define(["@jupyter-widgets/base"], function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
/******/
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

	module.exports = {};
	
	var loadedModules = [
	    __webpack_require__(1),
	    //require("./ngl.js"),
	]
	
	for (var i in loadedModules) {
	    if (loadedModules.hasOwnProperty(i)) {
	        var loadedModule = loadedModules[i];
	        for (var target_name in loadedModule) {
	            if (loadedModule.hasOwnProperty(target_name)) {
	                module.exports[target_name] = loadedModule[target_name];
	            }
	        }
	    }
	}
	
	module.exports['version'] = __webpack_require__(39).version;


/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

	var widgets = __webpack_require__(2);
	var NGL = __webpack_require__(3);
	var $ = __webpack_require__(11);
	var _ = __webpack_require__(12);
	__webpack_require__(13);
	__webpack_require__(23);
	__webpack_require__(25);
	
	var Jupyter;
	if (typeof window !== 'undefined') {
	  Jupyter = window['Jupyter'] = window['Jupyter'] || {};
	} else {
	  Jupyter = Jupyter || {};
	}
	
	var NGLView = widgets.DOMWidgetView.extend({
	    defaults: function() {
	        // _view_module_version must be synced with nglview/widget.py and
	        // js/package.json
	        // FIXME: avoid manual sync?
	        return _.extend(widgets.DOMWidgetModel.prototype.defaults(), {
	            _view_name: "NGLView",
	            _view_module: "nglview-js-widgets",
	            _view_module_version: "0.5.4-dev.8",
	        });
	    },
	
	    render: function() {
	
	        // init representations handling
	        this.model.on("change:_init_representations", this.representationsChanged, this);
	
	        // init setting of frame
	        this.model.on("change:frame", this.frameChanged, this);
	
	        // init setting of frame
	        this.model.on("change:count", this.countChanged, this);
	
	        // init _parameters handling
	        this.model.on("change:_parameters", this.parametersChanged, this);
	
	        // init orientation handling
	        this.model.on("change:orientation", this.orientationChanged, this);
	
	        this.model.set('_ngl_version', NGL.Version);
	
	        // for player
	        this.delay = 100;
	        this.sync_frame = false;
	        this.sync_camera = false;
	
	        // get message from Python
	        this.model.on("msg:custom", function(msg) {
	            this.on_msg(msg);
	        }, this);
	
	        if (this.model.comm) {
	            // for embeding in website
	            this.model.comm.on_msg(function(msg) {
	                var buffers = msg.buffers;
	                var content = msg.content.data.content;
	                if (buffers.length && content) {
	                    content.buffers = buffers;
	                }
	                this.model._handle_comm_msg.call(this.model, msg);
	            }.bind(this));
	        }
	
	        // init NGL stage
	        NGL.useWorker = false;
	        this.stage = new NGL.Stage(undefined, {
	            backgroundColor: "white"
	        });
	        this.structureComponent = undefined;
	        this.$container = $(this.stage.viewer.container);
	        this.$el.append(this.$container);
	        this.$container.resizable({
	            resize: function(event, ui) {
	                this.setSize(ui.size.width + "px", ui.size.height + "px");
	            }.bind(this)
	        });
	        this.displayed.then(function() {
	            var width = this.$el.parent().width() + "px";
	            var height = "300px";
	
	            this.setSize(width, height);
	            this.$container.resizable(
	                "option", "maxWidth", this.$el.parent().width()
	            );
	            this.requestUpdateStageParameters();
	        }.bind(this));
	
	        this.stage.viewerControls.signals.changed.add(function() {
	            if (this.sync_camera) {
	                this.model.set('_scene_position', this.stage.viewerControls.position)
	                this.model.set('_scene_rotation', this.stage.viewerControls.rotation)
	                this.touch();
	            }
	        }.bind(this));
	
	        // init toggle fullscreen
	        $(this.stage.viewer.container).dblclick(function() {
	            this.stage.toggleFullscreen();
	        }.bind(this));
	
	        // init picking handling
	        this.$pickingInfo = $("<div></div>")
	            .css("position", "absolute")
	            .css("top", "5%")
	            .css("left", "3%")
	            .css("background-color", "white")
	            .css("padding", "2px 5px 2px 5px")
	            .css("opacity", "0.7")
	            .appendTo(this.$container);
	
	        var $inputNotebookCommand = $('<input id="input_notebook_command" type="text"></input>');
	        var that = this;
	
	        $inputNotebookCommand.keypress(function(e) {
	            var command = $("#input_notebook_command").val();
	            if (e.which == 13) {
	                $("#input_notebook_command").val("")
	                Jupyter.notebook.kernel.execute(command);
	            }
	        });
	
	        this.$notebook_text = $("<div></div>")
	            .css("position", "absolute")
	            .css("bottom", "5%")
	            .css("left", "3%")
	            .css("padding", "2px 5px 2px 5px")
	            .css("opacity", "0.7")
	            .append($inputNotebookCommand)
	            .appendTo(this.$container);
	        this.$notebook_text.hide();
	
	        this.stage.signals.clicked.add(function(pd) {
	            if (pd) {
	                var pd2 = {};
	                if (pd.atom) pd2.atom = pd.atom.toObject();
	                if (pd.bond) pd2.bond = pd.bond.toObject();
	                if (pd.instance) pd2.instance = pd.instance;
	                this.model.set("picked", pd2);
	                this.touch();
	                var pickingText = "";
	                if (pd.atom) {
	                    pickingText = "Atom: " + pd.atom.qualifiedName();
	                } else if (pd.bond) {
	                    pickingText = "Bond: " + pd.bond.atom1.qualifiedName() + " - " + pd.bond.atom2.qualifiedName();
	                }
	                this.$pickingInfo.text(pickingText);
	            }
	        }, this);
	
	        this.initPlayer();
	
	        var container = this.stage.viewer.container;
	        that = this;
	        container.addEventListener('dragover', function(e) {
	            e.stopPropagation();
	            e.preventDefault();
	            e.dataTransfer.dropEffect = 'copy';
	        }, false);
	
	        container.addEventListener('drop', function(e) {
	            e.stopPropagation();
	            e.preventDefault();
	            var file = e.dataTransfer.files[0];
	
	            that.stage.loadFile(file).then(function(o){
	                that.makeDefaultRepr(o);
	                that._handle_loading_file_finished();
	            });
	            var numDroppedFiles = that.model.get("_n_dragged_files");
	            that.model.set("_n_dragged_files", numDroppedFiles + 1);
	            that.touch();
	        }, false);
	
	        that = this;
	        this.stage.signals.componentAdded.add(function() {
	            var len = this.stage.compList.length;
	            this.model.set("n_components", len);
	            this.touch();
	            var comp = this.stage.compList[len - 1];
	            comp.signals.representationRemoved.add(function() {
	                that.request_repr_dict();
	            });
	            comp.signals.representationAdded.add(function() {
	                that.request_repr_dict();
	            });
	        }, this);
	
	        this.stage.signals.componentRemoved.add(function() {
	            this.model.set("n_components", this.stage.compList.length);
	            this.touch();
	        }, this);
	
	        // for callbacks from Python
	        // must be after initializing NGL.Stage
	        this.send({
	            'type': 'request_loaded',
	            'data': true
	        })
	        var state_params = this.stage.getParameters();
	        this.model.set('_original_stage_parameters', state_params);
	        this.touch();
	    },
	
	    setSelector: function(selector_id) {
	        // id is uuid that will be set from Python
	        var selector = "<div class='" + selector_id + "'></div>";
	        this.$ngl_selector = $(selector)
	            .css("position", "absolute")
	            .css("bottom", "5%")
	            .css("left", "3%")
	            .css("padding", "2px 5px 2px 5px")
	            .css("opacity", "0.7")
	            .appendTo(this.$container);
	    },
	
	    setIPythonLikeCell: function() {
	        var cell = Jupyter.notebook.insert_cell_at_bottom();
	
	        var handler = function(event) {
	            var selected_cell = Jupyter.notebook.get_selected_cell();
	            if (selected_cell.cell_id === cell.cell_id) {
	                selected_cell.execute();
	                selected_cell.set_text('');
	            }
	            event; // to pass eslint
	            return false;
	        };
	
	        var action = {
	            help: 'run cell',
	            help_index: 'zz',
	            handler: handler
	        };
	
	        Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('enter', action);
	    },
	
	    hideNotebookCommandBox: function() {
	        this.$notebook_text.hide();
	    },
	
	    showNotebookCommandBox: function() {
	        this.$notebook_text.show();
	    },
	
	    requestFrame: function() {
	        this.send({
	            'type': 'request_frame',
	            'data': 'frame'
	        });
	    },
	
	    requestUpdateStageParameters: function() {
	        var updated_params = this.stage.getParameters();
	        this.model.set('_full_stage_parameters', updated_params);
	        this.touch();
	    },
	
	    requestReprParameters: function(component_index, repr_index) {
	        var comp = this.stage.compList[component_index];
	        var repr = comp.reprList[repr_index];
	        var msg = repr.repr.getParameters();
	
	        if (msg) {
	            msg['name'] = repr.name;
	            this.send({
	                'type': 'repr_parameters',
	                'data': msg
	            });
	        }
	    },
	
	    request_repr_dict: function() {
	        var n_components = this.stage.compList.length;
	        var msg = {};
	
	        for (var i = 0; i < n_components; i++) {
	            var comp = this.stage.compList[i];
	            msg['c' + i] = {};
	            var msgi = msg['c' + i];
	            for (var j = 0; j < comp.reprList.length; j++) {
	                var repr = comp.reprList[j];
	                msgi[j] = {};
	                msgi[j]['type'] = repr.name;
	                msgi[j]['params'] = repr.repr.getParameters();
	            }
	        }
	        this.send({
	            'type': 'request_repr_dict',
	            'data': msg
	        });
	    },
	
	    // setDraggable: function(params) {
	    //     if (params) {
	    //         this.$container.draggable(params);
	    //     } else {
	    //         this.$container.draggable();
	    //     }
	    // },
	    setDelay: function(delay) {
	        this.delay = delay;
	    },
	
	    setSyncFrame: function() {
	        this.sync_frame = true;
	    },
	
	    setUnSyncFrame: function() {
	        this.sync_frame = false;
	    },
	
	    setSyncCamera: function() {
	        this.sync_camera = true;
	    },
	
	    setUnSyncCamera: function() {
	        this.sync_camera = false;
	    },
	
	    viewXZPlane: function() {
	        var m = new NGL.Matrix4().makeRotationX( Math.PI / 2 );
	        var q = new NGL.Quaternion().setFromRotationMatrix( m );
	        this.stage.viewerControls.rotate( q );
	    },
	
	    makeDefaultRepr: function(o) {
	        var reprDefList = this.model.get("_init_representations");
	        reprDefList.forEach(function(reprDef) {
	            o.addRepresentation(reprDef.type, reprDef.params);
	        });
	
	        if (this.stage.compList.length < 2) {
	            o.autoView(100);
	        }
	    },
	
	
	    initPlayer: function() {
	        // init player
	        if (this.model.get("count")) {
	            var play = function() {
	                this.$playerButton.text("pause");
	                this.playerInterval = setInterval(function() {
	                    var frame = this.model.get("frame") + 1;
	                    var count = this.model.get("count");
	                    if (frame >= count) frame = 0;
	
	                    if (this.sync_frame) {
	                        this.model.set("frame", frame);
	                        this.touch();
	                    } else {
	                        this.requestFrame();
	                    }
	                }.bind(this), this.delay);
	            }.bind(this);
	            var pause = function() {
	                this.$playerButton.text("play");
	                if (this.playerInterval !== undefined) {
	                    clearInterval(this.playerInterval);
	                }
	            }.bind(this);
	            this.$playerButton = $("<button>play</button>")
	                .css("float", "left")
	                .css("width", "55px")
	                .css("opacity", "0.7")
	                .click(function(event) {
	                    if (this.$playerButton.text() === "play") {
	                        play();
	                    } else if (this.$playerButton.text() === "pause") {
	                        pause();
	                    }
	                    event; // to pass eslint
	                }.bind(this));
	            this.$playerSlider = $("<div></div>")
	                .css("margin-left", "70px")
	                .css("position", "relative")
	                .css("bottom", "-7px")
	                .slider({
	                    min: 0,
	                    max: this.model.get("count") - 1,
	                    slide: function(event, ui) {
	                        pause();
	                        this.model.set("frame", ui.value);
	                        this.touch();
	                    }.bind(this)
	                });
	            this.$player = $("<div></div>")
	                .css("position", "absolute")
	                .css("bottom", "5%")
	                .css("width", "94%")
	                .css("margin-left", "3%")
	                .css("opacity", "0.7")
	                .append(this.$playerButton)
	                .append(this.$playerSlider)
	                .appendTo(this.$container);
	            this.model.on("change:frame", function() {
	                this.$playerSlider.slider("value", this.model.get("frame"));
	            }, this);
	
	            if (this.model.get("count") < 2) {
	                this.$player.hide()
	            }
	        }
	    },
	
	    countChanged: function() {
	        var count = this.model.get("count");
	        this.$playerSlider.slider({
	            max: count - 1
	        });
	        if (this.model.get("count") > 1) {
	            this.$player.show()
	        }
	    },
	
	    representationsChanged: function() {
	        var representations = this.model.get("_init_representations");
	        var component;
	
	        for (var i = 0; i < this.stage.compList.length; i++) {
	            component = this.stage.compList[i];
	            if (representations && component) {
	                component.clearRepresentations();
	                representations.forEach(function(repr) {
	                    component.addRepresentation(repr.type, repr.params);
	                });
	            }
	        }
	    },
	
	    setVisibilityForRepr: function(component_index, repr_index, value) {
	        // value = True/False
	        var component = this.stage.compList[component_index];
	        var repr = component.reprList[repr_index];
	
	        if (repr) {
	            repr.setVisibility(value);
	        }
	    },
	
	    removeRepresentation: function(component_index, repr_index) {
	        var component = this.stage.compList[component_index];
	        var repr = component.reprList[repr_index]
	
	        if (repr) {
	            component.removeRepresentation(repr);
	        }
	    },
	
	    removeRepresentationsByName: function(repr_name, component_index) {
	        var component = this.stage.compList[component_index];
	
	        if (component) {
	            component.reprList.forEach(function(repr) {
	                if (repr.name == repr_name) {
	                    component.removeRepresentation(repr);
	                }
	            })
	        }
	    },
	
	    updateRepresentationForComponent: function(repr_index, component_index, params) {
	        var component = this.stage.compList[component_index];
	        var that = this;
	        console.log('component', component);
	        var repr = component.reprList[repr_index];
	        if (repr) {
	            repr.setParameters(params);
	            that.request_repr_dict();
	        }
	    },
	
	    updateRepresentationsByName: function(repr_name, component_index, params) {
	        var component = this.stage.compList[component_index];
	        var that = this;
	
	        if (component) {
	            console.log('updateRepresentationsByName');
	            component.reprList.forEach(function(repr) {
	                if (repr.name == repr_name) {
	                    repr.setParameters(params);
	                    that.request_repr_dict();
	                }
	            })
	        }
	    },
	
	    setRepresentation: function(name, params, component_index, repr_index) {
	        var component = this.stage.compList[component_index];
	        var repr = component.reprList[repr_index];
	        var that = this;
	
	        if (repr) {
	            params['useWorker'] = false;
	            var new_repr = NGL.makeRepresentation(name, component.structure,
	                this.stage.viewer, params);
	            if (new_repr) {
	                repr.setRepresentation(new_repr);
	                repr.name = name;
	                component.reprList[repr_index] = repr;
	                that.request_repr_dict();
	            }
	        }
	    },
	
	    setColorByResidue: function(colors, component_index, repr_index){
	        var repr = this.stage.compList[component_index].reprList[repr_index];
	        var schemeId = NGL.ColorMakerRegistry.addScheme(function(params){
	            this.atomColor = function(atom){
	                 var color = colors[atom.residueIndex];
	                 return color
	            };
	            params; // to pass eslint; ack;
	        });
	        repr.setColor(schemeId);
	    },
	
	    addShape: function(name, shapes) {
	        // shapes: List[Tuple[str, ...]]
	        // e.g: [('sphere', ...), ('cone', ...)]
	        console.log('shapes', shapes);
	        console.log('name', name);
	        var shape = new NGL.Shape(name);
	        var shape_dict = {
	            'sphere': shape.addSphere,
	            'ellipsoid': shape.addEllipsoid,
	            'cylinder': shape.addCylinder,
	            'cone': shape.addCone,
	            'mesh': shape.addMesh,
	            'arrow': shape.addArrow,
	            'text': shape.addText,
	            'label': shape.addText
	        };
	        for (var i = 0; i < shapes.length; i++) {
	            var shapes_i = shapes[i]
	            var shape_type = shapes_i[0];
	            var params = shapes_i.slice(1, shapes_i.length);
	            // e.g params = ('sphere', [ 0, 0, 9 ], [ 1, 0, 0 ], 1.5)
	
	            var func = shape_dict[shape_type];
	            console.log('func', func);
	            func.apply(shape, params);
	            // shape.func(params);
	        }
	        var shapeComp = this.stage.addComponentFromObject(shape);
	        shapeComp.addRepresentation("buffer");
	    },
	
	    replaceStructure: function(structure){
	         var blob = new Blob([structure.data], {type: "text/plain"});
	         var params = structure.params || {};
	         params.ext = structure.ext;
	         params.defaultRepresentation = false;
	         var comp = this.stage.compList[0];
	         var representations = comp.reprList.slice();
	         var old_orientation = this.stage.viewerControls.getOrientation();
	         var that = this;
	         this.stage.loadFile(blob, params).then(function(component) {
	             that.stage.viewerControls.orient(old_orientation);
	             representations.forEach(function(repr) {
	                 var repr_name = repr.name;
	                 var repr_params = repr.repr.getParameters();
	                 // Note: not using repr.repr.type, repr.repr.params
	                 // since seems to me that repr.repr.params won't return correct "sele"
	                 component.addRepresentation(repr_name, repr_params);
	             });
	             that.stage.removeComponent(comp);
	             that._handle_loading_file_finished();
	         });
	    },
	
	    superpose: function(cindex0, cindex1, align, sele0, sele1) {
	        // superpose two components with given params
	        var component0 = this.stage.compList[cindex0];
	        var component1 = this.stage.compList[cindex1];
	        component1.superpose(component0, align, sele0, sele1);
	    },
	
	    decode_base64: function(base64) {
	        // lightly adapted from Niklas
	
	        /*
	         * base64-arraybuffer
	         * https://github.com/niklasvh/base64-arraybuffer
	         *
	         * Copyright (c) 2012 Niklas von Hertzen
	         * Licensed under the MIT license.
	         */
	        var chars =
	            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
	        var bufferLength = base64.length * 0.75,
	            len = base64.length,
	            i, p = 0,
	            encoded1, encoded2, encoded3, encoded4;
	
	        if (base64[base64.length - 1] === "=") {
	            bufferLength--;
	            if (base64[base64.length - 2] === "=") {
	                bufferLength--;
	            }
	        }
	
	        var arraybuffer = new ArrayBuffer(bufferLength),
	            bytes = new Uint8Array(arraybuffer);
	
	        for (i = 0; i < len; i += 4) {
	            encoded1 = chars.indexOf(base64[i]);
	            encoded2 = chars.indexOf(base64[i + 1]);
	            encoded3 = chars.indexOf(base64[i + 2]);
	            encoded4 = chars.indexOf(base64[i + 3]);
	
	            bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
	            bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
	            bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
	        }
	
	        return arraybuffer;
	    },
	
	    updateCoordinates: function(coordinates, model) {
	        // coordinates must be ArrayBuffer (use this.decode_base64)
	        var component = this.stage.compList[model];
	        if (coordinates && component) {
	            var coords = new Float32Array(coordinates);
	            component.structure.updatePosition(coords);
	            component.updateRepresentations({
	                "position": true
	            });
	        }
	    },
	
	    handleResize: function() {
	        this.$container.resizable({
	            resize: function(event, ui) {
	                this.setSize(ui.size.width + "px", ui.size.height + "px");
	            }.bind(this)
	        })
	    },
	
	    setSize: function(width, height) {
	        this.stage.viewer.container.style.width = width;
	        this.stage.viewer.container.style.height = height;
	        this.stage.handleResize();
	    },
	
	    openNotebookCommandDialog: function() {
	        var that = this;
	        var dialog = this.$notebook_text.dialog({
	            draggable: true,
	            resizable: true,
	            modal: false,
	            show: {
	                effect: "blind",
	                duration: 150
	            },
	            close: function(event, ui) {
	                that.$container.append(that.$notebook_text);
	                that.$notebook_text.dialog('destroy');
	                event; ui; // to pass eslint; ack;
	            },
	        });
	        dialog.css({
	            overflow: 'hidden'
	        });
	        dialog.prev('.ui-dialog-titlebar')
	            .css({
	                'background': 'transparent',
	                'border': 'none'
	            });
	        Jupyter.keyboard_manager.register_events(dialog);
	    },
	
	    setDialog: function() {
	        var $nb_container = Jupyter.notebook.container;
	        var that = this;
	        var dialog = this.$container.dialog({
	            title: "NGLView",
	            draggable: true,
	            resizable: true,
	            modal: false,
	            width: window.innerWidth - $nb_container.width() - $nb_container.offset().left - 50,
	            height: 'auto',
	            position: {
	                my: 'right',
	                at: 'right',
	                of: window
	            },
	            show: {
	                effect: "blind",
	                duration: 150
	            },
	            close: function(event, ui) {
	                that.$el.append(that.$container);
	                that.$container.dialog('destroy');
	                that.handleResize();
	                event; ui; // to pass eslint; ack;
	            },
	            resize: function(event, ui) {
	                that.stage.handleResize();
	                that.setSize(ui.size.width + "px", ui.size.height + "px");
	            }.bind(that),
	        });
	        dialog.css({
	            overflow: 'hidden'
	        });
	        dialog.prev('.ui-dialog-titlebar')
	            .css({
	                'background': 'transparent',
	                'border': 'none'
	            });
	    },
	
	    resizeNotebook: function(width) {
	        var $nb_container = Jupyter.notebook.container;
	        $nb_container.width(width);
	
	        if (this.$container.dialog) {
	            this.$container.dialog({
	                width: $nb_container.offset().left
	            });
	        }
	    },
	
	    parametersChanged: function() {
	        var _parameters = this.model.get("_parameters");
	        this.setParameters(_parameters);
	    },
	
	    setParameters: function(parameters) {
	        this.stage.setParameters(parameters);
	
	        // do not set _full_stage_parameters here
	        // or parameters will be never updated (not sure why) 
	        // use observe in python side
	        var updated_params = this.stage.getParameters();
	        this.send({
	            'type': 'stage_parameters',
	            'data': updated_params
	        })
	    },
	
	    orientationChanged: function() {
	        var orientation_list = this.model.get("orientation");
	        var mat4 = this.stage.viewerControls.getOrientation();
	        mat4.set(orientation_list);
	        this.stage.viewerControls.orient(mat4);
	    },
	
	    _downloadImage: function(filename, params) {
	        this.stage.makeImage(params).then(function(blob) {
	            NGL.download(blob, filename);
	        })
	    },
	
	    _exportImage: function(params) {
	        this.stage.makeImage(params).then(function(blob) {
	            var reader = new FileReader();
	            var arr_str;
	            reader.onload = function() {
	                arr_str = reader.result.replace("data:image/png;base64,", "");
	                this.model.set("_image_data", arr_str);
	                this.touch();
	            }.bind(this);
	            reader.readAsDataURL(blob);
	        }.bind(this));
	    },
	
	    cleanOutput: function() {
	
	        var cells = Jupyter.notebook.get_cells();
	
	        for (var i = 0; i < cells.length; i++) {
	            var cell = cells[i];
	            if (cell.output_area.outputs.length > 0) {
	                var out = cell.output_area.outputs[0];
	                if (out.output_type == 'display_data') {
	                    cell.clear_output();
	                }
	            }
	        }
	    },
	
	    _handle_loading_file_finished: function() {
	        this.send({'type': 'async_message', 'data': 'ok'});
	    },
	    
	    _handle_stage_loadFile: function(msg){
	            // args = [{'type': ..., 'data': ...}]
	         var args0 = msg.args[0];
	         var that = this;
	         if (args0.type == 'blob') {
	             var blob;
	             if (args0.binary) {
	                 var decoded_data = this.decode_base64(args0.data);
	                 blob = new Blob([decoded_data], {
	                     type: "application/octet-binary"
	                 });
	             } else {
	                 blob = new Blob([args0.data], {
	                     type: "text/plain"
	                 });
	             }
	             this.stage.loadFile(blob, msg.kwargs).then(function(o){
	                  that._handle_loading_file_finished();
	                  o; // to pass eslint; ack;
	             });
	         } else {
	             this.stage.loadFile(msg.args[0].data, msg.kwargs).then(function(o){
	                  that._handle_loading_file_finished();
	                  o; // to pass eslint; ack;
	             });
	         }
	    },
	
	    on_msg: function(msg) {
	        // TODO: re-organize
	        if (msg.type == 'call_method') {
	            var index, component, func, stage;
	            var new_args = msg.args.slice();
	            new_args.push(msg.kwargs);
	
	            switch (msg.target) {
	                case 'Stage':
	                    var stage_func = this.stage[msg.methodName];
	                    stage = this.stage;
	                    if (msg.methodName == 'screenshot') {
	                        NGL.screenshot(this.stage.viewer, msg.kwargs);
	                    } else if (msg.methodName == 'removeComponent') {
	                        index = msg.args[0];
	                        component = this.stage.compList[index];
	                        this.stage.removeComponent(component);
	                    } else if (msg.methodName == 'loadFile') {
	                        this._handle_stage_loadFile(msg);
	                    } else {
	                            stage_func.apply(stage, new_args);
	                    }
	                    break;
	                case 'Viewer':
	                    var viewer = this.stage.viewer;
	                    func = this.stage.viewer[msg.methodName];
	                    func.apply(viewer, new_args);
	                    break;
	                case 'viewerControls':
	                    var controls = this.stage.viewerControls;
	                    func = controls[msg.methodName];
	                    func.apply(controls, new_args);
	                    break;
	                case 'compList':
	                    index = msg['component_index'];
	                    component = this.stage.compList[index];
	                    func = component[msg.methodName];
	                    func.apply(component, new_args);
	                    break;
	                case 'StructureComponent':
	                    component = this.structureComponent;
	                    func = component[msg.methodName];
	                    func.apply(component, new_args);
	                    break;
	                case 'Widget':
	                    func = this[msg.methodName];
	                    if (func) {
	                        func.apply(this, new_args);
	                    } else {
	                        // send error message to Python?
	                        console.log('can not create func for ' + msg.methodName);
	                    }
	                    break;
	                case 'player':
	                    func = this.$player[msg.methodName];
	                    if (func) {
	                        func.apply(this.$player, new_args);
	                    } else {
	                        // send error message to Python?
	                        console.log('can not create func for ' + msg.methodName);
	                    }
	                    break;
	                case 'Representation':
	                    var component_index = msg['component_index'];
	                    var repr_index = msg['repr_index'];
	                    component = this.stage.compList[component_index];
	                    var repr = component.reprList[repr_index];
	                    func = repr[msg.methodName];
	                    if (repr && func) {
	                        func.apply(repr, new_args);
	                    }
	                    break;
	                default:
	                    console.log('there is no method for ' + msg.target);
	                    break;
	            }
	        } else if (msg.type == 'base64_single') {
	            var coordinatesDict = msg.data;
	            var keys = Object.keys(coordinatesDict);
	
	            for (var i = 0; i < keys.length; i++) {
	                var traj_index = keys[i];
	                var coordinates = this.decode_base64(coordinatesDict[traj_index]);
	                if (coordinates.byteLength > 0) {
	                    this.updateCoordinates(coordinates, traj_index);
	                }
	            }
	        } else if (msg.type == 'binary_single') {
	            var coordinateMeta = msg.data;
	            keys = Object.keys(coordinateMeta);
	
	            for (i = 0; i < keys.length; i++) {
	                traj_index = keys[i];
	                coordinates = new Float32Array(msg.buffers[i].buffer);
	                if (coordinates.byteLength > 0) {
	                    this.updateCoordinates(coordinates, traj_index);
	                }
	            }
	        } else if (msg.type == 'get') {
	            if (msg.data == 'camera') {
	                this.send(JSON.stringify(this.stage.viewer.camera));
	            } else if (msg.data == 'parameters') {
	                this.send(JSON.stringify(this.stage.parameters));
	            } else {
	                for (i = 0; i < this.stage.compList.length; i++) {
	                    console.log(this.stage.compList[i]);
	                }
	            }
	        }
	    },
	});
	
	module.exports = {
	    'NGLView': NGLView,
	    'NGL': NGL,
	};


/***/ }),
/* 2 */
/***/ (function(module, exports) {

	module.exports = __WEBPACK_EXTERNAL_MODULE_2__;

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

	/* WEBPACK VAR INJECTION */(function(setImmediate, Buffer) {!function(t,e){ true?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.NGL=t.NGL||{})}(this,function(t){"use strict";function e(){}function r(t,e){return function(){t.apply(e,arguments)}}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function n(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,Wu(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var i;try{i=r(t._value)}catch(t){return void a(e.promise,t)}o(e.promise,i)}else(1===t._state?o:a)(e.promise,t._value)})):t._deferreds.push(e)}function o(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void s(t);if("function"==typeof n)return void u(r(n,e),t)}t._state=1,t._value=e,s(t)}catch(e){a(t,e)}}function a(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&Wu(function(){t._handled||Xu(t._value)});for(var e=0,r=t._deferreds.length;e<r;e++)n(t,t._deferreds[e]);t._deferreds=null}function c(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function u(t,e){var r=!1;try{t(function(t){r||(r=!0,o(e,t))},function(t){r||(r=!0,a(e,t))})}catch(t){if(r)return;r=!0,a(e,t)}}function h(){}function l(t,e){this.x=t||0,this.y=e||0}function p(t,e,r,i,n,o,a,s,c,u){Object.defineProperty(this,"id",{value:Ql++}),this.uuid=Kl.generateUUID(),this.name="",this.image=void 0!==t?t:p.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:p.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:el,this.wrapT=void 0!==i?i:el,this.magFilter=void 0!==n?n:al,this.minFilter=void 0!==o?o:cl,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:Sl,this.type=void 0!==s?s:ul,this.offset=new l(0,0),this.repeat=new l(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:Gl,this.version=0,this.onUpdate=null}function d(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1}function f(t,e,r){this.uuid=Kl.generateUUID(),this.width=t,this.height=e,this.scissor=new d(0,0,t,e),this.scissorTest=!1,this.viewport=new d(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=al),this.texture=new p(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function m(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1}function g(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0}function v(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function y(t,e,r,i,n,o,a,s,c,u,h,l){p.call(this,null,o,a,s,c,u,i,n,h,l),this.image={data:t,width:e,height:r},this.magFilter=void 0!==c?c:il,this.minFilter=void 0!==u?u:il,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function b(t,e,r,i,n,o,a,s,c,u){t=void 0!==t?t:[],e=void 0!==e?e:Xh,p.call(this,t,e,r,i,n,o,a,s,c,u),this.flipY=!1}function x(){this.seq=[],this.map={}}function _(t,e,r){var i=t[0];if(i<=0||i>0)return t;var n=e*r,o=ep[n];if(void 0===o&&(o=new Float32Array(n),ep[n]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=r,t[a].toArray(o,s)}return o}function w(t,e){var r=rp[e];void 0===r&&(r=new Int32Array(e),rp[e]=r);for(var i=0;i!==e;++i)r[i]=t.allocTextureUnit();return r}function S(t,e){t.uniform1f(this.addr,e)}function A(t,e){t.uniform1i(this.addr,e)}function M(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function T(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function E(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function P(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function C(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(np.set(e.elements),t.uniformMatrix3fv(this.addr,!1,np))}function I(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(ip.set(e.elements),t.uniformMatrix4fv(this.addr,!1,ip))}function R(t,e,r){var i=r.allocTextureUnit();t.uniform1i(this.addr,i),r.setTexture2D(e||Jl,i)}function L(t,e,r){var i=r.allocTextureUnit();t.uniform1i(this.addr,i),r.setTextureCube(e||tp,i)}function O(t,e){t.uniform2iv(this.addr,e)}function D(t,e){t.uniform3iv(this.addr,e)}function N(t,e){t.uniform4iv(this.addr,e)}function k(t){switch(t){case 5126:return S;case 35664:return M;case 35665:return T;case 35666:return E;case 35674:return P;case 35675:return C;case 35676:return I;case 35678:case 36198:return R;case 35680:return L;case 5124:case 35670:return A;case 35667:case 35671:return O;case 35668:case 35672:return D;case 35669:case 35673:return N}}function F(t,e){t.uniform1fv(this.addr,e)}function B(t,e){t.uniform1iv(this.addr,e)}function z(t,e){t.uniform2fv(this.addr,_(e,this.size,2))}function U(t,e){t.uniform3fv(this.addr,_(e,this.size,3))}function j(t,e){t.uniform4fv(this.addr,_(e,this.size,4))}function G(t,e){t.uniformMatrix2fv(this.addr,!1,_(e,this.size,4))}function V(t,e){t.uniformMatrix3fv(this.addr,!1,_(e,this.size,9))}function $(t,e){t.uniformMatrix4fv(this.addr,!1,_(e,this.size,16))}function H(t,e,r){var i=e.length,n=w(r,i);t.uniform1iv(this.addr,n);for(var o=0;o!==i;++o)r.setTexture2D(e[o]||Jl,n[o])}function W(t,e,r){var i=e.length,n=w(r,i);t.uniform1iv(this.addr,n);for(var o=0;o!==i;++o)r.setTextureCube(e[o]||tp,n[o])}function X(t){switch(t){case 5126:return F;case 35664:return z;case 35665:return U;case 35666:return j;case 35674:return G;case 35675:return V;case 35676:return $;case 35678:return H;case 35680:return W;case 5124:case 35670:return B;case 35667:case 35671:return O;case 35668:case 35672:return D;case 35669:case 35673:return N}}function q(t,e,r){this.id=t,this.addr=r,this.setValue=k(e.type)}function Y(t,e,r){this.id=t,this.addr=r,this.size=e.size,this.setValue=X(e.type)}function Z(t){this.id=t,x.call(this)}function K(t,e){t.seq.push(e),t.map[e.id]=e}function Q(t,e,r){var i=t.name,n=i.length;for(op.lastIndex=0;;){var o=op.exec(i),a=op.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===n){K(r,void 0===u?new q(s,t,e):new Y(s,t,e));break}var h=r.map[s];void 0===h&&K(r,h=new Z(s)),r=h}}function J(t,e,r){var i=this;x.call(this),this.renderer=r;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),o=0;o<n;++o){var a=t.getActiveUniform(e,o),s=a.name;Q(a,t.getUniformLocation(e,s),i)}}function tt(t,e,r){return void 0===e&&void 0===r?this.set(t):this.setRGB(t,e,r)}function et(t,e){this.min=void 0!==t?t:new l(1/0,1/0),this.max=void 0!==e?e:new l(-1/0,-1/0)}function rt(t,e){function r(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);n=d.createBuffer(),o=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,n),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),h=d.createTexture(),p=d.createTexture(),f.bindTexture(d.TEXTURE_2D,h),d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),f.bindTexture(d.TEXTURE_2D,p),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,16,16,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),a={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =        visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},s=i(a),c={vertex:d.getAttribLocation(s,"position"),uv:d.getAttribLocation(s,"uv")},u={renderType:d.getUniformLocation(s,"renderType"),map:d.getUniformLocation(s,"map"),occlusionMap:d.getUniformLocation(s,"occlusionMap"),opacity:d.getUniformLocation(s,"opacity"),color:d.getUniformLocation(s,"color"),scale:d.getUniformLocation(s,"scale"),rotation:d.getUniformLocation(s,"rotation"),screenPosition:d.getUniformLocation(s,"screenPosition")}}function i(e){var r=d.createProgram(),i=d.createShader(d.FRAGMENT_SHADER),n=d.createShader(d.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return d.shaderSource(i,o+e.fragmentShader),d.shaderSource(n,o+e.vertexShader),d.compileShader(i),d.compileShader(n),d.attachShader(r,i),d.attachShader(r,n),d.linkProgram(r),r}var n,o,a,s,c,u,h,p,d=t.context,f=t.state;this.render=function(i,a,m){if(0!==e.length){var v=new g,y=m.w/m.z,b=.5*m.z,x=.5*m.w,_=16/m.w,w=new l(_*y,_),S=new g(1,1,0),A=new l(1,1),M=new et;M.min.set(m.x,m.y),M.max.set(m.x+(m.z-16),m.y+(m.w-16)),void 0===s&&r(),d.useProgram(s),f.initAttributes(),f.enableAttribute(c.vertex),f.enableAttribute(c.uv),f.disableUnusedAttributes(),d.uniform1i(u.occlusionMap,0),d.uniform1i(u.map,1),d.bindBuffer(d.ARRAY_BUFFER,n),d.vertexAttribPointer(c.vertex,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),f.disable(d.CULL_FACE),f.buffers.depth.setMask(!1);for(var T=0,E=e.length;T<E;T++){_=16/m.w,w.set(_*y,_);var P=e[T];if(v.set(P.matrixWorld.elements[12],P.matrixWorld.elements[13],P.matrixWorld.elements[14]),v.applyMatrix4(a.matrixWorldInverse),v.applyMatrix4(a.projectionMatrix),S.copy(v),A.x=m.x+S.x*b+b-8,A.y=m.y+S.y*x+x-8,!0===M.containsPoint(A)){f.activeTexture(d.TEXTURE0),f.bindTexture(d.TEXTURE_2D,null),f.activeTexture(d.TEXTURE1),f.bindTexture(d.TEXTURE_2D,h),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGB,A.x,A.y,16,16,0),d.uniform1i(u.renderType,0),d.uniform2f(u.scale,w.x,w.y),d.uniform3f(u.screenPosition,S.x,S.y,S.z),f.disable(d.BLEND),f.enable(d.DEPTH_TEST),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0),f.activeTexture(d.TEXTURE0),f.bindTexture(d.TEXTURE_2D,p),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,A.x,A.y,16,16,0),d.uniform1i(u.renderType,1),f.disable(d.DEPTH_TEST),f.activeTexture(d.TEXTURE1),f.bindTexture(d.TEXTURE_2D,h),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0),P.positionScreen.copy(S),P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares(),d.uniform1i(u.renderType,2),f.enable(d.BLEND);for(var C=0,I=P.lensFlares.length;C<I;C++){var R=P.lensFlares[C];R.opacity>.001&&R.scale>.001&&(S.x=R.x,S.y=R.y,S.z=R.z,_=R.size*R.scale/m.w,w.x=_*y,w.y=_,d.uniform3f(u.screenPosition,S.x,S.y,S.z),d.uniform2f(u.scale,w.x,w.y),d.uniform1f(u.rotation,R.rotation),d.uniform1f(u.opacity,R.opacity),d.uniform3f(u.color,R.color.r,R.color.g,R.color.b),f.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.buffers.depth.setMask(!0),t.resetGLState()}}}function it(t,e){function r(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=i(),c={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},u={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var n=r.getContext("2d");n.fillStyle="white",n.fillRect(0,0,8,8),(h=new p(r)).needsUpdate=!0}function i(){var e=l.createProgram(),r=l.createShader(l.VERTEX_SHADER),i=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(r,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(i,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(r),l.compileShader(i),l.attachShader(e,r),l.attachShader(e,i),l.linkProgram(e),e}function n(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,a,s,c,u,h,l=t.context,d=t.state,f=new g,v=new m,y=new g;this.render=function(i,p){if(0!==e.length){void 0===s&&r(),l.useProgram(s),d.initAttributes(),d.enableAttribute(c.position),d.enableAttribute(c.uv),d.disableUnusedAttributes(),d.disable(l.CULL_FACE),d.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(c.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(c.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(u.projectionMatrix,!1,p.projectionMatrix.elements),d.activeTexture(l.TEXTURE0),l.uniform1i(u.map,0);var m=0,g=0,b=i.fog;b?(l.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(l.uniform1f(u.fogNear,b.near),l.uniform1f(u.fogFar,b.far),l.uniform1i(u.fogType,1),m=1,g=1):b.isFogExp2&&(l.uniform1f(u.fogDensity,b.density),l.uniform1i(u.fogType,2),m=2,g=2)):(l.uniform1i(u.fogType,0),m=0,g=0);for(var x=0,_=e.length;x<_;x++)(S=e[x]).modelViewMatrix.multiplyMatrices(p.matrixWorldInverse,S.matrixWorld),S.z=-S.modelViewMatrix.elements[14];e.sort(n);for(var w=[],x=0,_=e.length;x<_;x++){var S=e[x],A=S.material;if(!1!==A.visible){S.onBeforeRender(t,i,p,void 0,A,void 0),l.uniform1f(u.alphaTest,A.alphaTest),l.uniformMatrix4fv(u.modelViewMatrix,!1,S.modelViewMatrix.elements),S.matrixWorld.decompose(f,v,y),w[0]=y.x,w[1]=y.y;var M=0;i.fog&&A.fog&&(M=g),m!==M&&(l.uniform1i(u.fogType,M),m=M),null!==A.map?(l.uniform2f(u.uvOffset,A.map.offset.x,A.map.offset.y),l.uniform2f(u.uvScale,A.map.repeat.x,A.map.repeat.y)):(l.uniform2f(u.uvOffset,0,0),l.uniform2f(u.uvScale,1,1)),l.uniform1f(u.opacity,A.opacity),l.uniform3f(u.color,A.color.r,A.color.g,A.color.b),l.uniform1f(u.rotation,A.rotation),l.uniform2fv(u.scale,w),d.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst,A.blendEquationAlpha,A.blendSrcAlpha,A.blendDstAlpha,A.premultipliedAlpha),d.buffers.depth.setTest(A.depthTest),d.buffers.depth.setMask(A.depthWrite),A.map?t.setTexture2D(A.map,0):t.setTexture2D(h,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),S.onAfterRender(t,i,p,void 0,A,void 0)}}d.enable(l.CULL_FACE),t.resetGLState()}}}function nt(){Object.defineProperty(this,"id",{value:lp++}),this.uuid=Kl.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=hh,this.side=eh,this.shading=oh,this.vertexColors=ah,this.opacity=1,this.transparent=!1,this.blendSrc=Ah,this.blendDst=Mh,this.blendEquation=mh,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Dh,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function ot(t){nt.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function at(t){nt.call(this),this.type="MeshDepthMaterial",this.depthPacking=Yl,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function st(t,e){this.min=void 0!==t?t:new g(1/0,1/0,1/0),this.max=void 0!==e?e:new g(-1/0,-1/0,-1/0)}function ct(t,e){this.center=void 0!==t?t:new g,this.radius=void 0!==e?e:0}function ut(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function ht(t,e){this.normal=void 0!==t?t:new g(1,0,0),this.constant=void 0!==e?e:0}function lt(t,e,r,i,n,o){this.planes=[void 0!==t?t:new ht,void 0!==e?e:new ht,void 0!==r?r:new ht,void 0!==i?i:new ht,void 0!==n?n:new ht,void 0!==o?o:new ht]}function pt(t,e,r,i){function n(e,r,i,n){var o=e.geometry,a=null,s=S,c=e.customDepthMaterial;if(i&&(s=A,c=e.customDistanceMaterial),c)a=c;else{var u=!1;r.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===r.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var h=e.isSkinnedMesh&&r.skinning,l=0;u&&(l|=x),h&&(l|=_),a=s[l]}if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var p=a.uuid,d=r.uuid,f=M[p];void 0===f&&(f={},M[p]=f);var m=f[d];void 0===m&&(m=a.clone(),f[d]=m),a=m}a.visible=r.visible,a.wireframe=r.wireframe;var g=r.side;return F.renderSingleSided&&g==ih&&(g=eh),F.renderReverseSided&&(g===eh?g=rh:g===rh&&(g=eh)),a.side=g,a.clipShadows=r.clipShadows,a.clippingPlanes=r.clippingPlanes,a.wireframeLinewidth=r.wireframeLinewidth,a.linewidth=r.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(n),a}function o(e,i,a,s){if(!1!==e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||c.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,e.matrixWorld);var u=r.update(e),h=e.material;if(Array.isArray(h))for(var l=u.groups,p=0,d=l.length;p<d;p++){var f=l[p],m=h[f.materialIndex];if(m&&m.visible){g=n(e,m,s,b);t.renderBufferDirect(a,null,u,g,e,f)}}else if(h.visible){var g=n(e,h,s,b);t.renderBufferDirect(a,null,u,g,e,null)}}for(var v=e.children,y=0,x=v.length;y<x;y++)o(v[y],i,a,s)}}var a=t.context,s=t.state,c=new lt,u=new v,h=e.shadows,p=new l,m=new l(i.maxTextureSize,i.maxTextureSize),y=new g,b=new g,x=1,_=2,w=1+(x|_),S=new Array(w),A=new Array(w),M={},T=[new g(1,0,0),new g(-1,0,0),new g(0,0,1),new g(0,0,-1),new g(0,1,0),new g(0,-1,0)],E=[new g(0,1,0),new g(0,1,0),new g(0,1,0),new g(0,1,0),new g(0,0,1),new g(0,0,-1)],P=[new d,new d,new d,new d,new d,new d],C=new at;C.depthPacking=Zl,C.clipping=!0;for(var I=hp.distanceRGBA,R=cp.clone(I.uniforms),L=0;L!==w;++L){var O=0!=(L&x),D=0!=(L&_),N=C.clone();N.morphTargets=O,N.skinning=D,S[L]=N;var k=new ot({defines:{USE_SHADOWMAP:""},uniforms:R,vertexShader:I.vertexShader,fragmentShader:I.fragmentShader,morphTargets:O,skinning:D,clipping:!0});A[L]=k}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ju,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,r){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==h.length){s.disable(a.BLEND),s.buffers.color.setClear(1,1,1,1),s.buffers.depth.setTest(!0),s.setScissorTest(!1);for(var i,n=0,l=h.length;n<l;n++){var d=h[n],g=d.shadow,v=d&&d.isPointLight;if(void 0!==g){var x=g.camera;if(p.copy(g.mapSize),p.min(m),v){var _=p.x,w=p.y;P[0].set(2*_,w,_,w),P[1].set(0,w,_,w),P[2].set(3*_,w,_,w),P[3].set(_,w,_,w),P[4].set(3*_,0,_,w),P[5].set(_,0,_,w),p.x*=4,p.y*=2}if(null===g.map){var S={minFilter:il,magFilter:il,format:Sl};g.map=new f(p.x,p.y,S),g.map.texture.name=d.name+".shadowMap",x.updateProjectionMatrix()}g.isSpotLightShadow&&g.update(d);var A=g.map,M=g.matrix;b.setFromMatrixPosition(d.matrixWorld),x.position.copy(b),v?(i=6,M.makeTranslation(-b.x,-b.y,-b.z)):(i=1,y.setFromMatrixPosition(d.target.matrixWorld),x.lookAt(y),x.updateMatrixWorld(),M.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),M.multiply(x.projectionMatrix),M.multiply(x.matrixWorldInverse)),t.setRenderTarget(A),t.clear();for(var C=0;C<i;C++){if(v){y.copy(x.position),y.add(T[C]),x.up.copy(E[C]),x.lookAt(y),x.updateMatrixWorld();var I=P[C];s.viewport(I)}u.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),c.setFromMatrix(u),o(e,r,x,v)}}else console.warn("THREE.WebGLShadowMap:",d,"has no shadow.")}var R=t.getClearColor(),L=t.getClearAlpha();t.setClearColor(R,L),F.needsUpdate=!1}}}function dt(t){function e(e,r){var i=e.array,n=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();t.bindBuffer(r,o),t.bufferData(r,i,n),e.onUploadCallback();var a=t.FLOAT;return i instanceof Float32Array?a=t.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=t.UNSIGNED_SHORT:i instanceof Int16Array?a=t.SHORT:i instanceof Uint32Array?a=t.UNSIGNED_INT:i instanceof Int32Array?a=t.INT:i instanceof Int8Array?a=t.BYTE:i instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}function r(e,r,i){var n=r.array,o=r.updateRange;t.bindBuffer(i,e),!1===r.dynamic?t.bufferData(i,n,t.STATIC_DRAW):-1===o.count?t.bufferSubData(i,0,n):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,o.offset*n.BYTES_PER_ELEMENT,n.subarray(o.offset,o.offset+o.count)),o.count=-1)}function i(t){return t.isInterleavedBufferAttribute&&(t=t.data),a[t.uuid]}function n(e){e.isInterleavedBufferAttribute&&(e=e.data);var r=a[e.uuid];r&&(t.deleteBuffer(r.buffer),delete a[e.uuid])}function o(t,i){t.isInterleavedBufferAttribute&&(t=t.data);var n=a[t.uuid];void 0===n?a[t.uuid]=e(t,i):n.version<t.version&&(r(n.buffer,t,i),n.version=t.version)}var a={};return{get:i,remove:n,update:o}}function ft(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||ft.DefaultOrder}function mt(){this.mask=1}function gt(){function t(){n.setFromEuler(i,!1)}function e(){i.setFromQuaternion(n,void 0,!1)}Object.defineProperty(this,"id",{value:pp++}),this.uuid=Kl.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=gt.DefaultUp.clone();var r=new g,i=new ft,n=new m,o=new g(1,1,1);i.onChange(t),n.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:i},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new v},normalMatrix:{value:new ut}}),this.matrix=new v,this.matrixWorld=new v,this.matrixAutoUpdate=gt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new mt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function vt(){gt.call(this),this.type="Camera",this.matrixWorldInverse=new v,this.projectionMatrix=new v}function yt(t,e,r,i,n,o){vt.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function bt(t,e,r,i){vt.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function xt(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i&&i.isVector3?i:new g,this.vertexNormals=Array.isArray(i)?i:[],this.color=n&&n.isColor?n:new tt,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0}function _t(){return dp++}function wt(){Object.defineProperty(this,"id",{value:_t()}),this.uuid=Kl.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function St(t,e,r){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Kl.generateUUID(),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===r,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function At(t,e){St.call(this,new Uint16Array(t),e)}function Mt(t,e){St.call(this,new Uint32Array(t),e)}function Tt(t,e){St.call(this,new Float32Array(t),e)}function Et(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Pt(t){if(0===t.length)return-1/0;for(var e=t[0],r=1,i=t.length;r<i;++r)t[r]>e&&(e=t[r]);return e}function Ct(){Object.defineProperty(this,"id",{value:_t()}),this.uuid=Kl.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function It(t,e,r,i,n,o){wt.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.fromBufferGeometry(new Rt(t,e,r,i,n,o)),this.mergeVertices()}function Rt(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,f,m,v,y){var b,x,_=o/m,w=a/v,S=o/2,A=a/2,M=f/2,T=m+1,E=v+1,P=0,C=0,I=new g;for(x=0;x<E;x++){var R=x*w-A;for(b=0;b<T;b++){var L=b*_-S;I[t]=L*i,I[e]=R*n,I[r]=M,u.push(I.x,I.y,I.z),I[t]=0,I[e]=0,I[r]=f>0?1:-1,h.push(I.x,I.y,I.z),l.push(b/m),l.push(1-x/v),P+=1}}for(x=0;x<v;x++)for(b=0;b<m;b++){var O=p+b+T*x,D=p+b+T*(x+1),N=p+(b+1)+T*(x+1),k=p+(b+1)+T*x;c.push(O,D,k),c.push(D,N,k),C+=6}s.addGroup(d,C,y),d+=C,p+=P}Ct.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o};var s=this;i=Math.floor(i)||1,n=Math.floor(n)||1;var c=[],u=[],h=[],l=[],p=0,d=0;a("z","y","x",-1,-1,r,e,t,o=Math.floor(o)||1,n,0),a("z","y","x",1,-1,r,e,-t,o,n,1),a("x","z","y",1,1,t,r,e,i,o,2),a("x","z","y",1,-1,t,r,-e,i,o,3),a("x","y","z",1,-1,t,e,r,i,n,4),a("x","y","z",-1,-1,t,e,-r,i,n,5),this.setIndex(c),this.addAttribute("position",new Tt(u,3)),this.addAttribute("normal",new Tt(h,3)),this.addAttribute("uv",new Tt(l,2))}function Lt(t,e,r,i){wt.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new Ot(t,e,r,i)),this.mergeVertices()}function Ot(t,e,r,i){Ct.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n,o,a=t/2,s=e/2,c=Math.floor(r)||1,u=Math.floor(i)||1,h=c+1,l=u+1,p=t/c,d=e/u,f=[],m=[],g=[],v=[];for(o=0;o<l;o++){var y=o*d-s;for(n=0;n<h;n++){var b=n*p-a;m.push(b,-y,0),g.push(0,0,1),v.push(n/c),v.push(1-o/u)}}for(o=0;o<u;o++)for(n=0;n<c;n++){var x=n+h*o,_=n+h*(o+1),w=n+1+h*(o+1),S=n+1+h*o;f.push(x,_,S),f.push(_,w,S)}this.setIndex(f),this.addAttribute("position",new Tt(m,3)),this.addAttribute("normal",new Tt(g,3)),this.addAttribute("uv",new Tt(v,2))}function Dt(t){nt.call(this),this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Nt(t,e){this.origin=void 0!==t?t:new g,this.direction=void 0!==e?e:new g}function kt(t,e){this.start=void 0!==t?t:new g,this.end=void 0!==e?e:new g}function Ft(t,e,r){this.a=void 0!==t?t:new g,this.b=void 0!==e?e:new g,this.c=void 0!==r?r:new g}function Bt(t,e){gt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Ct,this.material=void 0!==e?e:new Dt({color:16777215*Math.random()}),this.drawMode=zl,this.updateMorphTargets()}function zt(t,e,r,i){function n(e,i,n){var p=e.background;null===p?o(h,l):p&&p.isColor&&(o(p,1),n=!0),(t.autoClear||n)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&p.isCubeTexture?(void 0===c&&(c=new bt,u=new Bt(new Rt(5,5,5),new ot({uniforms:hp.cube.uniforms,vertexShader:hp.cube.vertexShader,fragmentShader:hp.cube.fragmentShader,side:rh,depthTest:!1,depthWrite:!1,fog:!1}))),c.projectionMatrix.copy(i.projectionMatrix),c.matrixWorld.extractRotation(i.matrixWorld),c.matrixWorldInverse.getInverse(c.matrixWorld),u.material.uniforms.tCube.value=p,u.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,u.matrixWorld),r.update(u),t.renderBufferDirect(c,null,u.geometry,u.material,u,null)):p&&p.isTexture&&(void 0===a&&(a=new yt(-1,1,1,-1,0,1),s=new Bt(new Ot(2,2),new Dt({depthTest:!1,depthWrite:!1,fog:!1}))),s.material.map=p,r.update(s),t.renderBufferDirect(a,null,s.geometry,s.material,s,null))}function o(t,r){e.buffers.color.setClear(t.r,t.g,t.b,r,i)}var a,s,c,u,h=new tt(0),l=0;return{getClearColor:function(){return h},setClearColor:function(t,e){h.set(t),o(h,l=void 0!==e?e:1)},getClearAlpha:function(){return l},setClearAlpha:function(t){o(h,l=t)},render:n}}function Ut(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function jt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Gt(){function t(){o=-1,s=-1}function e(t,e,r,i,c){var u,h;r.transparent?(u=a,h=++s):(u=n,h=++o);var l=u[h];l?(l.id=t.id,l.object=t,l.geometry=e,l.material=r,l.program=r.program,l.renderOrder=t.renderOrder,l.z=i,l.group=c):(l={id:t.id,object:t,geometry:e,material:r,program:r.program,renderOrder:t.renderOrder,z:i,group:c},u.push(l))}function r(){n.length=o+1,a.length=s+1}function i(){n.sort(Ut),a.sort(jt)}var n=[],o=-1,a=[],s=-1;return{opaque:n,transparent:a,init:t,push:e,finish:r,sort:i}}function Vt(){function t(t,e){var i=t.id+","+e.id,n=r[i];return void 0===n&&(n=new Gt,r[i]=n),n}function e(){r={}}var r={};return{get:t,dispose:e}}function $t(t,e,r){function i(t){s=t}function n(t){c=t.type,u=t.bytesPerElement}function o(e,i){t.drawElements(s,i,c,e*u),r.calls++,r.vertices+=i,s===t.TRIANGLES&&(r.faces+=i/3)}function a(i,n,o){var a=e.get("ANGLE_instanced_arrays");null!==a?(a.drawElementsInstancedANGLE(s,o,c,n*u,i.maxInstancedCount),r.calls++,r.vertices+=o*i.maxInstancedCount,s===t.TRIANGLES&&(r.faces+=i.maxInstancedCount*o/3)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}var s,c,u;this.setMode=i,this.setIndex=n,this.render=o,this.renderInstances=a}function Ht(t,e,r){function i(t){a=t}function n(e,i){t.drawArrays(a,e,i),r.calls++,r.vertices+=i,a===t.TRIANGLES&&(r.faces+=i/3)}function o(i,n,o){var s=e.get("ANGLE_instanced_arrays");if(null!==s){var c=i.attributes.position;c.isInterleavedBufferAttribute?(o=c.data.count,s.drawArraysInstancedANGLE(a,0,o,i.maxInstancedCount)):s.drawArraysInstancedANGLE(a,n,o,i.maxInstancedCount),r.calls++,r.vertices+=o*i.maxInstancedCount,a===t.TRIANGLES&&(r.faces+=i.maxInstancedCount*o/3)}else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}var a;this.setMode=i,this.render=n,this.renderInstances=o}function Wt(t,e,r){function i(t){var n=t.target,o=s[n.id];null!==o.index&&e.remove(o.index);for(var a in o.attributes)e.remove(o.attributes[a]);n.removeEventListener("dispose",i),delete s[n.id];var u=c[n.id];u&&(e.remove(u),delete c[n.id]),(u=c[o.id])&&(e.remove(u),delete c[o.id]),r.geometries--}function n(t,e){var n=s[e.id];return n||(e.addEventListener("dispose",i),e.isBufferGeometry?n=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Ct).setFromObject(t)),n=e._bufferGeometry),s[e.id]=n,r.geometries++,n)}function o(r){var i=r.index,n=r.attributes;null!==i&&e.update(i,t.ELEMENT_ARRAY_BUFFER);for(var o in n)e.update(n[o],t.ARRAY_BUFFER);var a=r.morphAttributes;for(var o in a)for(var s=a[o],c=0,u=s.length;c<u;c++)e.update(s[c],t.ARRAY_BUFFER)}function a(r){var i=c[r.id];if(i)return i;var n=[],o=r.index,a=r.attributes;if(null!==o)for(var s=0,u=(d=o.array).length;s<u;s+=3){var h=d[s+0],l=d[s+1],p=d[s+2];n.push(h,l,l,p,p,h)}else for(var d=a.position.array,s=0,u=d.length/3-1;s<u;s+=3){var h=s+0,l=s+1,p=s+2;n.push(h,l,l,p,p,h)}return i=new(Pt(n)>65535?Mt:At)(n,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),c[r.id]=i,i}var s={},c={};return{get:n,update:o,getWireframeAttribute:a}}function Xt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new g,color:new tt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new l};break;case"SpotLight":r={position:new g,direction:new g,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new l};break;case"PointLight":r={position:new g,color:new tt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new l};break;case"HemisphereLight":r={direction:new g,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":r={color:new tt,position:new g,halfWidth:new g,halfHeight:new g}}return t[e.id]=r,r}}}function qt(t,e,r){function i(t){var i=r.frame,n=t.geometry,a=e.get(t,n);return o[a.id]!==i&&(n.isGeometry&&a.updateFromObject(t),e.update(a),o[a.id]=i),a}function n(){o={}}var o={};return{update:i,clear:n}}function Yt(t){for(var e=t.split("\n"),r=0;r<e.length;r++)e[r]=r+1+": "+e[r];return e.join("\n")}function Zt(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),Yt(r)),i}function Kt(t){switch(t){case Gl:return["Linear","( value )"];case Vl:return["sRGB","( value )"];case Hl:return["RGBE","( value )"];case Wl:return["RGBM","( value, 7.0 )"];case Xl:return["RGBM","( value, 16.0 )"];case ql:return["RGBD","( value, 256.0 )"];case $l:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Qt(t,e){var r=Kt(e);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function Jt(t,e){var r=Kt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function te(t,e){var r;switch(e){case Vh:r="Linear";break;case $h:r="Reinhard";break;case Hh:r="Uncharted2";break;case Wh:r="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function ee(t,e,r){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ne).join("\n")}function re(t){var e=[];for(var r in t){var i=t[r];!1!==i&&e.push("#define "+r+" "+i)}return e.join("\n")}function ie(t,e,r){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<n;o++){var a=t.getActiveAttrib(e,o).name;i[a]=t.getAttribLocation(e,a)}return i}function ne(t){return""!==t}function oe(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function ae(t){function e(t,e){var r=up[e];if(void 0===r)throw new Error("Can not resolve #include <"+e+">");return ae(r)}var r=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(r,e)}function se(t){function e(t,e,r,i){for(var n="",o=parseInt(e);o<parseInt(r);o++)n+=i.replace(/\[ i \]/g,"[ "+o+" ]");return n}var r=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(r,e)}function ce(t,e,r,i,n){var o=t.context,a=r.extensions,s=r.defines,c=i.vertexShader,u=i.fragmentShader,h="SHADOWMAP_TYPE_BASIC";n.shadowMapType===Ju?h="SHADOWMAP_TYPE_PCF":n.shadowMapType===th&&(h="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(r.envMap.mapping){case Xh:case qh:l="ENVMAP_TYPE_CUBE";break;case Qh:case Jh:l="ENVMAP_TYPE_CUBE_UV";break;case Yh:case Zh:l="ENVMAP_TYPE_EQUIREC";break;case Kh:l="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case qh:case Zh:p="ENVMAP_MODE_REFRACTION"}switch(r.combine){case zh:d="ENVMAP_BLENDING_MULTIPLY";break;case Uh:d="ENVMAP_BLENDING_MIX";break;case jh:d="ENVMAP_BLENDING_ADD"}}var f,m,g=t.gammaFactor>0?t.gammaFactor:1,v=ee(a,n,t.extensions),y=re(s),b=o.createProgram();r.isRawShaderMaterial?(f=[y,"\n"].filter(ne).join("\n"),m=[v,y,"\n"].filter(ne).join("\n")):(f=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.name,y,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ne).join("\n"),m=[v,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.name,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+p:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==Gh?"#define TONE_MAPPING":"",n.toneMapping!==Gh?up.tonemapping_pars_fragment:"",n.toneMapping!==Gh?te("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?up.encodings_pars_fragment:"",n.mapEncoding?Qt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Qt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Qt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Jt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(ne).join("\n")),c=oe(c=ae(c),n),u=oe(u=ae(u),n),r.isShaderMaterial||(c=se(c),u=se(u));var x=f+c,_=m+u,w=Zt(o,o.VERTEX_SHADER,x),S=Zt(o,o.FRAGMENT_SHADER,_);o.attachShader(b,w),o.attachShader(b,S),void 0!==r.index0AttributeName?o.bindAttribLocation(b,0,r.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(b,0,"position"),o.linkProgram(b);var A=o.getProgramInfoLog(b),M=o.getShaderInfoLog(w),T=o.getShaderInfoLog(S),E=!0,P=!0;!1===o.getProgramParameter(b,o.LINK_STATUS)?(E=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(b,o.VALIDATE_STATUS),"gl.getProgramInfoLog",A,M,T)):""!==A?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",A):""!==M&&""!==T||(P=!1),P&&(this.diagnostics={runnable:E,material:r,programLog:A,vertexShader:{log:M,prefix:f},fragmentShader:{log:T,prefix:m}}),o.deleteShader(w),o.deleteShader(S);var C;this.getUniforms=function(){return void 0===C&&(C=new J(o,b,t)),C};var I;return this.getAttributes=function(){return void 0===I&&(I=ie(o,b)),I},this.destroy=function(){o.deleteProgram(b),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=fp++,this.code=e,this.usedTimes=1,this.program=b,this.vertexShader=w,this.fragmentShader=S,this}function ue(t,e){function r(t){var r=t.skeleton.bones;if(e.floatVertexTextures)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),o=Math.min(n,r.length);return o<r.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+r.length+" bones. This GPU supports "+o+"."),0):o}function i(t,e){var r;return t?t.isTexture?r=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),r=t.texture.encoding):r=Gl,r===Gl&&e&&(r=$l),r}var n=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];this.getParameters=function(n,a,s,c,u,h){var l=o[n.type],p=h.isSkinnedMesh?r(h):0,d=t.getPrecision();null!==n.precision&&(d=e.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",d,"instead.");var f=t.getRenderTarget();return{shaderID:l,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:i(f?f.texture:null,t.gammaOutput),map:!!n.map,mapEncoding:i(n.map,t.gammaInput),envMap:!!n.envMap,envMapMode:n.envMap&&n.envMap.mapping,envMapEncoding:i(n.envMap,t.gammaInput),envMapCubeUV:!!n.envMap&&(n.envMap.mapping===Qh||n.envMap.mapping===Jh),lightMap:!!n.lightMap,aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:i(n.emissiveMap,t.gammaInput),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,combine:n.combine,vertexColors:n.vertexColors,fog:!!s,useFog:n.fog,fogExp:s&&s.isFogExp2,flatShading:n.shading===nh,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:n.skinning&&p>0,maxBones:p,useVertexTexture:e.floatVertexTextures,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:c,numClipIntersection:u,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&a.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===ih,flipSided:n.side===rh,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(e,r){var i=[];if(r.shaderID?i.push(r.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)i.push(n),i.push(e.defines[n]);for(var o=0;o<a.length;o++)i.push(r[a[o]]);return i.push(e.onBeforeCompile.toString()),i.push(t.gammaOutput),i.join()},this.acquireProgram=function(e,r,i,o){for(var a,s=0,c=n.length;s<c;s++){var u=n[s];if(u.code===o){++(a=u).usedTimes;break}}return void 0===a&&(a=new ce(t,o,e,r,i),n.push(a)),a},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function he(t,e,r,i,n,o,a){function s(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function c(t){return Kl.isPowerOfTwo(t.width)&&Kl.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.width=Kl.nearestPowerOfTwo(t.width),e.height=Kl.nearestPowerOfTwo(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==el||t.wrapT!==el||t.minFilter!==il&&t.minFilter!==al}function l(t,e){return t.generateMipmaps&&e&&t.minFilter!==il&&t.minFilter!==al}function p(e){return e===il||e===nl||e===ol?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),a.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),g(e),a.textures--}function m(e){var r=i.get(e);if(e.image&&r.__image__webglTextureCube)t.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)return;t.deleteTexture(r.__webglTexture)}i.remove(e)}function g(e){var r=i.get(e),n=i.get(e.texture);if(e){if(void 0!==n.__webglTexture&&t.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(r.__webglFramebuffer[o]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[o]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}}function v(e,n){var o=i.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void _(o,e,n);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}r.activeTexture(t.TEXTURE0+n),r.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function y(e,u){var h=i.get(e);if(6===e.image.length)if(e.version>0&&h.__version!==e.version){h.__image__webglTextureCube||(e.addEventListener("dispose",d),h.__image__webglTextureCube=t.createTexture(),a.textures++),r.activeTexture(t.TEXTURE0+u),r.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var p=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?e.image[g].image:e.image[g]:s(e.image[g],n.maxCubemapSize);var v=c(m[0]),y=o(e.format),b=o(e.type);x(t.TEXTURE_CUBE_MAP,e,v);for(g=0;g<6;g++)if(p)for(var _,w=m[g].mipmaps,S=0,A=w.length;S<A;S++)_=w[S],e.format!==Sl&&e.format!==wl?r.getCompressedTextureFormats().indexOf(y)>-1?r.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,S,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,S,y,_.width,_.height,0,y,b,_.data);else f?r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,m[g].width,m[g].height,0,y,b,m[g].data):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,y,b,m[g]);l(e,v)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else r.activeTexture(t.TEXTURE0+u),r.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)}function b(e,n){r.activeTexture(t.TEXTURE0+n),r.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)}function x(r,a,s){var c;if(s?(t.texParameteri(r,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(r,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(r,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(r,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(r,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===el&&a.wrapT===el||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(r,t.TEXTURE_MAG_FILTER,p(a.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,p(a.minFilter)),a.minFilter!==il&&a.minFilter!==al&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===ml&&null===e.get("OES_texture_float_linear"))return;if(a.type===gl&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(r,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function _(e,i,p){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),a.textures++),r.activeTexture(t.TEXTURE0+p),r.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var f=s(i.image,n.maxTextureSize);h(i)&&!1===c(f)&&(f=u(f));var m=c(f),g=o(i.format),v=o(i.type);x(t.TEXTURE_2D,i,m);var y,b=i.mipmaps;if(i.isDepthTexture){var _=t.DEPTH_COMPONENT;if(i.type===ml){if(!P)throw new Error("Float Depth Texture only supported in WebGL2.0");_=t.DEPTH_COMPONENT32F}else P&&(_=t.DEPTH_COMPONENT16);i.format===Tl&&_===t.DEPTH_COMPONENT&&i.type!==pl&&i.type!==fl&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=pl,v=o(i.type)),i.format===El&&(_=t.DEPTH_STENCIL,i.type!==xl&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=xl,v=o(i.type))),r.texImage2D(t.TEXTURE_2D,0,_,f.width,f.height,0,g,v,null)}else if(i.isDataTexture)if(b.length>0&&m){for(var w=0,S=b.length;w<S;w++)y=b[w],r.texImage2D(t.TEXTURE_2D,w,g,y.width,y.height,0,g,v,y.data);i.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,g,f.width,f.height,0,g,v,f.data);else if(i.isCompressedTexture)for(var w=0,S=b.length;w<S;w++)y=b[w],i.format!==Sl&&i.format!==wl?r.getCompressedTextureFormats().indexOf(g)>-1?r.compressedTexImage2D(t.TEXTURE_2D,w,g,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texImage2D(t.TEXTURE_2D,w,g,y.width,y.height,0,g,v,y.data);else if(b.length>0&&m){for(var w=0,S=b.length;w<S;w++)y=b[w],r.texImage2D(t.TEXTURE_2D,w,g,g,v,y);i.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,g,g,v,f);l(i,m)&&t.generateMipmap(t.TEXTURE_2D),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function w(e,n,a,s){var c=o(n.texture.format),u=o(n.texture.type);r.texImage2D(s,0,c,n.width,n.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(n.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function S(e,r){t.bindRenderbuffer(t.RENDERBUFFER,e),r.depthBuffer&&!r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):r.depthBuffer&&r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,r.width,r.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function A(e,r){if(r&&r.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),v(r.depthTexture,0);var n=i.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===Tl)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,n,0);else{if(r.depthTexture.format!==El)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,n,0)}}function M(e){var r=i.get(e),n=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");A(r.__webglFramebuffer,e)}else if(n){r.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=t.createRenderbuffer(),S(r.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),S(r.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var n=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,u=c(e);if(s){n.__webglFramebuffer=[];for(h=0;h<6;h++)n.__webglFramebuffer[h]=t.createFramebuffer()}else n.__webglFramebuffer=t.createFramebuffer();if(s){r.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),x(t.TEXTURE_CUBE_MAP,e.texture,u);for(var h=0;h<6;h++)w(n.__webglFramebuffer[h],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+h);l(e.texture,u)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,o.__webglTexture),x(t.TEXTURE_2D,e.texture,u),w(n.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),l(e.texture,u)&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&M(e)}function E(e){var n=e.texture;if(l(n,c(e))){var o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(n).__webglTexture;r.bindTexture(o,a),t.generateMipmap(o),r.bindTexture(o,null)}}var P="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=y,this.setTextureCubeDynamic=b,this.setupRenderTarget=T,this.updateRenderTargetMipmap=E}function le(){function t(t){var e=t.uuid,r=i[e];return void 0===r&&(r={},i[e]=r),r}function e(t){delete i[t.uuid]}function r(){i={}}var i={};return{get:t,remove:e,clear:r}}function pe(t,e,r){function i(){var e=!1,r=new d,i=null,n=new d;return{setMask:function(r){i===r||e||(t.colorMask(r,r,r,r),i=r)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),r.set(e,i,o,a),!1===n.equals(r)&&(t.clearColor(e,i,o,a),n.copy(r))},reset:function(){e=!1,i=null,n.set(0,0,0,1)}}}function n(){var e=!1,r=null,i=null,n=null;return{setTest:function(e){e?p(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(i){r===i||e||(t.depthMask(i),r=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case Rh:t.depthFunc(t.NEVER);break;case Lh:t.depthFunc(t.ALWAYS);break;case Oh:t.depthFunc(t.LESS);break;case Dh:t.depthFunc(t.LEQUAL);break;case Nh:t.depthFunc(t.EQUAL);break;case kh:t.depthFunc(t.GEQUAL);break;case Fh:t.depthFunc(t.GREATER);break;case Bh:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){n!==e&&(t.clearDepth(e),n=e)},reset:function(){e=!1,r=null,i=null,n=null}}}function o(){var e=!1,r=null,i=null,n=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?p(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(i){r===i||e||(t.stencilMask(i),r=i)},setFunc:function(e,r,a){i===e&&n===r&&o===a||(t.stencilFunc(e,r,a),i=e,n=r,o=a)},setOp:function(e,r,i){a===e&&s===r&&c===i||(t.stencilOp(e,r,i),a=e,s=r,c=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,r=null,i=null,n=null,o=null,a=null,s=null,c=null,u=null}}}function a(e,r,i){var n=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<i;a++)t.texImage2D(r+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,n);return o}function s(){R.setClear(0,0,0,1),L.setClear(1),O.setClear(0),p(t.DEPTH_TEST),L.setFunc(Dh),y(!1),b(Zu),p(t.CULL_FACE),p(t.BLEND),g(hh)}function c(){for(var t=0,e=N.length;t<e;t++)N[t]=0}function u(r){N[r]=1,0===k[r]&&(t.enableVertexAttribArray(r),k[r]=1),0!==F[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),F[r]=0)}function h(r,i){N[r]=1,0===k[r]&&(t.enableVertexAttribArray(r),k[r]=1),F[r]!==i&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,i),F[r]=i)}function l(){for(var e=0,r=k.length;e!==r;++e)k[e]!==N[e]&&(t.disableVertexAttribArray(e),k[e]=0)}function p(e){!0!==B[e]&&(t.enable(e),B[e]=!0)}function f(e){!1!==B[e]&&(t.disable(e),B[e]=!1)}function m(){if(null===z&&(z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)z.push(r[i]);return z}function g(e,i,n,o,a,s,c,u){e!==uh?p(t.BLEND):f(t.BLEND),e===fh||e===U&&u===X||(e===lh?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===ph?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===dh?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),U=e,X=u),e===fh?(a=a||i,s=s||n,c=c||o,i===j&&a===$||(t.blendEquationSeparate(r(i),r(a)),j=i,$=a),n===G&&o===V&&s===H&&c===W||(t.blendFuncSeparate(r(n),r(o),r(s),r(c)),G=n,V=o,H=s,W=c)):(j=null,G=null,V=null,$=null,H=null,W=null)}function v(e){e.side===ih?f(t.CULL_FACE):p(t.CULL_FACE),y(e.side===rh),!0===e.transparent?g(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):g(uh),L.setFunc(e.depthFunc),L.setTest(e.depthTest),L.setMask(e.depthWrite),R.setMask(e.colorWrite),_(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e){q!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),q=e)}function b(e){e!==Yu?(p(t.CULL_FACE),e!==Y&&(e===Zu?t.cullFace(t.BACK):e===Ku?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),Y=e}function x(e){e!==Z&&(rt&&t.lineWidth(e),Z=e)}function _(e,r,i){e?(p(t.POLYGON_OFFSET_FILL),K===r&&Q===i||(t.polygonOffset(r,i),K=r,Q=i)):f(t.POLYGON_OFFSET_FILL)}function w(){return J}function S(e){J=e,e?p(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function A(e){void 0===e&&(e=t.TEXTURE0+tt-1),it!==e&&(t.activeTexture(e),it=e)}function M(e,r){null===it&&A();var i=nt[it];void 0===i&&(i={type:void 0,texture:void 0},nt[it]=i),i.type===e&&i.texture===r||(t.bindTexture(e,r||st[e]),i.type=e,i.texture=r)}function T(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function E(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function P(e){!1===ot.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ot.copy(e))}function C(e){!1===at.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),at.copy(e))}function I(){for(var e=0;e<k.length;e++)1===k[e]&&(t.disableVertexAttribArray(e),k[e]=0);B={},z=null,it=null,nt={},U=null,q=null,Y=null,R.reset(),L.reset(),O.reset()}var R=new i,L=new n,O=new o,D=t.getParameter(t.MAX_VERTEX_ATTRIBS),N=new Uint8Array(D),k=new Uint8Array(D),F=new Uint8Array(D),B={},z=null,U=null,j=null,G=null,V=null,$=null,H=null,W=null,X=!1,q=null,Y=null,Z=null,K=null,Q=null,J=null,tt=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),et=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),rt=parseFloat(et)>=1,it=null,nt={},ot=new d,at=new d,st={};return st[t.TEXTURE_2D]=a(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=a(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:R,depth:L,stencil:O},init:s,initAttributes:c,enableAttribute:u,enableAttributeAndDivisor:h,disableUnusedAttributes:l,enable:p,disable:f,getCompressedTextureFormats:m,setBlending:g,setMaterial:v,setFlipSided:y,setCullFace:b,setLineWidth:x,setPolygonOffset:_,getScissorTest:w,setScissorTest:S,activeTexture:A,bindTexture:M,compressedTexImage2D:T,texImage2D:E,scissor:P,viewport:C,reset:I}}function de(t,e,r){function i(){if(void 0!==o)return o;var r=e.get("EXT_texture_filter_anisotropic");return o=null!==r?t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function n(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==r.precision?r.precision:"highp",s=n(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===r.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:i,getMaxPrecision:n,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function fe(t){bt.call(this),this.cameras=t||[]}function me(t){function e(){if(i.isPresenting){var e=i.getEyeParameters("left"),n=e.renderWidth,o=e.renderHeight;p=t.getPixelRatio(),l=t.getSize(),t.setDrawingBufferSize(2*n,o,1)}else r.enabled&&t.setDrawingBufferSize(l.width,l.height,p)}var r=this,i=null,n=null;"VRFrameData"in window&&(n=new window.VRFrameData);var o=new v,a=new v,s=new v,c=new bt;c.bounds=new d(0,0,.5,1),c.layers.enable(1);var u=new bt;u.bounds=new d(.5,0,.5,1),u.layers.enable(2);var h=new fe([c,u]);h.layers.enable(1),h.layers.enable(2);var l,p;window.addEventListener("vrdisplaypresentchange",e,!1),this.enabled=!1,this.standing=!1,this.getDevice=function(){return i},this.setDevice=function(t){void 0!==t&&(i=t)},this.getCamera=function(t){if(null===i)return t;i.depthNear=t.near,i.depthFar=t.far,i.getFrameData(n);var e=n.pose;null!==e.position?t.position.fromArray(e.position):t.position.set(0,0,0),null!==e.orientation&&t.quaternion.fromArray(e.orientation),t.updateMatrixWorld();var r=i.stageParameters;if(this.standing&&r&&(a.fromArray(r.sittingToStandingTransform),s.getInverse(a),t.matrixWorld.multiply(a),t.matrixWorldInverse.multiply(s)),!1===i.isPresenting)return t;h.matrixWorld.copy(t.matrixWorld),h.matrixWorldInverse.copy(t.matrixWorldInverse),c.matrixWorldInverse.fromArray(n.leftViewMatrix),u.matrixWorldInverse.fromArray(n.rightViewMatrix),this.standing&&r&&(c.matrixWorldInverse.multiply(s),u.matrixWorldInverse.multiply(s));var l=t.parent;null!==l&&(o.getInverse(l.matrixWorld),c.matrixWorldInverse.multiply(o),u.matrixWorldInverse.multiply(o)),c.matrixWorld.getInverse(c.matrixWorldInverse),u.matrixWorld.getInverse(u.matrixWorldInverse),c.projectionMatrix.fromArray(n.leftProjectionMatrix),u.projectionMatrix.fromArray(n.rightProjectionMatrix),h.projectionMatrix.copy(c.projectionMatrix);var p=i.getLayers();if(p.length){var d=p[0];null!==d.leftBounds&&4===d.leftBounds.length&&c.bounds.fromArray(d.leftBounds),null!==d.rightBounds&&4===d.rightBounds.length&&u.bounds.fromArray(d.rightBounds)}return h},this.getStandingMatrix=function(){return a},this.submitFrame=function(){i&&i.isPresenting&&i.submitFrame()}}function ge(t){var e={};return{get:function(r){if(void 0!==e[r])return e[r];var i;switch(r){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=i,i}}}function ve(){function t(){u.value!==i&&(u.value=i,u.needsUpdate=n>0),r.numPlanes=n,r.numIntersection=0}function e(t,e,i,n){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,!0!==n||null===a){var h=i+4*o,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===a||a.length<h)&&(a=new Float32Array(h));for(var p=0,d=i;p!==o;++p,d+=4)s.copy(t[p]).applyMatrix4(l,c),s.normal.toArray(a,d),a[d+3]=s.constant}u.value=a,u.needsUpdate=!0}return r.numPlanes=o,a}var r=this,i=null,n=0,o=!1,a=!1,s=new ht,c=new ut,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,a){var s=0!==t.length||r||0!==n||o;return o=r,i=e(t,a,0),n=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(r,s,c,h,l,p){if(!o||null===r||0===r.length||a&&!c)a?e(null):t();else{var d=a?0:n,f=4*d,m=l.clippingState||null;u.value=m,m=e(r,h,f,p);for(var g=0;g!==f;++g)m[g]=i[g];l.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function ye(t){function e(){return null===K?mt:1}function r(){Nt.init(),Nt.scissor(at.copy(gt).multiplyScalar(mt)),Nt.viewport(ct.copy(yt).multiplyScalar(mt))}function i(){Z=null,nt=null,et="",tt=-1,Nt.reset()}function n(t){t.preventDefault(),i(),r(),kt.clear(),jt.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),a(e)}function a(t){s(t),kt.remove(t)}function s(t){var e=kt.get(t).program;t.program=void 0,void 0!==e&&Gt.releaseProgram(e)}function c(t,e,r){t.render(function(t){Y.renderBufferImmediate(t,e,r)})}function u(t,e){return Math.abs(e[0])-Math.abs(t[0])}function h(t,e,r,i){if(r&&r.isInstancedBufferGeometry&&null===Ot.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===i&&(i=0),Nt.initAttributes();var n=r.attributes,o=e.getAttributes(),a=t.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var u=n[s];if(void 0!==u){var h=u.normalized,l=u.itemSize,p=Bt.get(u),d=p.buffer,f=p.type,m=p.bytesPerElement;if(u.isInterleavedBufferAttribute){var g=u.data,v=g.stride,y=u.offset;g&&g.isInstancedInterleavedBuffer?(Nt.enableAttributeAndDivisor(c,g.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=g.meshPerAttribute*g.count)):Nt.enableAttribute(c),Rt.bindBuffer(Rt.ARRAY_BUFFER,d),Rt.vertexAttribPointer(c,l,f,h,v*m,(i*v+y)*m)}else u.isInstancedBufferAttribute?(Nt.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=u.meshPerAttribute*u.count)):Nt.enableAttribute(c),Rt.bindBuffer(Rt.ARRAY_BUFFER,d),Rt.vertexAttribPointer(c,l,f,h,0,i*l*m)}else if(void 0!==a){var b=a[s];if(void 0!==b)switch(b.length){case 2:Rt.vertexAttrib2fv(c,b);break;case 3:Rt.vertexAttrib3fv(c,b);break;case 4:Rt.vertexAttrib4fv(c,b);break;default:Rt.vertexAttrib1fv(c,b)}}}}Nt.disableUnusedAttributes()}}function l(t,e,r){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)$.push(t);else if(t.isSprite)t.frustumCulled&&!bt.intersectsSprite(t)||X.push(t);else if(t.isLensFlare)q.push(t);else if(t.isImmediateRenderObject)r&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St),H.push(t,null,t.material,At.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||bt.intersectsObject(t))){r&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St);var i=jt.update(t),n=t.material;if(Array.isArray(n))for(var o=i.groups,a=0,s=o.length;a<s;a++){var c=o[a],u=n[c.materialIndex];u&&u.visible&&H.push(t,i,u,At.z,c)}else n.visible&&H.push(t,i,n,At.z,null)}for(var h=t.children,a=0,s=h.length;a<s;a++)l(h[a],e,r)}}function p(t,e,r,i){for(var n=0,o=t.length;n<o;n++){var a=t[n],s=a.object,c=a.geometry,u=void 0===i?a.material:i,h=a.group;if(r.isArrayCamera){ot=r;for(var l=r.cameras,p=0,d=l.length;p<d;p++){var m=l[p];if(s.layers.test(m.layers)){var g=m.bounds,v=g.x*ht,y=g.y*ft,b=g.z*ht,x=g.w*ft;Y.setViewport(v,y,b,x),Y.setScissor(v,y,b,x),Y.setScissorTest(!0),f(s,e,m,c,u,h)}}}else ot=null,f(s,e,r,c,u,h)}}function f(t,e,r,i,n,o){if(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.onBeforeRender(Y,e,r,i,n,o),t.isImmediateRenderObject){Nt.setMaterial(n);var a=b(r,e.fog,n,t);et="",c(t,a,n)}else Y.renderBufferDirect(r,e.fog,i,n,t,o);t.onAfterRender(Y,e,r,i,n,o)}function m(t,e,r){var i=kt.get(t),n=Gt.getParameters(t,Et,e,xt.numPlanes,xt.numIntersection,r),a=Gt.getProgramCode(t,n),c=i.program,u=!0;if(void 0===c)t.addEventListener("dispose",o);else if(c.code!==a)s(t);else{if(void 0!==n.shaderID)return;u=!1}if(u){if(n.shaderID){var h=hp[n.shaderID];i.shader={name:t.type,uniforms:cp.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else i.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(i.shader),c=Gt.acquireProgram(t,i.shader,n,a),i.program=c,t.program=c}var l=c.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(p=0;p<Y.maxMorphTargets;p++)l["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p<Y.maxMorphNormals;p++)l["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var d=i.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=xt.numPlanes,i.numIntersection=xt.numIntersection,d.clippingPlanes=xt.uniform),i.fog=e,i.lightsHash=Et.hash,t.lights&&(d.ambientLightColor.value=Et.ambient,d.directionalLights.value=Et.directional,d.spotLights.value=Et.spot,d.rectAreaLights.value=Et.rectArea,d.pointLights.value=Et.point,d.hemisphereLights.value=Et.hemi,d.directionalShadowMap.value=Et.directionalShadowMap,d.directionalShadowMatrix.value=Et.directionalShadowMatrix,d.spotShadowMap.value=Et.spotShadowMap,d.spotShadowMatrix.value=Et.spotShadowMatrix,d.pointShadowMap.value=Et.pointShadowMap,d.pointShadowMatrix.value=Et.pointShadowMatrix);var f=i.program.getUniforms(),m=J.seqWithValue(f.seq,d);i.uniformsList=m}function b(t,e,r,i){ut=0;var n=kt.get(r);if(_t&&(wt||t!==nt)){var o=t===nt&&r.id===tt;xt.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,t,n,o)}!1===r.needsUpdate&&(void 0===n.program?r.needsUpdate=!0:r.fog&&n.fog!==e?r.needsUpdate=!0:r.lights&&n.lightsHash!==Et.hash?r.needsUpdate=!0:void 0===n.numClippingPlanes||n.numClippingPlanes===xt.numPlanes&&n.numIntersection===xt.numIntersection||(r.needsUpdate=!0)),r.needsUpdate&&(m(r,e,i),r.needsUpdate=!1);var a=!1,s=!1,c=!1,u=n.program,h=u.getUniforms(),l=n.shader.uniforms;if(u.id!==Z&&(Rt.useProgram(u.program),Z=u.id,a=!0,s=!0,c=!0),r.id!==tt&&(tt=r.id,s=!0),a||t!==nt){if(h.setValue(Rt,"projectionMatrix",t.projectionMatrix),Dt.logarithmicDepthBuffer&&h.setValue(Rt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),nt!==(ot||t)&&(nt=ot||t,s=!0,c=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap){var p=h.map.cameraPosition;void 0!==p&&p.setValue(Rt,At.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&h.setValue(Rt,"viewMatrix",t.matrixWorldInverse)}if(r.skinning){h.setOptional(Rt,i,"bindMatrix"),h.setOptional(Rt,i,"bindMatrixInverse");var d=i.skeleton;if(d){var f=d.bones;if(Dt.floatVertexTextures){if(void 0===d.boneTexture){var g=Math.sqrt(4*f.length);g=Kl.nextPowerOfTwo(Math.ceil(g)),g=Math.max(g,4);var v=new Float32Array(g*g*4);v.set(d.boneMatrices);var b=new y(v,g,g,Sl,ml);d.boneMatrices=v,d.boneTexture=b,d.boneTextureSize=g}h.setValue(Rt,"boneTexture",d.boneTexture),h.setValue(Rt,"boneTextureSize",d.boneTextureSize)}else h.setOptional(Rt,d,"boneMatrices")}}return s&&(h.setValue(Rt,"toneMappingExposure",Y.toneMappingExposure),h.setValue(Rt,"toneMappingWhitePoint",Y.toneMappingWhitePoint),r.lights&&R(l,c),e&&r.fog&&A(l,e),(r.isMeshBasicMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshNormalMaterial||r.isMeshDepthMaterial)&&x(l,r),r.isLineBasicMaterial?_(l,r):r.isLineDashedMaterial?(_(l,r),w(l,r)):r.isPointsMaterial?S(l,r):r.isMeshLambertMaterial?M(l,r):r.isMeshToonMaterial?E(l,r):r.isMeshPhongMaterial?T(l,r):r.isMeshPhysicalMaterial?C(l,r):r.isMeshStandardMaterial?P(l,r):r.isMeshDepthMaterial?r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias):r.isMeshNormalMaterial&&I(l,r),void 0!==l.ltcMat&&(l.ltcMat.value=sp.LTC_MAT_TEXTURE),void 0!==l.ltcMag&&(l.ltcMag.value=sp.LTC_MAG_TEXTURE),J.upload(Rt,n.uniformsList,l,Y)),h.setValue(Rt,"modelViewMatrix",i.modelViewMatrix),h.setValue(Rt,"normalMatrix",i.normalMatrix),h.setValue(Rt,"modelMatrix",i.matrixWorld),u}function x(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var r;if(e.map?r=e.map:e.specularMap?r=e.specularMap:e.displacementMap?r=e.displacementMap:e.normalMap?r=e.normalMap:e.bumpMap?r=e.bumpMap:e.roughnessMap?r=e.roughnessMap:e.metalnessMap?r=e.metalnessMap:e.alphaMap?r=e.alphaMap:e.emissiveMap&&(r=e.emissiveMap),void 0!==r){r.isWebGLRenderTarget&&(r=r.texture);var i=r.offset,n=r.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function _(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function w(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function S(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*mt,t.scale.value=.5*ft,t.map.value=e.map,null!==e.map){var r=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}}function A(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function M(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function T(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function E(t,e){T(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function P(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function C(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,P(t,e)}function I(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function R(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function L(t){for(var e=0,r=0,i=t.length;r<i;r++){var n=t[r];n.castShadow&&(Et.shadows[e]=n,e++)}Et.shadows.length=e}function O(t,e){var r,i,n,o,a,s,c,u,h=0,l=0,p=0,d=e.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(r=0,i=t.length;r<i;r++)if(n=t[r],a=n.color,s=n.intensity,c=n.distance,u=n.shadow&&n.shadow.map?n.shadow.map.texture:null,n.isAmbientLight)h+=a.r*s,l+=a.g*s,p+=a.b*s;else if(n.isDirectionalLight)(b=Yt.get(n)).color.copy(n.color).multiplyScalar(n.intensity),b.direction.setFromMatrixPosition(n.matrixWorld),At.setFromMatrixPosition(n.target.matrixWorld),b.direction.sub(At),b.direction.transformDirection(d),b.shadow=n.castShadow,n.castShadow&&(o=n.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),Et.directionalShadowMap[f]=u,Et.directionalShadowMatrix[f]=n.shadow.matrix,Et.directional[f]=b,f++;else if(n.isSpotLight)(b=Yt.get(n)).position.setFromMatrixPosition(n.matrixWorld),b.position.applyMatrix4(d),b.color.copy(a).multiplyScalar(s),b.distance=c,b.direction.setFromMatrixPosition(n.matrixWorld),At.setFromMatrixPosition(n.target.matrixWorld),b.direction.sub(At),b.direction.transformDirection(d),b.coneCos=Math.cos(n.angle),b.penumbraCos=Math.cos(n.angle*(1-n.penumbra)),b.decay=0===n.distance?0:n.decay,b.shadow=n.castShadow,n.castShadow&&(o=n.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),Et.spotShadowMap[g]=u,Et.spotShadowMatrix[g]=n.shadow.matrix,Et.spot[g]=b,g++;else if(n.isRectAreaLight)(b=Yt.get(n)).color.copy(a).multiplyScalar(s/(n.width*n.height)),b.position.setFromMatrixPosition(n.matrixWorld),b.position.applyMatrix4(d),Tt.identity(),Mt.copy(n.matrixWorld),Mt.premultiply(d),Tt.extractRotation(Mt),b.halfWidth.set(.5*n.width,0,0),b.halfHeight.set(0,.5*n.height,0),b.halfWidth.applyMatrix4(Tt),b.halfHeight.applyMatrix4(Tt),Et.rectArea[v]=b,v++;else if(n.isPointLight)(b=Yt.get(n)).position.setFromMatrixPosition(n.matrixWorld),b.position.applyMatrix4(d),b.color.copy(n.color).multiplyScalar(n.intensity),b.distance=n.distance,b.decay=0===n.distance?0:n.decay,b.shadow=n.castShadow,n.castShadow&&(o=n.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),Et.pointShadowMap[m]=u,Et.pointShadowMatrix[m]=n.shadow.matrix,Et.point[m]=b,m++;else if(n.isHemisphereLight){var b=Yt.get(n);b.direction.setFromMatrixPosition(n.matrixWorld),b.direction.transformDirection(d),b.direction.normalize(),b.skyColor.copy(n.color).multiplyScalar(s),b.groundColor.copy(n.groundColor).multiplyScalar(s),Et.hemi[y]=b,y++}Et.ambient[0]=h,Et.ambient[1]=l,Et.ambient[2]=p,Et.directional.length=f,Et.spot.length=g,Et.rectArea.length=v,Et.point.length=m,Et.hemi.length=y,Et.hash=f+","+m+","+g+","+v+","+y+","+Et.shadows.length}function D(){var t=ut;return t>=Dt.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+Dt.maxTextures),ut+=1,t}function N(t){var e;if(t===tl)return Rt.REPEAT;if(t===el)return Rt.CLAMP_TO_EDGE;if(t===rl)return Rt.MIRRORED_REPEAT;if(t===il)return Rt.NEAREST;if(t===nl)return Rt.NEAREST_MIPMAP_NEAREST;if(t===ol)return Rt.NEAREST_MIPMAP_LINEAR;if(t===al)return Rt.LINEAR;if(t===sl)return Rt.LINEAR_MIPMAP_NEAREST;if(t===cl)return Rt.LINEAR_MIPMAP_LINEAR;if(t===ul)return Rt.UNSIGNED_BYTE;if(t===vl)return Rt.UNSIGNED_SHORT_4_4_4_4;if(t===yl)return Rt.UNSIGNED_SHORT_5_5_5_1;if(t===bl)return Rt.UNSIGNED_SHORT_5_6_5;if(t===hl)return Rt.BYTE;if(t===ll)return Rt.SHORT;if(t===pl)return Rt.UNSIGNED_SHORT;if(t===dl)return Rt.INT;if(t===fl)return Rt.UNSIGNED_INT;if(t===ml)return Rt.FLOAT;if(t===gl&&null!==(e=Ot.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===_l)return Rt.ALPHA;if(t===wl)return Rt.RGB;if(t===Sl)return Rt.RGBA;if(t===Al)return Rt.LUMINANCE;if(t===Ml)return Rt.LUMINANCE_ALPHA;if(t===Tl)return Rt.DEPTH_COMPONENT;if(t===El)return Rt.DEPTH_STENCIL;if(t===mh)return Rt.FUNC_ADD;if(t===gh)return Rt.FUNC_SUBTRACT;if(t===vh)return Rt.FUNC_REVERSE_SUBTRACT;if(t===xh)return Rt.ZERO;if(t===_h)return Rt.ONE;if(t===wh)return Rt.SRC_COLOR;if(t===Sh)return Rt.ONE_MINUS_SRC_COLOR;if(t===Ah)return Rt.SRC_ALPHA;if(t===Mh)return Rt.ONE_MINUS_SRC_ALPHA;if(t===Th)return Rt.DST_ALPHA;if(t===Eh)return Rt.ONE_MINUS_DST_ALPHA;if(t===Ph)return Rt.DST_COLOR;if(t===Ch)return Rt.ONE_MINUS_DST_COLOR;if(t===Ih)return Rt.SRC_ALPHA_SATURATE;if((t===Pl||t===Cl||t===Il||t===Rl)&&null!==(e=Ot.get("WEBGL_compressed_texture_s3tc"))){if(t===Pl)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Cl)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Il)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Rl)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Ll||t===Ol||t===Dl||t===Nl)&&null!==(e=Ot.get("WEBGL_compressed_texture_pvrtc"))){if(t===Ll)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ol)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Dl)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Nl)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===kl&&null!==(e=Ot.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===yh||t===bh)&&null!==(e=Ot.get("EXT_blend_minmax"))){if(t===yh)return e.MIN_EXT;if(t===bh)return e.MAX_EXT}return t===xl&&null!==(e=Ot.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",qu);var k=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,B=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,U=void 0===t.stencil||t.stencil,j=void 0!==t.antialias&&t.antialias,G=void 0===t.premultipliedAlpha||t.premultipliedAlpha,V=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,$=[],H=null,W=new Float32Array(8),X=[],q=[];this.domElement=k,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Vh,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var Y=this,Z=null,K=null,Q=null,tt=-1,et="",nt=null,ot=null,at=new d,st=null,ct=new d,ut=0,ht=k.width,ft=k.height,mt=1,gt=new d(0,0,ht,ft),vt=!1,yt=new d(0,0,ht,ft),bt=new lt,xt=new ve,_t=!1,wt=!1,St=new v,At=new g,Mt=new v,Tt=new v,Et={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Pt={geometries:0,textures:0},It={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:It,memory:Pt,programs:null};var Rt;try{var Lt={alpha:B,depth:z,stencil:U,antialias:j,premultipliedAlpha:G,preserveDrawingBuffer:V};if(null===(Rt=F||k.getContext("webgl",Lt)||k.getContext("experimental-webgl",Lt)))throw null!==k.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Rt.getShaderPrecisionFormat&&(Rt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),k.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Ot=new ge(Rt);Ot.get("WEBGL_depth_texture"),Ot.get("OES_texture_float"),Ot.get("OES_texture_float_linear"),Ot.get("OES_texture_half_float"),Ot.get("OES_texture_half_float_linear"),Ot.get("OES_standard_derivatives"),Ot.get("ANGLE_instanced_arrays"),Ot.get("OES_element_index_uint")&&(Ct.MaxIndex=4294967296);var Dt=new de(Rt,Ot,t),Nt=new pe(Rt,Ot,N),kt=new le,Ft=new he(Rt,Ot,Nt,kt,Dt,N,Pt),Bt=new dt(Rt),Ut=new Wt(Rt,Bt,Pt),jt=new qt(Rt,Ut,It),Gt=new ue(this,Dt),Yt=new Xt,Zt=new Vt,Kt=new zt(this,Nt,jt,G),Qt=new me(this);this.info.programs=Gt.programs;var Jt=new Ht(Rt,Ot,It),te=new $t(Rt,Ot,It);r(),this.context=Rt,this.capabilities=Dt,this.extensions=Ot,this.properties=kt,this.renderLists=Zt,this.state=Nt,this.vr=Qt;var ee=new pt(this,Et,jt,Dt);this.shadowMap=ee;var re=new it(this,X),ie=new rt(this,q);this.getContext=function(){return Rt},this.getContextAttributes=function(){return Rt.getContextAttributes()},this.forceContextLoss=function(){var t=Ot.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return Dt.getMaxAnisotropy()},this.getPrecision=function(){return Dt.precision},this.getPixelRatio=function(){return mt},this.setPixelRatio=function(t){void 0!==t&&(mt=t,this.setSize(ht,ft,!1))},this.getSize=function(){return{width:ht,height:ft}},this.setSize=function(t,e,r){var i=Qt.getDevice();i&&i.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(ht=t,ft=e,k.width=t*mt,k.height=e*mt,!1!==r&&(k.style.width=t+"px",k.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:ht*mt,height:ft*mt}},this.setDrawingBufferSize=function(t,e,r){ht=t,ft=e,mt=r,k.width=t*r,k.height=e*r,this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){yt.set(t,ft-e-i,r,i),Nt.viewport(ct.copy(yt).multiplyScalar(mt))},this.setScissor=function(t,e,r,i){gt.set(t,ft-e-i,r,i),Nt.scissor(at.copy(gt).multiplyScalar(mt))},this.setScissorTest=function(t){Nt.setScissorTest(vt=t)},this.getClearColor=Kt.getClearColor,this.setClearColor=Kt.setClearColor,this.getClearAlpha=Kt.getClearAlpha,this.setClearAlpha=Kt.setClearAlpha,this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=Rt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=Rt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=Rt.STENCIL_BUFFER_BIT),Rt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){k.removeEventListener("webglcontextlost",n,!1),Zt.dispose()},this.renderBufferImmediate=function(t,e,r){Nt.initAttributes();var i=kt.get(t);t.hasPositions&&!i.position&&(i.position=Rt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=Rt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=Rt.createBuffer()),t.hasColors&&!i.color&&(i.color=Rt.createBuffer());var n=e.getAttributes();if(t.hasPositions&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,i.position),Rt.bufferData(Rt.ARRAY_BUFFER,t.positionArray,Rt.DYNAMIC_DRAW),Nt.enableAttribute(n.position),Rt.vertexAttribPointer(n.position,3,Rt.FLOAT,!1,0,0)),t.hasNormals){if(Rt.bindBuffer(Rt.ARRAY_BUFFER,i.normal),!r.isMeshPhongMaterial&&!r.isMeshStandardMaterial&&!r.isMeshNormalMaterial&&r.shading===nh)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,c=(s[o+0]+s[o+3]+s[o+6])/3,u=(s[o+1]+s[o+4]+s[o+7])/3,h=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=c,s[o+1]=u,s[o+2]=h,s[o+3]=c,s[o+4]=u,s[o+5]=h,s[o+6]=c,s[o+7]=u,s[o+8]=h}Rt.bufferData(Rt.ARRAY_BUFFER,t.normalArray,Rt.DYNAMIC_DRAW),Nt.enableAttribute(n.normal),Rt.vertexAttribPointer(n.normal,3,Rt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,i.uv),Rt.bufferData(Rt.ARRAY_BUFFER,t.uvArray,Rt.DYNAMIC_DRAW),Nt.enableAttribute(n.uv),Rt.vertexAttribPointer(Bt.uv,2,Rt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==ah&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,i.color),Rt.bufferData(Rt.ARRAY_BUFFER,t.colorArray,Rt.DYNAMIC_DRAW),Nt.enableAttribute(n.color),Rt.vertexAttribPointer(n.color,3,Rt.FLOAT,!1,0,0)),Nt.disableUnusedAttributes(),Rt.drawArrays(Rt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,r,i,n,o,a){Nt.setMaterial(n);var s=b(t,r,n,o),c=i.id+"_"+s.id+"_"+(!0===n.wireframe),l=!1;c!==et&&(et=c,l=!0);var p=o.morphTargetInfluences;if(void 0!==p){for(var d=[],f=0,m=p.length;f<m;f++){v=p[f];d.push([v,f])}d.sort(u),d.length>8&&(d.length=8);for(var g=i.morphAttributes,f=0,m=d.length;f<m;f++){var v=d[f];if(W[f]=v[0],0!==v[0]){x=v[1];!0===n.morphTargets&&g.position&&i.addAttribute("morphTarget"+f,g.position[x]),!0===n.morphNormals&&g.normal&&i.addAttribute("morphNormal"+f,g.normal[x])}else!0===n.morphTargets&&i.removeAttribute("morphTarget"+f),!0===n.morphNormals&&i.removeAttribute("morphNormal"+f)}for(var f=d.length,y=W.length;f<y;f++)W[f]=0;s.getUniforms().setValue(Rt,"morphTargetInfluences",W),l=!0}var x=i.index,_=i.attributes.position,w=1;!0===n.wireframe&&(x=Ut.getWireframeAttribute(i),w=2);var S,A=Jt;null!==x&&(S=Bt.get(x),(A=te).setIndex(S)),l&&(h(n,s,i),null!==x&&Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,S.buffer));var M=0;null!==x?M=x.count:void 0!==_&&(M=_.count);var T=i.drawRange.start*w,E=i.drawRange.count*w,P=null!==a?a.start*w:0,C=null!==a?a.count*w:1/0,I=Math.max(T,P),R=Math.min(M,T+E,P+C)-1,L=Math.max(0,R-I+1);if(0!==L){if(o.isMesh)if(!0===n.wireframe)Nt.setLineWidth(n.wireframeLinewidth*e()),A.setMode(Rt.LINES);else switch(o.drawMode){case zl:A.setMode(Rt.TRIANGLES);break;case Ul:A.setMode(Rt.TRIANGLE_STRIP);break;case jl:A.setMode(Rt.TRIANGLE_FAN)}else if(o.isLine){var O=n.linewidth;void 0===O&&(O=1),Nt.setLineWidth(O*e()),o.isLineSegments?A.setMode(Rt.LINES):o.isLineLoop?A.setMode(Rt.LINE_LOOP):A.setMode(Rt.LINE_STRIP)}else o.isPoints&&A.setMode(Rt.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&A.renderInstances(i,I,L):A.render(I,L)}},this.compile=function(t,e){$=[],t.traverse(function(t){t.isLight&&$.push(t)}),O($,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var r=0;r<e.material.length;r++)m(e.material[r],t.fog,e);else m(e.material,t.fog,e)})},this.animate=function(t){function e(){t(),(Qt.getDevice()||window).requestAnimationFrame(e)}(Qt.getDevice()||window).requestAnimationFrame(e)},this.render=function(t,e,r,i){if(e&&e.isCamera){et="",tt=-1,nt=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),Qt.enabled&&(e=Qt.getCamera(e)),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),bt.setFromMatrix(St),$.length=0,X.length=0,q.length=0,wt=this.localClippingEnabled,_t=xt.init(this.clippingPlanes,wt,e),(H=Zt.get(t,e)).init(),l(t,e,Y.sortObjects),H.finish(),!0===Y.sortObjects&&H.sort(),_t&&xt.beginShadows(),L($),ee.render(t,e),O($,e),_t&&xt.endShadows(),It.frame++,It.calls=0,It.vertices=0,It.faces=0,It.points=0,void 0===r&&(r=null),this.setRenderTarget(r),Kt.render(t,e,i);var n=H.opaque,o=H.transparent;if(t.overrideMaterial){var a=t.overrideMaterial;n.length&&p(n,t,e,a),o.length&&p(o,t,e,a)}else n.length&&p(n,t,e),o.length&&p(o,t,e);re.render(t,e),ie.render(t,e,ct),r&&Ft.updateRenderTargetMipmap(r),Nt.buffers.depth.setTest(!0),Nt.buffers.depth.setMask(!0),Nt.buffers.color.setMask(!0),e.isArrayCamera&&Y.setScissorTest(!1),Qt.enabled&&Qt.submitFrame()}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(t,e){Nt.setCullFace(t),Nt.setFlipSided(e===Qu)},this.allocTextureUnit=D,this.setTexture2D=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Ft.setTexture2D(e,r)}}(),this.setTexture=function(){var t=!1;return function(e,r){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Ft.setTexture2D(e,r)}}(),this.setTextureCube=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Ft.setTextureCube(e,r):Ft.setTextureCubeDynamic(e,r)}}(),this.getRenderTarget=function(){return K},this.setRenderTarget=function(t){K=t,t&&void 0===kt.get(t).__webglFramebuffer&&Ft.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;if(t){var i=kt.get(t);e=r?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,at.copy(t.scissor),st=t.scissorTest,ct.copy(t.viewport)}else e=null,at.copy(gt).multiplyScalar(mt),st=vt,ct.copy(yt).multiplyScalar(mt);if(Q!==e&&(Rt.bindFramebuffer(Rt.FRAMEBUFFER,e),Q=e),Nt.scissor(at),Nt.setScissorTest(st),Nt.viewport(ct),r){var n=kt.get(t.texture);Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,n.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(t&&t.isWebGLRenderTarget){var a=kt.get(t).__webglFramebuffer;if(a){var s=!1;a!==Q&&(Rt.bindFramebuffer(Rt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==Sl&&N(u)!==Rt.getParameter(Rt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===ul||N(h)===Rt.getParameter(Rt.IMPLEMENTATION_COLOR_READ_TYPE)||h===ml&&(Ot.get("OES_texture_float")||Ot.get("WEBGL_color_buffer_float"))||h===gl&&Ot.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Rt.checkFramebufferStatus(Rt.FRAMEBUFFER)===Rt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&r>=0&&r<=t.height-n&&Rt.readPixels(e,r,i,n,N(u),N(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Rt.bindFramebuffer(Rt.FRAMEBUFFER,Q)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function be(t,e){this.name="",this.color=new tt(t),this.density=void 0!==e?e:25e-5}function xe(t,e,r){this.name="",this.color=new tt(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function _e(){gt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function we(t,e,r,i,n){gt.call(this),this.lensFlares=[],this.positionScreen=new g,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,i,n)}function Se(t){nt.call(this),this.type="SpriteMaterial",this.color=new tt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ae(t){gt.call(this),this.type="Sprite",this.material=void 0!==t?t:new Se}function Me(){gt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Te(t,e){var r=this;if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)r.boneInverses.push(new v)}}function Ee(){gt.call(this),this.type="Bone"}function Pe(t,e){Bt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new v,this.bindMatrixInverse=new v;var r=new Te(this.initBones());this.bind(r,this.matrixWorld),this.normalizeSkinWeights()}function Ce(t){nt.call(this),this.type="LineBasicMaterial",this.color=new tt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Ie(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Re(t,e);gt.call(this),this.type="Line",this.geometry=void 0!==t?t:new Ct,this.material=void 0!==e?e:new Ce({color:16777215*Math.random()})}function Re(t,e){Ie.call(this,t,e),this.type="LineSegments"}function Le(t,e){Ie.call(this,t,e),this.type="LineLoop"}function Oe(t){nt.call(this),this.type="PointsMaterial",this.color=new tt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function De(t,e){gt.call(this),this.type="Points",this.geometry=void 0!==t?t:new Ct,this.material=void 0!==e?e:new Oe({color:16777215*Math.random()})}function Ne(){gt.call(this),this.type="Group"}function ke(t,e,r,i,n,o,a,s,c,u,h,l){p.call(this,null,o,a,s,c,u,i,n,h,l),this.image={width:e,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Fe(t,e,r,i,n,o,a,s,c){p.call(this,t,e,r,i,n,o,a,s,c),this.needsUpdate=!0}function Be(t){Ct.call(this),this.type="WireframeGeometry";var e,r,i,n,o,a,s,c,u,h,l=[],p=[0,0],d={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,i=m.length;e<i;e++){var v=m[e];for(r=0;r<3;r++)s=v[f[r]],c=v[f[(r+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]})}for(u in d)a=d[u],h=t.vertices[a.index1],l.push(h.x,h.y,h.z),h=t.vertices[a.index2],l.push(h.x,h.y,h.z)}else if(t&&t.isBufferGeometry){var y,b,x,_,w,S,A;if(h=new g,null!==t.index){for(y=t.attributes.position,b=t.index,0===(x=t.groups).length&&(x=[{start:0,count:b.count,materialIndex:0}]),n=0,o=x.length;n<o;++n)for(e=w=(_=x[n]).start,i=w+_.count;e<i;e+=3)for(r=0;r<3;r++)s=b.getX(e+r),c=b.getX(e+(r+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]});for(u in d)a=d[u],h.fromBufferAttribute(y,a.index1),l.push(h.x,h.y,h.z),h.fromBufferAttribute(y,a.index2),l.push(h.x,h.y,h.z)}else for(e=0,i=(y=t.attributes.position).count/3;e<i;e++)for(r=0;r<3;r++)S=3*e+r,h.fromBufferAttribute(y,S),l.push(h.x,h.y,h.z),A=3*e+(r+1)%3,h.fromBufferAttribute(y,A),l.push(h.x,h.y,h.z)}this.addAttribute("position",new Tt(l,3))}function ze(t,e,r){wt.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new Ue(t,e,r)),this.mergeVertices()}function Ue(t,e,r){Ct.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o=[],a=[],s=[],c=[],u=new g,h=new g,l=new g,p=new g,d=new g,f=e+1;for(i=0;i<=r;i++){var m=i/r;for(n=0;n<=e;n++){var v=n/e;h=t(v,m,h),a.push(h.x,h.y,h.z),v-1e-5>=0?(l=t(v-1e-5,m,l),p.subVectors(h,l)):(l=t(v+1e-5,m,l),p.subVectors(l,h)),m-1e-5>=0?(l=t(v,m-1e-5,l),d.subVectors(h,l)):(l=t(v,m+1e-5,l),d.subVectors(l,h)),u.crossVectors(p,d).normalize(),s.push(u.x,u.y,u.z),c.push(v,m)}}for(i=0;i<r;i++)for(n=0;n<e;n++){var y=i*f+n,b=i*f+n+1,x=(i+1)*f+n+1,_=(i+1)*f+n;o.push(y,b,_),o.push(b,x,_)}this.setIndex(o),this.addAttribute("position",new Tt(a,3)),this.addAttribute("normal",new Tt(s,3)),this.addAttribute("uv",new Tt(c,2))}function je(t,e,r,i){wt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},this.fromBufferGeometry(new Ge(t,e,r,i)),this.mergeVertices()}function Ge(t,e,r,i){function n(t,e,r,i){var n,o,s=Math.pow(2,i),c=[];for(n=0;n<=s;n++){c[n]=[];var u=t.clone().lerp(r,n/s),h=e.clone().lerp(r,n/s),l=s-n;for(o=0;o<=l;o++)c[n][o]=0===o&&n===s?u:u.clone().lerp(h,o/l)}for(n=0;n<s;n++)for(o=0;o<2*(s-n)-1;o++){var p=Math.floor(o/2);o%2==0?(a(c[n][p+1]),a(c[n+1][p]),a(c[n][p])):(a(c[n][p+1]),a(c[n+1][p+1]),a(c[n+1][p]))}}function o(){for(var t=0;t<f.length;t+=6){var e=f[t+0],r=f[t+2],i=f[t+4],n=Math.max(e,r,i),o=Math.min(e,r,i);n>.9&&o<.1&&(e<.2&&(f[t+0]+=1),r<.2&&(f[t+2]+=1),i<.2&&(f[t+4]+=1))}}function a(t){d.push(t.x,t.y,t.z)}function s(e,r){var i=3*e;r.x=t[i+0],r.y=t[i+1],r.z=t[i+2]}function c(){for(var t=new g,e=new g,r=new g,i=new g,n=new l,o=new l,a=new l,s=0,c=0;s<d.length;s+=9,c+=6){t.set(d[s+0],d[s+1],d[s+2]),e.set(d[s+3],d[s+4],d[s+5]),r.set(d[s+6],d[s+7],d[s+8]),n.set(f[c+0],f[c+1]),o.set(f[c+2],f[c+3]),a.set(f[c+4],f[c+5]),i.copy(t).add(e).add(r).divideScalar(3);var p=h(i);u(n,c+0,t,p),u(o,c+2,e,p),u(a,c+4,r,p)}}function u(t,e,r,i){i<0&&1===t.x&&(f[e]=t.x-1),0===r.x&&0===r.z&&(f[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}function p(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Ct.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1;var d=[],f=[];!function(t){for(var r=new g,i=new g,o=new g,a=0;a<e.length;a+=3)s(e[a+0],r),s(e[a+1],i),s(e[a+2],o),n(r,i,o,t)}(i=i||0),function(t){for(var e=new g,r=0;r<d.length;r+=3)e.x=d[r+0],e.y=d[r+1],e.z=d[r+2],e.normalize().multiplyScalar(t),d[r+0]=e.x,d[r+1]=e.y,d[r+2]=e.z}(r),function(){for(var t=new g,e=0;e<d.length;e+=3){t.x=d[e+0],t.y=d[e+1],t.z=d[e+2];var r=h(t)/2/Math.PI+.5,i=p(t)/Math.PI+.5;f.push(r,1-i)}c(),o()}(),this.addAttribute("position",new Tt(d,3)),this.addAttribute("normal",new Tt(d.slice(),3)),this.addAttribute("uv",new Tt(f,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Ve(t,e){wt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new $e(t,e)),this.mergeVertices()}function $e(t,e){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];Ge.call(this,r,i,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function He(t,e){wt.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new We(t,e)),this.mergeVertices()}function We(t,e){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Ge.call(this,r,i,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e){wt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qe(t,e)),this.mergeVertices()}function qe(t,e){var r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],n=[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];Ge.call(this,i,n,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ye(t,e){wt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ze(t,e)),this.mergeVertices()}function Ze(t,e){var r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];Ge.call(this,n,o,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ke(t,e,r,i,n,o){wt.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:i,closed:n},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Qe(t,e,r,i,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Qe(t,e,r,i,n){function o(n){var o=t.getPointAt(n/e),a=c.normals[n],s=c.binormals[n];for(h=0;h<=i;h++){var u=h/i*Math.PI*2,l=Math.sin(u),f=-Math.cos(u);d.x=f*a.x+l*s.x,d.y=f*a.y+l*s.y,d.z=f*a.z+l*s.z,d.normalize(),v.push(d.x,d.y,d.z),p.x=o.x+r*d.x,p.y=o.y+r*d.y,p.z=o.z+r*d.z,m.push(p.x,p.y,p.z)}}function a(){for(h=1;h<=e;h++)for(u=1;u<=i;u++){var t=(i+1)*(h-1)+(u-1),r=(i+1)*h+(u-1),n=(i+1)*h+u,o=(i+1)*(h-1)+u;b.push(t,r,o),b.push(r,n,o)}}function s(){for(u=0;u<=e;u++)for(h=0;h<=i;h++)f.x=u/e,f.y=h/i,y.push(f.x,f.y)}Ct.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:i,closed:n},e=e||64,r=r||1,i=i||8,n=n||!1;var c=t.computeFrenetFrames(e,n);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var u,h,p=new g,d=new g,f=new l,m=[],v=[],y=[],b=[];!function(){for(u=0;u<e;u++)o(u);o(!1===n?e:0),s(),a()}(),this.setIndex(b),this.addAttribute("position",new Tt(m,3)),this.addAttribute("normal",new Tt(v,3)),this.addAttribute("uv",new Tt(y,2))}function Je(t,e,r,i,n,o,a){wt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:i,p:n,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new tr(t,e,r,i,n,o)),this.mergeVertices()}function tr(t,e,r,i,n,o){function a(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t),s=r/e*t,c=Math.cos(s);n.x=i*(2+c)*.5*o,n.y=i*(2+c)*a*.5,n.z=i*Math.sin(s)*.5}Ct.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:i,p:n,q:o},t=t||100,e=e||40,r=Math.floor(r)||64,i=Math.floor(i)||8,n=n||2,o=o||3;var s,c,u=[],h=[],l=[],p=[],d=new g,f=new g,m=new g,v=new g,y=new g,b=new g,x=new g;for(s=0;s<=r;++s){var _=s/r*n*Math.PI*2;for(a(_,n,o,t,m),a(_+.01,n,o,t,v),b.subVectors(v,m),x.addVectors(v,m),y.crossVectors(b,x),x.crossVectors(y,b),y.normalize(),x.normalize(),c=0;c<=i;++c){var w=c/i*Math.PI*2,S=-e*Math.cos(w),A=e*Math.sin(w);d.x=m.x+(S*x.x+A*y.x),d.y=m.y+(S*x.y+A*y.y),d.z=m.z+(S*x.z+A*y.z),h.push(d.x,d.y,d.z),f.subVectors(d,m).normalize(),l.push(f.x,f.y,f.z),p.push(s/r),p.push(c/i)}}for(c=1;c<=r;c++)for(s=1;s<=i;s++){var M=(i+1)*(c-1)+(s-1),T=(i+1)*c+(s-1),E=(i+1)*c+s,P=(i+1)*(c-1)+s;u.push(M,T,P),u.push(T,E,P)}this.setIndex(u),this.addAttribute("position",new Tt(h,3)),this.addAttribute("normal",new Tt(l,3)),this.addAttribute("uv",new Tt(p,2))}function er(t,e,r,i,n){wt.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},this.fromBufferGeometry(new rr(t,e,r,i,n)),this.mergeVertices()}function rr(t,e,r,i,n){Ct.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=Math.floor(r)||8,i=Math.floor(i)||6,n=n||2*Math.PI;var o,a,s=[],c=[],u=[],h=[],l=new g,p=new g,d=new g;for(o=0;o<=r;o++)for(a=0;a<=i;a++){var f=a/i*n,m=o/r*Math.PI*2;p.x=(t+e*Math.cos(m))*Math.cos(f),p.y=(t+e*Math.cos(m))*Math.sin(f),p.z=e*Math.sin(m),c.push(p.x,p.y,p.z),l.x=t*Math.cos(f),l.y=t*Math.sin(f),d.subVectors(p,l).normalize(),u.push(d.x,d.y,d.z),h.push(a/i),h.push(o/r)}for(o=1;o<=r;o++)for(a=1;a<=i;a++){var v=(i+1)*o+a-1,y=(i+1)*(o-1)+a-1,b=(i+1)*(o-1)+a,x=(i+1)*o+a;s.push(v,y,x),s.push(y,b,x)}this.setIndex(s),this.addAttribute("position",new Tt(c,3)),this.addAttribute("normal",new Tt(u,3)),this.addAttribute("uv",new Tt(h,2))}function ir(t,e){wt.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new nr(t,e)),this.mergeVertices()}function nr(t,e){void 0!==t&&(Ct.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals())}function or(t,e){wt.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ar(t,e)),this.mergeVertices()}function ar(t,e){var r=(e=e||{}).font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new wt;var i=r.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),nr.call(this,i,e),this.type="TextBufferGeometry"}function sr(t,e,r,i,n,o,a){wt.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new cr(t,e,r,i,n,o,a)),this.mergeVertices()}function cr(t,e,r,i,n,o,a){Ct.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var s,c,u=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=0,l=[],p=new g,d=new g,f=[],m=[],v=[],y=[];for(c=0;c<=r;c++){var b=[],x=c/r;for(s=0;s<=e;s++){var _=s/e;p.x=-t*Math.cos(i+_*n)*Math.sin(o+x*a),p.y=t*Math.cos(o+x*a),p.z=t*Math.sin(i+_*n)*Math.sin(o+x*a),m.push(p.x,p.y,p.z),d.set(p.x,p.y,p.z).normalize(),v.push(d.x,d.y,d.z),y.push(_,1-x),b.push(h++)}l.push(b)}for(c=0;c<r;c++)for(s=0;s<e;s++){var w=l[c][s+1],S=l[c][s],A=l[c+1][s],M=l[c+1][s+1];(0!==c||o>0)&&f.push(w,S,M),(c!==r-1||u<Math.PI)&&f.push(S,A,M)}this.setIndex(f),this.addAttribute("position",new Tt(m,3)),this.addAttribute("normal",new Tt(v,3)),this.addAttribute("uv",new Tt(y,2))}function ur(t,e,r,i,n,o){wt.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},this.fromBufferGeometry(new hr(t,e,r,i,n,o)),this.mergeVertices()}function hr(t,e,r,i,n,o){Ct.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||20,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s,c,u=[],h=[],p=[],d=[],f=t,m=(e-t)/(i=void 0!==i?Math.max(1,i):1),v=new g,y=new l;for(s=0;s<=i;s++){for(c=0;c<=r;c++)a=n+c/r*o,v.x=f*Math.cos(a),v.y=f*Math.sin(a),h.push(v.x,v.y,v.z),p.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,d.push(y.x,y.y);f+=m}for(s=0;s<i;s++){var b=s*(r+1);for(c=0;c<r;c++){var x=a=c+b,_=a+r+1,w=a+r+2,S=a+1;u.push(x,_,S),u.push(_,w,S)}}this.setIndex(u),this.addAttribute("position",new Tt(h,3)),this.addAttribute("normal",new Tt(p,3)),this.addAttribute("uv",new Tt(d,2))}function lr(t,e,r,i){wt.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},this.fromBufferGeometry(new pr(t,e,r,i)),this.mergeVertices()}function pr(t,e,r,i){Ct.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=Math.floor(e)||12,r=r||0,i=i||2*Math.PI,i=Kl.clamp(i,0,2*Math.PI);var n,o,a,s=[],c=[],u=[],h=1/e,p=new g,d=new l;for(o=0;o<=e;o++){var f=r+o*h*i,m=Math.sin(f),v=Math.cos(f);for(a=0;a<=t.length-1;a++)p.x=t[a].x*m,p.y=t[a].y,p.z=t[a].x*v,c.push(p.x,p.y,p.z),d.x=o/e,d.y=a/(t.length-1),u.push(d.x,d.y)}for(o=0;o<e;o++)for(a=0;a<t.length-1;a++){var y=n=a+o*t.length,b=n+t.length,x=n+t.length+1,_=n+1;s.push(y,b,_),s.push(b,x,_)}if(this.setIndex(s),this.addAttribute("position",new Tt(c,3)),this.addAttribute("uv",new Tt(u,2)),this.computeVertexNormals(),i===2*Math.PI){var w=this.attributes.normal.array,S=new g,A=new g,M=new g;for(n=e*t.length*3,o=0,a=0;o<t.length;o++,a+=3)S.x=w[a+0],S.y=w[a+1],S.z=w[a+2],A.x=w[n+a+0],A.y=w[n+a+1],A.z=w[n+a+2],M.addVectors(S,A).normalize(),w[a+0]=w[n+a+0]=M.x,w[a+1]=w[n+a+1]=M.y,w[a+2]=w[n+a+2]=M.z}}function dr(t,e){wt.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new fr(t,e)),this.mergeVertices()}function fr(t,e){function r(t){var r,i,c,h=o.length/3,l=t.extractPoints(e),p=l.shape,d=l.holes;if(!1===mp.isClockWise(p))for(p=p.reverse(),r=0,i=d.length;r<i;r++)c=d[r],!0===mp.isClockWise(c)&&(d[r]=c.reverse());var f=mp.triangulateShape(p,d);for(r=0,i=d.length;r<i;r++)c=d[r],p=p.concat(c);for(r=0,i=p.length;r<i;r++){var m=p[r];o.push(m.x,m.y,0),a.push(0,0,1),s.push(m.x,m.y)}for(r=0,i=f.length;r<i;r++){var g=f[r],v=g[0]+h,y=g[1]+h,b=g[2]+h;n.push(v,y,b),u+=3}}var i=this;Ct.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],o=[],a=[],s=[],c=0,u=0;if(!1===Array.isArray(t))r(t);else for(var h=0;h<t.length;h++)r(t[h]),i.addGroup(c,u,h),c+=u,u=0;this.setIndex(n),this.addAttribute("position",new Tt(o,3)),this.addAttribute("normal",new Tt(a,3)),this.addAttribute("uv",new Tt(s,2))}function mr(t,e){Ct.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var r,i,n,o,a=[],s=Math.cos(Kl.DEG2RAD*e),c=[0,0],u={},h=["a","b","c"];t.isBufferGeometry?(o=new wt).fromBufferGeometry(t):o=t.clone(),o.mergeVertices(),o.computeFaceNormals();for(var l=o.vertices,p=o.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)r=m[h[g]],i=m[h[(g+1)%3]],c[0]=Math.min(r,i),c[1]=Math.max(r,i),void 0===u[n=c[0]+","+c[1]]?u[n]={index1:c[0],index2:c[1],face1:d,face2:void 0}:u[n].face2=d;for(n in u){var v=u[n];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=s){var y=l[v.index1];a.push(y.x,y.y,y.z),y=l[v.index2],a.push(y.x,y.y,y.z)}}this.addAttribute("position",new Tt(a,3))}function gr(t,e,r,i,n,o,a,s){wt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new vr(t,e,r,i,n,o,a,s)),this.mergeVertices()}function vr(t,e,r,i,n,o,a,s){function c(r){var n,o,c,v=new l,x=new g,_=0,w=!0===r?t:e,S=!0===r?1:-1;for(o=m,n=1;n<=i;n++)p.push(0,y*S,0),d.push(0,S,0),f.push(.5,.5),m++;for(c=m,n=0;n<=i;n++){var A=n/i*s+a,M=Math.cos(A),T=Math.sin(A);x.x=w*T,x.y=y*S,x.z=w*M,p.push(x.x,x.y,x.z),d.push(0,S,0),v.x=.5*M+.5,v.y=.5*T*S+.5,f.push(v.x,v.y),m++}for(n=0;n<i;n++){var E=o+n,P=c+n;!0===r?h.push(P,P+1,E):h.push(P+1,P,E),_+=3}u.addGroup(b,_,!0===r?1:2),b+=_}Ct.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s};var u=this;t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=Math.floor(i)||8,n=Math.floor(n)||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h=[],p=[],d=[],f=[],m=0,v=[],y=r/2,b=0;!function(){var o,c,l=new g,x=new g,_=0,w=(e-t)/r;for(c=0;c<=n;c++){var S=[],A=c/n,M=A*(e-t)+t;for(o=0;o<=i;o++){var T=o/i,E=T*s+a,P=Math.sin(E),C=Math.cos(E);x.x=M*P,x.y=-A*r+y,x.z=M*C,p.push(x.x,x.y,x.z),l.set(P,w,C).normalize(),d.push(l.x,l.y,l.z),f.push(T,1-A),S.push(m++)}v.push(S)}for(o=0;o<i;o++)for(c=0;c<n;c++){var I=v[c][o],R=v[c+1][o],L=v[c+1][o+1],O=v[c][o+1];h.push(I,R,O),h.push(R,L,O),_+=6}u.addGroup(b,_,0),b+=_}(),!1===o&&(t>0&&c(!0),e>0&&c(!1)),this.setIndex(h),this.addAttribute("position",new Tt(p,3)),this.addAttribute("normal",new Tt(d,3)),this.addAttribute("uv",new Tt(f,2))}function yr(t,e,r,i,n,o,a){gr.call(this,0,t,e,r,i,n,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:o,thetaLength:a}}function br(t,e,r,i,n,o,a){vr.call(this,0,t,e,r,i,n,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:o,thetaLength:a}}function xr(t,e,r,i){wt.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new _r(t,e,r,i)),this.mergeVertices()}function _r(t,e,r,i){Ct.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n,o,a=[],s=[],c=[],u=[],h=new g,p=new l;for(s.push(0,0,0),c.push(0,0,1),u.push(.5,.5),o=0,n=3;o<=e;o++,n+=3){var d=r+o/e*i;h.x=t*Math.cos(d),h.y=t*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),p.x=(s[n]/t+1)/2,p.y=(s[n+1]/t+1)/2,u.push(p.x,p.y)}for(n=1;n<=e;n++)a.push(n,n+1,0);this.setIndex(a),this.addAttribute("position",new Tt(s,3)),this.addAttribute("normal",new Tt(c,3)),this.addAttribute("uv",new Tt(u,2))}function wr(t){ot.call(this,{uniforms:cp.merge([sp.lights,{opacity:{value:1}}]),vertexShader:up.shadow_vert,fragmentShader:up.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function Sr(t){ot.call(this,t),this.type="RawShaderMaterial"}function Ar(t){nt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new tt(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new l(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Mr(t){Ar.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Tr(t){nt.call(this),this.type="MeshPhongMaterial",this.color=new tt(16777215),this.specular=new tt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new l(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Er(t){Tr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Pr(t){nt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new l(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Cr(t){nt.call(this),this.type="MeshLambertMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ir(t){nt.call(this),this.type="LineDashedMaterial",this.color=new tt(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Rr(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}function Lr(t){this.manager=void 0!==t?t:bp}function Or(t){this.manager=void 0!==t?t:bp,this._parser=null}function Dr(t){this.manager=void 0!==t?t:bp,this._parser=null}function Nr(t){this.manager=void 0!==t?t:bp}function kr(t){this.manager=void 0!==t?t:bp}function Fr(t){this.manager=void 0!==t?t:bp}function Br(t,e){gt.call(this),this.type="Light",this.color=new tt(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function zr(t,e,r){Br.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(gt.DefaultUp),this.updateMatrix(),this.groundColor=new tt(e)}function Ur(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new l(512,512),this.map=null,this.matrix=new v}function jr(){Ur.call(this,new bt(50,1,.5,500))}function Gr(t,e,r,i,n,o){Br.call(this,t,e),this.type="SpotLight",this.position.copy(gt.DefaultUp),this.updateMatrix(),this.target=new gt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==n?n:0,this.decay=void 0!==o?o:1,this.shadow=new jr}function Vr(t,e,r,i){Br.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new Ur(new bt(90,1,.5,500))}function $r(){Ur.call(this,new yt(-5,5,5,-5,.5,500))}function Hr(t,e){Br.call(this,t,e),this.type="DirectionalLight",this.position.copy(gt.DefaultUp),this.updateMatrix(),this.target=new gt,this.shadow=new $r}function Wr(t,e){Br.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Xr(t,e,r,i){Br.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==r?r:10,this.height=void 0!==i?i:10}function qr(t,e,r,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(r),this.sampleValues=e,this.valueSize=r}function Yr(t,e,r,i){qr.call(this,t,e,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zr(t,e,r,i){qr.call(this,t,e,r,i)}function Kr(t,e,r,i){qr.call(this,t,e,r,i)}function Qr(t,e,r,i){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=xp.convertArray(e,this.TimeBufferType),this.values=xp.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Jr(t,e,r,i){Qr.call(this,t,e,r,i)}function ti(t,e,r,i){qr.call(this,t,e,r,i)}function ei(t,e,r,i){Qr.call(this,t,e,r,i)}function ri(t,e,r,i){Qr.call(this,t,e,r,i)}function ii(t,e,r,i){Qr.call(this,t,e,r,i)}function ni(t,e,r){Qr.call(this,t,e,r)}function oi(t,e,r,i){Qr.call(this,t,e,r,i)}function ai(t,e,r,i){Qr.apply(this,arguments)}function si(t,e,r){this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.uuid=Kl.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function ci(t){this.manager=void 0!==t?t:bp,this.textures={}}function ui(t){this.manager=void 0!==t?t:bp}function hi(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function li(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:bp,this.withCredentials=!1}function pi(t){this.manager=void 0!==t?t:bp,this.texturePath=""}function di(t,e,r,i,n){var o=.5*(i-e),a=.5*(n-r),s=t*t;return(2*r-2*i+o+a)*(t*s)+(-3*r+3*i-2*o-a)*s+o*t+r}function fi(t,e){var r=1-t;return r*r*e}function mi(t,e){return 2*(1-t)*t*e}function gi(t,e){return t*t*e}function vi(t,e,r,i){return fi(t,e)+mi(t,r)+gi(t,i)}function yi(t,e){var r=1-t;return r*r*r*e}function bi(t,e){var r=1-t;return 3*r*r*t*e}function xi(t,e){return 3*(1-t)*t*t*e}function _i(t,e){return t*t*t*e}function wi(t,e,r,i,n){return yi(t,e)+bi(t,r)+xi(t,i)+_i(t,n)}function Si(){this.arcLengthDivisions=200}function Ai(t,e){Si.call(this),this.v1=t,this.v2=e}function Mi(){Si.call(this),this.curves=[],this.autoClose=!1}function Ti(t,e,r,i,n,o,a,s){Si.call(this),this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function Ei(t){Si.call(this),this.points=void 0===t?[]:t}function Pi(t,e,r,i){Si.call(this),this.v0=t,this.v1=e,this.v2=r,this.v3=i}function Ci(t,e,r){Si.call(this),this.v0=t,this.v1=e,this.v2=r}function Ii(t){Mi.call(this),this.currentPoint=new l,t&&this.fromPoints(t)}function Ri(){Ii.apply(this,arguments),this.holes=[]}function Li(){this.subPaths=[],this.currentPath=null}function Oi(t){this.data=t}function Di(t){this.manager=void 0!==t?t:bp}function Ni(t){this.manager=void 0!==t?t:bp}function ki(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new bt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new bt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Fi(){gt.call(this),this.type="AudioListener",this.context=Pp.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Bi(t){gt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function zi(t){Bi.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Ui(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function ji(t,e,r){this.binding=t,this.valueSize=r;var i,n=Float64Array;switch(e){case"quaternion":i=this._slerp;break;case"string":case"bool":n=Array,i=this._select;break;default:i=this._lerp}this.buffer=new n(4*r),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Gi(t,e,r){var i=r||Vi.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Vi(t,e,r){this.path=e,this.parsedPath=r||Vi.parseTrackName(e),this.node=Vi.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function $i(t){var e=arguments;this.uuid=Kl.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var r={};this._indicesByUUID=r;for(var i=0,n=arguments.length;i!==n;++i)r[e[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var o=this;this.stats={objects:{get total(){return o._objects.length},get inUse(){return this.total-o.nCachedObjects_}},get bindingsPerObject(){return o._bindings.length}}}function Hi(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null;for(var i=e.tracks,n=i.length,o=new Array(n),a={endingStart:Bl,endingEnd:Bl},s=0;s!==n;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Fl,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Wi(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Xi(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function qi(){Ct.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Yi(t,e,r,i){this.uuid=Kl.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===i}function Zi(t,e){this.uuid=Kl.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ki(t,e,r){Zi.call(this,t,e),this.meshPerAttribute=r||1}function Qi(t,e,r){St.call(this,t,e),this.meshPerAttribute=r||1}function Ji(t,e,r,i){this.ray=new Nt(t,e),this.near=r||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function tn(t,e){return t.distance-e.distance}function en(t,e,r,i){if(!1!==t.visible&&(t.raycast(e,r),!0===i))for(var n=t.children,o=0,a=n.length;o<a;o++)en(n[o],e,r,!0)}function rn(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function nn(t,e,r){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==r?r:0,this}function on(t,e,r){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==r?r:0,this}function an(t,e,r,i){this.object=t,this.size=void 0!==e?e:1;var n=void 0!==r?r:16711680,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var c=new Ct,u=new Tt(2*a*3,3);c.addAttribute("position",u),Re.call(this,c,new Ce({color:n,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function sn(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,sn(t.children[r]));return e}function cn(t){for(var e=sn(t),r=new Ct,i=[],n=[],o=new tt(0,0,1),a=new tt(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),n.push(o.r,o.g,o.b),n.push(a.r,a.g,a.b))}r.addAttribute("position",new Tt(i,3)),r.addAttribute("color",new Tt(n,3));var u=new Ce({vertexColors:ch,depthTest:!1,depthWrite:!1,transparent:!0});Re.call(this,r,u),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.onBeforeRender()}function un(t,e){gt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var r=new We(e);r.rotateY(.5*Math.PI);var i=new Dt({vertexColors:ch,wireframe:!0}),n=r.getAttribute("position"),o=new Float32Array(3*n.count);r.addAttribute("color",new St(o,3)),this.add(new Bt(r,i)),this.update()}function hn(t,e,r,i){this.object=t,this.size=void 0!==e?e:1;var n=void 0!==r?r:16776960,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Ct,u=new Tt(2*a*3,3);c.addAttribute("position",u),Re.call(this,c,new Ce({color:n,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function ln(t){function e(t,e,i){r(t,i),r(e,i)}function r(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var i=new Ct,n=new Ce({color:16777215,vertexColors:sh}),o=[],a=[],s={},c=new tt(16755200),u=new tt(16711680),h=new tt(43775),l=new tt(16777215),p=new tt(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",u),e("p","n2",u),e("p","n3",u),e("p","n4",u),e("u1","u2",h),e("u2","u3",h),e("u3","u1",h),e("c","t",l),e("p","c",p),e("cn1","cn2",p),e("cn3","cn4",p),e("cf1","cf2",p),e("cf3","cf4",p),i.addAttribute("position",new Tt(o,3)),i.addAttribute("color",new Tt(a,3)),Re.call(this,i,n),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function pn(){function t(t,o,a,s){e=t,r=a,i=-3*t+3*o-2*a-s,n=2*t-2*o+a+s}var e=0,r=0,i=0,n=0;return{initCatmullRom:function(e,r,i,n,o){t(r,i,o*(i-e),o*(n-r))},initNonuniformCatmullRom:function(e,r,i,n,o,a,s){var c=(r-e)/o-(i-e)/(o+a)+(i-r)/a,u=(i-r)/a-(n-r)/(a+s)+(n-i)/s;t(r,i,c*=a,u*=a)},calc:function(t){var o=t*t;return e+r*t+i*o+n*(o*t)}}}function dn(t){Si.call(this),t.length<2&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function fn(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),dn.call(this,t),this.type="catmullrom"}function mn(t){if("undefined"!=typeof window){var e=new RegExp(t+"=([^&#=]*)").exec(window.location.search);return e?decodeURIComponent(e[1]):void 0}}function gn(t,e){return void 0!==t?t:e}function vn(t,e){e=gn(e,[]);for(var r=0;r<t.length;r++)Array.isArray(t[r])?vn(t[r],e):e.push(t[r]);return e}function yn(){var t=window.location.protocol;return null===t.match(/http(s)?:/gi)?"http:":t}function bn(){if("undefined"==typeof window)return!1;var t=window.navigator.userAgent;return/Opera|OPR/.test(t)?"Opera":/Chrome/i.test(t)?"Chrome":/Firefox/i.test(t)?"Firefox":/Mobile(\/.*)? Safari/i.test(t)?"Mobile Safari":/MSIE/i.test(t)?"Internet Explorer":!!/Safari/i.test(t)&&"Safari"}function xn(t){var e=window.location,r=e.pathname,i=r.substring(0,r.lastIndexOf("/")+1);return e.origin+i+t}function _n(t,e){function r(t){window.open(t,"_blank")||(window.location.href=t)}function i(t){r(o?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"))}if(t){e=e||"download";var n="Safari"===bn(),o=/CriOS\/[\d]+/.test(window.navigator.userAgent),a=document.createElement("a");if("undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(t,e);else if((n||o)&&window.FileReader)if(t instanceof window.Blob){var s=new window.FileReader;s.onloadend=function(){i(s.result)},s.readAsDataURL(t)}else i(t);else t instanceof window.Blob&&(t=window.URL.createObjectURL(t)),"download"in a?(a.style.display="hidden",document.body.appendChild(a),a.href=t,a.download=e,a.target="_blank",a.click(),document.body.removeChild(a)):r(t),t instanceof window.Blob&&window.URL.revokeObjectURL(t)}}function wn(t){var e,r,i,n=Yf.names,o=(e="undefined"!=typeof window&&t instanceof window.File||"undefined"!=typeof window&&t instanceof window.Blob?t.name||"":t).lastIndexOf("?"),a=(e=e.substring(0,-1===o?e.length:o)).replace(/^.*[\\/]/,""),s=a.substring(0,a.lastIndexOf(".")),c=a.split("."),u=c.length>1?c.pop().toLowerCase():"",h=e.match(/^(.+):\/\/(.+)$/);h&&(i=h[1].toLowerCase(),e=h[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(n.includes(u)){r=u;var p=e.length-u.length-1;u=e.substr(0,p).split(".").pop().toLowerCase();var d=s.length-u.length-1;s=s.substr(0,d)}else r=!1;return{path:e,name:a,ext:u,base:s,dir:l,compressed:r,protocol:i,src:t}}function Sn(t,e,r){var i,n,o,a=null,s=0;r||(r={});var c=function(){s=!1===r.leading?0:Date.now(),a=null,o=t.apply(i,n),a||(i=n=null)};return function(){var u=Date.now();s||!1!==r.leading||(s=u);var h=e-(u-s);return i=this,n=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(i,n),a||(i=n=null)):a||!1===r.trailing||(a=setTimeout(c,h)),o}}function An(t,e){return t<e?-1:t>e?1:0}function Mn(t,e,r){void 0===r&&(r=An);for(var i=0,n=t.length-1;i<=n;){var o=i+n>>1,a=r(e,t[o]);if(a>0)i=o+1;else{if(!(a<0))return o;n=o-1}}return-i-1}function Tn(t,e){var r=t.length-1;if(t[r]<e)return-1;for(var i=0;i<=r;){var n=i+r>>1;t[n]>=e?r=n-1:i=n+1}return r+1}function En(t,e){if(t[0]>e)return-1;for(var r=0,i=t.length-1;r<=i;){var n=r+i>>1;t[n]>e?i=n-1:r=n+1}return r-1}function Pn(t,e,r){var i=Tn(t,e),n=En(t,r);return-1===i||-1===n||i>n?0:n-i+1}function Cn(t){return t.sort().filter(function(t,e,r){return 0===e||t!==r[e-1]})}function In(t){if(t.length>28672){for(var e=[],r=0;r<t.length;r+=28672)e.push(String.fromCharCode.apply(null,t.subarray(r,r+28672)));return e.join("")}return String.fromCharCode.apply(null,t)}function Rn(t,e,r){e=void 0!==e?e:10485760,r=void 0!==r?r:"\n";for(var i="",n=[],o=0;o<t.length;o+=e){var a=In(t.subarray(o,o+e)),s=a.lastIndexOf(r);if(-1===s)i+=a;else{var c=i+a.substr(0,s);n=n.concat(c.split(r)),i=s===a.length-r.length?"":a.substr(s+r.length)}}return""!==i&&n.push(i),n}function Ln(t,e){switch(t){case"int8":return new Int8Array(e);case"int16":return new Int16Array(e);case"int32":return new Int32Array(e);case"uint8":return new Uint8Array(e);case"uint16":return new Uint16Array(e);case"uint32":return new Uint32Array(e);case"float32":return new Float32Array(e);default:throw new Error("arrayType unknown: "+t)}}function On(t,e){return new(e>65535?Uint32Array:Uint16Array)(t)}function Dn(t){return Array.isArray(t)?t:[t]}function Nn(t){return t.buffer&&t.buffer instanceof ArrayBuffer?t.buffer:t}function kn(t,e){return t instanceof e?t:new e(t)}function Fn(t,e){return void 0===t?t=new e:Array.isArray(t)&&(t=(new e).fromArray(t)),t}function Bn(t){return Fn(t,l)}function zn(t){return Fn(t,g)}function Un(t){return Fn(t,v)}function jn(t){return Fn(t,m)}function Gn(t){return kn(t,Float32Array)}function Vn(t){return gn(t,"").toString().toLowerCase()}function $n(t){return.01745*t}function Hn(t){return 57.29578*t}function Wn(){for(var t,e=0,r=0;r<36;r++)8===r||13===r||18===r||23===r?cf[r]="-":14===r?cf[r]="4":(e<=2&&(e=33554432+16777216*Math.random()|0),t=15&e,e>>=4,cf[r]=sf[19===r?3&t|8:t]);return cf.join("")}function Xn(t){return t-=t>>1&1431655765,16843009*((t=(858993459&t)+(t>>2&858993459))+(t>>4)&252645135)>>24}function qn(t,e,r){return(t-e)/(r-e)}function Yn(t,e,r){return Math.max(e,Math.min(r,t))}function Zn(t){return Yn(t,0,100)}function Kn(t){return Yn(t,0,1)}function Qn(t,e,r){return t+(e-t)*r}function Jn(t,e,r,i,n,o){var a=(r-t)*o,s=(i-e)*o,c=n*n;return(2*e-2*r+a+s)*(n*c)+(-3*e+3*r-2*a-s)*c+a*n+e}function to(t,e,r){return(r=Kn(qn(r,t,e)))*r*(3-2*r)}function eo(t,e,r){if(t>e)return t;var i=t/e;return((2*r-e)*i+(2*e-3*r))*i*i+r}function ro(t,e,r,i,n){this._listener=e,this._isOnce=r,this.context=i,this._signal=t,this._priority=n||0}function io(t,e){if("function"!=typeof t)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",e))}function no(){this._bindings=[],this._prevParams=null;var t=this;this.dispatch=function(){no.prototype.dispatch.apply(t,arguments)}}function oo(t){var e={operator:void 0,rules:[]};if(!t)return e;var r,i,n=e,o=[];"("===(t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim()).charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());for(var a,s=t.split(/\s+/),c=function(t){r={operator:t,rules:[]},void 0===n?(n=r,e=r):(n.rules.push(r),o.push(n),n=r)},u=function(t){i=n,void 0===(n=o.pop())&&(c(t),h(i))},h=function(t){n.rules.push(t)},l=0;l<s.length;++l){var p=s[l],d=p.toUpperCase();if("("!==p)if(")"!==p){if(a>0)if("NOT"===d)a=1;else if(1===a)a=2;else{if(2!==a)throw new Error("something went wrong with 'not'");a=!1,u()}if("AND"!==d)if("OR"!==d)if("NOT"!==p.toUpperCase()){var f=pf[d];if(void 0===f)if("HYDROGEN"!==d)if("SMALL"!==d)if("NUCLEOPHILIC"!==d)if("HYDROPHOBIC"!==d)if("AROMATIC"!==d)if("AMIDE"!==d)if("ACIDIC"!==d)if("BASIC"!==d)if("CHARGED"!==d)if("POLAR"!==d)if("NONPOLAR"!==d)if("CYCLIC"!==d)if("ALIPHATIC"!==d)if("SIDECHAINATTACHED"!==d)if("LIGAND"!==d)if(-1===df.indexOf(d))if("@"!==p.charAt(0))if("#"!==p.charAt(0))if("_"!==p.charAt(0))if("["!==p[0]||"]"!==p[p.length-1])if(p.length>=1&&p.length<=4&&"^"!==p[0]&&":"!==p[0]&&"."!==p[0]&&"%"!==p[0]&&"/"!==p[0]&&isNaN(parseInt(p)))h({resname:d});else{var m={operator:"AND",rules:[]},g=p.split("/");if(g.length>1&&g[1]){if(isNaN(parseInt(g[1])))throw new Error("model must be an integer");m.rules.push({model:parseInt(g[1])})}var v=g[0].split("%");v.length>1&&m.rules.push({altloc:v[1]});var y=v[0].split(".");if(y.length>1&&y[1]){if(y[1].length>4)throw new Error("atomname must be one to four characters");m.rules.push({atomname:y[1].substring(0,4).toUpperCase()})}var b=y[0].split(":");b.length>1&&b[1]&&m.rules.push({chainname:b[1]});var x=b[0].split("^");if(x.length>1&&m.rules.push({inscode:x[1]}),x[0]){var _=void 0,w=void 0;"-"===x[0][0]&&(x[0]=x[0].substr(1),_=!0),x[0].includes("--")&&(x[0]=x[0].replace("--","-"),w=!0);var S=x[0].split("-");if(1===S.length){if(S=parseInt(S[0]),isNaN(S))throw new Error("resi must be an integer");_&&(S*=-1),m.rules.push({resno:S})}else{if(2!==S.length)throw new Error("resi range must contain one '-'");_&&(S[0]*=-1),w&&(S[1]*=-1),m.rules.push({resno:[parseInt(S[0]),parseInt(S[1])]})}}if(1===m.rules.length)h(m.rules[0]);else{if(!(m.rules.length>1))throw new Error("empty selection chunk");h(m)}}else{var A=d.substr(1,p.length-2).split(","),M=A.length>1?A:A[0];h({resname:M})}else h({element:d.substr(1)});else console.error("# for element selection deprecated, use _"),h({element:d.substr(1)});else{for(var T=p.substr(1).split(","),E=0,P=T.length;E<P;++E)T[E]=parseInt(T[E]);T.sort(function(t,e){return t-e}),h({atomindex:T})}else h({keyword:pf.ALL});else h({operator:"AND",rules:[{operator:"OR",rules:[{operator:"AND",rules:[{keyword:pf.HETERO},{negate:!0,operator:void 0,rules:[{keyword:pf.POLYMER}]}]},{negate:!0,operator:void 0,rules:[{keyword:pf.POLYMER}]}]},{negate:!0,operator:void 0,rules:[{operator:"OR",rules:[{keyword:pf.WATER},{keyword:pf.ION}]}]}]});else h({operator:"OR",rules:[{keyword:pf.SIDECHAIN},{operator:"AND",negate:!1,rules:[{keyword:pf.PROTEIN},{operator:"OR",negate:!1,rules:[{atomname:"CA"},{atomname:"BB"}]}]},{operator:"AND",negate:!1,rules:[{resname:"PRO"},{atomname:"N"}]},{operator:"AND",negate:!1,rules:[{keyword:pf.NUCLEIC},{operator:"OR",negate:!0,rules:[{atomname:"P"},{atomname:"OP1"},{atomname:"OP2"},{atomname:"O3'"},{atomname:"O3*"},{atomname:"O5'"},{atomname:"O5*"},{atomname:"C5'"},{atomname:"C5*"}]}]}]});else h({resname:Ef});else h({resname:Tf});else h({resname:Mf});else h({resname:Af});else h({resname:Sf});else h({resname:wf});else h({resname:_f});else h({resname:xf});else h({resname:bf});else h({resname:yf});else h({resname:vf});else h({resname:gf});else h({element:"H"});else h({keyword:f})}else a=1,c(),n.negate=!0;else"AND"===n.operator?u("OR"):n.operator="OR";else if("OR"===n.operator){var C=n.rules.pop();c("AND"),h(C)}else n.operator="AND"}else u(),n.negate&&u();else a=!1,c()}return void 0===e.operator&&1===e.rules.length&&e.rules[0].hasOwnProperty("operator")&&(e=e.rules[0]),e}function ao(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===pf.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===pf.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===pf.BONDED&&!t.isBonded())return!1;if(e.keyword===pf.RING&&!t.isRing())return!1;if(e.keyword===pf.HETERO&&!t.isHetero())return!1;if(e.keyword===pf.PROTEIN&&!t.isProtein())return!1;if(e.keyword===pf.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===pf.RNA&&!t.isRna())return!1;if(e.keyword===pf.DNA&&!t.isDna())return!1;if(e.keyword===pf.POLYMER&&!t.isPolymer())return!1;if(e.keyword===pf.WATER&&!t.isWater())return!1;if(e.keyword===pf.HELIX&&!t.isHelix())return!1;if(e.keyword===pf.SHEET&&!t.isSheet())return!1;if(e.keyword===pf.TURN&&!t.isTurn())return!1;if(e.keyword===pf.ION&&!t.isIon())return!1;if(e.keyword===pf.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&Mn(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname)if(Array.isArray(e.resname)){if(!e.resname.includes(t.resname))return!1}else if(e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]<t.resno)return!1}else if(e.resno!==t.resno)return!1;return(void 0===e.inscode||e.inscode===t.inscode)&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function so(t,e){if(void 0===e.resname&&void 0===e.resno&&void 0===e.inscode&&void 0===e.sstruc&&void 0===e.model&&void 0===e.chainname&&void 0===e.atomindex&&(void 0===e.keyword||ff.includes(e.keyword)))return-1;if(void 0!==e.keyword){if(e.keyword===pf.HETERO&&!t.isHetero())return!1;if(e.keyword===pf.PROTEIN&&!t.isProtein())return!1;if(e.keyword===pf.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===pf.RNA&&!t.isRna())return!1;if(e.keyword===pf.DNA&&!t.isDna())return!1;if(e.keyword===pf.POLYMER&&!t.isPolymer())return!1;if(e.keyword===pf.WATER&&!t.isWater())return!1;if(e.keyword===pf.HELIX&&!t.isHelix())return!1;if(e.keyword===pf.SHEET&&!t.isSheet())return!1;if(e.keyword===pf.TURN&&!t.isTurn())return!1;if(e.keyword===pf.ION&&!t.isIon())return!1;if(e.keyword===pf.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomindex&&0===Pn(e.atomindex,t.atomOffset,t.atomEnd))return!1;if(void 0!==e.resname)if(Array.isArray(e.resname)){if(!e.resname.includes(t.resname))return!1}else if(e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]<t.resno)return!1}else if(e.resno!==t.resno)return!1;return(void 0===e.inscode||e.inscode===t.inscode)&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function co(t,e){if(!(void 0!==e.chainname||void 0!==e.model||void 0!==e.atomindex||void 0!==e.keyword&&mf.includes(e.keyword)&&t.entity))return-1;if(void 0!==e.keyword){if(e.keyword===pf.POLYMER&&!t.entity.isPolymer())return!1;if(e.keyword===pf.WATER&&!t.entity.isWater())return!1}return(void 0===e.atomindex||0!==Pn(e.atomindex,t.atomOffset,t.atomEnd))&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function uo(t,e){return void 0===e.model&&void 0===e.atomindex?-1:(void 0===e.atomindex||0!==Pn(e.atomindex,t.atomOffset,t.atomEnd))&&(void 0===e.model||e.model===t.index)}function ho(t,e){if(null===t)return!1;if(t.error)return!1;var r=t.rules.length;if(0===r)return!1;for(var i=!t.negate,n=!!t.negate,o=[],a=0;a<r;++a){var s=t.rules[a];s.hasOwnProperty("operator")&&(o[a]=ho(s,e))}return function(a){for(var s="AND"===t.operator,c=!1,u=0;u<r;++u){var h=t.rules[u],l=void 0;if(h.hasOwnProperty("operator")){if(-1===(l=o[u]?o[u](a):-1)){c=!0;continue}if(!0===l){if(s)continue;return i}if(s)return n}else{if(h.keyword===pf.ALL){if(s)continue;return i}if(-1!==(l=e(a,h))){if(!0===l){if(s)continue;return i}if(s)return n}else c=!0}}return c?-1:s?i:n}}function lo(t,e){if(t.error)return t;var r=t.rules.length;if(0===r)return t;var i={operator:t.operator,rules:[]};t.hasOwnProperty("negate")&&(i.negate=t.negate);for(var n=0;n<r;++n){var o=t.rules[n];if(o.hasOwnProperty("operator")){var a=lo(o,e);null!==a&&i.rules.push(a)}else e(o)||i.rules.push(o)}return i.rules.length>0?t:null}function po(t,e){return e&&(t=lo(t,function(t){return void 0!==t.keyword&&!ff.includes(t.keyword)||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))})),ho(t,ao)}function fo(t,e){return e&&(t=lo(t,function(t){return!(void 0===t.keyword||!ff.includes(t.keyword))||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.atomname||(void 0!==t.element||void 0!==t.altloc))))},t)),ho(t,so)}function mo(t,e){return e&&(t=lo(t,function(t){return void 0!==t.keyword&&!mf.includes(t.keyword)||(void 0!==t.resname||(void 0!==t.resno||(void 0!==t.atomname||(void 0!==t.element||(void 0!==t.altloc||(void 0!==t.sstruc||void 0!==t.inscode))))))})),ho(t,co)}function go(t,e){return e&&(t=lo(t,function(t){return void 0!==t.keyword||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||(void 0!==t.atomname||(void 0!==t.element||(void 0!==t.altloc||(void 0!==t.sstruc||void 0!==t.inscode)))))))})),ho(t,uo)}function vo(t){var e=t;return t.forEach(function(t){t.__deps&&Array.prototype.push.apply(e,vo(t.__deps))}),e}function yo(t){return Cn(vo(t)).map(function(t){return t.toString()}).join("\n\n\n")}function bo(t){var e=t.data.__name,r=t.data.__postId;if(void 0===e)console.error("message __name undefined");else if(void 0===self.func)console.error("worker func undefined",e);else{var i=function(t,e){t=t||{},void 0!==r&&(t.__postId=r);try{self.postMessage(t,e)}catch(e){console.error("self.postMessage:",e),self.postMessage(t)}};self.func(t,i)}}function xo(t,e){var r="'use strict';\n\n"+yo(e);return r+="\n\n\nself.func = "+t.toString()+";",r+="\n\n\nself.onmessage = "+bo.toString()+";",new window.Blob([r],{type:"application/javascript"})}function _o(t){Bf=t}function wo(t){zf=t}function So(e){t.Debug=e}function Ao(t){var e=wn(t),r=Hf.get(e.protocol);return r&&!(e=wn(r.getUrl(e.src))).ext&&r.getExt&&(e.ext=r.getExt(t)),e}function Mo(t,e){var r,i=Object.assign(Ao(t),e);return Xf.names.includes(i.ext)?r=nm:Gf.includes(i.ext)?r=sm:"plugin"===i.ext&&(r=cm),r?new r(i.src,i).load():Promise.reject(new Error("autoLoad: ext '"+i.ext+"' unknown"))}function To(t){return Eo(Po(t),arguments)}function Eo(t,e){var r,i,n,o,a,s,c,u,h,l=1,p=t.length,d="";for(i=0;i<p;i++)if("string"==typeof t[i])d+=t[i];else if("object"==typeof t[i]){if((o=t[i]).keys)for(r=e[l],n=0;n<o.keys.length;n++){if(!r.hasOwnProperty(o.keys[n]))throw new Error(To('[sprintf] property "%s" does not exist',o.keys[n]));r=r[o.keys[n]]}else r=o.param_no?e[o.param_no]:e[l++];if(lm.not_type.test(o.type)&&lm.not_primitive.test(o.type)&&r instanceof Function&&(r=r()),lm.numeric_arg.test(o.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(To("[sprintf] expecting number but found %T",r));switch(lm.number.test(o.type)&&(u=r>=0),o.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,o.width?parseInt(o.width):0);break;case"e":r=o.precision?parseFloat(r).toExponential(o.precision):parseFloat(r).toExponential();break;case"f":r=o.precision?parseFloat(r).toFixed(o.precision):parseFloat(r);break;case"g":r=o.precision?String(Number(r.toPrecision(o.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=o.precision?r.substring(0,o.precision):r;break;case"t":r=String(!!r),r=o.precision?r.substring(0,o.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=o.precision?r.substring(0,o.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=o.precision?r.substring(0,o.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}lm.json.test(o.type)?d+=r:(!lm.number.test(o.type)||u&&!o.sign?h="":(h=u?"+":"-",r=r.toString().replace(lm.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",c=o.width-(h+r).length,a=o.width&&c>0?s.repeat(c):"",d+=o.align?h+r+a:"0"===s?h+a+r:a+h+r)}return d}function Po(t){if(pm[t])return pm[t];for(var e,r=t,i=[],n=0;r;){if(null!==(e=lm.text.exec(r)))i.push(e[0]);else if(null!==(e=lm.modulo.exec(r)))i.push("%");else{if(null===(e=lm.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){n|=1;var o=[],a=e[2],s=[];if(null===(s=lm.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(s[1]);""!==(a=a.substring(s[0].length));)if(null!==(s=lm.key_access.exec(a)))o.push(s[1]);else{if(null===(s=lm.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(s[1])}e[2]=o}else n|=2;if(3===n)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}r=r.substring(e[0].length)}return pm[t]=i}function Co(){this.signals={updated:new no},this.begin(),this.maxDuration=-1/0,this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}function Io(t){if(void 0===t)return"";var e=[];for(var r in t){var i=t[r];!1!==i&&e.push("#define "+r+" "+i)}return e.join("\n")+"\n"}function Ro(t,e){e=e||{};var r=t+"|";for(var i in e)r+=i+":"+e[i];if(!bm[r]){var n=Io(e),o=qf.get("shader/"+t);if(!o)throw new Error("empty shader, '"+t+"'");o=o.replace(ym,function(t,e){var r="shader/chunk/"+e+".glsl";return qf.get(r)||up[e]||""}),bm[r]=n+o}return bm[r]}function Lo(t,e,r,i){function n(e){var i=e%u,n=Math.floor(e/u),o=i*m,a=n*g;r.camera.setViewOffset(m*u,g*u,o,a,m,g),r.render(),h?v.drawImage(t.domElement,Math.floor(o/2),Math.floor(a/2),Math.ceil(m/2),Math.ceil(g/2)):v.drawImage(t.domElement,Math.floor(o),Math.floor(a),Math.ceil(m),Math.ceil(g)),"function"==typeof l&&l(e+1,d,!1)}function o(){r.setSampling(y),r.camera.view=null,"function"==typeof p&&p(d+1,d,!1)}function a(){for(var t=0;t<=d;++t)t===d?o():n(t)}function s(){function t(){e===d?o():n(e),e+=1}for(var e=0,r=0;r<=d;++r)setTimeout(t,0,r)}var c=i||{},u=void 0!==c.factor?c.factor:2,h=void 0!==c.antialias&&c.antialias,l=c.onProgress,p=c.onFinish;h&&(u*=2);var d=u*u,f=document.createElement("canvas"),m=r.width,g=r.height;h?(f.width=m*u/2,f.height=g*u/2):(f.width=m*u,f.height=g*u);var v=f.getContext("2d"),y=r.sampleLevel;r.setSampling(-1),this.render=a,this.renderAsync=s,this.canvas=f}function Oo(t,e,r,i,n){r=r||1,i=i||0;var o,a,s=n?n.length:t.length/r,c=0,u=0;if(n)for(a=0;a<s;++a)o=(t[n[a]*r+i]+e)%e/e*Tm-Math.PI,c+=Math.cos(o),u+=Math.sin(o);else for(a=i;a<s;a+=r)o=(t[a]+e)%e/e*Tm-Math.PI,c+=Math.cos(o),u+=Math.sin(o);return c/=s,u/=s,(Math.atan2(u,c)+Math.PI)/Tm*e}function Do(t,e,r,i){var n=t.length;r=r||new Float32Array(n),i=i||0;for(var o=0;o<n;o+=3)r[i+o+0]=(t[o+0]+e[o+0])/2,r[i+o+1]=(t[o+1]+e[o+1])/2,r[i+o+2]=(t[o+2]+e[o+2])/2;return r}function No(t,e,r){for(var i=r||new Float32Array(t),n=0;n<t;++n)i[n]=e;return i}function ko(t,e,r,i,n){for(var o,a=n||new Float32Array(3*t),s=0;s<t;++s)a[(o=3*s)+0]=e,a[o+1]=r,a[o+2]=i;return a}function Fo(t,e){var r=t.length;e=e||new g;for(var i=0;i<r;i+=3)e.x+=t[i],e.y+=t[i+1],e.z+=t[i+2];return e.divideScalar(r/3),e}function Bo(t){for(var e=new Float32Array(t),r=0;r<t;++r)e[r]=r;return e}function zo(t,e,r,i){void 0===r&&(r=0);for(var n=i||new Float32Array(t*e),o=0;o<t;++o)for(var a=r+o*e,s=0;s<e;++s)n[a+s]=o;return n}function Uo(t,e){for(var r=t.length,i=new Float32Array(r),n=0;n<r;n++)i[n]=Math.min(t[n],e[n]);return i}function jo(t,e,r,i,n){for(var o=0;o<n;++o)e[i+o]=t[r+o]}function Go(t,e,r,i){jo(t,t,e,r,i)}function Vo(t,e,r,i){function n(e,r){p=t[e],t[e]=t[r],t[r]=p}e=e||function(t,e){return t>e?1:t<e?-1:0};for(var o,a,s=[],c=-1,u=r=r||0,h=i=(i||t.length)-1,l=0,p=0;;)if(h-u<=25){for(a=u+1;a<=h;++a){for(l=t[a],o=a-1;o>=u&&e(t[o],l)>0;)t[o+1]=t[o],--o;t[o+1]=l}if(-1===c)break;h=s[c--],u=s[c--]}else{for(a=h,n(u+h>>1,o=u+1),e(t[u],t[h])>0&&n(u,h),e(t[o],t[h])>0&&n(o,h),e(t[u],t[o])>0&&n(u,o),l=t[o];;){do{o++}while(e(t[o],l)<0);do{a--}while(e(t[a],l)>0);if(a<o)break;n(o,a)}t[u+1]=t[a],t[a]=l,h-o+1>=a-u?(s[++c]=o,s[++c]=h,h=a-1):(s[++c]=u,s[++c]=a-1,u=o)}return t}function $o(t){for(var e=-1/0,r=0,i=t.length;r<i;++r)t[r]>e&&(e=t[r]);return e}function Ho(t){for(var e=1/0,r=0,i=t.length;r<i;++r)t[r]<e&&(e=t[r]);return e}function Wo(t){for(var e=t.length,r=0,i=0;i<e;++i)r+=t[i];return r}function Xo(t){return Wo(t)/t.length}function qo(t){for(var e=t.length,r=0,i=0;i<e;++i){var n=t[i];r+=n*n}return Math.sqrt(r/e)}function Yo(t,e,r,i,n){var o,a,s,c,u=t.height,h=t.width,l=t.getContext("2d").getImageData(0,0,h,u).data;for(s=!1,a=0;a<u;a++){for(o=0;o<h;o++)if(c=4*(a*h+o),l[c]!==e||l[c+1]!==r||l[c+2]!==i||l[c+3]!==n){s=!0;break}if(s)break}var p=a;for(s=!1,o=0;o<h;o++){for(a=0;a<u;a++)if(c=4*(a*h+o),l[c]!==e||l[c+1]!==r||l[c+2]!==i||l[c+3]!==n){s=!0;break}if(s)break}var d=o;for(s=!1,a=u-1;a>=0;a--){for(o=h-1;o>=0;o--)if(c=4*(a*h+o),l[c]!==e||l[c+1]!==r||l[c+2]!==i||l[c+3]!==n){s=!0;break}if(s)break}var f=a;for(s=!1,o=h-1;o>=0;o--){for(a=u-1;a>=0;a--)if(c=4*(a*h+o),l[c]!==e||l[c+1]!==r||l[c+2]!==i||l[c+3]!==n){s=!0;break}if(s)break}var m=o,g=document.createElement("canvas");return g.width=m-d,g.height=f-p,g.getContext("2d").drawImage(t,d,p,g.width,g.height,0,0,g.width,g.height),g}function Zo(t,e){function r(e){var r=s;c&&(r*=2),e&&(r=1/r),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=r),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=r,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function i(t){if(a){var e=d;return Yo(t,u?0:255*e.r,u?0:255*e.g,u?0:255*e.b,u?0:255)}return t}function n(t,e,r){"function"==typeof o.onProgress&&o.onProgress(t,e,r)}var o=e||{},a=gn(o.trim,!1),s=gn(o.factor,1),c=gn(o.antialias,!1),u=gn(o.transparent,!1),h=t.renderer,l=t.camera,p=h.getClearAlpha(),d=h.getClearColor();return new Promise(function(e){function o(o,s){i(a.canvas).toBlob(function(i){h.setClearAlpha(p),r(!0),t.requestRender(),n(s,s,!0),e(i)},"image/png")}var a=new Lo(h,l,t,{factor:s,antialias:c,onProgress:n,onFinish:o});h.setClearAlpha(u?0:1),r(),a.renderAsync()})}function Ko(t,e){t.traverseVisible(function(t){if(t instanceof De&&t.sortParticles){var r=t.geometry.attributes,i=r.position.count;if(0!==i){Pm.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),Cm.multiplyMatrices(e.projectionMatrix,Pm);var n,o,a,s;t.userData.sortData?(n=t.userData.sortData,a=n.__zArray,o=n.__sortArray,s=n.__cmpFn):(a=new Float32Array(i),o=new Uint32Array(i),n={__zArray:a,__sortArray:o,__cmpFn:s=function(t,e){var r=a[t],i=a[e];return r>i?1:r<i?-1:0}},t.userData.sortData=n);for(var c=0;c<i;++c)Em.fromArray(r.position.array,3*c),Em.applyMatrix4(Cm),a[c]=-Em.z,o[c]=c;Vo(o,s);var u,h,l;for(var p in r){var d=r[p],f=d.array,m=d.itemSize;n[p]||(n[p]=new Float32Array(m*i)),l=n[p],n[p]=f;for(var g=0;g<i;++g){u=o[g];for(var v=0;v<m;++v)h=u*m+v,l[g*m+v]=f[h]}r[p].array=l,r[p].needsUpdate=!0}}}})}function Qo(t,e,r,i,n){var o=r.getSize().height,a=r.getPixelRatio(),s="OrthographicCamera"===e.type;Im.getInverse(e.projectionMatrix),Rm.copy(e.projectionMatrix).transpose(),t.traverse(function(t){var e=t.material;if(e){var r=t.material.uniforms;if(r){if(e.clipNear){var c=(50-e.clipNear)/50,u=i-n*c;r.nearClip.value=u}r.canvasHeight&&(r.canvasHeight.value=o),r.pixelRatio&&(r.pixelRatio.value=a),r.projectionMatrixInverse&&r.projectionMatrixInverse.value.copy(Im),r.projectionMatrixTranspose&&r.projectionMatrixTranspose.value.copy(Rm),r.ortho&&(r.ortho.value=s)}}})}function Jo(t,e,r,i,n){var o=n.uniforms,a=[];if(o.objectId&&(o.objectId.value=Bf?this.id:this.id/255,a.push("objectId")),(o.modelViewMatrixInverse||o.modelViewMatrixInverseTranspose||o.modelViewProjectionMatrix||o.modelViewProjectionMatrixInverse)&&this.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,this.matrixWorld),o.modelViewMatrixInverse&&(o.modelViewMatrixInverse.value.getInverse(this.modelViewMatrix),a.push("modelViewMatrixInverse")),o.modelViewMatrixInverseTranspose&&(o.modelViewMatrixInverse?o.modelViewMatrixInverseTranspose.value.copy(o.modelViewMatrixInverse.value).transpose():o.modelViewMatrixInverseTranspose.value.getInverse(this.modelViewMatrix).transpose(),a.push("modelViewMatrixInverseTranspose")),o.modelViewProjectionMatrix&&(r.updateProjectionMatrix(),o.modelViewProjectionMatrix.value.multiplyMatrices(r.projectionMatrix,this.modelViewMatrix),a.push("modelViewProjectionMatrix")),o.modelViewProjectionMatrixInverse&&(o.modelViewProjectionMatrix?(Dm.copy(o.modelViewProjectionMatrix.value),o.modelViewProjectionMatrixInverse.value.getInverse(Dm)):(r.updateProjectionMatrix(),Dm.multiplyMatrices(r.projectionMatrix,this.modelViewMatrix),o.modelViewProjectionMatrixInverse.value.getInverse(Dm)),a.push("modelViewProjectionMatrixInverse")),a.length){var s=t.properties.get(n);if(s.program){var c=t.getContext(),u=s.program;c.useProgram(u.program);var h=u.getUniforms();a.forEach(function(t){h.setValue(c,t,o[t].value)})}}}function ta(e){function r(){Q||(Q=new _e),(rt=new Ne).name="rotationGroup",Q.add(rt),(it=new Ne).name="translationGroup",rt.add(it),(nt=new Ne).name="modelGroup",it.add(nt),(at=new Ne).name="pickingGroup",it.add(at),(ct=new Ne).name="backgroundGroup",it.add(ct),(ut=new Ne).name="helperGroup",it.add(ut),Q.fog=new xe,J=new Gr(X.lightColor,X.lightIntensity),Q.add(J),et=new Wr(X.ambientLight,X.ambientIntensity),Q.add(et)}function i(){var t=_t.geometry.attributes.position,e=t.array,r=wt.min,i=wt.max;e[0]=i.x,e[1]=i.y,e[2]=i.z,e[3]=r.x,e[4]=i.y,e[5]=i.z,e[6]=r.x,e[7]=r.y,e[8]=i.z,e[9]=i.x,e[10]=r.y,e[11]=i.z,e[12]=i.x,e[13]=i.y,e[14]=r.z,e[15]=r.x,e[16]=i.y,e[17]=r.z,e[18]=r.x,e[19]=r.y,e[20]=r.z,e[21]=i.x,e[22]=r.y,e[23]=r.z,t.needsUpdate=!0,wt.isEmpty()||_t.geometry.computeBoundingSphere()}function n(e,r){r?r.forEach(function(t){o(e,t)}):o(e),e.background?(ct.add(e.group),ct.add(e.wireframeGroup)):(nt.add(e.group),nt.add(e.wireframeGroup)),e.pickable&&at.add(e.pickingGroup),t.Debug&&i()}function o(t,e){function r(i){i instanceof Ne?i.children.forEach(r):(i.userData.buffer=t,i.userData.instance=e,i.onBeforeRender=Jo)}var i=t.getMesh();e&&i.applyMatrix(e.matrix),r(i),t.group.add(i);var n=t.getWireframeMesh();if(e&&(n.matrix.copy(i.matrix),n.position.copy(i.position),n.quaternion.copy(i.quaternion),n.scale.copy(i.scale)),r(n),t.wireframeGroup.add(n),t.pickable){var o=t.getPickingMesh();e&&(o.matrix.copy(i.matrix),o.position.copy(i.position),o.quaternion.copy(i.quaternion),o.scale.copy(i.scale)),r(o),t.pickingGroup.add(o)}e?s(t.geometry,t.matrix,e.matrix):s(t.geometry,t.matrix)}function a(e){it.children.forEach(function(t){t.remove(e.group),t.remove(e.wireframeGroup)}),e.pickable&&at.remove(e.pickingGroup),s(),t.Debug&&i()}function s(t,e,r){function i(t,e,r){t.boundingBox||t.computeBoundingBox();var i=t.boundingBox.clone();e&&i.applyMatrix4(e),r&&i.applyMatrix4(r),i.min.equals(i.max)&&i.expandByScalar(5),wt.union(i)}function n(t){if(void 0!==t.geometry){var e,r;t.userData.buffer&&(e=t.userData.buffer.matrix),t.userData.instance&&(r=t.userData.instance.matrix),i(t.geometry,e,r)}}t?i(t,e,r):(wt.makeEmpty(),nt.traverse(n),ct.traverse(n)),wt.getSize(At),Mt=At.length()}function c(){var t=k*F*4,e=Bf?new Float32Array(t):new Uint8Array(t);return O(!0),ht.readRenderTargetPixels(pt,0,0,k,F,e),e}function u(t){return new Promise(function(e){if(t){var r=k*F*4,i=c();if(Bf){for(var n=new Uint8Array(r),o=0;o<r;++o)n[o]=Math.round(255*i[o]);i=n}var a=document.createElement("canvas");a.width=k,a.height=F;var s=a.getContext("2d"),u=s.getImageData(0,0,k,F);u.data.set(i),s.putImageData(u,0,0),a.toBlob(e,"image/png")}else ht.domElement.toBlob(e,"image/png")})}function h(t){return Zo(this,t)}function l(t,e,r,i){var n=X;void 0!==t&&n.lightColor.set(t),void 0!==e&&(n.lightIntensity=e),void 0!==r&&n.ambientColor.set(r),void 0!==i&&(n.ambientIntensity=i),A()}function p(t,e,r){var i=X;void 0!==t&&i.fogColor.set(t),void 0!==e&&(i.fogNear=e),void 0!==r&&(i.fogFar=r),A()}function d(t){var e=X;t&&e.backgroundColor.set(t),p(e.backgroundColor),ht.setClearColor(e.backgroundColor,0),ht.domElement.style.backgroundColor=e.backgroundColor.getStyle(),A()}function m(t){void 0!==t&&(X.sampleLevel=t,$=t),A()}function v(t,e){var r=X;t&&(r.cameraType=t),e&&(r.cameraFov=e),"orthographic"===r.cameraType?K!==Z&&((K=Z).position.copy(Y.position),K.up.copy(Y.up),M()):K!==Y&&((K=Y).position.copy(Z.position),K.up.copy(Z.up)),Y.fov=r.cameraFov,K.updateProjectionMatrix(),A()}function y(t,e,r){var i=X;void 0!==t&&(i.clipNear=t),void 0!==e&&(i.clipFar=e),void 0!==r&&(i.clipDist=r),A()}function b(t,e){k=t||1,F=e||1,Y.aspect=k/F,Z.left=-k/2,Z.right=k/2,Z.top=F/2,Z.bottom=-F/2,K.updateProjectionMatrix();var r=window.devicePixelRatio;ht.setPixelRatio(r),ht.setSize(k,F);var i=k*r,n=F*r;pt.setSize(i,n),dt.setSize(i,n),ft.setSize(i,n),A()}function x(){if(N===document.body)b(window.innerWidth,window.innerHeight);else{var t=N.getBoundingClientRect();b(t.width,t.height)}}function _(t){var e=Et.memory,r=Et.render;if(t)e.programs=0,e.geometries=0,e.textures=0,r.calls=0,r.vertices=0,r.faces=0,r.points=0;else{var i=ht.info,n=i.memory,o=i.render;e.programs=n.programs,e.geometries=n.geometries,e.textures=n.textures,r.calls+=o.calls,r.vertices+=o.vertices,r.faces+=o.faces,r.points+=o.points}}function w(){if(B.ticked.dispatch(q),window.performance.now()-q.startTime>500&&!V&&$<3&&-1!==$){var e=$;$=3,j=!0,O(),V=!0,$=e,t.Debug&&Uf.log("rendered still frame")}window.requestAnimationFrame(w)}function S(t,e){t*=window.devicePixelRatio,e*=window.devicePixelRatio;var r,i,n,o=Bf?Lm:Om;O(!0),ht.readRenderTargetPixels(pt,t,e,1,1,o),r=Bf?Math.round(255*o[0])<<16&16711680|Math.round(255*o[1])<<8&65280|255&Math.round(255*o[2]):o[0]<<16|o[1]<<8|o[2];var a=Math.round(o[3]),s=at.getObjectById(a);return s&&(i=s.userData.instance,n=s.userData.buffer.picking),{pid:r,instance:i,picker:n}}function A(){j||(window.performance.now()-q.startTime>22&&(q.begin(),V=!1),j=!0,window.requestAnimationFrame(function(){O(),q.update()}))}function M(){var t=$n(Y.fov),e=2*Math.tan(t/2)*-K.position.z;Z.zoom=F/e}function T(){var t=X;(H=Tt.copy(K.position).length())||(K.position.set(0,0,t.cameraZ),H=Math.abs(t.cameraZ)),W=Math.max(10,.5*Mt),((W+=wt.getCenter(Tt).length())===1/0||W===-1/0||isNaN(W))&&(W=50);var e=(50-t.clipNear)/50,r=-(50-t.clipFar)/50;K.near=H-W*e,K.far=H+W*r;var i=(50-t.fogNear)/50,n=-(50-t.fogFar)/50,o=Q.fog;o.color.set(t.fogColor),o.near=H-W*i,o.far=H+W*n,"PerspectiveCamera"===K.type?(K.near=Math.max(.1,t.clipDist,K.near),K.far=Math.max(1,K.far),o.near=Math.max(.1,o.near),o.far=Math.max(1,o.far)):"OrthographicCamera"===K.type&&0===t.clipNear&&t.clipDist>0&&H+K.zoom>2*-t.clipDist&&(K.near+=K.zoom+t.clipDist)}function E(){K.updateMatrix(),K.updateMatrixWorld(!0),K.matrixWorldInverse.getInverse(K.matrixWorld),K.updateProjectionMatrix(),Qo(Q,K,ht,H,W),Ko(Q,K)}function P(t,e,r,i){nt.visible=t,at.visible=e,ct.visible=r,ut.visible=i}function C(){Tt.copy(K.position).setLength(100*Mt),J.position.copy(K.position).add(Tt),J.color.set(X.lightColor),J.intensity=X.lightIntensity,et.color.set(X.ambientColor),et.intensity=X.ambientIntensity}function I(){ht.clearTarget(pt),P(!1,!0,!1,!1),ht.render(Q,K,pt),_(),ht.setRenderTarget(null)}function R(e){e?ht.clearTarget(e):ht.clear(),P(!1,!1,!0,!1),ht.render(Q,K,e),e?ht.clearTarget(e,!1,!0,!1):ht.clearDepth(),_(),P(!0,!1,!1,t.Debug),ht.render(Q,K,e),_()}function L(){var t=Mm[Math.max(0,Math.min($,5))],e=1/t.length;mt.tForeground.value=dt.texture;for(var r=dt.width,i=dt.height,n=0;n<t.length;++n){var o=t[n];K.setViewOffset(r,i,o[0],o[1],r,i),E();var a=e;a+=1/32*((n+.5)/t.length-.5),mt.scale.value=a,R(dt),ht.render(xt,vt,ft,0===n)}mt.scale.value=1,mt.tForeground.value=ft.texture,ht.render(xt,vt,null,!0),K.view=null}function O(t){U?Uf.warn("tried to call 'render' from within 'render'"):(U=!0,T(),E(),C(),_(!0),t?G||I():$>0?L():R(),G=t,U=!1,j=!1)}function D(){Uf.log("scene cleared"),Q.remove(rt),r(),ht.clear()}var N,k,F,B={ticked:new no};if((N="string"==typeof e?document.getElementById(e):e instanceof window.Element?e:document.createElement("div"))===document.body)k=window.innerWidth||1,F=window.innerHeight||1;else{var z=N.getBoundingClientRect();k=z.width||1,F=z.height||1}var U,j,G,V,$,H,W,X;!function(){X={fogColor:new tt(0),fogNear:50,fogFar:100,backgroundColor:new tt(0),cameraType:"perspective",cameraFov:40,cameraZ:-80,clipNear:0,clipFar:100,clipDist:10,lightColor:new tt(14540253),lightIntensity:1,ambientColor:new tt(14540253),ambientIntensity:.2,sampleLevel:0}}();var q;!function(){q=new Co}();var Y,Z,K;!function(){var t=new g(0,0,0);(Y=new bt(X.cameraFov,k/F)).position.z=X.cameraZ,Y.lookAt(t),(Z=new yt(k/-2,k/2,F/2,F/-2)).position.z=X.cameraZ,Z.lookAt(t),(K="orthographic"===X.cameraType?Z:Y).updateProjectionMatrix()}();var Q,J,et,rt,it,nt,at,ct,ut;r();var ht,lt,pt,dt,ft,mt,gt,vt,xt;if(!1===function(){var t=window.devicePixelRatio;try{ht=new ye({preserveDrawingBuffer:!0,alpha:!0,antialias:!0})}catch(t){return N.innerHTML=jf,!1}ht.setPixelRatio(t),ht.setSize(k,F),ht.autoClear=!1,ht.sortObjects=!0,wo(ht.extensions.get("EXT_frag_depth")),ht.extensions.get("OES_element_index_uint"),_o(ht.extensions.get("OES_texture_float")&&ht.extensions.get("WEBGL_color_buffer_float")||"Chrome"===kf&&ht.extensions.get("OES_texture_float")),N.appendChild(ht.domElement);var e=k*t,r=F*t;ht.extensions.get("OES_texture_float"),lt=ht.extensions.get("OES_texture_half_float"),ht.extensions.get("WEBGL_color_buffer_float"),(pt=new f(e,r,{minFilter:il,magFilter:il,stencilBuffer:!1,format:Sl,type:Bf?ml:ul})).texture.generateMipmaps=!1,dt=new f(e,r,{minFilter:al,magFilter:al,format:Sl}),ft=new f(e,r,{minFilter:il,magFilter:il,format:Sl,type:Ff?ul:lt?gl:Bf?ml:ul}),gt=new ot({uniforms:mt={tForeground:{type:"t",value:null},scale:{type:"f",value:1}},vertexShader:Ro("Quad.vert"),fragmentShader:Ro("Quad.frag"),premultipliedAlpha:!0,transparent:!0,blending:lh,depthTest:!1,depthWrite:!1}),vt=new yt(-1,1,1,-1,0,1),xt=(new _e).add(new Bt(new Lt(2,2),gt))}())return this.container=N,void Uf.error("Viewer: could not initialize renderer");var _t,wt=new st,At=new g,Mt=0;!function(){var t=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]),e=new Float32Array(24),r=new Ct;r.setIndex(new St(t,1)),r.addAttribute("position",new St(e,3));var i=new ot({uniforms:{uColor:{value:new tt("skyblue")}},vertexShader:Ro("BasicLine.vert"),fragmentShader:Ro("BasicLine.frag"),linewidth:2});_t=new Re(r,i),ut.add(_t)}(),d(),p();var Tt=new g,Et={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};this.container=N,this.stats=q,this.signals=B,this.rotationGroup=rt,this.translationGroup=it,this.add=n,this.remove=a,this.clear=D,this.getPickingPixels=c,this.getImage=u,this.makeImage=h,this.setLight=l,this.setFog=p,this.setBackground=d,this.setSampling=m,this.setCamera=v,this.setClip=y,this.setSize=b,this.handleResize=x,this.pick=S,this.requestRender=A,this.render=O,this.animate=w,this.updateZoom=M,this.updateHelper=i,this.renderer=ht,this.scene=Q,this.perspectiveCamera=Y,this.boundingBox=wt,this.updateBoundingBox=function(){s(),t.Debug&&i()},Object.defineProperties(this,{camera:{get:function(){return K}},width:{get:function(){return k}},height:{get:function(){return F}},sampleLevel:{get:function(){return $}}})}function ea(t){var e=t.touches[0].pageX-t.touches[1].pageX,r=t.touches[0].pageY-t.touches[1].pageY;return Math.sqrt(e*e+r*r)}function ra(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<<e-1}else if("button"in t){var r=t.button;if(1===r)return 4;if(2===r)return 2;if(r>=0)return 1<<r}}return 0}function ia(t,e,r){return t.distanceTo(e)<t.distanceTo(r)}function na(t){var e=t.split(/[-+]/),r="";e.includes("scroll")&&(r="scroll"),e.includes("drag")&&(r="drag"),e.includes("click")&&(r="click"),e.includes("doubleClick")&&(r="doubleClick"),e.includes("hover")&&(r="hover"),e.includes("clickPick")&&(r="clickPick"),e.includes("hoverPick")&&(r="hoverPick");var i=0;e.includes("alt")&&(i+=1),e.includes("ctrl")&&(i+=2),e.includes("meta")&&(i+=4),e.includes("shift")&&(i+=8);var n=0;return e.includes("left")&&(n+=1),e.includes("right")&&(n+=2),e.includes("middle")&&(n+=4),[r,i,n]}function oa(t){var e,r=t.length,i=t.length/3,n=0,o=0,a=0;for(e=0;e<r;e+=3)n+=t[e+0],o+=t[e+1],a+=t[e+2];return new g(n/i,o/i,a/i)}function aa(t,e,r){return r?t.sub(r).projectOnVector(e).add(r):t.projectOnVector(e),t}function sa(t){for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],h=t[s+1],l=t[s+2];u<e&&(e=u),h<r&&(r=h),l<i&&(i=l),u>n&&(n=u),h>o&&(o=h),l>a&&(a=l)}return[la([e,r,i]),la([n,o,a])]}function ca(t,e){for(var r=0,i=e.length;r<i;r+=3){var n=e[r],o=e[r+1],a=e[r+2];e[r]=t[0]*n+t[4]*o+t[8]*a+t[12],e[r+1]=t[1]*n+t[5]*o+t[9]*a+t[13],e[r+2]=t[2]*n+t[6]*o+t[10]*a+t[14]}}function ua(t,e){for(var r=0,i=e.length;r<i;r+=3){var n=e[r],o=e[r+1],a=e[r+2];e[r]=t[0]*n+t[3]*o+t[6]*a,e[r+1]=t[1]*n+t[4]*o+t[7]*a,e[r+2]=t[2]*n+t[5]*o+t[8]*a}}function ha(t){for(var e=0,r=t.length;e<r;e+=3){var i=t[e],n=t[e+1],o=t[e+2],a=1/Math.sqrt(i*i+n*n+o*o);t[e]=i*a,t[e+1]=n*a,t[e+2]=o*a}}function la(t){return new Float32Array(t||3)}function pa(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],c=r[2];t[0]=n*c-o*s,t[1]=o*a-i*c,t[2]=i*s-n*a}function da(t,e,r){t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2]}function fa(t,e,r){t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2]}function ma(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}function ga(t,e,r){va(t,e,1/r)}function va(t,e,r){t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r}function ya(t,e){va(t,e,1/ma(e))}function ba(t,e,r){t[0]=e[0]-r,t[1]=e[1]-r,t[2]=e[2]-r}function xa(t,e,r){t[0]=e[0]+r,t[1]=e[1]+r,t[2]=e[2]+r}function _a(t,e){t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2])}function wa(t,e){t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2])}function Sa(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2]}function Aa(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}function Ma(t){return t-=t>>>1&1431655765,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function Ta(t,e){this.type=t,this.scale=e||1,this.max=10}function Ea(t,e){this.cols=t,this.rows=e,this.size=this.cols*this.rows,this.data=new Float32Array(this.size)}function Pa(t,e){for(var r=0,i=0,n=e.rows,o=e.cols,a=0,s=0,c=0,u=e.data,h=t.data;r<n;s+=1,a+=o,r++)for(c=s,i=0;i<o;c+=n,i++)h[c]=u[a+i]}function Ca(t,e,r){for(var i=0,n=0,o=0,a=0,s=0,c=0,u=0,h=e.cols,l=e.rows,p=r.rows,d=e.data,f=r.data,m=t.data,g=0;i<l;a+=h,i++)for(c=0,n=0;n<p;u++,n++){for(s=a,g=0,o=0;o<h;s++,c++,o++)g+=d[s]*f[c];m[u]=g}}function Ia(t,e){var r=t.data,i=e.data,n=r[4],o=r[8],a=r[5],s=r[7],c=r[0],u=c*n,h=c*a,l=r[3],p=r[1],d=l*p,f=r[2],m=l*f,g=r[6],v=g*p,y=g*f,b=1/(u*o-h*s-d*o+m*s+v*a-y*n);i[0]=(n*o-a*s)*b,i[1]=-(p*o-f*s)*b,i[2]=-(-p*a+f*n)*b,i[3]=-(l*o-a*g)*b,i[4]=(c*o-y)*b,i[5]=-(h-m)*b,i[6]=-(-l*s+n*g)*b,i[7]=-(c*s-v)*b,i[8]=(u-d)*b}function Ra(t){var e=t.data;return e[0]*e[4]*e[8]-e[0]*e[5]*e[7]-e[3]*e[1]*e[8]+e[3]*e[2]*e[7]+e[6]*e[1]*e[5]-e[6]*e[2]*e[4]}function La(t,e,r){var i=t.data,n=e.data,o=r.data,a=n[0],s=n[1],c=n[2],u=n[3],h=n[4],l=n[5],p=n[6],d=n[7],f=n[8],m=o[0],g=o[1],v=o[2],y=o[3],b=o[4],x=o[5],_=o[6],w=o[7],S=o[8];i[0]=a*m+s*y+c*_,i[1]=a*g+s*b+c*w,i[2]=a*v+s*x+c*S,i[3]=u*m+h*y+l*_,i[4]=u*g+h*b+l*w,i[5]=u*v+h*x+l*S,i[6]=p*m+d*y+f*_,i[7]=p*g+d*b+f*w,i[8]=p*v+d*x+f*S}function Oa(t){var e,r,i=0,n=t.rows,o=t.cols,a=t.data,s=new Array(o);for(r=0;r<o;++r)s[r]=0;for(e=0;e<n;++e)for(r=0;r<o;++r,++i)s[r]+=a[i];for(r=0;r<o;++r)s[r]/=n;return s}function Da(t,e){var r,i,n=0,o=t.rows,a=t.cols,s=t.data;for(r=0;r<o;++r)for(i=0;i<a;++i,++n)s[n]-=e[i]}function Na(t,e){var r,i,n=0,o=t.rows,a=t.cols,s=t.data;for(r=0;r<o;++r)for(i=0;i<a;++i,++n)s[n]+=e[i]}function ka(t,e,r,i){i=t[e],t[e]=t[r],t[r]=i}function Fa(t,e){return t=Math.abs(t),e=Math.abs(e),t>e?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}function Ba(t,e,r,i,n,o,a,s){for(var c=2*qv,u=Yv,h=0,l=0,p=0,d=0,f=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,T=0,E=0,P=0,C=0,I=0,R=0,L=4660,O=0,D=0,N=0,k=new Float64Array(a<<3);h<a;h++){for(p=0,M=0;p<o;p++)M+=(w=t[h*e+p])*w;if(k[h]=M,i){for(p=0;p<a;p++)i[h*n+p]=0;i[h*n+h]=1}}for(;d<f;d++){for(b=0,h=0;h<a-1;h++)for(l=h+1;l<a;l++){for(m=h*e|0,g=l*e|0,C=k[h],I=0,R=k[l],p=2,I+=t[m]*t[g],I+=t[m+1]*t[g+1];p<o;p++)I+=t[m+p]*t[g+p];if(!(Math.abs(I)<=c*Math.sqrt(C*R))){for(E=Fa(I*=2,T=C-R),T<0?(P=.5*(E-T),x=I/(E*(_=Math.sqrt(P/E))*2)):_=I/(E*(x=Math.sqrt((E+T)/(2*E)))*2),C=0,R=0,p=2,S=x*t[m]+_*t[g],A=-_*t[m]+x*t[g],t[m]=S,t[g]=A,C+=S*S,R+=A*A,S=x*t[m+1]+_*t[g+1],A=-_*t[m+1]+x*t[g+1],t[m+1]=S,t[g+1]=A,C+=S*S,R+=A*A;p<o;p++)S=x*t[m+p]+_*t[g+p],A=-_*t[m+p]+x*t[g+p],t[m+p]=S,t[g+p]=A,C+=S*S,R+=A*A;if(k[h]=C,k[l]=R,b=1,i)for(y=l*n|0,p=2,S=x*i[v=h*n|0]+_*i[y],A=-_*i[v]+x*i[y],i[v]=S,i[y]=A,S=x*i[v+1]+_*i[y+1],A=-_*i[v+1]+x*i[y+1],i[v+1]=S,i[y+1]=A;p<a;p++)S=x*i[v+p]+_*i[y+p],A=-_*i[v+p]+x*i[y+p],i[v+p]=S,i[y+p]=A}}if(0===b)break}for(h=0;h<a;h++){for(p=0,M=0;p<o;p++)M+=(w=t[h*e+p])*w;k[h]=Math.sqrt(M)}for(h=0;h<a-1;h++){for(l=h,p=h+1;p<a;p++)k[l]<k[p]&&(l=p);if(h!==l&&(ka(k,h,l,M),i)){for(p=0;p<o;p++)ka(t,h*e+p,l*e+p,w);for(p=0;p<a;p++)ka(i,h*n+p,l*n+p,w)}}for(h=0;h<a;h++)r[h]=k[h];if(i)for(h=0;h<s;h++){for(M=h<a?k[h]:0;M<=u;){for(D=1/o,p=0;p<o;p++)O=0!=(256&(L=214013*L+2531011)>>16)?D:-D,t[h*e+p]=O;for(d=0;d<2;d++)for(l=0;l<h;l++){for(M=0,p=0;p<o;p++)M+=t[h*e+p]*t[l*e+p];for(N=0,p=0;p<o;p++)w=t[h*e+p]-M*t[l*e+p],t[h*e+p]=w,N+=Math.abs(w);for(N=N?1/N:0,p=0;p<o;p++)t[h*e+p]*=N}for(M=0,p=0;p<o;p++)M+=(w=t[h*e+p])*w;M=Math.sqrt(M)}for(_=1/M,p=0;p<o;p++)t[h*e+p]*=_}}function za(t,e,r,i){var n=0,o=0,a=t.rows,s=t.cols,c=a,u=s;c<u&&(n=1,o=c,c=u,u=o);var h=new Ea(c,c),l=new Ea(1,u),p=new Ea(u,u);if(0===n)Pa(h,t);else{for(o=0;o<s*a;o++)h.data[o]=t.data[o];for(;o<u*c;o++)h.data[o]=0}if(Ba(h.data,c,l.data,p.data,u,c,u,c),e){for(o=0;o<u;o++)e.data[o]=l.data[o];for(;o<s;o++)e.data[o]=0}0===n?(r&&Pa(r,h),i&&Pa(i,p)):(r&&Pa(r,p),i&&Pa(i,h))}function Ua(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function ja(t,e,r,i,n,o,a,s,c,u,h,l,p,d,f,m,g){t[0]=e,t[4]=r,t[8]=i,t[12]=n,t[1]=o,t[5]=a,t[9]=s,t[13]=c,t[2]=u,t[6]=h,t[10]=l,t[14]=p,t[3]=d,t[7]=f,t[11]=m,t[15]=g}function Ga(t,e,r){var i=e[0],n=e[4],o=e[8],a=e[12],s=e[1],c=e[5],u=e[9],h=e[13],l=e[2],p=e[6],d=e[10],f=e[14],m=e[3],g=e[7],v=e[11],y=e[15],b=r[0],x=r[4],_=r[8],w=r[12],S=r[1],A=r[5],M=r[9],T=r[13],E=r[2],P=r[6],C=r[10],I=r[14],R=r[3],L=r[7],O=r[11],D=r[15];t[0]=i*b+n*S+o*E+a*R,t[4]=i*x+n*A+o*P+a*L,t[8]=i*_+n*M+o*C+a*O,t[12]=i*w+n*T+o*I+a*D,t[1]=s*b+c*S+u*E+h*R,t[5]=s*x+c*A+u*P+h*L,t[9]=s*_+c*M+u*C+h*O,t[13]=s*w+c*T+u*I+h*D,t[2]=l*b+p*S+d*E+f*R,t[6]=l*x+p*A+d*P+f*L,t[10]=l*_+p*M+d*C+f*O,t[14]=l*w+p*T+d*I+f*D,t[3]=m*b+g*S+v*E+y*R,t[7]=m*x+g*A+v*P+y*L,t[11]=m*_+g*M+v*C+y*O,t[15]=m*w+g*T+v*I+y*D}function Va(t,e,r,i){ja(t,e,0,0,0,0,r,0,0,0,0,i,0,0,0,0,1)}function $a(t,e,r,i){ja(t,1,0,0,e,0,1,0,r,0,0,1,i,0,0,0,1)}function Ha(t,e){var r=Math.cos(e),i=Math.sin(e);ja(t,r,0,i,0,0,1,0,0,-i,0,r,0,0,0,0,1)}function Wa(){return new Float32Array([1,0,0,0,1,0,0,0,1])}function Xa(t,e){var r=la([e[0],e[1],e[2]]),i=la([e[4],e[5],e[6]]),n=la([e[8],e[9],e[10]]),o=la();pa(o,i,n),t[0]=o[0],t[1]=o[1],t[2]=o[2],pa(o,n,r),t[3]=o[0],t[4]=o[1],t[5]=o[2],pa(o,r,i),t[6]=o[0],t[7]=o[1],t[8]=o[2]}function qa(t,e){function r(t,e,r,i){for(var n=i*i,a=Math.max(0,t-i-s>>o),d=Math.max(0,e-i-c>>o),f=Math.max(0,r-i-u>>o),y=Math.min(h,t+i-s>>o),x=Math.min(l,e+i-c>>o),_=Math.min(p,r+i-u>>o),w=[],S=a;S<=y;++S)for(var A=d;A<=x;++A)for(var T=f;T<=_;++T){var P=b[(S*l+A)*p+T];if(P>0)for(var I=P-1,R=E[I],L=R+M[I],O=R;O<L;++O){var D=C[O],N=m[D]-t,k=g[D]-e,F=v[D]-r;N*N+k*k+F*F<=n&&w.push(D)}}return w}var i,n,o=3,a=e,s=a.min.x,c=a.min.y,u=a.min.z,h=1+(a.max.x-s>>o),l=1+(a.max.y-c>>o),p=1+(a.max.z-u>>o),d=h*l*p,f=t.count,m=t.x,g=t.y,v=t.z,y=0,b=new Uint32Array(d),x=new Int32Array(f);for(i=0;i<f;++i){var _=m[i]-s>>o,w=g[i]-c>>o,S=v[i]-u>>o,A=(_*l+w)*p+S;1===(b[A]+=1)&&(y+=1),x[i]=A}var M=new Uint16Array(y);for(i=0,n=0;i<d;++i){var T=b[i];T>0&&(b[i]=n+1,M[n]=T,n+=1)}var E=new Uint32Array(y);for(i=1;i<y;++i)E[i]+=E[i-1]+M[i-1];var P=new Uint16Array(y),C=new Int32Array(f);for(i=0;i<f;++i){var I=b[x[i]];if(I>0){var R=I-1;C[E[R]+P[R]]=i,P[R]+=1}}this.within=r}function Ya(e){var r=0,i=0,n={},o={},a=window.URL.createObjectURL(Vf.get(e)),s=new window.Worker(a);Vf.activeWorkerCount+=1,s.onmessage=function(i){r-=1;var a=i.data.__postId;t.Debug&&Uf.timeEnd("Worker.postMessage "+e+" #"+a),n[a]&&n[a].call(s,i),delete n[a],delete o[a]},s.onerror=function(t){if(r-=1,t.data){var i=t.data.__postId;o[i]?o[i].call(s,t):Uf.error("Worker.onerror",i,e,t),delete n[i],delete o[i]}else Uf.error("Worker.onerror",e,t)},this.name=e,this.post=function(a,c,u,h){n[i]=u,o[i]=h,(a=a||{}).__name=e,a.__postId=i,a.__debug=t.Debug,t.Debug&&Uf.time("Worker.postMessage "+e+" #"+i);try{s.postMessage(a,c)}catch(t){Uf.error("worker.post:",t),s.postMessage(a)}return r+=1,i+=1,this},this.terminate=function(){s?(s.terminate(),window.URL.revokeObjectURL(a),Vf.activeWorkerCount-=1):Uf.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return i}},pending:{get:function(){return r}}})}function Za(t,e){e=Math.min(8,e||2);var r=[],i=0;this.name=t,this.maxCount=e,this.post=function(t,e,r,i){return this.getNextWorker().post(t,e,r,i),this},this.terminate=function(){r.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var n,o=1/0,a=0;a<e;++a){if(a>=i){n=new Ya(t),r.push(n),i+=1;break}var s=r[a];if(0===s.pending){n=s;break}s.pending<o&&(o=s.pending,n=s)}return n},Object.defineProperties(this,{count:{get:function(){return i}}})}function Ka(){return new Uint32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0])}function Qa(){return new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-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,-1,-1])}function Ja(){return[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]]}function ts(t,e,r,i,n){function o(t,e,r){return t+(e-t)*r}function a(t,n,o){return t=(t+v)%e,n=(n+y)%r,o=(o+b)%i,T*o+M*n+t}function s(t,e,r,i,a,s,c){var u=w?3*t:t;if(f[u]<0){var h=(x-s)/(c-s),l=d,p=3*m;if(P[p+0]=r+h,P[p+1]=i,P[p+2]=a,!_){var g=3*t;C[p]=-o(l[g],l[g+3],h),C[p+1]=-o(l[g+1],l[g+4],h),C[p+2]=-o(l[g+2],l[g+5],h)}n&&(R[m]=n[t+Math.round(h)]),f[u]=m,E[e]=m,m+=1}else E[e]=f[u]}function c(t,e,r,i,a,s,c){var u=w?3*t+1:t;if(f[u]<0){var h=(x-s)/(c-s),l=d,p=3*m;if(P[p]=r,P[p+1]=i+h,P[p+2]=a,!_){var g=3*t,v=g+3*M;C[p]=-o(l[g],l[v],h),C[p+1]=-o(l[g+1],l[v+1],h),C[p+2]=-o(l[g+2],l[v+2],h)}n&&(R[m]=n[t+Math.round(h)*M]),f[u]=m,E[e]=m,m+=1}else E[e]=f[u]}function u(t,e,r,i,a,s,c){var u=w?3*t+2:t;if(f[u]<0){var h=(x-s)/(c-s),l=d,p=3*m;if(P[p]=r,P[p+1]=i,P[p+2]=a+h,!_){var g=3*t,v=g+3*T;C[p]=-o(l[g],l[v],h),C[p+1]=-o(l[g+1],l[v+1],h),C[p+2]=-o(l[g+2],l[v+2],h)}n&&(R[m]=n[t+Math.round(h)*T]),f[u]=m,E[e]=m,m+=1}else E[e]=f[u]}function h(e){var r=3*e;0===d[r]&&(d[r]=t[(e-1+A)%A]-t[(e+1)%A],d[r+1]=t[(e-M+A)%A]-t[(e+M)%A],d[r+2]=t[(e-T+A)%A]-t[(e+T)%A])}function l(e,r,i,n,o){var l,p,d,f,m,v,y;S?(n=a(e,r,i),l=a(e+1,r,i),p=a(e,r+1,i),d=a(e,r,i+1),f=a(e+1,r+1,i),m=a(e+1,r,i+1),v=a(e,r+1,i+1),y=a(e+1,r+1,i+1)):(l=n+1,f=(p=n+M)+1,m=(d=n+T)+1,y=(v=p+T)+1);var b=0,A=t[n],P=t[l],C=t[p],R=t[f],N=t[d],k=t[m],F=t[v],B=t[y];A<x&&(b|=1),P<x&&(b|=2),C<x&&(b|=8),R<x&&(b|=4),N<x&&(b|=16),k<x&&(b|=32),F<x&&(b|=128),B<x&&(b|=64);var z=L[b];if(0===z)return 0;var U=e+1,j=r+1,G=i+1;1&z&&(_||(h(n),h(l)),s(n,0,e,r,i,A,P)),2&z&&(_||(h(l),h(f)),c(l,1,U,r,i,P,R)),4&z&&(_||(h(p),h(f)),s(p,2,e,j,i,C,R)),8&z&&(_||(h(n),h(p)),c(n,3,e,r,i,A,C)),16&z&&(_||(h(d),h(m)),s(d,4,e,r,G,N,k)),32&z&&(_||(h(m),h(y)),c(m,5,U,r,G,k,B)),64&z&&(_||(h(v),h(y)),s(v,6,e,j,G,F,B)),128&z&&(_||(h(d),h(v)),c(d,7,e,r,G,N,F)),256&z&&(_||(h(n),h(d)),u(n,8,e,r,i,A,N)),512&z&&(_||(h(l),h(m)),u(l,9,U,r,i,P,k)),1024&z&&(_||(h(f),h(y)),u(f,10,U,j,i,R,B)),2048&z&&(_||(h(p),h(v)),u(p,11,e,j,i,C,F));for(var V,$,H,W=b<<4,X=0;-1!==O[W+X];)V=O[W+X],$=O[W+X+1],H=O[W+X+2],w?(D[V][$]&o&&(I[g++]=E[V],I[g++]=E[$]),D[$][H]&o&&(I[g++]=E[$],I[g++]=E[H]),D[V][H]&o&&(I[g++]=E[V],I[g++]=E[H])):(I[g++]=E[$],I[g++]=E[V],I[g++]=E[H]),X+=3}function p(n,o,s,c,u,h){var p,d,m,g,v,y,b;n=void 0!==n?n:0,o=void 0!==o?o:0,s=void 0!==s?s:0,c=void 0!==c?c:e-1,u=void 0!==u?u:r-1,h=void 0!==h?h:i-1,S||(_?(n=Math.max(0,n),o=Math.max(0,o),s=Math.max(0,s),c=Math.min(e-1,c),u=Math.min(r-1,u),h=Math.min(i-1,h)):(n=Math.max(1,n),o=Math.max(1,o),s=Math.max(1,s),c=Math.min(e-2,c),u=Math.min(r-2,u),h=Math.min(i-2,h)));var A,E,P,C,I,R;if(S)for(A=n-2,E=o-2,C=c+2,I=u+2,R=h+2,v=P=s-2;v<R;++v)for(g=E;g<I;++g)for(m=A;m<C;++m)w?(d=3*a(m,g,v),f[d]=-1,f[d+1]=-1,f[d+2]=-1):(p=a(m,g,v),f[p]=-1);else for(A=Math.max(0,n-2),E=Math.max(0,o-2),P=Math.max(0,s-2),C=Math.min(e,c+2),I=Math.min(r,u+2),R=Math.min(i,h+2),v=P;v<R;++v)for(b=T*v,g=E;g<I;++g)for(y=b+M*g,m=A;m<C;++m)w?(f[p=3*(y+m)]=-1,f[p+1]=-1,f[p+2]=-1):f[p=y+m]=-1;if(!S){var L,O=n,D=o,N=s,k=c,F=u,B=h;for(L=!1,v=s;v<h;++v){for(g=o;g<u;++g){for(m=n;m<c;++m)if(p=e*r*v+e*g+m,t[p]>=x){N=v,L=!0;break}if(L)break}if(L)break}for(L=!1,g=o;g<u;++g){for(v=N;v<h;++v){for(m=n;m<c;++m)if(p=e*r*v+e*g+m,t[p]>=x){D=g,L=!0;break}if(L)break}if(L)break}for(L=!1,m=n;m<c;++m){for(g=D;g<u;++g){for(v=N;v<h;++v)if(p=e*r*v+e*g+m,t[p]>=x){O=m,L=!0;break}if(L)break}if(L)break}for(L=!1,v=h;v>=s;--v){for(g=u;g>=o;--g){for(m=c;m>=n;--m)if(p=e*r*v+e*g+m,t[p]>=x){B=v,L=!0;break}if(L)break}if(L)break}for(L=!1,g=u;g>=o;--g){for(v=B;v>=s;--v){for(m=c;m>=n;--m)if(p=e*r*v+e*g+m,t[p]>=x){F=g,L=!0;break}if(L)break}if(L)break}for(L=!1,m=c;m>=n;--m){for(g=F;g>=o;--g){for(v=B;v>=s;--v)if(p=e*r*v+e*g+m,t[p]>=x){k=m,L=!0;break}if(L)break}if(L)break}_?(n=Math.max(0,O-1),o=Math.max(0,D-1),s=Math.max(0,N-1),c=Math.min(e-1,k+1),u=Math.min(r-1,F+1),h=Math.min(i-1,B+1)):(n=Math.max(1,O-1),o=Math.max(1,D-1),s=Math.max(1,N-1),c=Math.min(e-2,k+1),u=Math.min(r-2,F+1),h=Math.min(i-2,B+1))}var z=15;for(v=s;v<h;++v,z&=-5)for(b=T*v,z|=2,g=o;g<u;++g,z&=-3)for(y=b+M*g,z|=1,m=n;m<c;++m,z&=-2)l(m,g,v,p=y+m,z)}var d,f,m,g,v,y,b,x=0,_=!1,w=!1,S=!1,A=e*r*i,M=e,T=e*r,E=new Int32Array(12),P=[],C=[],I=[],R=[],L=Ka(),O=Qa(),D=Ja();this.triangulate=function(t,o,a,s,c){x=t,w=s,S=c,(_=o||w)||d||(d=new Float32Array(3*A));var u=w?3*A:A;if(f&&f.length===u||(f=new Int32Array(u)),m=0,g=0,void 0!==a){var h=a[0].map(Math.round),l=a[1].map(Math.round);v=e*Math.ceil(Math.abs(h[0])/e),y=r*Math.ceil(Math.abs(h[1])/r),b=i*Math.ceil(Math.abs(h[2])/i),p(h[0],h[1],h[2],l[0],l[1],l[2])}else v=y=b=0,p();return P.length=3*m,_||(C.length=3*m),I.length=g,n&&(R.length=m),{position:new Float32Array(P),normal:_?void 0:new Float32Array(C),index:On(I,P.length/3),atomindex:n?new Int32Array(R):void 0,contour:w}}}function es(t,e,r,i){r=r||1,i=i||!0;var n,o=t.length/3,a=e.length/3;i&&(n=new Float32Array(3*o));var s,c=new Float32Array(3*o),u=new Array(20);for(s=0;s<20;++s)u[s]=new Uint32Array(o);for(s=0;s<o;++s)u[0][s]=0;var h,l,p;for(s=0;s<a;++s){var d=3*s,f=3*s+1,m=3*s+2;for(p=!0,h=0,l=u[0][e[d]];h<l;++h)if(e[f]===u[h+1][e[d]]){p=!1;break}for(p&&(u[++u[0][e[d]]][e[d]]=e[f]),p=!0,h=0,l=u[0][e[d]];h<l;++h)if(e[m]===u[h+1][e[d]]){p=!1;break}for(p&&(u[++u[0][e[d]]][e[d]]=e[m]),p=!0,h=0,l=u[0][e[f]];h<l;++h)if(e[d]===u[h+1][e[f]]){p=!1;break}for(p&&(u[++u[0][e[f]]][e[f]]=e[d]),p=!0,h=0,l=u[0][e[f]];h<l;++h)if(e[m]===u[h+1][e[f]]){p=!1;break}for(p&&(u[++u[0][e[f]]][e[f]]=e[m]),p=!0,h=0;h<u[0][e[m]];++h)if(e[d]===u[h+1][e[m]]){p=!1;break}for(p&&(u[++u[0][e[m]]][e[m]]=e[d]),p=!0,h=0,l=u[0][e[m]];h<l;++h)if(e[f]===u[h+1][e[m]]){p=!1;break}p&&(u[++u[0][e[m]]][e[m]]=e[f])}for(var g,v,y,b,x,_=0;_<r;++_){for(s=0;s<o;++s)if(g=3*s,(y=u[0][s])<3)c[g]=t[g],c[g+1]=t[g+1],c[g+2]=t[g+2];else if(3===y||4===y){for(c[g]=0,c[g+1]=0,c[g+2]=0,h=0;h<y;++h)v=3*u[h+1][s],c[g]+=t[v],c[g+1]+=t[v+1],c[g+2]+=t[v+2];c[g]+=.5*t[g],c[g+1]+=.5*t[g+1],c[g+2]+=.5*t[g+2],x=.5+y,c[g]/=x,c[g+1]/=x,c[g+2]/=x}else{for(c[g]=0,c[g+1]=0,c[g+2]=0,h=0;h<y;++h)v=3*u[h+1][s],c[g]+=t[v],c[g+1]+=t[v+1],c[g+2]+=t[v+2];c[g]+=1*t[g],c[g+1]+=1*t[g+1],c[g+2]+=1*t[g+2],b=1+y,c[g]/=b,c[g+1]/=b,c[g+2]/=b}if(t.set(c),i){rs(t,e,n);var w=3*o;for(g=0;g<w;g+=3)t[g]+=.75/4.5*-1*n[g],t[g+1]+=.75/4.5*-1*n[g+1],t[g+2]+=.75/4.5*-1*n[g+2]}}}function rs(t,e,r){var i,n;if(void 0===r)r=new Float32Array(t.length);else for(i=0,n=r.length;i<n;i++)r[i]=0;var o=new Float32Array(3),a=new Float32Array(3),s=new Float32Array(3),c=new Float32Array(3),u=new Float32Array(3);if(e)for(i=0,n=e.length;i<n;i+=3){var h=3*e[i],l=3*e[i+1],p=3*e[i+2];fa(o,t,h),fa(a,t,l),fa(s,t,p),da(c,s,a),da(u,o,a),pa(c,c,u),r[h]+=c[0],r[h+1]+=c[1],r[h+2]+=c[2],r[l]+=c[0],r[l+1]+=c[1],r[l+2]+=c[2],r[p]+=c[0],r[p+1]+=c[1],r[p+2]+=c[2]}else for(i=0,n=t.length;i<n;i+=9)fa(o,t,i),fa(a,t,i+3),fa(s,t,i+6),da(c,s,a),da(u,o,a),pa(c,c,u),r[i]=c[0],r[i+1]=c[1],r[i+2]=c[2],r[i+3]=c[0],r[i+4]=c[1],r[i+5]=c[2],r[i+6]=c[0],r[i+7]=c[1],r[i+8]=c[2];return ha(r),r}function is(t){for(var e={},r=0,i=t.length;r<i;++r)e[t[r]]=!0;return e}function ns(t,e,r,i,n){var o=1/i*3;ba(t,t,n+(o+=r)),xa(e,e,n+o),va(t,t,i),_a(t,t),ga(t,t,i),va(e,e,i),wa(e,e),ga(e,e,i);var a=new Float32Array(3);da(a,e,t),va(a,a,i),wa(a,a),xa(a,a,1);var s=256*Math.pow(10,6),c=a[0]*a[1]*a[2]*3;s<=c&&(va(t,t,i*=Math.pow(s/c,1/3)),_a(t,t),ga(t,t,i),va(e,e,i),wa(e,e),ga(e,e,i),da(a,e,t),va(a,a,i),wa(a,a),xa(a,a,1));var u=new Float32Array(t);Sa(u,u);var h=Ua(),l=Ua();Ha(l,$n(90)),Ga(h,h,l);var p=Ua();Va(p,-1/i,1/i,1/i),Ga(h,h,p);var d=Ua();return $a(d,-i*u[2],-i*u[1],-i*u[0]),Ga(h,h,d),{dim:a,tran:u,matrix:h,scaleFactor:i}}function os(t,e,r,i,n){function o(t,e,r,i,n,o){var s=a.triangulate(t,e,r,n,o);if(e&&!n&&(es(s.position,s.index,e,!0),s.normal=rs(s.position,s.index)),i&&(ca(i,s.position),s.normal)){var c=Wa();Xa(c,i),ua(c,s.normal)}return s}var a=new ts(t,e,r,i,n);this.getSurface=o}function as(t){this.polymer=t,this.size=t.residueCount}function ss(t){this.polymer=t,this.helixorient=new as(t),this.position=this.helixorient.getPosition()}function cs(t){this.content=[],this.scoreFunction=t}function us(t,e){function r(e,i,n,o){e>s&&(s=e);var a=o-n;if(0===a)return-1;var u=4*l;if(l+=1,1===a)return h[u]=n,h[u+1]=-1,h[u+2]=-1,h[u+3]=i,u;var d=n+Math.floor(a/2);p=e%3;for(var f,m,g,v,y,b=n,x=o-1;x>b;){for(v=t[3*c[g=b+x>>1]+p],m=c[g],c[g]=c[x],c[x]=m,y=b,f=b;f<x;++f)t[3*c[f]+p]<v&&(m=c[y],c[y]=c[f],c[f]=m,++y);if(m=c[x],c[x]=c[y],c[y]=m,g=y,d===g)break;d<g?x=g-1:b=g+1}return h[u]=d,h[u+1]=r(e+1,u,n,d),h[u+2]=r(e+1,u,d+1,o),h[u+3]=i,u}function i(t){var e=h[t+3];return-1===e?0:i(e)+1}function n(r,n,o){function a(u){function l(t,e){s.push([t,e]),s.size()>n&&s.pop()}var p,d,f=i(u)%3,m=3*c[h[u]],g=[t[m+0],t[m+1],t[m+2]],v=e(r,g),y=h[u+1],b=h[u+2];if(-1!==b||-1!==y){a(p=-1===b?y:-1===y?b:r[f]<=t[m+f]?y:b),(s.size()<n||v<s.peek()[1])&&v<=o&&l(u,v);for(var x=[],_=0;_<3;_+=1)x[_]=_===f?r[_]:t[m+_];var w=e(x,g);(s.size()<n||Math.abs(w)<s.peek()[1])&&Math.abs(w)<=o&&-1!==(d=p===y?b:y)&&a(d)}else(s.size()<n||v<s.peek()[1])&&v<=o&&l(u,v)}var s=new cs(function(t){return-t[1]});a(d);for(var u=[],l=0,p=Math.min(s.size(),n);l<p;l+=1)u.push(s.content[l]);return u}function o(e,r){var i=1;if(void 0===e&&(e=d,r=0),-1===e)throw new Error("node is null");var n=r%3,a=h[e+1],s=h[e+2];if(-1!==a){if(t[3*c[h[a]]+n]>t[3*c[h[e]]+n])throw new Error("left child is > parent!");i+=o(a,r+1)}if(-1!==s){if(t[3*c[h[s]]+n]<t[3*c[h[e]]+n])throw new Error("right child is < parent!");i+=o(s,r+1)}return i}for(var a=t.length/3,s=0,c=new Uint32Array(a),u=0;u<a;++u)c[u]=u;var h=new Int32Array(4*a),l=0,p=0,d=r(0,-1,0,a);this.rootIndex=d,this.maxDepth=s,this.nearest=n,this.indices=c,this.nodes=h,this.verify=o}function hs(e,r){t.Debug&&Uf.time("Kdtree build");var i;i=r?function(t,e){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}:function(t,e){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(r*r+i*i+n*n)};var n=new Float32Array(3*e.atomCount),o=new Uint32Array(e.atomCount),a=0;e.eachAtom(function(t){n[a+0]=t.x,n[a+1]=t.y,n[a+2]=t.z,o[a/3]=t.index,a+=3}),this.atomIndices=o,this.points=n,this.kdtree=new us(n,i),t.Debug&&Uf.timeEnd("Kdtree build")}function ls(t){var e=dy[t],r={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),r;for(var i=[],n=0,o=e.length;n<o;n+=3){for(var a=[],s=0;s<3;++s)a.push(py[e[n+s]]);i.push(a)}var c=/^[1-9]$/;return i.forEach(function(t){var e=0,i=(new v).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),n=i.elements;r[t]=i,t.forEach(function(t){for(var r=!1,i=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)r=!0;else if("+"===s)r=!1;else if("/"===s)i=!0;else if("X"===s)n[0+e]=r?-1:1;else if("Y"===s)n[4+e]=r?-1:1;else if("Z"===s)n[8+e]=r?-1:1;else if(c.test(s)){var u=parseInt(s);i?n[12+e]/=u:n[12+e]=u}else Uf.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1})}),r}function ps(t){var e="";return t.length>0&&(e=":"+Cn(t).join(" OR :")),new Pf(e)}function ds(e,r){if(r){t.Debug&&Uf.time("assignSecondaryStructure");var i=[];e.eachModel(function(t){t.eachChain(function(t){i.push(t.chainname)})});var n=i.slice().sort(),o=[];n.forEach(function(t){o.push(i.indexOf(t))});var a=r.helices;(a=a.filter(function(t){return Mn(n,t[0])>=0})).sort(function(t,e){var r=t[0],i=e[0],a=t[1],s=e[1];if(r===i)return a===s?0:a<s?-1:1;var c=Mn(n,r),u=Mn(n,i);return o[c]<o[u]?-1:1});var s=e.residueStore;e.eachModel(function(t){var e=0,r=a.length;if(0!==r){var i=a[e],n=!1,o=!1;t.eachChain(function(t){var c=!1;if(t.chainname===i[0])for(var u=t.residueCount,h=t.residueOffset,l=h+u,p=h;p<l;++p)if(s.resno[p]===i[1]&&s.getInscode(p)===i[2]&&(n=!0),n&&(s.sstruc[p]=i[6],s.resno[p]===i[4]&&s.getInscode(p)===i[5]&&(n=!1,(e+=1)<r?(p=h-1,i=a[e],c=t.chainname!==i[0]):o=!0)),c||o)return})}});var c=r.sheets;(c=c.filter(function(t){return Mn(n,t[0])>=0})).sort(function(t,e){var r=t[0],i=e[0];if(r===i)return 0;var a=Mn(n,r),s=Mn(n,i);return o[a]<o[s]?-1:1});var u="e".charCodeAt(0);e.eachModel(function(t){var e=0,r=c.length;if(0!==r){var i=c[e],n=!1,o=!1;t.eachChain(function(t){var a=!1;if(t.chainname===i[0])for(var h=t.residueCount,l=t.residueOffset,p=l+h,d=l;d<p;++d)if(s.resno[d]===i[1]&&s.getInscode(d)===i[2]&&(n=!0),n&&(s.sstruc[d]=u,s.resno[d]===i[4]&&s.getInscode(d)===i[5]&&(n=!1,(e+=1)<r?(d=l-1,i=c[e],a=t.chainname!==i[0]):o=!0)),a||o)return})}}),t.Debug&&Uf.timeEnd("assignSecondaryStructure")}}function fs(t){for(var e=by.length,r=t,i=0,n=by[r%e];r>=e;)r=Math.floor(r/e),n+=by[r%e],i+=1;return i>=5&&Uf.warn("chainname overflow"),n}function ms(e,r){t.Debug&&Uf.time("calculateChainnames");var i=!0;if(e.eachChain(function(t){t.chainname&&(i=!1)}),i){var n=e.modelStore,o=e.chainStore,a=e.residueStore,s=function(t,e,r,i){for(var s=o.count,c=0;c<i;++c)a.chainIndex[r+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=r,o.residueCount[s]=i,o.count+=1,n.chainCount[t]+=1},c=e.getAtomProxy(),u=e.getAtomProxy(),h=0,l=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):e.eachResidueN(2,function(t,e){var i=!1,n=t.backboneType,o=e.backboneType,s=Sv;d=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:n!==s&&n===o&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,i=r?!c.hasBondTo(u):!c.connectedTo(u)),i||e.index!==a.count-1||(i=!0,d=e.index),i&&(f.push({mIndex:l,chainname:fs(h),rStart:p,rCount:d-p+1}),h+=1,t.modelIndex!==e.modelIndex&&(h=0,l+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:l,chainname:fs(h),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)}),o.count=0,f.forEach(function(t){s(t.mIndex,t.chainname,t.rStart,t.rCount)});var m=0;e.eachModel(function(t){n.chainOffset[t.index]=m,n.chainCount[t.index]-=1,m+=n.chainCount[t.index]})}t.Debug&&Uf.timeEnd("calculateChainnames")}function gs(e){t.Debug&&Uf.time("calculateBonds"),bs(e),xs(e),t.Debug&&Uf.timeEnd("calculateBonds")}function vs(e){var r=e.structure,i=r.getAtomProxy(),n=r.getAtomProxy(),o=e.atomCount,a=e.atomOffset,s=a+o-1;if(!(o>500)){var c,u,h=[],l=[],p=[];if(o>50){var d=new hs(e,!0),f=e.isCg()?1.2:2.3;for(c=a;c<s;++c){i.index=c;var m=i.covalent+f+.3,g=d.nearest(i,1/0,m*m),v=g.length;for(u=0;u<v;++u)n.index=g[u].index,i.index<n.index&&i.connectedTo(n)&&(h.push(i.index-a),l.push(n.index-a),p.push(1))}}else for(c=a;c<s;++c)for(i.index=c,u=c+1;u<=s;++u)n.index=u,i.connectedTo(n)&&(h.push(c-a),l.push(u-a),p.push(1));return{atomIndices1:h,atomIndices2:l,bondOrders:p}}t.Debug&&Uf.warn("more than 500 atoms, skip residue for auto-bonding",e.qualifiedName())}function ys(e){t.Debug&&Uf.time("calculateAtomBondMap");var r=[];return e.eachBond(function(t){var e=t.atomIndex1,i=t.atomIndex2;void 0===r[e]&&(r[e]=[]),r[e][i]=t.index}),t.Debug&&Uf.timeEnd("calculateAtomBondMap"),r}function bs(e,r){t.Debug&&Uf.time("calculateBondsWithin");var i=e.bondStore,n=e.rungBondStore,o=e.getAtomSet(!1),a=e.getAtomProxy(),s=e.getAtomProxy(),c=e.getBondProxy(),u=r?null:ys(e);e.eachResidue(function(t){if(!r){var e=t.atomCount,h=t.atomOffset;if(e>500)return void Uf.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),p=l.atomIndices1,d=l.atomIndices2,f=l.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+h,y=d[g]+h,b=u[v];void 0!==b&&void 0!==(b=b[y])?(c.index=b,f[t.residueType.getBondIndex(v,y)]=c.bondOrder):(a.index=v,s.index=y,i.addBond(a,s,f[g]))}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(a.index=t.traceAtomIndex,s.index=t.rungEndAtomIndex,n.addBond(a,s),o.set(a.index),o.set(s.index))}),e.atomSetDict.rung=o,t.Debug&&Uf.timeEnd("calculateBondsWithin")}function xs(e,r,i){function n(t,e){var n=t.backboneType,h=e.backboneType;n!==Sv&&n===h&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,(i&&c.hasBondTo(u)||c.connectedTo(u))&&(r||o.addBond(c,u,1),c.index=t.traceAtomIndex,u.index=e.traceAtomIndex,a.addBond(c,u),s.set(c.index),s.set(u.index)))}t.Debug&&Uf.time("calculateBondsBetween");var o=e.bondStore,a=e.backboneBondStore,s=e.getAtomSet(!1),c=e.getAtomProxy(),u=e.getAtomProxy();0===a.count&&a.resize(e.residueStore.count),e.eachResidueN(2,n);var h=e.getResidueProxy(),l=e.getResidueProxy();e.eachChain(function(t){0!==t.residueCount&&(h.index=t.residueOffset,l.index=t.residueOffset+t.residueCount-1,n(l,h))}),e.atomSetDict.backbone=s,t.Debug&&Uf.timeEnd("calculateBondsBetween")}function _s(e){function r(t){var e=[];return Object.keys(o).forEach(function(r){var u=o[r].clone();s.copy(n).applyMatrix4(u),c.setFromMatrixPosition(u),c.sub(a),s.x>1&&(c.x-=1),s.x<0&&(c.x+=1),s.y>1&&(c.y-=1),s.y<0&&(c.y+=1),s.z>1&&(c.z-=1),s.z<0&&(c.z+=1),t&&c.add(t),u.setPosition(c),u.multiplyMatrices(i.fracToCart,u),u.multiply(i.cartToFrac),e.push(u)}),e}if(e.unitcell){t.Debug&&Uf.time("buildUnitcellAssembly");var i=e.unitcell,n=e.center.clone().applyMatrix4(i.cartToFrac),o=ls(i.spacegroup),a=new g,s=new g,c=new g;n.x>1&&(a.x-=1),n.x<0&&(a.x+=1),n.y>1&&(a.y-=1),n.y<0&&(a.y+=1),n.z>1&&(a.z-=1),n.z<0&&(a.z+=1);var u,h=new fy("UNITCELL"),l=r();if(e.biomolDict.NCS){u=[new v].concat(e.biomolDict.NCS.partList[0].matrixList);var p=[];l.forEach(function(t){u.forEach(function(e){p.push(t.clone().multiply(e))})}),h.addPart(p)}else h.addPart(l);var d=new g,f=new fy("SUPERCELL"),m=Array.prototype.concat.call(r(d.set(1,0,0)),r(d.set(0,1,0)),r(d.set(0,0,1)),r(d.set(-1,0,0)),r(d.set(0,-1,0)),r(d.set(0,0,-1)),r(d.set(1,1,0)),r(d.set(1,0,1)),r(d.set(0,1,1)),r(d.set(-1,-1,0)),r(d.set(-1,0,-1)),r(d.set(0,-1,-1)),r(d.set(1,-1,-1)),r(d.set(1,1,-1)),r(d.set(1,-1,1)),r(d.set(-1,1,1)),r(d.set(-1,-1,1)),r(d.set(-1,1,-1)),r(d.set(0,1,-1)),r(d.set(0,-1,1)),r(d.set(1,0,-1)),r(d.set(-1,0,1)),r(d.set(1,-1,0)),r(d.set(-1,1,0)),r(),r(d.set(1,1,1)),r(d.set(-1,-1,-1)));if(e.biomolDict.NCS){var y=[];m.forEach(function(t){u.forEach(function(e){y.push(t.clone().multiply(e))})}),f.addPart(y)}else f.addPart(m);e.biomolDict.UNITCELL=h,e.biomolDict.SUPERCELL=f,t.Debug&&Uf.timeEnd("buildUnitcellAssembly")}}function ws(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var r=e.length;if(0===r)return"";if(1===r)return e;if(2===r){if(-1!==_y.indexOf(e))return e;if(-1!==xy.indexOf(e[0]))return e[0]}return r>=3&&-1!==xy.indexOf(e[0])?e[0]:""}function Ss(t){var e=t.bondHash,r=e.countArray,i=e.offsetArray,n=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],u=[],h={};t.eachAtom(function(t){for(var e=t.index,l=i[e],p=0,d=r[e];p<d;++p){o.index=n[l+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===h[v]&&(h[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}})}function As(t,e){return t+"|"+e}function Ms(t,e,r,i){return t+"|"+e.join(",")+"|"+(r?1:0)+"|"+(i||"")}function Ts(t,e,r){if(0!==r[0]&&0!==r[8]&&0!==r[4])for(var i=t.length,n=r[0],o=r[1],a=r[2],s=-e[0]+n+n/2,c=-e[1]+o+o/2,u=-e[2]+a+a/2,h=0;h<i;h+=3)t[h+0]=(t[h+0]+s)%n,t[h+1]=(t[h+1]+c)%o,t[h+2]=(t[h+2]+u)%a}function Es(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var r,i,n,o,a=t.length;for(r=3;r<a;r+=3)for(i=0;i<3;++i)if(o=t[r+i]-t[r-3+i],Math.abs(o)>.9*e[3*i+i])if(o>0)for(n=0;n<3;++n)t[r+n]-=e[3*i+n];else for(n=0;n<3;++n)t[r+n]+=e[3*i+n];return t}}function Ps(t,e,r){return[Oo(e,r[0],3,0,t),Oo(e,r[1],3,1,t),Oo(e,r[2],3,2,t)]}function Cs(t,e,r,i,n){for(var o=t.length,a=new Float32Array(o),s=0;s<o;s+=3){var c=s+1,u=s+2;a[s]=Jn(i[s],r[s],e[s],t[s],n,1),a[c]=Jn(i[c],r[c],e[c],t[c],n,1),a[u]=Jn(i[u],r[u],e[u],t[u],n,1)}return a}function Is(t,e,r){for(var i=t.length,n=new Float32Array(i),o=0;o<i;o+=3){var a=o+1,s=o+2;n[o]=Qn(e[o],t[o],r),n[a]=Qn(e[a],t[a],r),n[s]=Qn(e[s],t[s],r)}return n}function Rs(t){return"front"===t?eh:"back"===t?rh:ih}function Ls(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}function Os(t,e){function r(e){t(e,i)}function i(){var t=n.shift();void 0!==t?(o=!0,setTimeout(function(){r(t)})):o=!1}var n=[],o=!1;if(e){for(var a=0,s=e.length;a<s;++a)n.push(e[a]);i()}this.push=function(t){n.push(t),o||i()},this.kill=function(){n.length=0},this.length=function(){return n.length}}function Ds(t){t.visible=!0}function Ns(t){t.visible=!1}function ks(t,e,r,i){var n=r-t,o=i-e;return Math.sqrt(n*n+o*o)}function Fs(t){for(var e=t||{},r=gn(e.width,256),i=gn(e.height,256),n=[r/2,i/2],o=Math.min(r/2,i/2),a=gn(e.delta,1/(o+1))*o,s=0,c=0,u=new Uint8Array(r*i*4),h=0,l=u.length;h<l;h+=4){var p=1-to(o-a,o,ks(s,c,n[0],n[1]));u[h]=255*p,u[h+1]=255*p,u[h+2]=255*p,u[h+3]=255*p,++s===r&&(s=0,c++)}var d=new y(u,r,i);return d.needsUpdate=!0,d}function Bs(t){Uf.error("makeRepresentation: representation type "+t+" unknown")}function zs(e,r,i,n){t.Debug&&Uf.time("makeRepresentation "+e);var o;if(r instanceof By){if(!(o=Wf.get(e)))return void Bs(e)}else if(r instanceof Jv)if("surface"===e)o=ob;else{if("dot"!==e)return void Bs(e);o=yb}else if(r instanceof ey)if("surface"===e)o=ob;else if("dot"===e)o=yb;else{if("slice"!==e)return void Bs(e);o=Sb}else if(r instanceof Vy)o=Nb;else if(r instanceof Ky)o=tb,r=r.getBufferList();else{if("buffer"!==e)return void Uf.error("makeRepresentation: object "+r+" unknown");o=tb}var a=new o(r,i,n);return t.Debug&&Uf.timeEnd("makeRepresentation "+e),a}function Us(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}function js(t,e){var r,i=0,n={};return e.forEach(function(e){r=0;var o={};e.forEach(function(e){o[t[r++]]=e}),n[t[i++]]=o}),n}function Gs(t,e,r,i,n){r=gn(r,!1),i=gn(i,""),n=gn(n,"");var o,a,s,c,u;if(r){var h=t,l=e;i&&n&&(h=t.getView(new Pf(i)),l=e.getView(new Pf(n)));var p=h.getSequence(),d=l.getSequence(),f=new Zb(p.join(""),d.join(""));f.calc(),f.trace();var m,g,v,y,b;o=0,a=0,s=f.ali1.length;var x=[],_=[];for(m=0;m<s;++m)y=f.ali1[m],b=f.ali2[m],g=0,v=0,"-"===y?_[a]=!1:(_[a]=!0,g=1),"-"===b?x[o]=!1:(x[o]=!0,v=1),o+=g,a+=v;var w=[],S=[],A=h.getAtomProxy(),M=l.getAtomProxy();o=0,h.eachResidue(function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(A.index=t.getAtomIndexByName("CA"),w.push(A.x,A.y,A.z)),o+=1)}),o=0,l.eachResidue(function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(M.index=t.getAtomIndexByName("CA"),S.push(M.x,M.y,M.z)),o+=1)}),c=new Float32Array(w),u=new Float32Array(S)}else c=t.getView(new Pf(i+" and .CA")),u=e.getView(new Pf(n+" and .CA"));new Uy(c,u).transform(t),t.refreshPosition()}function Vs(t,e){var r=!1,i=!1,n=!1;return(e=e||new g).set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom(function(t){if(!r)return"H"===t.atomname?(e.set(t),void(r=!0)):void(i||"CA"!==t.atomname?n||"C"!==t.atomname||(n=!0,e.sub(t)):(e.sub(t),i=!0))}),r?e:i&&n?(e.normalize(),e.multiplyScalar(ox),e.add(t),e):void 0}function $s(t){for(var e=t.length,r=new Float32Array(e),i=new Float32Array(e),n=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];r[o]=a.x,i[o]=a.y,n[o]=a.z}return{x:r,y:i,z:n,count:e}}function Hs(){return 16777215*Math.random()}function Ws(t,e,r){return t&&"Frames"===t.type?new Ix(t,e,r):!t&&e.frames?new Rx(t,e,r):new Lx(t,e,r)}function Xs(t,e){function r(t,r,i,n,o,a,s){a[s+0]=Jn(t.x,r.x,i.x,n.x,o,e),a[s+1]=Jn(t.y,r.y,i.y,n.y,o,e),a[s+2]=Jn(t.z,r.z,i.z,n.z,o,e)}function i(t,r,i,n,o,a){a.x=Jn(t.x,r.x,i.x,n.x,o,e),a.y=Jn(t.y,r.y,i.y,n.y,o,e),a.z=Jn(t.z,r.z,i.z,n.z,o,e)}function n(e,i,n,o,a,s){for(var c=0;c<t;++c)r(e,i,n,o,p*c,a,s+3*c)}function o(e,r,n,o,a,s){for(var c=0;c<t;++c){var u=p*c,h=u-d,l=u+d,g=s+3*c;h<0&&(h=0),l>1&&(l=1),i(e,r,n,o,h,f),i(e,r,n,o,l,m),m.sub(f).normalize(),m.toArray(a,g)}}function a(e,r,i,n,o){for(var a=r.next(),s=r.next(),c=r.next(),u=r.size,h=u-1,l=n||0,p=0;p<h;++p)e(a,a=s,s=c,c=r.next(),i,l),l+=3*t;o&&(e(r.get(u-2),a=r.get(u-1),s=r.get(0),c=r.get(1),i,l),l+=3*t)}function s(e,r,n,o,a,s,c,u,h,l,d,g,w){for(var S=0;S<t;++S){var A=g+3*S;w&&(A+=3*_);var M=p*S;i(e,r,n,o,M,f),i(a,s,c,u,M,m),v.subVectors(m,f).normalize(),y.fromArray(h,A),x.crossVectors(v,y).normalize(),x.toArray(d,A),b.crossVectors(y,x).normalize(),b.toArray(l,A)}}function c(e,r,i,n,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(b),y.fromArray(r,s),x.crossVectors(e,y).normalize(),x.toArray(n,s),b.crossVectors(y,x).normalize(),b.toArray(i,s)}}function u(e,r,i,n,o){var a;for(a=0;a<_;++a)i(e,n,o+3*a);for(a=_;a<t;++a)i(r,n,o+3*a)}function h(e,r,i,n,o){var a;for(a=0;a<_;++a)n[o+a]=i(e);for(a=_;a<t;++a)n[o+a]=i(r)}function l(e,r,i,n,o){for(var a=i(e),s=i(r),c=0;c<t;++c){var u=c/t;n[o+c]=(1-u)*a+u*s}}var p=1/t,d=1e-4,f=new g,m=new g;this.getPosition=function(e,r,i,o){e.reset(),a(n,e,r,i,o);var s=e.size-1,c=s*t*3;o&&(c+=3*t);var u=e.get(o?0:s);r[c]=u.x,r[c+1]=u.y,r[c+2]=u.z},this.getTangent=function(e,r,i,n){e.reset(),a(o,e,r,i,n);var s=(e.size-1)*t*3;n&&(s+=3*t),jo(r,r,s-3,s,3)};var v=new g,y=new g,b=new g,x=new g,_=Math.ceil(t/2);this.getNormal=function(e,r,i,n,o,a){b.set(0,0,1);for(var s=e-1,u=o||0,h=0;h<s;++h)c(v,r,i,n,u),u+=3*t;a&&(c(v,r,i,n,u),u+=3*t),x.toArray(n,u),b.toArray(i,u)},this.getNormalDir=function(e,r,i,n,o,a,c,u){e.reset(),r.reset();var h=new g,l=new g,p=new g,d=new g,f=new g,m=(new g).copy(e.next()),v=(new g).copy(e.next()),y=(new g).copy(e.next()),w=new g,S=(new g).copy(r.next()),A=(new g).copy(r.next()),M=(new g).copy(r.next());b.set(0,0,1);for(var T=e.size,E=T-1,P=a||0,C=0;C<E;++C)f.copy(m),m.copy(v),v.copy(y),y.copy(e.next()),w.copy(S),S.copy(A),A.copy(M),M.copy(r.next()),0===C?(h.subVectors(w,f),l.subVectors(S,m),h.dot(l)<0&&(l.multiplyScalar(-1),S.addVectors(m,l)),p.subVectors(A,v),l.dot(p)<0&&(p.multiplyScalar(-1),A.addVectors(v,p))):p.copy(d),d.subVectors(M,y),p.dot(d)<0&&(d.multiplyScalar(-1),M.addVectors(y,d)),s(f,m,v,y,w,S,A,M,i,n,o,P,u),P+=3*t;if(c&&(f.copy(e.get(T-2)),m.copy(e.get(T-1)),v.copy(e.get(0)),y.copy(e.get(1)),w.copy(r.get(T-2)),S.copy(r.get(T-1)),A.copy(r.get(0)),M.copy(r.get(1)),p.copy(d),d.subVectors(M,y),p.dot(d)<0&&(d.multiplyScalar(-1),M.addVectors(y,d)),s(f,m,v,y,w,S,A,M,i,n,o,P,u),P+=3*t),u){x.fromArray(o,3*_),b.fromArray(n,3*_);for(var I=0;I<_;++I)x.toArray(o,3*I),b.toArray(n,3*I)}else x.toArray(o,P),b.toArray(n,P)},this.getColor=function(e,r,i,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,h=n||0,l=0;l<c;++l)u(a,a=e.next(),r,i,h),h+=3*t;o&&(u(e.get(s-1),a=e.get(0),r,i,h),h+=3*t),i[h]=i[h-3],i[h+1]=i[h-2],i[h+2]=i[h-1]},this.getPicking=function(e,r,i,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,l=0;l<c;++l)h(a,a=e.next(),r,i,u),u+=t;o&&(h(e.get(s-1),a=e.get(0),r,i,u),u+=t),i[u]=i[u-1]},this.getSize=function(e,r,i,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)l(a,a=e.next(),r,i,u),u+=t;o&&(l(e.get(s-1),a=e.get(0),r,i,u),u+=t),i[u]=i[u-1]}}function qs(t,e){this.polymer=t,this.size=t.residueCount;var r=e||{};this.directional=r.directional||!1,this.positionIterator=r.positionIterator||!1,this.subdiv=r.subdiv||1,this.smoothSheet=r.smoothSheet||!1,isNaN(r.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=r.tension||.5,this.interpolator=new Xs(this.subdiv,this.tension)}function Ys(t,e,r){e=e||3.5,r=r||40;for(var i=new Pf("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),n=new Pf("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(i),a=t.getView(n),s=new Hx(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new g,v=new g,y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],h.index=c.atomIndex2[y],"O"===u.atomname&&"N"===h.atomname||"N"===u.atomname&&"O"===h.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===h.atomname){var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0===l.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),v.subVectors(x,l),m.add(v).multiplyScalar(.5),v.subVectors(_,x),Hn(m.angleTo(v))>r&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===h.atomname&&"TYR"===h.resname)&&(function(t,e,i,n){var o,a;t.atomname===i?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(n);return m.subVectors(s,o),v.subVectors(s,a),Hn(m.angleTo(v))<r}(u,h,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Zs(t,e,r){e=e||3.5,r=r||40;for(var i=new Pf("( PROTEIN and .N )"),n=new Pf("( PROTEIN and .O )"),o=t.getView(i),a=t.getView(n),s=new Hx(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new g,v=new g,y=0,b=c.count;y<b;++y){u.index=c.atomIndex1[y],h.index=c.atomIndex2[y];var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0!==l.index){var w=d.getPreviousConnectedResidue(f);void 0!==w&&(p.index=w.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(x,p),v.subVectors(x,l),m.add(v).multiplyScalar(.5),v.subVectors(_,x),Hn(m.angleTo(v))>r&&s.bondSet.clear(y)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Ks(t){var e=JSON.stringify(t);return void 0===Xx[e]&&(Xx[e]=new qx(t)),Xx[e]}function Qs(t,e){this.type=t,this.text=e||{}}function Js(t,e,r,i,n){function o(t,i,o){return((t*e+i)*r+o)*n}var a,s=new(i=i||Int32Array)(t*e*r*(n=n||1));this.data=s,this.index=o,this.set=function(t,e,r){var i=arguments,c=o(t,e,r);for(a=0;a<n;++a)s[c+a]=i[3+a]},this.toArray=function(t,e,r,i,c){var u=o(t,e,r);for(void 0===i&&(i=[]),void 0===c&&(c=0),a=0;a<n;++a)i[c+a]=s[u+a]},this.fromArray=function(t,e,r,i,c){var u=o(t,e,r);for(void 0===c&&(c=0),a=0;a<n;++a)s[u+a]=i[c+a]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new Js(t,e,r,i,n).copy(this)}}function tc(t,e,r){function i(t,e,r,i,o){m=e||1.4,g=r||2,T=o||!0;var a=0;for(var s in d)a=Math.max(a,s);var c=ns(I,R,a,g,t?m:0);y=c.dim[0],b=c.dim[1],x=c.dim[2],_=c.matrix,w=c.tran,g=c.scaleFactor,S={},A={},n(t),M=m*g,v=i||m/g,E=new Uint8Array(y*b*x),t&&(P=new Float64Array(y*b*x)),T&&(C=new Int32Array(y*b*x))}function n(t){var e,r,i,n,o,a,s,c,u,h;for(var l in d)if(e=d[l],!S[l]){for(a=(s=t?(e+m)*g+.5:e*g+.5)*s,c=Math.floor(s)+1,u=new Int32Array(c*c),h=0,r=0;r<c;++r)for(i=0;i<c;++i)(n=r*r+i*i)>a?u[h]=-1:(o=Math.sqrt(a-n),u[h]=Math.floor(o)),++h;A[l]=c,S[l]=u}}function o(r){var i,n,o,a,s,c,u,h,l,p,d,f,m,v,_,M,P,I,R=3*r,O=r;i=Math.floor(.5+g*(t[R]+w[0])),n=Math.floor(.5+g*(t[R+1]+w[1])),o=Math.floor(.5+g*(t[R+2]+w[2]));var D,N=e[O],k=S[N],F=0,B=b*x,z=A[N];for(p=0;p<z;++p)for(d=0;d<z;++d){if(-1!==(D=k[F]))for(M=-1;M<2;++M)for(P=-1;P<2;++P)for(I=-1;I<2;++I)if(0!==M&&0!==P&&0!==I)for(u=M*p,l=I*d,f=0;f<=D;++f)if(h=f*P,m=i+u,v=n+h,_=o+l,!(m<0||v<0||_<0||m>=y||v>=b||_>=x)){var U=m*B+v*x+_;if(T)if(E[U]&L){if(E[U]&L){var j=C[U];j!==R&&u*u+h*h+l*l<(a=i+u-Math.floor(.5+g*(t[j]+w[0])))*a+(s=n+h-Math.floor(.5+g*(t[j+1]+w[1])))*s+(c=o+l-Math.floor(.5+g*(t[j+2]+w[2])))*c&&(C[U]=r)}}else E[U]|=L,C[U]=r;else E[U]|=L}F++}}function a(e){console.time("EDTSurface fillvoxels");var r,i;for(r=0,i=E.length;r<i;++r)E[r]=0,e&&(P[r]=-1),T&&(C[r]=-1);for(r=0,i=t.length/3;r<i;++r)o(r);for(r=0,i=E.length;r<i;++r)E[r]&L&&(E[r]|=O);console.timeEnd("EDTSurface fillvoxels")}function s(r){var i,n,o,a,s,c,u,h,l,p,d,f,m,v,_,M,P,I,R,L=3*r,D=r,N=0;i=Math.floor(.5+g*(t[L]+w[0])),n=Math.floor(.5+g*(t[L+1]+w[1])),o=Math.floor(.5+g*(t[L+2]+w[2]));var k=e[D],F=b*x;for(m=0,R=A[k];m<R;++m)for(v=0;v<R;++v){if(-1!==S[k][N])for(M=-1;M<2;++M)for(P=-1;P<2;++P)for(I=-1;I<2;++I)if(0!==M&&0!==P&&0!==I)for(u=M*m,l=I*v,_=0;_<=S[k][N];++_)if(h=_*P,p=i+u,d=n+h,f=o+l,!(p<0||d<0||f<0||p>=y||d>=b||f>=x)){var B=p*F+d*x+f;if(E[B]&O){if(T){var z=C[B];u*u+h*h+l*l<(a=Math.floor(.5+g*(t[z]+w[0])))*a+(s=Math.floor(.5+g*(t[z+1]+w[1])))*s+(c=Math.floor(.5+g*(t[z+2]+w[2])))*c&&(C[B]=r)}}else E[B]|=O,T&&(C[B]=r)}N++}}function c(){var e,r;for(e=0,r=E.length;e<r;++e)E[e]&=~O;for(e=0,r=t.length/3;e<r;++e)s(e)}function u(){var t,e,r,i=b*x;for(t=0;t<y;++t)for(e=0;e<x;++e)for(r=0;r<b;++r){var n=t*i+r*x+e;if(E[n]&L)for(var o=0;o<26;){var a=t+N[o][0],s=e+N[o][2],c=r+N[o][1];if(a>-1&&a<y&&c>-1&&c<b&&s>-1&&s<x&&!(E[a*i+c*x+s]&L)){E[n]|=D;break}o++}}}function h(){console.time("EDTSurface fastdistancemap");var t,e,r,i,n,o=new Js(y,b,x,Uint16Array,3),a=b*x,s=M*M,c=0;for(t=0;t<y;++t)for(e=0;e<b;++e)for(r=0;r<x;++r)E[n=t*a+e*x+r]&=~O,E[n]&L&&E[n]&D&&(o.set(t,e,r,t,e,r),P[n]=0,E[n]|=O,c+=1);var u=new Int32Array(3*c),h=0,p=new Int32Array(3*c),d=0;for(t=0;t<y;++t)for(e=0;e<b;++e)for(r=0;r<x;++r)E[n=t*a+e*x+r]&D&&(u[h]=t,u[h+1]=e,u[h+2]=r,h+=3,E[n]&=~D);do{for(d=l(u,o,h,p),h=0,t=0,i=d;t<i;t+=3)n=a*p[t]+x*p[t+1]+p[t+2],E[n]&=~D,P[n]<=1.0404*s&&(u[h]=p[t],u[h+1]=p[t+1],u[h+2]=p[t+2],h+=3)}while(h>0);var f,m=v*v,g=new Uint16Array(3);for(t=0;t<y;++t)for(e=0;e<b;++e)for(r=0;r<x;++r)E[n=t*a+e*x+r]&=~D,E[n]&L&&(E[n]&O&&!(E[n]&O&&P[n]>=m)||(E[n]|=D,T&&E[n]&O&&(o.toArray(t,e,r,g),f=g[0]*a+g[1]*x+g[2],C[n]=C[f])));console.timeEnd("EDTSurface fastdistancemap")}function l(t,e,r,i){var n,o,a,s,c,u,h,l,p,d,f,m,g=new Uint16Array(3),v=0;if(0===r)return v;var _=-1,w=-1,S=-1,A=b*x;for(h=0,p=r;h<p;h+=3)for(n=t[h],o=t[h+1],a=t[h+2],e.toArray(n,o,a,g),l=0;l<6;++l)_=n+(m=N[l])[0],w=o+m[1],S=a+m[2],_<y&&_>-1&&w<b&&w>-1&&S<x&&S>-1&&(E[f=_*A+x*w+S]&L&&!(E[f]&O)?(e.fromArray(_,w,S,g),d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u,P[f]=d,E[f]|=O,E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3):E[f]&L&&E[f]&O&&(d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u)<P[f]&&(e.fromArray(_,w,S,g),P[f]=d,E[f]&D||(E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3)));for(h=0,p=r;h<p;h+=3)for(n=t[h],o=t[h+1],a=t[h+2],e.toArray(n,o,a,g),l=6;l<18;l++)_=n+(m=N[l])[0],w=o+m[1],S=a+m[2],_<y&&_>-1&&w<b&&w>-1&&S<x&&S>-1&&(E[f=_*A+x*w+S]&L&&!(E[f]&O)?(e.fromArray(_,w,S,g),d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u,P[f]=d,E[f]|=O,E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3):E[f]&L&&E[f]&O&&(d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u)<P[f]&&(e.fromArray(_,w,S,g),P[f]=d,E[f]&D||(E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3)));for(h=0,p=r;h<p;h+=3)for(n=t[h],o=t[h+1],a=t[h+2],e.toArray(n,o,a,g),l=18;l<26;l++)_=n+(m=N[l])[0],w=o+m[1],S=a+m[2],_<y&&_>-1&&w<b&&w>-1&&S<x&&S>-1&&(E[f=_*A+x*w+S]&L&&!(E[f]&O)?(e.fromArray(_,w,S,g),d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u,P[f]=d,E[f]|=O,E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3):E[f]&L&&E[f]&O&&(d=(s=_-g[0])*s+(c=w-g[1])*c+(u=S-g[2])*u)<P[f]&&(e.fromArray(_,w,S,g),P[f]=d,E[f]&D||(E[f]|=D,i[v]=_,i[v+1]=w,i[v+2]=S,v+=3)));return v}function p(t){var e,r=E.length;if("vws"===t)for(e=0;e<r;++e)E[e]&=~D,E[e]=E[e]&O?1:0;else if("ms"===t)for(e=0;e<r;++e)E[e]&=~O,E[e]&D&&(E[e]|=O),E[e]&=~D,E[e]=E[e]&O?1:0;else if("ses"===t)for(e=0;e<r;++e)E[e]&D&&E[e]&O?E[e]&=~D:E[e]&D&&!(E[e]&O)&&(E[e]|=O),E[e]=E[e]&O?1:0;else if("sas"===t)for(e=0;e<r;++e)E[e]&=~D,E[e]=E[e]&O?1:0}var d=is(e),f=sa(t);0===t.length&&(f[0].set([0,0,0]),f[1].set([0,0,0]));var m,g,v,y,b,x,_,w,S,A,M,T,E,P,C,I=f[0],R=f[1],L=1,O=2,D=4,N=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];this.getVolume=function(t,e,o,s,l){console.time("EDTSurface.getVolume");var d="vws"!==t;i(d,e,o,s,l),a(d),u(),"ms"!==t&&"ses"!==t||h(),"ses"===t&&(n(!1),c()),p(t);for(var f=0,m=C.length;f<m;++f)C[f]=r[C[f]];return console.timeEnd("EDTSurface.getVolume"),{data:E,nx:x,ny:b,nz:y,atomindex:C}},this.getSurface=function(t,e,r,i,n,o,a){var s=this.getVolume(t,e,r,i,n);return new os(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,_,a)}}function ec(t,e,r,i,n,o,a){function s(t,e){return Math.floor((t-e)/a)}for(var c=t.length,u=n[0],h=n[1],l=n[2],p=o[0],d=o[1],f=o[2],m=s(p,u)+1,g=s(d,h)+1,v=s(f,l)+1,y=m*g*v,b=g*v,x=[],_=0;_<c;_++){var w=function(t,e,r){return(s(t,u)*g+s(e,h))*v+s(r,l)}(t[_],e[_],r[_]);void 0===x[w]?x[w]=[_]:x[w].push(_)}var S=new Uint32Array(y),A=new Uint16Array(y),M=new Uint32Array(c),T=0,E=0;for(_=0;_<y;_++){var P=S[_]=T,C=x[_];if(void 0!==C)for(var I=0;I<C.length;I++)M[T]=C[I],T++;var R=T-P;A[_]=R,R>E&&(E=R)}this.neighbourListLength=27*E+1,this.withinRadii=function(n,o,a,c,p){for(var d=0,f=s(n,u),y=s(o,h),x=s(a,l),_=Math.max(0,f-1),w=Math.max(0,y-1),T=Math.max(0,x-1),E=Math.min(m,f+1),P=Math.min(g,y+1),C=Math.min(v,x+1),I=_;I<=E;++I)for(var R=I*b,L=w;L<=P;++L)for(var O=L*v,D=T;D<=C;++D)for(var N=R+O+D,k=S[N],F=k+A[N],B=k;B<F;B++){var z=M[B],U=t[z]-n,j=e[z]-o,G=r[z]-a,V=i[z]+c;U*U+j*j+G*G<=V*V&&(p[d++]=M[B])}p[d]=-1}}function rc(t,e,r){function i(t,r,i,n){E=gn(t,1.4),P=gn(r,2),C=gn(i,!0),I=gn(n,30),A=new Float32Array(v),M=new Float32Array(v);for(var c=0;c<A.length;++c){var u=e[c]+E;A[c]=u,M[c]=u*u}T=0;for(var h=0;h<A.length;++h)A[h]>T&&(T=A[h]);o(),a(),s(),H=-1}function n(t,e,r){for(var i=0;i<t.length;i++)t[i]=e+r*i}function o(){var t=ns(V,$,T,P,0);P=t.scaleFactor,R=t.dim,L=t.matrix,G=Math.min(5,2+Math.floor(E*P)),O=No(R[0]*R[1]*R[2],-1001),D=new Int32Array(O.length),N=new Float32Array(R[0]),k=new Float32Array(R[1]),F=new Float32Array(R[2]),n(N,V[0],1/P),n(k,V[1],1/P),n(F,V[2],1/P)}function a(){var t=0,e=2*Math.PI/I;z=new Float32Array(I),B=new Float32Array(I);for(var r=0;r<I;r++)z[r]=Math.cos(t),B[r]=Math.sin(t),t+=e}function s(){U=new ec(y,b,x,A,V,$,2.01*T),j=new Int32Array(U.neighbourListLength)}function c(t,e,r,i,n){var o;if(-1!==H){if((o=H)!==i&&o!==n&&u(o,t,e,r))return o;H=-1}var a=0;for(o=j[a];o>=0;){if(o!==i&&o!==n&&u(o,t,e,r))return H=o,o;o=j[++a]}return H=-1,-1}function u(e,r,i,n){var o=3*e,a=M[e],s=t[o]-r,c=t[o+1]-i,u=t[o+2]-n;return s*s+c*c+u*u<a}function h(){for(var t=0;t<v;t++){var e=y[t],r=b[t],i=x[t],n=A[t],o=M[t];U.withinRadii(e,r,i,n,j);for(var a=Math.ceil(n*P),s=Math.floor(P*(e-V[0])),u=Math.floor(P*(r-V[1])),h=Math.floor(P*(i-V[2])),l=Math.max(0,s-a),p=Math.max(0,u-a),d=Math.max(0,h-a),f=Math.min(R[0],s+a+2),m=Math.min(R[1],u+a+2),g=Math.min(R[2],h+a+2),_=l;_<f;_++)for(var w=N[_]-e,S=R[1]*R[2]*_,T=p;T<m;T++)for(var E=k[T]-r,I=w*w+E*E,L=S+R[2]*T,B=d;B<g;B++){var z=F[B]-i,G=I+z*z;if(G<o){var $=B+L;O[$]<0&&(O[$]=-O[$]);var H=Math.sqrt(G),W=n/H,X=w*W,q=E*W,Y=z*W;if(X+=e,q+=r,Y+=i,-1===c(X,q,Y,t,-1)){var Z=n-H;Z<O[$]&&(O[$]=Z,C&&(D[$]=t))}}}}}function l(){for(var t=0;t<v;t++){U.withinRadii(y[t],b[t],x[t],A[t],j);for(var e=0,r=j[e];r>=0;)t<r&&p(t,r),r=j[++e]}}function p(t,e){var r=A[t],i=A[e],n=W[0]=y[e]-y[t],o=W[1]=b[e]-b[t],a=W[2]=x[e]-x[t],s=n*n+o*o+a*a,u=Math.sqrt(s),h=r*((r*r+u*u-i*i)/(2*r*u));ya(W,W),d(X,W),ya(X,X),pa(q,W,X),ya(q,q);var l=Math.sqrt(r*r-h*h);va(X,X,l),va(q,q,l),va(W,W,h),W[0]+=y[t],W[1]+=b[t],W[2]+=x[t],H=-1;for(var p=G,f=0;f<I;f++){var m=z[f],g=B[f],v=W[0]+m*X[0]+g*q[0],_=W[1]+m*X[1]+g*q[1],w=W[2]+m*X[2]+g*q[2];if(-1===c(v,_,w,t,e))for(var S=Math.floor(P*(v-V[0])),M=Math.floor(P*(_-V[1])),T=Math.floor(P*(w-V[2])),E=Math.max(0,S-p),L=Math.max(0,M-p),U=Math.max(0,T-p),j=Math.min(R[0],S+p+2),$=Math.min(R[1],M+p+2),Y=Math.min(R[2],T+p+2),Z=E;Z<j;Z++){n=v-N[Z];for(var K=R[1]*R[2]*Z,Q=L;Q<$;Q++)for(var J=n*n+(o=_-k[Q])*o,tt=K+R[2]*Q,et=U;et<Y;et++){s=J+(a=w-F[et])*a;var rt=et+tt,it=O[rt];it>0&&s<it*it&&(O[rt]=Math.sqrt(s),C&&(D[rt]=t))}}}}function d(t,e){return t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2]),t}function f(){for(var t=0;t<O.length;t++)O[t]<0&&(O[t]=0)}function m(){for(var t=0;t<D.length;t++)D[t]=r[D[t]]}function g(t,e,r){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),i(t,e,r),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),h(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),l(),console.timeEnd("AVSurface.projectTorii"),f(),m(),console.timeEnd("AVSurface.getVolume")}for(var v=e.length,y=new Float32Array(v),b=new Float32Array(v),x=new Float32Array(v),_=0;_<v;_++){var w=3*_;y[_]=t[w],b[_]=t[w+1],x[_]=t[w+2]}var S=sa(t);0===t.length&&(S[0].set([0,0,0]),S[1].set([0,0,0]));var A,M,T,E,P,C,I,R,L,O,D,N,k,F,B,z,U,j,G,V=S[0],$=S[1],H=-1,W=new Float32Array([0,0,0]),X=new Float32Array([0,0,0]),q=new Float32Array([0,0,0]);this.getSurface=function(t,e,r,i,n,o,a){return g(e,r,n),new os(O,R[2],R[1],R[0],D).getSurface(e,!1,void 0,L,a)}}function ic(t){function e(t){for(var e=l.atomCount[t],n=l.atomOffset[t],o=new Array(e),a=0;a<e;++a)o[a]=h.atomTypeId[n+a];l.residueTypeId[t]=f.add(r,o,i)}var r,i,n=null,o=null,a=null,s=null,c=null,u=null,h=t.atomStore,l=t.residueStore,p=t.chainStore,d=t.modelStore,f=t.residueMap,m=-1,g=-1,v=-1,y=-1;this.addAtom=function(t,f,b,x,_,w,S,A){var M=!1,T=!1,E=!1;n!==t?(M=!0,T=!0,E=!0,y+=1,v+=1,g+=1):o!==b?(T=!0,E=!0,v+=1,g+=1):s===_&&a===x&&c===A||(E=!0,g+=1),m+=1,M&&(d.growIfFull(),d.chainOffset[y]=v,d.chainCount[y]=0,d.count+=1,p.modelIndex[v]=y),T&&(p.growIfFull(),p.setChainname(v,f),p.setChainid(v,b),p.residueOffset[v]=g,p.residueCount[v]=0,p.count+=1,p.modelIndex[v]=y,d.chainCount[y]+=1,l.chainIndex[g]=v),E&&(r=a,i=u,g>0&&e(g-1),l.growIfFull(),l.resno[g]=_,void 0!==S&&(l.sstruc[g]=S.charCodeAt(0)),void 0!==A&&(l.inscode[g]=A.charCodeAt(0)),l.atomOffset[g]=m,l.atomCount[g]=0,l.count+=1,l.chainIndex[g]=v,p.residueCount[v]+=1),h.count+=1,h.residueIndex[m]=g,l.atomCount[g]+=1,n=t,o=b,a=x,s=_,c=A,u=w},this.finalize=function(){r=a,i=u,g>-1&&e(g)}}function nc(t){switch(t=t.toLowerCase()){case"polymer":return bv;case"non-polymer":return xv;case"macrolide":return _v;case"water":return wv;default:return yv}}function oc(t,e,r){var i=""+t;return e&&(i+=":"+e),r&&(i+="^"+r),i}function ac(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function sc(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function cc(t){return"?"!==t}function uc(t,e){return cc(t)?t:e}function hc(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}function lc(t,e,r){var i,n,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,u=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(gw,"")),s.id&&(e.id=s.id.trim().replace(gw,"")));var h={};if(c){var l,p,d,f;for(n=c.comp_id.length,i=0;i<n;++i)o.growIfFull(),l=c.atom_id[i].replace(mw,""),p=c.type_symbol[i],h[l]=i,o.atomTypeId[i]=a.add(l,p),o.x[i]=c.model_Cartn_x[i],o.y[i]=c.model_Cartn_y[i],o.z[i]=c.model_Cartn_z[i],o.serial[i]=i,d=c.pdbx_component_comp_id[i],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[i]:1,r.addAtom(0,"","",d,f,1);for(i=0;i<n;++i){var m=i+n;o.growIfFull(),l=c.atom_id[i].replace(mw,""),p=c.type_symbol[i],o.atomTypeId[m]=a.add(l,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[i],o.y[m]=c.pdbx_model_Cartn_y_ideal[i],o.z[m]=c.pdbx_model_Cartn_z_ideal[i],o.serial[m]=m,d=c.pdbx_component_comp_id[i],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[i]:1,r.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;n=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(i=0;i<n;++i)g=u.atom_id_1[i].replace(mw,""),v=u.atom_id_2[i].replace(mw,""),y=hc(u.value_order[i]),x.index=h[g],_.index=h[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}function pc(t,e,r){function i(t){return o.get(n.atomTypeId[t]).covalent}var n=e.atomStore,o=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new sw({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:ac(t.symmetry_space_group_name_H)});for(var a=new g,s=new g,c=t.atom_site_type_symbol.length,u=0;u<c;++u){n.growIfFull();var h=t.atom_site_label[u],l=t.atom_site_type_symbol[u];n.atomTypeId[u]=o.add(h,l),a.set(t.atom_site_fract_x[u],t.atom_site_fract_y[u],t.atom_site_fract_z[u]),a.applyMatrix4(e.unitcell.fracToCart),s.add(a),n.x[u]=a.x,n.y[u]=a.y,n.z[u]=a.z,t.atom_site_occupancy&&(n.occupancy[u]=parseFloat(t.atom_site_occupancy[u])),n.serial[u]=u,r.addAtom(0,"","","HET",1,1)}s.divideScalar(c),e.center=s,_s(e);for(var p=new g,d=new g,f=e.biomolDict.SUPERCELL.partList[0].matrixList,m=c,y=new v,b=0;b<c;++b)!function(t){var e=i(t);a.set(n.x[t],n.y[t],n.z[t]),f.forEach(function(o){if(!y.equals(o)){p.copy(a),p.applyMatrix4(o);for(var s=0;s<c;++s){d.set(n.x[s],n.y[s],n.z[s]);var u=p.distanceToSquared(d),h=i(s)+e,l=h+.3,f=h-.5;if(u<l*l&&u>f*f)return n.growIfFull(),n.atomTypeId[m]=n.atomTypeId[t],n.x[m]=p.x,n.y[m]=p.y,n.z[m]=p.z,n.occupancy[m]=n.occupancy[t],n.serial[m]=m,n.altloc[m]="A".charCodeAt(0),r.addAtom(0,"","","HET",1,1),void(m+=1)}}})}(b)}function dc(t,e,r){var i,n,o,a,s=[],c=[],u=t.struct_conf;if(u)for(sc(u,"id"),i=0,n=u.beg_auth_seq_id.length;i<n;++i){var h=parseInt(u.pdbx_PDB_helix_class[i]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[i],a=u.pdbx_end_PDB_ins_code[i],s.push([r[u.beg_label_asym_id[i]],parseInt(u.beg_auth_seq_id[i]),uc(o,""),r[u.end_label_asym_id[i]],parseInt(u.end_auth_seq_id[i]),uc(a,""),(cw[h]||cw[""]).charCodeAt(0)]))}var l=t.struct_sheet_range;if(l)for(sc(l,"id"),i=0,n=l.beg_auth_seq_id.length;i<n;++i)o=l.pdbx_beg_PDB_ins_code[i],a=l.pdbx_end_PDB_ins_code[i],c.push([r[l.beg_label_asym_id[i]],parseInt(l.beg_auth_seq_id[i]),uc(o,""),r[l.end_label_asym_id[i]],parseInt(l.end_auth_seq_id[i]),uc(a,"")]);return!(!u&&!l)&&{helices:s,sheets:c}}function fc(t,e,r){var i={},n=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;sc(o,"id"),o.id.forEach(function(t,e){var r=new v,n=r.elements;n[0]=parseFloat(o["matrix[1][1]"][e]),n[1]=parseFloat(o["matrix[1][2]"][e]),n[2]=parseFloat(o["matrix[1][3]"][e]),n[4]=parseFloat(o["matrix[2][1]"][e]),n[5]=parseFloat(o["matrix[2][2]"][e]),n[6]=parseFloat(o["matrix[2][3]"][e]),n[8]=parseFloat(o["matrix[3][1]"][e]),n[9]=parseFloat(o["matrix[3][2]"][e]),n[10]=parseFloat(o["matrix[3][3]"][e]),n[3]=parseFloat(o["vector[1]"][e]),n[7]=parseFloat(o["vector[2]"][e]),n[11]=parseFloat(o["vector[3]"][e]),r.transpose(),i[t]=r})}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;sc(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach(function(t){if(t.includes("-"))for(var r=t.split("-"),n=parseInt(r[0]),o=parseInt(r[1]);n<=o;++n)e[n]=i[n];else e[t]=i[t]}),e};a.assembly_id.forEach(function(t,e){var i={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){o=o.split("(");var c=s(o[0]),u=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(u).forEach(function(e){var r=new v;r.multiplyMatrices(c[t],u[e]),i[t+"x"+e]=r})})}else i=s(o);var h=[];for(var l in i)h.push(i[l]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=r[d[f]];void 0===n[p]&&(n[p]=new fy(p)),n[p].addPart(h,d)})}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;sc(c,"id");n.NCS=new fy("NCS");var u=n.NCS.addPart();c.id.forEach(function(t,e){if("given"!==c.code[e]){var r=new v,i=r.elements;i[0]=parseFloat(c["matrix[1][1]"][e]),i[1]=parseFloat(c["matrix[1][2]"][e]),i[2]=parseFloat(c["matrix[1][3]"][e]),i[4]=parseFloat(c["matrix[2][1]"][e]),i[5]=parseFloat(c["matrix[2][2]"][e]),i[6]=parseFloat(c["matrix[2][3]"][e]),i[8]=parseFloat(c["matrix[3][1]"][e]),i[9]=parseFloat(c["matrix[3][2]"][e]),i[10]=parseFloat(c["matrix[3][3]"][e]),i[3]=parseFloat(c["vector[1]"][e]),i[7]=parseFloat(c["vector[2]"][e]),i[11]=parseFloat(c["vector[3]"][e]),r.transpose(),u.matrixList.push(r)}}),0===u.matrixList.length&&delete n.NCS}var h={};if(t.cell){var l=t.cell,p=parseFloat(l.length_a),d=parseFloat(l.length_b),f=parseFloat(l.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),h.a=p,h.b=d,h.c=f,h.alpha=parseFloat(l.angle_alpha),h.beta=parseFloat(l.angle_beta),h.gamma=parseFloat(l.angle_gamma)}t.symmetry&&(h.spacegroup=ac(t.symmetry["space_group_name_H-M"]));var g=new v;if(t.database_PDB_matrix){var y=t.database_PDB_matrix,b=g.elements;b[0]=parseFloat(y["origx[1][1]"]),b[1]=parseFloat(y["origx[1][2]"]),b[2]=parseFloat(y["origx[1][3]"]),b[4]=parseFloat(y["origx[2][1]"]),b[5]=parseFloat(y["origx[2][2]"]),b[6]=parseFloat(y["origx[2][3]"]),b[8]=parseFloat(y["origx[3][1]"]),b[9]=parseFloat(y["origx[3][2]"]),b[10]=parseFloat(y["origx[3][3]"]),b[3]=parseFloat(y["origx_vector[1]"]),b[7]=parseFloat(y["origx_vector[2]"]),b[11]=parseFloat(y["origx_vector[3]"]),g.transpose(),h.origx=g}var x=new v;if(t.atom_sites){var _=t.atom_sites,w=x.elements;w[0]=parseFloat(_["fract_transf_matrix[1][1]"]),w[1]=parseFloat(_["fract_transf_matrix[1][2]"]),w[2]=parseFloat(_["fract_transf_matrix[1][3]"]),w[4]=parseFloat(_["fract_transf_matrix[2][1]"]),w[5]=parseFloat(_["fract_transf_matrix[2][2]"]),w[6]=parseFloat(_["fract_transf_matrix[2][3]"]),w[8]=parseFloat(_["fract_transf_matrix[3][1]"]),w[9]=parseFloat(_["fract_transf_matrix[3][2]"]),w[10]=parseFloat(_["fract_transf_matrix[3][3]"]),w[3]=parseFloat(_["fract_transf_vector[1]"]),w[7]=parseFloat(_["fract_transf_vector[2]"]),w[11]=parseFloat(_["fract_transf_vector[3]"]),x.transpose(),h.scale=x}void 0!==h.a?e.unitcell=new sw(h):e.unitcell=void 0}function mc(e,r,i){var n=e.struct_conn;if(n){sc(n,"id");for(var o=/"/g,a=r.getAtomProxy(),s=r.getAtomProxy(),c={},u=0,h=n.id.length;u<h;++u){var l=n.conn_type_id[u];if("hydrog"!==l&&"mismat"!==l&&"saltbr"!==l&&("1_555"===n.ptnr1_symmetry[u]&&"1_555"===n.ptnr2_symmetry[u])){var p=n.pdbx_ptnr1_PDB_ins_code[u],d=n.pdbx_ptnr1_label_alt_id[u],f=n.ptnr1_auth_seq_id[u]+(cc(p)?"^"+p:"")+":"+i[n.ptnr1_label_asym_id[u]]+"."+n.ptnr1_label_atom_id[u].replace(o,"")+(cc(d)?"%"+d:""),m=c[f];if(!m){var g=new Pf(f);if(g.selection.error){t.Debug&&Uf.warn("invalid selection for connection",f);continue}m=r.getAtomIndices(g),c[f]=m}var v=n.pdbx_ptnr2_PDB_ins_code[u],y=n.pdbx_ptnr2_label_alt_id[u],b=n.ptnr2_auth_seq_id[u]+(cc(v)?"^"+v:"")+":"+i[n.ptnr2_label_asym_id[u]]+"."+n.ptnr2_label_atom_id[u].replace(o,"")+(cc(y)?"%"+y:""),x=c[b];if(!x){var _=new Pf(b);if(_.selection.error){t.Debug&&Uf.warn("invalid selection for connection",b);continue}x=r.getAtomIndices(_),c[b]=x}var w=m.length,S=x.length;if(w>S){var A=w;w=S,S=A;var M=m;m=x,x=M}if(0!==w&&0!==S)for(var T=0;T<S;++T)a.index=m[T%w],s.index=x[T],a&&s?r.bondStore.addBond(a,s,hc(n.pdbx_value_order[u])):Uf.log("atoms for connection not found");else t.Debug&&Uf.warn("no atoms found for",f,b)}}}}function gc(t,e,r){if(t.entity){sc(t.entity,"id");for(var i=t.entity,n=i.id.length,o=0;o<n;++o){var a=i.pdbx_description[o],s=i.type[o],c=Array.from(r[i.id[o]]);e.entityList[o]=new ow(e,o,a,s,c)}}}function vc(t,e,r){return e?new t(e.buffer,e.byteOffset,e.byteLength/(r||1)):void 0}function yc(t){return vc(DataView,t)}function bc(t){return vc(Uint8Array,t)}function xc(t){return vc(Int8Array,t)}function _c(t){return vc(Int32Array,t,4)}function wc(t){return vc(Float32Array,t,4)}function Sc(t,e){var r=t.length/2;e||(e=new Int16Array(r));for(var i=0,n=0;i<r;++i,n+=2)e[i]=t[n]<<8^t[n+1]<<0;return e}function Ac(t,e){var r=t.length/4;e||(e=new Int32Array(r));for(var i=0,n=0;i<r;++i,n+=4)e[i]=t[n]<<24^t[n+1]<<16^t[n+2]<<8^t[n+3]<<0;return e}function Mc(t,e){var r=t.length;e||(e=new Float32Array(r/4));for(var i=yc(e),n=yc(t),o=0,a=0,s=r/4;o<s;++o,a+=4)i.setFloat32(a,n.getFloat32(a),!0);return e}function Tc(t,e,r){var i=t.length,n=1/e;r||(r=new Float32Array(i));for(var o=0;o<i;++o)r[o]=t[o]*n;return r}function Ec(t,e){var r,i;if(!e){var n=0;for(r=0,i=t.length;r<i;r+=2)n+=t[r+1];e=new t.constructor(n)}var o=0;for(r=0,i=t.length;r<i;r+=2)for(var a=t[r],s=t[r+1],c=0;c<s;++c)e[o]=a,++o;return e}function Pc(t,e){var r=t.length;e||(e=new t.constructor(r)),r&&(e[0]=t[0]);for(var i=1;i<r;++i)e[i]=t[i]+e[i-1];return e}function Cc(t,e){var r,i,n=t instanceof Int8Array?127:32767,o=-n-1,a=t.length;if(!e){var s=0;for(r=0;r<a;++r)t[r]<n&&t[r]>o&&++s;e=new Int32Array(s)}for(r=0,i=0;r<a;){for(var c=0;t[r]===n||t[r]===o;)c+=t[r],++r;c+=t[r],++r,e[i]=c,++i}return e}function Ic(t,e){return Pc(Ec(t),e)}function Rc(t,e,r){return Tc(Ec(t,_c(r)),e,r)}function Lc(t,e,r){return Tc(Pc(t,_c(r)),e,r)}function Oc(t,e,r){return Tc(Cc(t,_c(r)),e,r)}function Dc(t,e,r){var i=Cc(t,_c(r));return Lc(i,e,wc(i))}function Nc(t){var e=yc(t),r=e.getInt32(0),i=e.getInt32(4),n=t.subarray(8,12);return[r,t=t.subarray(12),i,n]}function kc(t){function e(t){for(var e={},r=0;r<t;r++)e[o()]=o();return e}function r(e){var r=t.subarray(a,a+e);return a+=e,r}function i(e){var r=t.subarray(a,a+e);a+=e;if(e>65535){for(var i=[],n=0;n<r.length;n+=65535)i.push(String.fromCharCode.apply(null,r.subarray(n,n+65535)));return i.join("")}return String.fromCharCode.apply(null,r)}function n(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=o();return e}function o(){var o,c,u=t[a];if(0==(128&u))return a++,u;if(128==(240&u))return c=15&u,a++,e(c);if(144==(240&u))return c=15&u,a++,n(c);if(160==(224&u))return c=31&u,a++,i(c);if(224==(224&u))return o=s.getInt8(a),a++,o;switch(u){case 192:return a++,null;case 194:return a++,!1;case 195:return a++,!0;case 196:return c=s.getUint8(a+1),a+=2,r(c);case 197:return c=s.getUint16(a+1),a+=3,r(c);case 198:return c=s.getUint32(a+1),a+=5,r(c);case 202:return o=s.getFloat32(a+1),a+=5,o;case 203:return o=s.getFloat64(a+1),a+=9,o;case 204:return o=t[a+1],a+=2,o;case 205:return o=s.getUint16(a+1),a+=3,o;case 206:return o=s.getUint32(a+1),a+=5,o;case 208:return o=s.getInt8(a+1),a+=2,o;case 209:return o=s.getInt16(a+1),a+=3,o;case 210:return o=s.getInt32(a+1),a+=5,o;case 217:return c=s.getUint8(a+1),a+=2,i(c);case 218:return c=s.getUint16(a+1),a+=3,i(c);case 219:return c=s.getUint32(a+1),a+=5,i(c);case 220:return c=s.getUint16(a+1),a+=3,n(c);case 221:return c=s.getUint32(a+1),a+=5,n(c);case 222:return c=s.getUint16(a+1),a+=3,e(c);case 223:return c=s.getUint32(a+1),a+=5,e(c)}throw new Error("Unknown type 0x"+u.toString(16))}var a=0,s=new DataView(t.buffer);return o()}function Fc(t,e,r,i){switch(t){case 1:return Mc(e);case 2:return xc(e);case 3:return Sc(e);case 4:return Ac(e);case 5:return bc(e);case 6:return Ec(Ac(e),new Uint8Array(r));case 7:return Ec(Ac(e));case 8:return Ic(Ac(e));case 9:return Rc(Ac(e),Ac(i)[0]);case 10:return Dc(Sc(e),Ac(i)[0]);case 11:return Tc(Sc(e),Ac(i)[0]);case 12:return Oc(Sc(e),Ac(i)[0]);case 13:return Oc(xc(e),Ac(i)[0]);case 14:return Cc(Sc(e));case 15:return Cc(xc(e))}}function Bc(t,e){var r=(e=e||{}).ignoreFields,i={};return xw.forEach(function(e){var n=!!r&&-1!==r.indexOf(e),o=t[e];n||void 0===o||(o instanceof Uint8Array?i[e]=Fc.apply(null,Nc(o)):i[e]=o)}),i}function zc(t,e,r){return parseInt(t.substr(e,r).trim())}function Uc(t,e){if(t)throw new TypeError("Not a valid NetCDF v3.x file: "+e)}function jc(t){t.offset%4!=0&&t.skip(4-t.offset%4)}function Gc(t){var e=t.readUint32(),r=t.readChars(e);return jc(t),r}function Vc(t){switch(Number(t)){case cS.BYTE:return"byte";case cS.CHAR:return"char";case cS.SHORT:return"short";case cS.INT:return"int";case cS.FLOAT:return"float";case cS.DOUBLE:return"double";default:return"undefined"}}function $c(t){switch(Number(t)){case cS.BYTE:case cS.CHAR:return 1;case cS.SHORT:return 2;case cS.INT:case cS.FLOAT:return 4;case cS.DOUBLE:return 8;default:return-1}}function Hc(t){switch(String(t)){case"byte":return cS.BYTE;case"char":return cS.CHAR;case"short":return cS.SHORT;case"int":return cS.INT;case"float":return cS.FLOAT;case"double":return cS.DOUBLE;default:return-1}}function Wc(t,e){if(1!==t){for(var r=new Array(t),i=0;i<t;i++)r[i]=e();return r}return e()}function Xc(t,e,r){switch(e){case cS.BYTE:return t.readBytes(r);case cS.CHAR:return qc(t.readChars(r));case cS.SHORT:return Wc(r,t.readInt16.bind(t));case cS.INT:return Wc(r,t.readInt32.bind(t));case cS.FLOAT:return Wc(r,t.readFloat32.bind(t));case cS.DOUBLE:return Wc(r,t.readFloat64.bind(t));default:return void Uc(!0,"non valid type "+e)}}function qc(t){return 0===t.charCodeAt(t.length-1)?t.substring(0,t.length-1):t}function Yc(t,e){for(var r=Hc(e.type),i=e.size/$c(r),n=new Array(i),o=0;o<i;o++)n[o]=Xc(t,r,1);return n}function Zc(t,e,r){for(var i=Hc(e.type),n=e.size?e.size/$c(i):1,o=r.length,a=new Array(o),s=r.recordStep,c=0;c<o;c++){var u=t.offset;a[c]=Xc(t,i,n),t.seek(u+s)}return a}function Kc(t,e){var r={recordDimension:{length:t.readUint32()}};r.version=e;var i=Qc(t);r.recordDimension.id=i.recordId,r.recordDimension.name=i.recordName,r.dimensions=i.dimensions,r.globalAttributes=Jc(t);var n=tu(t,i.recordId,e);return r.variables=n.variables,r.recordDimension.recordStep=n.recordStep,r}function Qc(t){var e,r,i,n=t.readUint32();if(n===uS)return Uc(t.readUint32()!==uS,"wrong empty tag for list of dimensions"),[];Uc(n!==hS,"wrong tag for list of dimensions");var o=t.readUint32();e=new Array(o);for(var a=0;a<o;a++){var s=Gc(t),c=t.readUint32();0===c&&(r=a,i=s),e[a]={name:s,size:c}}return{dimensions:e,recordId:r,recordName:i}}function Jc(t){var e,r=t.readUint32();if(r===uS)return Uc(t.readUint32()!==uS,"wrong empty tag for list of attributes"),[];Uc(r!==pS,"wrong tag for list of attributes");var i=t.readUint32();e=new Array(i);for(var n=0;n<i;n++){var o=Gc(t),a=t.readUint32();Uc(a<1||a>6,"non valid type "+a);var s=Xc(t,a,t.readUint32());jc(t),e[n]={name:o,type:Vc(a),value:s}}return e}function tu(t,e,r){var i,n=t.readUint32(),o=0;if(n===uS)return Uc(t.readUint32()!==uS,"wrong empty tag for list of variables"),[];Uc(n!==lS,"wrong tag for list of variables");var a=t.readUint32();i=new Array(a);for(var s=0;s<a;s++){for(var c=Gc(t),u=t.readUint32(),h=new Array(u),l=0;l<u;l++)h[l]=t.readUint32();var p=Jc(t),d=t.readUint32();Uc(d<1&&d>6,"non valid type "+d);var f=t.readUint32(),m=t.readUint32();2===r&&(Uc(m>0,"offsets larger than 4GB not supported"),m=t.readUint32()),h[0]===e&&(o+=f),i[s]={name:c,dimensions:h,attributes:p,type:Vc(d),size:f,offset:m,record:h[0]===e}}return{variables:i,recordStep:o}}function eu(t){for(var e=1,r=0;t>=e&&r<32;)r++,e<<=1;return r}function ru(t,e){var r=1,i=0;yS[0]=1;for(var n=0;n<t;n++){var o=void 0,a=0;for(o=0;o<r;o++)a+=yS[o]*e[n],yS[o]=255&a,a>>=8;for(;0!==a;)yS[o++]=255&a,a>>=8;r=o}var s=1;for(r--;yS[r]>=s;)i++,s*=2;return i+8*r}function iu(t,e,r,i){for(var n=(1<<r)-1,o=i[1],a=i[2],s=t[0],c=0;r>=8;)c|=(a=a<<8|e[s++])>>o<<r-8,r-=8;return r>0&&(o<r&&(o+=8,a=a<<8|e[s++]),c|=a>>(o-=r)&(1<<r)-1),c&=n,t[0]=s,t[1]=o,t[2]=a,c}function nu(t,e,r,i,n,o,a){var s=0;for(bS[1]=0,bS[2]=0,bS[3]=0;i>8;)bS[s++]=iu(t,e,8,a),i-=8;i>0&&(bS[s++]=iu(t,e,i,a));for(var c=r-1;c>0;c--){for(var u=0,h=s-1;h>=0;h--){var l=(u=u<<8|bS[h])/n[c]|0;bS[h]=l,u-=l*n[c]}o[c]=u}o[0]=bS[0]|bS[1]<<8|bS[2]<<16|bS[3]<<24}function ou(t){return t.trim().split(IS).map(parseFloat)}function au(){this.regexp={vertex_pattern:/^v\s+([\d.+\-eE]+)\s+([\d.+\-eE]+)\s+([\d.+\-eE]+)/,normal_pattern:/^vn\s+([\d.+\-eE]+)\s+([\d.+\-eE]+)\s+([\d.+\-eE]+)/,uv_pattern:/^vt\s+([\d.+\-eE]+)\s+([\d.+\-eE]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}function su(){this.propertyNameMapping={}}function cu(t){return t.replace(US,"")}function uu(t){function e(){if(o(/^<\?xml\s*/)){for(var t={attributes:{}};!a()&&!s("?>");){var e=n();if(!e)return t;t.attributes[e.name]=e.value}return o(/\?>\s*/),t}}function r(){var t=o(jS);if(t){for(var e={name:t[1],attributes:{},children:[]};!(a()||s(">")||s("?>")||s("/>"));){var c=n();if(!c)return e;e.attributes[c.name]=c.value}if(o(/^\s*\/>\s*/))return e;o(/\??>\s*/),e.content=i();for(var u;u=r();)e.children.push(u);return o(/^<\/[\w-:.]+>\s*/),e}}function i(){var t=o(GS);return t?t[1]:""}function n(){var t=o(VS);if(t)return{name:t[1],value:cu(t[2])}}function o(e){var r=t.match(e);if(r)return t=t.slice(r[0].length),r}function a(){return 0===t.length}function s(e){return 0===t.indexOf(e)}return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),function(){return{declaration:e(),root:r()}}()}function hu(t,e,r){var i=t.icode.value,n=t.chain.value,o=t.altcode.value,a=t.resnum.value;return i.trim()&&(a+="^"+i),n.trim()&&(a+=":"+n),e&&(a+="."+e),r&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function lu(t,e,r){void 0===t[e]?t[e]=r:t[e]|=r}function pu(t,e){return void 0!==t&&t.value===e}function du(t){var e=t.inscode,r=t.chainname,i=t.atomname,n=t.altloc,o=t.resno;return e&&(o+="^"+e),r&&(o+=":"+r),i&&(o+="."+i),n&&(o+="%"+n),o+="/"+t.modelIndex}function fu(t,e,r){for(var i=0,n=e.getElementsByTagName("clash"),o=0,a=n.length;o<a;++o)if(t[n[o].attributes.cid.value]){i+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(i+=1),e.getElementsByTagName("bond-outlier").length>0&&(i+=1),e.getElementsByTagName("plane-outlier").length>0&&(i+=1),pu(r.rota,"OUTLIER")&&(i+=1),pu(r.rama,"OUTLIER")&&(i+=1),pu(r.RNApucker,"outlier")&&(i+=1),i}function mu(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}}return t}function gu(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function vu(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var o=0;o<i;o++)t[n+o]=e[r+o]}function yu(t){var e,r,i,n,o,a;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(a=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)o=t[e],a.set(o,n),n+=o.length;return a}function bu(t,e,r,i){for(var n=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+e[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}function xu(t,e,r,i){var n=ZS,o=i+r;t^=-1;for(var a=i;a<o;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}function _u(t,e){var r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,T;r=t.state,i=t.next_in,M=t.input,n=i+(t.avail_in-5),o=t.next_out,T=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=r.dmax,u=r.wsize,h=r.whave,l=r.wnext,p=r.window,d=r.hold,f=r.bits,m=r.lencode,g=r.distcode,v=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;t:do{f<15&&(d+=M[i++]<<f,f+=8,d+=M[i++]<<f,f+=8),b=m[d&v];e:for(;;){if(x=b>>>24,d>>>=x,f-=x,0===(x=b>>>16&255))T[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){r.mode=QS;break t}t.msg="invalid literal/length code",r.mode=KS;break t}_=65535&b,(x&=15)&&(f<x&&(d+=M[i++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=M[i++]<<f,f+=8,d+=M[i++]<<f,f+=8),b=g[d&y];r:for(;;){if(x=b>>>24,d>>>=x,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue r}t.msg="invalid distance code",r.mode=KS;break t}if(w=65535&b,x&=15,f<x&&(d+=M[i++]<<f,(f+=8)<x&&(d+=M[i++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",r.mode=KS;break t}if(d>>>=x,f-=x,x=o-a,w>x){if((x=w-x)>h&&r.sane){t.msg="invalid distance too far back",r.mode=KS;break t}if(S=0,A=p,0===l){if(S+=u-x,x<_){_-=x;do{T[o++]=p[S++]}while(--x);S=o-w,A=T}}else if(l<x){if(S+=u+l-x,(x-=l)<_){_-=x;do{T[o++]=p[S++]}while(--x);if(S=0,l<_){_-=x=l;do{T[o++]=p[S++]}while(--x);S=o-w,A=T}}}else if(S+=l-x,x<_){_-=x;do{T[o++]=p[S++]}while(--x);S=o-w,A=T}for(;_>2;)T[o++]=A[S++],T[o++]=A[S++],T[o++]=A[S++],_-=3;_&&(T[o++]=A[S++],_>1&&(T[o++]=A[S++]))}else{S=o-w;do{T[o++]=T[S++],T[o++]=T[S++],T[o++]=T[S++],_-=3}while(_>2);_&&(T[o++]=T[S++],_>1&&(T[o++]=T[S++]))}break}}break}}while(i<n&&o<s);i-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=i,t.next_out=o,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=o<s?s-o+257:257-(o-s),r.hold=d,r.bits=f}function wu(t,e,r,i,n,o,a,s){var c,u,h,l,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,T=0,E=0,P=null,C=0,I=new Uint16Array(JS+1),R=new Uint16Array(JS+1),L=null,O=0;for(y=0;y<=JS;y++)I[y]=0;for(b=0;b<i;b++)I[e[r+b]]++;for(w=v,_=JS;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),M=1,y=1;y<=JS;y++)if(M<<=1,(M-=I[y])<0)return-1;if(M>0&&(t===rA||1!==_))return-1;for(R[1]=0,y=1;y<JS;y++)R[y+1]=R[y]+I[y];for(b=0;b<i;b++)0!==e[r+b]&&(a[R[e[r+b]]++]=b);if(t===rA?(P=L=a,d=19):t===iA?(P=oA,C-=257,L=aA,O-=257,d=256):(P=sA,L=cA,d=-1),E=0,b=0,y=x,p=o,S=w,A=0,h=-1,T=1<<w,l=T-1,t===iA&&T>tA||t===nA&&T>eA)return 1;for(var D=0;;){D++,f=y-A,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=L[O+a[b]],g=P[C+a[b]]):(m=96,g=0),c=1<<y-A,x=u=1<<S;do{n[p+(E>>A)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;E&c;)c>>=1;if(0!==c?(E&=c-1,E+=c):E=0,b++,0==--I[y]){if(y===_)break;y=e[r+a[b]]}if(y>w&&(E&l)!==h){for(0===A&&(A=w),p+=x,M=1<<(S=y-A);S+A<_&&!((M-=I[S+A])<=0);)S++,M<<=1;if(T+=1<<S,t===iA&&T>tA||t===nA&&T>eA)return 1;n[h=E&l]=w<<24|S<<16|p-o|0}}return 0!==E&&(n[p+E]=y-A<<24|64<<16|0),s.bits=w,0}function Su(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function Au(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Mu(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=SA,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(eM),e.distcode=e.distdyn=new Int32Array(rM),e.sane=1,e.back=-1,mA):yA}function Tu(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,Mu(t)):yA}function Eu(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?yA:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,Tu(t))):yA}function Pu(t,e){var r,i;return t?(i=new Au,t.state=i,i.window=null,(r=Eu(t,e))!==mA&&(t.state=null),r):yA}function Cu(t){if(iM){var e;for(qS=new Int32Array(512),YS=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(wu(hA,t.lens,0,288,qS,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;wu(lA,t.lens,0,32,YS,0,t.work,{bits:5}),iM=!1}t.lencode=qS,t.lenbits=9,t.distcode=YS,t.distbits=5}function Iu(t,e,r,i){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),i>=o.wsize?(vu(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>i&&(n=i),vu(o.window,e,r-i,n,o.wnext),(i-=n)?(vu(o.window,e,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function Ru(t,e){var r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,T=0,E=new Uint8Array(4),P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return yA;(r=t.state).mode===DA&&(r.mode=NA),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,i=t.input,s=t.avail_in,u=r.hold,h=r.bits,l=s,p=c,S=mA;t:for(;;)switch(r.mode){case SA:if(0===r.wrap){r.mode=NA;break}for(;h<16;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(2&r.wrap&&35615===u){r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=xu(r.check,E,2,0),u=0,h=0,r.mode=AA;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=QA;break}if((15&u)!==wA){t.msg="unknown compression method",r.mode=QA;break}if(u>>>=4,h-=4,w=8+(15&u),0===r.wbits)r.wbits=w;else if(w>r.wbits){t.msg="invalid window size",r.mode=QA;break}r.dmax=1<<w,t.adler=r.check=1,r.mode=512&u?LA:DA,u=0,h=0;break;case AA:for(;h<16;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(r.flags=u,(255&r.flags)!==wA){t.msg="unknown compression method",r.mode=QA;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=QA;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=xu(r.check,E,2,0)),u=0,h=0,r.mode=MA;case MA:for(;h<32;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.head&&(r.head.time=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=xu(r.check,E,4,0)),u=0,h=0,r.mode=TA;case TA:for(;h<16;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=xu(r.check,E,2,0)),u=0,h=0,r.mode=EA;case EA:if(1024&r.flags){for(;h<16;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=xu(r.check,E,2,0)),u=0,h=0}else r.head&&(r.head.extra=null);r.mode=PA;case PA:if(1024&r.flags&&((d=r.length)>s&&(d=s),d&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),vu(r.head.extra,i,o,d,w)),512&r.flags&&(r.check=xu(r.check,i,d,o)),s-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=CA;case CA:if(2048&r.flags){if(0===s)break t;d=0;do{w=i[o+d++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&r.flags&&(r.check=xu(r.check,i,d,o)),s-=d,o+=d,w)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=IA;case IA:if(4096&r.flags){if(0===s)break t;d=0;do{w=i[o+d++],r.head&&w&&r.length<65536&&(r.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&r.flags&&(r.check=xu(r.check,i,d,o)),s-=d,o+=d,w)break t}else r.head&&(r.head.comment=null);r.mode=RA;case RA:if(512&r.flags){for(;h<16;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=QA;break}u=0,h=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=DA;break;case LA:for(;h<32;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}t.adler=r.check=Su(u),u=0,h=0,r.mode=OA;case OA:if(0===r.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,r.hold=u,r.bits=h,vA;t.adler=r.check=1,r.mode=DA;case DA:if(e===dA||e===fA)break t;case NA:if(r.last){u>>>=7&h,h-=7&h,r.mode=YA;break}for(;h<3;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}switch(r.last=1&u,u>>>=1,h-=1,3&u){case 0:r.mode=kA;break;case 1:if(Cu(r),r.mode=GA,e===fA){u>>>=2,h-=2;break t}break;case 2:r.mode=zA;break;case 3:t.msg="invalid block type",r.mode=QA}u>>>=2,h-=2;break;case kA:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=QA;break}if(r.length=65535&u,u=0,h=0,r.mode=FA,e===fA)break t;case FA:r.mode=BA;case BA:if(d=r.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;vu(n,i,o,d,a),s-=d,o+=d,c-=d,a+=d,r.length-=d;break}r.mode=DA;break;case zA:for(;h<14;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(r.nlen=257+(31&u),u>>>=5,h-=5,r.ndist=1+(31&u),u>>>=5,h-=5,r.ncode=4+(15&u),u>>>=4,h-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=QA;break}r.have=0,r.mode=UA;case UA:for(;r.have<r.ncode;){for(;h<3;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.lens[P[r.have++]]=7&u,u>>>=3,h-=3}for(;r.have<19;)r.lens[P[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},S=wu(uA,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,S){t.msg="invalid code lengths set",r.mode=QA;break}r.have=0,r.mode=jA;case jA:for(;r.have<r.nlen+r.ndist;){for(;T=r.lencode[u&(1<<r.lenbits)-1],g=T>>>24,v=T>>>16&255,y=65535&T,!(g<=h);){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(y<16)u>>>=g,h-=g,r.lens[r.have++]=y;else{if(16===y){for(M=g+2;h<M;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(u>>>=g,h-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=QA;break}w=r.lens[r.have-1],d=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h<M;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}h-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}h-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,h-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=QA;break}for(;d--;)r.lens[r.have++]=w}}if(r.mode===QA)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=QA;break}if(r.lenbits=9,A={bits:r.lenbits},S=wu(hA,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,S){t.msg="invalid literal/lengths set",r.mode=QA;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},S=wu(lA,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,S){t.msg="invalid distances set",r.mode=QA;break}if(r.mode=GA,e===fA)break t;case GA:r.mode=VA;case VA:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,r.hold=u,r.bits=h,_u(t,p),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,i=t.input,s=t.avail_in,u=r.hold,h=r.bits,r.mode===DA&&(r.back=-1);break}for(r.back=0;T=r.lencode[u&(1<<r.lenbits)-1],g=T>>>24,v=T>>>16&255,y=65535&T,!(g<=h);){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;T=r.lencode[_+((u&(1<<b+x)-1)>>b)],g=T>>>24,v=T>>>16&255,y=65535&T,!(b+g<=h);){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}u>>>=b,h-=b,r.back+=b}if(u>>>=g,h-=g,r.back+=g,r.length=y,0===v){r.mode=qA;break}if(32&v){r.back=-1,r.mode=DA;break}if(64&v){t.msg="invalid literal/length code",r.mode=QA;break}r.extra=15&v,r.mode=$A;case $A:if(r.extra){for(M=r.extra;h<M;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,h-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=HA;case HA:for(;T=r.distcode[u&(1<<r.distbits)-1],g=T>>>24,v=T>>>16&255,y=65535&T,!(g<=h);){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(0==(240&v)){for(b=g,x=v,_=y;T=r.distcode[_+((u&(1<<b+x)-1)>>b)],g=T>>>24,v=T>>>16&255,y=65535&T,!(b+g<=h);){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}u>>>=b,h-=b,r.back+=b}if(u>>>=g,h-=g,r.back+=g,64&v){t.msg="invalid distance code",r.mode=QA;break}r.offset=y,r.extra=15&v,r.mode=WA;case WA:if(r.extra){for(M=r.extra;h<M;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,h-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=QA;break}r.mode=XA;case XA:if(0===c)break t;if(d=p-c,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=QA;break}d>r.wnext?(d-=r.wnext,f=r.wsize-d):f=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=n,f=a-r.offset,d=r.length;d>c&&(d=c),c-=d,r.length-=d;do{n[a++]=m[f++]}while(--d);0===r.length&&(r.mode=VA);break;case qA:if(0===c)break t;n[a++]=r.length,c--,r.mode=VA;break;case YA:if(r.wrap){for(;h<32;){if(0===s)break t;s--,u|=i[o++]<<h,h+=8}if(p-=c,t.total_out+=p,r.total+=p,p&&(t.adler=r.check=r.flags?xu(r.check,n,p,a-p):bu(r.check,n,p,a-p)),p=c,(r.flags?u:Su(u))!==r.check){t.msg="incorrect data check",r.mode=QA;break}u=0,h=0}r.mode=ZA;case ZA:if(r.wrap&&r.flags){for(;h<32;){if(0===s)break t;s--,u+=i[o++]<<h,h+=8}if(u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=QA;break}u=0,h=0}r.mode=KA;case KA:S=gA;break t;case QA:S=bA;break t;case JA:return xA;case tM:default:return yA}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,r.hold=u,r.bits=h,(r.wsize||p!==t.avail_out&&r.mode<QA&&(r.mode<YA||e!==pA))&&Iu(t,t.output,t.next_out,p-t.avail_out)?(r.mode=JA,xA):(l-=t.avail_in,p-=t.avail_out,t.total_in+=l,t.total_out+=p,r.total+=p,r.wrap&&p&&(t.adler=r.check=r.flags?xu(r.check,n,p,t.next_out-p):bu(r.check,n,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===DA?128:0)+(r.mode===GA||r.mode===FA?256:0),(0===l&&0===p||e===pA)&&S===mA&&(S=_A),S)}function Lu(t){if(!t||!t.state)return yA;var e=t.state;return e.window&&(e.window=null),t.state=null,mA}function Ou(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?yA:(r.head=e,e.done=!1,mA):yA}function Du(t,e){var r,i,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&r.mode!==OA?yA:r.mode===OA&&(i=1,(i=bu(i,e,n,0))!==r.check)?bA:Iu(t,e,n,n)?(r.mode=JA,xA):(r.havedict=1,mA):yA}function Nu(t){var e,r,i,n,o,a=t.length,s=0;for(n=0;n<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),o=0,n=0;o<s;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e}function ku(t,e){if(e<65537&&(t.subarray&&oM||!t.subarray&&nM))return String.fromCharCode.apply(null,gu(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}function Fu(t){for(var e=new Uint8Array(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e}function Bu(t,e){var r,i,n,o,a=e||t.length,s=new Array(2*a);for(i=0,r=0;r<a;)if((n=t[r++])<128)s[i++]=n;else if((o=aM[n])>4)s[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&t[r++],o--;o>1?s[i++]=65533:n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|1023&n)}return ku(s,i)}function zu(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+aM[t[r]]>e?r:e}function Uu(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function ju(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function Gu(t){if(!(this instanceof Gu))return new Gu(t);this.options=mu({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Uu,this.strm.avail_out=0;var r=Pu(this.strm,e.windowBits);if(r!==cM)throw new Error(uM[r]);this.header=new ju,Ou(this.strm,this.header)}function Vu(t,e){var r=new Gu(e);if(r.push(t,!0),r.err)throw r.msg;return r.result}function $u(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=Vu(t)}catch(r){e=t}return e}"undefined"!=typeof window&&function(){window.console=window.console||{};for(var t,e,r=window.console,i={},n=function(){},o="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=o.pop();)r[t]||(r[t]=i);for(;e=a.pop();)r[e]||(r[e]=n)}(),void 0===window.HTMLCanvasElement||window.HTMLCanvasElement.prototype.toBlob||Object.defineProperty(window.HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,r){for(var i=window.atob(this.toDataURL(e,r).split(",")[1]),n=i.length,o=n>>2,a=new Uint8Array(n),s=new Uint32Array(a.buffer,0,o),c=0,u=0;c<o;c++)s[c]=i.charCodeAt(u++)|i.charCodeAt(u++)<<8|i.charCodeAt(u++)<<16|i.charCodeAt(u++)<<24;for(var h=3&n;h--;)a[u]=i.charCodeAt(u++);t(new window.Blob([a],{type:e||"image/png"}))}}),Math.cbrt=Math.cbrt||function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},Math.sign||(Math.sign=function(t){return t=+t,0===t||isNaN(t)?Number(t):t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&t>-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!==t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var e=arguments;if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var r,i=Object(t),n=!1,o=1;o<arguments.length;o++){var a=e[o];if(void 0!==a&&null!==a){for(var s=Object.keys(Object(a)),c=0,u=s.length;c<u;c++){var h=s[c];try{var l=Object.getOwnPropertyDescriptor(a,h);void 0!==l&&l.enumerable&&(i[h]=a[h])}catch(t){n||(n=!0,r=t)}}if(n)throw r}}return i}}),String.prototype.startsWith||function(){var t=function(){var t;try{var e={},r=Object.defineProperty;t=r(e,e,e)&&r}catch(t){}return t}(),e={}.toString,r=function(t){if(null===this)throw TypeError();var r=String(this);if(t&&"[object RegExp]"===e.call(t))throw TypeError();var i=r.length,n=String(t),o=n.length,a=arguments.length>1?arguments[1]:void 0,s=a?Number(a):0;Number.isNaN(s)&&(s=0);var c=Math.min(Math.max(s,0),i);if(o+c>i)return!1;for(var u=-1;++u<o;)if(r.charCodeAt(c+u)!==n.charCodeAt(u))return!1;return!0};t?t(String.prototype,"startsWith",{value:r,configurable:!0,writable:!0}):String.prototype.startsWith=r}(),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var r=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>r.length)&&(e=r.length),e-=t.length;var i=r.indexOf(t,e);return-1!==i&&i===e}),String.prototype.repeat||(String.prototype.repeat=function(t){if(null===this)throw new TypeError("can't convert "+this+" to object");var e=""+this;if(t=+t,Number.isNaN(t)&&(t=0),t<0)throw new RangeError("repeat count must be non-negative");if(t===1/0)throw new RangeError("repeat count must be less than infinity");if(t=Math.floor(t),0===e.length||0===t)return"";if(e.length*t>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var r="";1==(1&t)&&(r+=e),0!==(t>>>=1);)e+=e;return r}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),r=parseInt(e.length,10)||0;if(0===r)return!1;var i,n=parseInt(arguments[1],10)||0;n>=0?i=n:(i=r+n)<0&&(i=0);for(var o;i<r;){if(o=e[i],t===o||Number.isNaN(t)&&Number.isNaN(o))return!0;i++}return!1}),Array.from||(Array.from=function(){var t=Object.prototype.toString,e=function(e){return"function"==typeof e||"[object Function]"===t.call(e)},r=function(t){var e=Number(t);return isNaN(e)?0:0!==e&&isFinite(e)?(e>0?1:-1)*Math.floor(Math.abs(e)):e},i=Math.pow(2,53)-1,n=function(t){var e=r(t);return Math.min(Math.max(e,0),i)};return function(t){var r=this,i=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var s,c=n(i.length),u=e(r)?Object(new r(c)):new Array(c),h=0;h<c;)s=i[h],u[h]=a?void 0===o?a(s,h):a.call(o,s,h):s,h+=1;return u.length=c,u}}()),"undefined"!=typeof window&&function(){for(var t=0,e=["ms","moz","webkit","o"],r=0;r<e.length&&!window.requestAnimationFrame;++r)window.requestAnimationFrame=window[e[r]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[r]+"CancelAnimationFrame"]||window[e[r]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var r=(new Date).getTime(),i=Math.max(0,16-(r-t)),n=window.setTimeout(function(){e(r+i)},i);return t=r+i,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}(),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),"undefined"!=typeof window&&(void 0===window.performance&&(self.performance={}),void 0===window.performance.now&&function(){var t=Date.now();window.performance.now=function(){return Date.now()-t}}());var Hu=setTimeout,Wu="function"==typeof setImmediate&&setImmediate||function(t){Hu(t,0)},Xu=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,r){var i=new this.constructor(e);return n(this,new c(t,r,i)),i},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,r){function i(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){i(o,t)},r)}e[o]=a,0==--n&&t(e)}catch(t){r(t)}}if(0===e.length)return t([]);for(var n=e.length,o=0;o<e.length;o++)i(o,e[o])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,r){r(t)})},i.race=function(t){return new i(function(e,r){for(var i=0,n=t.length;i<n;i++)t[i].then(e,r)})},i._setImmediateFn=function(t){Wu=t},i._setUnhandledRejectionFn=function(t){Xu=t},void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){var e=arguments;if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),i=1;i<arguments.length;i++){var n=e[i];if(void 0!==n&&null!==n)for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r}}(),Object.assign(h.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){var e=this;if(void 0!==this._listeners){var r=this._listeners[t.type];if(void 0!==r){t.target=this;for(var i=r.slice(0),n=0,o=i.length;n<o;n++)i[n].call(e,t)}}}});var qu="86",Yu=0,Zu=1,Ku=2,Qu=0,Ju=1,th=2,eh=0,rh=1,ih=2,nh=1,oh=2,ah=0,sh=1,ch=2,uh=0,hh=1,lh=2,ph=3,dh=4,fh=5,mh=100,gh=101,vh=102,yh=103,bh=104,xh=200,_h=201,wh=202,Sh=203,Ah=204,Mh=205,Th=206,Eh=207,Ph=208,Ch=209,Ih=210,Rh=0,Lh=1,Oh=2,Dh=3,Nh=4,kh=5,Fh=6,Bh=7,zh=0,Uh=1,jh=2,Gh=0,Vh=1,$h=2,Hh=3,Wh=4,Xh=301,qh=302,Yh=303,Zh=304,Kh=305,Qh=306,Jh=307,tl=1e3,el=1001,rl=1002,il=1003,nl=1004,ol=1005,al=1006,sl=1007,cl=1008,ul=1009,hl=1010,ll=1011,pl=1012,dl=1013,fl=1014,ml=1015,gl=1016,vl=1017,yl=1018,bl=1019,xl=1020,_l=1021,wl=1022,Sl=1023,Al=1024,Ml=1025,Tl=1026,El=1027,Pl=2001,Cl=2002,Il=2003,Rl=2004,Ll=2100,Ol=2101,Dl=2102,Nl=2103,kl=2151,Fl=2201,Bl=2400,zl=0,Ul=1,jl=2,Gl=3e3,Vl=3001,$l=3007,Hl=3002,Wl=3004,Xl=3005,ql=3006,Yl=3200,Zl=3201,Kl={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;n<36;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(i<=2&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,r[n]=e[19===n?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Kl.DEG2RAD},radToDeg:function(t){return t*Kl.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(l.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(l.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new l,e=new l;return function(r,i){return t.set(r,r),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}});var Ql=0;p.DEFAULT_IMAGE=void 0,p.DEFAULT_MAPPING=300,Object.defineProperty(p.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(p.prototype,h.prototype,{constructor:p,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;void 0===r.uuid&&(r.uuid=Kl.generateUUID()),void 0===t.images[r.uuid]&&(t.images[r.uuid]={uuid:r.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(r)}),e.image=r.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case tl:t.x=t.x-Math.floor(t.x);break;case el:t.x=t.x<0?0:1;break;case rl:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case tl:t.y=t.y-Math.floor(t.y);break;case el:t.y=t.y<0?0:1;break;case rl:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(d.prototype,{isVector4:!0,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w,o=t.elements;return this.x=o[0]*e+o[4]*r+o[8]*i+o[12]*n,this.y=o[1]*e+o[5]*r+o[9]*i+o[13]*n,this.z=o[2]*e+o[6]*r+o[10]*i+o[14]*n,this.w=o[3]*e+o[7]*r+o[11]*i+o[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,i,n,o=t.elements,a=o[0],s=o[4],c=o[8],u=o[1],h=o[5],l=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(c-p)<.01&&Math.abs(l-d)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+p)<.1&&Math.abs(l+d)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+u)/4,b=(c+p)/4,x=(l+d)/4;return m>g&&m>v?m<.01?(r=0,i=.707106781,n=.707106781):(i=y/(r=Math.sqrt(m)),n=b/r):g>v?g<.01?(r=.707106781,i=0,n=.707106781):(r=y/(i=Math.sqrt(g)),n=x/i):v<.01?(r=.707106781,i=.707106781,n=0):(r=b/(n=Math.sqrt(v)),i=x/n),this.set(r,i,n,e),this}var _=Math.sqrt((d-l)*(d-l)+(c-p)*(c-p)+(u-s)*(u-s));return Math.abs(_)<.001&&(_=1),this.x=(d-l)/_,this.y=(c-p)/_,this.z=(u-s)/_,this.w=Math.acos((a+h+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new d,e=new d),t.set(r,r,r,r),e.set(i,i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(f.prototype,h.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(m,{slerp:function(t,e,r,i){return r.copy(t).slerp(e,i)},slerpFlat:function(t,e,r,i,n,o,a){var s=r[i+0],c=r[i+1],u=r[i+2],h=r[i+3],l=n[o+0],p=n[o+1],d=n[o+2],f=n[o+3];if(h!==f||s!==l||c!==p||u!==d){var m=1-a,g=s*l+c*p+u*d+h*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+l*_,c=c*m+p*_,u=u*m+d*_,h=h*m+f*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=w,c*=w,u*=w,h*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),Object.defineProperties(m.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(m.prototype,{set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,i=t._y,n=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(r/2),u=a(i/2),h=a(n/2),l=s(r/2),p=s(i/2),d=s(n/2);return"XYZ"===o?(this._x=l*u*h+c*p*d,this._y=c*p*h-l*u*d,this._z=c*u*d+l*p*h,this._w=c*u*h-l*p*d):"YXZ"===o?(this._x=l*u*h+c*p*d,this._y=c*p*h-l*u*d,this._z=c*u*d-l*p*h,this._w=c*u*h+l*p*d):"ZXY"===o?(this._x=l*u*h-c*p*d,this._y=c*p*h+l*u*d,this._z=c*u*d+l*p*h,this._w=c*u*h-l*p*d):"ZYX"===o?(this._x=l*u*h-c*p*d,this._y=c*p*h+l*u*d,this._z=c*u*d-l*p*h,this._w=c*u*h+l*p*d):"YZX"===o?(this._x=l*u*h+c*p*d,this._y=c*p*h+l*u*d,this._z=c*u*d-l*p*h,this._w=c*u*h-l*p*d):"XZY"===o&&(this._x=l*u*h-c*p*d,this._y=c*p*h-l*u*d,this._z=c*u*d+l*p*h,this._w=c*u*h+l*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],c=r[9],u=r[2],h=r[6],l=r[10],p=i+s+l;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-u)*e,this._z=(a-n)*e):i>s&&i>l?(e=2*Math.sqrt(1+i-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(o+u)/e):s>l?(e=2*Math.sqrt(1+s-i-l),this._w=(o-u)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-i-s),this._w=(a-n)/e,this._x=(o+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new g;return function(r,i){return void 0===e&&(e=new g),t=r.dot(i)+1,t<1e-6?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=r*u+o*a+i*c-n*s,this._y=i*u+o*s+n*a-r*c,this._z=n*u+o*c+r*s-i*a,this._w=o*u-r*a-i*s-n*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*t._w+r*t._x+i*t._y+n*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*u+this._w*h,this._x=r*u+this._x*h,this._y=i*u+this._y*h,this._z=n*u+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(g.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new m;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new m;return function(e,r){return this.applyQuaternion(t.setFromAxisAngle(e,r))}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6]*i,this.y=n[1]*e+n[4]*r+n[7]*i,this.z=n[2]*e+n[5]*r+n[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements,o=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*o,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*r,u=s*r+a*e-n*i,h=s*i+n*r-o*e,l=-n*e-o*r-a*i;return this.x=c*s+l*-n+u*-a-h*-o,this.y=u*s+l*-o+h*-n-c*-a,this.z=h*s+l*-a+c*-o-u*-n,this},project:function(){var t=new v;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new v;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new g,e=new g;return function(r,i){return t.set(r,r,r),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new g;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new g;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Kl.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(v.prototype,{isMatrix4:!0,set:function(t,e,r,i,n,o,a,s,c,u,h,l,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=h,g[14]=l,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new v).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this},copyPosition:function(t){var e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t=new g;return function(e){var r=this.elements,i=e.elements,n=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[8]=i[8]*a,r[9]=i[9]*a,r[10]=i[10]*a,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),a=Math.sin(r),s=Math.cos(i),c=Math.sin(i),u=Math.cos(n),h=Math.sin(n);if("XYZ"===t.order){var l=o*u,p=o*h,d=a*u,f=a*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=p+d*c,e[5]=l-f*c,e[9]=-a*s,e[2]=f-l*c,e[6]=d+p*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var l=o*u,p=o*h,d=a*u,f=a*h;e[0]=s*u,e[4]=d*c-p,e[8]=l*c+f,e[1]=s*h,e[5]=f*c+l,e[9]=p*c-d,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=w-b*h,e[8]=_*h+x,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*h+_,e[10]=b-w*h}else if("XZY"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=b*h+w,e[5]=o*u,e[9]=x*h-_,e[2]=_*h-x,e[6]=a*u,e[10]=w*h+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t._x,i=t._y,n=t._z,o=t._w,a=r+r,s=i+i,c=n+n,u=r*a,h=r*s,l=r*c,p=i*s,d=i*c,f=n*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(p+f),e[4]=h-v,e[8]=l+g,e[1]=h+v,e[5]=1-(u+f),e[9]=d-m,e[2]=l-g,e[6]=d+m,e[10]=1-(u+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new g,e=new g,r=new g;return function(i,n,o){var a=this.elements;return r.subVectors(i,n),0===r.lengthSq()&&(r.z=1),r.normalize(),t.crossVectors(o,r),0===t.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),t.crossVectors(o,r)),t.normalize(),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],c=r[12],u=r[1],h=r[5],l=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],b=r[11],x=r[15],_=i[0],w=i[4],S=i[8],A=i[12],M=i[1],T=i[5],E=i[9],P=i[13],C=i[2],I=i[6],R=i[10],L=i[14],O=i[3],D=i[7],N=i[11],k=i[15];return n[0]=o*_+a*M+s*C+c*O,n[4]=o*w+a*T+s*I+c*D,n[8]=o*S+a*E+s*R+c*N,n[12]=o*A+a*P+s*L+c*k,n[1]=u*_+h*M+l*C+p*O,n[5]=u*w+h*T+l*I+p*D,n[9]=u*S+h*E+l*R+p*N,n[13]=u*A+h*P+l*L+p*k,n[2]=d*_+f*M+m*C+g*O,n[6]=d*w+f*T+m*I+g*D,n[10]=d*S+f*E+m*R+g*N,n[14]=d*A+f*P+m*L+g*k,n[3]=v*_+y*M+b*C+x*O,n[7]=v*w+y*T+b*I+x*D,n[11]=v*S+y*E+b*R+x*N,n[15]=v*A+y*P+b*L+x*k,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new g;return function(e){for(var r=this,i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix4(r),e.setXYZ(i,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],c=t[13],u=t[2],h=t[6],l=t[10],p=t[14];return t[3]*(+n*s*h-i*c*h-n*a*l+r*c*l+i*a*p-r*s*p)+t[7]*(+e*s*p-e*c*l+n*o*l-i*o*p+i*c*u-n*s*u)+t[11]*(+e*c*h-e*a*p-n*o*h+r*o*p+n*a*u-r*c*u)+t[15]*(-i*a*u-e*s*h+e*a*l+i*o*h-r*o*l+r*s*u)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=t.elements,n=i[0],o=i[1],a=i[2],s=i[3],c=i[4],u=i[5],h=i[6],l=i[7],p=i[8],d=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],b=i[15],x=d*y*l-v*f*l+v*h*m-u*y*m-d*h*b+u*f*b,_=g*f*l-p*y*l-g*h*m+c*y*m+p*h*b-c*f*b,w=p*v*l-g*d*l+g*u*m-c*v*m-p*u*b+c*d*b,S=g*d*h-p*v*h-g*u*f+c*v*f+p*u*y-c*d*y,A=n*x+o*_+a*w+s*S;if(0===A){var M="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(M);return console.warn(M),this.identity()}var T=1/A;return r[0]=x*T,r[1]=(v*f*s-d*y*s-v*a*m+o*y*m+d*a*b-o*f*b)*T,r[2]=(u*y*s-v*h*s+v*a*l-o*y*l-u*a*b+o*h*b)*T,r[3]=(d*h*s-u*f*s-d*a*l+o*f*l+u*a*m-o*h*m)*T,r[4]=_*T,r[5]=(p*y*s-g*f*s+g*a*m-n*y*m-p*a*b+n*f*b)*T,r[6]=(g*h*s-c*y*s-g*a*l+n*y*l+c*a*b-n*h*b)*T,r[7]=(c*f*s-p*h*s+p*a*l-n*f*l-c*a*m+n*h*m)*T,r[8]=w*T,r[9]=(g*d*s-p*v*s-g*o*m+n*v*m+p*o*b-n*d*b)*T,r[10]=(c*v*s-g*u*s+g*o*l-n*v*l-c*o*b+n*u*b)*T,r[11]=(p*u*s-c*d*s-p*o*l+n*d*l+c*o*m-n*u*m)*T,r[12]=S*T,r[13]=(p*v*a-g*d*a+g*o*f-n*v*f-p*o*y+n*d*y)*T,r[14]=(g*u*a-c*v*a-g*o*h+n*v*h+c*o*y-n*u*y)*T,r[15]=(c*d*a-p*u*a+p*o*h-n*d*h-c*o*f+n*u*f)*T,this},scale:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z;return e[0]*=r,e[4]*=i,e[8]*=n,e[1]*=r,e[5]*=i,e[9]*=n,e[2]*=r,e[6]*=i,e[10]*=n,e[3]*=r,e[7]*=i,e[11]*=n,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,i))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,c=n*o,u=n*a;return this.set(c*o+r,c*a-i*s,c*s+i*a,0,c*a+i*s,u*a+r,u*s-i*o,0,c*s-i*a,u*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(t,e,r){return this.set(1,e,r,0,t,1,r,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t=new g,e=new v;return function(r,i,n){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.copy(this);var u=1/a,h=1/s,l=1/c;return e.elements[0]*=u,e.elements[1]*=u,e.elements[2]*=u,e.elements[4]*=h,e.elements[5]*=h,e.elements[6]*=h,e.elements[8]*=l,e.elements[9]*=l,e.elements[10]*=l,i.setFromRotationMatrix(e),n.x=a,n.y=s,n.z=c,this}}(),makePerspective:function(t,e,r,i,n,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*n/(e-t),c=2*n/(r-i),u=(e+t)/(e-t),h=(r+i)/(r-i),l=-(o+n)/(o-n),p=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=l,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=1/(e-t),c=1/(r-i),u=1/(o-n),h=(e+t)*s,l=(r+i)*c,p=(o+n)*u;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-l,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(e[i]!==r[i])return!1;return!0},fromArray:function(t,e){var r=this;void 0===e&&(e=0);for(var i=0;i<16;i++)r.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),y.prototype=Object.create(p.prototype),y.prototype.constructor=y,y.prototype.isDataTexture=!0,b.prototype=Object.create(p.prototype),b.prototype.constructor=b,b.prototype.isCubeTexture=!0,Object.defineProperty(b.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Jl=new p,tp=new b,ep=[],rp=[],ip=new Float32Array(16),np=new Float32Array(9);Z.prototype.setValue=function(t,e){for(var r=this.seq,i=0,n=r.length;i!==n;++i){var o=r[i];o.setValue(t,e[o.id])}};var op=/([\w\d_]+)(\])?(\[|\.)?/g;J.prototype.setValue=function(t,e,r){var i=this.map[e];void 0!==i&&i.setValue(t,r,this.renderer)},J.prototype.setOptional=function(t,e,r){var i=e[r];void 0!==i&&this.setValue(t,r,i)},J.upload=function(t,e,r,i){for(var n=0,o=e.length;n!==o;++n){var a=e[n],s=r[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},J.seqWithValue=function(t,e){for(var r=[],i=0,n=t.length;i!==n;++i){var o=t[i];o.id in e&&r.push(o)}return r};var ap={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(tt.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){if(e=Kl.euclideanModulo(e,1),r=Kl.clamp(r,0,1),i=Kl.clamp(i,0,1),0===r)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+r):i+r-i*r,o=2*i-n;this.r=t(o,n,e+1/3),this.g=t(o,n,e),this.b=t(o,n,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,n=r[1],o=r[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=(h=r[1]).length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=ap[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=e>0?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,r,i=t||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),c=Math.min(n,o,a),u=(c+s)/2;if(c===s)e=0,r=0;else{var h=s-c;switch(r=u<=.5?h/(s+c):h/(2-s-c),s){case n:e=(o-a)/h+(o<a?6:0);break;case o:e=(a-n)/h+2;break;case a:e=(n-o)/h+4}e/=6}return i.h=e,i.s=r,i.l=u,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var sp={common:{diffuse:{value:new tt(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new d(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new l(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new tt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new d(0,0,1,1)}}},cp={merge:function(t){for(var e=this,r={},i=0;i<t.length;i++){var n=e.clone(t[i]);for(var o in n)r[o]=n[o]}return r},clone:function(t){var e={};for(var r in t){e[r]={};for(var i in t[r]){var n=t[r][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture)?e[r][i]=n.clone():Array.isArray(n)?e[r][i]=n.slice():e[r][i]=n}}return e}},up={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 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 theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\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.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - 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 * transpose( 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = 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 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM            = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n  varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3(   1,   0, t.y ),\n\t\t\tvec3(   0, t.z,   0 ),\n\t\t\tvec3( t.w,   0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = 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 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\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 ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int 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\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <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}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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 <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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>\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}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\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_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_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 <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},hp={basic:{uniforms:cp.merge([sp.common,sp.aomap,sp.lightmap,sp.fog]),vertexShader:up.meshbasic_vert,fragmentShader:up.meshbasic_frag},lambert:{uniforms:cp.merge([sp.common,sp.aomap,sp.lightmap,sp.emissivemap,sp.fog,sp.lights,{emissive:{value:new tt(0)}}]),vertexShader:up.meshlambert_vert,fragmentShader:up.meshlambert_frag},phong:{uniforms:cp.merge([sp.common,sp.aomap,sp.lightmap,sp.emissivemap,sp.bumpmap,sp.normalmap,sp.displacementmap,sp.gradientmap,sp.fog,sp.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30}}]),vertexShader:up.meshphong_vert,fragmentShader:up.meshphong_frag},standard:{uniforms:cp.merge([sp.common,sp.aomap,sp.lightmap,sp.emissivemap,sp.bumpmap,sp.normalmap,sp.displacementmap,sp.roughnessmap,sp.metalnessmap,sp.fog,sp.lights,{emissive:{value:new tt(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:up.meshphysical_vert,fragmentShader:up.meshphysical_frag},points:{uniforms:cp.merge([sp.points,sp.fog]),vertexShader:up.points_vert,fragmentShader:up.points_frag},dashed:{uniforms:cp.merge([sp.common,sp.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:up.linedashed_vert,fragmentShader:up.linedashed_frag},depth:{uniforms:cp.merge([sp.common,sp.displacementmap]),vertexShader:up.depth_vert,fragmentShader:up.depth_frag},normal:{uniforms:cp.merge([sp.common,sp.bumpmap,sp.normalmap,sp.displacementmap,{opacity:{value:1}}]),vertexShader:up.normal_vert,fragmentShader:up.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:up.cube_vert,fragmentShader:up.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:up.equirect_vert,fragmentShader:up.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new g}},vertexShader:up.distanceRGBA_vert,fragmentShader:up.distanceRGBA_frag}};hp.physical={uniforms:cp.merge([hp.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:up.meshphysical_vert,fragmentShader:up.meshphysical_frag},Object.assign(et.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){var e=this;this.makeEmpty();for(var r=0,i=t.length;r<i;r++)e.expandByPoint(t[r]);return this},setFromCenterAndSize:function(){var t=new l;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new l).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new l).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var lp=0;Object.assign(nt.prototype,h.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){var e=this;if(void 0!==t)for(var r in t){var i=t[r];if(void 0!==i){var n=e[r];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):e[r]="overdraw"===r?Number(i):i:console.warn("THREE."+e.type+": '"+r+"' is not a property of this material.")}else console.warn("THREE.Material: '"+r+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var r in t){var i=t[r];delete i.metadata,e.push(i)}return e}var r=void 0===t;r&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==hh&&(i.blending=this.blending),this.shading!==oh&&(i.shading=this.shading),this.side!==eh&&(i.side=this.side),this.vertexColors!==ah&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,i.dithering=this.dithering,r){var n=e(t.textures),o=e(t.images);n.length>0&&(i.textures=n),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,r=null;if(null!==e){var i=e.length;r=new Array(i);for(var n=0;n!==i;++n)r[n]=e[n].clone()}return this.clippingPlanes=r,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ot.prototype=Object.create(nt.prototype),ot.prototype.constructor=ot,ot.prototype.isShaderMaterial=!0,ot.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=cp.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},ot.prototype.toJSON=function(t){var e=nt.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},at.prototype=Object.create(nt.prototype),at.prototype.constructor=at,at.prototype.isMeshDepthMaterial=!0,at.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(st.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],h=t[s+1],l=t[s+2];u<e&&(e=u),h<r&&(r=h),l<i&&(i=l),u>n&&(n=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,r,i),this.max.set(n,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var u=t.getX(s),h=t.getY(s),l=t.getZ(s);u<e&&(e=u),h<r&&(r=h),l<i&&(i=l),u>n&&(n=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,r,i),this.max.set(n,o,a),this},setFromPoints:function(t){var e=this;this.makeEmpty();for(var r=0,i=t.length;r<i;r++)e.expandByPoint(t[r]);return this},setFromCenterAndSize:function(){var t=new g;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new g;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new g;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new g;return function(e){var r=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var i,n,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(i=0,n=a.length;i<n;i++)t.copy(a[i]),t.applyMatrix4(e.matrixWorld),r.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(i=0,n=s.count;i<n;i++)t.fromBufferAttribute(s,i).applyMatrix4(e.matrixWorld),r.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new g).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new g;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return t.normal.x>0?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new g).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new g;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new g;return function(e){var r=e||new ct;return this.getCenter(r.center),r.radius=.5*this.getSize(t).length(),r}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new g,new g,new g,new g,new g,new g,new g,new g];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(ct.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new st;return function(e,r){var i=this.center;void 0!==r?i.copy(r):t.setFromPoints(e).getCenter(i);for(var n=0,o=0,a=e.length;o<a;o++)n=Math.max(n,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new g;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new st;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(ut.prototype,{isMatrix3:!0,set:function(t,e,r,i,n,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=i,u[2]=a,u[3]=e,u[4]=n,u[5]=s,u[6]=r,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new g;return function(e){for(var r=this,i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix3(r),e.setXYZ(i,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],c=r[1],u=r[4],h=r[7],l=r[2],p=r[5],d=r[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],_=i[5],w=i[8];return n[0]=o*f+a*v+s*x,n[3]=o*m+a*y+s*_,n[6]=o*g+a*b+s*w,n[1]=c*f+u*v+h*x,n[4]=c*m+u*y+h*_,n[7]=c*g+u*b+h*w,n[2]=l*f+p*v+d*x,n[5]=l*m+p*y+d*_,n[8]=l*g+p*b+d*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-r*n*u+r*a*s+i*n*c-i*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=t.elements,i=this.elements,n=r[0],o=r[1],a=r[2],s=r[3],c=r[4],u=r[5],h=r[6],l=r[7],p=r[8],d=p*c-u*l,f=u*h-p*s,m=l*s-c*h,g=n*d+o*f+a*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return i[0]=d*y,i[1]=(a*l-p*o)*y,i[2]=(u*o-a*c)*y,i[3]=f*y,i[4]=(p*n-a*h)*y,i[5]=(a*s-u*n)*y,i[6]=m*y,i[7]=(o*h-l*n)*y,i[8]=(c*n-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(e[i]!==r[i])return!1;return!0},fromArray:function(t,e){var r=this;void 0===e&&(e=0);for(var i=0;i<9;i++)r.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}}),Object.assign(ht.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new g,e=new g;return function(r,i,n){var o=t.subVectors(n,i).cross(e.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new g).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new g;return function(e,r){var i=r||new g,n=e.delta(t),o=this.normal.dot(n);if(0!==o){var a=-(e.start.dot(this.normal)+this.constant)/o;if(!(a<0||a>1))return i.copy(n).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),r=this.distanceToPoint(t.end);return e<0&&r>0||r<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new g).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new g,e=new ut;return function(r,i){var n=this.coplanarPoint(t).applyMatrix4(r),o=i||e.getNormalMatrix(r),a=this.normal.applyMatrix3(o).normalize();return this.constant=-n.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(lt.prototype,{set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes,r=t.elements,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],c=r[5],u=r[6],h=r[7],l=r[8],p=r[9],d=r[10],f=r[11],m=r[12],g=r[13],v=r[14],y=r[15];return e[0].setComponents(a-i,h-s,f-l,y-m).normalize(),e[1].setComponents(a+i,h+s,f+l,y+m).normalize(),e[2].setComponents(a+n,h+c,f+p,y+g).normalize(),e[3].setComponents(a-n,h-c,f-p,y-g).normalize(),e[4].setComponents(a-o,h-u,f-d,y-v).normalize(),e[5].setComponents(a+o,h+u,f+d,y+v).normalize(),this},intersectsObject:function(){var t=new ct;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new ct;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,r=t.center,i=-t.radius,n=0;n<6;n++)if(e[n].distanceToPoint(r)<i)return!1;return!0},intersectsBox:function(){var t=new g,e=new g;return function(r){for(var i=this.planes,n=0;n<6;n++){var o=i[n];t.x=o.normal.x>0?r.min.x:r.max.x,e.x=o.normal.x>0?r.max.x:r.min.x,t.y=o.normal.y>0?r.min.y:r.max.y,e.y=o.normal.y>0?r.max.y:r.min.y,t.z=o.normal.z>0?r.min.z:r.max.z,e.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0}}),ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ft.DefaultOrder="XYZ",Object.defineProperties(ft.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ft.prototype,{isEuler:!0,set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=Kl.clamp,n=t.elements,o=n[0],a=n[4],s=n[8],c=n[1],u=n[5],h=n[9],l=n[2],p=n[6],d=n[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-l,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-l,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new v;return function(e,r,i){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new m;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new g(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(mt.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var pp=0;gt.DefaultUp=new g(0,1,0),gt.DefaultMatrixAutoUpdate=!0,Object.assign(gt.prototype,h.prototype,{isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new m;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new g(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new g(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new g(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new g;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new g(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new g(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new g(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new v;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new v;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){var e=arguments,r=this;if(arguments.length>1){for(var i=0;i<arguments.length;i++)r.add(e[i]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){var e=arguments,r=this;if(arguments.length>1){for(var i=0;i<arguments.length;i++)r.remove(e[i]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(n,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){var r=this;if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var o=r.children[i].getObjectByProperty(t,e);if(void 0!==o)return o}},getWorldPosition:function(t){var e=t||new g;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new g,e=new g;return function(r){var i=r||new m;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,i,e),i}}(),getWorldRotation:function(){var t=new m;return function(e){var r=e||new ft;return this.getWorldQuaternion(t),r.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new g,e=new m;return function(r){var i=r||new g;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(){var t=new m;return function(e){var r=e||new g;return this.getWorldQuaternion(t),r.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].updateMatrixWorld(t)},toJSON:function(t){function e(e,r){return void 0===e[r.uuid]&&(e[r.uuid]=r.toJSON(t)),r.uuid}function r(t){var e=[];for(var r in t){var i=t[r];delete i.metadata,e.push(i)}return e}var i=this,n=void 0===t||""===t,o={};n&&(t={geometries:{},materials:{},textures:{},images:{}},o.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),a.matrix=this.matrix.toArray(),void 0!==this.geometry&&(a.geometry=e(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var s=[],c=0,u=this.material.length;c<u;c++)s.push(e(t.materials,i.material[c]));a.material=s}else a.material=e(t.materials,this.material);if(this.children.length>0){a.children=[];for(c=0;c<this.children.length;c++)a.children.push(i.children[c].toJSON(t).object)}if(n){var h=r(t.geometries),l=r(t.materials),p=r(t.textures),d=r(t.images);h.length>0&&(o.geometries=h),l.length>0&&(o.materials=l),p.length>0&&(o.textures=p),d.length>0&&(o.images=d)}return o.object=a,o},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){var r=this;if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];r.add(n.clone())}return this}}),vt.prototype=Object.assign(Object.create(gt.prototype),{constructor:vt,isCamera:!0,copy:function(t,e){return gt.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new m;return function(e){var r=e||new g;return this.getWorldQuaternion(t),r.set(0,0,-1).applyQuaternion(t)}}(),updateMatrixWorld:function(t){gt.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),yt.prototype=Object.assign(Object.create(vt.prototype),{constructor:yt,isOrthographicCamera:!0,copy:function(t,e){return vt.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,r,i,n,o){this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:i,width:n,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-t,o=r+t,a=i+e,s=i-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,l=(this.top-this.bottom)/this.view.height;o=(n+=h*(this.view.offsetX/c))+h*(this.view.width/c),s=(a-=l*(this.view.offsetY/u))-l*(this.view.height/u)}this.projectionMatrix.makeOrthographic(n,o,a,s,this.near,this.far)},toJSON:function(t){var e=gt.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),bt.prototype=Object.assign(Object.create(vt.prototype),{constructor:bt,isPerspectiveCamera:!0,copy:function(t,e){return vt.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Kl.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Kl.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Kl.RAD2DEG*Math.atan(Math.tan(.5*Kl.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,r,i,n,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:i,width:n,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Kl.DEG2RAD*this.fov)/this.zoom,r=2*e,i=this.aspect*r,n=-.5*i,o=this.view;if(null!==o){var a=o.fullWidth,s=o.fullHeight;n+=o.offsetX*i/a,e-=o.offsetY*r/s,i*=o.width/a,r*=o.height/s}var c=this.filmOffset;0!==c&&(n+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,e,e-r,t,this.far)},toJSON:function(t){var e=gt.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Object.assign(xt.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e=this;this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var r=0,i=t.vertexNormals.length;r<i;r++)e.vertexNormals[r]=t.vertexNormals[r].clone();for(var r=0,i=t.vertexColors.length;r<i;r++)e.vertexColors[r]=t.vertexColors[r].clone();return this}});var dp=0;Object.assign(wt.prototype,h.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=this,r=(new ut).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++)e.vertices[i].applyMatrix4(t);for(var i=0,n=this.faces.length;i<n;i++){var o=e.faces[i];o.normal.applyMatrix3(r).normalize();for(var a=0,s=o.vertexNormals.length;a<s;a++)o.vertexNormals[a].applyMatrix3(r).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new v;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new v;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new v;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new v;return function(e,r,i){return t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t=new v;return function(e,r,i){return t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new gt;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,n){var o=new xt(t,e,i,void 0!==a?[h[t].clone(),h[e].clone(),h[i].clone()]:[],void 0!==s?[r.colors[t].clone(),r.colors[e].clone(),r.colors[i].clone()]:[],n);r.faces.push(o),void 0!==c&&r.faceVertexUvs[0].push([p[t].clone(),p[e].clone(),p[i].clone()]),void 0!==u&&r.faceVertexUvs[1].push([d[t].clone(),d[e].clone(),d[i].clone()])}var r=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,u=void 0!==n.uv2?n.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var h=[],p=[],d=[],f=0,m=0;f<o.length;f+=3,m+=2)r.vertices.push(new g(o[f],o[f+1],o[f+2])),void 0!==a&&h.push(new g(a[f],a[f+1],a[f+2])),void 0!==s&&r.colors.push(new tt(s[f],s[f+1],s[f+2])),void 0!==c&&p.push(new l(c[m],c[m+1])),void 0!==u&&d.push(new l(u[m],u[m+1]));var v=t.groups;if(v.length>0)for(f=0;f<v.length;f++)for(var y=v[f],b=y.start,m=b,x=b+y.count;m<x;m+=3)void 0!==i?e(i[m],i[m+1],i[m+2],y.materialIndex):e(m,m+1,m+2,y.materialIndex);else if(void 0!==i)for(f=0;f<i.length;f+=3)e(i[f],i[f+1],i[f+2]);else for(f=0;f<o.length/3;f+=3)e(f,f+1,f+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,r=0===e?1:1/e,i=new v;return i.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var t=this,e=new g,r=new g,i=0,n=this.faces.length;i<n;i++){var o=t.faces[i],a=t.vertices[o.a],s=t.vertices[o.b],c=t.vertices[o.c];e.subVectors(c,s),r.subVectors(a,s),e.cross(r),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(t){var e=this;void 0===t&&(t=!0);var r,i,n,o,a,s;for(s=new Array(this.vertices.length),r=0,i=this.vertices.length;r<i;r++)s[r]=new g;if(t){var c,u,h,l=new g,p=new g;for(n=0,o=this.faces.length;n<o;n++)a=e.faces[n],c=e.vertices[a.a],u=e.vertices[a.b],h=e.vertices[a.c],l.subVectors(h,u),p.subVectors(c,u),l.cross(p),s[a.a].add(l),s[a.b].add(l),s[a.c].add(l)}else for(this.computeFaceNormals(),n=0,o=this.faces.length;n<o;n++)s[(a=e.faces[n]).a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(r=0,i=this.vertices.length;r<i;r++)s[r].normalize();for(n=0,o=this.faces.length;n<o;n++){var d=(a=e.faces[n]).vertexNormals;3===d.length?(d[0].copy(s[a.a]),d[1].copy(s[a.b]),d[2].copy(s[a.c])):(d[0]=s[a.a].clone(),d[1]=s[a.b].clone(),d[2]=s[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,r,i=this;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(r=i.faces[t]).vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,i,n,o=this;for(r=0,i=this.faces.length;r<i;r++)for((n=o.faces[r]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var a=new wt;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!o.morphNormals[t]){o.morphNormals[t]={},o.morphNormals[t].faceNormals=[],o.morphNormals[t].vertexNormals=[];var s=o.morphNormals[t].faceNormals,c=o.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)h=new g,l={a:new g,b:new g,c:new g},s.push(h),c.push(l)}var u=o.morphNormals[t];a.vertices=o.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals();var h,l;for(r=0,i=this.faces.length;r<i;r++)n=o.faces[r],h=u.faceNormals[r],l=u.vertexNormals[r],h.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)(n=o.faces[r]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeLineDistances:function(){for(var t=this,e=0,r=this.vertices,i=0,n=r.length;i<n;i++)i>0&&(e+=r[i].distanceTo(r[i-1])),t.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new st),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ct),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(t&&t.isGeometry){var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0],l=this.colors,p=t.colors;void 0===r&&(r=0),void 0!==e&&(i=(new ut).getNormalMatrix(e));for(var d=0,f=a.length;d<f;d++){var m=a[d].clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(var d=0,f=p.length;d<f;d++)l.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var g,v,y,b=c[d],x=b.vertexNormals,_=b.vertexColors;(g=new xt(b.a+n,b.b+n,b.c+n)).normal.copy(b.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var w=0,S=x.length;w<S;w++)v=x[w].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);g.color.copy(b.color);for(var w=0,S=_.length;w<S;w++)y=_[w],g.vertexColors.push(y.clone());g.materialIndex=b.materialIndex+r,s.push(g)}for(d=0,f=h.length;d<f;d++){var A=h[d],M=[];if(void 0!==A){for(var w=0,S=A.length;w<S;w++)M.push(A[w].clone());u.push(M)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,r,i,n,o,a,s,c=this,u={},h=[],l=[],p=Math.pow(10,4);for(r=0,i=this.vertices.length;r<i;r++)t=c.vertices[r],void 0===u[e=Math.round(t.x*p)+"_"+Math.round(t.y*p)+"_"+Math.round(t.z*p)]?(u[e]=r,h.push(c.vertices[r]),l[r]=h.length-1):l[r]=l[u[e]];var d=[];for(r=0,i=this.faces.length;r<i;r++){(n=c.faces[r]).a=l[n.a],n.b=l[n.b],n.c=l[n.c],o=[n.a,n.b,n.c];for(var f=0;f<3;f++)if(o[f]===o[(f+1)%3]){d.push(r);break}}for(r=d.length-1;r>=0;r--){var m=d[r];for(c.faces.splice(m,1),a=0,s=this.faceVertexUvs.length;a<s;a++)c.faceVertexUvs[a].splice(m,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,r=e.length,i=0;i<r;i++)e[i]._id=i;e.sort(t);var n,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===r&&(n=[]),s&&s.length===r&&(o=[]);for(i=0;i<r;i++){var c=e[i]._id;n&&n.push(a[c]),o&&o.push(s[c])}n&&(this.faceVertexUvs[0]=n),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/3,p.push(t.x,t.y,t.z),d[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==m[e]?m[e]:(m[e]=f.length,f.push(t.getHex()),m[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=g.length/2,g.push(t.x,t.y),v[e])}var n=this,o={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var s in a)void 0!==a[s]&&(o[s]=a[s]);return o}for(var c=[],u=0;u<this.vertices.length;u++){var h=n.vertices[u];c.push(h.x,h.y,h.z)}for(var l=[],p=[],d={},f=[],m={},g=[],v={},u=0;u<this.faces.length;u++){var y=n.faces[u],b=void 0!==n.faceVertexUvs[0][u],x=y.normal.length()>0,_=y.vertexNormals.length>0,w=1!==y.color.r||1!==y.color.g||1!==y.color.b,S=y.vertexColors.length>0,A=0;if(A=t(A,0,0),A=t(A,1,!0),A=t(A,2,!1),A=t(A,3,b),A=t(A,4,x),A=t(A,5,_),A=t(A,6,w),A=t(A,7,S),l.push(A),l.push(y.a,y.b,y.c),l.push(y.materialIndex),b){var M=n.faceVertexUvs[0][u];l.push(i(M[0]),i(M[1]),i(M[2]))}if(x&&l.push(e(y.normal)),_){var T=y.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(w&&l.push(r(y.color)),S){var E=y.vertexColors;l.push(r(E[0]),r(E[1]),r(E[2]))}}return o.data={},o.data.vertices=c,o.data.normals=p,f.length>0&&(o.data.colors=f),g.length>0&&(o.data.uvs=[g]),o.data.faces=l,o},clone:function(){return(new wt).copy(this)},copy:function(t){var e,r,i,n,o,a,s=this;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var c=t.vertices;for(e=0,r=c.length;e<r;e++)s.vertices.push(c[e].clone());var u=t.colors;for(e=0,r=u.length;e<r;e++)s.colors.push(u[e].clone());var h=t.faces;for(e=0,r=h.length;e<r;e++)s.faces.push(h[e].clone());for(e=0,r=t.faceVertexUvs.length;e<r;e++){var l=t.faceVertexUvs[e];for(void 0===s.faceVertexUvs[e]&&(s.faceVertexUvs[e]=[]),i=0,n=l.length;i<n;i++){var p=l[i],d=[];for(o=0,a=p.length;o<a;o++){var f=p[o];d.push(f.clone())}s.faceVertexUvs[e].push(d)}}var m=t.morphTargets;for(e=0,r=m.length;e<r;e++){var g={};if(g.name=m[e].name,void 0!==m[e].vertices)for(g.vertices=[],i=0,n=m[e].vertices.length;i<n;i++)g.vertices.push(m[e].vertices[i].clone());if(void 0!==m[e].normals)for(g.normals=[],i=0,n=m[e].normals.length;i<n;i++)g.normals.push(m[e].normals[i].clone());s.morphTargets.push(g)}var v=t.morphNormals;for(e=0,r=v.length;e<r;e++){var y={};if(void 0!==v[e].vertexNormals)for(y.vertexNormals=[],i=0,n=v[e].vertexNormals.length;i<n;i++){var b=v[e].vertexNormals[i],x={};x.a=b.a.clone(),x.b=b.b.clone(),x.c=b.c.clone(),y.vertexNormals.push(x)}if(void 0!==v[e].faceNormals)for(y.faceNormals=[],i=0,n=v[e].faceNormals.length;i<n;i++)y.faceNormals.push(v[e].faceNormals[i].clone());s.morphNormals.push(y)}var _=t.skinWeights;for(e=0,r=_.length;e<r;e++)s.skinWeights.push(_[e].clone());var w=t.skinIndices;for(e=0,r=w.length;e<r;e++)s.skinIndices.push(w[e].clone());var S=t.lineDistances;for(e=0,r=S.length;e<r;e++)s.lineDistances.push(S[e]);var A=t.boundingBox;null!==A&&(this.boundingBox=A.clone());var M=t.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(St.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(St.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){var i=this;t*=this.itemSize,r*=e.itemSize;for(var n=0,o=this.itemSize;n<o;n++)i.array[t+n]=e.array[r+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new tt),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new l),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new g),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new d),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),At.prototype=Object.create(St.prototype),At.prototype.constructor=At,Mt.prototype=Object.create(St.prototype),Mt.prototype.constructor=Mt,Tt.prototype=Object.create(St.prototype),Tt.prototype.constructor=Tt,Object.assign(Et.prototype,{computeGroups:function(t){for(var e,r=[],i=void 0,n=t.faces,o=0;o<n.length;o++){var a=n[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,r.push(e)),e={start:3*o,materialIndex:i})}void 0!==e&&(e.count=3*o-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var e,r=this,i=t.faces,n=t.vertices,o=t.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,c=t.morphTargets,u=c.length;if(u>0){e=[];for(y=0;y<u;y++)e[y]=[];this.morphTargets.position=e}var h,p=t.morphNormals,d=p.length;if(d>0){h=[];for(y=0;y<d;y++)h[y]=[];this.morphTargets.normal=h}for(var f=t.skinIndices,m=t.skinWeights,g=f.length===n.length,v=m.length===n.length,y=0;y<i.length;y++){var b=i[y];r.vertices.push(n[b.a],n[b.b],n[b.c]);var x=b.vertexNormals;if(3===x.length)r.normals.push(x[0],x[1],x[2]);else{var _=b.normal;r.normals.push(_,_,_)}var w=b.vertexColors;if(3===w.length)r.colors.push(w[0],w[1],w[2]);else{var S=b.color;r.colors.push(S,S,S)}if(!0===a&&(void 0!==(A=o[0][y])?r.uvs.push(A[0],A[1],A[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),r.uvs.push(new l,new l,new l))),!0===s){var A=o[1][y];void 0!==A?r.uvs2.push(A[0],A[1],A[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),r.uvs2.push(new l,new l,new l))}for(T=0;T<u;T++){var M=c[T].vertices;e[T].push(M[b.a],M[b.b],M[b.c])}for(var T=0;T<d;T++){var E=p[T].vertexNormals[y];h[T].push(E.a,E.b,E.c)}g&&r.skinIndices.push(f[b.a],f[b.b],f[b.c]),v&&r.skinWeights.push(m[b.a],m[b.b],m[b.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}}),Ct.MaxIndex=65535,Object.assign(Ct.prototype,h.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(Pt(t)>65535?Mt:At)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new St(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var r=this.attributes.normal;return void 0!==r&&((new ut).getNormalMatrix(t).applyToBufferAttribute(r),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new v;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new v;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new v;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new v;return function(e,r,i){return t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t=new v;return function(e,r,i){return t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new gt;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var r=new Tt(3*e.vertices.length,3),i=new Tt(3*e.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var n=new Tt(e.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var r=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(r=void 0,e.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}var i;return!0===e.verticesNeedUpdate&&(void 0!==(i=this.attributes.position)&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(i=this.attributes.normal)&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(i=this.attributes.color)&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(i=this.attributes.uv)&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(i=this.attributes.lineDistance)&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Et).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=this,r=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new St(r,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new St(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new St(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var o=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new St(o,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new St(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var s=new(Pt(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new St(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],l=0,p=h.length;l<p;l++){var d=h[l],f=new Tt(3*d.length,3);u.push(f.copyVector3sArray(d))}e.morphAttributes[c]=u}if(t.skinIndices.length>0){var m=new Tt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new Tt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new st);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new st,e=new g;return function(){null===this.boundingSphere&&(this.boundingSphere=new ct);var r=this.attributes.position;if(r){var i=this.boundingSphere.center;t.setFromBufferAttribute(r),t.getCenter(i);for(var n=0,o=0,a=r.count;o<a;o++)e.x=r.getX(o),e.y=r.getY(o),e.z=r.getZ(o),n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new St(new Float32Array(i.length),3));else for(var n=e.normal.array,o=0,a=n.length;o<a;o++)n[o]=0;var s,c,u,h=e.normal.array,l=new g,p=new g,d=new g,f=new g,m=new g;if(t){var v=t.array;0===r.length&&this.addGroup(0,v.length);for(var y=0,b=r.length;y<b;++y)for(var x=r[y],_=x.start,o=_,a=_+x.count;o<a;o+=3)s=3*v[o+0],c=3*v[o+1],u=3*v[o+2],l.fromArray(i,s),p.fromArray(i,c),d.fromArray(i,u),f.subVectors(d,p),m.subVectors(l,p),f.cross(m),h[s]+=f.x,h[s+1]+=f.y,h[s+2]+=f.z,h[c]+=f.x,h[c+1]+=f.y,h[c+2]+=f.z,h[u]+=f.x,h[u+1]+=f.y,h[u+2]+=f.z}else for(var o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),p.fromArray(i,o+3),d.fromArray(i,o+6),f.subVectors(d,p),m.subVectors(l,p),f.cross(m),h[o]=f.x,h[o+1]=f.y,h[o+2]=f.z,h[o+3]=f.x,h[o+4]=f.y,h[o+5]=f.z,h[o+6]=f.x,h[o+7]=f.y,h[o+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var r=this.attributes;for(var i in r)if(void 0!==t.attributes[i])for(var n=r[i].array,o=t.attributes[i],a=o.array,s=0,c=o.itemSize*e;s<a.length;s++,c++)n[c]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i,n=this.attributes.normal,o=0,a=n.count;o<a;o++)t=n.getX(o),e=n.getY(o),r=n.getZ(o),i=1/Math.sqrt(t*t+e*e+r*r),n.setXYZ(o,t*i,e*i,r*i)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Ct,e=this.index.array,r=this.attributes;for(var i in r){for(var n=r[i],o=n.array,a=n.itemSize,s=new o.constructor(e.length*a),c=0,u=0,h=0,l=e.length;h<l;h++){c=e[h]*a;for(var p=0;p<a;p++)s[u++]=o[c++]}t.addAttribute(i,new St(s,a))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}t.data={attributes:{}};var i=this.index;if(null!==i){a=Array.prototype.slice.call(i.array);t.data.index={type:i.array.constructor.name,array:a}}var n=this.attributes;for(var r in n){var o=n[r],a=Array.prototype.slice.call(o.array);t.data.attributes[r]={itemSize:o.itemSize,type:o.array.constructor.name,array:a,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Ct).copy(this)},copy:function(t){var e,r,i,n=this;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var o=t.index;null!==o&&this.setIndex(o.clone());var a=t.attributes;for(e in a){var s=a[e];n.addAttribute(e,s.clone())}var c=t.morphAttributes;for(e in c){var u=[],h=c[e];for(r=0,i=h.length;r<i;r++)u.push(h[r].clone());n.morphAttributes[e]=u}var l=t.groups;for(r=0,i=l.length;r<i;r++){var p=l[r];n.addGroup(p.start,p.count,p.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var f=t.boundingSphere;return null!==f&&(this.boundingSphere=f.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),It.prototype=Object.create(wt.prototype),It.prototype.constructor=It,Rt.prototype=Object.create(Ct.prototype),Rt.prototype.constructor=Rt,Lt.prototype=Object.create(wt.prototype),Lt.prototype.constructor=Lt,Ot.prototype=Object.create(Ct.prototype),Ot.prototype.constructor=Ot,Dt.prototype=Object.create(nt.prototype),Dt.prototype.constructor=Dt,Dt.prototype.isMeshBasicMaterial=!0,Dt.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.assign(Nt.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new g).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new g;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new g;r.subVectors(t,this.origin);var i=r.dot(this.direction);return i<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new g;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return r<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new g,e=new g,r=new g;return function(i,n,o,a){t.copy(i).add(n).multiplyScalar(.5),e.copy(n).sub(i).normalize(),r.copy(this.origin).sub(t);var s,c,u,h,l=.5*i.distanceTo(n),p=-this.direction.dot(e),d=r.dot(this.direction),f=-r.dot(e),m=r.lengthSq(),g=Math.abs(1-p*p);if(g>0)if(s=p*f-d,c=p*d-f,h=l*g,s>=0)if(c>=-h)if(c<=h){var v=1/g;u=(s*=v)*(s+p*(c*=v)+2*d)+c*(p*s+c+2*f)+m}else c=l,u=-(s=Math.max(0,-(p*c+d)))*s+c*(c+2*f)+m;else c=-l,u=-(s=Math.max(0,-(p*c+d)))*s+c*(c+2*f)+m;else c<=-h?u=-(s=Math.max(0,-(-p*l+d)))*s+(c=s>0?-l:Math.min(Math.max(-l,-f),l))*(c+2*f)+m:c<=h?(s=0,u=(c=Math.min(Math.max(-l,-f),l))*(c+2*f)+m):u=-(s=Math.max(0,-(p*l+d)))*s+(c=s>0?l:Math.min(Math.max(-l,-f),l))*(c+2*f)+m;else c=p>0?-l:l,u=-(s=Math.max(0,-(p*c+d)))*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new g;return function(e,r){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),n=t.dot(t)-i*i,o=e.radius*e.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,r):this.at(s,r)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(t.normal)+t.constant)/e;return r>=0?r:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var r,i,n,o,a,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(r=(t.min.x-l.x)*c,i=(t.max.x-l.x)*c):(r=(t.max.x-l.x)*c,i=(t.min.x-l.x)*c),u>=0?(n=(t.min.y-l.y)*u,o=(t.max.y-l.y)*u):(n=(t.max.y-l.y)*u,o=(t.min.y-l.y)*u),r>o||n>i?null:((n>r||r!==r)&&(r=n),(o<i||i!==i)&&(i=o),h>=0?(a=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(a=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),r>s||a>i?null:((a>r||r!==r)&&(r=a),(s<i||i!==i)&&(i=s),i<0?null:this.at(r>=0?r:i,e)))},intersectsBox:function(){var t=new g;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new g,e=new g,r=new g,i=new g;return function(n,o,a,s,c){e.subVectors(o,n),r.subVectors(a,n),i.crossVectors(e,r);var u,h=this.direction.dot(i);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null;u=-1,h=-h}t.subVectors(this.origin,n);var l=u*this.direction.dot(r.crossVectors(t,r));if(l<0)return null;var p=u*this.direction.dot(e.cross(t));if(p<0)return null;if(l+p>h)return null;var d=-u*t.dot(i);return d<0?null:this.at(d/h,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(kt.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new g).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new g).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new g;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new g,e=new g;return function(r,i){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),o=e.dot(t)/n;return i&&(o=Kl.clamp(o,0,1)),o}}(),closestPointToPoint:function(t,e,r){var i=this.closestPointToPointParameter(t,e),n=r||new g;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(Ft,{normal:function(){var t=new g;return function(e,r,i,n){var o=n||new g;o.subVectors(i,r),t.subVectors(e,r),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new g,e=new g,r=new g;return function(i,n,o,a,s){t.subVectors(a,n),e.subVectors(o,n),r.subVectors(i,n);var c=t.dot(t),u=t.dot(e),h=t.dot(r),l=e.dot(e),p=e.dot(r),d=c*l-u*u,f=s||new g;if(0===d)return f.set(-2,-1,-1);var m=1/d,v=(l*h-u*p)*m,y=(c*p-u*h)*m;return f.set(1-v-y,y,v)}}(),containsPoint:function(){var t=new g;return function(e,r,i,n){var o=Ft.barycoordFromPoint(e,r,i,n,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(Ft.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new g,e=new g;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new g).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return Ft.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new ht).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return Ft.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Ft.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new ht,e=[new kt,new kt,new kt],r=new g,i=new g;return function(n,o){var a=o||new g,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(n,r),!0===this.containsPoint(r))a.copy(r);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(r,!0,i);var u=r.distanceToSquared(i);u<s&&(s=u,a.copy(i))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Bt.prototype=Object.assign(Object.create(gt.prototype),{constructor:Bt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return gt.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t,e,r,i=this,n=this.geometry;if(n.isBufferGeometry){var o=n.morphAttributes,a=Object.keys(o);if(a.length>0){var s=o[a[0]];if(void 0!==s)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;t<e;t++)r=s[t].name||String(t),i.morphTargetInfluences.push(0),i.morphTargetDictionary[r]=t}}else{var c=n.morphTargets;if(void 0!==c&&c.length>0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=c.length;t<e;t++)r=c[t].name||String(t),i.morphTargetInfluences.push(0),i.morphTargetDictionary[r]=t}},raycast:function(){function t(t,e,r,i,n,o,a){return Ft.barycoordFromPoint(t,e,r,i,y),n.multiplyScalar(y.x),o.multiplyScalar(y.y),a.multiplyScalar(y.z),n.add(o).add(a),n.clone()}function e(t,e,r,i,n,o,a){var s=t.material;if(null===(s.side===rh?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==ih,a)))return null;x.copy(a),x.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(x);return c<e.near||c>e.far?null:{distance:c,point:x.clone(),object:t}}function r(r,i,n,o,u,h,l,p){a.fromBufferAttribute(o,h),s.fromBufferAttribute(o,l),c.fromBufferAttribute(o,p);var g=e(r,i,n,a,s,c,b);return g&&(u&&(d.fromBufferAttribute(u,h),f.fromBufferAttribute(u,l),m.fromBufferAttribute(u,p),g.uv=t(b,a,s,c,d,f,m)),g.face=new xt(h,l,p,Ft.normal(a,s,c)),g.faceIndex=h),g}var i=new v,n=new Nt,o=new ct,a=new g,s=new g,c=new g,u=new g,h=new g,p=new g,d=new l,f=new l,m=new l,y=new g,b=new g,x=new g;return function(l,g){var v=this,y=this.geometry,x=this.material,_=this.matrixWorld;if(void 0!==x&&(null===y.boundingSphere&&y.computeBoundingSphere(),o.copy(y.boundingSphere),o.applyMatrix4(_),!1!==l.ray.intersectsSphere(o)&&(i.getInverse(_),n.copy(l.ray).applyMatrix4(i),null===y.boundingBox||!1!==n.intersectsBox(y.boundingBox)))){var w;if(y.isBufferGeometry){var S,A,M,T,E,P=y.index,C=y.attributes.position,I=y.attributes.uv;if(null!==P)for(T=0,E=P.count;T<E;T+=3)S=P.getX(T),A=P.getX(T+1),M=P.getX(T+2),(w=r(v,l,n,C,I,S,A,M))&&(w.faceIndex=Math.floor(T/3),g.push(w));else for(T=0,E=C.count;T<E;T+=3)(w=r(v,l,n,C,I,S=T,A=T+1,M=T+2))&&(w.index=S,g.push(w))}else if(y.isGeometry){var R,L,O,D,N=Array.isArray(x),k=y.vertices,F=y.faces,B=y.faceVertexUvs[0];B.length>0&&(D=B);for(var z=0,U=F.length;z<U;z++){var j=F[z],G=N?x[j.materialIndex]:x;if(void 0!==G){if(R=k[j.a],L=k[j.b],O=k[j.c],!0===G.morphTargets){var V=y.morphTargets,$=v.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),c.set(0,0,0);for(var H=0,W=V.length;H<W;H++){var X=$[H];if(0!==X){var q=V[H].vertices;a.addScaledVector(u.subVectors(q[j.a],R),X),s.addScaledVector(h.subVectors(q[j.b],L),X),c.addScaledVector(p.subVectors(q[j.c],O),X)}}a.add(R),s.add(L),c.add(O),R=a,L=s,O=c}if(w=e(v,l,n,R,L,O,b)){if(D&&D[z]){var Y=D[z];d.copy(Y[0]),f.copy(Y[1]),m.copy(Y[2]),w.uv=t(b,R,L,O,d,f,m)}w.face=j,w.faceIndex=z,g.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var fp=0;fe.prototype=Object.assign(Object.create(bt.prototype),{constructor:fe,isArrayCamera:!0}),be.prototype.isFogExp2=!0,be.prototype.clone=function(){return new be(this.color.getHex(),this.density)},be.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},xe.prototype.isFog=!0,xe.prototype.clone=function(){return new xe(this.color.getHex(),this.near,this.far)},xe.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},_e.prototype=Object.assign(Object.create(gt.prototype),{constructor:_e,copy:function(t,e){return gt.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=gt.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),we.prototype=Object.assign(Object.create(gt.prototype),{constructor:we,isLensFlare:!0,copy:function(t){var e=this;gt.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var r=0,i=t.lensFlares.length;r<i;r++)e.lensFlares.push(t.lensFlares[r]);return this},add:function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new tt(16777215)),void 0===i&&(i=hh),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},updateLensFlares:function(){var t,e,r=this,i=this.lensFlares.length,n=2*-this.positionScreen.x,o=2*-this.positionScreen.y;for(t=0;t<i;t++)(e=r.lensFlares[t]).x=r.positionScreen.x+n*e.distance,e.y=r.positionScreen.y+o*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),Se.prototype=Object.create(nt.prototype),Se.prototype.constructor=Se,Se.prototype.isSpriteMaterial=!0,Se.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},Ae.prototype=Object.assign(Object.create(gt.prototype),{constructor:Ae,isSprite:!0,raycast:function(){var t=new g,e=new g,r=new g;return function(i,n){e.setFromMatrixPosition(this.matrixWorld),i.ray.closestPointToPoint(e,t),r.setFromMatrixScale(this.matrixWorld);var o=r.x*r.y/4;if(!(e.distanceToSquared(t)>o)){var a=i.ray.origin.distanceTo(t);a<i.near||a>i.far||n.push({distance:a,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),Me.prototype=Object.assign(Object.create(gt.prototype),{constructor:Me,copy:function(t){var e=this;gt.prototype.copy.call(this,t,!1);for(var r=t.levels,i=0,n=r.length;i<n;i++){var o=r[i];e.addLevel(o.object.clone(),o.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},raycast:function(){var t=new g;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,r)}}(),update:function(){var t=new g,e=new g;return function(r){var i=this.levels;if(i.length>1){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var n=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o<a&&n>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;o<a;o++)i[o].object.visible=!1}}}(),toJSON:function(t){var e=gt.prototype.toJSON.call(this,t);e.object.levels=[];for(var r=this.levels,i=0,n=r.length;i<n;i++){var o=r[i];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),Object.assign(Te.prototype,{calculateInverses:function(){var t=this;this.boneInverses=[];for(var e=0,r=this.bones.length;e<r;e++){var i=new v;t.bones[e]&&i.getInverse(t.bones[e].matrixWorld),t.boneInverses.push(i)}},pose:function(){var t,e,r,i=this;for(e=0,r=this.bones.length;e<r;e++)(t=i.bones[e])&&t.matrixWorld.getInverse(i.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=i.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new v,e=new v;return function(){for(var r=this.bones,i=this.boneInverses,n=this.boneMatrices,o=this.boneTexture,a=0,s=r.length;a<s;a++){var c=r[a]?r[a].matrixWorld:e;t.multiplyMatrices(c,i[a]),t.toArray(n,16*a)}void 0!==o&&(o.needsUpdate=!0)}}(),clone:function(){return new Te(this.bones,this.boneInverses)}}),Ee.prototype=Object.assign(Object.create(gt.prototype),{constructor:Ee,isBone:!0}),Pe.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Pe,isSkinnedMesh:!0,initBones:function(){var t,e,r,i,n=this,o=[];if(this.geometry&&void 0!==this.geometry.bones){for(r=0,i=this.geometry.bones.length;r<i;r++)e=n.geometry.bones[r],t=new Ee,o.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(r=0,i=this.geometry.bones.length;r<i;r++)-1!==(e=n.geometry.bones[r]).parent&&null!==e.parent&&void 0!==o[e.parent]?o[e.parent].add(o[r]):n.add(o[r])}return this.updateMatrixWorld(!0),o},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e,r=this;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var i=r.geometry.skinWeights[e];(t=1/i.lengthManhattan())!==1/0?i.multiplyScalar(t):i.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var n=new d,o=this.geometry.attributes.skinWeight;for(e=0;e<o.count;e++)n.x=o.getX(e),n.y=o.getY(e),n.z=o.getZ(e),n.w=o.getW(e),(t=1/n.lengthManhattan())!==1/0?n.multiplyScalar(t):n.set(1,0,0,0),o.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){Bt.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ce.prototype=Object.create(nt.prototype),Ce.prototype.constructor=Ce,Ce.prototype.isLineBasicMaterial=!0,Ce.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Ie.prototype=Object.assign(Object.create(gt.prototype),{constructor:Ie,isLine:!0,raycast:function(){var t=new v,e=new Nt,r=new ct;return function(i,n){var o=this,a=i.linePrecision,s=a*a,c=this.geometry,u=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(u),!1!==i.ray.intersectsSphere(r)){t.getInverse(u),e.copy(i.ray).applyMatrix4(t);var h=new g,l=new g,p=new g,d=new g,f=this&&this.isLineSegments?2:1;if(c.isBufferGeometry){var m=c.index,v=c.attributes.position.array;if(null!==m)for(var y=m.array,b=0,x=y.length-1;b<x;b+=f){var _=y[b],w=y[b+1];h.fromArray(v,3*_),l.fromArray(v,3*w),(M=e.distanceSqToSegment(h,l,d,p))>s||(d.applyMatrix4(o.matrixWorld),(T=i.ray.origin.distanceTo(d))<i.near||T>i.far||n.push({distance:T,point:p.clone().applyMatrix4(o.matrixWorld),index:b,face:null,faceIndex:null,object:o}))}else for(var b=0,x=v.length/3-1;b<x;b+=f)h.fromArray(v,3*b),l.fromArray(v,3*b+3),(M=e.distanceSqToSegment(h,l,d,p))>s||(d.applyMatrix4(o.matrixWorld),(T=i.ray.origin.distanceTo(d))<i.near||T>i.far||n.push({distance:T,point:p.clone().applyMatrix4(o.matrixWorld),index:b,face:null,faceIndex:null,object:o}))}else if(c.isGeometry)for(var S=c.vertices,A=S.length,b=0;b<A-1;b+=f){var M=e.distanceSqToSegment(S[b],S[b+1],d,p);if(!(M>s)){d.applyMatrix4(o.matrixWorld);var T=i.ray.origin.distanceTo(d);T<i.near||T>i.far||n.push({distance:T,point:p.clone().applyMatrix4(o.matrixWorld),index:b,face:null,faceIndex:null,object:o})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Re.prototype=Object.assign(Object.create(Ie.prototype),{constructor:Re,isLineSegments:!0}),Le.prototype=Object.assign(Object.create(Ie.prototype),{constructor:Le,isLineLoop:!0}),Oe.prototype=Object.create(nt.prototype),Oe.prototype.constructor=Oe,Oe.prototype.isPointsMaterial=!0,Oe.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},De.prototype=Object.assign(Object.create(gt.prototype),{constructor:De,isPoints:!0,raycast:function(){var t=new v,e=new Nt,r=new ct;return function(i,n){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(c);var u=i.ray.origin.distanceTo(s);if(u<i.near||u>i.far)return;n.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,u=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(c),r.radius+=u,!1!==i.ray.intersectsSphere(r)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,p=new g;if(s.isBufferGeometry){var d=s.index,f=s.attributes.position.array;if(null!==d)for(var m=d.array,v=0,y=m.length;v<y;v++){var b=m[v];p.fromArray(f,3*b),o(p,b)}else for(var v=0,x=f.length/3;v<x;v++)p.fromArray(f,3*v),o(p,v)}else for(var _=s.vertices,v=0,x=_.length;v<x;v++)o(_[v],v)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ne.prototype=Object.assign(Object.create(gt.prototype),{constructor:Ne}),ke.prototype=Object.create(p.prototype),ke.prototype.constructor=ke,ke.prototype.isCompressedTexture=!0,Fe.prototype=Object.create(p.prototype),Fe.prototype.constructor=Fe,Be.prototype=Object.create(Ct.prototype),Be.prototype.constructor=Be,ze.prototype=Object.create(wt.prototype),ze.prototype.constructor=ze,Ue.prototype=Object.create(Ct.prototype),Ue.prototype.constructor=Ue,je.prototype=Object.create(wt.prototype),je.prototype.constructor=je,Ge.prototype=Object.create(Ct.prototype),Ge.prototype.constructor=Ge,Ve.prototype=Object.create(wt.prototype),Ve.prototype.constructor=Ve,$e.prototype=Object.create(Ge.prototype),$e.prototype.constructor=$e,He.prototype=Object.create(wt.prototype),He.prototype.constructor=He,We.prototype=Object.create(Ge.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(wt.prototype),Xe.prototype.constructor=Xe,qe.prototype=Object.create(Ge.prototype),qe.prototype.constructor=qe,Ye.prototype=Object.create(wt.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(Ge.prototype),Ze.prototype.constructor=Ze,Ke.prototype=Object.create(wt.prototype),Ke.prototype.constructor=Ke,Qe.prototype=Object.create(Ct.prototype),Qe.prototype.constructor=Qe,Je.prototype=Object.create(wt.prototype),Je.prototype.constructor=Je,tr.prototype=Object.create(Ct.prototype),tr.prototype.constructor=tr,er.prototype=Object.create(wt.prototype),er.prototype.constructor=er,rr.prototype=Object.create(Ct.prototype),rr.prototype.constructor=rr;var mp={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(){function t(t,e,r,i,n,o){var a,s,c,u,h,l,p,d,f;if(s=t[o[e]].x,c=t[o[e]].y,u=t[o[r]].x,h=t[o[r]].y,l=t[o[i]].x,p=t[o[i]].y,(u-s)*(p-c)-(h-c)*(l-s)<=0)return!1;var m,g,v,y,b,x,_,w,S,A,M,T,E,P,C;for(m=l-u,g=p-h,v=s-l,y=c-p,b=u-s,x=h-c,a=0;a<n;a++)if(d=t[o[a]].x,f=t[o[a]].y,!(d===s&&f===c||d===u&&f===h||d===l&&f===p)&&(_=d-s,w=f-c,S=d-u,A=f-h,M=d-l,T=f-p,C=m*A-g*S,E=b*w-x*_,P=v*T-y*M,C>=-Number.EPSILON&&P>=-Number.EPSILON&&E>=-Number.EPSILON))return!1;return!0}return function(e,r){var i=e.length;if(i<3)return null;var n,o,a,s=[],c=[],u=[];if(mp.area(e)>0)for(o=0;o<i;o++)c[o]=o;else for(o=0;o<i;o++)c[o]=i-1-o;var h=i,l=2*h;for(o=h-1;h>2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),r?u:s;if(n=o,h<=n&&(n=0),o=n+1,h<=o&&(o=0),a=o+1,h<=a&&(a=0),t(e,n,o,a,h,c)){var p,d,f,m,g;for(p=c[n],d=c[o],f=c[a],s.push([e[p],e[d],e[f]]),u.push([c[n],c[o],c[a]]),m=o,g=o+1;g<h;m++,g++)c[m]=c[g];l=2*--h}}return r?u:s}}(),triangulateShape:function(t,e){function r(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function i(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function n(t,e,r,n,o){var a=e.x-t.x,s=e.y-t.y,c=n.x-r.x,u=n.y-r.y,h=t.x-r.x,l=t.y-r.y,p=s*c-a*u,d=s*h-a*l;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if((f=u*h-c*l)<0||f>p)return[]}else{if(d>0||d<p)return[];if((f=u*h-c*l)>0||f<p)return[]}if(0===f)return!o||0!==d&&d!==p?[t]:[];if(f===p)return!o||0!==d&&d!==p?[e]:[];if(0===d)return[r];if(d===p)return[n];var m=f/p;return[{x:t.x+m*a,y:t.y+m*s}]}if(0!==d||u*h!=c*l)return[];var g=0===a&&0===s,v=0===c&&0===u;if(g&&v)return t.x!==r.x||t.y!==r.y?[]:[t];if(g)return i(r,n,t)?[t]:[];if(v)return i(t,e,r)?[r]:[];var y,b,x,_,w,S,A,M;return 0!==a?(t.x<e.x?(y=t,x=t.x,b=e,_=e.x):(y=e,x=e.x,b=t,_=t.x),r.x<n.x?(w=r,A=r.x,S=n,M=n.x):(w=n,A=n.x,S=r,M=r.x)):(t.y<e.y?(y=t,x=t.y,b=e,_=e.y):(y=e,x=e.y,b=t,_=t.y),r.y<n.y?(w=r,A=r.y,S=n,M=n.y):(w=n,A=n.y,S=r,M=r.y)),x<=A?_<A?[]:_===A?o?[]:[w]:_<=M?[w,b]:[w,S]:x>M?[]:x===M?o?[]:[y]:_<=M?[y,b]:[y,S]}function o(t,e,r,i){var n=e.x-t.x,o=e.y-t.y,a=r.x-t.x,s=r.y-t.y,c=i.x-t.x,u=i.y-t.y,h=n*s-o*a,l=n*u-o*c;if(Math.abs(h)>Number.EPSILON){var p=c*s-u*a;return h>0?l>=0&&p>=0:l>=0||p>=0}return l>0}r(t),e.forEach(r);for(var a,s,c,u,h,l,p={},d=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(d,e[f]);for(a=0,s=d.length;a<s;a++)void 0!==p[h=d[a].x+":"+d[a].y]&&console.warn("THREE.ShapeUtils: Duplicate point",h,a),p[h]=a;var g=function(t,e){for(var r,i,a,s,c,u,h,l,p,d,f,m=t.concat(),g=[],v=[],y=0,b=e.length;y<b;y++)g.push(y);for(var x=0,_=2*g.length;g.length>0;){if(--_<0){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(a=x;a<m.length;a++){s=m[a],i=-1;for(y=0;y<g.length;y++)if(u=g[y],h=s.x+":"+s.y+":"+u,void 0===v[h]){r=e[u];for(var w=0;w<r.length;w++)if(c=r[w],function(t,e){var i=m.length-1,n=t-1;n<0&&(n=i);var a=t+1;a>i&&(a=0);var s=o(m[t],m[n],m[a],r[e]);if(!s)return!1;var c=r.length-1,u=e-1;u<0&&(u=c);var h=e+1;return h>c&&(h=0),!!(s=o(r[e],r[u],r[h],m[t]))}(a,w)&&!function(t,e){var r,i;for(r=0;r<m.length;r++)if(i=r+1,i%=m.length,n(t,e,m[r],m[i],!0).length>0)return!0;return!1}(s,c)&&!function(t,r){var i,o,a,s;for(i=0;i<g.length;i++)for(o=e[g[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,n(t,r,o[a],o[s],!0).length>0)return!0;return!1}(s,c)){i=w,g.splice(y,1),l=m.slice(0,a+1),p=m.slice(a),d=r.slice(i),f=r.slice(0,i+1),m=l.concat(d).concat(f).concat(p),x=a;break}if(i>=0)break;v[h]=!0}if(i>=0)break}}return m}(t,e),v=mp.triangulate(g,!1);for(a=0,s=v.length;a<s;a++)for(u=v[a],c=0;c<3;c++)void 0!==(l=p[h=u[c].x+":"+u[c].y])&&(u[c]=l);return v.concat()},isClockWise:function(t){return mp.area(t)<0}};ir.prototype=Object.create(wt.prototype),ir.prototype.constructor=ir,nr.prototype=Object.create(Ct.prototype),nr.prototype.constructor=nr,nr.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],r=this.getAttribute("uv"),i=r?Array.prototype.slice.call(r.array):[],n=this.index;return{position:e,uv:i,index:n?Array.prototype.slice.call(n.array):[]}},nr.prototype.addShapeList=function(t,e){var r=this,i=t.length;e.arrays=this.getArrays();for(var n=0;n<i;n++){var o=t[n];r.addShape(o,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new Tt(e.arrays.position,3)),this.addAttribute("uv",new Tt(e.arrays.uv,2))},nr.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i,n,o,a=t.x-e.x,s=t.y-e.y,c=r.x-t.x,u=r.y-t.y,h=a*a+s*s,p=a*u-s*c;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(c*c+u*u),m=e.x-s/d,g=e.y+a/d,v=((r.x-u/f-m)*u-(r.y+c/f-g)*c)/(a*u-s*c),y=(i=m+a*v-t.x)*i+(n=g+s*v-t.y)*n;if(y<=2)return new l(i,n);o=Math.sqrt(y/2)}else{var b=!1;a>Number.EPSILON?c>Number.EPSILON&&(b=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(b=!0):Math.sign(s)===Math.sign(u)&&(b=!0),b?(i=-s,n=a,o=Math.sqrt(h)):(i=a,n=s,o=Math.sqrt(h/2))}return new l(i/o,n/o)}function n(t,e){var r,i;for(Z=t.length;--Z>=0;){r=Z,(i=Z-1)<0&&(i=t.length-1);var n=0,o=P+2*M;for(n=0;n<o;n++){var a=X*n,c=X*(n+1);s(e+r+a,e+i+a,e+i+c,e+r+c,t,n,o,r,i)}}}function o(t,e,r){_.push(t),_.push(e),_.push(r)}function a(t,e,r){c(t),c(e),c(r);var i=y.length/3,n=R.generateTopUV(N,y,i-3,i-2,i-1);u(n[0]),u(n[1]),u(n[2])}function s(t,e,r,i,n,o,a,s,h){c(t),c(e),c(i),c(e),c(r),c(i);var l=y.length/3,p=R.generateSideWallUV(N,y,l-6,l-3,l-2,l-1);u(p[0]),u(p[1]),u(p[3]),u(p[1]),u(p[2]),u(p[3])}function c(t){b.push(y.length/3),y.push(_[3*t+0]),y.push(_[3*t+1]),y.push(_[3*t+2])}function u(t){x.push(t.x),x.push(t.y)}var h,p,d,f,m,v=e.arrays?e.arrays:this.getArrays(),y=v.position,b=v.index,x=v.uv,_=[],w=void 0!==e.amount?e.amount:100,S=void 0!==e.bevelThickness?e.bevelThickness:6,A=void 0!==e.bevelSize?e.bevelSize:S-2,M=void 0!==e.bevelSegments?e.bevelSegments:3,T=void 0===e.bevelEnabled||e.bevelEnabled,E=void 0!==e.curveSegments?e.curveSegments:12,P=void 0!==e.steps?e.steps:1,C=e.extrudePath,I=!1,R=void 0!==e.UVGenerator?e.UVGenerator:ir.WorldUVGenerator;C&&(h=C.getSpacedPoints(P),I=!0,T=!1,p=void 0!==e.frames?e.frames:C.computeFrenetFrames(P,!1),d=new g,f=new g,m=new g),T||(M=0,S=0,A=0);var L,O,D,N=this,k=t.extractPoints(E),F=k.shape,B=k.holes;if(!mp.isClockWise(F))for(F=F.reverse(),O=0,D=B.length;O<D;O++)L=B[O],mp.isClockWise(L)&&(B[O]=L.reverse());var z=mp.triangulateShape(F,B),U=F;for(O=0,D=B.length;O<D;O++)L=B[O],F=F.concat(L);for(var j,G,V,$,H,W,X=F.length,q=z.length,Y=[],Z=0,K=U.length,Q=K-1,J=Z+1;Z<K;Z++,Q++,J++)Q===K&&(Q=0),J===K&&(J=0),Y[Z]=i(U[Z],U[Q],U[J]);var tt,et=[],rt=Y.concat();for(O=0,D=B.length;O<D;O++){for(L=B[O],tt=[],Z=0,Q=(K=L.length)-1,J=Z+1;Z<K;Z++,Q++,J++)Q===K&&(Q=0),J===K&&(J=0),tt[Z]=i(L[Z],L[Q],L[J]);et.push(tt),rt=rt.concat(tt)}for(j=0;j<M;j++){for(V=j/M,$=S*Math.cos(V*Math.PI/2),G=A*Math.sin(V*Math.PI/2),Z=0,K=U.length;Z<K;Z++)o((H=r(U[Z],Y[Z],G)).x,H.y,-$);for(O=0,D=B.length;O<D;O++)for(L=B[O],tt=et[O],Z=0,K=L.length;Z<K;Z++)o((H=r(L[Z],tt[Z],G)).x,H.y,-$)}for(G=A,Z=0;Z<X;Z++)H=T?r(F[Z],rt[Z],G):F[Z],I?(f.copy(p.normals[0]).multiplyScalar(H.x),d.copy(p.binormals[0]).multiplyScalar(H.y),m.copy(h[0]).add(f).add(d),o(m.x,m.y,m.z)):o(H.x,H.y,0);var it;for(it=1;it<=P;it++)for(Z=0;Z<X;Z++)H=T?r(F[Z],rt[Z],G):F[Z],I?(f.copy(p.normals[it]).multiplyScalar(H.x),d.copy(p.binormals[it]).multiplyScalar(H.y),m.copy(h[it]).add(f).add(d),o(m.x,m.y,m.z)):o(H.x,H.y,w/P*it);for(j=M-1;j>=0;j--){for(V=j/M,$=S*Math.cos(V*Math.PI/2),G=A*Math.sin(V*Math.PI/2),Z=0,K=U.length;Z<K;Z++)o((H=r(U[Z],Y[Z],G)).x,H.y,w+$);for(O=0,D=B.length;O<D;O++)for(L=B[O],tt=et[O],Z=0,K=L.length;Z<K;Z++)H=r(L[Z],tt[Z],G),I?o(H.x,H.y+h[P-1].y,h[P-1].x+$):o(H.x,H.y,w+$)}!function(){var t=y.length/3;if(T){var r=0,i=X*r;for(Z=0;Z<q;Z++)a((W=z[Z])[2]+i,W[1]+i,W[0]+i);for(i=X*(r=P+2*M),Z=0;Z<q;Z++)a((W=z[Z])[0]+i,W[1]+i,W[2]+i)}else{for(Z=0;Z<q;Z++)a((W=z[Z])[2],W[1],W[0]);for(Z=0;Z<q;Z++)a((W=z[Z])[0]+X*P,W[1]+X*P,W[2]+X*P)}N.addGroup(t,y.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=y.length/3,r=0;for(n(U,r),r+=U.length,O=0,D=B.length;O<D;O++)n(L=B[O],r),r+=L.length;N.addGroup(t,y.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(b),this.addAttribute("position",new Tt(y,3)),this.addAttribute("uv",new Tt(e.arrays.uv,2)))},ir.WorldUVGenerator={generateTopUV:function(t,e,r,i,n){var o=e[3*r],a=e[3*r+1],s=e[3*i],c=e[3*i+1],u=e[3*n],h=e[3*n+1];return[new l(o,a),new l(s,c),new l(u,h)]},generateSideWallUV:function(t,e,r,i,n,o){var a=e[3*r],s=e[3*r+1],c=e[3*r+2],u=e[3*i],h=e[3*i+1],p=e[3*i+2],d=e[3*n],f=e[3*n+1],m=e[3*n+2],g=e[3*o],v=e[3*o+1],y=e[3*o+2];return Math.abs(s-h)<.01?[new l(a,1-c),new l(u,1-p),new l(d,1-m),new l(g,1-y)]:[new l(s,1-c),new l(h,1-p),new l(f,1-m),new l(v,1-y)]}},or.prototype=Object.create(wt.prototype),or.prototype.constructor=or,ar.prototype=Object.create(nr.prototype),ar.prototype.constructor=ar,sr.prototype=Object.create(wt.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(Ct.prototype),cr.prototype.constructor=cr,ur.prototype=Object.create(wt.prototype),ur.prototype.constructor=ur,hr.prototype=Object.create(Ct.prototype),hr.prototype.constructor=hr,lr.prototype=Object.create(wt.prototype),lr.prototype.constructor=lr,pr.prototype=Object.create(Ct.prototype),pr.prototype.constructor=pr,dr.prototype=Object.create(wt.prototype),dr.prototype.constructor=dr,fr.prototype=Object.create(Ct.prototype),fr.prototype.constructor=fr,mr.prototype=Object.create(Ct.prototype),mr.prototype.constructor=mr,gr.prototype=Object.create(wt.prototype),gr.prototype.constructor=gr,vr.prototype=Object.create(Ct.prototype),vr.prototype.constructor=vr,yr.prototype=Object.create(gr.prototype),yr.prototype.constructor=yr,br.prototype=Object.create(vr.prototype),br.prototype.constructor=br,xr.prototype=Object.create(wt.prototype),xr.prototype.constructor=xr,_r.prototype=Object.create(Ct.prototype),_r.prototype.constructor=_r;var gp=Object.freeze({WireframeGeometry:Be,ParametricGeometry:ze,ParametricBufferGeometry:Ue,TetrahedronGeometry:Ve,TetrahedronBufferGeometry:$e,OctahedronGeometry:He,OctahedronBufferGeometry:We,IcosahedronGeometry:Xe,IcosahedronBufferGeometry:qe,DodecahedronGeometry:Ye,DodecahedronBufferGeometry:Ze,PolyhedronGeometry:je,PolyhedronBufferGeometry:Ge,TubeGeometry:Ke,TubeBufferGeometry:Qe,TorusKnotGeometry:Je,TorusKnotBufferGeometry:tr,TorusGeometry:er,TorusBufferGeometry:rr,TextGeometry:or,TextBufferGeometry:ar,SphereGeometry:sr,SphereBufferGeometry:cr,RingGeometry:ur,RingBufferGeometry:hr,PlaneGeometry:Lt,PlaneBufferGeometry:Ot,LatheGeometry:lr,LatheBufferGeometry:pr,ShapeGeometry:dr,ShapeBufferGeometry:fr,ExtrudeGeometry:ir,ExtrudeBufferGeometry:nr,EdgesGeometry:mr,ConeGeometry:yr,ConeBufferGeometry:br,CylinderGeometry:gr,CylinderBufferGeometry:vr,CircleGeometry:xr,CircleBufferGeometry:_r,BoxGeometry:It,BoxBufferGeometry:Rt});wr.prototype=Object.create(ot.prototype),wr.prototype.constructor=wr,wr.prototype.isShadowMaterial=!0,Sr.prototype=Object.create(ot.prototype),Sr.prototype.constructor=Sr,Sr.prototype.isRawShaderMaterial=!0,Ar.prototype=Object.create(nt.prototype),Ar.prototype.constructor=Ar,Ar.prototype.isMeshStandardMaterial=!0,Ar.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Mr.prototype=Object.create(Ar.prototype),Mr.prototype.constructor=Mr,Mr.prototype.isMeshPhysicalMaterial=!0,Mr.prototype.copy=function(t){return Ar.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Tr.prototype=Object.create(nt.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isMeshPhongMaterial=!0,Tr.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Er.prototype=Object.create(Tr.prototype),Er.prototype.constructor=Er,Er.prototype.isMeshToonMaterial=!0,Er.prototype.copy=function(t){return Tr.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Pr.prototype=Object.create(nt.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshNormalMaterial=!0,Pr.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Cr.prototype=Object.create(nt.prototype),Cr.prototype.constructor=Cr,Cr.prototype.isMeshLambertMaterial=!0,Cr.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ir.prototype=Object.create(nt.prototype),Ir.prototype.constructor=Ir,Ir.prototype.isLineDashedMaterial=!0,Ir.prototype.copy=function(t){return nt.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var vp=Object.freeze({ShadowMaterial:wr,SpriteMaterial:Se,RawShaderMaterial:Sr,ShaderMaterial:ot,PointsMaterial:Oe,MeshPhysicalMaterial:Mr,MeshStandardMaterial:Ar,MeshPhongMaterial:Tr,MeshToonMaterial:Er,MeshNormalMaterial:Pr,MeshLambertMaterial:Cr,MeshDepthMaterial:at,MeshBasicMaterial:Dt,LineDashedMaterial:Ir,LineBasicMaterial:Ce,Material:nt}),yp={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},bp=new Rr;Object.assign(Lr.prototype,{load:function(t,e,r,i){var n=this;void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var o=this,a=yp.get(t);if(void 0!==a)return o.manager.itemStart(t),setTimeout(function(){e&&e(a),o.manager.itemEnd(t)},0),a;var s=/^data:(.*?)(;base64)?,(.*)$/,c=t.match(s);if(c){var u=c[1],h=!!c[2],l=c[3];l=window.decodeURIComponent(l),h&&(l=window.atob(l));try{var p,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":p=new ArrayBuffer(l.length);for(var f=new Uint8Array(p),m=0;m<l.length;m++)f[m]=l.charCodeAt(m);"blob"===d&&(p=new Blob([p],{type:u}));break;case"document":var g=new DOMParser;p=g.parseFromString(l,u);break;case"json":p=JSON.parse(l);break;default:p=l}window.setTimeout(function(){e&&e(p),o.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){i&&i(e),o.manager.itemEnd(t),o.manager.itemError(t)},0)}}else{var v=new XMLHttpRequest;v.open("GET",t,!0),v.addEventListener("load",function(r){var n=r.target.response;yp.add(t,n),200===this.status?(e&&e(n),o.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(n),o.manager.itemEnd(t)):(i&&i(r),o.manager.itemEnd(t),o.manager.itemError(t))},!1),void 0!==r&&v.addEventListener("progress",function(t){r(t)},!1),v.addEventListener("error",function(e){i&&i(e),o.manager.itemEnd(t),o.manager.itemError(t)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(var y in n.requestHeader)v.setRequestHeader(y,n.requestHeader[y]);v.send(null)}return o.manager.itemStart(t),v},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Or.prototype,{load:function(t,e,r,i){var n=this,o=[],a=new ke;a.image=o;var s=new Lr(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,u=0,h=t.length;u<h;++u)!function(u){s.load(t[u],function(t){var r=n._parser(t,!0);o[u]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(c+=1)&&(1===r.mipmapCount&&(a.minFilter=al),a.format=r.format,a.needsUpdate=!0,e&&e(a))},r,i)}(u);else s.load(t,function(t){var r=n._parser(t,!0);if(r.isCubemap)for(var i=r.mipmaps.length/r.mipmapCount,s=0;s<i;s++){o[s]={mipmaps:[]};for(var c=0;c<r.mipmapCount;c++)o[s].mipmaps.push(r.mipmaps[s*r.mipmapCount+c]),o[s].format=r.format,o[s].width=r.width,o[s].height=r.height}else a.image.width=r.width,a.image.height=r.height,a.mipmaps=r.mipmaps;1===r.mipmapCount&&(a.minFilter=al),a.format=r.format,a.needsUpdate=!0,e&&e(a)},r,i);return a},setPath:function(t){return this.path=t,this}}),Object.assign(Dr.prototype,{load:function(t,e,r,i){var n=this,o=new y,a=new Lr(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){var r=n._parser(t);r&&(void 0!==r.image?o.image=r.image:void 0!==r.data&&(o.image.width=r.width,o.image.height=r.height,o.image.data=r.data),o.wrapS=void 0!==r.wrapS?r.wrapS:el,o.wrapT=void 0!==r.wrapT?r.wrapT:el,o.magFilter=void 0!==r.magFilter?r.magFilter:al,o.minFilter=void 0!==r.minFilter?r.minFilter:cl,o.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(o.format=r.format),void 0!==r.type&&(o.type=r.type),void 0!==r.mipmaps&&(o.mipmaps=r.mipmaps),1===r.mipmapCount&&(o.minFilter=al),o.needsUpdate=!0,e&&e(o,r))},r,i),o}}),Object.assign(Nr.prototype,{load:function(t,e,r,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var n=this,o=yp.get(t);if(void 0!==o)return n.manager.itemStart(t),setTimeout(function(){e&&e(o),n.manager.itemEnd(t)},0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");return a.addEventListener("load",function(){yp.add(t,this),e&&e(this),n.manager.itemEnd(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemEnd(t),n.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(kr.prototype,{load:function(t,e,r,i){var n=new b,o=new Nr(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var a=0,s=0;s<t.length;++s)!function(r){o.load(t[r],function(t){n.images[r]=t,6==++a&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}(s);return n},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Fr.prototype,{load:function(t,e,r,i){var n=new Nr(this.manager);n.setCrossOrigin(this.crossOrigin),n.setPath(this.path);var o=new p;return o.image=n.load(t,function(){var r=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);o.format=r?wl:Sl,o.needsUpdate=!0,void 0!==e&&e(o)},r,i),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Br.prototype=Object.assign(Object.create(gt.prototype),{constructor:Br,isLight:!0,copy:function(t){return gt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=gt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),zr.prototype=Object.assign(Object.create(Br.prototype),{constructor:zr,isHemisphereLight:!0,copy:function(t){return Br.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Ur.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),jr.prototype=Object.assign(Object.create(Ur.prototype),{constructor:jr,isSpotLightShadow:!0,update:function(t){var e=this.camera,r=2*Kl.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||e.far;r===e.fov&&i===e.aspect&&n===e.far||(e.fov=r,e.aspect=i,e.far=n,e.updateProjectionMatrix())}}),Gr.prototype=Object.assign(Object.create(Br.prototype),{constructor:Gr,isSpotLight:!0,copy:function(t){return Br.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Vr.prototype=Object.assign(Object.create(Br.prototype),{constructor:Vr,isPointLight:!0,copy:function(t){return Br.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),$r.prototype=Object.assign(Object.create(Ur.prototype),{constructor:$r}),Hr.prototype=Object.assign(Object.create(Br.prototype),{constructor:Hr,isDirectionalLight:!0,copy:function(t){return Br.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Wr.prototype=Object.assign(Object.create(Br.prototype),{constructor:Wr,isAmbientLight:!0}),Xr.prototype=Object.assign(Object.create(Br.prototype),{constructor:Xr,isRectAreaLight:!0,copy:function(t){return Br.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Br.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var xp={arraySlice:function(t,e,r){return xp.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==r?r:t.length)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,r){return t[e]-t[r]}for(var r=t.length,i=new Array(r),n=0;n!==r;++n)i[n]=n;return i.sort(e),i},sortedArray:function(t,e,r){for(var i=t.length,n=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*e,c=0;c!==e;++c)n[a++]=t[s+c];return n},flattenJSON:function(t,e,r,i){for(var n=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),r.push.apply(r,a)),o=t[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(r,r.length)),o=t[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),r.push(a)),o=t[n++]}while(void 0!==o)}}};Object.assign(qr.prototype,{evaluate:function(t){var e=this,r=this.parameterPositions,i=this._cachedIndex,n=r[i],o=r[i-1];t:{e:{var a;r:{i:if(!(t<n)){for(c=i+2;;){if(void 0===n){if(t<o)break i;return i=r.length,e._cachedIndex=i,e.afterEnd_(i-1,t,o)}if(i===c)break;if(o=n,n=r[++i],t<n)break e}a=r.length;break r}{if(t>=o)break t;var s=r[1];t<s&&(i=2,o=s);for(var c=i-2;;){if(void 0===o)return e._cachedIndex=0,e.beforeStart_(0,t,n);if(i===c)break;if(n=o,o=r[--i-1],t>=o)break e}a=i,i=0}}for(;i<a;){var u=i+a>>>1;t<r[u]?a=u:i=u+1}if(n=r[i],void 0===(o=r[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=r.length,this._cachedIndex=i,this.afterEnd_(i-1,o,t)}this._cachedIndex=i,this.intervalChanged_(i,o,n)}return this.interpolate_(i,o,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=t*i,o=0;o!==i;++o)e[o]=r[n+o];return e},interpolate_:function(t,e,r,i){throw new Error("call to abstract method")},intervalChanged_:function(t,e,r){}}),Object.assign(qr.prototype,{beforeStart_:qr.prototype.copySampleValue_,afterEnd_:qr.prototype.copySampleValue_}),Yr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Yr,DefaultSettings_:{endingStart:Bl,endingEnd:Bl},intervalChanged_:function(t,e,r){var i=this.parameterPositions,n=t-2,o=t+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:n=t,a=2*e-r;break;case 2402:a=e+i[n=i.length-2]-i[n+1];break;default:n=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*r-e;break;case 2402:o=1,s=r+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(r-e),u=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-r),this._offsetPrev=n*u,this._offsetNext=o*u},interpolate_:function(t,e,r,i){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=this._offsetPrev,h=this._offsetNext,l=this._weightPrev,p=this._weightNext,d=(r-e)/(i-e),f=d*d,m=f*d,g=-l*m+2*l*f-l*d,v=(1+l)*m+(-1.5-2*l)*f+(-.5+l)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,b=p*m-p*f,x=0;x!==a;++x)n[x]=g*o[u+x]+v*o[c+x]+y*o[s+x]+b*o[h+x];return n}}),Zr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Zr,interpolate_:function(t,e,r,i){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=(r-e)/(i-e),h=1-u,l=0;l!==a;++l)n[l]=o[c+l]*h+o[s+l]*u;return n}}),Kr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Kr,interpolate_:function(t,e,r,i){return this.copySampleValue_(t-1)}});var _p;_p={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Kr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Zr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Yr(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)this.createInterpolant=e;else{var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrackPrototype:",r)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<t;)++n;for(;-1!==o&&r[o]>e;)--o;if(++o,0!==n||o!==i){n>=o&&(n=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=xp.arraySlice(r,n,o),this.values=xp.arraySlice(this.values,n*a,o*a)}return this},validate:function(){var t=this,e=!0,r=this.getValueSize();r-Math.floor(r)!=0&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),e=!1);var i=this.times,n=this.values,o=i.length;0===o&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),e=!1);for(var a=null,s=0;s!==o;s++){var c=i[s];if("number"==typeof c&&isNaN(c)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",t,s,c),e=!1;break}if(null!==a&&a>c){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",t,s,c,a),e=!1;break}a=c}if(void 0!==n&&xp.isTypedArray(n))for(var s=0,u=n.length;s!==u;++s){var h=n[s];if(isNaN(h)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",t,s,h),e=!1;break}}return e},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),i=2302===this.getInterpolation(),n=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else for(var u=a*r,h=u-r,l=u+r,p=0;p!==r;++p){var d=e[u+p];if(d!==e[h+p]||d!==e[l+p]){s=!0;break}}if(s){if(a!==n){t[n]=t[a];for(var f=a*r,m=n*r,p=0;p!==r;++p)e[m+p]=e[f+p]}++n}}if(o>0){t[n]=t[o];for(var f=o*r,m=n*r,p=0;p!==r;++p)e[m+p]=e[f+p];++n}return n!==t.length&&(this.times=xp.arraySlice(t,0,n),this.values=xp.arraySlice(e,0,n*r)),this}},Jr.prototype=Object.assign(Object.create(_p),{constructor:Jr,ValueTypeName:"vector"}),ti.prototype=Object.assign(Object.create(qr.prototype),{constructor:ti,interpolate_:function(t,e,r,i){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(r-e)/(i-e),u=s+a;s!==u;s+=4)m.slerpFlat(n,0,o,s-a,o,s,c);return n}}),ei.prototype=Object.assign(Object.create(_p),{constructor:ei,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new ti(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),ri.prototype=Object.assign(Object.create(_p),{constructor:ri,ValueTypeName:"number"}),ii.prototype=Object.assign(Object.create(_p),{constructor:ii,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ni.prototype=Object.assign(Object.create(_p),{constructor:ni,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),oi.prototype=Object.assign(Object.create(_p),{constructor:oi,ValueTypeName:"color"}),ai.prototype=_p,_p.constructor=ai,Object.assign(ai,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=ai._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var r=[],i=[];xp.flattenJSON(t.keys,r,i,"value"),t.times=r,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,r=t.constructor;if(void 0!==r.toJSON)e=r.toJSON(t);else{e={name:t.name,times:xp.convertArray(t.times,Array),values:xp.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ri;case"vector":case"vector2":case"vector3":case"vector4":return Jr;case"color":return oi;case"quaternion":return ei;case"bool":case"boolean":return ni;case"string":return ii}throw new Error("Unsupported typeName: "+t)}}),Object.assign(si,{parse:function(t){for(var e=[],r=t.tracks,i=1/(t.fps||1),n=0,o=r.length;n!==o;++n)e.push(ai.parse(r[n]).scale(i));return new si(t.name,t.duration,e)},toJSON:function(t){for(var e=[],r=t.tracks,i={name:t.name,duration:t.duration,tracks:e},n=0,o=r.length;n!==o;++n)e.push(ai.toJSON(r[n]));return i},CreateFromMorphTargetSequence:function(t,e,r,i){for(var n=e.length,o=[],a=0;a<n;a++){var s=[],c=[];s.push((a+n-1)%n,a,(a+1)%n),c.push(0,1,0);var u=xp.getKeyframeOrder(s);s=xp.sortedArray(s,1,u),c=xp.sortedArray(c,1,u),i||0!==s[0]||(s.push(n),c.push(c[0])),o.push(new ri(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/r))}return new si(t,-1,o)},findByName:function(t,e){var r=t;if(!Array.isArray(t)){var i=t;r=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<r.length;n++)if(r[n].name===e)return r[n];return null},CreateClipsFromMorphTargetSequences:function(t,e,r){for(var i={},n=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(n);if(c&&c.length>1){var u=i[l=c[1]];u||(i[l]=u=[]),u.push(s)}}var h=[];for(var l in i)h.push(si.CreateFromMorphTargetSequence(l,i[l],e,r));return h},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r=function(t,e,r,i,n){if(0!==r.length){var o=[],a=[];xp.flattenJSON(r,o,a,i),0!==o.length&&n.push(new t(e,o,a))}},i=[],n=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var u=s[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var h={},l=0;l<u.length;l++)if(u[l].morphTargets)for(m=0;m<u[l].morphTargets.length;m++)h[u[l].morphTargets[m]]=-1;for(var p in h){for(var d=[],f=[],m=0;m!==u[l].morphTargets.length;++m){var g=u[l];d.push(g.time),f.push(g.morphTarget===p?1:0)}i.push(new ri(".morphTargetInfluence["+p+"]",d,f))}o=h.length*(a||1)}else{var v=".bones["+e[c].name+"]";r(Jr,v+".position",u,"pos",i),r(ei,v+".quaternion",u,"rot",i),r(Jr,v+".scale",u,"scl",i)}}return 0===i.length?null:new si(n,o,i)}}),Object.assign(si.prototype,{resetDuration:function(){for(var t=this,e=0,r=0,i=this.tracks.length;r!==i;++r){var n=t.tracks[r];e=Math.max(e,n.times[n.times.length-1])}this.duration=e},trim:function(){for(var t=this,e=0;e<this.tracks.length;e++)t.tracks[e].trim(0,t.duration);return this},optimize:function(){for(var t=this,e=0;e<this.tracks.length;e++)t.tracks[e].optimize();return this}}),Object.assign(ci.prototype,{load:function(t,e,r,i){var n=this;new Lr(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===r[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),r[t]}var r=this.textures,i=new vp[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearCoat&&(i.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(i.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(i.uniforms=t.uniforms),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(i.vertexColors=t.vertexColors),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.shading&&(i.shading=t.shading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=e(t.map)),void 0!==t.alphaMap&&(i.alphaMap=e(t.alphaMap),i.transparent=!0),void 0!==t.bumpMap&&(i.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=e(t.normalMap)),void 0!==t.normalScale){var n=t.normalScale;!1===Array.isArray(n)&&(n=[n,n]),i.normalScale=(new l).fromArray(n)}return void 0!==t.displacementMap&&(i.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=e(t.specularMap)),void 0!==t.envMap&&(i.envMap=e(t.envMap)),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.lightMap&&(i.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=e(t.gradientMap)),i}}),Object.assign(ui.prototype,{load:function(t,e,r,i){var n=this;new Lr(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},parse:function(t){var e=new Ct,r=t.data.index;if(void 0!==r){a=new wp[r.type](r.array);e.setIndex(new St(a,1))}var i=t.data.attributes;for(var n in i){var o=i[n],a=new wp[o.type](o.array);e.addAttribute(n,new St(a,o.itemSize,o.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,u=s.length;c!==u;++c){var h=s[c];e.addGroup(h.start,h.count,h.materialIndex)}var l=t.data.boundingSphere;if(void 0!==l){var p=new g;void 0!==l.center&&p.fromArray(l.center),e.boundingSphere=new ct(p,l.radius)}return e}});var wp={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};hi.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r],o=e[r+1];if(n.test(t))return o}return null}},Object.assign(hi.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,r){for(var i=this,n=[],o=0;o<t.length;++o)n[o]=i.createMaterial(t[o],e,r);return n},createMaterial:function(){var t={NoBlending:uh,NormalBlending:hh,AdditiveBlending:lh,SubtractiveBlending:ph,MultiplyBlending:dh,CustomBlending:fh},e=new tt,r=new Fr,i=new ci;return function(n,o,a){function s(t,e,i,n,s){var u,h=o+t,l=hi.Handlers.get(h);null!==l?u=l.load(h):(r.setCrossOrigin(a),u=r.load(h)),void 0!==e&&(u.repeat.fromArray(e),1!==e[0]&&(u.wrapS=tl),1!==e[1]&&(u.wrapT=tl)),void 0!==i&&u.offset.fromArray(i),void 0!==n&&("repeat"===n[0]&&(u.wrapS=tl),"mirror"===n[0]&&(u.wrapS=rl),"repeat"===n[1]&&(u.wrapT=tl),"mirror"===n[1]&&(u.wrapT=rl)),void 0!==s&&(u.anisotropy=s);var p=Kl.generateUUID();return c[p]=u,p}var c={},u={uuid:Kl.generateUUID(),type:"MeshLambertMaterial"};for(var h in n){var l=n[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=l;break;case"blending":u.blending=t[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":u.color=e.fromArray(l).getHex();break;case"colorSpecular":u.specular=e.fromArray(l).getHex();break;case"colorEmissive":u.emissive=e.fromArray(l).getHex();break;case"specularCoef":u.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===l.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=s(l,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=s(l,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=s(l,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=s(l,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=s(l,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=s(l,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=s(l,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=s(l,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=s(l,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=s(l,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=rh;break;case"doubleSided":u.side=ih;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[h]=l;break;case"vertexColors":!0===l&&(u.vertexColors=ch),"face"===l&&(u.vertexColors=sh);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,l)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}}()}),Object.assign(li.prototype,{load:function(t,e,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:hi.prototype.extractUrlBase(t),a=new Lr(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var i=JSON.parse(r),a=i.metadata;if(void 0!==a){var s=a.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var c=n.parse(i,o);e(c.geometry,c.materials)},r,i)},setTexturePath:function(t){this.texturePath=t},parse:function(){function t(t,e){function r(t,e){return t&1<<e}var i,n,o,a,s,c,u,h,p,d,f,m,v,y,b,x,_,w,S,A,M,T,E,P,C,I=t.faces,R=t.vertices,L=t.normals,O=t.colors,D=t.scale,N=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&N++;for(i=0;i<N;i++)e.faceVertexUvs[i]=[]}for(a=0,s=R.length;a<s;)(w=new g).x=R[a++]*D,w.y=R[a++]*D,w.z=R[a++]*D,e.vertices.push(w);for(a=0,s=I.length;a<s;)if(d=I[a++],f=r(d,0),m=r(d,1),v=r(d,3),y=r(d,4),b=r(d,5),x=r(d,6),_=r(d,7),f){if(A=new xt,A.a=I[a],A.b=I[a+1],A.c=I[a+3],M=new xt,M.a=I[a+1],M.b=I[a+2],M.c=I[a+3],a+=4,m&&(p=I[a++],A.materialIndex=p,M.materialIndex=p),o=e.faces.length,v)for(i=0;i<N;i++)for(P=t.uvs[i],e.faceVertexUvs[i][o]=[],e.faceVertexUvs[i][o+1]=[],n=0;n<4;n++)C=new l(P[2*(h=I[a++])],P[2*h+1]),2!==n&&e.faceVertexUvs[i][o].push(C),0!==n&&e.faceVertexUvs[i][o+1].push(C);if(y&&(u=3*I[a++],A.normal.set(L[u++],L[u++],L[u]),M.normal.copy(A.normal)),b)for(i=0;i<4;i++)u=3*I[a++],E=new g(L[u++],L[u++],L[u]),2!==i&&A.vertexNormals.push(E),0!==i&&M.vertexNormals.push(E);if(x&&(T=O[c=I[a++]],A.color.setHex(T),M.color.setHex(T)),_)for(i=0;i<4;i++)T=O[c=I[a++]],2!==i&&A.vertexColors.push(new tt(T)),0!==i&&M.vertexColors.push(new tt(T));e.faces.push(A),e.faces.push(M)}else{if(S=new xt,S.a=I[a++],S.b=I[a++],S.c=I[a++],m&&(p=I[a++],S.materialIndex=p),o=e.faces.length,v)for(i=0;i<N;i++)for(P=t.uvs[i],e.faceVertexUvs[i][o]=[],n=0;n<3;n++)C=new l(P[2*(h=I[a++])],P[2*h+1]),e.faceVertexUvs[i][o].push(C);if(y&&(u=3*I[a++],S.normal.set(L[u++],L[u++],L[u])),b)for(i=0;i<3;i++)u=3*I[a++],E=new g(L[u++],L[u++],L[u]),S.vertexNormals.push(E);if(x&&(c=I[a++],S.color.setHex(O[c])),_)for(i=0;i<3;i++)c=I[a++],S.vertexColors.push(new tt(O[c]));e.faces.push(S)}}function e(t,e){var r=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=r){var o=t.skinWeights[i],a=r>1?t.skinWeights[i+1]:0,s=r>2?t.skinWeights[i+2]:0,c=r>3?t.skinWeights[i+3]:0;e.skinWeights.push(new d(o,a,s,c))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i<n;i+=r){var u=t.skinIndices[i],h=r>1?t.skinIndices[i+1]:0,l=r>2?t.skinIndices[i+2]:0,p=r>3?t.skinIndices[i+3]:0;e.skinIndices.push(new d(u,h,l,p))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function r(t,e){var r=t.scale;if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){e.morphTargets[i]={},e.morphTargets[i].name=t.morphTargets[i].name,e.morphTargets[i].vertices=[];for(var o=e.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,c=a.length;s<c;s+=3){var u=new g;u.x=a[s]*r,u.y=a[s+1]*r,u.z=a[s+2]*r,o.push(u)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=e.faces,l=t.morphColors[0].colors,i=0,n=h.length;i<n;i++)h[i].color.fromArray(l,3*i)}}function i(t,e){var r=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var o=si.parseAnimation(i[n],e.bones);o&&r.push(o)}if(e.morphTargets){var a=si.CreateClipsFromMorphTargetSequences(e.morphTargets,10);r=r.concat(a)}r.length>0&&(e.animations=r)}return function(n,o){void 0!==n.data&&(n=n.data),void 0!==n.scale?n.scale=1/n.scale:n.scale=1;var a=new wt;return t(n,a),e(n,a),r(n,a),i(n,a),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===n.materials||0===n.materials.length?{geometry:a}:{geometry:a,materials:hi.prototype.initMaterials(n.materials,o,this.crossOrigin)}}}()}),Object.assign(pi.prototype,{load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new Lr(n.manager).load(t,function(r){var o=null;try{o=JSON.parse(r)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?n.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(a)}),n=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,n),a=this.parseObject(t.object,r,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e=this,r={};if(void 0!==t)for(var i=new li,n=new ui,o=0,a=t.length;o<a;o++){var s,c=t[o];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new gp[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new gp[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new gp[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new gp[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new gp[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new gp[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":s=new gp[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new gp[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new gp[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new gp[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new gp[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"BufferGeometry":s=n.parse(c);break;case"Geometry":s=i.parse(c,e.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),r[c.uuid]=s}return r},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new ci;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=t[n];if("MultiMaterial"===a.type){for(var s=[],c=0;c<a.materials.length;c++)s.push(i.parse(a.materials[c]));r[a.uuid]=s}else r[a.uuid]=i.parse(a)}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=si.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&t.length>0){var n=new Nr(new Rr(e));n.setCrossOrigin(this.crossOrigin);for(var o=0,a=t.length;o<a;o++){var s=t[o],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),n.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemEnd(t),r.manager.itemError(t)})}(c)}}return i},parseTextures:function(t,e){function r(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new p(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping,Sp)),void 0!==a.offset&&s.offset.fromArray(a.offset),void 0!==a.repeat&&s.repeat.fromArray(a.repeat),void 0!==a.wrap&&(s.wrapS=r(a.wrap[0],Ap),s.wrapT=r(a.wrap[1],Ap)),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter,Mp)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter,Mp)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),void 0!==a.flipY&&(s.flipY=a.flipY),i[a.uuid]=s}return i},parseObject:function(){var t=new v;return function(e,r,i){function n(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,n=t.length;r<n;r++){var o=t[r];void 0===i[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(i[o])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}var a,s=this;switch(e.type){case"Scene":a=new _e,void 0!==e.background&&Number.isInteger(e.background)&&(a.background=new tt(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new xe(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new be(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new bt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new yt(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new Wr(e.color,e.intensity);break;case"DirectionalLight":a=new Hr(e.color,e.intensity);break;case"PointLight":a=new Vr(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Xr(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Gr(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new zr(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var c=n(e.geometry),u=o(e.material);a=c.bones&&c.bones.length>0?new Pe(c,u):new Bt(c,u);break;case"LOD":a=new Me;break;case"Line":a=new Ie(n(e.geometry),o(e.material),e.mode);break;case"LineLoop":a=new Le(n(e.geometry),o(e.material));break;case"LineSegments":a=new Re(n(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new De(n(e.geometry),o(e.material));break;case"Sprite":a=new Ae(o(e.material));break;case"Group":a=new Ne;break;default:a=new gt}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(s.parseObject(e.children[h],r,i));if("LOD"===e.type)for(var l=e.levels,p=0;p<l.length;p++){var d=l[p];void 0!==(h=a.getObjectByProperty("uuid",d.object))&&a.addLevel(h,d.distance)}return a}}()});var Sp={UVMapping:300,CubeReflectionMapping:Xh,CubeRefractionMapping:qh,EquirectangularReflectionMapping:Yh,EquirectangularRefractionMapping:Zh,SphericalReflectionMapping:Kh,CubeUVReflectionMapping:Qh,CubeUVRefractionMapping:Jh},Ap={RepeatWrapping:tl,ClampToEdgeWrapping:el,MirroredRepeatWrapping:rl},Mp={NearestFilter:il,NearestMipMapNearestFilter:nl,NearestMipMapLinearFilter:ol,LinearFilter:al,LinearMipMapNearestFilter:sl,LinearMipMapLinearFilter:cl};Object.assign(Si.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){var e=this;void 0===t&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(e.getPoint(i/t));return r},getSpacedPoints:function(t){var e=this;void 0===t&&(t=5);for(var r=[],i=0;i<=t;i++)r.push(e.getPointAt(i/t));return r},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){var e=this;if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var r,i,n=[],o=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)a+=(r=e.getPoint(i/t)).distanceTo(o),n.push(a),o=r;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if(n=Math.floor(s+(c-s)/2),(a=i[n]-r)<0)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}if(n=c,i[n]===r)return n/(o-1);var u=i[n];return(n+(r-u)/(i[n+1]-u))/(o-1)},getTangent:function(t){var e=t-1e-4,r=t+1e-4;e<0&&(e=0),r>1&&(r=1);var i=this.getPoint(e);return this.getPoint(r).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var r,i,n,o=this,a=new g,s=[],c=[],u=[],h=new g,l=new v;for(r=0;r<=t;r++)i=r/t,s[r]=o.getTangentAt(i),s[r].normalize();c[0]=new g,u[0]=new g;var p=Number.MAX_VALUE,d=Math.abs(s[0].x),f=Math.abs(s[0].y),m=Math.abs(s[0].z);for(d<=p&&(p=d,a.set(1,0,0)),f<=p&&(p=f,a.set(0,1,0)),m<=p&&a.set(0,0,1),h.crossVectors(s[0],a).normalize(),c[0].crossVectors(s[0],h),u[0].crossVectors(s[0],c[0]),r=1;r<=t;r++)c[r]=c[r-1].clone(),u[r]=u[r-1].clone(),h.crossVectors(s[r-1],s[r]),h.length()>Number.EPSILON&&(h.normalize(),n=Math.acos(Kl.clamp(s[r-1].dot(s[r]),-1,1)),c[r].applyMatrix4(l.makeRotationAxis(h,n))),u[r].crossVectors(s[r],c[r]);if(!0===e)for(n=Math.acos(Kl.clamp(c[0].dot(c[t]),-1,1)),n/=t,s[0].dot(h.crossVectors(c[0],c[t]))>0&&(n=-n),r=1;r<=t;r++)c[r].applyMatrix4(l.makeRotationAxis(s[r],n*r)),u[r].crossVectors(s[r],c[r]);return{tangents:s,normals:c,binormals:u}}}),Ai.prototype=Object.create(Si.prototype),Ai.prototype.constructor=Ai,Ai.prototype.isLineCurve=!0,Ai.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},Ai.prototype.getPointAt=function(t){return this.getPoint(t)},Ai.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Mi.prototype=Object.assign(Object.create(Si.prototype),{constructor:Mi,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ai(e,t))},getPoint:function(t){for(var e=this,r=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=r){var o=i[n]-r,a=e.curves[n],s=a.getLength(),c=0===s?0:1-o/s;return a.getPointAt(c)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){var t=this;if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],r=0,i=0,n=this.curves.length;i<n;i++)r+=t.curves[i].getLength(),e.push(r);return this.cacheLengths=e,e},getSpacedPoints:function(t){var e=this;void 0===t&&(t=40);for(var r=[],i=0;i<=t;i++)r.push(e.getPoint(i/t));return this.autoClose&&r.push(r[0]),r},getPoints:function(t){t=t||12;for(var e,r=[],i=0,n=this.curves;i<n.length;i++)for(var o=n[i],a=o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var u=s[c];e&&e.equals(u)||(r.push(u),e=u)}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new wt,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new g(n.x,n.y,n.z||0))}return e}}),Ti.prototype=Object.create(Si.prototype),Ti.prototype.constructor=Ti,Ti.prototype.isEllipseCurve=!0,Ti.prototype.getPoint=function(t){for(var e=2*Math.PI,r=this.aEndAngle-this.aStartAngle,i=Math.abs(r)<Number.EPSILON;r<0;)r+=e;for(;r>e;)r-=e;r<Number.EPSILON&&(r=i?0:e),!0!==this.aClockwise||i||(r===e?r=-e:r-=e);var n=this.aStartAngle+t*r,o=this.aX+this.xRadius*Math.cos(n),a=this.aY+this.yRadius*Math.sin(n);if(0!==this.aRotation){var s=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=o-this.aX,h=a-this.aY;o=u*s-h*c+this.aX,a=u*c+h*s+this.aY}return new l(o,a)},Ei.prototype=Object.create(Si.prototype),Ei.prototype.constructor=Ei,Ei.prototype.isSplineCurve=!0,Ei.prototype.getPoint=function(t){var e=this.points,r=(e.length-1)*t,i=Math.floor(r),n=r-i,o=e[0===i?i:i-1],a=e[i],s=e[i>e.length-2?e.length-1:i+1],c=e[i>e.length-3?e.length-1:i+2];return new l(di(n,o.x,a.x,s.x,c.x),di(n,o.y,a.y,s.y,c.y))},Pi.prototype=Object.create(Si.prototype),Pi.prototype.constructor=Pi,Pi.prototype.getPoint=function(t){var e=this.v0,r=this.v1,i=this.v2,n=this.v3;return new l(wi(t,e.x,r.x,i.x,n.x),wi(t,e.y,r.y,i.y,n.y))},Ci.prototype=Object.create(Si.prototype),Ci.prototype.constructor=Ci,Ci.prototype.getPoint=function(t){var e=this.v0,r=this.v1,i=this.v2;return new l(vi(t,e.x,r.x,i.x),vi(t,e.y,r.y,i.y))};var Tp=Object.assign(Object.create(Mi.prototype),{fromPoints:function(t){var e=this;this.moveTo(t[0].x,t[0].y);for(var r=1,i=t.length;r<i;r++)e.lineTo(t[r].x,t[r].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var r=new Ai(this.currentPoint.clone(),new l(t,e));this.curves.push(r),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,r,i){var n=new Ci(this.currentPoint.clone(),new l(t,e),new l(r,i));this.curves.push(n),this.currentPoint.set(r,i)},bezierCurveTo:function(t,e,r,i,n,o){var a=new Pi(this.currentPoint.clone(),new l(t,e),new l(r,i),new l(n,o));this.curves.push(a),this.currentPoint.set(n,o)},splineThru:function(t){var e=new Ei([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,r,i,n,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,r,i,n,o)},absarc:function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},ellipse:function(t,e,r,i,n,o,a,s){var c=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(t+c,e+u,r,i,n,o,a,s)},absellipse:function(t,e,r,i,n,o,a,s){var c=new Ti(t,e,r,i,n,o,a,s);if(this.curves.length>0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});Ii.prototype=Tp,Tp.constructor=Ii,Ri.prototype=Object.assign(Object.create(Tp),{constructor:Ri,getPointsHoles:function(t){for(var e=this,r=[],i=0,n=this.holes.length;i<n;i++)r[i]=e.holes[i].getPoints(t);return r},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(Li.prototype,{moveTo:function(t,e){this.currentPath=new Ii,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,r,i){this.currentPath.quadraticCurveTo(t,e,r,i)},bezierCurveTo:function(t,e,r,i,n,o){this.currentPath.bezierCurveTo(t,e,r,i,n,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new Ri;o.curves=n.curves,e.push(o)}return e}var i=mp.isClockWise,n=this.subPaths;if(0===n.length)return[];if(!0===e)return r(n);var o,a,s,c=[];if(1===n.length)return a=n[0],s=new Ri,s.curves=a.curves,c.push(s),c;var u=!i(n[0].getPoints());u=t?!u:u;var h,l=[],p=[],d=[],f=0;p[f]=void 0,d[f]=[];for(var m=0,g=n.length;m<g;m++)o=i(h=(a=n[m]).getPoints()),(o=t?!o:o)?(!u&&p[f]&&f++,p[f]={s:new Ri,p:h},p[f].s.curves=a.curves,u&&f++,d[f]=[]):d[f].push({h:a,p:h[0]});if(!p[0])return r(n);if(p.length>1){for(var v=!1,y=[],b=0,x=p.length;b<x;b++)l[b]=[];for(var b=0,x=p.length;b<x;b++)for(var _=d[b],w=0;w<_.length;w++){for(var S=_[w],A=!0,M=0;M<p.length;M++)(function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],c=s.x-a.x,u=s.y-a.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[n],u=-u),t.y<a.y||t.y>s.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=u*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i})(S.p,p[M].p)&&(b!==M&&y.push({froms:b,tos:M,hole:w}),A?(A=!1,l[M].push(S)):v=!0);A&&l[b].push(S)}y.length>0&&(v||(d=l))}for(var T,m=0,E=p.length;m<E;m++){s=p[m].s,c.push(s);for(var P=0,C=(T=d[m]).length;P<C;P++)s.holes.push(T[P].h)}return c}}),Object.assign(Oi.prototype,{isFont:!0,generateShapes:function(t,e,r){function i(t,e,i,o){var a=n.glyphs[t]||n.glyphs["?"];if(a){var s,c,u,h,l,p,d,f,m,g,v,y=new Li,b=[];if(a.o)for(var x=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),_=0,w=x.length;_<w;)switch(x[_++]){case"m":s=x[_++]*e+i,c=x[_++]*e+o,y.moveTo(s,c);break;case"l":s=x[_++]*e+i,c=x[_++]*e+o,y.lineTo(s,c);break;case"q":if(u=x[_++]*e+i,h=x[_++]*e+o,d=x[_++]*e+i,f=x[_++]*e+o,y.quadraticCurveTo(d,f,u,h),v=b[b.length-1]){l=v.x,p=v.y;for(S=1;S<=r;S++)vi(A=S/r,l,d,u),vi(A,p,f,h)}break;case"b":if(u=x[_++]*e+i,h=x[_++]*e+o,d=x[_++]*e+i,f=x[_++]*e+o,m=x[_++]*e+i,g=x[_++]*e+o,y.bezierCurveTo(d,f,m,g,u,h),v=b[b.length-1]){l=v.x,p=v.y;for(var S=1;S<=r;S++){var A=S/r;wi(A,l,d,m,u),wi(A,p,f,g,h)}}}return{offsetX:a.ha*e,path:y}}}void 0===e&&(e=100),void 0===r&&(r=4);for(var n=this.data,o=function(t){for(var r=String(t).split(""),o=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*o,s=0,c=0,u=[],h=0;h<r.length;h++){var l=r[h];if("\n"===l)s=0,c-=a;else{var p=i(l,o,s,c);s+=p.offsetX,u.push(p.path)}}return u}(t),a=[],s=0,c=o.length;s<c;s++)Array.prototype.push.apply(a,o[s].toShapes());return a}}),Object.assign(Di.prototype,{load:function(t,e,r,i){var n=this;new Lr(this.manager).load(t,function(t){var r;try{r=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(t.substring(65,t.length-2))}var i=n.parse(r);e&&e(i)},r,i)},parse:function(t){return new Oi(t)}});var Ep,Pp={getContext:function(){return void 0===Ep&&(Ep=new(window.AudioContext||window.webkitAudioContext)),Ep},setContext:function(t){Ep=t}};Object.assign(Ni.prototype,{load:function(t,e,r,i){var n=new Lr(this.manager);n.setResponseType("arraybuffer"),n.load(t,function(t){Pp.getContext().decodeAudioData(t,function(t){e(t)})},r,i)}}),Object.assign(ki.prototype,{update:function(){var t,e,r,i,n,o,a,s,c=new v,u=new v;return function(h){if(t!==this||e!==h.focus||r!==h.fov||i!==h.aspect*this.aspect||n!==h.near||o!==h.far||a!==h.zoom||s!==this.eyeSep){t=this,e=h.focus,r=h.fov,i=h.aspect*this.aspect,n=h.near,o=h.far,a=h.zoom;var l,p,d=h.projectionMatrix.clone(),f=(s=this.eyeSep/2)*n/e,m=n*Math.tan(Kl.DEG2RAD*r*.5)/a;u.elements[12]=-s,c.elements[12]=s,l=-m*i+f,p=m*i+f,d.elements[0]=2*n/(p-l),d.elements[8]=(p+l)/(p-l),this.cameraL.projectionMatrix.copy(d),l=-m*i-f,p=m*i-f,d.elements[0]=2*n/(p-l),d.elements[8]=(p+l)/(p-l),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(u),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(c)}}()}),Fi.prototype=Object.assign(Object.create(gt.prototype),{constructor:Fi,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new g,e=new m,r=new g,i=new g;return function(n){gt.prototype.updateMatrixWorld.call(this,n);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(t,e,r),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(t.x,this.context.currentTime),o.positionY.setValueAtTime(t.y,this.context.currentTime),o.positionZ.setValueAtTime(t.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(a.x,this.context.currentTime),o.upY.setValueAtTime(a.y,this.context.currentTime),o.upZ.setValueAtTime(a.z,this.context.currentTime)):(o.setPosition(t.x,t.y,t.z),o.setOrientation(i.x,i.y,i.z,a.x,a.y,a.z))}}()}),Bi.prototype=Object.assign(Object.create(gt.prototype),{constructor:Bi,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){var t=this;if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,r=this.filters.length;e<r;e++)t.filters[e-1].connect(t.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){var t=this;if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,r=this.filters.length;e<r;e++)t.filters[e-1].disconnect(t.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),zi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:zi,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new g;return function(e){gt.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Ui.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),r=0;r<e.length;r++)t+=e[r];return t/e.length}}),Object.assign(ji.prototype,{accumulate:function(t,e){var r=this.buffer,i=this.valueSize,n=t*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)r[n+a]=r[a];o=e}else{var s=e/(o+=e);this._mixBufferRegion(r,n,0,s,i)}this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer,i=t*e+e,n=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,n<1){var a=3*e;this._mixBufferRegion(r,i,a,1-n,e)}for(var s=e,c=e+e;s!==c;++s)if(r[s]!==r[s+e]){o.setValue(r,i);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,r=this.valueSize,i=3*r;t.getValue(e,i);for(var n=r,o=i;n!==o;++n)e[n]=e[i+n%r];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,r,i,n){if(i>=.5)for(var o=0;o!==n;++o)t[e+o]=t[r+o]},_slerp:function(t,e,r,i){m.slerpFlat(t,e,t,e,t,r,i)},_lerp:function(t,e,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*i}}}),Object.assign(Gi.prototype,{getValue:function(t,e){this.bind();var r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Vi,{Composite:Gi,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Vi.Composite(t,e,r):new Vi(t,e,r)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var t=/((?:[\w-]+[\/:])*)/,e=/([\w-\.]+)?/,r=/(?:\.([\w-]+)(?:\[(.+)\])?)?/,i=/\.([\w-]+)(?:\[(.+)\])?/,n=new RegExp("^"+t.source+e.source+r.source+i.source+"$"),o=["material","materials","bones"];return function(t){var e=n.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var r={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var a=r.nodeName.substring(i+1);-1!==o.indexOf(a)&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=a)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return r}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var i=t.bones[r];if(i.name===e)return i}return null}(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var r=0;r<t.length;r++){var n=t[r];if(n.name===e||n.uuid===e)return n;var o=i(n.children);if(o)return o}return null},n=i(t.children);if(n)return n}return null}}),Object.assign(Vi.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)t[e++]=r[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(t=Vi.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(u=0;u<t.length;u++)if(t[u].name===o){o=u;break}break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var a=t[i];if(void 0!==a){var s=this.Versioning.None;void 0!==t.needsUpdate?(s=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var c=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(u=0;u<this.node.geometry.morphAttributes.position.length;u++)if(t.geometry.morphAttributes.position[u].name===n){n=u;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(var u=0;u<this.node.geometry.morphTargets.length;u++)if(t.geometry.morphTargets[u].name===n){n=u;break}}}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}else{var h=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Vi.prototype,{_getValue_unbound:Vi.prototype.getValue,_setValue_unbound:Vi.prototype.setValue}),Object.assign($i.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=arguments,r=this._objects,i=r.length,n=this.nCachedObjects_,o=this._indicesByUUID,a=this._paths,s=this._parsedPaths,c=this._bindings,u=c.length,h=0,l=arguments.length;h!==l;++h){var p=e[h],d=p.uuid,f=o[d],m=void 0;if(void 0===f){f=i++,o[d]=f,r.push(p);for(var g=0,v=u;g!==v;++g)c[g].push(new Vi(p,a[g],s[g]))}else if(f<n){m=r[f];var y=--n,b=r[y];o[b.uuid]=f,r[f]=b,o[d]=y,r[y]=p;for(var g=0,v=u;g!==v;++g){var x=c[g],_=x[y],w=x[f];x[f]=_,void 0===w&&(w=new Vi(p,a[g],s[g])),x[y]=w}}else r[f]!==m&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(t){for(var e=arguments,r=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var u=e[s],h=u.uuid,l=n[h];if(void 0!==l&&l>=i){var p=i++,d=r[p];n[d.uuid]=l,r[l]=d,n[h]=p,r[p]=u;for(var f=0,m=a;f!==m;++f){var g=o[f],v=g[p],y=g[l];g[l]=v,g[p]=y}}}this.nCachedObjects_=i},uncache:function(t){for(var e=arguments,r=this._objects,i=r.length,n=this.nCachedObjects_,o=this._indicesByUUID,a=this._bindings,s=a.length,c=0,u=arguments.length;c!==u;++c){var h=e[c].uuid,l=o[h];if(void 0!==l)if(delete o[h],l<n){var p=--n,d=r[p],f=r[b=--i];o[d.uuid]=l,r[l]=d,o[f.uuid]=p,r[p]=f,r.pop();for(var m=0,g=s;m!==g;++m){var v=(x=a[m])[p],y=x[b];x[l]=v,x[p]=y,x.pop()}}else{var b=--i;o[(f=r[b]).uuid]=l,r[l]=f,r.pop();for(var m=0,g=s;m!==g;++m){var x=a[m];x[l]=x[b],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,i=r[t],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,h=new Array(c);i=n.length,r[t]=i,o.push(t),a.push(e),n.push(h);for(var l=u,p=s.length;l!==p;++l){var d=s[l];h[l]=new Vi(d,t,e)}return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}}),Object.assign(Hi.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){var i=this._clip.duration,n=t._clip.duration,o=n/i,a=i/n;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=n,s[1]=n+r,c[0]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,i){if(this.enabled){var n=this._startTime;if(null!==n){var o=(t-n)*r;if(o<0||0===r)return;this._startTime=null,e=r*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(a),u[h].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var r=this._weightInterpolant;if(null!==r){var i=r.evaluate(t)[0];e*=i,t>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var r=this._timeScaleInterpolant;null!==r&&(e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var r=this._clip.duration,i=this.loop,n=this._loopCount;if(2200===i){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=r)e=r;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=2202===i;if(-1===n&&(t>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=r||e<0){var a=Math.floor(e/r);e-=r*a,n+=Math.abs(a);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&n))return this.time=e,r-e}return this.time=e,e},_setEndings:function(t,e,r){var i=this._interpolantSettings;r?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:Bl:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:Bl:2402)},_scheduleFading:function(t,e,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=e,a[1]=n+t,s[1]=r,this}}),Object.assign(Wi.prototype,h.prototype,{_bindAction:function(t,e){var r=this,i=t._localRoot||this._root,n=t._clip.tracks,o=n.length,a=t._propertyBindings,s=t._interpolants,c=i.uuid,u=this._bindingsByRootAndName,h=u[c];void 0===h&&(h={},u[c]=h);for(var l=0;l!==o;++l){var p=n[l],d=p.name,f=h[d];if(void 0!==f)a[l]=f;else{if(void 0!==(f=a[l])){null===f._cacheIndex&&(++f.referenceCount,r._addInactiveBinding(f,c,d));continue}var m=e&&e._propertyBindings[l].binding.parsedPath;++(f=new ji(Vi.create(i,d,m),p.ValueTypeName,p.getValueSize())).referenceCount,r._addInactiveBinding(f,c,d),a[l]=f}s[l].resultBuffer=f.buffer}},_activateAction:function(t){var e=this;if(!this._isActiveAction(t)){if(null===t._cacheIndex){var r=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,r)}for(var o=t._propertyBindings,a=0,s=o.length;a!==s;++a){var c=o[a];0==c.useCount++&&(e._lendBinding(c),c.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){var e=this;if(this._isActiveAction(t)){for(var r=t._propertyBindings,i=0,n=r.length;i!==n;++i){var o=r[i];0==--o.useCount&&(o.restoreOriginalState(),e._takeBackBinding(o))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,r){var i=this._actions,n=this._actionsByClip,o=n[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,n[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],i=t._cacheIndex;r._cacheIndex=i,e[i]=r,e.pop(),t._cacheIndex=null;var n=t._clip.uuid,o=this._actionsByClip,a=o[n],s=a.knownActions,c=s[s.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[n],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=this,r=t._propertyBindings,i=0,n=r.length;i!==n;++i){var o=r[i];0==--o.referenceCount&&e._removeInactiveBinding(o)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,i=this._nActiveActions++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,i=--this._nActiveActions,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_addInactiveBinding:function(t,e,r){var i=this._bindingsByRootAndName,n=i[e],o=this._bindings;void 0===n&&(n={},i[e]=n),n[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=t.binding,i=r.rootNode.uuid,n=r.path,o=this._bindingsByRootAndName,a=o[i],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[n];t:{for(var u in a)break t;delete o[i]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=this._nActiveBindings++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=--this._nActiveBindings,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&((r=new Zr(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];t.__cacheIndex=i,e[i]=t,n.__cacheIndex=r,e[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var r=e||this._root,i=r.uuid,n="string"==typeof t?si.findByName(r,t):t,o=null!==n?n.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[i];if(void 0!==c)return c;s=a.knownActions[0],null===n&&(n=s._clip)}if(null===n)return null;var u=new Hi(this,n,e);return this._bindAction(u,s),this._addInactiveAction(u,o,i),u},existingAction:function(t,e){var r=e||this._root,i=r.uuid,n="string"==typeof t?si.findByName(r,t):t,o=n?n.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[i]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,r=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(n=0;n!==e;++n)t[n].reset();for(var n=0;n!==i;++n)r[n].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,i=this.time+=t,n=Math.sign(t),o=this._accuIndex^=1,a=0;a!==r;++a)e[a]._update(i,t,n,o);for(var s=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)s[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this,r=this._actions,i=t.uuid,n=this._actionsByClip,o=n[i];if(void 0!==o){for(var a=o.knownActions,s=0,c=a.length;s!==c;++s){var u=a[s];e._deactivateAction(u);var h=u._cacheIndex,l=r[r.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,l._cacheIndex=h,r[h]=l,r.pop(),e._removeInactiveBindingsForAction(u)}delete n[i]}},uncacheRoot:function(t){var e=this,r=t.uuid,i=this._actionsByClip;for(var n in i){var o=i[n].actionByRoot[r];void 0!==o&&(e._deactivateAction(o),e._removeInactiveAction(o))}var a=this._bindingsByRootAndName[r];if(void 0!==a)for(var s in a){var c=a[s];c.restoreOriginalState(),e._removeInactiveBinding(c)}},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),Xi.prototype.clone=function(){return new Xi(void 0===this.value.clone?this.value:this.value.clone())},qi.prototype=Object.assign(Object.create(Ct.prototype),{constructor:qi,isInstancedBufferGeometry:!0,addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:r})},copy:function(t){var e=this,r=t.index;null!==r&&this.setIndex(r.clone());var i=t.attributes;for(var n in i){var o=i[n];e.addAttribute(n,o.clone())}for(var a=t.groups,s=0,c=a.length;s<c;s++){var u=a[s];e.addGroup(u.start,u.count,u.materialIndex)}return this}}),Object.defineProperties(Yi.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Yi.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}}),Object.defineProperty(Zi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Zi.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){var i=this;t*=this.stride,r*=e.stride;for(var n=0,o=this.stride;n<o;n++)i.array[t+n]=e.array[r+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Ki.prototype=Object.assign(Object.create(Zi.prototype),{constructor:Ki,isInstancedInterleavedBuffer:!0,copy:function(t){return Zi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Qi.prototype=Object.assign(Object.create(St.prototype),{constructor:Qi,isInstancedBufferAttribute:!0,copy:function(t){return St.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Ji.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var r=[];return en(t,this,r,e),r.sort(tn),r},intersectObjects:function(t,e){var r=this,i=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,o=t.length;n<o;n++)en(t[n],r,i,e);return i.sort(tn),i}}),Object.assign(rn.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(nn.prototype,{set:function(t,e,r){return this.radius=t,this.phi=e,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Kl.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(on.prototype,{set:function(t,e,r){return this.radius=t,this.theta=e,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),an.prototype=Object.create(Re.prototype),an.prototype.constructor=an,an.prototype.update=function(){var t=new g,e=new g,r=new ut;return function(){var i=this,n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var o=this.object.matrixWorld,a=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var c=s.vertices,u=s.faces,h=0,l=0,p=u.length;l<p;l++)for(var d=u[l],f=0,m=d.vertexNormals.length;f<m;f++){var g=c[d[n[f]]],v=d.vertexNormals[f];t.copy(g).applyMatrix4(o),e.copy(v).applyMatrix3(r).normalize().multiplyScalar(i.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1}else if(s&&s.isBufferGeometry)for(var y=s.attributes.position,b=s.attributes.normal,h=0,f=0,m=y.count;f<m;f++)t.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(o),e.set(b.getX(f),b.getY(f),b.getZ(f)),e.applyMatrix3(r).normalize().multiplyScalar(i.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1;a.needsUpdate=!0}}(),cn.prototype=Object.create(Re.prototype),cn.prototype.constructor=cn,cn.prototype.onBeforeRender=function(){var t=new g,e=new v,r=new v;return function(){var i=this.bones,n=this.geometry,o=n.getAttribute("position");r.getInverse(this.root.matrixWorld);for(var a=0,s=0;a<i.length;a++){var c=i[a];c.parent&&c.parent.isBone&&(e.multiplyMatrices(r,c.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(s,t.x,t.y,t.z),e.multiplyMatrices(r,c.parent.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(s+1,t.x,t.y,t.z),s+=2)}n.getAttribute("position").needsUpdate=!0}}(),un.prototype=Object.create(gt.prototype),un.prototype.constructor=un,un.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},un.prototype.update=function(){var t=new g,e=new tt,r=new tt;return function(){var i=this.children[0],n=i.geometry.getAttribute("color");e.copy(this.light.color),r.copy(this.light.groundColor);for(var o=0,a=n.count;o<a;o++){var s=o<a/2?e:r;n.setXYZ(o,s.r,s.g,s.b)}i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),n.needsUpdate=!0}}(),hn.prototype=Object.create(Re.prototype),hn.prototype.constructor=hn,hn.prototype.update=function(){var t=new g,e=new g,r=new ut;return function(){var i=this;this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry,s=a.vertices,c=a.faces,u=0,h=0,l=c.length;h<l;h++){var p=c[h],d=p.normal;t.copy(s[p.a]).add(s[p.b]).add(s[p.c]).divideScalar(3).applyMatrix4(n),e.copy(d).applyMatrix3(r).normalize().multiplyScalar(i.size).add(t),o.setXYZ(u,t.x,t.y,t.z),u+=1,o.setXYZ(u,e.x,e.y,e.z),u+=1}o.needsUpdate=!0}}(),ln.prototype=Object.create(Re.prototype),ln.prototype.constructor=ln,ln.prototype.update=function(){function t(t,o,a,s){i.set(o,a,s).unproject(n);var c=r[t];if(void 0!==c)for(var u=e.getAttribute("position"),h=0,l=c.length;h<l;h++)u.setXYZ(c[h],i.x,i.y,i.z)}var e,r,i=new g,n=new vt;return function(){e=this.geometry,r=this.pointMap;n.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}();var Cp=new g,Ip=new pn,Rp=new pn,Lp=new pn;dn.prototype=Object.create(Si.prototype),dn.prototype.constructor=dn,dn.prototype.getPoint=function(t){var e=this.points,r=e.length,i=(r-(this.closed?0:1))*t,n=Math.floor(i),o=i-n;this.closed?n+=n>0?0:(Math.floor(Math.abs(n)/e.length)+1)*e.length:0===o&&n===r-1&&(n=r-2,o=1);var a,s,c,u;if(this.closed||n>0?a=e[(n-1)%r]:(Cp.subVectors(e[0],e[1]).add(e[0]),a=Cp),s=e[n%r],c=e[(n+1)%r],this.closed||n+2<r?u=e[(n+2)%r]:(Cp.subVectors(e[r-1],e[r-2]).add(e[r-1]),u=Cp),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var h="chordal"===this.type?.5:.25,l=Math.pow(a.distanceToSquared(s),h),p=Math.pow(s.distanceToSquared(c),h),d=Math.pow(c.distanceToSquared(u),h);p<1e-4&&(p=1),l<1e-4&&(l=p),d<1e-4&&(d=p),Ip.initNonuniformCatmullRom(a.x,s.x,c.x,u.x,l,p,d),Rp.initNonuniformCatmullRom(a.y,s.y,c.y,u.y,l,p,d),Lp.initNonuniformCatmullRom(a.z,s.z,c.z,u.z,l,p,d)}else if("catmullrom"===this.type){var f=void 0!==this.tension?this.tension:.5;Ip.initCatmullRom(a.x,s.x,c.x,u.x,f),Rp.initCatmullRom(a.y,s.y,c.y,u.y,f),Lp.initCatmullRom(a.z,s.z,c.z,u.z,f)}return new g(Ip.calc(o),Rp.calc(o),Lp.calc(o))},Si.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Si.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},fn.prototype=Object.create(dn.prototype),Object.assign(fn.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),cn.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(et.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(st.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),kt.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Kl.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(ut.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(v.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new g),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,i,n,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,r,n,o)}}),ht.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},m.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Nt.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(Ri.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ir(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new dr(this,t)}}),Object.assign(l.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(g.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(d.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),wt.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(gt.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(gt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Me.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Te.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Si.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),bt.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Br.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(St.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Ct.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Ct.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Xi.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(nt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new tt}}}),Object.defineProperties(Tr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(ot.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(ye.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ye.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(pt.prototype,{cullFace:{get:function(){return this.renderReverseSided?Ku:Zu},set:function(t){var e=t!==Zu;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(f.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Bi.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Ni).load(t,function(t){e.setBuffer(t)}),this},Ui.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Op=function(t){this.name=t,this._dict={}},Dp={names:{}};Op.prototype.add=function(t,e){this._dict[Vn(t)]=e},Op.prototype.get=function(t){return this._dict[Vn(t)]},Dp.names.get=function(){return Object.keys(this._dict)},Object.defineProperties(Op.prototype,Dp);var Np,kp,Fp,Bp,zp,Up,jp,Gp,Vp,$p,Hp,Wp,Xp,qp,Yp,Zp,Kp,Qp,Jp,td,ed,rd,id,nd,od,ad,sd,cd,ud,hd,ld,pd,dd,fd,md,gd,vd,yd,bd,xd,_d,wd,Sd,Ad,Md,Td,Ed,Pd,Cd,Id,Rd,Ld,Od,Dd,Nd,kd,Fd,Bd,zd,Ud,jd,Gd,Vd,$d,Hd,Wd,Xd,qd,Yd,Zd,Kd,Qd,Jd,tf,ef,rf,nf,of,af,sf="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),cf=new Array(36),uf=[].slice;ef=function(){var t,e,r,i,n;for(t={},i=0,e=(n="Boolean Number String Function Array Date RegExp Undefined Null".split(" ")).length;i<e;i++)r=n[i],t["[object "+r+"]"]=r.toLowerCase();return function(e){var r;return r=Object.prototype.toString.call(e),t[r]||"object"}}(),Md=function(t,e,r){return null==e&&(e=0),null==r&&(r=1),t<e&&(t=e),t>r&&(t=r),t},rf=function(t){return t.length>=3?[].slice.call(t):t[0]},td=function(t){var e,r;for(t._clipped=!1,t._unclipped=t.slice(0),e=r=0;r<3;e=++r)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t._clipped||delete t._unclipped,t},Bp=Math.PI,Zd=Math.round,rd=Math.cos,sd=Math.floor,Dd=Math.pow,Td=Math.log,Qd=Math.sin,Jd=Math.sqrt,Xp=Math.atan2,Cd=Math.max,Wp=Math.abs,jp=2*Bp,zp=Bp/3,kp=Bp/180,Up=180/Bp,Hp=[],(Jp=function(){return arguments[0]instanceof Np?arguments[0]:function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,arguments,function(){})}).version="1.3.3",$p={},Gp=[],Vp=!1,Np=function(){function t(){var t,e,r,i,n,o,a,s,c,u=arguments;for(o=this,e=[],s=0,i=arguments.length;s<i;s++)null!=(t=u[s])&&e.push(t);if(a=e[e.length-1],null!=$p[a])o._rgb=td($p[a](rf(e.slice(0,-1))));else{for(Vp||(Gp=Gp.sort(function(t,e){return e.p-t.p}),Vp=!0),c=0,n=Gp.length;c<n&&(r=Gp[c],!(a=r.test.apply(r,e)));c++);a&&(o._rgb=td($p[a].apply($p,e)))}null==o._rgb&&console.warn("unknown format: "+e),null==o._rgb&&(o._rgb=[0,0,0]),3===o._rgb.length&&o._rgb.push(1)}return t.prototype.toString=function(){return this.hex()},t}(),Jp._input=$p,Jp.brewer=Kp={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},function(){var t,e;e=[];for(t in Kp)e.push(Kp[t.toLowerCase()]=Kp[t])}(),nf={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Jp.colors=nf,xd=function(){var t,e,r,i,n,o,a,s,c;return e=rf(arguments),n=e[0],t=e[1],r=e[2],s=(n+16)/116,a=isNaN(t)?s:s+t/500,c=isNaN(r)?s:s-r/200,s=Fp.Yn*_d(s),a=Fp.Xn*_d(a),c=Fp.Zn*_d(c),o=af(3.2404542*a-1.5371385*s-.4985314*c),i=af(-.969266*a+1.8760108*s+.041556*c),r=af(.0556434*a-.2040259*s+1.0572252*c),[o,i,r,e.length>3?e[3]:1]},af=function(t){return 255*(t<=.00304?12.92*t:1.055*Dd(t,1/2.4)-.055)},_d=function(t){return t>Fp.t1?t*t*t:Fp.t2*(t-Fp.t0)},Fp={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Gd=function(){var t,e,r,i,n,o,a,s;return i=rf(arguments),r=i[0],e=i[1],t=i[2],n=Xd(r,e,t),o=n[0],a=n[1],s=n[2],[116*a-16,500*(o-a),200*(a-s)]},qd=function(t){return(t/=255)<=.04045?t/12.92:Dd((t+.055)/1.055,2.4)},of=function(t){return t>Fp.t3?Dd(t,1/3):t/Fp.t2+Fp.t0},Xd=function(){var t,e,r,i,n,o,a;return i=rf(arguments),r=i[0],e=i[1],t=i[2],r=qd(r),e=qd(e),t=qd(t),n=of((.4124564*r+.3575761*e+.1804375*t)/Fp.Xn),o=of((.2126729*r+.7151522*e+.072175*t)/Fp.Yn),a=of((.0193339*r+.119192*e+.9503041*t)/Fp.Zn),[n,o,a]},Jp.lab=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["lab"]),function(){})},$p.lab=xd,Np.prototype.lab=function(){return Gd(this._rgb)},qp=function(t){var e,r,i,n,o,a,s,c,u,h,l;return t=function(){var e,r,i;for(i=[],r=0,e=t.length;r<e;r++)n=t[r],i.push(Jp(n));return i}(),2===t.length?(u=function(){var e,r,i;for(i=[],r=0,e=t.length;r<e;r++)n=t[r],i.push(n.lab());return i}(),o=u[0],a=u[1],e=function(t){var e,r;return r=function(){var r,i;for(i=[],e=r=0;r<=2;e=++r)i.push(o[e]+t*(a[e]-o[e]));return i}(),Jp.lab.apply(Jp,r)}):3===t.length?(h=function(){var e,r,i;for(i=[],r=0,e=t.length;r<e;r++)n=t[r],i.push(n.lab());return i}(),o=h[0],a=h[1],s=h[2],e=function(t){var e,r;return r=function(){var r,i;for(i=[],e=r=0;r<=2;e=++r)i.push((1-t)*(1-t)*o[e]+2*(1-t)*t*a[e]+t*t*s[e]);return i}(),Jp.lab.apply(Jp,r)}):4===t.length?(l=function(){var e,r,i;for(i=[],r=0,e=t.length;r<e;r++)n=t[r],i.push(n.lab());return i}(),o=l[0],a=l[1],s=l[2],c=l[3],e=function(t){var e,r;return r=function(){var r,i;for(i=[],e=r=0;r<=2;e=++r)i.push((1-t)*(1-t)*(1-t)*o[e]+3*(1-t)*(1-t)*t*a[e]+3*(1-t)*t*t*s[e]+t*t*t*c[e]);return i}(),Jp.lab.apply(Jp,r)}):5===t.length&&(r=qp(t.slice(0,3)),i=qp(t.slice(2,5)),e=function(t){return t<.5?r(2*t):i(2*(t-.5))}),e},Jp.bezier=function(t){var e;return e=qp(t),e.scale=function(){return Jp.scale(e)},e},Jp.cubehelix=function(t,e,r,i,n){var o,a,s;return null==t&&(t=300),null==e&&(e=-1.5),null==r&&(r=1),null==i&&(i=1),null==n&&(n=[0,1]),o=0,"array"===ef(n)?a=n[1]-n[0]:(a=0,n=[n,n]),s=function(s){var c,u,h,l,p,d,f,m,g;return c=jp*((t+120)/360+e*s),f=Dd(n[0]+a*s,i),d=0!==o?r[0]+s*o:r,u=d*f*(1-f)/2,l=rd(c),g=Qd(c),m=f+u*(-.14861*l+1.78277*g),p=f+u*(-.29227*l-.90649*g),h=f+u*(1.97294*l),Jp(td([255*m,255*p,255*h]))},s.start=function(e){return null==e?t:(t=e,s)},s.rotations=function(t){return null==t?e:(e=t,s)},s.gamma=function(t){return null==t?i:(i=t,s)},s.hue=function(t){return null==t?r:(r=t,"array"===ef(r)?0===(o=r[1]-r[0])&&(r=r[1]):o=0,s)},s.lightness=function(t){return null==t?n:("array"===ef(t)?(n=t,a=t[1]-t[0]):(n=[t,t],a=0),s)},s.scale=function(){return Jp.scale(s)},s.hue(r),s},Jp.random=function(){var t,e;for("0123456789abcdef",t="#",e=0;e<6;++e)t+="0123456789abcdef".charAt(sd(16*Math.random()));return new Np(t)},Jp.average=function(t,e){var r,i,n,o,a,s,c,u,h,l,p,d,f;null==e&&(e="rgb"),h=t.length,d=(c=(t=t.map(function(t){return Jp(t)})).splice(0,1)[0]).get(e),o=[],a=0,s=0;for(u in d)d[u]=d[u]||0,o.push(isNaN(d[u])?0:1),"h"!==e.charAt(u)||isNaN(d[u])||(r=d[u]/180*Bp,a+=rd(r),s+=Qd(r));for(i=c.alpha(),p=0,l=t.length;p<l;p++){f=(n=t[p]).get(e),i+=n.alpha();for(u in d)isNaN(f[u])||(d[u]+=f[u],o[u]+=1,"h"===e.charAt(u)&&(r=d[u]/180*Bp,a+=rd(r),s+=Qd(r)))}for(u in d)if(d[u]=d[u]/o[u],"h"===e.charAt(u)){for(r=Xp(s/o[u],a/o[u])/Bp*180;r<0;)r+=360;for(;r>=360;)r-=360;d[u]=r}return Jp(d,e).alpha(i/h)},$p.rgb=function(){var t,e,r,i;e=rf(arguments),r=[];for(t in e)i=e[t],r.push(i);return r},Jp.rgb=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["rgb"]),function(){})},Np.prototype.rgb=function(t){return null==t&&(t=!0),t?this._rgb.map(Math.round).slice(0,3):this._rgb.slice(0,3)},Np.prototype.rgba=function(t){return null==t&&(t=!0),t?[Math.round(this._rgb[0]),Math.round(this._rgb[1]),Math.round(this._rgb[2]),this._rgb[3]]:this._rgb.slice(0)},Gp.push({p:3,test:function(t){var e;return e=rf(arguments),"array"===ef(e)&&3===e.length?"rgb":4===e.length&&"number"===ef(e[3])&&e[3]>=0&&e[3]<=1?"rgb":void 0}}),ud=function(t){var e,r,i,n,o,a;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]),a=parseInt(t,16),n=a>>16,i=a>>8&255,r=255&a,[n,i,r,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),a=parseInt(t,16),n=a>>24&255,i=a>>16&255,r=a>>8&255,e=Zd((255&a)/255*100)/100,[n,i,r,e];if(null!=$p.css&&(o=$p.css(t)))return o;throw"unknown color: "+t},Bd=function(t,e){var r,i,n,o,a,s,c;return null==e&&(e="rgb"),a=t[0],n=t[1],i=t[2],r=t[3],a=Math.round(a),n=Math.round(n),i=Math.round(i),c=a<<16|n<<8|i,s="000000"+c.toString(16),s=s.substr(s.length-6),o="0"+Zd(255*r).toString(16),o=o.substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},$p.hex=function(t){return ud(t)},Jp.hex=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["hex"]),function(){})},Np.prototype.hex=function(t){return null==t&&(t="rgb"),Bd(this._rgb,t)},Gp.push({p:4,test:function(t){if(1===arguments.length&&"string"===ef(t))return"hex"}}),pd=function(){var t,e,r,i,n,o,a,s,c,u,h,l,p,d;if(t=rf(arguments),n=t[0],h=t[1],a=t[2],0===h)c=i=e=255*a;else{for(d=[0,0,0],r=[0,0,0],l=2*a-(p=a<.5?a*(1+h):a+h-a*h),n/=360,d[0]=n+1/3,d[1]=n,d[2]=n-1/3,o=s=0;s<=2;o=++s)d[o]<0&&(d[o]+=1),d[o]>1&&(d[o]-=1),6*d[o]<1?r[o]=l+6*(p-l)*d[o]:2*d[o]<1?r[o]=p:3*d[o]<2?r[o]=l+(p-l)*(2/3-d[o])*6:r[o]=l;c=(u=[Zd(255*r[0]),Zd(255*r[1]),Zd(255*r[2])])[0],i=u[1],e=u[2]}return t.length>3?[c,i,e,t[3]]:[c,i,e]},Ud=function(t,e,r){var i,n,o,a,s;return void 0!==t&&t.length>=3&&(t=(a=t)[0],e=a[1],r=a[2]),t/=255,e/=255,r/=255,o=Math.min(t,e,r),Cd=Math.max(t,e,r),n=(Cd+o)/2,Cd===o?(s=0,i=Number.NaN):s=n<.5?(Cd-o)/(Cd+o):(Cd-o)/(2-Cd-o),t===Cd?i=(e-r)/(Cd-o):e===Cd?i=2+(r-t)/(Cd-o):r===Cd&&(i=4+(t-e)/(Cd-o)),(i*=60)<0&&(i+=360),[i,s,n]},Jp.hsl=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["hsl"]),function(){})},$p.hsl=pd,Np.prototype.hsl=function(){return Ud(this._rgb)},dd=function(){var t,e,r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v;if(t=rf(arguments),n=t[0],m=t[1],v=t[2],v*=255,0===m)c=i=e=v;else switch(360===n&&(n=0),n>360&&(n-=360),n<0&&(n+=360),n/=60,o=sd(n),r=n-o,a=v*(1-m),s=v*(1-m*r),g=v*(1-m*(1-r)),o){case 0:c=(u=[v,g,a])[0],i=u[1],e=u[2];break;case 1:c=(h=[s,v,a])[0],i=h[1],e=h[2];break;case 2:c=(l=[a,v,g])[0],i=l[1],e=l[2];break;case 3:c=(p=[a,s,v])[0],i=p[1],e=p[2];break;case 4:c=(d=[g,a,v])[0],i=d[1],e=d[2];break;case 5:c=(f=[v,a,s])[0],i=f[1],e=f[2]}return[c,i,e,t.length>3?t[3]:1]},jd=function(){var t,e,r,i,n,o,a,s,c;return a=rf(arguments),o=a[0],r=a[1],t=a[2],n=Math.min(o,r,t),Cd=Math.max(o,r,t),e=Cd-n,c=Cd/255,0===Cd?(i=Number.NaN,s=0):(s=e/Cd,o===Cd&&(i=(r-t)/e),r===Cd&&(i=2+(t-o)/e),t===Cd&&(i=4+(o-r)/e),(i*=60)<0&&(i+=360)),[i,s,c]},Jp.hsv=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["hsv"]),function(){})},$p.hsv=dd,Np.prototype.hsv=function(){return jd(this._rgb)},Ld=function(t){var e,r,i;return"number"===ef(t)&&t>=0&&t<=16777215?(i=t>>16,r=t>>8&255,e=255&t,[i,r,e,1]):(console.warn("unknown num color: "+t),[0,0,0,1])},Hd=function(){var t,e,r,i;return i=rf(arguments),r=i[0],e=i[1],t=i[2],(r<<16)+(e<<8)+t},Jp.num=function(t){return new Np(t,"num")},Np.prototype.num=function(t){return null==t&&(t="rgb"),Hd(this._rgb,t)},$p.num=Ld,Gp.push({p:1,test:function(t){if(1===arguments.length&&"number"===ef(t)&&t>=0&&t<=16777215)return"num"}}),cd=function(){var t,e,r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b;if(r=rf(arguments),s=r[0],n=r[1],e=r[2],n/=100,a=a/100*255,t=255*n,0===n)l=a=i=e;else switch(360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),s/=60,c=sd(s),o=s-c,u=e*(1-n),h=u+t*(1-o),y=u+t*o,b=u+t,c){case 0:l=(p=[b,y,u])[0],a=p[1],i=p[2];break;case 1:l=(d=[h,b,u])[0],a=d[1],i=d[2];break;case 2:l=(f=[u,b,y])[0],a=f[1],i=f[2];break;case 3:l=(m=[u,h,b])[0],a=m[1],i=m[2];break;case 4:l=(g=[y,u,b])[0],a=g[1],i=g[2];break;case 5:l=(v=[b,u,h])[0],a=v[1],i=v[2]}return[l,a,i,r.length>3?r[3]:1]},Fd=function(){var t,e,r,i,n,o,a,s,c;return c=rf(arguments),s=c[0],n=c[1],e=c[2],a=Math.min(s,n,e),Cd=Math.max(s,n,e),i=Cd-a,r=100*i/255,t=a/(255-i)*100,0===i?o=Number.NaN:(s===Cd&&(o=(n-e)/i),n===Cd&&(o=2+(e-s)/i),e===Cd&&(o=4+(s-n)/i),(o*=60)<0&&(o+=360)),[o,r,t]},Jp.hcg=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["hcg"]),function(){})},$p.hcg=cd,Np.prototype.hcg=function(){return Fd(this._rgb)},id=function(t){var e,r,i,n,o,a,s,c;if(t=t.toLowerCase(),null!=Jp.colors&&Jp.colors[t])return ud(Jp.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),n=a=0;a<=2;n=++a)s[n]=+s[n];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),n=c=0;c<=3;n=++c)s[n]=+s[n];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),n=e=0;e<=2;n=++e)s[n]=Zd(2.55*s[n]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),n=r=0;r<=2;n=++r)s[n]=Zd(2.55*s[n]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?((i=o.slice(1,4))[1]*=.01,i[2]*=.01,(s=pd(i))[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&((i=o.slice(1,4))[1]*=.01,i[2]*=.01,(s=pd(i))[3]=+o[4]);return s},kd=function(t){var e;return e=t[3]<1?"rgba":"rgb","rgb"===e?e+"("+t.slice(0,3).map(Zd).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Zd).join(",")+","+t[3]+")":void 0},Yd=function(t){return Zd(100*t)/100},ld=function(t,e){var r;return r=e<1?"hsla":"hsl",t[0]=Yd(t[0]||0),t[1]=Yd(100*t[1])+"%",t[2]=Yd(100*t[2])+"%","hsla"===r&&(t[3]=e),r+"("+t.join(",")+")"},$p.css=function(t){return id(t)},Jp.css=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["css"]),function(){})},Np.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?kd(this._rgb):"hsl"===t.slice(0,3)?ld(this.hsl(),this.alpha()):void 0},$p.named=function(t){return ud(nf[t])},Gp.push({p:5,test:function(t){if(1===arguments.length&&null!=nf[t])return"named"}}),Np.prototype.name=function(t){var e,r;arguments.length&&(nf[t]&&(this._rgb=ud(nf[t])),this._rgb[3]=1),e=this.hex();for(r in nf)if(e===nf[r])return r;return e},wd=function(){var t,e,r,i;return i=rf(arguments),r=i[0],t=i[1],e=i[2],e*=kp,[r,rd(e)*t,Qd(e)*t]},Sd=function(){var t,e,r,i,n,o,a,s,c,u,h;return r=rf(arguments),s=r[0],n=r[1],a=r[2],u=wd(s,n,a),t=u[0],e=u[1],i=u[2],h=xd(t,e,i),c=h[0],o=h[1],i=h[2],[c,o,i,r.length>3?r[3]:1]},bd=function(){var t,e,r,i,n,o;return o=rf(arguments),n=o[0],t=o[1],e=o[2],r=Jd(t*t+e*e),i=(Xp(e,t)*Up+360)%360,0===Zd(1e4*r)&&(i=Number.NaN),[n,r,i]},Vd=function(){var t,e,r,i,n,o,a;return o=rf(arguments),n=o[0],r=o[1],e=o[2],a=Gd(n,r,e),i=a[0],t=a[1],e=a[2],bd(i,t,e)},Jp.lch=function(){var t;return t=rf(arguments),new Np(t,"lch")},Jp.hcl=function(){var t;return t=rf(arguments),new Np(t,"hcl")},$p.lch=Sd,$p.hcl=function(){var t,e,r,i;return i=rf(arguments),e=i[0],t=i[1],r=i[2],Sd([r,t,e])},Np.prototype.lch=function(){return Vd(this._rgb)},Np.prototype.hcl=function(){return Vd(this._rgb).reverse()},Nd=function(t){var e,r,i,n,o,a,s,c,u;return null==t&&(t="rgb"),c=rf(arguments),s=c[0],n=c[1],e=c[2],s/=255,n/=255,e/=255,o=1-Math.max(s,Math.max(n,e)),i=o<1?1/(1-o):0,r=(1-s-o)*i,a=(1-n-o)*i,u=(1-e-o)*i,[r,a,u,o]},ed=function(){var t,e,r,i,n,o,a,s,c;return e=rf(arguments),i=e[0],a=e[1],c=e[2],o=e[3],t=e.length>4?e[4]:1,1===o?[0,0,0,t]:(s=i>=1?0:255*(1-i)*(1-o),n=a>=1?0:255*(1-a)*(1-o),r=c>=1?0:255*(1-c)*(1-o),[s,n,r,t])},$p.cmyk=function(){return ed(rf(arguments))},Jp.cmyk=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["cmyk"]),function(){})},Np.prototype.cmyk=function(){return Nd(this._rgb)},$p.gl=function(){var t,e,r,i,n;for(i=function(){var t,r;t=rf(arguments),r=[];for(e in t)n=t[e],r.push(n);return r}.apply(this,arguments),t=r=0;r<=2;t=++r)i[t]*=255;return i},Jp.gl=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["gl"]),function(){})},Np.prototype.gl=function(){var t;return t=this._rgb,[t[0]/255,t[1]/255,t[2]/255,t[3]]},$d=function(t,e,r){var i;return i=rf(arguments),t=i[0],e=i[1],r=i[2],t=Ed(t),e=Ed(e),r=Ed(r),.2126*t+.7152*e+.0722*r},Ed=function(t){return t/=255,t<=.03928?t/12.92:Dd((t+.055)/1.055,2.4)},Hp=[],fd=function(t,e,r,i){var n,o,a,s;for(null==r&&(r=.5),null==i&&(i="rgb"),"object"!==ef(t)&&(t=Jp(t)),"object"!==ef(e)&&(e=Jp(e)),a=0,o=Hp.length;a<o;a++)if(n=Hp[a],i===n[0]){s=n[1](t,e,r,i);break}if(null==s)throw"color mode "+i+" is not supported";return s.alpha(t.alpha()+r*(e.alpha()-t.alpha()))},Jp.interpolate=fd,Np.prototype.interpolate=function(t,e,r){return fd(this,t,e,r)},Jp.mix=fd,Np.prototype.mix=Np.prototype.interpolate,yd=function(t,e,r,i){var n,o;return n=t._rgb,o=e._rgb,new Np(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),i)},Hp.push(["rgb",yd]),Np.prototype.luminance=function(t,e){var r,i,n,o;return null==e&&(e="rgb"),arguments.length?(0===t?this._rgb=[0,0,0,this._rgb[3]]:1===t?this._rgb=[255,255,255,this._rgb[3]]:(i=1e-7,n=20,o=function(r,a){var s,c;return c=r.interpolate(a,.5,e),s=c.luminance(),Math.abs(t-s)<i||!n--?c:s>t?o(r,c):o(c,a)},r=$d(this._rgb),this._rgb=(r>t?o(Jp("black"),this):o(this,Jp("white"))).rgba()),this):$d(this._rgb)},tf=function(t){var e,r,i,n;return n=t/100,n<66?(i=255,r=-155.25485562709179-.44596950469579133*(r=n-2)+104.49216199393888*Td(r),e=n<20?0:.8274096064007395*(e=n-10)-254.76935184120902+115.67994401066147*Td(e)):(i=351.97690566805693+.114206453784165*(i=n-55)-40.25366309332127*Td(i),r=325.4494125711974+.07943456536662342*(r=n-50)-28.0852963507957*Td(r),e=255),[i,r,e]},Wd=function(){var t,e,r,i,n,o,a;for(i=(n=rf(arguments))[0],n[1],t=n[2],r=1e3,e=4e4,.4;e-r>.4;)(o=tf(a=.5*(e+r)))[2]/o[0]>=t/i?e=a:r=a;return Zd(a)},Jp.temperature=Jp.kelvin=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["temperature"]),function(){})},$p.temperature=$p.kelvin=$p.K=tf,Np.prototype.temperature=function(){return Wd(this._rgb)},Np.prototype.kelvin=Np.prototype.temperature,Jp.contrast=function(t,e){var r,i,n,o;return"string"!==(n=ef(t))&&"number"!==n||(t=new Np(t)),"string"!==(o=ef(e))&&"number"!==o||(e=new Np(e)),r=t.luminance(),i=e.luminance(),r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)},Jp.distance=function(t,e,r){var i,n,o,a,s,c,u;null==r&&(r="lab"),"string"!==(s=ef(t))&&"number"!==s||(t=new Np(t)),"string"!==(c=ef(e))&&"number"!==c||(e=new Np(e)),o=t.get(r),a=e.get(r),u=0;for(n in o)u+=(i=(o[n]||0)-(a[n]||0))*i;return Math.sqrt(u)},Jp.deltaE=function(t,e,r,i){var n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,T,E,P,C,I;for(null==r&&(r=1),null==i&&(i=1),"string"!==(x=ef(t))&&"number"!==x||(t=new Np(t)),"string"!==(_=ef(e))&&"number"!==_||(e=new Np(e)),n=(w=t.lab())[0],a=w[1],c=w[2],o=(S=e.lab())[0],s=S[1],u=S[2],h=Jd(a*a+c*c),l=Jd(s*s+u*u),T=n<16?.511:.040975*n/(1+.01765*n),A=.0638*h/(1+.0131*h)+.638,b=h<1e-6?0:180*Xp(c,a)/Bp;b<0;)b+=360;for(;b>=360;)b-=360;return E=b>=164&&b<=345?.56+Wp(.2*rd(Bp*(b+168)/180)):.36+Wp(.4*rd(Bp*(b+35)/180)),p=h*h*h*h,y=Jd(p/(p+1900)),M=A*(y*E+1-y),v=n-o,g=h-l,f=a-s,m=c-u,d=f*f+m*m-g*g,P=v/(r*T),C=g/(i*A),I=M,Jd(P*P+C*C+d/(I*I))},Np.prototype.get=function(t){var e,r,i,n,o,a;return i=this,o=t.split("."),n=o[0],e=o[1],a=i[n](),e?(r=n.indexOf(e),r>-1?a[r]:console.warn("unknown channel "+e+" in mode "+n)):a},Np.prototype.set=function(t,e){var r,i,n,o,a,s;if(n=this,a=t.split("."),o=a[0],r=a[1])if(s=n[o](),(i=o.indexOf(r))>-1)if("string"===ef(e))switch(e.charAt(0)){case"+":case"-":s[i]+=+e;break;case"*":s[i]*=+e.substr(1);break;case"/":s[i]/=+e.substr(1);break;default:s[i]=+e}else s[i]=e;else console.warn("unknown channel "+r+" in mode "+o);else s=e;return Jp(s,o).alpha(n.alpha())},Np.prototype.clipped=function(){return this._rgb._clipped||!1},Np.prototype.alpha=function(t){return arguments.length?Jp.rgb([this._rgb[0],this._rgb[1],this._rgb[2],t]):this._rgb[3]},Np.prototype.darken=function(t){var e,r;return null==t&&(t=1),r=this,e=r.lab(),e[0]-=Fp.Kn*t,Jp.lab(e).alpha(r.alpha())},Np.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},Np.prototype.darker=Np.prototype.darken,Np.prototype.brighter=Np.prototype.brighten,Np.prototype.saturate=function(t){var e,r;return null==t&&(t=1),r=this,e=r.lch(),e[1]+=t*Fp.Kn,e[1]<0&&(e[1]=0),Jp.lch(e).alpha(r.alpha())},Np.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},Np.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),Jp(e[0]*t,e[1]*t,e[2]*t,t)},Zp=function(t){return function(e,r){var i,n;return i=Jp(r).rgb(),n=Jp(e).rgb(),Jp(t(i,n),"rgb")}},ad=function(t){return function(e,r){var i,n,o;for(o=[],i=n=0;n<=3;i=++n)o[i]=t(e[i],r[i]);return o}},Rd=function(t,e){return t},Id=function(t,e){return t*e/255},nd=function(t,e){return t>e?e:t},Ad=function(t,e){return t>e?t:e},Kd=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},Od=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},Qp=function(t,e){return 255*(1-(1-e/255)/(t/255))},od=function(t,e){return 255===t?255:(t=e/255*255/(1-t/255),t>255?255:t)},(Yp=function(t,e,r){if(!Yp[r])throw"unknown blend mode "+r;return Yp[r](t,e)}).normal=Zp(ad(Rd)),Yp.multiply=Zp(ad(Id)),Yp.screen=Zp(ad(Kd)),Yp.overlay=Zp(ad(Od)),Yp.darken=Zp(ad(nd)),Yp.lighten=Zp(ad(Ad)),Yp.dodge=Zp(ad(od)),Yp.burn=Zp(ad(Qp)),Jp.blend=Yp,Jp.analyze=function(t){var e,r,i,n;for(i={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},r=0,e=t.length;r<e;r++)null==(n=t[r])||isNaN(n)||(i.values.push(n),i.sum+=n,n<i.min&&(i.min=n),n>i.max&&(i.max=n),i.count+=1);return i.domain=[i.min,i.max],i.limits=function(t,e){return Jp.limits(i,t,e)},i},Jp.scale=function(t,e){var r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_;return u="rgb",h=Jp("#ccc"),f=0,!1,a=[0,1],d=[],p=[0,0],r=!1,n=[],l=!1,c=0,s=1,o=!1,i={},m=!0,x=function(t){var e,r,i,o,a,s;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===ef(t)&&null!=Jp.brewer&&(t=Jp.brewer[t]||Jp.brewer[t.toLowerCase()]||t),"array"===ef(t)){for(e=i=0,o=(t=t.slice(0)).length-1;0<=o?i<=o:i>=o;e=0<=o?++i:--i)r=t[e],"string"===ef(r)&&(t[e]=Jp(r));for(d.length=0,e=s=0,a=t.length-1;0<=a?s<=a:s>=a;e=0<=a?++s:--s)d.push(e/(t.length-1))}return b(),n=t},v=function(t){var e,i;if(null!=r){for(i=r.length-1,e=0;e<i&&t>=r[e];)e++;return e-1}return 0},_=function(t){return t},function(t){var e,i,n,o,a;return a=t,r.length>2&&(o=r.length-1,e=v(t),n=r[0]+(r[1]-r[0])*(0+.5*f),i=r[o-1]+(r[o]-r[o-1])*(1-.5*f),a=c+(r[e]+.5*(r[e+1]-r[e])-n)/(i-n)*(s-c)),a},y=function(t,e){var o,a,l,f,g,y,b;if(null==e&&(e=!1),isNaN(t))return h;if(e?b=t:r&&r.length>2?(b=v(t)/(r.length-2),b=p[0]+b*(1-p[0]-p[1])):s!==c?(b=(t-c)/(s-c),b=p[0]+b*(1-p[0]-p[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=_(b)),l=Math.floor(1e4*b),m&&i[l])o=i[l];else{if("array"===ef(n))for(a=f=0,y=d.length-1;0<=y?f<=y:f>=y;a=0<=y?++f:--f){if(g=d[a],b<=g){o=n[a];break}if(b>=g&&a===d.length-1){o=n[a];break}if(b>g&&b<d[a+1]){b=(b-g)/(d[a+1]-g),o=Jp.interpolate(n[a],n[a+1],b,u);break}}else"function"===ef(n)&&(o=n(b));m&&(i[l]=o)}return o},b=function(){return i={}},x(t),g=function(t){var e;return e=Jp(y(t)),l&&e[l]?e[l]():e},g.classes=function(t){var e;return null!=t?("array"===ef(t)?(r=t,a=[t[0],t[t.length-1]]):(e=Jp.analyze(a),r=0===t?[e.min,e.max]:Jp.limits(e,"e",t)),g):r},g.domain=function(t){var e,r,i,o,u,h,l;if(!arguments.length)return a;if(c=t[0],s=t[t.length-1],d=[],i=n.length,t.length===i&&c!==s)for(u=0,o=t.length;u<o;u++)r=t[u],d.push((r-c)/(s-c));else for(e=l=0,h=i-1;0<=h?l<=h:l>=h;e=0<=h?++l:--l)d.push(e/(i-1));return a=[c,s],g},g.mode=function(t){return arguments.length?(u=t,b(),g):u},g.range=function(t,e){return x(t),g},g.out=function(t){return l=t,g},g.spread=function(t){return arguments.length?(f=t,g):f},g.correctLightness=function(t){return null==t&&(t=!0),o=t,b(),_=o?function(t){var e,r,i,n,o,a,s,c,u;for(e=y(0,!0).lab()[0],r=y(1,!0).lab()[0],s=e>r,i=y(t,!0).lab()[0],n=i-(o=e+(r-e)*t),c=0,u=1,a=20;Math.abs(n)>.01&&a-- >0;)!function(){s&&(n*=-1),n<0?(c=t,t+=.5*(u-t)):(u=t,t+=.5*(c-t)),i=y(t,!0).lab()[0],n=i-o}();return t}:function(t){return t},g},g.padding=function(t){return null!=t?("number"===ef(t)&&(t=[t,t]),p=t,g):p},g.colors=function(e,i){var o,s,c,u,h,l,p;if(null==i&&(i="hex"),0===arguments.length)return n.map(function(t){return t[i]()});if(e)return 1===e?g(.5)[i]():(s=a[0],o=a[1]-s,function(){h=[];for(var t=0;0<=e?t<e:t>e;0<=e?t++:t--)h.push(t);return h}.apply(this).map(function(t){return g(s+t/(e-1)*o)[i]()}));if(t=[],l=[],r&&r.length>2)for(c=p=1,u=r.length;1<=u?p<u:p>u;c=1<=u?++p:--p)l.push(.5*(r[c-1]+r[c]));else l=a;return l.map(function(t){return g(t)[i]()})},g.cache=function(t){return null!=t?m=t:m},g},null==Jp.scales&&(Jp.scales={}),Jp.scales.cool=function(){return Jp.scale([Jp.hsl(180,1,.9),Jp.hsl(250,.7,.4)])},Jp.scales.hot=function(){return Jp.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},Jp.analyze=function(t,e,r){var i,n,o,a,s,c;if(s={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==r&&(r=function(){return!0}),i=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,t<s.min&&(s.min=t),t>s.max&&(s.max=t),s.count+=1)},c=function(t,n){if(r(t,n))return i(null!=e&&"function"===ef(e)?e(t):null!=e&&"string"===ef(e)||"number"===ef(e)?t[e]:t)},"array"===ef(t))for(a=0,o=t.length;a<o;a++)c(t[a]);else for(n in t)c(t[n],n);return s.domain=[s.min,s.max],s.limits=function(t,e){return Jp.limits(s,t,e)},s},Jp.limits=function(t,e,r){var i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,T,E,P,C,I,R,L,O,D,N,k,F,B,z,U,j,G,V,$,H,W,X,q,Y,Z,K,Q,J,tt,et,rt,it;if(null==e&&(e="equal"),null==r&&(r=7),"array"===ef(t)&&(t=Jp.analyze(t)),E=t.min,Cd=t.max,t.sum,rt=t.values.sort(function(t,e){return t-e}),1===r)return[E,Cd];if(M=[],"c"===e.substr(0,1)&&(M.push(E),M.push(Cd)),"e"===e.substr(0,1)){for(M.push(E),w=O=1,F=r-1;1<=F?O<=F:O>=F;w=1<=F?++O:--O)M.push(E+w/r*(Cd-E));M.push(Cd)}else if("l"===e.substr(0,1)){if(E<=0)throw"Logarithmic scales are only possible for values > 0";for(P=Math.LOG10E*Td(E),T=Math.LOG10E*Td(Cd),M.push(E),w=it=1,B=r-1;1<=B?it<=B:it>=B;w=1<=B?++it:--it)M.push(Dd(10,P+w/r*(T-P)));M.push(Cd)}else if("q"===e.substr(0,1)){for(M.push(E),w=i=1,$=r-1;1<=$?i<=$:i>=$;w=1<=$?++i:--i)D=(rt.length-1)*w/r,(N=sd(D))===D?M.push(rt[N]):(k=D-N,M.push(rt[N]*(1-k)+rt[N+1]*k));M.push(Cd)}else if("k"===e.substr(0,1)){for(I=rt.length,g=new Array(I),x=new Array(r),Q=!0,R=0,y=null,(y=[]).push(E),w=n=1,H=r-1;1<=H?n<=H:n>=H;w=1<=H?++n:--n)y.push(E+w/r*(Cd-E));for(y.push(Cd);Q;){for(S=o=0,W=r-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(w=a=0,X=I-1;0<=X?a<=X:a>=X;w=0<=X?++a:--a){for(et=rt[w],C=Number.MAX_VALUE,S=s=0,q=r-1;0<=q?s<=q:s>=q;S=0<=q?++s:--s)(_=Wp(y[S]-et))<C&&(C=_,v=S);x[v]++,g[w]=v}for(L=new Array(r),S=c=0,Y=r-1;0<=Y?c<=Y:c>=Y;S=0<=Y?++c:--c)L[S]=null;for(w=u=0,Z=I-1;0<=Z?u<=Z:u>=Z;w=0<=Z?++u:--u)null===L[b=g[w]]?L[b]=rt[w]:L[b]+=rt[w];for(S=h=0,K=r-1;0<=K?h<=K:h>=K;S=0<=K?++h:--h)L[S]*=1/x[S];for(Q=!1,S=l=0,z=r-1;0<=z?l<=z:l>=z;S=0<=z?++l:--l)if(L[S]!==y[w]){Q=!0;break}y=L,++R>200&&(Q=!1)}for(A={},S=p=0,U=r-1;0<=U?p<=U:p>=U;S=0<=U?++p:--p)A[S]=[];for(w=d=0,j=I-1;0<=j?d<=j:d>=j;w=0<=j?++d:--d)A[b=g[w]].push(rt[w]);for(J=[],S=f=0,G=r-1;0<=G?f<=G:f>=G;S=0<=G?++f:--f)J.push(A[S][0]),J.push(A[S][A[S].length-1]);for(J=J.sort(function(t,e){return t-e}),M.push(J[0]),w=m=1,V=J.length-1;m<=V;w=m+=2)tt=J[w],isNaN(tt)||-1!==M.indexOf(tt)||M.push(tt)}return M},hd=function(t,e,r){var i,n,o,a;return i=rf(arguments),t=i[0],e=i[1],r=i[2],isNaN(t)&&(t=0),t/=360,t<1/3?o=1-((n=(1-e)/3)+(a=(1+e*rd(jp*t)/rd(zp-jp*t))/3)):t<2/3?n=1-((a=(1-e)/3)+(o=(1+e*rd(jp*(t-=1/3))/rd(zp-jp*t))/3)):a=1-((o=(1-e)/3)+(n=(1+e*rd(jp*(t-=2/3))/rd(zp-jp*t))/3)),a=Md(r*a*3),o=Md(r*o*3),n=Md(r*n*3),[255*a,255*o,255*n,i.length>3?i[3]:1]},zd=function(){var t,e,r,i,n,o,a,s;return a=rf(arguments),o=a[0],e=a[1],t=a[2],jp=2*Math.PI,o/=255,e/=255,t/=255,n=Math.min(o,e,t),i=(o+e+t)/3,s=1-n/i,0===s?r=0:(r=(o-e+(o-t))/2,r/=Math.sqrt((o-e)*(o-e)+(o-t)*(e-t)),r=Math.acos(r),t>e&&(r=jp-r),r/=jp),[360*r,s,i]},Jp.hsi=function(){return function(t,e,r){r.prototype=t.prototype;var i=new r,n=t.apply(i,e);return Object(n)===n?n:i}(Np,uf.call(arguments).concat(["hsi"]),function(){})},$p.hsi=hd,Np.prototype.hsi=function(){return zd(this._rgb)},md=function(t,e,r,i){var n,o,a,s,c,u,h,l,p,d,f;return"hsl"===i?(d=t.hsl(),f=e.hsl()):"hsv"===i?(d=t.hsv(),f=e.hsv()):"hcg"===i?(d=t.hcg(),f=e.hcg()):"hsi"===i?(d=t.hsi(),f=e.hsi()):"lch"!==i&&"hcl"!==i||(i="hcl",d=t.hcl(),f=e.hcl()),"h"===i.substr(0,1)&&(o=d[0],l=d[1],c=d[2],a=f[0],p=f[1],u=f[2]),isNaN(o)||isNaN(a)?isNaN(o)?isNaN(a)?n=Number.NaN:(n=a,1!==c&&0!==c||"hsv"===i||(h=p)):(n=o,1!==u&&0!==u||"hsv"===i||(h=l)):n=o+r*(a>o&&a-o>180?a-(o+360):a<o&&o-a>180?a+360-o:a-o),null==h&&(h=l+r*(p-l)),s=c+r*(u-c),Jp[i](n,h,s)},vd=function(t,e,r,i){var n,o;return n=t.num(),o=e.num(),Jp.num(n+(o-n)*r,"num")},(Hp=Hp.concat(function(){var t,e,r,i;for(i=[],e=0,t=(r=["hsv","hsl","hsi","hcl","lch","hcg"]).length;e<t;e++)Pd=r[e],i.push([Pd,md]);return i}())).push(["num",vd]),gd=function(t,e,r,i){var n,o;return n=t.lab(),o=e.lab(),new Np(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),i)},Hp.push(["lab",gd]);var hf=Jp,lf=function(t){var e=t||{};this.scale=gn(e.scale,"uniform"),this.mode=gn(e.mode,"hcl"),this.domain=gn(e.domain,[0,1]),this.value=new tt(gn(e.value,16777215)).getHex(),this.reverse=gn(e.reverse,!1),this.structure=e.structure,this.volume=e.volume,this.surface=e.surface,this.structure&&(this.atomProxy=this.structure.getAtomProxy())};lf.prototype.getScale=function(t){var e=t||{},r=gn(e.scale,this.scale);"rainbow"===r?r=["red","orange","yellow","green","blue"]:"rwb"===r&&(r=["red","white","blue"]);var i=gn(e.domain,this.domain);return this.reverse&&(i=i.slice().reverse()),hf.scale(r).mode(gn(e.mode,this.mode)).domain(i).out("num")},lf.prototype.colorToArray=function(t,e,r){return void 0===e&&(e=[]),void 0===r&&(r=0),e[r+0]=(t>>16&255)/255,e[r+1]=(t>>8&255)/255,e[r+2]=(255&t)/255,e},lf.prototype.atomColorToArray=function(t,e,r){return this.colorToArray(this.atomColor(t),e,r)},lf.prototype.bondColor=function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},lf.prototype.bondColorToArray=function(t,e,r,i){return this.colorToArray(this.bondColor(t,e),r,i)},lf.prototype.volumeColorToArray=function(t,e,r){return this.colorToArray(this.volumeColor(t),e,r)},lf.prototype.positionColorToArray=function(t,e,r){return this.colorToArray(this.positionColor(t),e,r)},ro.prototype={active:!0,params:null,execute:function(t){var e,r;return this.active&&this._listener&&(r=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,r),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},no.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,r,i){var n,o=this._indexOfListener(t,r);if(-1!==o){if((n=this._bindings[o]).isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else n=new ro(this,t,e,r,i),this._addBinding(n);return this.memorize&&this._prevParams&&n.execute(this._prevParams),n},_addBinding:function(t){var e=this._bindings.length;do{--e}while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var r,i=this,n=this._bindings.length;n--;)if((r=i._bindings[n])._listener===t&&r.context===e)return n;return-1},has:function(t,e){return-1!==this._indexOfListener(t,e)},add:function(t,e,r){return io(t,"add"),this._registerListener(t,!1,e,r)},addOnce:function(t,e,r){return io(t,"addOnce"),this._registerListener(t,!0,e,r)},remove:function(t,e){io(t,"remove");var r=this._indexOfListener(t,e);return-1!==r&&(this._bindings[r]._destroy(),this._bindings.splice(r,1)),t},removeAll:function(){for(var t=this,e=this._bindings.length;e--;)t._bindings[e]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,r=Array.prototype.slice.call(arguments),i=this._bindings.length;if(this.memorize&&(this._prevParams=r),i){e=this._bindings.slice(),this._shouldPropagate=!0;do{i--}while(e[i]&&this._shouldPropagate&&!1!==e[i].execute(r))}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var pf={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,TURN:9,BACKBONE:10,SIDECHAIN:11,ALL:12,HETERO:13,ION:14,SACCHARIDE:15,SUGAR:15,BONDED:16,RING:17},df=["*","","ALL"],ff=[pf.BACKBONE,pf.SIDECHAIN,pf.BONDED,pf.RING],mf=[pf.POLYMER,pf.WATER],gf=["ALA","GLY","SER"],vf=["CYS","SER","THR"],yf=["ALA","ILE","LEU","MET","PHE","PRO","TRP","VAL"],bf=["PHE","TRP","TYR","HIS"],xf=["ASN","GLN"],_f=["ASP","GLU"],wf=["ARG","HIS","LYS"],Sf=["ARG","ASP","GLU","HIS","LYS"],Af=["ASN","ARG","ASP","CYS","GLY","GLN","GLU","HIS","LYS","SER","THR","TYR"],Mf=["ALA","ILE","LEU","MET","PHE","PRO","TRP","VAL"],Tf=["HIS","PHE","PRO","TRP","TYR"],Ef=["ALA","GLY","ILE","LEU","VAL"],Pf=function(t){this.signals={stringChanged:new no},this.setString(t)},Cf={type:{}};Cf.type.get=function(){return"selection"},Pf.prototype.setString=function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.selection=oo(t)}catch(t){this.selection={error:t.message}}var r=this.selection;this.string=t,this.test=po(r),this.residueTest=fo(r),this.chainTest=mo(r),this.modelTest=go(r),this.atomOnlyTest=po(r,!0),this.residueOnlyTest=fo(r,!0),this.chainOnlyTest=mo(r,!0),this.modelOnlyTest=go(r,!0),e||this.signals.stringChanged.dispatch(this.string)}},Object.defineProperties(Pf.prototype,Cf);var If=function(t){function e(e){var r=this;t.call(this,e);var i=e.dataList||[];this.colormakerList=[],this.selectionList=[],i.forEach(function(t){var e=t[0],i=t[1],n=t[2];void 0===n&&(n={}),$f.hasScheme(e)?Object.assign(n,{scheme:e,structure:r.structure}):Object.assign(n,{scheme:"uniform",value:new tt(e).getHex()}),r.colormakerList.push($f.getScheme(n)),r.selectionList.push(new Pf(i))})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){for(var e=this,r=0,i=this.selectionList.length;r<i;++r)if(e.selectionList[r].test(t))return e.colormakerList[r].atomColor(t);return 16777215},e}(lf),Rf={"":"",OrRd:"[S] Orange-Red",PuBu:"[S] Purple-Blue",BuPu:"[S] Blue-Purple",Oranges:"[S] Oranges",BuGn:"[S] Blue-Green",YlOrBr:"[S] Yellow-Orange-Brown",YlGn:"[S] Yellow-Green",Reds:"[S] Reds",RdPu:"[S] Red-Purple",Greens:"[S] Greens",YlGnBu:"[S] Yellow-Green-Blue",Purples:"[S] Purples",GnBu:"[S] Green-Blue",Greys:"[S] Greys",YlOrRd:"[S] Yellow-Orange-Red",PuRd:"[S] Purple-Red",Blues:"[S] Blues",PuBuGn:"[S] Purple-Blue-Green",Viridis:"[D] Viridis",Spectral:"[D] Spectral",RdYlGn:"[D] Red-Yellow-Green",RdBu:"[D] Red-Blue",PiYG:"[D] Pink-Yellowgreen",PRGn:"[D] Purplered-Green",RdYlBu:"[D] Red-Yellow-Blue",BrBG:"[D] Brown-Bluegreen",RdGy:"[D] Red-Grey",PuOr:"[D] Purple-Orange",Set1:"[Q] Set1",Set2:"[Q] Set2",Set3:"[Q] Set3",Dark2:"[Q] Dark2",Paired:"[Q] Paired",Pastel1:"[Q] Pastel1",Pastel2:"[Q] Pastel2",Accent:"[Q] Accent",rainbow:"[?] Rainbow",rwb:"[?] Red-White-Blue"},Lf={"":"",rgb:"Red Green Blue",hsv:"Hue Saturation Value",hsl:"Hue Saturation Lightness",hsi:"Hue Saturation Intensity",lab:"CIE L*a*b*",hcl:"Hue Chroma Lightness"},Of=function(){this.schemes={},this.userSchemes={}};Of.prototype.getScheme=function(t){var e=((t||{}).scheme||"").toLowerCase();return new(e in this.schemes?this.schemes[e]:e in this.userSchemes?this.userSchemes[e]:lf)(t)},Of.prototype.getSchemes=function(){var t={};return Object.keys(this.schemes).forEach(function(e){t[e]=e}),Object.keys(this.userSchemes).forEach(function(e){t[e]=e.split("|")[1]}),t},Of.prototype.getScales=function(){return Rf},Of.prototype.getModes=function(){return Lf},Of.prototype.add=function(t,e){t=t.toLowerCase(),this.schemes[t]=e},Of.prototype.addScheme=function(t,e){return t instanceof lf||(t=this._createScheme(t)),this._addUserScheme(t,e)},Of.prototype._addUserScheme=function(t,e){e=e||"";var r=(Wn()+"|"+e).toLowerCase();return this.userSchemes[r]=t,r},Of.prototype.removeScheme=function(t){t=t.toLowerCase(),delete this.userSchemes[t]},Of.prototype._createScheme=function(t){var e=function(e){lf.call(this,e),t.call(this,e)};return e.prototype=lf.prototype,e.prototype.constructor=lf,e},Of.prototype.addSelectionScheme=function(t,e){var r=function(e){function r(r){e.call(this,Object.assign({dataList:t},r))}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r}(If);return this._addUserScheme(r,e)},Of.prototype.hasScheme=function(t){return(t=t.toLowerCase())in this.schemes||t in this.userSchemes};var Df=function(t){function e(){t.call(this,"parser")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__hasObjName=function(t,e){var r=this.get(t);return r&&r.prototype.__objName===e},e.prototype.isTrajectory=function(t){return this.__hasObjName(t,"frames")},e.prototype.isStructure=function(t){return this.__hasObjName(t,"structure")},e.prototype.isVolume=function(t){return this.__hasObjName(t,"volume")},e.prototype.isSurface=function(t){return this.__hasObjName(t,"surface")},e.prototype.isBinary=function(t){var e=this.get(t);return e&&e.prototype.isBinary},e.prototype.isXml=function(t){var e=this.get(t);return e&&e.prototype.isXml},e.prototype.isJson=function(t){var e=this.get(t);return e&&e.prototype.isJson},e.prototype.getTrajectoryExtensions=function(){var t=this;return this.names.filter(function(e){return t.isTrajectory(e)})},e.prototype.getStructureExtensions=function(){var t=this;return this.names.filter(function(e){return t.isStructure(e)})},e.prototype.getVolumeExtensions=function(){var t=this;return this.names.filter(function(e){return t.isVolume(e)})},e.prototype.getSurfaceExtensions=function(){var t=this;return this.names.filter(function(e){return t.isSurface(e)})},e}(Op),Nf=function(){this.activeWorkerCount=0,this._funcDict={},this._depsDict={},this._blobDict={}};Nf.prototype.add=function(t,e,r){this._funcDict[t]=e,this._depsDict[t]=r},Nf.prototype.get=function(t){return this._blobDict[t]||(this._blobDict[t]=xo(this._funcDict[t],this._depsDict[t])),this._blobDict[t]};var kf=bn(),Ff="undefined"!=typeof window&&void 0!==window.orientation,Bf=!1,zf=!1,Uf={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)};t.Debug=function(t){return!!t&&("string"!=typeof t||/^1|true|t|yes|y$/i.test(t))}(mn("debug"));var jf='<div style="display:flex;align-items:center;justify-content:center;height:100%;"><p style="padding:15px;text-align:center;">Your browser/graphics card does not seem to support <a target="_blank" href="https://en.wikipedia.org/wiki/WebGL">WebGL</a>.<br/><br/>Find out how to get it <a target="_blank" href="http://get.webgl.org/">here</a>.</p></div>',Gf=["ngl","js"],Vf=new Nf,$f=new Of,Hf=new Op("datasource"),Wf=new Op("representatation"),Xf=new Df,qf=new Op("shader"),Yf=new Op("decompressor"),Zf=new Op("component"),Kf=new Op("buffer"),Qf=new Op("picker"),Jf=function(t,e){var r=e||{};this.compressed=gn(r.compressed,!1),this.binary=gn(r.binary,!1),this.json=gn(r.json,!1),this.xml=gn(r.xml,!1),this.src=t,this.chunkSize=10485760,this.newline="\n",this.__pointer=0,this.__partialLine="",this.__srcName&&(this[this.__srcName]=t)},tm={type:{},__srcName:{}};tm.type.get=function(){return""},tm.__srcName.get=function(){},Jf.prototype.isBinary=function(){return this.binary||this.compressed},Jf.prototype.onload=function(){},Jf.prototype.onprogress=function(){},Jf.prototype.onerror=function(){},Jf.prototype.read=function(){var t=this;return new Promise(function(e,r){try{t._read(function(r){var i=Yf.get(t.compressed);t.compressed&&i?t.data=i(r):((t.binary||t.compressed)&&r instanceof ArrayBuffer&&(r=new Uint8Array(r)),t.data=r),e(t.data)})}catch(t){r(t)}})},Jf.prototype._read=function(t){t(this.src)},Jf.prototype._chunk=function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},Jf.prototype.chunk=function(t){var e=t+this.chunkSize;return this._chunk(t,e)},Jf.prototype.peekLines=function(t){var e,r=this.data,i=r.length,n=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;e<i&&(r[e]===n&&++o,o!==t);++e);var a=this._chunk(0,e+1);return this.chunkToLines(a,"",e>i).lines},Jf.prototype.chunkCount=function(){return Math.floor(this.data.length/this.chunkSize)+1},Jf.prototype.asText=function(){return this.isBinary()?In(this.data):this.data},Jf.prototype.chunkToLines=function(t,e,r){var i=this.newline;if(!this.isBinary()&&t.length===this.data.length)return{lines:t.split(i),partialLine:""};var n=[],o=this.isBinary()?In(t):t,a=o.lastIndexOf(i);if(-1===a)e+=o;else{var s=e+o.substr(0,a);n=n.concat(s.split(i)),e=a===o.length-i.length?"":o.substr(a+i.length)}return r&&""!==e&&n.push(e),{lines:n,partialLine:e}},Jf.prototype.nextChunk=function(){var t=this.__pointer;if(!(t>this.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},Jf.prototype.nextChunkOfLines=function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,r=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=r.partialLine,r.lines}},Jf.prototype.eachChunk=function(t){for(var e=this,r=this.chunkSize,i=this.data.length,n=this.chunkCount(),o=0;o<i;o+=r)t(e.chunk(o),Math.round(o/r),n)},Jf.prototype.eachChunkOfLines=function(t){var e=this;this.eachChunk(function(r,i,n){var o=i===n+1,a=e.chunkToLines(r,e.__partialLine,o);e.__partialLine=a.partialLine,t(a.lines,i,n)})},Jf.prototype.dispose=function(){delete this.src,this.__srcName&&delete this[this.__srcName]},Object.defineProperties(Jf.prototype,tm);var em=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__srcName:{}};return r.type.get=function(){return"file"},r.__srcName.get=function(){return"file"},e.prototype._read=function(t){var e,r=this;if("function"==typeof importScripts){e=new window.FileReaderSync;var i;i=this.binary||this.compressed?e.readAsArrayBuffer(this.file):e.readAsText(this.file),t(i)}else(e=new window.FileReader).onload=function(e){t(e.target.result)},"function"==typeof this.onprogress&&(e.onprogress=function(t){r.onprogress(t)}),"function"==typeof this.onerror&&(e.onerror=function(t){r.onerror(t)}),this.binary||this.compressed?e.readAsArrayBuffer(this.file):e.readAsText(this.file)},Object.defineProperties(e.prototype,r),e}(Jf),rm=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__srcName:{}};return r.type.get=function(){return"network"},r.__srcName.get=function(){return"url"},e.prototype._read=function(t){var e=this.src;"function"==typeof importScripts&&"../"===e.substr(0,3)&&(e="../"+e);var r=new window.XMLHttpRequest;r.open("GET",e,!0),r.addEventListener("load",function(){if(200!==r.status&&304!==r.status&&0!==r.status)throw"function"==typeof this.onerror&&this.onerror(r.status),new Error("NetworkStreamer._read: status code "+r.status);try{t(r.response)}catch(t){this.onerror(t)}}.bind(this),!1),"function"==typeof this.onerror&&r.addEventListener("error",function(t){this.onerror(t)}.bind(this),!1),this.isBinary()?r.responseType="arraybuffer":this.json?r.responseType="json":this.xml?r.responseType="document":r.responseType="text",r.send(null)},Object.defineProperties(e.prototype,r),e}(Jf),im=function(t,e){var r=Object.assign({},e);this.compressed=gn(r.compressed,!1),this.binary=gn(r.binary,Xf.isBinary(r.ext)),this.name=gn(r.name,""),this.ext=gn(r.ext,""),this.dir=gn(r.dir,""),this.path=gn(r.path,""),this.protocol=gn(r.protocol,""),this.params=e;var i={compressed:this.compressed,binary:this.binary,json:Xf.isJson(this.ext),xml:Xf.isXml(this.ext)};"undefined"!=typeof File&&t instanceof window.File||"undefined"!=typeof Blob&&t instanceof window.Blob?this.streamer=new em(t,i):this.streamer=new rm(t,i),"function"==typeof r.onProgress&&(this.streamer.onprogress=r.onprogress)};im.prototype.load=function(){return Promise.reject(new Error("not implemented"))};var nm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){return new(Xf.get(this.ext))(this.streamer,this.params).parse()},e}(im),om=function(t,e,r){this.signals={elementAdded:new no,elementRemoved:new no,nameChanged:new no},this.name=e,this.path=r,this.dir=r.substring(0,r.lastIndexOf("/")+1);try{this.fn=new Function("stage","panel","__name__","__path__","__dir__",t)}catch(t){Uf.error("Script compilation failed",t),this.fn=function(){}}},am={type:{}};am.type.get=function(){return"Script"},om.prototype.call=function(t){var e=this,r={add:function(){this.signals.elementAdded.dispatch(arguments)}.bind(this),remove:function(){this.signals.elementRemoved.dispatch(arguments)}.bind(this),setName:function(t){this.signals.nameChanged.dispatch(t)}.bind(this)};return new Promise(function(i,n){var o=[t,r,e.name,e.path,e.dir];try{e.fn.apply(null,o),i()}catch(t){Uf.error("Script.fn",t),n(t)}})},Object.defineProperties(om.prototype,am);var sm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t=this;return this.streamer.read().then(function(){return new om(t.streamer.asText(),t.name,t.path)})},e}(im),cm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t,e=this;return t=this.protocol?this.protocol+"://"+this.dir:this.dir,this.streamer.read().then(function(){var r=JSON.parse(e.streamer.asText()),i=[];return r.files.map(function(e){i.push(Mo(t+e,{ext:"text",useWorker:!1}))}),Promise.all(i).then(function(t){var i=t.reduce(function(t,e){return t+"\n\n"+e.data},"");return i+=r.source||"",new om(i,e.name,e.path)})})},e}(im),um=function(){},hm={mimeType:{},defaultName:{},defaultExt:{}};hm.mimeType.get=function(){},hm.defaultName.get=function(){},hm.defaultExt.get=function(){},um.prototype.getData=function(){},um.prototype.getBlob=function(){return new window.Blob([this.getData()],{type:this.mimeType})},um.prototype.download=function(t,e){t=gn(t,this.defaultName),e=gn(e,this.defaultExt),_n(this.getBlob(),t+"."+e)},Object.defineProperties(um.prototype,hm);var lm={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},pm=Object.create(null),dm=function(t){function e(e,r){var i=Object.assign({},r);t.call(this),this.renumberSerial=gn(i.renumberSerial,!0),this.remarks=Dn(gn(i.remarks,[])),this.structure=e,this._records=[]}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={mimeType:{},defaultName:{},defaultExt:{}};return r.mimeType.get=function(){return"text/plain"},r.defaultName.get=function(){return"structure"},r.defaultExt.get=function(){return"pdb"},e.prototype._writeRecords=function(){this._records.length=0,this._writeTitle(),this._writeRemarks(),this._writeAtoms()},e.prototype._writeTitle=function(){this._records.push(To("TITLE %-74s",this.structure.name))},e.prototype._writeRemarks=function(){var t=this;this.remarks.forEach(function(e){t._records.push(To("REMARK %-73s",e))}),this.structure.trajectory&&(this._records.push(To("REMARK %-73s","Trajectory '"+this.structure.trajectory.name+"'")),this._records.push(To("REMARK %-73s","Frame "+this.structure.trajectory.frame)))},e.prototype._writeAtoms=function(){var t=this,e=1,r=1;this.structure.eachModel(function(i){t._records.push(To("MODEL %-74d",r++)),i.eachAtom(function(r){var i=r.hetero?"HETATM%5d %-4s %3s %1s%4d    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s":"ATOM  %5d %-4s %3s %1s%4d    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s",n=t.renumberSerial?e:r.serial,o=r.atomname;1===o.length&&(o=" "+o),t._records.push(To(i,n,o,r.resname,gn(r.chainname," "),r.resno,r.x,r.y,r.z,gn(r.occurence,1),gn(r.bfactor,0),gn(r.segid,""),gn(r.element,""))),e+=1}),t._records.push(To("%-80s","ENDMDL")),r+=1}),this._records.push(To("%-80s","END"))},e.prototype.getString=function(){return console.warn("PdbWriter.getString() is deprecated, use .getData instead"),this.getData()},e.prototype.getData=function(){return this._writeRecords(),this._records.join("\n")},Object.defineProperties(e.prototype,r),e}(um),fm=[],mm=function(t,e){var r=e||{},i=!1;void 0===t&&(t=8192),"number"==typeof t?t=new ArrayBuffer(t):(i=!0,this._lastWrittenByte=t.byteLength);var n=r.offset?r.offset>>>0:0,o=t.byteLength-n,a=n;t.buffer&&(t.byteLength!==t.buffer.byteLength&&(a=t.byteOffset+n),t=t.buffer),this._lastWrittenByte=i?o:0,this.buffer=t,this.length=o,this.byteLength=o,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,o),this._mark=0,this._marks=[]};mm.prototype.available=function(t){return void 0===t&&(t=1),this.offset+t<=this.length},mm.prototype.isLittleEndian=function(){return this.littleEndian},mm.prototype.setLittleEndian=function(){return this.littleEndian=!0,this},mm.prototype.isBigEndian=function(){return!this.littleEndian},mm.prototype.setBigEndian=function(){return this.littleEndian=!1,this},mm.prototype.skip=function(t){return void 0===t&&(t=1),this.offset+=t,this},mm.prototype.seek=function(t){return this.offset=t,this},mm.prototype.mark=function(){return this._mark=this.offset,this},mm.prototype.reset=function(){return this.offset=this._mark,this},mm.prototype.pushMark=function(){return this._marks.push(this.offset),this},mm.prototype.popMark=function(){var t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this},mm.prototype.rewind=function(){return this.offset=0,this},mm.prototype.ensureAvailable=function(t){if(void 0===t&&(t=1),!this.available(t)){var e=2*(this.offset+t),r=new Uint8Array(e);r.set(new Uint8Array(this.buffer)),this.buffer=r.buffer,this.length=this.byteLength=e,this._data=new DataView(this.buffer)}return this},mm.prototype.readBoolean=function(){return 0!==this.readUint8()},mm.prototype.readInt8=function(){return this._data.getInt8(this.offset++)},mm.prototype.readUint8=function(){return this._data.getUint8(this.offset++)},mm.prototype.readByte=function(){return this.readUint8()},mm.prototype.readBytes=function(t){var e=this;void 0===t&&(t=1);for(var r=new Uint8Array(t),i=0;i<t;i++)r[i]=e.readByte();return r},mm.prototype.readInt16=function(){var t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},mm.prototype.readUint16=function(){var t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},mm.prototype.readInt32=function(){var t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},mm.prototype.readUint32=function(){var t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},mm.prototype.readFloat32=function(){var t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},mm.prototype.readFloat64=function(){var t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},mm.prototype.readChar=function(){return String.fromCharCode(this.readInt8())},mm.prototype.readChars=function(t){var e=this;void 0===t&&(t=1),fm.length=t;for(var r=0;r<t;r++)fm[r]=e.readChar();return fm.join("")},mm.prototype.writeBoolean=function(t){return this.writeUint8(t?255:0),this},mm.prototype.writeInt8=function(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this},mm.prototype.writeUint8=function(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this},mm.prototype.writeByte=function(t){return this.writeUint8(t)},mm.prototype.writeBytes=function(t){var e=this;this.ensureAvailable(t.length);for(var r=0;r<t.length;r++)e._data.setUint8(e.offset++,t[r]);return this._updateLastWrittenByte(),this},mm.prototype.writeInt16=function(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this},mm.prototype.writeUint16=function(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this},mm.prototype.writeInt32=function(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},mm.prototype.writeUint32=function(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},mm.prototype.writeFloat32=function(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},mm.prototype.writeFloat64=function(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this},mm.prototype.writeChar=function(t){return this.writeUint8(t.charCodeAt(0))},mm.prototype.writeChars=function(t){for(var e=this,r=0;r<t.length;r++)e.writeUint8(t.charCodeAt(r));return this},mm.prototype.toArray=function(){return new Uint8Array(this.buffer,this.byteOffset,this._lastWrittenByte)},mm.prototype.getBuffer=function(){return"undefined"!=typeof Buffer?Buffer.from(this.toArray()):this.toArray()},mm.prototype._updateLastWrittenByte=function(){this.offset>this._lastWrittenByte&&(this._lastWrittenByte=this.offset)};var gm=function(t){function e(e){t.call(this),this.surface=e,this._records=[]}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={mimeType:{},defaultName:{},defaultExt:{}};return r.mimeType.get=function(){return"application/vnd.ms-pki.stl"},r.defaultName.get=function(){return"surface"},r.defaultExt.get=function(){return"stl"},e.prototype.getData=function(){var t=this,e=this.surface.index.length/3,r=new mm(2*e+3*e*4*4+80+4);r.skip(80),r.writeUint32(e);for(var i=new g,n=new g,o=new g,a=new g,s=0;s<e;s++){var c=[t.surface.index[3*s],t.surface.index[3*s+1],t.surface.index[3*s+2]];n.fromArray(t.surface.normal,3*c[0]),o.fromArray(t.surface.normal,3*c[1]),a.fromArray(t.surface.normal,3*c[2]),i.addVectors(n,o).add(a).normalize(),r.writeFloat32(i.x),r.writeFloat32(i.y),r.writeFloat32(i.z);for(var u=0;u<3;u++)i.fromArray(t.surface.position,3*c[u]),r.writeFloat32(i.x),r.writeFloat32(i.y),r.writeFloat32(i.z);r.writeUint16(0)}return new DataView(r.buffer)},Object.defineProperties(e.prototype,r),e}(um),vm=function(){this.count=0,this.signals={countChanged:new no}};vm.prototype.clear=function(){this.change(-this.count)},vm.prototype.change=function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&Uf.warn("Counter.count below zero",this.count)},vm.prototype.increment=function(){this.change(1)},vm.prototype.decrement=function(){this.change(-1)},vm.prototype.listen=function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},vm.prototype.unlisten=function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},vm.prototype.onZeroOnce=function(t,e){if(0===this.count)t.call(e,0,0);else{var r=function(){0===this.count&&(this.signals.countChanged.remove(r,this),t.apply(e,arguments))};this.signals.countChanged.add(r,this)}},vm.prototype.dispose=function(){this.clear(),this.signals.countChanged.dispose()},qf.add("shader/BasicLine.vert","void main(){\n#include begin_vertex\n#include project_vertex\n}"),qf.add("shader/BasicLine.frag","uniform vec3 uColor;\n#include common\n#include fog_pars_fragment\nvoid main(){\ngl_FragColor = vec4( uColor, 1.0 );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),qf.add("shader/Quad.vert","varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"),qf.add("shader/Quad.frag","varying vec2 vUv;\nuniform sampler2D tForeground;\nuniform float scale;\nvoid main() {\nvec4 foreground = texture2D( tForeground, vUv );\ngl_FragColor = foreground * scale;\n}"),Co.prototype={update:function(){this.startTime=this.end(),this.currentTime=this.startTime,this.signals.updated.dispatch()},begin:function(){this.startTime=window.performance.now(),this.lastFrames=this.frames},end:function(){var t=window.performance.now();return this.count+=1,this.frames+=1,this.lastDuration=t-this.startTime,this.minDuration=Math.min(this.minDuration,this.lastDuration),this.maxDuration=Math.max(this.maxDuration,this.lastDuration),this.avgDuration-=this.avgDuration/30,this.avgDuration+=this.lastDuration/30,t>this.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},qf.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),qf.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),qf.add("shader/chunk/matrix_scale.glsl","float matrixScale( in mat4 m ){\nvec4 r = m[ 0 ];\nreturn sqrt( r[ 0 ] * r[ 0 ] + r[ 1 ] * r[ 1 ] + r[ 2 ] * r[ 2 ] );\n}"),qf.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),qf.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"),qf.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif"),qf.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),qf.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),qf.add("shader/chunk/unpack_color.glsl","vec3 unpackColor(float f) {\nvec3 color;\ncolor.r = floor(f / 256.0 / 256.0);\ncolor.g = floor((f - color.r * 256.0 * 256.0) / 256.0);\ncolor.b = floor(f - color.r * 256.0 * 256.0 - color.g * 256.0);\nreturn color / 255.0;\n}");var ym=/^(?!\/\/)\s*#include\s+(\S+)/gim,bm={};if("undefined"!=typeof window&&window.WebGLRenderingContext){var xm=window.WebGLRenderingContext.prototype,_m=xm.getShaderParameter;xm.getShaderParameter=function(){return!t.Debug||_m.apply(this,arguments)};var wm=xm.getShaderInfoLog;xm.getShaderInfoLog=function(){return t.Debug?wm.apply(this,arguments):""};var Sm=xm.getProgramParameter;xm.getProgramParameter=function(e,r){return!t.Debug&&r===xm.LINK_STATUS||Sm.apply(this,arguments)};var Am=xm.getProgramInfoLog;xm.getProgramInfoLog=function(){return t.Debug?Am.apply(this,arguments):""}}var Mm=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];Mm.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),Lo.prototype.constructor=Lo;var Tm=2*Math.PI,Em=(new Float32Array(4),new Float32Array(4),new g),Pm=new v,Cm=new v,Im=new v,Rm=new v,Lm=new Float32Array(4),Om=new Uint8Array(4),Dm=new v;ta.prototype.constructor=ta;var Nm=function(t,e){this.signals={moved:new no,scrolled:new no,dragged:new no,dropped:new no,clicked:new no,hovered:new no,doubleClicked:new no};var r=Object.assign({},e);this.hoverTimeout=gn(r.hoverTimeout,50),this.handleScroll=gn(r.handleScroll,!0),this.doubleClickSpeed=gn(r.doubleClickSpeed,200),this.domElement=t,this.position=new l,this.prevPosition=new l,this.down=new l,this.canvasPosition=new l,this.moving=!1,this.hovering=!0,this.scrolled=!1,this.lastMoved=1/0,this.which=void 0,this.buttons=void 0,this.pressed=void 0,this.altKey=void 0,this.ctrlKey=void 0,this.metaKey=void 0,this.shiftKey=void 0,this._listen=this._listen.bind(this),this._onMousewheel=this._onMousewheel.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMousedown=this._onMousedown.bind(this),this._onMouseup=this._onMouseup.bind(this),this._onContextmenu=this._onContextmenu.bind(this),this._onTouchstart=this._onTouchstart.bind(this),this._onTouchend=this._onTouchend.bind(this),this._onTouchmove=this._onTouchmove.bind(this),this._listen(),document.addEventListener("mousewheel",this._onMousewheel),document.addEventListener("wheel",this._onMousewheel),document.addEventListener("MozMousePixelScroll",this._onMousewheel),document.addEventListener("mousemove",this._onMousemove),document.addEventListener("mousedown",this._onMousedown),document.addEventListener("mouseup",this._onMouseup),document.addEventListener("contextmenu",this._onContextmenu),document.addEventListener("touchstart",this._onTouchstart),document.addEventListener("touchend",this._onTouchend),document.addEventListener("touchmove",this._onTouchmove),this.prevClickCP=new l},km={key:{}};km.key.get=function(){var t=0;return this.altKey&&(t+=1),this.ctrlKey&&(t+=2),this.metaKey&&(t+=4),this.shiftKey&&(t+=8),t},Nm.prototype.setParameters=function(t){var e=Object.assign({},t);this.hoverTimeout=gn(e.hoverTimeout,this.hoverTimeout)},Nm.prototype._listen=function(){var t=window.performance.now(),e=this.canvasPosition;this.clickPending&&t-this.lastClicked>this.doubleClickSpeed&&(this.signals.clicked.dispatch(e.x,e.y),this.clickPending=!1,this.which=void 0,this.buttons=void 0,this.pressed=void 0),t-this.lastMoved>this.hoverTimeout&&(this.moving=!1),(this.scrolled||!this.moving&&!this.hovering)&&(this.scrolled=!1,-1!==this.hoverTimeout&&this.overElement&&(this.hovering=!0,this.signals.hovered.dispatch(e.x,e.y))),window.requestAnimationFrame(this._listen)},Nm.prototype._onMousewheel=function(t){var e=this;if(t.target===this.domElement&&this.handleScroll){t.preventDefault(),this._setKeys(t);var r=0;r=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:-t.deltaY/(t.deltaMode?.33:30),this.signals.scrolled.dispatch(r),setTimeout(function(){e.scrolled=!0},this.hoverTimeout)}},Nm.prototype._onMousemove=function(t){t.target===this.domElement?(t.preventDefault(),this.overElement=!0):this.overElement=!1,this._setKeys(t),this.moving=!0,this.hovering=!1,this.lastMoved=window.performance.now(),this.prevPosition.copy(this.position),this.position.set(t.clientX,t.clientY),this._setCanvasPosition(t);var e=this.prevPosition.x-this.position.x,r=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(e,r),this.pressed&&this.signals.dragged.dispatch(e,r)},Nm.prototype._onMousedown=function(t){t.target===this.domElement&&(t.preventDefault(),this._setKeys(t),this.moving=!1,this.hovering=!1,this.down.set(t.clientX,t.clientY),this.position.set(t.clientX,t.clientY),this.which=t.which,this.buttons=ra(t),this.pressed=!0,this._setCanvasPosition(t))},Nm.prototype._onMouseup=function(t){t.target===this.domElement&&t.preventDefault(),this._setKeys(t);var e=this.canvasPosition;this._distance()<4?(this.lastClicked=window.performance.now(),this.clickPending&&this.prevClickCP.distanceTo(e)<4?(this.signals.doubleClicked.dispatch(e.x,e.y),this.clickPending=!1,this.which=void 0,this.buttons=void 0,this.pressed=void 0):this.clickPending=!0,this.prevClickCP.copy(e)):(this.which=void 0,this.buttons=void 0,this.pressed=void 0)},Nm.prototype._onContextmenu=function(t){t.target===this.domElement&&t.preventDefault()},Nm.prototype._onTouchstart=function(t){if(t.target===this.domElement)switch(t.preventDefault(),this.pressed=!0,t.touches.length){case 1:this.moving=!1,this.hovering=!1,this.down.set(t.touches[0].pageX,t.touches[0].pageY),this.position.set(t.touches[0].pageX,t.touches[0].pageY),this._setCanvasPosition(t.touches[0]);break;case 2:this.down.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2),this.position.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2),this.lastTouchDistance=ea(t)}},Nm.prototype._onTouchend=function(t){t.target===this.domElement&&t.preventDefault(),this.which=void 0,this.buttons=void 0,this.pressed=void 0},Nm.prototype._onTouchmove=function(t){switch(t.target===this.domElement?(t.preventDefault(),this.overElement=!0):this.overElement=!1,t.touches.length){case 1:this._setKeys(t),this.which=1,this.buttons=1,this.moving=!0,this.hovering=!1,this.lastMoved=window.performance.now(),this.prevPosition.copy(this.position),this.position.set(t.touches[0].pageX,t.touches[0].pageY),this._setCanvasPosition(t.touches[0]);var e=this.prevPosition.x-this.position.x,r=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(e,r),this.pressed&&this.signals.dragged.dispatch(e,r);break;case 2:var i=ea(t),n=i-this.lastTouchDistance;if(this.lastTouchDistance=i,this.prevPosition.copy(this.position),this.position.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2),Math.abs(n)>2&&this.handleScroll&&this.position.distanceTo(this.prevPosition)<2)this.which=0,this.buttons=0,this.signals.scrolled.dispatch(n/2);else{this.which=3,this.buttons=2;var o=this.prevPosition.x-this.position.x,a=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(o,a),this.pressed&&this.signals.dragged.dispatch(o,a)}}},Nm.prototype._distance=function(){return this.position.distanceTo(this.down)},Nm.prototype._setCanvasPosition=function(t){var e,r,i=this.domElement.getBoundingClientRect();"offsetX"in t&&"offsetY"in t?(e=t.offsetX,r=t.offsetY):(e=t.clientX-i.left,r=t.clientY-i.top),this.canvasPosition.set(e,i.height-r)},Nm.prototype._setKeys=function(t){this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey},Nm.prototype.dispose=function(){document.removeEventListener("mousewheel",this._onMousewheel),document.removeEventListener("wheel",this._onMousewheel),document.removeEventListener("MozMousePixelScroll",this._onMousewheel),document.removeEventListener("mousemove",this._onMousemove),document.removeEventListener("mousedown",this._onMousedown),document.removeEventListener("mouseup",this._onMouseup),document.removeEventListener("contextmenu",this._onContextmenu),document.removeEventListener("touchstart",this._onTouchstart),document.removeEventListener("touchend",this._onTouchend),document.removeEventListener("touchmove",this._onTouchmove)},Object.defineProperties(Nm.prototype,km);var Fm=new v,Bm=new v,zm=new v,Um=new g,jm=new m,Gm=new v,Vm=new g,$m=new g,Hm=function(t,e){var r=e||{};this.rotateSpeed=gn(r.rotateSpeed,2),this.zoomSpeed=gn(r.zoomSpeed,1.2),this.panSpeed=gn(r.panSpeed,1),this.stage=t,this.viewer=t.viewer,this.mouse=t.mouseObserver,this.controls=t.viewerControls},Wm={component:{},atom:{}};Wm.component.get=function(){return this.stage.transformComponent},Wm.atom.get=function(){return this.stage.transformAtom},Hm.prototype._setPanVector=function(t,e,r){var i,n=this.viewer.camera;if(r=-r||0,r+=n.position.z,"OrthographicCamera"===n.type)i=1/n.zoom;else{var o=$n(n.fov);i=-2*r*Math.tan(o/2)/this.viewer.height}Vm.set(t,e,0),Vm.multiplyScalar(this.panSpeed*i)},Hm.prototype._getRotateXY=function(t,e){return[this.rotateSpeed*-t*.01,this.rotateSpeed*e*.01]},Hm.prototype._transformPanVector=function(){Gm.extractRotation(this.component.transform),Gm.premultiply(this.viewer.rotationGroup.matrix),Gm.getInverse(Gm),Vm.applyMatrix4(Gm)},Hm.prototype.zoom=function(t){this.controls.zoom(this.zoomSpeed*t*.02)},Hm.prototype.pan=function(t,e){this._setPanVector(t,e),Gm.getInverse(this.viewer.rotationGroup.matrix),Vm.applyMatrix4(Gm),this.controls.translate(Vm)},Hm.prototype.panComponent=function(t,e){this.component&&(this._setPanVector(t,e),this._transformPanVector(),this.component.position.add(Vm),this.component.updateMatrix())},Hm.prototype.panAtom=function(t,e){this.atom&&this.component&&(this.atom.positionToVector3($m),$m.add(this.viewer.translationGroup.position),$m.applyMatrix4(this.viewer.rotationGroup.matrix),this._setPanVector(t,e,$m.z),this._transformPanVector(),this.atom.positionAdd(Vm),this.component.updateRepresentations({position:!0}))},Hm.prototype.rotate=function(t,e){var r=this._getRotateXY(t,e),i=r[0],n=r[1];Fm.makeRotationX(n),Bm.makeRotationY(i),Fm.multiply(Bm),this.controls.applyMatrix(Fm)},Hm.prototype.rotateComponent=function(t,e){if(this.component){var r=this._getRotateXY(t,e),i=r[0],n=r[1];zm.extractRotation(this.component.transform),zm.premultiply(this.viewer.rotationGroup.matrix),zm.getInverse(zm),Um.set(1,0,0),Um.applyMatrix4(zm),Fm.makeRotationAxis(Um,n),Um.set(0,1,0),Um.applyMatrix4(zm),Bm.makeRotationAxis(Um,i),Fm.multiply(Bm),jm.setFromRotationMatrix(Fm),this.component.quaternion.premultiply(jm),this.component.updateMatrix()}},Object.defineProperties(Hm.prototype,Wm);var Xm=function(t,e){this.pid=t.pid,this.picker=t.picker,this.instance=t.instance,this.stage=e,this.controls=e.viewerControls,this.mouse=e.mouseObserver},qm={type:{},altKey:{},ctrlKey:{},metaKey:{},shiftKey:{},canvasPosition:{},component:{},object:{},position:{},closestBondAtom:{},arrow:{},atom:{},axes:{},bond:{},box:{},cone:{},clash:{},contact:{},cylinder:{},distance:{},ellipsoid:{},octahedron:{},mesh:{},slice:{},sphere:{},tetrahedron:{},torus:{},surface:{},unitcell:{},unknown:{},volume:{}};qm.type.get=function(){return this.picker.type},qm.altKey.get=function(){return this.mouse.altKey},qm.ctrlKey.get=function(){return this.mouse.ctrlKey},qm.metaKey.get=function(){return this.mouse.metaKey},qm.shiftKey.get=function(){return this.mouse.shiftKey},qm.canvasPosition.get=function(){return this.mouse.canvasPosition},qm.component.get=function(){return this.stage.getComponentsByObject(this.picker.data).list[0]},qm.object.get=function(){return this.picker.getObject(this.pid)},qm.position.get=function(){return this.picker.getPosition(this.pid,this.instance,this.component)},qm.closestBondAtom.get=function(){if("bond"===this.type){var t=this.bond,e=this.controls;return ia(this.canvasPosition,e.getPositionOnCanvas(t.atom1),e.getPositionOnCanvas(t.atom2))?t.atom1:t.atom2}},qm.arrow.get=function(){return this._objectIfType("arrow")},qm.atom.get=function(){return this._objectIfType("atom")},qm.axes.get=function(){return this._objectIfType("axes")},qm.bond.get=function(){return this._objectIfType("bond")},qm.box.get=function(){return this._objectIfType("box")},qm.cone.get=function(){return this._objectIfType("cone")},qm.clash.get=function(){return this._objectIfType("clash")},qm.contact.get=function(){return this._objectIfType("contact")},qm.cylinder.get=function(){return this._objectIfType("cylinder")},qm.distance.get=function(){return this._objectIfType("distance")},qm.ellipsoid.get=function(){return this._objectIfType("ellipsoid")},qm.octahedron.get=function(){return this._objectIfType("octahedron")},qm.mesh.get=function(){return this._objectIfType("mesh")},qm.slice.get=function(){return this._objectIfType("slice")},qm.sphere.get=function(){return this._objectIfType("sphere")},qm.tetrahedron.get=function(){return this._objectIfType("tetrahedron")},qm.torus.get=function(){return this._objectIfType("torus")},qm.surface.get=function(){return this._objectIfType("surface")},qm.unitcell.get=function(){return this._objectIfType("unitcell")},qm.unknown.get=function(){return this._objectIfType("unknown")},qm.volume.get=function(){return this._objectIfType("volume")},Xm.prototype._objectIfType=function(t){return this.type===t?this.object:void 0},Xm.prototype.getLabel=function(){var t="nothing";return this.arrow?t="arrow: "+(this.arrow.name||this.pid)+" ("+this.arrow.shape.name+")":this.atom?t="atom: "+this.atom.qualifiedName()+" ("+this.atom.structure.name+")":this.axes?t="axes":this.bond?t="bond: "+this.bond.atom1.qualifiedName()+" - "+this.bond.atom2.qualifiedName()+" ("+this.bond.structure.name+")":this.box?t="box: "+(this.box.name||this.pid)+" ("+this.box.shape.name+")":this.cone?t="cone: "+(this.cone.name||this.pid)+" ("+this.cone.shape.name+")":this.clash?t="clash: "+this.clash.clash.sele1+" - "+this.clash.clash.sele2:this.contact?t="contact: "+this.contact.atom1.qualifiedName()+" - "+this.contact.atom2.qualifiedName()+" ("+this.contact.structure.name+")":this.cylinder?t="cylinder: "+(this.cylinder.name||this.pid)+" ("+this.cylinder.shape.name+")":this.distance?t="distance: "+this.distance.atom1.qualifiedName()+" - "+this.distance.atom2.qualifiedName()+" ("+this.distance.structure.name+")":this.ellipsoid?t="ellipsoid: "+(this.ellipsoid.name||this.pid)+" ("+this.ellipsoid.shape.name+")":this.octahedron?t="octahedron: "+(this.octahedron.name||this.pid)+" ("+this.octahedron.shape.name+")":this.mesh?t="mesh: "+(this.mesh.name||this.mesh.serial)+" ("+this.mesh.shape.name+")":this.slice?t="slice: "+this.slice.value.toPrecision(3)+" ("+this.slice.volume.name+")":this.sphere?t="sphere: "+(this.sphere.name||this.pid)+" ("+this.sphere.shape.name+")":this.surface?t="surface: "+this.surface.surface.name:this.tetrahedron?t="tetrahedron: "+(this.tetrahedron.name||this.pid)+" ("+this.tetrahedron.shape.name+")":this.torus?t="torus: "+(this.torus.name||this.pid)+" ("+this.torus.shape.name+")":this.unitcell?t="unitcell: "+this.unitcell.unitcell.spacegroup+" ("+this.unitcell.structure.name+")":this.unknown?t="unknown":this.volume&&(t="volume: "+this.volume.value.toPrecision(3)+" ("+this.volume.volume.name+")"),t},Object.defineProperties(Xm.prototype,qm);var Ym=function(t){this.stage=t,this.viewer=t.viewer};Ym.prototype.pick=function(t,e){var r=this.viewer.pick(t,e);if(r.picker&&"ignore"!==r.picker.type&&void 0!==r.pid){var i=r.picker.array;if(!(i&&r.pid>=i.length))return new Xm(r,this.stage);console.error("pid >= picker.array.length")}};var Zm=new m,Km=new g,Qm=new g,Jm=new g,tg=new g,eg=new v,rg=new g,ig=new v,ng=function(t){this.stage=t,this.viewer=t.viewer,this.signals={changed:new no}},og={position:{},rotation:{}};og.position.get=function(){return this.viewer.translationGroup.position},og.rotation.get=function(){return this.viewer.rotationGroup.quaternion},ng.prototype.changed=function(){this.viewer.requestRender(),this.signals.changed.dispatch()},ng.prototype.getPositionOnCanvas=function(t,e){var r=Bn(e),i=this.viewer;return Jm.copy(t).add(i.translationGroup.position).applyMatrix4(i.rotationGroup.matrix).project(i.camera),r.set((Jm.x+1)*i.width/2,(Jm.y+1)*i.height/2)},ng.prototype.getOrientation=function(t){var e=Un(t);e.copy(this.viewer.rotationGroup.matrix);var r=-this.viewer.camera.position.z;return e.scale(tg.set(r,r,r)),e.setPosition(this.viewer.translationGroup.position),e},ng.prototype.orient=function(t){Un(t).decompose(Km,Zm,Qm);var e=this.viewer;e.rotationGroup.setRotationFromQuaternion(Zm),e.translationGroup.position.copy(Km),e.camera.position.z=-Qm.z,e.updateZoom(),this.changed()},ng.prototype.translate=function(t){this.viewer.translationGroup.position.add(zn(t)),this.changed()},ng.prototype.center=function(t){this.viewer.translationGroup.position.copy(zn(t)).negate(),this.changed()},ng.prototype.zoom=function(t){this.distance(this.viewer.camera.position.z*(1-t))},ng.prototype.distance=function(t){this.viewer.camera.position.z=t,this.viewer.updateZoom(),this.changed()},ng.prototype.spin=function(t,e){eg.getInverse(this.viewer.rotationGroup.matrix),rg.copy(zn(t)).applyMatrix4(eg),this.viewer.rotationGroup.rotateOnAxis(rg,e),this.changed()},ng.prototype.rotate=function(t){this.viewer.rotationGroup.setRotationFromQuaternion(jn(t)),this.changed()},ng.prototype.align=function(t){ig.getInverse(Un(t)),this.viewer.rotationGroup.setRotationFromMatrix(ig),this.changed()},ng.prototype.applyMatrix=function(t){this.viewer.rotationGroup.applyMatrix(Un(t)),this.changed()},Object.defineProperties(ng.prototype,og);var ag=function(t,e){for(var r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];this.duration=gn(t,1e3),this.controls=e,this.startTime=window.performance.now(),this.pausedTime=-1,this.elapsedDuration=0,this.pausedDuration=0,this.ignoreGlobalToggle=!1,this._paused=!1,this._resolveList=[],(n=this)._init.apply(n,r);var n},sg={done:{},paused:{}};sg.done.get=function(){return 1===this.alpha},sg.paused.get=function(){return this._paused},ag.prototype._init=function(){},ag.prototype._tick=function(){},ag.prototype.tick=function(t){if(!this._paused)return this.elapsedDuration=t.currentTime-this.startTime-this.pausedDuration,0===this.duration?this.alpha=1:this.alpha=to(0,1,this.elapsedDuration/this.duration),this._tick(t),this.done&&this._resolveList.forEach(function(t){return t()}),this.done},ag.prototype.pause=function(t){t&&(this._hold=!0),-1===this.pausedTime&&(this.pausedTime=window.performance.now()),this._paused=!0},ag.prototype.resume=function(t){!t&&this._hold||(this.pausedDuration+=window.performance.now()-this.pausedTime,this._paused=!1,this._hold=!1,this.pausedTime=-1)},ag.prototype.toggle=function(){this._paused?this.resume():this.pause()},ag.prototype.then=function(t){var e=this;return(this.done?Promise.resolve():new Promise(function(t){return e._resolveList.push(t)})).then(t)},Object.defineProperties(ag.prototype,sg);var cg=function(t){function e(e){for(var r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];t.apply(this,[gn(e,1/0)].concat(r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){Array.isArray(t)?this.axis=(new g).fromArray(t):this.axis=gn(t,new g(0,1,0)),this.angle=gn(e,.01)},e.prototype._tick=function(t){this.axis&&this.angle&&this.controls.spin(this.axis,this.angle*t.lastDuration/16)},e}(ag),ug=function(t){function e(e){for(var r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];t.apply(this,[gn(e,1/0)].concat(r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e,r){Array.isArray(t)?this.axis=(new g).fromArray(t):this.axis=gn(t,new g(0,1,0)),this.angleStep=gn(e,.01),this.angleEnd=gn(r,.2),this.angleSum=0,this.direction=1},e.prototype._tick=function(t){if(this.axis&&this.angleStep&&this.angleEnd){var e=to(0,1,Math.abs(this.angleSum)/this.angleEnd),r=this.angleStep*this.direction*(1.1-e);this.controls.spin(this.axis,r*t.lastDuration/16),this.angleSum+=this.angleStep,this.angleSum>=this.angleEnd&&(this.direction*=-1,this.angleSum=-this.angleEnd)}},e}(ag),hg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.moveFrom=zn(gn(t,new g)),this.moveTo=zn(gn(e,new g))},e.prototype._tick=function(){this.controls.position.lerpVectors(this.moveFrom,this.moveTo,this.alpha).negate(),this.controls.changed()},e}(ag),lg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.zoomFrom=t,this.zoomTo=e},e.prototype._tick=function(){this.controls.distance(Qn(this.zoomFrom,this.zoomTo,this.alpha))},e}(ag),pg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.rotateFrom=jn(t),this.rotateTo=jn(e),this._currentRotation=new m},e.prototype._tick=function(){this._currentRotation.copy(this.rotateFrom).slerp(this.rotateTo,this.alpha),this.controls.rotate(this._currentRotation)},e}(ag),dg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e,r){this.valueFrom=t,this.valueTo=e,this.callback=r},e.prototype._tick=function(){this.callback(Qn(this.valueFrom,this.valueTo,this.alpha))},e}(ag),fg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t){this.callback=t},e.prototype._tick=function(){1===this.alpha&&this.callback()},e}(ag),mg=function(t){this._list=t||[],this._resolveList=[]},gg={done:{}};gg.done.get=function(){return this._list.every(function(t){return t.done})},mg.prototype.then=function(t){var e=this;return(this.done?Promise.resolve():new Promise(function(t){e._resolveList.push(t),e._list.forEach(function(t){t.then(function(){e._resolveList.forEach(function(t){t()}),e._resolveList.length=0})})})).then(t)},Object.defineProperties(mg.prototype,gg);var vg=function(t){this.stage=t,this.viewer=t.viewer,this.controls=t.viewerControls,this.animationList=[],this.finishedList=[]},yg={paused:{}};yg.paused.get=function(){return this.animationList.every(function(t){return t.paused})},vg.prototype.add=function(t){return 0===t.duration?t.tick(this.viewer.stats):this.animationList.push(t),t},vg.prototype.remove=function(t){var e=this.animationList,r=e.indexOf(t);r>-1&&e.splice(r,1)},vg.prototype.run=function(t){for(var e=this,r=this.finishedList,i=this.animationList,n=i.length,o=0;o<n;++o){var a=i[o];a.tick(t)&&r.push(a)}var s=r.length;if(s){for(var c=0;c<s;++c)e.remove(r[c]);r.length=0}},vg.prototype.spin=function(t,e,r){return this.add(new cg(r,this.controls,t,e))},vg.prototype.rock=function(t,e,r,i){return this.add(new ug(i,this.controls,t,e,r))},vg.prototype.rotate=function(t,e){var r=this.viewer.rotationGroup.quaternion.clone();return this.add(new pg(e,this.controls,r,t))},vg.prototype.move=function(t,e){var r=this.controls.position.clone().negate();return this.add(new hg(e,this.controls,r,t))},vg.prototype.zoom=function(t,e){var r=this.viewer.camera.position.z;return this.add(new lg(e,this.controls,r,t))},vg.prototype.zoomMove=function(t,e,r){return new mg([this.move(t,r),this.zoom(e,r)])},vg.prototype.orient=function(t,e){var r=new g,i=new m,n=new g;return Un(t).decompose(r,i,n),new mg([this.move(r.negate(),e),this.rotate(i,e),this.zoom(-n.x,e)])},vg.prototype.value=function(t,e,r,i){return this.add(new dg(i,this.controls,t,e,r))},vg.prototype.timeout=function(t,e){return this.add(new fg(e,this.controls,t))},vg.prototype.spinComponent=function(t,e,r,i){return this.add(new cg(i,t.controls,e,r))},vg.prototype.rockComponent=function(t,e,r,i,n){return this.add(new ug(n,t.controls,e,r,i))},vg.prototype.moveComponent=function(t,e,r){var i=t.controls.position.clone().negate();return this.add(new hg(r,t.controls,i,e))},vg.prototype.pause=function(){this.animationList.forEach(function(t){return t.pause()})},vg.prototype.resume=function(){this.animationList.forEach(function(t){return t.resume()})},vg.prototype.toggle=function(){this.paused?this.resume():this.pause()},vg.prototype.clear=function(){this.animationList.length=0},vg.prototype.dispose=function(){this.clear()},Object.defineProperties(vg.prototype,yg);var bg=function(){};bg.zoomScroll=function(t,e){t.trackballControls.zoom(e)},bg.clipNearScroll=function(t,e){var r=t.getParameters();t.setParameters({clipNear:r.clipNear+e/10})},bg.focusScroll=function(t,e){var r=2*t.getParameters().clipNear,i=Math.sign(e)*eo((100-r)/10,5,.2);t.setFocus(r+i)},bg.isolevelScroll=function(t,e){var r=Math.sign(e)/5;t.eachRepresentation(function(t){if("surface"===t.repr.type){var e=t.getParameters().isolevel;t.setParameters({isolevel:e+r})}},"volume")},bg.panDrag=function(t,e,r){t.trackballControls.pan(e,r)},bg.rotateDrag=function(t,e,r){t.trackballControls.rotate(e,r)},bg.zoomDrag=function(t,e,r){t.trackballControls.zoom((e+r)/-2)},bg.zoomFocusDrag=function(t,e,r){t.trackballControls.zoom((e+r)/-2);var i=t.viewer.camera.position.z;t.setFocus(100-Math.abs(i/8))},bg.panComponentDrag=function(t,e,r){t.trackballControls.panComponent(e,r)},bg.panAtomDrag=function(t,e,r){t.trackballControls.panAtom(e,r)},bg.rotateComponentDrag=function(t,e,r){t.trackballControls.rotateComponent(e,r)},bg.movePick=function(t,e){e&&t.animationControls.move(e.position.clone())},bg.tooltipPick=function(t,e){var r=t.tooltip;if(t.getParameters().tooltip&&e){var i=e.mouse.position;r.innerText=e.getLabel(),r.style.bottom=window.innerHeight-i.y+3+"px",r.style.left=i.x+3+"px",r.style.display="block"}else r.style.display="none"};var xg={default:[["scroll",bg.zoomScroll],["scroll-ctrl",bg.clipNearScroll],["scroll-shift",bg.focusScroll],["scroll-alt",bg.isolevelScroll],["drag-right",bg.panDrag],["drag-left",bg.rotateDrag],["drag-middle",bg.zoomDrag],["drag-shift-right",bg.zoomDrag],["drag-left+right",bg.zoomDrag],["drag-ctrl-right",bg.panComponentDrag],["drag-ctrl-left",bg.rotateComponentDrag],["clickPick-middle",bg.movePick],["hoverPick",bg.tooltipPick]],pymol:[["drag-left",bg.rotateDrag],["drag-middle",bg.panDrag],["drag-right",bg.zoomDrag],["drag-shift-right",bg.focusScroll],["clickPick-ctrl+shift-middle",bg.movePick],["hoverPick",bg.tooltipPick]],coot:[["scroll",bg.isolevelScroll],["drag-left",bg.rotateDrag],["drag-middle",bg.panDrag],["drag-ctrl-left",bg.panDrag],["drag-right",bg.zoomFocusDrag],["drag-ctrl-right",bg.focusScroll],["clickPick-middle",bg.movePick],["hoverPick",bg.tooltipPick]]},_g=function(t,e){var r=e||{};this.stage=t,this.mouse=t.mouseObserver,this.actionList=[],this.disabled=r.disabled||!1,this.preset(r.preset||"default")};_g.prototype.run=function(t){for(var e=this,r=[],i=arguments.length-1;i-- >0;)r[i]=arguments[i+1];if(!this.disabled){var n=this.mouse.key||0,o=this.mouse.buttons||0;this.actionList.forEach(function(i){i.type===t&&i.key===n&&i.button===o&&i.callback.apply(i,[e.stage].concat(r))})}},_g.prototype.add=function(t,e){var r=na(t),i=r[0],n=r[1],o=r[2];this.actionList.push({type:i,key:n,button:o,callback:e})},_g.prototype.remove=function(t,e){var r=t.includes("*"),i=na(t),n=i[0],o=i[1],a=i[2],s=this.actionList.filter(function(t){return!((t.type===n||r&&""===n)&&(t.key===o||r&&0===o)&&(t.button===a||r&&0===a)&&(t.callback===e||void 0===e))});this.actionList=s},_g.prototype.preset=function(t){var e=this;this.clear(),(xg[t]||[]).forEach(function(t){return(r=e).add.apply(r,t);var r})},_g.prototype.clear=function(){this.actionList.length=0};var wg=function(){};wg.toggleSpin=function(t){t.toggleSpin()},wg.toggleRock=function(t){t.toggleRock()},wg.toggleAnimations=function(t){t.animationControls.toggle()};var Sg={default:[["i",wg.toggleSpin],["k",wg.toggleRock],["p",wg.toggleAnimations]]},Ag=function(t,e){var r=e||{};this.stage=t,this.actionList=[],this.disabled=r.disabled||!1,this.preset(r.preset||"default")};Ag.prototype.run=function(t){var e=this;this.disabled||this.actionList.forEach(function(r){r.keyCode===t&&r.callback(e.stage)})},Ag.prototype.add=function(t,e){var r=t.charCodeAt(0);this.actionList.push({keyCode:r,callback:e})},Ag.prototype.remove=function(t,e){var r=t.charCodeAt(0),i=this.actionList.filter(function(t){return!(t.keyCode===r&&(t.callback===e||void 0===e))});this.actionList=i},Ag.prototype.preset=function(t){var e=this;this.clear(),(Sg[t]||[]).forEach(function(t){return(r=e).add.apply(r,t);var r})},Ag.prototype.clear=function(){this.actionList.length=0};var Mg=function(t){this.stage=t,this.mouse=t.mouseObserver,this.controls=t.mouseControls,this.mouse.signals.clicked.add(this._onClick,this),this.mouse.signals.hovered.add(this._onHover,this)};Mg.prototype._onClick=function(t,e){var r=this.stage.pickingControls.pick(t,e);this.stage.signals.clicked.dispatch(r),this.controls.run("clickPick",r)},Mg.prototype._onHover=function(t,e){var r=this.stage.pickingControls.pick(t,e);r&&this.mouse.down.equals(this.mouse.position)&&(this.stage.transformComponent=r.component,this.stage.transformAtom=r.atom),this.stage.signals.hovered.dispatch(r),this.controls.run("hoverPick",r)},Mg.prototype.dispose=function(){this.mouse.signals.clicked.remove(this._onClick,this),this.mouse.signals.hovered.remove(this._onHover,this)};var Tg=function(t){this.stage=t,this.mouse=t.mouseObserver,this.controls=t.mouseControls,this.mouse.signals.moved.add(this._onMove,this),this.mouse.signals.scrolled.add(this._onScroll,this),this.mouse.signals.dragged.add(this._onDrag,this),this.mouse.signals.clicked.add(this._onClick,this),this.mouse.signals.hovered.add(this._onHover,this),this.mouse.signals.doubleClicked.add(this._onDblclick,this)};Tg.prototype._onMove=function(){this.stage.tooltip.style.display="none"},Tg.prototype._onScroll=function(t){this.controls.run("scroll",t)},Tg.prototype._onDrag=function(t,e){this.controls.run("drag",t,e)},Tg.prototype._onClick=function(t,e){this.controls.run("click",t,e)},Tg.prototype._onDblclick=function(t,e){this.controls.run("doubleClick",t,e)},Tg.prototype._onHover=function(t,e){this.controls.run("hover",t,e)},Tg.prototype.dispose=function(){this.mouse.signals.moved.remove(this._onMove,this),this.mouse.signals.scrolled.remove(this._onScroll,this),this.mouse.signals.dragged.remove(this._onDrag,this),this.mouse.signals.clicked.remove(this._onClick,this),this.mouse.signals.hovered.remove(this._onHover,this)};var Eg=function(t){this.viewer=t.viewer,this.animationControls=t.animationControls,this.viewer.signals.ticked.add(this._onTick,this)};Eg.prototype._onTick=function(t){this.animationControls.run(t)},Eg.prototype.dispose=function(){this.viewer.signals.ticked.remove(this._onTick,this)};var Pg=function(t){this.stage=t,this.controls=t.keyControls,this.domElement=t.viewer.renderer.domElement,this.domElement.setAttribute("tabIndex","-1"),this.domElement.style.outline="none",this.domElement.autofocus=!0,this.domElement.focus(),this._focusDomElement=this._focusDomElement.bind(this),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this),this._onKeypress=this._onKeypress.bind(this),this.domElement.addEventListener("mousedown",this._focusDomElement),this.domElement.addEventListener("touchstart",this._focusDomElement),this.domElement.addEventListener("keydown",this._onKeydown),this.domElement.addEventListener("keyup",this._onKeyup),this.domElement.addEventListener("keypress",this._onKeypress)};Pg.prototype._onKeydown=function(){},Pg.prototype._onKeyup=function(){},Pg.prototype._onKeypress=function(t){this.controls.run(t.keyCode)},Pg.prototype._focusDomElement=function(){this.domElement.focus()},Pg.prototype.dispose=function(){this.domElement.removeEventListener("mousedown",this._focusDomElement),this.domElement.removeEventListener("touchstart",this._focusDomElement),this.domElement.removeEventListener("keydown",this._onKeypress),this.domElement.removeEventListener("keyup",this._onKeypress),this.domElement.removeEventListener("keypress",this._onKeypress)};var Cg=function(t,e,r,i){var n=i||{};this.offsetX=gn(n.offsetX,0),this.offsetY=gn(n.offsetY,0),this.visible=gn(n.visible,!0),this.component=t,this.stage=t.stage,this.viewer=this.stage.viewer,this.position=e,this._viewerPosition=new g,this._updateViewerPosition(),this._canvasPosition=new g,this._cameraPosition=new g,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"block",position:"fixed",zIndex:1+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif",left:"-10000px"}),this.viewer.container.appendChild(this.element),this.setContent(r),this.updateVisibility(),this.viewer.signals.ticked.add(this._update,this),this.component.signals.matrixChanged.add(this._updateViewerPosition,this)};Cg.prototype.setContent=function(t){var e=this.element.style.display;"none"===e&&(this.element.style.left="-10000px",this.element.style.display="block"),t instanceof window.Element?(this.element.innerHTML="",this.element.appendChild(t)):this.element.innerHTML=t,this._clientRect=this.element.getBoundingClientRect(),"none"===e&&(this.element.style.display=e)},Cg.prototype.setVisibility=function(t){this.visible=t,this.updateVisibility()},Cg.prototype.getVisibility=function(){return this.visible&&this.component.visible},Cg.prototype.updateVisibility=function(){this.element.style.display=this.getVisibility()?"block":"none"},Cg.prototype._updateViewerPosition=function(){this._viewerPosition.copy(this.position).applyMatrix4(this.component.matrix)},Cg.prototype._update=function(){if(this.getVisibility()){var t=this.element.style,e=this._canvasPosition,r=this._viewerPosition,i=this._clientRect;this._cameraPosition.copy(r).add(this.viewer.translationGroup.position).applyMatrix4(this.viewer.rotationGroup.matrix).sub(this.viewer.camera.position),this._cameraPosition.z<0?t.display="none":(t.display="block",t.opacity=1-to(this.viewer.scene.fog.near,this.viewer.scene.fog.far,this._cameraPosition.length()),this.stage.viewerControls.getPositionOnCanvas(r,e),t.bottom=this.offsetX+e.y+i.height/2+"px",t.left=this.offsetY+e.x-i.width/2+"px")}},Cg.prototype.dispose=function(){this.viewer.container.removeChild(this.element),this.viewer.signals.ticked.remove(this._update,this),this.component.signals.matrixChanged.remove(this._updateViewerPosition,this)};var Ig=new v,Rg=new g,Lg=new m,Og=function(t){this.component=t,this.stage=t.stage,this.viewer=t.stage.viewer,this.signals={changed:new no}},Dg={position:{},rotation:{}};Dg.position.get=function(){return this.component.position},Dg.rotation.get=function(){return this.component.quaternion},Og.prototype.changed=function(){this.component.updateMatrix(),this.viewer.requestRender(),this.signals.changed.dispatch()},Og.prototype.spin=function(t,e){Ig.getInverse(this.viewer.rotationGroup.matrix),Rg.copy(zn(t)).applyMatrix4(Ig),Ig.extractRotation(this.component.transform),Ig.premultiply(this.viewer.rotationGroup.matrix),Ig.getInverse(Ig),Rg.copy(zn(t)),Rg.applyMatrix4(Ig),Ig.makeRotationAxis(Rg,e),Lg.setFromRotationMatrix(Ig),this.component.quaternion.premultiply(Lg),this.changed()},Object.defineProperties(Og.prototype,Dg),ga.__deps=[va],ya.__deps=[va,ma];var Ng=new g,kg=function(){},Fg={Picker:{},Buffer:{}};Fg.Picker.get=function(){return Qf.get(this.type)},Fg.Buffer.get=function(){return Kf.get(this.type)},kg.getShapeKey=function(t){return this.type+t[0].toUpperCase()+t.substr(1)},kg.valueToShape=function(t,e,r){var i=t[this.getShapeKey(e)];switch(this.fields[e]){case"v3":case"c":Aa(r,i);break;default:i.push(r)}},kg.objectToShape=function(t,e){var r=this;Object.keys(this.fields).forEach(function(i){r.valueToShape(t,i,e[i])}),this.valueToShape(t,"name",e.name),this.expandBoundingBox(t.boundingBox,e)},kg.valueFromShape=function(t,e,r){var i=t[this.getShapeKey(r)];switch(this.fields[r]){case"v3":return(new g).fromArray(i,3*e);case"c":return(new tt).fromArray(i,3*e);default:return i[e]}},kg.objectFromShape=function(t,e){var r=this,i={shape:t,name:this.valueFromShape(t,e,"name")};return Object.keys(this.fields).forEach(function(n){i[n]=r.valueFromShape(t,e,n)}),i},kg.arrayFromShape=function(t,e){var r=t[this.getShapeKey(e)];switch(this.fields[e]){case"s":return r;default:return new Float32Array(r)}},kg.dataFromShape=function(t){var e=this,r={};return this.Picker&&(r.picking=new this.Picker(t)),Object.keys(this.fields).forEach(function(i){r[i]=e.arrayFromShape(t,i)}),r},kg.bufferFromShape=function(t,e){return new this.Buffer(this.dataFromShape(t),e)},Object.defineProperties(kg,Fg);var Bg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},fields:{}};return r.type.get=function(){return"sphere"},r.fields.get=function(){return{position:"v3",color:"c",radius:"f"}},e.positionFromShape=function(t,e){return this.valueFromShape(t,e,"position")},e.expandBoundingBox=function(t,e){t.expandByPoint(Ng.fromArray(e.position))},Object.defineProperties(e,r),e}(kg),zg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},fields:{}};return r.type.get=function(){return"box"},r.fields.get=function(){return{position:"v3",color:"c",size:"f",heightAxis:"v3",depthAxis:"v3"}},Object.defineProperties(e,r),e}(Bg),Ug=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"octahedron"},Object.defineProperties(e,r),e}(zg),jg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"tetrahedron"},Object.defineProperties(e,r),e}(zg),Gg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},fields:{}};return r.type.get=function(){return"cylinder"},r.fields.get=function(){return{position1:"v3",position2:"v3",color:"c",radius:"f"}},e.positionFromShape=function(t,e){var r=this.valueFromShape(t,e,"position1"),i=this.valueFromShape(t,e,"position2");return r.add(i).multiplyScalar(.5)},e.expandBoundingBox=function(t,e){t.expandByPoint(Ng.fromArray(e.position1)),t.expandByPoint(Ng.fromArray(e.position2))},Object.defineProperties(e,r),e}(kg),Vg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"arrow"},Object.defineProperties(e,r),e}(Gg),$g=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"cone"},Object.defineProperties(e,r),e}(Gg),Hg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},fields:{}};return r.type.get=function(){return"ellipsoid"},r.fields.get=function(){return{position:"v3",color:"c",radius:"f",majorAxis:"v3",minorAxis:"v3"}},Object.defineProperties(e,r),e}(Bg),Wg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"torus"},Object.defineProperties(e,r),e}(Hg),Xg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},fields:{}};return r.type.get=function(){return"text"},r.fields.get=function(){return{position:"v3",color:"c",size:"f",text:"s"}},Object.defineProperties(e,r),e}(Bg),qg=function(t){this.array=t};qg.prototype.getIndex=function(t){return this.array?this.array[t]:t},qg.prototype.getObject=function(){return{}},qg.prototype._applyTransformations=function(t,e,r){return e&&t.applyMatrix4(e.matrix),r&&t.applyMatrix4(r.matrix),t},qg.prototype._getPosition=function(){return new g},qg.prototype.getPosition=function(t,e,r){return this._applyTransformations(this._getPosition(t),e,r)};var Yg=function(t){function e(e){t.call(this),this.shape=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{},data:{},type:{}};return r.primitive.get=function(){},r.data.get=function(){return this.shape},r.type.get=function(){return this.primitive.type},e.prototype.getObject=function(t){return this.primitive.objectFromShape(this.shape,t)},e.prototype._getPosition=function(t){return this.primitive.positionFromShape(this.shape,t)},Object.defineProperties(e.prototype,r),e}(qg),Zg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Gg},Object.defineProperties(e.prototype,r),e}(Yg),Kg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Vg},Object.defineProperties(e.prototype,r),e}(Yg),Qg=function(t){function e(e,r){t.call(this,e),this.structure=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"atom"},r.data.get=function(){return this.structure},e.prototype.getObject=function(t){return this.structure.getAtomProxy(this.getIndex(t))},e.prototype._getPosition=function(t){return(new g).copy(this.getObject(t))},Object.defineProperties(e.prototype,r),e}(qg),Jg=function(t){function e(e){t.call(this),this.axes=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"axes"},r.data.get=function(){return this.axes},e.prototype.getObject=function(){return{axes:this.axes}},e.prototype._getPosition=function(){return this.axes.center.clone()},Object.defineProperties(e.prototype,r),e}(qg),tv=function(t){function e(e,r,i){t.call(this,e),this.structure=r,this.bondStore=i||r.bondStore}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"bond"},r.data.get=function(){return this.structure},e.prototype.getObject=function(t){var e=this.structure.getBondProxy(this.getIndex(t));return e.bondStore=this.bondStore,e},e.prototype._getPosition=function(t){var e=this.getObject(t);return(new g).copy(e.atom1).add(e.atom2).multiplyScalar(.5)},Object.defineProperties(e.prototype,r),e}(qg),ev=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"contact"},Object.defineProperties(e.prototype,r),e}(tv),rv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return $g},Object.defineProperties(e.prototype,r),e}(Yg),iv=function(t){function e(e,r,i){t.call(this,e),this.validation=r,this.structure=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"clash"},r.data.get=function(){return this.validation},e.prototype.getObject=function(t){var e=this.validation,r=this.getIndex(t);return{validation:e,index:r,clash:e.clashArray[r]}},e.prototype._getAtomProxyFromSele=function(t){var e=new Pf(t),r=this.structure.getAtomIndices(e)[0];return this.structure.getAtomProxy(r)},e.prototype._getPosition=function(t){var e=this.getObject(t).clash,r=this._getAtomProxyFromSele(e.sele1),i=this._getAtomProxyFromSele(e.sele2);return(new g).copy(r).add(i).multiplyScalar(.5)},Object.defineProperties(e.prototype,r),e}(qg),nv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"distance"},Object.defineProperties(e.prototype,r),e}(tv),ov=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Hg},Object.defineProperties(e.prototype,r),e}(Yg),av=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Ug},Object.defineProperties(e.prototype,r),e}(Yg),sv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return zg},Object.defineProperties(e.prototype,r),e}(Yg),cv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"ignore"},Object.defineProperties(e.prototype,r),e}(qg),uv=function(t){function e(e,r){t.call(this,e),this.mesh=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"mesh"},e.prototype.getObject=function(){var t=this.mesh;return{shape:this.shape,name:t.name,serial:t.serial}},e.prototype._getPosition=function(){return this.__position||(this.__position=oa(this.mesh.position)),this.__position},Object.defineProperties(e.prototype,r),e}(Yg),hv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Bg},Object.defineProperties(e.prototype,r),e}(Yg),lv=function(t){function e(e,r){t.call(this,e),this.surface=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"surface"},r.data.get=function(){return this.surface},e.prototype.getObject=function(t){return{surface:this.surface,index:this.getIndex(t)}},e.prototype._getPosition=function(){return this.surface.center.clone()},Object.defineProperties(e.prototype,r),e}(qg),pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return jg},Object.defineProperties(e.prototype,r),e}(Yg),dv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={primitive:{}};return r.primitive.get=function(){return Wg},Object.defineProperties(e.prototype,r),e}(Yg),fv=function(t){function e(e,r){t.call(this),this.unitcell=e,this.structure=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"unitcell"},r.data.get=function(){return this.unitcell},e.prototype.getObject=function(){return{unitcell:this.unitcell,structure:this.structure}},e.prototype._getPosition=function(){return this.unitcell.getCenter(this.structure)},Object.defineProperties(e.prototype,r),e}(qg),mv=(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};r.type.get=function(){return"unknown"},Object.defineProperties(e.prototype,r)}(qg),function(t){function e(e,r){t.call(this,e),this.volume=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},data:{}};return r.type.get=function(){return"volume"},r.data.get=function(){return this.volume},e.prototype.getObject=function(t){var e=this.volume,r=this.getIndex(t);return{volume:e,index:r,value:e.data[r]}},e.prototype._getPosition=function(t){var e=this.volume.position,r=this.getIndex(t);return new g(e[3*r],e[3*r+1],e[3*r+2])},Object.defineProperties(e.prototype,r),e}(qg)),gv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"slice"},Object.defineProperties(e.prototype,r),e}(mv);Qf.add("arrow",Kg),Qf.add("box",sv),Qf.add("cone",rv),Qf.add("cylinder",Zg),Qf.add("ellipsoid",ov),Qf.add("octahedron",av),Qf.add("sphere",hv),Qf.add("tetrahedron",pv),Qf.add("torus",dv);var vv=function(t,e){this.length=t,this._words=new Uint32Array(t+32>>>5),!0===e&&this.setAll()};vv.prototype.get=function(t){return 0!=(this._words[t>>>5]&1<<t)},vv.prototype.set=function(t){this._words[t>>>5]|=1<<t},vv.prototype.clear=function(t){this._words[t>>>5]&=~(1<<t)},vv.prototype.flip=function(t){this._words[t>>>5]^=1<<t},vv.prototype._assignRange=function(t,e,r){for(var i=this._words,n=!0===r?4294967295:0,o=t>>>5,a=e>>>5,s=o;s<a;++s)i[s]=n;var c=o<<5,u=a<<5;if(!0===r)if(e-t<32)for(var h=t,l=e+1;h<l;++h)i[h>>>5]|=1<<h;else{for(var p=t,d=c;p<d;++p)i[p>>>5]|=1<<p;for(var f=u,m=e+1;f<m;++f)i[f>>>5]|=1<<f}else if(e-t<32)for(var g=t,v=e+1;g<v;++g)i[g>>>5]&=~(1<<g);else{for(var y=t,b=c;y<b;++y)i[y>>>5]&=~(1<<y);for(var x=u,_=e+1;x<_;++x)i[x>>>5]&=~(1<<x)}return this},vv.prototype.setRange=function(t,e){return this._assignRange(t,e,!0)},vv.prototype.clearRange=function(t,e){return this._assignRange(t,e,!1)},vv.prototype.setBits=function(){for(var t=arguments,e=this._words,r=arguments.length,i=0;i<r;++i){var n=t[i];e[n>>>5]|=1<<n}return this},vv.prototype.clearBits=function(){for(var t=arguments,e=this._words,r=arguments.length,i=0;i<r;++i){var n=t[i];e[n>>>5]&=~(1<<n)}return this},vv.prototype.setAll=function(){return this._assignRange(0,this.length-1,!0)},vv.prototype.clearAll=function(){return this._assignRange(0,this.length-1,!1)},vv.prototype.flipAll=function(){for(var t=this._words.length,e=this._words,r=32-this.length%32,i=0;i<t-1;++i)e[i]=~e[i];return e[t-1]=~(e[t-1]<<r)>>>r,this},vv.prototype._isRangeValue=function(t,e,r){for(var i=this._words,n=!0===r?4294967295:0,o=t>>>5,a=e>>>5,s=o;s<a;++s)if(i[s]!==n)return!1;if(e-t<32){for(var c=t,u=e+1;c<u;++c)if(!!(i[c>>>5]&1<<c)!==r)return!1}else{for(var h=a<<5,l=t,p=o<<5<<5;l<p;++l)if(!!(i[l>>>5]&1<<l)!==r)return!1;for(var d=h,f=e+1;d<f;++d)if(!!(i[d>>>5]&1<<d)!==r)return!1}return!0},vv.prototype.isRangeSet=function(t,e){return this._isRangeValue(t,e,!0)},vv.prototype.isRangeClear=function(t,e){return this._isRangeValue(t,e,!1)},vv.prototype.isAllSet=function(){return this._isRangeValue(0,this.length-1,!0)},vv.prototype.isAllClear=function(){return this._isRangeValue(0,this.length-1,!1)},vv.prototype.isSet=function(){for(var t=arguments,e=this._words,r=arguments.length,i=0;i<r;++i){var n=t[i];if(0==(e[n>>>5]&1<<n))return!1}return!0},vv.prototype.isClear=function(){for(var t=arguments,e=this._words,r=arguments.length,i=0;i<r;++i){var n=t[i];if(0!=(e[n>>>5]&1<<n))return!1}return!0},vv.prototype.isEqualTo=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0;n<i;++n)if(e[n]!==r[n])return!1;return!0},vv.prototype.getSize=function(){for(var t=this._words.length,e=this._words,r=0,i=0;i<t;++i)r+=Ma(e[i]);return r},vv.prototype.difference=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0;n<i;++n)e[n]=e[n]&~r[n];for(var o=e.length;o<i;++o)e[o]=0;return this},vv.prototype.union=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0;n<i;++n)e[n]|=r[n];for(var o=e.length;o<i;++o)e[o]=0;return this},vv.prototype.intersection=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0;n<i;++n)e[n]&=r[n];for(var o=e.length;o<i;++o)e[o]=0;return this},vv.prototype.intersects=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0;n<i;++n)if(0!=(e[n]&r[n]))return!0;return!1},vv.prototype.getIntersectionSize=function(t){for(var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=0,o=0;o<i;++o)n+=Ma(e[o]&r[o]);return n},vv.prototype.makeIntersection=function(t){var e=this._words,r=t._words,i=Math.min(e.length,r.length),n=new Uint32Array(i),o=Object.create(vv.prototype);o._words=n,o.length=Math.min(this.length,t.length);for(var a=0;a<i;++a)n[a]=e[a]&r[a];return o},vv.prototype.forEach=function(t){for(var e=this._words.length,r=this._words,i=0,n=0;n<e;++n)for(var o=r[n];0!==o;){var a=o&-o;t((n<<5)+Ma(a-1),i),o^=a,++i}},vv.prototype.toArray=function(){for(var t=this._words,e=new Array(this.getSize()),r=this._words.length,i=0,n=0;n<r;++n)for(var o=t[n];0!==o;){var a=o&-o;e[i++]=(n<<5)+Ma(a-1),o^=a}return e},vv.prototype.toString=function(){return"{"+this.toArray().join(",")+"}"},vv.prototype.toSeleString=function(){var t=this.toArray().join(",");return t?"@"+t:"NONE"},vv.prototype.clone=function(){var t=Object.create(vv.prototype);return t.length=this.length,t._words=new Uint32Array(this._words),t};var yv=0,bv=1,xv=2,_v=3,wv=4,Sv=0,Av=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],Mv=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],Tv=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],Ev=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],Pv=["OTHER"],Cv=["NON-POLYMER"].concat(Pv,Ev),Iv=["h","g","i"],Rv=["e","b"],Lv=["s","t","l",""],Ov={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73,AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},Dv={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},Nv={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},kv=[0,0,0],Fv={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},Bv=Object.keys(Fv),zv=["A","C","T","G","U"],Uv=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],jv=["A","G","DA","DG"],Gv=["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP3","TIP4"],Vv=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3","OHX"],$v=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],Hv=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","HN","BB"],Wv=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],Xv={};Xv[1]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},Xv[2]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Xv[3]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Xv[4]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},Xv[5]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},Xv[6]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},Xv[Sv]={},Ta.prototype={constructor:Ta,atomRadius:function(t){var e,r=this.type,i=this.scale;switch(r){case"vdw":e=Ov[t.element]||2;break;case"covalent":e=Dv[t.element]||1.6;break;case"bfactor":e=t.bfactor||1;break;case"sstruc":var n=t.sstruc;e="h"===n?.25:"g"===n?.25:"i"===n?.25:"e"===n?.25:"b"===n?.25:Wv.includes(t.atomname)?.4:.1;break;default:e=r||1}return Math.min(e*i,this.max)}},Ta.types={"":"",vdw:"by vdW radius",covalent:"by covalent radius",sstruc:"by secondary structure",bfactor:"by bfactor",size:"size"},Ea.prototype={copyTo:function(t){t.data.set(this.data)}};var qv=1.192092896e-7,Yv=1e-37;Va.__deps=[ja],$a.__deps=[ja],Ha.__deps=[ja],Xa.__deps=[la,pa];var Zv=new g(-1,-1,-1),Kv=new v,Qv=function(t){var e=t.rows,r=e/3,i=new Ea(e,3),n=new Ea(3,3),o=new Ea(1,3),a=new Ea(3,3),s=new Ea(3,3),c=Oa(t);Da(t,c),Pa(i,t),Ca(n,i,i),za(n,o,a,s);var u=new g(c[0],c[1],c[2]),h=new g(a.data[0],a.data[3],a.data[6]),l=new g(a.data[1],a.data[4],a.data[7]),p=new g(a.data[2],a.data[5],a.data[8]),d=h.clone().multiplyScalar(Math.sqrt(o.data[0]/r)),f=l.clone().multiplyScalar(Math.sqrt(o.data[1]/r)),m=p.clone().multiplyScalar(Math.sqrt(o.data[2]/r));this.begA=u.clone().sub(d),this.endA=u.clone().add(d),this.begB=u.clone().sub(f),this.endB=u.clone().add(f),this.begC=u.clone().sub(m),this.endC=u.clone().add(m),this.center=u,this.vecA=d,this.vecB=f,this.vecC=m,this.normVecA=h,this.normVecB=l,this.normVecC=p};Qv.prototype.getBasisMatrix=function(t){var e=t||new v;return e.makeBasis(this.normVecB,this.normVecA,this.normVecC),e.determinant()<0&&e.scale(Zv),e},Qv.prototype.getRotationQuaternion=function(t){var e=t||new m;return e.setFromRotationMatrix(this.getBasisMatrix(Kv)),e.inverse()},Qv.prototype.getProjectedScaleForAtoms=function(t){var e=-1/0,r=-1/0,i=-1/0,n=-1/0,o=-1/0,a=-1/0,s=new g,c=new g,u=this.center,h=this.normVecA,l=this.normVecB,p=this.normVecC;return t.eachAtom(function(t){aa(s.copy(t),h,u);var d=c.subVectors(s,u).normalize().dot(h),f=s.distanceTo(u);d>0?f>e&&(e=f):f>r&&(r=f),aa(s.copy(t),l,u);var m=c.subVectors(s,u).normalize().dot(l),g=s.distanceTo(u);m>0?g>i&&(i=g):g>n&&(n=g),aa(s.copy(t),p,u);var v=c.subVectors(s,u).normalize().dot(p),y=s.distanceTo(u);v>0?y>o&&(o=y):y>a&&(a=y)}),{d1a:e,d2a:i,d3a:o,d1b:-r,d2b:-n,d3b:-a}},Ya.prototype.constructor=Ya,Za.prototype.constructor=Za,ts.__deps=[Ka,Qa,Ja,On],es.__deps=[rs],rs.__deps=[da,pa,fa,ha],ns.__deps=[$n,ba,xa,ga,va,_a,wa,da,Sa,Ua,Ga,$a,Va,Ha];var Jv=function(t,e,r){this.name=t||"",this.path=e||"",this.info={},this.center=new g,this.boundingBox=new st,r instanceof wt||r instanceof Ct||r instanceof Ne?this.fromGeometry(r):r&&(this.set(r.position,r.index,r.normal,r.color,r.atomindex,r.contour),this.boundingBox.setFromArray(r.position),this.boundingBox.getCenter(this.center))},ty={type:{}};ty.type.get=function(){return"Surface"},Jv.prototype.set=function(t,e,r,i,n,o){this.position=t,this.index=e,this.normal=r,this.color=i,this.atomindex=n,this.size=t.length/3,this.contour=o},Jv.prototype.fromGeometry=function(e){t.Debug&&Uf.time("GeometrySurface.fromGeometry");var r;e instanceof wt?(e.computeVertexNormals(!0),r=(new Ct).fromGeometry(e)):r=e instanceof Ct?e:e[0],r.boundingBox||r.computeBoundingBox(),this.boundingBox.copy(r.boundingBox),this.boundingBox.getCenter(this.center);var i,n,o;if(r instanceof Ct){var a=r.attributes,s=!!a.normal&&a.normal.array;(!s||0===s[0]&&0===s[1]&&0===s[2])&&r.computeVertexNormals(),i=a.position.array,n=a.index?a.index.array:null,o=a.normal.array}this.set(i,n,o,void 0,void 0),t.Debug&&Uf.timeEnd("GeometrySurface.setGeometry")},Jv.prototype.getPosition=function(){return this.position},Jv.prototype.getColor=function(t){var e=t||{};e.surface=this;var r=this.size,i=new Float32Array(3*r),n=$f.getScheme(e);if(n.volumeColor||"random"===e.scheme)for(var o=0;o<r;++o)n.volumeColorToArray(o,i,3*o);else if(n.positionColor)for(var a=new g,s=this.position,c=0;c<r;++c){var u=3*c;a.set(s[u],s[u+1],s[u+2]),n.positionColorToArray(a,i,u)}else if(n.atomColor&&this.atomindex)for(var h=e.structure.getAtomProxy(),l=this.atomindex,p=0;p<r;++p)h.index=l[p],n.atomColorToArray(h,i,3*p);else{var d=new tt(e.value);ko(r,d.r,d.g,d.b,i)}return i},Jv.prototype.getPicking=function(t){return this.atomindex&&t?new Qg(this.atomindex,t):new lv(Bo(this.size),this)},Jv.prototype.getNormal=function(){return this.normal},Jv.prototype.getSize=function(t,e){return No(this.size,t*e)},Jv.prototype.getIndex=function(){return this.index},Jv.prototype.getFilteredIndex=function(t,e){if(t&&this.atomindex){for(var r=new Pf(t),i=e.getAtomSet(r),n=[],o=this.atomindex,a=this.index,s=a.length,c=this.contour?2:3,u=0,h=0;h<s;h+=c){for(var l=!0,p=0;p<c;p++){var d=o[a[h+p]];if(!i.get(d)){l=!1;break}}if(l)for(var f=0;f<c;f++,u++)n[u]=a[h+f]}return On(n,this.position.length/3)}return this.index},Jv.prototype.getAtomindex=function(){return this.atomindex},Jv.prototype.dispose=function(){},Object.defineProperties(Jv.prototype,ty),os.__deps=[es,rs,ts,ca,ua,Wa,Xa],Vf.add("surf",function(t,e){var r=t.data.args,i=t.data.params;if(r&&(self.volsurf=new os(r[0],r[1],r[2],r[3],r[4])),i){var n=self.volsurf.getSurface(i.isolevel,i.smooth,i.box,i.matrix,i.contour,i.wrap),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:i},o)}},[os]);var ey=function(t,e,r,i,n,o,a){this.name=t,this.path=e,this.matrix=new v,this.normalMatrix=new ut,this.inverseMatrix=new v,this.center=new g,this.boundingBox=new st,this.setData(r,i,n,o,a)},ry={type:{},position:{},min:{},max:{},sum:{},mean:{},rms:{}};ry.type.get=function(){return"Volume"},ey.prototype.setData=function(t,e,r,i,n){this.nx=e||1,this.ny=r||1,this.nz=i||1,this.data=t||new Float32Array(1),this.setAtomindex(n),delete this._position,delete this._min,delete this._max,delete this._mean,delete this._rms,this.worker&&this.worker.terminate()},ey.prototype.setStats=function(t,e,r,i){this._min=t,this._max=e,this._mean=r,this._rms=i},ey.prototype.setMatrix=function(t){this.matrix.copy(t);var e=this.boundingBox,r=this.center,i=this.nx-1,n=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(r.set(i,n,o)),e.expandByPoint(r.set(i,n,0)),e.expandByPoint(r.set(i,0,o)),e.expandByPoint(r.set(i,0,0)),e.expandByPoint(r.set(0,n,o)),e.expandByPoint(r.set(0,0,o)),e.expandByPoint(r.set(0,n,0)),e.expandByPoint(r.set(0,0,0)),e.applyMatrix4(this.matrix),e.getCenter(this.center);var a=this.matrix.elements,s=new g(a[0],a[1],a[2]),c=new g(a[4],a[5],a[6]),u=new g(a[8],a[9],a[10]),h=new g,l=this.normalMatrix.elements;h.crossVectors(c,u),l[0]=h.x,l[1]=h.y,l[2]=h.z,h.crossVectors(u,s),l[3]=h.x,l[4]=h.y,l[5]=h.z,h.crossVectors(s,c),l[6]=h.x,l[7]=h.y,l[8]=h.z,this.inverseMatrix.getInverse(this.matrix)},ey.prototype.setAtomindex=function(t){this.atomindex=t},ey.prototype.getBox=function(t,e,r){return r||(r=new st),r.set(t,t),r.expandByScalar(e),r.applyMatrix4(this.inverseMatrix),r.min.round(),r.max.round(),r},ey.prototype._getBox=function(t,e){if(t&&e){this.__box||(this.__box=new st);var r=this.getBox(t,e,this.__box);return[r.min.toArray(),r.max.toArray()]}},ey.prototype._makeSurface=function(t,e,r){var i=this.name+"@"+e.toPrecision(2),n=new Jv(i,"",t);return n.info.isolevel=e,n.info.smooth=r,n.info.volume=this,n},ey.prototype.getSurface=function(t,e,r,i,n,o){t=isNaN(t)?this.getValueForSigma(2):t,e=gn(e,0),void 0===this.volsurf&&(this.volsurf=new os(this.data,this.nx,this.ny,this.nz,this.atomindex));var a=this._getBox(r,i),s=this.volsurf.getSurface(t,e,a,this.matrix.elements,n,o);return this._makeSurface(s,t,e)},ey.prototype.getSurfaceWorker=function(t,e,r,i,n,o,a){var s=this;if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new Za("surf",2));var c={},u=this.workerPool.getNextWorker();0===u.postCount&&(c.args=[this.data,this.nx,this.ny,this.nz,this.atomindex]),c.params={isolevel:t,smooth:e,box:this._getBox(r,i),matrix:this.matrix.elements,contour:n,wrap:o},u.post(c,void 0,function(t){var e=t.data.sd,r=t.data.p;a(s._makeSurface(e,r.isolevel,r.smooth))},function(c){console.warn("Volume.getSurfaceWorker error - trying without worker",c);var u=s.getSurface(t,e,r,i,n,o);a(u)})}else{var h=this.getSurface(t,e,r,i,n,o);a(h)}},ey.prototype.getValueForSigma=function(t){return this.mean+gn(t,2)*this.rms},ey.prototype.getSigmaForValue=function(t){return(gn(t,0)-this.mean)/this.rms},ry.position.get=function(){if(!this._position){for(var t=this.nz,e=this.ny,r=this.nx,i=new Float32Array(r*e*t*3),n=0,o=0;o<t;++o)for(var a=0;a<e;++a)for(var s=0;s<r;++s)i[n+0]=s,i[n+1]=a,i[n+2]=o,n+=3;ca(this.matrix.elements,i),this._position=i}return this._position},ey.prototype.getDataAtomindex=function(){return this.atomindex},ey.prototype.getDataPosition=function(){return this.position},ey.prototype.getDataColor=function(t){var e=t||{};e.volume=this,e.scale=e.scale||"Spectral",e.domain=e.domain||[this.min,this.max];for(var r=$f.getScheme(e),i=this.position.length/3,n=new Float32Array(3*i),o=0;o<i;++o)r.volumeColorToArray(o,n,3*o);return n},ey.prototype.getDataPicking=function(){var t=Bo(this.position.length/3);return new mv(t,this)},ey.prototype.getDataSize=function(t,e){var r,i=this.data,n=this.position.length/3;switch(t){case"value":r=new Float32Array(i);break;case"abs-value":r=new Float32Array(i);for(var o=0;o<n;++o)r[o]=Math.abs(r[o]);break;case"value-min":r=new Float32Array(i);for(var a=this.min,s=0;s<n;++s)r[s]-=a;break;case"deviation":r=new Float32Array(i);break;default:r=No(n,t)}if(1!==e)for(var c=0;c<n;++c)r[c]*=e;return r},ry.min.get=function(){return void 0===this._min&&(this._min=Ho(this.data)),this._min},ry.max.get=function(){return void 0===this._max&&(this._max=$o(this.data)),this._max},ry.sum.get=function(){return void 0===this._sum&&(this._sum=Wo(this.data)),this._sum},ry.mean.get=function(){return void 0===this._mean&&(this._mean=Xo(this.data)),this._mean},ry.rms.get=function(){return void 0===this._rms&&(this._rms=qo(this.data)),this._rms},ey.prototype.clone=function(){var t=new ey(this.name,this.path,this.data,this.nx,this.ny,this.nz,this.atomindex);return t.matrix.copy(this.matrix),t.header=Object.assign({},this.header),t},ey.prototype.dispose=function(){this.workerPool&&this.workerPool.terminate()},Object.defineProperties(ey.prototype,ry);var iy=function(t,e,r,i){this.volume=t,this.setFilter(e,r,i)},ny={header:{},matrix:{},normalMatrix:{},inverseMatrix:{},center:{},boundingBox:{},min:{},max:{},mean:{},rms:{}};ny.header.get=function(){return this.volume.header},ny.matrix.get=function(){return this.volume.matrix},ny.normalMatrix.get=function(){return this.volume.normalMatrix},ny.inverseMatrix.get=function(){return this.volume.inverseMatrix},ny.center.get=function(){return this.volume.center},ny.boundingBox.get=function(){return this.volume.boundingBox},ny.min.get=function(){return this.volume.min},ny.max.get=function(){return this.volume.max},ny.mean.get=function(){return this.volume.mean},ny.rms.get=function(){return this.volume.rms},iy.prototype._getFilterHash=function(t,e,r){return JSON.stringify([t,e,r])},iy.prototype.setFilter=function(t,e,r){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-1/0:t,e=gn(e,1/0),r=gn(r,!1);var i=this.volume.data,n=this.volume.position,o=this.volume.atomindex,a=this._getFilterHash(t,e,r);if(a!==this._filterHash){if(t===-1/0&&e===1/0)this.data=i,this.position=n,this.atomindex=o;else{var s=i.length;this._dataBuffer||(this._dataBuffer=new ArrayBuffer(4*s),this._positionBuffer=new ArrayBuffer(3*s*4),o&&(this._atomindexBuffer=new ArrayBuffer(4*s)));var c,u=new Float32Array(this._dataBuffer),h=new Float32Array(this._positionBuffer);o&&(c=new Uint32Array(this._atomindexBuffer));for(var l=0,p=0;p<s;++p){var d=3*p,f=i[p];if(!r&&f>=t&&f<=e||r&&(f<t||f>e)){var m=3*l;u[l]=f,h[m+0]=n[d+0],h[m+1]=n[d+1],h[m+2]=n[d+2],o&&(c[l]=o[p]),l+=1}}this.data=new Float32Array(this._dataBuffer,0,l),this.position=new Float32Array(this._positionBuffer,0,3*l),o&&(this.atomindex=new Float32Array(this._atomindexBuffer,0,l))}this._filterHash=a}},Object.defineProperties(iy.prototype,ny),iy.prototype.getValueForSigma=ey.prototype.getValueForSigma,iy.prototype.getSigmaForValue=ey.prototype.getSigmaForValue,iy.prototype.getDataAtomindex=ey.prototype.getDataAtomindex,iy.prototype.getDataPosition=ey.prototype.getDataPosition,iy.prototype.getDataColor=ey.prototype.getDataColor,iy.prototype.getDataPicking=ey.prototype.getDataPicking,iy.prototype.getDataSize=ey.prototype.getDataSize;var oy=function(e,r){t.Debug&&Uf.time("BondHash init");for(var i=e.count,n=e.atomIndex1,o=e.atomIndex2,a=new Uint8Array(r),s=new Int32Array(r),c=0;c<i;++c)a[n[c]]+=1,a[o[c]]+=1;for(var u=1;u<r;++u)s[u]+=s[u-1]+a[u-1];for(var h=2*i,l=new Int32Array(h),p=0;p<h;++p)l[p]=-1;for(var d=0;d<i;++d){for(var f=n[d],m=o[d],g=s[f];-1!==l[g];)g+=1;l[g]=d;for(var v=s[m];-1!==l[v];)v+=1;l[v]=d}t.Debug&&Uf.timeEnd("BondHash init"),this.countArray=a,this.offsetArray=s,this.indexArray=l},ay=function(t){this._fields=this._defaultFields,Number.isInteger(t)?this._init(t):this._init(0)};ay.prototype._init=function(t){var e=this;this.length=t,this.count=0;for(var r=0,i=this._fields.length;r<i;++r)(n=e)._initField.apply(n,e._fields[r]);var n},ay.prototype._initField=function(t,e,r){this[t]=Ln(r,this.length*e)},ay.prototype.addField=function(t,e,r){this._fields.push([t,e,r]),this._initField(t,e,r)},ay.prototype.resize=function(t){var e=this;this.length=Math.round(t||0),this.count=Math.min(this.count,this.length);for(var r=0,i=this._fields.length;r<i;++r){var n=e._fields[r][0],o=e._fields[r][1],a=e.length*o,s=new e[n].constructor(a);e[n].length>a?s.set(e[n].subarray(0,a)):s.set(e[n]),e[n]=s}},ay.prototype.growIfFull=function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},ay.prototype.copyFrom=function(t,e,r,i){for(var n=this,o=0,a=this._fields.length;o<a;++o)for(var s=n._fields[o][0],c=n._fields[o][1],u=n[s],h=t[s],l=0;l<i;++l)for(var p=c*(e+l),d=c*(r+l),f=0;f<c;++f)u[p+f]=h[d+f]},ay.prototype.copyWithin=function(t,e,r){for(var i=this,n=0,o=this._fields.length;n<o;++n)for(var a=i._fields[n][0],s=i._fields[n][1],c=i[a],u=0;u<r;++u)for(var h=s*(t+u),l=s*(e+u),p=0;p<s;++p)c[h+p]=c[l+p]},ay.prototype.sort=function(t){function e(t,e){t!==e&&(n.copyFrom(i,0,t,1),i.copyWithin(t,e,1),i.copyFrom(n,e,0,1))}function r(i,n){if(i<n){var o=Math.floor((i+n)/2),a=i,s=n;do{for(;t(a,o)<0;)a+=1;for(;t(s,o)>0;)s-=1;a<=s&&(a===o?o=s:s===o&&(o=a),e(a,s),a+=1,s-=1)}while(a<=s);r(i,s),r(a,n)}}Uf.time("Store.sort");var i=this,n=new this.constructor(1);r(0,this.count-1),Uf.timeEnd("Store.sort")},ay.prototype.clear=function(){this.count=0},ay.prototype.dispose=function(){var t=this;delete this.length,delete this.count;for(var e=0,r=this._fields.length;e<r;++e)delete t[t._fields[e][0]]};var sy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_defaultFields:{}};return r._defaultFields.get=function(){return[["atomIndex1",1,"int32"],["atomIndex2",1,"int32"],["bondOrder",1,"int8"]]},e.prototype.addBond=function(t,e,r){this.growIfFull();var i=this.count,n=t.index,o=e.index;n<o?(this.atomIndex1[i]=n,this.atomIndex2[i]=o):(this.atomIndex2[i]=n,this.atomIndex1[i]=o),r&&(this.bondOrder[i]=r),this.count+=1},e.prototype.addBondIfConnected=function(t,e,r){return!!t.connectedTo(e)&&(this.addBond(t,e,r),!0)},Object.defineProperties(e.prototype,r),e}(ay),cy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_defaultFields:{}};return r._defaultFields.get=function(){return[["residueIndex",1,"uint32"],["atomTypeId",1,"uint16"],["x",1,"float32"],["y",1,"float32"],["z",1,"float32"],["serial",1,"int32"],["bfactor",1,"float32"],["altloc",1,"uint8"],["occupancy",1,"float32"]]},e.prototype.setAltloc=function(t,e){this.altloc[t]=e.charCodeAt(0)},e.prototype.getAltloc=function(t){var e=this.altloc[t];return e?String.fromCharCode(e):""},Object.defineProperties(e.prototype,r),e}(ay),uy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_defaultFields:{}};return r._defaultFields.get=function(){return[["chainIndex",1,"uint32"],["atomOffset",1,"uint32"],["atomCount",1,"uint16"],["residueTypeId",1,"uint16"],["resno",1,"int32"],["sstruc",1,"uint8"],["inscode",1,"uint8"]]},e.prototype.setSstruc=function(t,e){this.sstruc[t]=e.charCodeAt(0)},e.prototype.getSstruc=function(t){var e=this.sstruc[t];return e?String.fromCharCode(e):""},e.prototype.setInscode=function(t,e){this.inscode[t]=e.charCodeAt(0)},e.prototype.getInscode=function(t){var e=this.inscode[t];return e?String.fromCharCode(e):""},Object.defineProperties(e.prototype,r),e}(ay),hy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_defaultFields:{}};return r._defaultFields.get=function(){return[["entityIndex",1,"uint16"],["modelIndex",1,"uint16"],["residueOffset",1,"uint32"],["residueCount",1,"uint32"],["chainname",4,"uint8"],["chainid",4,"uint8"]]},e.prototype.setChainname=function(t,e){var r=4*t;this.chainname[r]=e.charCodeAt(0),this.chainname[r+1]=e.charCodeAt(1),this.chainname[r+2]=e.charCodeAt(2),this.chainname[r+3]=e.charCodeAt(3)},e.prototype.getChainname=function(t){for(var e=this,r="",i=0;i<4;++i){var n=e.chainname[4*t+i];if(!n)break;r+=String.fromCharCode(n)}return r},e.prototype.setChainid=function(t,e){var r=4*t;this.chainid[r]=e.charCodeAt(0),this.chainid[r+1]=e.charCodeAt(1),this.chainid[r+2]=e.charCodeAt(2),this.chainid[r+3]=e.charCodeAt(3)},e.prototype.getChainid=function(t){for(var e=this,r="",i=0;i<4;++i){var n=e.chainid[4*t+i];if(!n)break;r+=String.fromCharCode(n)}return r},Object.defineProperties(e.prototype,r),e}(ay),ly=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_defaultFields:{}};return r._defaultFields.get=function(){return[["chainOffset",1,"uint32"],["chainCount",1,"uint32"]]},Object.defineProperties(e.prototype,r),e}(ay);as.prototype={constructor:as,getCenterIterator:function(t){function e(){var t=this.get(s);return s+=1,t}function r(e){e=Math.min(o-1,Math.max(0,e));var r=c[a%4],i=3*e;if(r.fromArray(n,i),t){var s,u,h,l=Math.min(t,e,o-e-1);for(u=1;u<=l;++u)s=3*u,h=(l+1-u)/(l+1),r.x+=h*n[i-s+0]+h*n[i+s+0],r.y+=h*n[i-s+1]+h*n[i+s+1],r.z+=h*n[i-s+2]+h*n[i+s+2];r.x/=l+1,r.y/=l+1,r.z/=l+1}return a+=1,r}function i(){a=0,s=-1}var n=this.getPosition().center,o=n.length/3,a=0,s=-1,c=[new g,new g,new g,new g];return{size:o,next:e,get:r,reset:i}},getColor:function(t){var e=this.polymer,r=e.structure,i=e.residueCount,n=e.residueIndexStart,o=new Float32Array(3*i),a=t||{};a.structure=r;for(var s=$f.getScheme(a),c=r.getResidueProxy(),u=r.getAtomProxy(),h=0;h<i;++h)c.index=n+h,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*h);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,r=t.residueCount,i=t.residueIndexStart,n=new Float32Array(r),o=e.getResidueProxy(),a=0;a<r;++a)o.index=i+a,n[a]=o.traceAtomIndex;return{picking:new Qg(n,e)}},getSize:function(t,e){for(var r=this.polymer,i=r.structure,n=r.residueCount,o=r.residueIndexStart,a=new Float32Array(n),s=new Ta(t,e),c=i.getResidueProxy(),u=i.getAtomProxy(),h=0;h<n;++h)c.index=o+h,u.index=c.traceAtomIndex,a[h]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,r,i,n,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),h=new Float32Array(3*s),l=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),v=new g,y=new g,b=new g,x=new g,_=new g,w=new g,S=new g,A=new g,M=new g,T=new g,E=new g,P=new g(0,0,0),C="trace",I=a.getAtomProxy(),R=a.getAtomProxy(o.getAtomIndexByType(0,C)),L=a.getAtomProxy(o.getAtomIndexByType(1,C)),O=a.getAtomProxy(o.getAtomIndexByType(2,C));for(r=0;r<c;++r)I.index=R.index,R.index=L.index,L.index=O.index,O.index=o.getAtomIndexByType(r+3,C),e=3*r,v.subVectors(R,I),y.subVectors(L,R),b.subVectors(O,L),x.subVectors(v,y),_.subVectors(y,b),M.crossVectors(x,_).normalize(),M.toArray(h,e),r>0&&(l[r]=M.angleTo(T)),t=Math.cos(x.angleTo(_)),f[r]=180/Math.PI*Math.acos(t),i=x.length(),n=_.length(),p[r]=Math.sqrt(n*i)/Math.max(2,2*(1-t)),d[r]=Math.abs(y.dot(M)),w.copy(x).multiplyScalar(p[r]/i),S.copy(_).multiplyScalar(p[r]/n),w.subVectors(R,w),S.subVectors(L,S),w.toArray(u,e+3),S.toArray(u,e+6),E.subVectors(I,P),E.toArray(m,e),T.copy(M),P.copy(w);for(w.fromArray(u,3),S.fromArray(u,6),M.subVectors(w,S).normalize(),I.index=o.getAtomIndexByType(0,C),P.copy(I),A.copy(I),aa(A,M,w),A.toArray(u,0),E.subVectors(P,w),E.toArray(m,0),w.fromArray(u,3*s-6),S.fromArray(u,3*s-9),M.subVectors(w,S).normalize(),I.index=o.getAtomIndexByType(s-1,C),P.copy(I),A.copy(I),aa(A,M,w),A.toArray(u,3*s-3),r=s-3;r<s;++r)w.fromArray(u,3*r),I.index=o.getAtomIndexByType(r,C),P.copy(I),E.subVectors(P,w),E.toArray(m,3*r);var D=new Float32Array(s),N=new Float32Array(s),k=new Float32Array(s),F=new Float32Array(s);for(D[1]=p[0],N[1]=f[0],k[1]=p[0],r=2;r<s-2;++r)D[r]=.5*(p[r-2]+p[r-1]),N[r]=.5*(f[r-2]+f[r-1]),k[r]=.5*(d[r-2]+d[r-1]),w.fromArray(h,3*(r-2)),S.fromArray(h,3*(r-1)),F[r]=180/Math.PI*Math.acos(Math.cos(w.angleTo(S)));D[s-2]=p[s-4],N[s-2]=f[s-4],k[s-2]=d[s-4];var B=new Float32Array(3*s);for(jo(h,B,0,0,3),jo(h,B,0,3,3),r=2;r<s-2;++r)w.fromArray(h,3*(r-2)),S.fromArray(h,3*(r-1)),M.addVectors(S,w).multiplyScalar(.5).normalize(),M.toArray(B,3*r);return jo(h,B,3*s-12,3*s-6,3),jo(h,B,3*s-12,3*s-3,3),{center:u,axis:B,bending:F,radius:D,rise:k,twist:N,resdir:m}}},ss.prototype={constructor:ss,getAxis:function(t,e,r,i,n,o){t=t||30,e=e||2.5,r=void 0!==r&&r;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,h=this.position,l=i||{};l.structure=s;for(var p,d,f=$f.getScheme(l),m=new Ta(n,o),v=0,y=0,b=[],x=[],_=[],w=[],S=[],A=[],M=[],T=[],E=[],P=[],C=[],I=new g,R=new g,L=s.getResidueProxy(),O=s.getResidueProxy(),D=s.getAtomProxy(),N=new g,k=new g,F=!1,B=0;B<c;++B)if(L.index=u+B,N.fromArray(h.center,3*B),B===c-1?F=!0:(O.index=u+B+1,k.fromArray(h.center,3*B+3),r&&L.sstruc!==O.sstruc?F=!0:N.distanceTo(k)>e?F=!0:h.bending[B]>t&&(F=!0)),F){if(B-v<4){v=B,F=!1;continue}D.index=L.traceAtomIndex,P=h.axis.subarray(3*v+3,3*B),C=h.center.subarray(3*v,3*B+3),p=oa(P).normalize(),d=oa(C),I.fromArray(C),aa(I,p,d),R.fromArray(C,C.length-3),aa(R,p,d),p.subVectors(R,I),p.toArray(b,y),d.toArray(x,y),I.toArray(_,y),R.toArray(w,y),f.atomColorToArray(D,S,y),A.push(D.index),M.push(m.atomRadius(D)),T.push(u+v),E.push(u+B+1-v),y+=3,v=B,F=!1}var z=new Float32Array(A);return{axis:new Float32Array(b),center:new Float32Array(x),begin:new Float32Array(_),end:new Float32Array(w),color:new Float32Array(S),picking:new Qg(z,s),size:new Float32Array(M),residueOffset:T,residueCount:E}}},cs.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this,r=this.content.length,i=0;i<r;i++)if(e.content[i]===t){var n=e.content.pop();return void(i!==r-1&&(e.content[i]=n,e.scoreFunction(n)<e.scoreFunction(t)?e.bubbleUp(i):e.sinkDown(i)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this,r=this.content[t];t>0;){var i=Math.floor((t+1)/2)-1,n=e.content[i];if(!(e.scoreFunction(r)<e.scoreFunction(n)))break;e.content[i]=r,e.content[t]=n,t=i}},sinkDown:function(t){for(var e,r=this,i=this.content.length,n=this.content[t],o=this.scoreFunction(n);;){var a=2*(t+1),s=a-1,c=null;if(s<i){var u=r.content[s];(e=r.scoreFunction(u))<o&&(c=s)}if(a<i){var h=r.content[a];r.scoreFunction(h)<(null===c?o:e)&&(c=a)}if(null===c)break;r.content[t]=r.content[c],r.content[c]=n,t=c}}},hs.prototype={nearest:function(){var t=new Float32Array(3);return function(e,r,i){e.toArray?e.toArray(t):e.positionToArray&&e.positionToArray(t);for(var n=this.kdtree.nearest(t,r,i),o=this.kdtree.indices,a=this.kdtree.nodes,s=this.atomIndices,c=[],u=0,h=n.length;u<h;++u){var l=n[u],p=l[0],d=l[1];c.push({index:s[o[a[p]]],distance:d})}return c}}()};var py={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},dy={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+","P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%&  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$","F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&%  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#!  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#!  )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"},fy=function(t){this.name=t||"",this.partList=[]},my={type:{}};my.type.get=function(){return"Assembly"},fy.prototype.addPart=function(t,e){var r=new gy(t,e);return this.partList.push(r),r},fy.prototype._getCount=function(t,e){var r=0;return this.partList.forEach(function(i){r+=i[e](t)}),r},fy.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},fy.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},fy.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},fy.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new v).equals(e.matrixList[0]))return!1;var r=[];return t.eachChain(function(t){r.push(t.chainname)}),r=Cn(r),e.chainList.length===r.length},fy.prototype.getBoundingBox=function(t){var e=new st;return this.partList.forEach(function(r){var i=r.getBoundingBox(t);e.expandByPoint(i.min),e.expandByPoint(i.max)}),e},fy.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},fy.prototype.getSelection=function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),ps(t)},Object.defineProperties(fy.prototype,my);var gy=function(t,e){this.matrixList=t||[],this.chainList=e||[]},vy={type:{}};vy.type.get=function(){return"AssemblyPart"},gy.prototype._getCount=function(t,e){var r=0,i=this.chainList;return t.eachChain(function(t){(0===i.length||i.includes(t.chainname))&&(r+=t[e])}),this.matrixList.length*r},gy.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},gy.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},gy.prototype.getBoundingBox=function(t){var e=new st,r=new st,i=this.getSelection(),n=t.getBoundingBox(i);return this.matrixList.forEach(function(t){r.copy(n).applyMatrix4(t),e.expandByPoint(r.min),e.expandByPoint(r.max)}),e},gy.prototype.getSelection=function(){return ps(this.chainList)},gy.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},gy.prototype.getInstanceList=function(){for(var t=this,e=[],r=0,i=this.matrixList.length;r<i;++r)e.push({id:r+1,name:r,matrix:t.matrixList[r]});return e},Object.defineProperties(gy.prototype,vy);var yy=function(){var e=function(t,e,r,i){for(var n=t.structure,o=t.residueIndexStart,a=n.getResidueProxy(),s=n.getResidueProxy(),c=n.getAtomProxy(),u=n.getAtomProxy(),h=Math.max(0,e-2);h<=e;++h)for(var l=2;l<5;++l)if(!(h+l>=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-r[l-2])>i)return!1}return!0},r=function(t,r){return e(t,r,[5.45,5.18,6.37],2.1)},i=function(t,r){return e(t,r,[6.1,10.4,13],1.42)},n=function(t){for(var e=t.residueStore,n=t.residueIndexStart,o=0,a=t.residueCount;o<a;++o){var s="c";r(t,o)?s="h":i(t,o)&&(s="s"),e.sstruc[n+o]=s.charCodeAt(0)}},o=function(t){for(var e=t.residueStore,r=t.residueIndexStart,i=new ss(t).position,n=new g,o=new g,a=0,s=t.residueCount;a<s;++a){n.fromArray(i.center,3*a),o.fromArray(i.center,3*a+3);var c=n.distanceTo(o);c<2&&c>1&&i.bending[a]<20&&(e.sstruc[r+a]="h".charCodeAt(0),e.sstruc[r+a+1]="h".charCodeAt(0))}};return function(e){t.Debug&&Uf.time("calculateSecondaryStructure"),e.eachPolymer(function(t){if(!(t.residueCount<4)){if(t.isCg())o(t);else{if(!t.isProtein())return;n(t)}var e,r=0;t.eachResidue(function(t){t.sstruc===e?r+=1:(1===r&&(t.index-=1,t.sstruc="c"),r=1,e=t.sstruc)})}}),t.Debug&&Uf.timeEnd("calculateSecondaryStructure")}}(),by="ABCDEFGHIJKLMNOPQRSTUVWXYZ",xy=["H","C","O","N","S","P"],_y=["NA","CL","FE"],wy=function(t,e,r){this.structure=t,r=r||ws(e),this.atomname=e,this.element=r,this.vdw=Ov[r],this.covalent=Dv[r]},Sy=function(t){this.structure=t,this.dict={},this.list=[]};Sy.prototype.add=function(t,e){var r=As(t=t.toUpperCase(),e=e?e.toUpperCase():ws(t)),i=this.dict[r];if(void 0===i){var n=new wy(this.structure,t,e);i=this.list.length,this.dict[r]=i,this.list.push(n)}return i},Sy.prototype.get=function(t){return this.list[t]};var Ay=function(t,e,r,i,n,o){this.structure=t,this.resname=e,this.atomTypeIdList=r,this.hetero=i?1:0,this.chemCompType=n,this.bonds=o,this.rings=void 0,this.atomCount=r.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=Xv[this.backboneType],s=Xv[this.backboneStartType],c=Xv[this.backboneEndType],u=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==u?u:-1;var h=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==h?h:-1;var l=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==l?l:-1;var p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==d?d:-1;var f;f=jv.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==f?f:-1,this.bondReferenceAtomIndices=[]};Ay.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=Hv;break;case 4:case 5:t=Wv;break;default:return e}for(var r=this.structure.atomMap,i=this.atomTypeIdList,n=0,o=this.atomCount;n<o;++n){var a=r.get(i[n]);t.includes(a.atomname)&&e.push(n)}return e},Ay.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},Ay.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:Sv},Ay.prototype.isProtein=function(){return this.chemCompType?Av.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||Bv.includes(this.resname)},Ay.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},Ay.prototype.isNucleic=function(){return this.isRna()||this.isDna()},Ay.prototype.isRna=function(){return this.chemCompType?Mv.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||zv.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},Ay.prototype.isDna=function(){return this.chemCompType?Tv.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||Uv.includes(this.resname)},Ay.prototype.isHetero=function(){return 1===this.hetero},Ay.prototype.isIon=function(){return Vv.includes(this.resname)},Ay.prototype.isWater=function(){return Gv.includes(this.resname)},Ay.prototype.isSaccharide=function(){return this.chemCompType?Ev.includes(this.chemCompType):$v.includes(this.resname)},Ay.prototype.hasBackboneAtoms=function(t,e){var r=Xv[e];return-1===t?this.hasAtomWithName(r.trace,r.backboneEnd,r.direction1,r.direction2):0===t?this.hasAtomWithName(r.trace,r.direction1,r.direction2):1===t?this.hasAtomWithName(r.trace,r.backboneStart,r.direction1,r.direction2):this.hasAtomWithName(r.trace,r.backboneStart,r.backboneEnd,r.direction1,r.direction2)},Ay.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},Ay.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},Ay.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},Ay.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},Ay.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},Ay.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},Ay.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},Ay.prototype.getAtomIndexByName=function(t){var e=this.atomCount,r=this.structure.atomMap,i=this.atomTypeIdList;if(Array.isArray(t))for(var n=0;n<e;++n){var o=i[n];if(t.includes(r.get(o).atomname))return n}else for(var a=0;a<e;++a){var s=i[a];if(t===r.get(s).atomname)return a}},Ay.prototype.hasAtomWithName=function(){for(var t=arguments,e=this,r=arguments.length,i=0;i<r;++i)if(void 0!==t[i]&&void 0===e.getAtomIndexByName(t[i]))return!1;return!0},Ay.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=vs(t)),this.bonds},Ay.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},Ay.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},Ay.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),r=e.atomIndices1.length,i=e.atomIndices1,n=e.atomIndices2,o=0;o<r;++o){var a=i[o],s=n[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},Ay.prototype.calculateRings=function(){function t(a,s,c){if(r[a])throw new Error("DFS revisited atom");r[a]=1,o.push(a);for(var u=s.length,h=0;h<u;++h){var l=s[h];if(0===r[l])e[l]&&e[l].length>=2?t(l,e[l],a):r[l]=2;else if(1===r[l]&&c&&c!==l){var p=[l];i[l]=1,n.push(p);for(var d=o.length-1;d>=0;--d){var f=o[d];if(f===l)break;p.push(f),i[f]=1}}}r[a]=2,o.pop()}for(var e=this.getBondGraph(),r=new Int8Array(this.atomCount),i=new Int8Array(this.atomCount),n=[],o=[],a=0;a<this.atomCount;++a)if(!r[a]){var s=e[a];!s||s.length<2?r[a]=2:(o.length=0,t(a,s))}this.rings={flags:i,rings:n}},Ay.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),r=e.flags,i=e.rings,n=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var h=n[u],l=o[u];if(r[h]&&r[l]){for(var p=0;p<i.length&&void 0===s[u];++p)for(var d=i[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===h||v===l?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[h].length>1)for(var y=0;y<t[h].length;++y){var b=t[h][y];if(b!==l){s[u]=b;break}}else if(t[l].length>1)for(var x=0;x<t[l].length;++x){var _=t[l][x];if(_!==h){s[u]=_;break}}else;}},Ay.prototype.getBondIndex=function(t,e){for(var r=this.bonds,i=r.atomIndices1,n=r.atomIndices2,o=i.indexOf(t),a=n.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=n.indexOf(e,a+1)}o=i.indexOf(t,o+1),a=s}},Ay.prototype.getBondReferenceAtomIndex=function(t,e){var r=this.getBondIndex(t,e);if(void 0!==r)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[r]};var My=function(t){this.structure=t,this.dict={},this.list=[]};My.prototype.add=function(t,e,r,i,n){var o=Ms(t=t.toUpperCase(),e,r,i),a=this.dict[o];if(void 0===a){var s=new Ay(this.structure,t,e,r,i,n);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},My.prototype.get=function(t){return this.list[t]};var Ty=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new g,this._v13=new g,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},Ey={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};Ey.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},Ey.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},Ey.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},Ey.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},Ey.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},Ey.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},Ey.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},Ey.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},Ty.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var r=t.index-t.residueAtomOffset,i=e.index-e.residueAtomOffset,n=t.residueType.getBondReferenceAtomIndex(r,i);if(void 0!==n)return n+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},Ty.prototype.calculateShiftDir=function(t){t||(t=new g);var e=this._ap1,r=this._ap2,i=this._ap3,n=this._v12,o=this._v13;e.index=this.atomIndex1,r.index=this.atomIndex2;var a=this.getReferenceAtomIndex();n.subVectors(e,r).normalize(),void 0!==a?(i.index=a,o.subVectors(e,i)):o.copy(e),o.normalize();var s=n.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=n.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=n.dot(o))),t.copy(o.sub(n.multiplyScalar(s))).normalize()},Ty.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},Ty.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Ty.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(Ty.prototype,Ey);var Py=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e},Cy={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{},partialCharge:{}};Cy.bondHash.get=function(){return this.structure.bondHash},Cy.entity.get=function(){return this.structure.entityList[this.entityIndex]},Cy.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},Cy.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},Cy.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},Cy.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},Cy.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},Cy.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},Cy.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},Cy.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},Cy.resno.get=function(){return this.residueStore.resno[this.residueIndex]},Cy.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Cy.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},Cy.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},Cy.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},Cy.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},Cy.resname.get=function(){return this.residueType.resname},Cy.hetero.get=function(){return this.residueType.hetero},Cy.atomname.get=function(){return this.atomType.atomname},Cy.element.get=function(){return this.atomType.element},Cy.vdw.get=function(){return this.atomType.vdw},Cy.covalent.get=function(){return this.atomType.covalent},Cy.x.get=function(){return this.atomStore.x[this.index]},Cy.x.set=function(t){this.atomStore.x[this.index]=t},Cy.y.get=function(){return this.atomStore.y[this.index]},Cy.y.set=function(t){this.atomStore.y[this.index]=t},Cy.z.get=function(){return this.atomStore.z[this.index]},Cy.z.set=function(t){this.atomStore.z[this.index]=t},Cy.serial.get=function(){return this.atomStore.serial[this.index]},Cy.serial.set=function(t){this.atomStore.serial[this.index]=t},Cy.bfactor.get=function(){return this.atomStore.bfactor[this.index]},Cy.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},Cy.occupancy.get=function(){return this.atomStore.occupancy[this.index]},Cy.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},Cy.altloc.get=function(){return this.atomStore.getAltloc(this.index)},Cy.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},Cy.partialCharge.get=function(){return this.atomStore.partialCharge?this.atomStore.partialCharge[this.index]:null},Cy.partialCharge.set=function(t){this.atomStore.partialCharge&&(this.atomStore.partialCharge[this.index]=t)},Py.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var r=this.index,i=this.bondHash,n=i.indexArray,o=i.countArray[r],a=i.offsetArray[r],s=0;s<o;++s)e.index=n[a+s],t(e)},Py.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var r=this.index;this.eachBond(function(i){r!==i.atomIndex1?e.index=i.atomIndex1:e.index=i.atomIndex2,t(e)})},Py.prototype.hasBondTo=function(t){var e=!1;return this.eachBondedAtom(function(r){t.index===r.index&&(e=!0)}),e},Py.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},Py.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},Py.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},Py.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},Py.prototype.isHetero=function(){return 1===this.residueType.hetero},Py.prototype.isProtein=function(){return 3===this.residueType.moleculeType},Py.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},Py.prototype.isRna=function(){return 4===this.residueType.moleculeType},Py.prototype.isDna=function(){return 5===this.residueType.moleculeType},Py.prototype.isWater=function(){return 1===this.residueType.moleculeType},Py.prototype.isIon=function(){return 2===this.residueType.moleculeType},Py.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},Py.prototype.isHelix=function(){return Iv.includes(this.sstruc)},Py.prototype.isSheet=function(){return Rv.includes(this.sstruc)},Py.prototype.isTurn=function(){return Lv.includes(this.sstruc)&&this.isProtein()},Py.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},Py.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},Py.prototype.distanceTo=function(t){var e=this.atomStore,r=t.atomStore,i=this.index,n=t.index,o=e.x[i]-r.x[n],a=e.y[i]-r.y[n],s=e.z[i]-r.z[n],c=o*o+a*a+s*s;return Math.sqrt(c)},Py.prototype.connectedTo=function(t){var e=this.atomStore,r=t.atomStore,i=this.index,n=t.index;if(e.altloc&&r.altloc){var o=e.altloc[i],a=r.altloc[n];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[i]-r.x[n],c=e.y[i]-r.y[n],u=e.z[i]-r.z[n],h=s*s+c*c+u*u;if(h<64&&this.isCg())return!0;if(isNaN(h))return!1;var l=this.covalent+t.covalent,p=l+.3,d=l-.5;return h<p*p&&h>d*d},Py.prototype.positionFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},Py.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.index,i=this.atomStore;return t[e+0]=i.x[r],t[e+1]=i.y[r],t[e+2]=i.z[r],t},Py.prototype.positionToVector3=function(t){return void 0===t&&(t=new g),t.x=this.x,t.y=this.y,t.z=this.z,t},Py.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},Py.prototype.positionAdd=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},Py.prototype.positionSub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},Py.prototype.getResidueBonds=function(t){var e,r,i,n,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(n=[]),e=c.indexOf(a);-1!==e;){if(i=u[e]+o,t)return i;n.push(i),e=c.indexOf(a,e+1)}for(r=u.indexOf(a);-1!==r;){if(i=c[r]+o,t)return i;n.push(i),r=u.indexOf(a,r+1)}return n},Py.prototype.qualifiedName=function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},Py.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Py.prototype.toObject=function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}},Object.defineProperties(Py.prototype,Cy);var Iy=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e},Ry={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};Ry.entity.get=function(){return this.structure.entityList[this.entityIndex]},Ry.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},Ry.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},Ry.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},Ry.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},Ry.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},Ry.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},Ry.atomCount.get=function(){return this.residueStore.atomCount[this.index]},Ry.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},Ry.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},Ry.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},Ry.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Ry.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},Ry.resno.get=function(){return this.residueStore.resno[this.index]},Ry.resno.set=function(t){this.residueStore.resno[this.index]=t},Ry.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},Ry.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},Ry.inscode.get=function(){return this.residueStore.getInscode(this.index)},Ry.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},Ry.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},Ry.resname.get=function(){return this.residueType.resname},Ry.hetero.get=function(){return this.residueType.hetero},Ry.moleculeType.get=function(){return this.residueType.moleculeType},Ry.backboneType.get=function(){return this.residueType.backboneType},Ry.backboneStartType.get=function(){return this.residueType.backboneStartType},Ry.backboneEndType.get=function(){return this.residueType.backboneEndType},Ry.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},Ry.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},Ry.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},Ry.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},Ry.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},Ry.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},Iy.prototype.eachAtom=function(t,e){var r,i=this.atomCount,n=this.atomOffset,o=this.structure._ap,a=n+i;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(r=n;r<a;++r)o.index=r,s(o)&&t(o)}else for(r=n;r<a;++r)o.index=r,t(o)},Iy.prototype.isProtein=function(){return 3===this.residueType.moleculeType},Iy.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},Iy.prototype.isRna=function(){return 4===this.residueType.moleculeType},Iy.prototype.isDna=function(){return 5===this.residueType.moleculeType},Iy.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},Iy.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},Iy.prototype.isHetero=function(){return 1===this.residueType.hetero},Iy.prototype.isWater=function(){return 1===this.residueType.moleculeType},Iy.prototype.isIon=function(){return 2===this.residueType.moleculeType},Iy.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},Iy.prototype.isHelix=function(){return Iv.includes(this.sstruc)},Iy.prototype.isSheet=function(){return Rv.includes(this.sstruc)},Iy.prototype.isTurn=function(){return Lv.includes(this.sstruc)&&this.isProtein()},Iy.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},Iy.prototype.getResname1=function(){return Fv[this.resname.toUpperCase()]||"X"},Iy.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},Iy.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},Iy.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},Iy.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},Iy.prototype.getAtomnameList=function(){var t=this;console.warn("getAtomnameList - might be expensive");for(var e=this.atomCount,r=this.atomOffset,i=new Array(e),n=0;n<e;++n)i[n]=t.getAtomType(r+n).atomname;return i},Iy.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),r=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!r)&&e.connectedTo(r)},Iy.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],r=this.index+1;if(r<t+e){var i=this.structure.getResidueProxy(r);if(this.connectedTo(i))return i}else if(r===t+e){var n=this.structure.getResidueProxy(t);if(this.connectedTo(n))return n}},Iy.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var r=this.structure.getResidueProxy(e);if(r.connectedTo(this))return r}else if(e===t-1){var i=this.chainStore.residueCount[this.chainIndex],n=this.structure.getResidueProxy(t+i-1);if(n.connectedTo(this))return n}},Iy.prototype.getBonds=function(){return this.residueType.getBonds(this)},Iy.prototype.getRings=function(){return this.residueType.getRings()},Iy.prototype.qualifiedName=function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},Iy.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Iy.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(Iy.prototype,Ry);var Ly=function(t,e,r){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=r,this.residueCount=r-e+1;var i=this.structure.getResidueProxy(this.residueIndexStart),n=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==i.getPreviousConnectedResidue();var o=n.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=n.connectedTo(i),this.__residueProxy=this.structure.getResidueProxy()},Oy={chainIndex:{},modelIndex:{},chainname:{}};Oy.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},Oy.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},Oy.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Ly.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},Ly.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},Ly.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},Ly.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},Ly.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},Ly.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var r=this.__residueProxy;r.index=this.residueIndexStart+t;var i;switch(e){case"trace":i=r.traceAtomIndex;break;case"direction1":i=r.direction1AtomIndex;break;case"direction2":i=r.direction2AtomIndex;break;default:var n=r.getAtomByName(e);i=n?n.index:void 0}return i},Ly.prototype.eachAtom=function(t,e){this.eachResidue(function(r){r.eachAtom(t,e)},e)},Ly.prototype.eachAtomN=function(t,e,r){var i,n=this,o=this.residueCount,a=new Array(t);for(i=0;i<t;++i)a[i]=n.structure.getAtomProxy(n.getAtomIndexByType(i,r));e.apply(this,a);for(var s=t;s<o;++s){for(i=1;i<t;++i)a[i-1].index=a[i].index;a[t-1].index=n.getAtomIndexByType(s,r),e.apply(n,a)}},Ly.prototype.eachAtomN2=function(t,e,r){var i=this,n=this.atomOffset,o=this.atomCount,a=n+o;if(!(o<t)){for(var s=new Array(t),c=0;c<t;++c)s[c]=i.structure.getAtomProxy();var u=this.structure.atomSetCache["__"+r];void 0===u&&(Uf.warn("no precomputed atomSet for: "+r),u=this.structure.getAtomSet(!1),this.eachResidue(function(t){var e=t.getAtomByName(r);u.set(e.index)}));var h=0;u.forEach(function(r){if(r>=n&&r<a){for(var i=1;i<t;++i)s[i-1].index=s[i].index;s[t-1].index=r,(h+=1)>=t&&e.apply(this,s)}})}},Ly.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),r=this.residueCount,i=this.residueIndexStart,n=0;n<r;++n)e.index=i+n,t(e)},Ly.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(Ly.prototype,Oy);var Dy=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},Ny={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};Ny.entity.get=function(){return this.structure.entityList[this.entityIndex]},Ny.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},Ny.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},Ny.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},Ny.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},Ny.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},Ny.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},Ny.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},Ny.residueCount.get=function(){return this.chainStore.residueCount[this.index]},Ny.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},Ny.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},Ny.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},Ny.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},Ny.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},Ny.chainname.get=function(){return this.chainStore.getChainname(this.index)},Ny.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},Ny.chainid.get=function(){return this.chainStore.getChainid(this.index)},Ny.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},Dy.prototype.eachAtom=function(t,e){this.eachResidue(function(r){r.eachAtom(t,e)},e)},Dy.prototype.eachResidue=function(t,e){var r,i=this.residueCount,n=this.residueOffset,o=this.structure._rp,a=n+i;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(r=n;r<a;++r)o.index=r,s(o)&&t(o,e);else for(r=n;r<a;++r)o.index=r,t(o,e)}else for(r=n;r<a;++r)o.index=r,t(o)},Dy.prototype.eachResidueN=function(t,e){var r,i=this,n=this.residueCount,o=this.residueOffset,a=o+n;if(!(n<t)){var s=new Array(t);for(r=0;r<t;++r)s[r]=i.structure.getResidueProxy(o+r);e.apply(this,s);for(var c=o+t;c<a;++c){for(r=0;r<t;++r)s[r].index+=1;e.apply(i,s)}}},Dy.prototype.eachPolymer=function(t,e){for(var r,i,n=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),h=this.structure.getResidueProxy(s),l=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=h.index,h.index=f,d&&(r=u.index,d=!1),i=h.index;var m=d?u.backboneEndType:u.backboneType,g=h.backboneType;m!==Sv&&m===g?(l.index=u.backboneEndAtomIndex,p.index=h.backboneStartAtomIndex,l&&p&&l.connectedTo(p)&&(!n||n(u)&&n(h))||(u.index-r>1&&t(new Ly(o,r,u.index)),r=i)):(m!==Sv&&u.index-r>1&&t(new Ly(o,r,u.index)),r=i)}i-r>1&&this.structure.getResidueProxy(r).backboneStartType&&t(new Ly(o,r,i))},Dy.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},Dy.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Dy.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(Dy.prototype,Ny);var ky=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},Fy={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};Fy.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},Fy.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},Fy.chainCount.get=function(){return this.modelStore.chainCount[this.index]},Fy.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},Fy.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},Fy.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},Fy.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},Fy.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},Fy.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},Fy.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},Fy.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},ky.prototype.eachAtom=function(t,e){this.eachChain(function(r){r.eachAtom(t,e)},e)},ky.prototype.eachResidue=function(t,e){this.eachChain(function(r){r.eachResidue(t,e)},e)},ky.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var r=e.chainOnlyTest;this.eachChain(function(i){r(i)&&i.eachPolymer(t,e)})}else this.eachChain(function(r){r.eachPolymer(t,e)})},ky.prototype.eachChain=function(t,e){var r,i=this.chainCount,n=this.chainOffset,o=this.structure._cp,a=n+i;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(r=n;r<a;++r)o.index=r,s(o)&&t(o,e);else for(r=n;r<a;++r)o.index=r,t(o,e)}else for(r=n;r<a;++r)o.index=r,t(o)},ky.prototype.qualifiedName=function(){return"/"+this.index},ky.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ky.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(ky.prototype,Fy);var By=function(t,e){this.signals={refreshed:new no},this.init(t,e)},zy={type:{}};By.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new sy(0),this.backboneBondStore=new sy(0),this.rungBondStore=new sy(0),this.atomStore=new cy(0),this.residueStore=new uy(0),this.chainStore=new hy(0),this.modelStore=new ly(0),this.atomMap=new Sy(this),this.residueMap=new My(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()},zy.type.get=function(){return"Structure"},By.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new qa(this.atomStore,this.boundingBox)},By.prototype.finalizeBonds=function(){var t=this;this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new oy(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1));for(var e in t.atomSetDict)t.atomSetCache["__"+e]=t.atomSetDict[e].clone()},By.prototype.getBondProxy=function(t){return new Ty(this,t)},By.prototype.getAtomProxy=function(t){return new Py(this,t)},By.prototype.getResidueProxy=function(t){return new Iy(this,t)},By.prototype.getChainProxy=function(t){return new Dy(this,t)},By.prototype.getModelProxy=function(t){return new ky(this,t)},By.prototype.getBondSet=function(){var t=this.bondStore.count,e=new vv(t),r=this.atomSet;if(r)for(var i=this.getBondProxy(),n=0;n<t;++n)i.index=n,r.isSet(i.atomIndex1,i.atomIndex2)&&e.set(i.index);else e.setAll();return e},By.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new vv(t),r=this.atomSetCache.__backbone;if(r){var i=this.getBondProxy();i.bondStore=this.backboneBondStore;for(var n=0;n<t;++n)i.index=n,r.isSet(i.atomIndex1,i.atomIndex2)&&e.set(i.index)}else e.set_all(!0);return e},By.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new vv(t),r=this.atomSetCache.__rung;if(r){var i=this.getBondProxy();i.bondStore=this.rungBondStore;for(var n=0;n<t;++n)i.index=n,r.isSet(i.atomIndex1,i.atomIndex2)&&e.set(i.index)}else e.set_all(!0);return e},By.prototype.getAtomSet=function(t){var e,r=this.atomStore.count;if(t instanceof vv)e=t;else if(t&&t.test){var i=t.string;i in this.atomSetCache?e=this.atomSetCache[i]:(e=new vv(r),this.eachAtom(function(t){e.set(t.index)},t),this.atomSetCache[i]=e)}else e=!1===t?new vv(r):new vv(r,!0);return e},By.prototype.getAtomSetWithinSelection=function(t,e){var r=this.spatialHash,i=this.getAtomSet(!1),n=this.getAtomProxy();return this.getAtomSet(t).forEach(function(t){n.index=t,r.within(n.x,n.y,n.z,e).forEach(function(t){i.set(t)})}),i},By.prototype.getAtomSetWithinPoint=function(t,e){var r=t,i=this.getAtomSet(!1);return this.spatialHash.within(r.x,r.y,r.z,e).forEach(function(t){i.set(t)}),i},By.prototype.getAtomSetWithinVolume=function(t,e,r,i,n){for(var o=this,a=new iy(t,r,i,n),s=a.getDataPosition(),c=s.length,u=a.matrix.getMaxScaleOnAxis(),h=this.getAtomSet(!1),l=0;l<c;l+=3)o.spatialHash.within(s[l],s[l+1],s[l+2],u).forEach(function(t){h.set(t)});return h},By.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,r=this.getAtomSet(!1),i=this.getResidueProxy();return this.getAtomSet(t).forEach(function(t){i.index=e[t];for(var n=i.atomOffset;n<=i.atomEnd;++n)r.set(n)}),r},By.prototype.getSelection=function(){return!1},By.prototype.getStructure=function(){return this},By.prototype.eachEntity=function(t,e){this.entityList.forEach(function(r){void 0!==e&&r.getEntityType()!==e||t(r)})},By.prototype.eachBond=function(t,e){var r,i=this.getBondProxy();if(e&&e.test&&(r=this.getBondSet(e),this.bondSet&&r.intersection(this.bondSet)),r)r.forEach(function(e){i.index=e,t(i)});else for(var n=this.bondStore.count,o=0;o<n;++o)i.index=o,t(i)},By.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel(function(r){r.eachAtom(t,e)},e);else for(var r=this.atomStore.count,i=this.getAtomProxy(),n=0;n<r;++n)i.index=n,t(i)},By.prototype.eachResidue=function(t,e){if(e&&e.test){var r=this.modelStore.count,i=this.getModelProxy(),n=e.modelOnlyTest;if(n)for(var o=0;o<r;++o)i.index=o,n(i)&&i.eachResidue(t,e);else for(var a=0;a<r;++a)i.index=a,i.eachResidue(t,e)}else for(var s=this.residueStore.count,c=this.getResidueProxy(),u=0;u<s;++u)c.index=u,t(c)},By.prototype.eachResidueN=function(t,e){var r=this,i=this.residueStore.count;if(!(i<t)){for(var n=new Array(t),o=0;o<t;++o)n[o]=r.getResidueProxy(o);e.apply(this,n);for(var a=t;a<i;++a){for(var s=0;s<t;++s)n[s].index+=1;e.apply(r,n)}}},By.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var r=e.modelOnlyTest;this.eachModel(function(i){r(i)&&i.eachPolymer(t,e)})}else this.eachModel(function(r){r.eachPolymer(t,e)})},By.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel(function(r){r.eachChain(t,e)});else for(var r=this.chainStore.count,i=this.getChainProxy(),n=0;n<r;++n)i.index=n,t(i)},By.prototype.eachModel=function(t,e){var r=this.modelStore.count,i=this.getModelProxy();if(e&&e.test){var n=e.modelOnlyTest;if(n)for(var o=0;o<r;++o)i.index=o,n(i)&&t(i,e);else for(var a=0;a<r;++a)i.index=a,t(i,e)}else for(var s=0;s<r;++s)i.index=s,t(i)},By.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var r,i,n,o,a,s,c,u=e.what,h=gn(e.atomSet,this.atomSet),l={},p=this.getAtomProxy(),d=h.getSize();return u&&!u.position||(n=new Float32Array(3*d),l.position=n),u&&!u.color||(o=new Float32Array(3*d),l.color=o,i=$f.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),l.picking=new Qg(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),l.radius=s,r=new Ta(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),l.index=c),h.forEach(function(t,e){var u=3*e;p.index=t,n&&p.positionToArray(n,u),o&&i.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=r.atomRadius(p)),c&&(c[e]=t)}),l},By.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var r,i,n,o,a,s,c,u,h,l=e.what,p=gn(e.bondSet,this.bondSet),d=gn(e.multipleBond,"off"),f="off"!==d,m="offset"===d,v=gn(e.bondScale,.4),y=gn(e.bondSpacing,1),b={},x=this.getBondProxy();e.bondStore&&(x.bondStore=e.bondStore);var _,w=this.getAtomProxy(),S=this.getAtomProxy();if(f){var A=x.bondStore.bondOrder;_=0,p.forEach(function(t){_+=A[t]})}else _=p.getSize();l&&!l.position||(n=new Float32Array(3*_),o=new Float32Array(3*_),b.position1=n,b.position2=o),l&&!l.color||(a=new Float32Array(3*_),s=new Float32Array(3*_),b.color=a,b.color2=s,i=$f.getScheme(e.colorParams)),l&&!l.picking||(c=new Float32Array(_),b.picking=new tv(c,this.getStructure(),e.bondStore)),(!l||l.radius||f&&l.position)&&(r=new Ta(e.radiusParams.radius,e.radiusParams.scale)),l&&!l.radius||(u=new Float32Array(_),b.radius=u,e.radius2&&(h=new Float32Array(_),b.radius2=h));var M,T,E,P,C,I,R,L=0,O=new g,D=new g,N=new g;return p.forEach(function(t){if(T=3*L,x.index=t,w.index=x.atomIndex1,S.index=x.atomIndex2,P=x.bondOrder,n&&(f&&P>1?(C=r.atomRadius(w),I=C*v/(.5*P),x.calculateShiftDir(N),m?(R=2*y*C,N.multiplyScalar(R),N.negate(),D.subVectors(S,w).multiplyScalar(Math.max(.1,R/1.88)),w.positionToArray(n,T),S.positionToArray(o,T),P>=2&&(O.addVectors(w,N).add(D).toArray(n,T+3),O.addVectors(S,N).sub(D).toArray(o,T+3),P>=3&&(O.subVectors(w,N).add(D).toArray(n,T+6),O.subVectors(S,N).sub(D).toArray(o,T+6)))):(R=(y-v)*C,N.multiplyScalar(R),2===P?(O.addVectors(w,N).toArray(n,T),O.subVectors(w,N).toArray(n,T+3),O.addVectors(S,N).toArray(o,T),O.subVectors(S,N).toArray(o,T+3)):3===P?(w.positionToArray(n,T),O.addVectors(w,N).toArray(n,T+3),O.subVectors(w,N).toArray(n,T+6),S.positionToArray(o,T),O.addVectors(S,N).toArray(o,T+3),O.subVectors(S,N).toArray(o,T+6)):(w.positionToArray(n,T),S.positionToArray(o,T)))):(w.positionToArray(n,T),S.positionToArray(o,T))),a&&(i.bondColorToArray(x,1,a,T),i.bondColorToArray(x,0,s,T),f&&P>1))for(M=1;M<P;++M)Go(a,T,E=3*M+T,3),Go(s,T,E,3);if(c&&(c[L]=t,f&&P>1))for(M=1;M<P;++M)c[L+M]=t;if(u&&(u[L]=r.atomRadius(w),f&&P>1))for(I=u[L]*v/(m?1:.5*P),M=m?1:0;M<P;++M)u[L+M]=I;if(h&&(h[L]=r.atomRadius(S),f&&P>1))for(I=h[L]*v/(m?1:.5*P),M=m?1:0;M<P;++M)h[L+M]=I;L+=f?P:1}),b},By.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},By.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},By.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},By.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},By.prototype.getBoundingBox=function(e,r){t.Debug&&Uf.time("getBoundingBox"),r=r||new st;var i=1/0,n=1/0,o=1/0,a=-1/0,s=-1/0,c=-1/0;return this.eachAtom(function(t){var e=t.x,r=t.y,u=t.z;e<i&&(i=e),r<n&&(n=r),u<o&&(o=u),e>a&&(a=e),r>s&&(s=r),u>c&&(c=u)},e),r.min.set(i,n,o),r.max.set(a,s,c),t.Debug&&Uf.timeEnd("getBoundingBox"),r},By.prototype.getPrincipalAxes=function(e){t.Debug&&Uf.time("getPrincipalAxes");var r=0,i=new Ea(3,this.atomCount),n=i.data;return this.eachAtom(function(t){n[r+0]=t.x,n[r+1]=t.y,n[r+2]=t.z,r+=3},e),t.Debug&&Uf.timeEnd("getPrincipalAxes"),new Qv(i)},By.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},By.prototype.getSequence=function(t){var e=[],r=this.getResidueProxy();return this.eachAtom(function(t){r.index=t.residueIndex,t.index===r.traceAtomIndex&&e.push(r.getResname1())},t),e},By.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{var r={what:{index:!0}};e=this.getAtomData(r).index}return e},By.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},By.prototype.updatePosition=function(t){var e=0;this.eachAtom(function(r){r.positionFromArray(t,e),e+=3})},By.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new qa(this.atomStore,this.boundingBox)},By.prototype.dispose=function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet},Object.defineProperties(By.prototype,zy);var Uy=function(t,e){var r;"function"==typeof t.eachAtom?r=t.atomCount:t instanceof Float32Array&&(r=t.length/3);var i=new Ea(3,r),n=new Ea(3,r);this.coords1t=new Ea(r,3),this.coords2t=new Ea(r,3),this.A=new Ea(3,3),this.W=new Ea(1,3),this.U=new Ea(3,3),this.V=new Ea(3,3),this.VH=new Ea(3,3),this.R=new Ea(3,3),this.tmp=new Ea(3,3),this.c=new Ea(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,i),this.prepCoords(e,n),this._superpose(i,n)};Uy.prototype._superpose=function(e,r){this.mean1=Oa(e),this.mean2=Oa(r),Da(e,this.mean1),Da(r,this.mean2),Pa(this.coords1t,e),Pa(this.coords2t,r),Ca(this.A,this.coords2t,this.coords1t),za(this.A,this.W,this.U,this.V),Ia(this.V,this.VH),La(this.R,this.U,this.VH),Ra(this.R)<0&&(t.Debug&&Uf.log("R not a right handed system"),La(this.tmp,this.c,this.VH),La(this.R,this.U,this.tmp))},Uy.prototype.prepCoords=function(t,e){var r=0,i=e.data;"function"==typeof t.eachAtom?t.eachAtom(function(t){i[r+0]=t.x,i[r+1]=t.y,i[r+2]=t.z,r+=3}):t instanceof Float32Array?i.set(t):Uf.warn("prepCoords: input type unknown")},Uy.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var r=new Ea(3,e),i=new Ea(e,3);this.prepCoords(t,r),Da(r,this.mean1),Ca(i,this.R,r),Pa(r,i),Na(r,this.mean2);var n=0,o=r.data;"function"==typeof t.eachAtom?t.eachAtom(function(t){t.x=o[n+0],t.y=o[n+1],t.z=o[n+2],n+=3}):t instanceof Float32Array?t.set(o.subarray(0,3*e)):Uf.warn("transform: input type unknown")};var jy=function(t,e){this.signals={startedRunning:new no,haltedRunning:new no},t.signals.playerChanged.add(function(t){t!==this&&this.pause()},this);var r=Object.assign({},e),i=gn(t.frameCount,1);this.traj=t,this.start=gn(r.start,0),this.end=Math.min(gn(r.end,i-1),i-1),this.step=gn(r.step,Math.ceil((i+1)/100)),this.timeout=gn(r.timeout,50),this.interpolateType=gn(r.interpolateType,""),this.interpolateStep=gn(r.interpolateStep,5),this.mode=gn(r.mode,"loop"),this.direction=gn(r.direction,"forward"),this._run=!1,this._previousTime=0,this._currentTime=0,this._currentStep=1,this._currentFrame=this.start,this._direction="bounce"===this.direction?"forward":this.direction,t.signals.countChanged.add(function(t){this.end=Math.min(gn(this.end,t-1),t-1)},this),this._animate=this._animate.bind(this)},Gy={isRunning:{}};Gy.isRunning.get=function(){return this._run},jy.prototype.setParameters=function(t){var e=Object.assign({},t);void 0!==e.start&&(this.start=e.start),void 0!==e.end&&(this.end=e.end),void 0!==e.step&&(this.step=e.step),void 0!==e.timeout&&(this.timeout=e.timeout),void 0!==e.interpolateType&&(this.interpolateType=e.interpolateType),void 0!==e.interpolateStep&&(this.interpolateStep=e.interpolateStep),void 0!==e.mode&&(this.mode=e.mode),void 0!==e.direction&&(this.direction=e.direction,"bounce"!==this.direction&&(this._direction=this.direction))},jy.prototype._animate=function(){if(this._run){this._currentTime=window.performance.now();var t=this._currentTime-this._previousTime,e=this.interpolateType?this.interpolateStep:1,r=this.timeout/e,i=this.traj;if(i&&i.frameCount&&!i.inProgress&&t>=r)if(this.interpolateType)if(this._currentStep>this.interpolateStep&&(this._currentStep=1),1===this._currentStep&&(this._currentFrame=this._nextInterpolated()),i.hasFrame(this._currentFrame)){this._currentStep+=1;var n=this._currentStep/(this.interpolateStep+1);i.setFrameInterpolated.apply(i,this._currentFrame.concat([n],[this.interpolateType])),this._previousTime=this._currentTime}else i.loadFrame(this._currentFrame);else{var o=this._next();i.hasFrame(o)?(i.setFrame(o),this._previousTime=this._currentTime):i.loadFrame(o)}window.requestAnimationFrame(this._animate)}},jy.prototype._next=function(){var t;return((t="forward"===this._direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>this.end||t<this.start)&&("bounce"===this.direction&&("forward"===this._direction?this._direction="backward":this._direction="forward"),"once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:"backward"===this.direction?this.start:"forward"===this._direction?this.start:this.end):"forward"===this._direction?(t=this.start,this.interpolateType&&(t=Math.min(this.end,t+this.step))):(t=this.end,this.interpolateType&&(t=Math.max(this.start,t-this.step)))),t},jy.prototype._nextInterpolated=function(){var t,e,r,i=this._next();return"forward"===this._direction?(t=Math.max(this.start,i-this.step),e=Math.max(this.start,i-2*this.step),r=Math.max(this.start,i-3*this.step)):(t=Math.min(this.end,i+this.step),e=Math.min(this.end,i+2*this.step),r=Math.min(this.end,i+3*this.step)),[i,t,e,r]},jy.prototype.toggle=function(){this._run?this.pause():this.play()},jy.prototype.play=function(){if(!this._run){this.traj.player!==this&&this.traj.setPlayer(this),this._currentStep=1;var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&t>=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._run=!0,this._animate(),this.signals.startedRunning.dispatch()}},jy.prototype.pause=function(){this._run=!1,this.signals.haltedRunning.dispatch()},jy.prototype.stop=function(){this.pause(),this.traj.setFrame(this.start)},Object.defineProperties(jy.prototype,Gy);var Vy=function(t,e,r){this.signals={countChanged:new no,frameChanged:new no,playerChanged:new no};var i=r||{};this.deltaTime=gn(i.deltaTime,0),this.timeOffset=gn(i.timeOffset,0),this.centerPbc=gn(i.centerPbc,!1),this.removePbc=gn(i.removePbc,!1),this.superpose=gn(i.superpose,!1),this.name=t.replace(/^.*[\\/]/,""),this.trajPath=t,this.initialCoords=null,this.structureCoords=null,this.selection=new Pf(gn(i.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add(function(){this.selectionIndices=this.structure.getAtomIndices(this.selection),this._resetCache(),this._saveInitialCoords(),this.setFrame(this._currentFrame)},this),this._frameCount=0,this._currentFrame=-1},$y={frameCount:{},currentFrame:{}};$y.frameCount.get=function(){return this._frameCount},$y.currentFrame.get=function(){return this._currentFrame},Vy.prototype._init=function(t){this.setStructure(t),this._loadFrameCount(),this.setPlayer(new jy(this))},Vy.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.backboneIndices=this._getIndices(new Pf("backbone and not hydrogen")),this._makeAtomIndices(),this._saveStructureCoords(),this.selectionIndices=this._getIndices(this.selection),this._resetCache(),this._saveInitialCoords(),this.setFrame(this._currentFrame)},Vy.prototype._saveInitialCoords=function(){var t=this;this.frameCache[0]?(this.initialCoords=new Float32Array(this.frameCache[0]),this._makeSuperposeCoords()):this.loadFrame(0,function(){return t._saveInitialCoords()})},Vy.prototype._saveStructureCoords=function(){var t={what:{position:!0}};this.structureCoords=this.structure.getAtomData(t).position},Vy.prototype.setSelection=function(t){return this.selection.setString(t),this},Vy.prototype._getIndices=function(t){var e=0,r=t.test,i=[];return this.structure.eachAtom(function(t){r(t)&&i.push(e),e+=1}),i},Vy.prototype._makeSuperposeCoords=function(){var t=this,e=3*this.selectionIndices.length;this.coords1=new Float32Array(e),this.coords2=new Float32Array(e);for(var r=this.initialCoords,i=this.coords2,n=0;n<e;n+=3){var o=3*t.selectionIndices[n/3];i[n+0]=r[o+0],i[n+1]=r[o+1],i[n+2]=r[o+2]}},Vy.prototype._makeAtomIndices=function(){Uf.error("Trajectory._makeAtomIndices not implemented")},Vy.prototype._resetCache=function(){this.frameCache={},this.loadQueue={},this.boxCache={},this.pathCache={},this.frameCacheSize=0,this.initialCoords=null},Vy.prototype.setParameters=function(t){var e=t||{},r=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,r=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,r=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,r=!0),this.deltaTime=gn(e.deltaTime,this.deltaTime),this.timeOffset=gn(e.timeOffset,this.timeOffset),r&&(this._resetCache(),this.setFrame(this._currentFrame))},Vy.prototype.hasFrame=function(t){var e=this;return Array.isArray(t)?t.every(function(t){return!!e.frameCache[t]}):!!this.frameCache[t]},Vy.prototype.setFrame=function(t,e){var r=this;return void 0===t?this:(this.inProgress=!0,t=parseInt(t),-1===t||this.frameCache[t]?(this._updateStructure(t),e&&e()):this.loadFrame(t,function(){r._updateStructure(t),e&&e()}),this)},Vy.prototype._interpolate=function(t,e,r,i,n,o){var a,s=this.frameCache;a="spline"===o?Cs(s[t],s[e],s[r],s[i],n):Is(s[t],s[e],n),this.structure.updatePosition(a),this._currentFrame=t,this.signals.frameChanged.dispatch(t)},Vy.prototype.setFrameInterpolated=function(t,e,r,i,n,o,a){var s=this;if(void 0===t)return this;var c=this.frameCache,u=[];return c[i]||u.push(i),c[r]||u.push(r),c[e]||u.push(e),c[t]||u.push(t),u.length?this.loadFrame(u,function(){s._interpolate(t,e,r,i,n,o),a&&a()}):(this._interpolate(t,e,r,i,n,o),a&&a()),this},Vy.prototype.loadFrame=function(t,e){var r=this;Array.isArray(t)?t.forEach(function(t){r.loadQueue[t]||r.frameCache[t]||(r.loadQueue[t]=!0,r._loadFrame(t,function(){delete r.loadQueue[t]}))}):this.loadQueue[t]||this.frameCache[t]||(this.loadQueue[t]=!0,this._loadFrame(t,function(){delete r.loadQueue[t],e&&e()}))},Vy.prototype._loadFrame=function(t,e){Uf.error("Trajectory._loadFrame not implemented",t,e)},Vy.prototype._updateStructure=function(t){this._disposed?console.error("updateStructure: traj disposed"):(-1===t?this.structureCoords&&this.structure.updatePosition(this.structureCoords):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},this._currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},Vy.prototype._doSuperpose=function(t){for(var e=this,r=3*this.selectionIndices.length,i=this.coords1,n=this.coords2,o=0;o<r;o+=3){var a=3*e.selectionIndices[o/3];i[o+0]=t[a+0],i[o+1]=t[a+1],i[o+2]=t[a+2]}new Uy(i,n).transform(t)},Vy.prototype._process=function(t,e,r,i){if(this._setFrameCount(i),e){if(this.backboneIndices.length>0&&this.centerPbc){var n=[e[0],e[4],e[8]];Ts(r,Ps(this.backboneIndices,r,n),n)}this.removePbc&&Es(r,e)}this.selectionIndices.length>0&&this.coords1&&this.superpose&&this._doSuperpose(r),this.frameCache[t]=r,this.boxCache[t]=e,this.frameCacheSize+=1},Vy.prototype._setFrameCount=function(t){t!==this._frameCount&&(this._frameCount=t,this.signals.countChanged.dispatch(t))},Vy.prototype.dispose=function(){this._resetCache(),this._disposed=!0,this.player&&this.player.stop()},Vy.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},Vy.prototype.getPath=function(t,e){Uf.error("Trajectory.getPath not implemented",t,e)},Vy.prototype.getFrameTime=function(t){return this.timeOffset+t*this.deltaTime},Object.defineProperties(Vy.prototype,$y),qf.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),qf.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\nif( opacity < 0.7 )\ndiscard;\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}");var Hy={f:1,v2:2,v3:3,c:3},Wy=function(t,e){var r=t||{},i=e||{};this.opaqueBack=gn(i.opaqueBack,!1),this.dullInterior=gn(i.dullInterior,!1),this.side=gn(i.side,"double"),this.opacity=gn(i.opacity,1),this.depthWrite=gn(i.depthWrite,!0),this.clipNear=gn(i.clipNear,0),this.clipRadius=gn(i.clipRadius,0),this.clipCenter=gn(i.clipCenter,new g),this.flatShaded=gn(i.flatShaded,!1),this.background=gn(i.background,!1),this.linewidth=gn(i.linewidth,1),this.wireframe=gn(i.wireframe,!1),this.wireframeLinewidth=gn(i.wireframeLinewidth,1),this.roughness=gn(i.roughness,.4),this.metalness=gn(i.metalness,0),this.diffuse=gn(i.diffuse,16777215),this.forceTransparent=gn(i.forceTransparent,!1),this.disablePicking=gn(i.disablePicking,!1),this.geometry=new Ct,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=cp.merge([sp.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new tt(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},sp.ambient,sp.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new Ne,this.wireframeGroup=new Ne,this.pickingGroup=new Ne,this.matrix=gn(i.matrix,new v);var n=r.position||r.position1;this._positionDataSize=n?n.length/3:0,this.addAttributes({position:{type:"v3",value:r.position},color:{type:"c",value:r.color},primitiveId:{type:"f",value:r.primitiveId}}),r.index&&this.initIndex(r.index),this.picking=r.picking,this.makeWireframeGeometry()},Xy={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};Xy.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0},matrix:{}}},Xy.matrix.set=function(t){this.setMatrix(t)},Xy.matrix.get=function(){return this.group.matrix.clone()},Xy.transparent.get=function(){return this.opacity<1||this.forceTransparent},Xy.size.get=function(){return this._positionDataSize},Xy.attributeSize.get=function(){return this.size},Xy.pickable.get=function(){return!!this.picking&&!this.disablePicking},Xy.dynamic.get=function(){return!0},Xy.vertexShader.get=function(){},Xy.fragmentShader.get=function(){},Wy.prototype.setMatrix=function(t){Ls(this.group,t),Ls(this.wireframeGroup,t),Ls(this.pickingGroup,t)},Wy.prototype.initIndex=function(t){this.geometry.setIndex(new St(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},Wy.prototype.makeMaterial=function(){var t=Rs(this.side),e=new ot({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=ch,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var r=new ot({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});r.vertexColors=ch,r.clipNear=this.clipNear;var i=new ot({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:uh});i.vertexColors=ch,i.extensions.fragDepth=this.isImpostor,i.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=r,this.pickingMaterial=i,this.updateShader()},Wy.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,r=new Ct;r.attributes=t.attributes,e&&(r.setIndex(new St(e,1).setDynamic(this.dynamic)),r.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=r},Wy.prototype.makeWireframeIndex=function(){function t(t,r){if(t>r){var i=t;t=r,r=i}var n=e[t];return void 0===n?(e[t]=[r],!0):!n.includes(r)&&(n.push(r),!0)}var e=[],r=this.geometry,i=r.index;if(this.wireframe)if(i){var n=i.array,o=n.length;r.drawRange.count!==1/0&&(o=r.drawRange.count);var a;a=this.wireframeIndex&&this.wireframeIndex.length>2*o?this.wireframeIndex:On(2*o,r.attributes.position.count);var s=0;e.length=0;for(var c=0;c<o;c+=3){var u=n[c+0],h=n[c+1],l=n[c+2];t(u,h)&&(a[s+0]=u,a[s+1]=h,s+=2),t(h,l)&&(a[s+0]=h,a[s+1]=l,s+=2),t(l,u)&&(a[s+0]=l,a[s+1]=u,s+=2)}this.wireframeIndex=a,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=r.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:On(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},Wy.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new St(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},Wy.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},Wy.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,r=this.geometry,i=this[t];return this.isLine?e=new Re(r,i):this.isPoint?(e=new De(r,i),this.sortParticles&&(e.sortParticles=!0)):e=new Bt(r,i),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},Wy.prototype.getMesh=function(){return this._getMesh("material")},Wy.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),t=new Re(this.wireframeGeometry,this.wireframeMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},Wy.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},Wy.prototype.getShader=function(t,e){return Ro(t,this.getDefines(e))},Wy.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},Wy.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},Wy.prototype.getDefines=function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},Wy.prototype.getParameters=function(){var t=this,e={};for(var r in t.parameters)e[r]=t[r];return e},Wy.prototype.addUniforms=function(t){this.uniforms=cp.merge([this.uniforms,t]),this.pickingUniforms=cp.merge([this.pickingUniforms,t])},Wy.prototype.addAttributes=function(t){var e=this;for(var r in t){var i=void 0,n=t[r],o=e.attributeSize*Hy[n.type];n.value?(o!==n.value.length&&Uf.error("attribute value has wrong length",r),i=n.value):i=Ln("float32",o),e.geometry.addAttribute(r,new St(i,Hy[n.type]).setDynamic(e.dynamic))}},Wy.prototype.updateRenderOrder=function(){function t(t){t.renderOrder=e}var e=this.getRenderOrder();this.group.children.forEach(t),this.pickingGroup&&this.pickingGroup.children.forEach(t)},Wy.prototype.updateShader=function(){var t=this.material,e=this.wireframeMaterial,r=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,r.vertexShader=this.getVertexShader("picking"),r.fragmentShader=this.getFragmentShader("picking"),r.needsUpdate=!0},Wy.prototype.setParameters=function(t){var e=this;if(t){var r=t,i=this.parameters,n={},o={},a=!1,s=!1;for(var c in r){var u=r[c];void 0!==u&&(void 0!==i[c]&&(e[c]=u,i[c].property&&(!0!==i[c].property?n[i[c].property]=u:n[c]=u),i[c].uniform&&(!0!==i[c].uniform?o[i[c].uniform]=u:o[c]=u),i[c].updateShader&&(a=!0),i[c].updateVisibility&&(s=!0),e.dynamic&&"wireframe"===c&&!0===u&&e.updateWireframeIndex(),"flatShaded"===c&&(e.material.extensions.derivatives=e.flatShaded),"forceTransparent"===c&&(n.transparent=e.transparent)))}this.setProperties(n),this.setUniforms(o),a&&this.updateShader(),s&&this.setVisibility(this.visible)}},Wy.prototype.setAttributes=function(t){var e=this,r=this.geometry,i=r.attributes;for(var n in t)if("picking"!==n){var o=t[n],a=o.length;if("index"===n){var s=r.getIndex();r.setDrawRange(0,1/0),a>s.array.length?r.setIndex(new St(o,1).setDynamic(e.dynamic)):(s.set(o),s.needsUpdate=a>0,s.updateRange.count=a,r.setDrawRange(0,a)),e.indexVersion++,e.wireframe&&e.updateWireframeIndex()}else{var c=i[n];a>c.array.length?r.addAttribute(n,new St(o,c.itemSize).setDynamic(e.dynamic)):(i[n].set(o),i[n].needsUpdate=a>0,i[n].updateRange.count=a)}}},Wy.prototype.setUniforms=function(t){var e=this;if(t){var r=this.material.uniforms,i=this.wireframeMaterial.uniforms,n=this.pickingMaterial.uniforms;for(var o in t)"opacity"===o&&e.setProperties({transparent:e.transparent}),void 0!==r[o]&&(r[o].value.isVector3?r[o].value.copy(t[o]):r[o].value.set?r[o].value.set(t[o]):r[o].value=t[o]),void 0!==i[o]&&(i[o].value.isVector3?i[o].value.copy(t[o]):i[o].value.set?i[o].value.set(t[o]):i[o].value=t[o]),void 0!==n[o]&&(n[o].value.isVector3?n[o].value.copy(t[o]):n[o].value.set?n[o].value.set(t[o]):n[o].value=t[o])}},Wy.prototype.setProperties=function(t){var e=this;if(t){var r=this.material,i=this.wireframeMaterial,n=this.pickingMaterial;for(var o in t){var a=t[o];"transparent"===o?e.updateRenderOrder():"side"===o&&(a=Rs(a)),void 0!==r[o]&&(r[o]=a),void 0!==i[o]&&(i[o]=a),void 0!==n[o]&&(n[o]=a)}r.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0}},Wy.prototype.setVisibility=function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},Wy.prototype.dispose=function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()},Object.defineProperties(Wy.prototype,Xy);var qy=function(t){function e(e,r){var i=e||{};!i.primitiveId&&i.position&&(i.primitiveId=Bo(i.position.length/3)),t.call(this,i,r),this.addAttributes({normal:{type:"v3",value:i.normal}}),void 0===i.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={vertexShader:{},fragmentShader:{}};return r.vertexShader.get=function(){return"Mesh.vert"},r.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,r),e}(Wy),Yy=new st,Zy=[Vg,zg,$g,Gg,Hg,Ug,Bg,jg,Xg,Wg],Ky=function(t,e){var r=this;this.name=gn(t,"shape");var i=e||{};this.aspectRatio=gn(i.aspectRatio,1.5),this.sphereDetail=gn(i.sphereDetail,2),this.radialSegments=gn(i.radialSegments,50),this.disableImpostor=gn(i.disableImpostor,!1),this.openEnded=gn(i.openEnded,!1),this.labelParams=gn(i.labelParams,{}),this.boundingBox=new st,this.bufferList=[],this.meshCount=0,Zy.forEach(function(t){Object.keys(t.fields).forEach(function(e){r[t.getShapeKey(e)]=[]}),r[t.getShapeKey("name")]=[]})},Qy={center:{},type:{}};Ky.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},Ky.prototype.addMesh=function(t,e,r,i,n){t=Gn(t),e=Gn(e),Array.isArray(r)&&(r=On(r,t.length)),i&&(i=Gn(i));var o={position:t,color:e,index:r,normal:i},a=new uv(this,Object.assign({serial:this.meshCount,name:n},o)),s=new qy(Object.assign({picking:a},o));return this.bufferList.push(s),Yy.setFromArray(t),this.boundingBox.union(Yy),this.meshCount+=1,this},Ky.prototype.addSphere=function(t,e,r,i){return Bg.objectToShape(this,{position:t,color:e,radius:r,name:i}),this},Ky.prototype.addEllipsoid=function(t,e,r,i,n,o){return Hg.objectToShape(this,{position:t,color:e,radius:r,majorAxis:i,minorAxis:n,name:o}),this},Ky.prototype.addTorus=function(t,e,r,i,n,o){return Wg.objectToShape(this,{position:t,color:e,radius:r,majorAxis:i,minorAxis:n,name:o}),this},Ky.prototype.addCylinder=function(t,e,r,i,n){return Gg.objectToShape(this,{position1:t,position2:e,color:r,radius:i,name:n}),this},Ky.prototype.addCone=function(t,e,r,i,n){return $g.objectToShape(this,{position1:t,position2:e,color:r,radius:i,name:n}),this},Ky.prototype.addArrow=function(t,e,r,i,n){return Vg.objectToShape(this,{position1:t,position2:e,color:r,radius:i,name:n}),this},Ky.prototype.addBox=function(t,e,r,i,n,o){return zg.objectToShape(this,{position:t,color:e,size:r,heightAxis:i,depthAxis:n,name:o}),this},Ky.prototype.addOctahedron=function(t,e,r,i,n,o){return Ug.objectToShape(this,{position:t,color:e,size:r,heightAxis:i,depthAxis:n,name:o}),this},Ky.prototype.addTetrahedron=function(t,e,r,i,n,o){return jg.objectToShape(this,{position:t,color:e,size:r,heightAxis:i,depthAxis:n,name:o}),this},Ky.prototype.addText=function(t,e,r,i){return Xg.objectToShape(this,{position:t,color:e,size:r,text:i}),this},Ky.prototype.addLabel=function(t,e,r,i){return console.warn("Shape.addLabel is deprecated, use .addText instead"),this.addText(t,e,r,i)},Ky.prototype.getBufferList=function(){var t=this,e=[],r={aspectRatio:this.aspectRatio,sphereDetail:this.sphereDetail,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded,labelParams:this.labelParams};return Zy.forEach(function(i){t[i.getShapeKey("color")].length&&e.push(i.bufferFromShape(t,r))}),this.bufferList.concat(e)},Ky.prototype.dispose=function(){var t=this;this.bufferList.forEach(function(t){t.dispose()}),this.bufferList.length=0,Zy.forEach(function(e){Object.keys(e.fields).forEach(function(r){t[e.getShapeKey(r)].length=0}),t[e.getShapeKey("name")].length=0})},Qy.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},Qy.type.get=function(){return"Shape"},Object.defineProperties(Ky.prototype,Qy);var Jy=function(t,e,r){this.type="",this.parameters={lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},depthWrite:{type:"boolean",buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:{}},colorScale:{type:"select",update:"color",options:$f.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:$f.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new vm,this.queue=new Os(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=$f.getSchemes())};Jy.prototype.init=function(t){var e=t||{};this.clipNear=gn(e.clipNear,0),this.clipRadius=gn(e.clipRadius,0),this.clipCenter=gn(e.clipCenter,new g),this.flatShaded=gn(e.flatShaded,!1),this.side=gn(e.side,"double"),this.opacity=gn(e.opacity,1),this.depthWrite=gn(e.depthWrite,!0),this.wireframe=gn(e.wireframe,!1),this.linewidth=gn(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=gn(e.colorScheme,"uniform"),this.colorScale=gn(e.colorScale,""),this.colorReverse=gn(e.colorReverse,!1),this.colorValue=gn(e.colorValue,9474192),this.colorDomain=gn(e.colorDomain,void 0),this.colorMode=gn(e.colorMode,"hcl"),this.visible=gn(e.visible,!0),this.quality=gn(e.quality,void 0),this.roughness=gn(e.roughness,.4),this.metalness=gn(e.metalness,0),this.diffuse=gn(e.diffuse,16777215),this.lazy=gn(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=gn(e.matrix,new v),this.disablePicking=gn(e.disablePicking,!1);var r=this.parameters;!0===r.sphereDetail&&(r.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===r.radialSegments&&(r.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===r.openEnded&&(r.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===r.disableImpostor&&(r.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(r.sphereDetail&&(this.sphereDetail=0),r.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(r.sphereDetail&&(this.sphereDetail=1),r.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(r.sphereDetail&&(this.sphereDetail=2),r.radialSegments&&(this.radialSegments=20)):(r.sphereDetail&&(this.sphereDetail=gn(e.sphereDetail,1)),r.radialSegments&&(this.radialSegments=gn(e.radialSegments,10))),r.openEnded&&(this.openEnded=gn(e.openEnded,!0)),r.disableImpostor&&(this.disableImpostor=gn(e.disableImpostor,!1))},Jy.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},Jy.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},Jy.prototype.setColor=function(t,e){var r=Object.keys($f.getSchemes());return"string"==typeof t&&r.includes(t.toLowerCase())?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new tt(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},Jy.prototype.create=function(){},Jy.prototype.update=function(){this.build()},Jy.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},Jy.prototype.make=function(e,r){t.Debug&&Uf.time("Representation.make "+this.type);var i=function(){e?(this.update(e),this.viewer.requestRender(),this.tasks.decrement(),r&&r()):(this.clear(),this.create(),this.manualAttach||this.disposed||(t.Debug&&Uf.time("Representation.attach "+this.type),this.attach(function(){t.Debug&&Uf.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),r&&r()}.bind(this)))),t.Debug&&Uf.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(i):i()},Jy.prototype.attach=function(t){this.setVisibility(this.visible),t()},Jy.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var r=this.lazyProps,i=r.bufferParams,n=r.what;if(r.build)return r.build=!1,void this.build();(Object.keys(i).length||Object.keys(n).length)&&(r.bufferParams={},r.what={},this.updateParameters(i,n))}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},Jy.prototype.setParameters=function(t,e,r){var i=this,n=t||{},o=this.parameters;e=e||{},r=r||!1;var a={};for(var s in n)void 0!==n[s]&&void 0!==o[s]&&(o[s].int&&(n[s]=parseInt(n[s])),o[s].float&&(n[s]=parseFloat(n[s])),(n[s]!==i[s]||n[s].equals&&!n[s].equals(i[s]))&&(i[s]&&i[s].set?i[s].set(n[s]):i[s]=n[s],o[s].buffer&&(!0===o[s].buffer?a[s]=n[s]:a[o[s].buffer]=n[s]),o[s].update&&(e[o[s].update]=!0),!o[s].rebuild||"impostor"===o[s].rebuild&&zf&&!i.disableImpostor||(r=!0)));return r?this.build():this.updateParameters(a,e),this},Jy.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e);this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),this.viewer.requestRender()},Jy.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(r){null!==t.parameters[r]&&(e[r]=t[r])}),e},Jy.prototype.clear=function(){var t=this;this.bufferList.forEach(function(e){t.viewer.remove(e),e.dispose()}),this.bufferList.length=0,this.viewer.requestRender()},Jy.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var tb=function(t){function e(e,r,i){Array.isArray(e)||(e=[e]),t.call(this,e,r,i),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())}),this.setVisibility(this.visible),t()},e}(Jy),eb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isSurface:{}};return r.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(qy),rb=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new Ne,this.wireframeGroup=new Ne,this.pickingGroup=new Ne,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,r=new t.constructor;e.makeMaterial(),r.makeMaterial(),r.picking=t.picking,r.geometry=t.geometry,r.wireframeGeometry=t.wireframeGeometry,r.setParameters(t.getParameters()),r.updateShader(),e.setParameters({side:"front"}),r.setParameters({side:"back",opacity:r.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=r},ib={matrix:{},pickable:{}};ib.matrix.set=function(t){Wy.prototype.setMatrix.call(this,t)},ib.matrix.get=function(){return this.group.matrix.clone()},ib.pickable.get=function(){return!!this.picking&&!this.disablePicking},rb.prototype.getMesh=function(t){var e,r;return t?(r=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(r=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(r),this.setParameters({side:this.side}),(new Ne).add(r,e)},rb.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},rb.prototype.getPickingMesh=function(){return this.getMesh(!0)},rb.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},rb.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(Ds),this.backMeshes.forEach(Ns)):"back"===t.side?(this.frontMeshes.forEach(Ns),this.backMeshes.forEach(Ds)):"double"===t.side&&(this.frontMeshes.forEach(Ds),this.backMeshes.forEach(Ds)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},rb.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(rb.prototype,ib),rb.prototype.setVisibility=Wy.prototype.setVisibility,qf.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),qf.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var nb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isLine:{},vertexShader:{},fragmentShader:{}};return r.isLine.get=function(){return!0},r.vertexShader.get=function(){return"Line.vert"},r.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,r),e}(Wy),ob=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof ey?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new g,this.__boxCenter=new g,this.box=new st,this.__box=new st,this._position=new g,this.setBox=function(){this._position.copy(r.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"uniform"),r.colorValue=gn(r.colorValue,14540253),this.isolevelType=gn(r.isolevelType,"sigma"),this.isolevel=gn(r.isolevel,2),this.negateIsolevel=gn(r.negateIsolevel,!1),this.smooth=gn(r.smooth,0),this.background=gn(r.background,!1),this.opaqueBack=gn(r.opaqueBack,!0),this.boxSize=gn(r.boxSize,0),this.colorVolume=gn(r.colorVolume,void 0),this.contour=gn(r.contour,!1),this.useWorker=gn(r.useWorker,!0),this.wrap=gn(r.wrap,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e=this;if(this.volume){var r;if(r="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(r*=-1),!this.surface||this.__isolevel!==r||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=r,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var i=function(r){e.surface=r,t()};this.useWorker?this.volume.getSurfaceWorker(r,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,i):i(this.volume.getSurface(r,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t()}else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new nb(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var r=new eb(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new rb(r)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=t||{}).position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},e.prototype.setParameters=function(e,r,i){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,r,i),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(r.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(Jy),ab=new v,sb=new ut,cb=function(t){function e(e,r,i){var n,o=e||{},a=r||{},s=i.attributes.position.array,c=i.attributes.normal.array,u=i.index?i.index.array:void 0,h=o.position.length/3,l=s.length/3,p=h*l,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(n=On(h*u.length,p)),t.call(this,{position:d,color:m,index:n,normal:f,primitiveId:o.primitiveId||zo(h,l),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=h,this.geoPositionCount=l,this.transformedGeoPosition=new Float32Array(3*l),this.transformedGeoNormal=new Float32Array(3*l),this.meshPosition=d,this.meshColor=m,this.meshIndex=n,this.meshNormal=f,this.meshIndex=n,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var r,i,n,o,a,s,c,u,h,l=this,p=this.geometry.attributes,d=this.updateNormals;t.position&&(r=t.position,n=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,p.position.needsUpdate=!0,(d||e)&&(o=this.geoNormal,h=this.meshNormal,s=this.transformedGeoNormal,p.normal.needsUpdate=!0)),t.color&&(i=t.color,u=this.meshColor,p.color.needsUpdate=!0);for(var f=this.positionCount,m=this.geoPositionCount,g=0;g<f;++g){var v=void 0,y=void 0,b=g*m*3,x=3*g;if(r&&(a.set(n),ab.makeTranslation(r[x],r[x+1],r[x+2]),l.applyPositionTransform(ab,g,x),ca(ab.elements,a),c.set(a,b),d?(s.set(o),sb.getNormalMatrix(ab),ua(sb.elements,s),h.set(s,b)):e&&h.set(o,b)),i)for(v=0;v<m;++v)u[y=b+3*v]=i[x],u[y+1]=i[x+1],u[y+2]=i[x+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var r=this.positionCount,i=this.geoPositionCount,n=3*(t.length/3),o=0;o<r;++o){var a=o*n,s=a+n;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*i}},r.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,r),e}(qy),ub=new g,hb=function(t){function e(e,r){var i=r||{},n=new qe(1,gn(i.sphereDetail,1));t.call(this,e,i,n),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var r=this._radius[e];ub.set(r,r,r),t.scale(ub)},e.prototype.setAttributes=function(e,r){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,r)},e}(cb);qf.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),qf.add("shader/SphereImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var lb=function(t){function e(e,r){t.call(this,e,r),this.index=On(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:Bo(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return r.attributeSize.get=function(){return this.size*this.mappingSize},r.indexSize.get=function(){return this.size*this.mappingIndicesSize},r.mapping.get=function(){},r.mappingIndices.get=function(){},r.mappingIndicesSize.get=function(){},r.mappingType.get=function(){},r.mappingSize.get=function(){},r.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var r={};for(var i in e){var n=e[i];r[i]={type:n.type,value:null}}t.prototype.addAttributes.call(this,r)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=Do(t.position1,t.position2));var e,r,i,n,o,a,s,c=this.size,u=this.mappingSize,h=this.geometry.attributes;for(var l in t)if("index"!==l&&"picking"!==l){r=t[l],i=(e=h[l]).itemSize,n=e.array;for(var p=0;p<c;++p){a=(o=p*i)*u;for(var d=0;d<u;++d){s=a+i*d;for(var f=0;f<i;++f)n[s+f]=r[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,r=this.mappingSize,i=this.mappingItemSize,n=this.geometry.attributes.mapping.array,o=0;o<t;o++)n.set(e,o*i*r)},e.prototype.makeIndex=function(){for(var t,e,r=this.size,i=this.mappingSize,n=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<r;s++){t=s*o,e=s*i,a.set(n,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,r),e}(Wy),pb=new Float32Array([-1,1,-1,-1,1,1,1,-1]),db=new Uint16Array([0,1,2,1,3,2]),fb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return r.mapping.get=function(){return pb},r.mappingIndices.get=function(){return db},r.mappingIndicesSize.get=function(){return 6},r.mappingType.get=function(){return"v2"},r.mappingSize.get=function(){return 4},r.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,r),e}(lb),mb=function(t){function e(e,r){t.call(this,e,r),this.addUniforms({projectionMatrixInverse:{value:new v},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isImpostor:{},vertexShader:{},fragmentShader:{}};return r.isImpostor.get=function(){return!0},r.vertexShader.get=function(){return"SphereImpostor.vert"},r.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,r),e}(fb),gb=function(t,e){return!zf||e&&e.disableImpostor?new hb(t,e):new mb(t,e)};Kf.add("sphere",gb),qf.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),qf.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var vb=function(t){function e(e,r){var i=e||{},n=r||{};i.primitiveId||(i.primitiveId=Bo(i.position.length/3)),t.call(this,i,n),this.pointSize=gn(n.pointSize,1),this.sizeAttenuation=gn(n.sizeAttenuation,!0),this.sortParticles=gn(n.sortParticles,!1),this.alphaTest=gn(n.alphaTest,.5),this.useTexture=gn(n.useTexture,!1),this.forceTransparent=gn(n.forceTransparent,!1),this.edgeBleach=gn(n.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return r.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,r=this.wireframeMaterial,i=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0,i.uniforms.map.value=this.tex,i.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=Fs({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var r=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(r.USE_SIZEATTENUATION=1),this.useTexture&&(r.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(r.ALPHATEST=this.alphaTest.toPrecision(2)),r},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},r.isPoint.get=function(){return!0},r.vertexShader.get=function(){return"Point.vert"},r.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,r),e}(Wy),yb=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="dot",this.parameters=Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof ey?(this.surface=void 0,this.volume=new iy(e)):(this.surface=e,this.volume=void 0),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"uniform"),r.colorValue=gn(r.colorValue,14540253),this.thresholdType=gn(r.thresholdType,"sigma"),this.thresholdMin=gn(r.thresholdMin,2),this.thresholdMax=gn(r.thresholdMax,1/0),this.thresholdOut=gn(r.thresholdOut,!1),this.dotType=gn(r.dotType,"point"),this.radius=gn(r.radius,.1),this.scale=gn(r.scale,1),this.pointSize=gn(r.pointSize,1),this.sizeAttenuation=gn(r.sizeAttenuation,!0),this.sortParticles=gn(r.sortParticles,!1),this.useTexture=gn(r.useTexture,!1),this.alphaTest=gn(r.alphaTest,.5),this.forceTransparent=gn(r.forceTransparent,!1),this.edgeBleach=gn(r.edgeBleach,0),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,r,i=this.volume;"sigma"===this.thresholdType?(e=i.getValueForSigma(this.thresholdMin),r=i.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,r=this.thresholdMax),i.setFilter(e,r,this.thresholdOut),t.position=i.getDataPosition(),t.color=i.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=i.getDataSize(this.radius,this.scale),t.picking=i.getDataPicking())}else{var n=this.surface;t.position=n.getPosition(),t.color=n.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=n.getSize(this.radius,this.scale),t.picking=n.getPicking())}"sphere"===this.dotType?this.dotBuffer=new gb(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new vb(t,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=t||{}).color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},e.prototype.setParameters=function(e,r,i){return r=r||{},e&&void 0!==e.thresholdType&&this.volume instanceof ey&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,r.radius=!0,"sphere"!==this.dotType||zf&&!this.disableImpostor||(i=!0)),e&&void 0!==e.radius&&(r.radius=!0,"sphere"!==this.dotType||zf&&!this.disableImpostor||(i=!0)),e&&void 0!==e.scale&&(r.scale=!0,"sphere"!==this.dotType||zf&&!this.disableImpostor||(i=!0)),t.prototype.setParameters.call(this,e,r,i),this},e}(Jy);qf.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n}"),qf.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var bb=new Uint16Array([0,1,2,1,3,2]),xb=new Float32Array([0,1,0,0,1,1,1,0]),_b=function(t){function e(e,r){var i=e||{},n=r||{};t.call(this,{position:i.position,index:bb,picking:i.picking},n),this.forceTransparent=!0,this.filter=gn(n.filter,"nearest");var o=new y(i.imageData,i.width,i.height);o.flipY=!0,this.tex=o;for(var a=i.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var h=new y(s,i.width,i.height);h.flipY=!0,h.minFilter=il,h.magFilter=il,this.pickingTex=h,this.addUniforms({map:{value:o},pickingMap:{value:h},mapSize:{value:new l(i.width,i.height)}}),this.geometry.addAttribute("uv",new St(xb,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={parameters:{},vertexShader:{},fragmentShader:{}};return r.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var r=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(r.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?r.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?r.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(r.MITCHELL_FILTER=1)),r},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=il,t.magFilter=il):"linear"===this.filter?(t.minFilter=al,t.magFilter=al):(t.minFilter=il,t.magFilter=il),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=hh,e.needsUpdate=!0;var r=this.wireframeMaterial;r.uniforms.map.value=this.tex,r.blending=hh,r.needsUpdate=!0;var i=this.pickingMaterial;i.uniforms.map.value=this.tex,i.uniforms.pickingMap.value=this.pickingTex,i.blending=hh,i.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},r.vertexShader.get=function(){return"Image.vert"},r.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,r),e}(Wy),wb=function(t,e){var r=e||{};this.dimension=gn(r.dimension,"x"),this.positionType=gn(r.positionType,"percent"),this.position=gn(r.position,30),this.thresholdType=gn(r.thresholdType,"sigma"),this.thresholdMin=gn(r.thresholdMin,-1/0),this.thresholdMax=gn(r.thresholdMax,1/0),this.normalize=gn(r.normalize,!1),this.volume=t};wb.prototype.getPositionFromCoordinate=function(t){var e,r=this.dimension,i=this.volume,n=i.matrix,o=(new g).setFromMatrixPosition(n)[r],a=(new g).setFromMatrixScale(n)[r];return e="x"===r?i.nx:"y"===r?i.ny:i.nz,Math.round(((t-o)/(e/100)+1)/a)},wb.prototype.getData=function(t){function e(t){return Math.round(t/100*(o-1))}function r(t,e,r,i){return 3*(r*a.ny*a.nx+e*a.nx+t)+i}function i(t,e,r,i){m.set(t,e,r).applyMatrix4(c).toArray(f,i)}var n=this;t=t||{};var o,a=this.volume,s=a.data,c=a.matrix;o="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var u,h,l,p,d,f=new Float32Array(12),m=new g,v=0,y=0,b=0,x=a.nx,_=a.ny,w=a.nz;"x"===this.dimension?(l=e(a.nx),p=a.ny-1,d=a.nz-1,u=a.nz,h=a.ny,x=(v=l)+1,i(l,0,0,0),i(l,p,0,3),i(l,0,d,6),i(l,p,d,9)):"y"===this.dimension?(l=a.nx-1,p=e(a.ny),d=a.nz-1,u=a.nz,h=a.nx,_=(y=p)+1,i(0,p,0,0),i(l,p,0,3),i(0,p,d,6),i(l,p,d,9)):"z"===this.dimension&&(l=a.nx-1,p=a.ny-1,d=e(a.nz),u=a.nx,h=a.ny,w=(b=d)+1,i(0,0,d,0),i(0,p,d,3),i(l,0,d,6),i(l,p,d,9));var S,A,M=0,T=0,E=new Uint8Array(u*h*4),P=new Float32Array(u*h);"sigma"===this.thresholdType?(S=a.getValueForSigma(this.thresholdMin),A=a.getValueForSigma(this.thresholdMax)):(S=this.thresholdMin,A=this.thresholdMax);var C=Object.assign({},t.colorParams,{volume:a});this.normalize&&(C.domain=[0,1]);var I,R,L,O=$f.getScheme(C),D=new Float32Array(3),N=O.getScale();if(this.normalize){I=1/0,R=-1/0;for(var k=y;k<_;++k)for(var F=v;F<x;++F)for(var B=b;B<w;++B){var z=s[r(F,k,B,0)/3];z<I&&(I=z),z>R&&(R=z)}L=R-I}for(var U=y;U<_;++U)for(var j=v;j<x;++j)for(var G=b;G<w;++G){var V=r(j,U,G,0)/3,$=s[V];n.normalize&&($=($-I)/L),O.colorToArray(N($),D),E[M]=Math.round(255*D[0]),E[M+1]=Math.round(255*D[1]),E[M+2]=Math.round(255*D[2]),E[M+3]=$>S&&$<A?255:0,P[T]=V,++T,M+=4}var H=new gv(P,a);return{position:f,imageData:E,width:u,height:h,picking:H}};var Sb=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=this.volume,i=e||{};i.colorDomain=gn(i.colorDomain,[r.min,r.max]),i.colorScheme=gn(i.colorScheme,"value"),i.colorScale=gn(i.colorScale,"Spectral"),this.colorScheme="value",this.dimension=gn(i.dimension,"x"),this.filter=gn(i.filter,"cubic-bspline"),this.positionType=gn(i.positionType,"percent"),this.position=gn(i.position,30),this.thresholdType=gn(i.thresholdType,"sigma"),this.thresholdMin=gn(i.thresholdMin,-1/0),this.thresholdMax=gn(i.thresholdMax,1/0),this.normalize=gn(i.normalize,!1),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new wb(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new _b(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(Jy),Ab=function(t){function e(e,r,i){var n=i||{};if(t.call(this,e,r,n),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Ta.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new Pf(n.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach(function(t){o[t]=t}),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultScale:{}};return r.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"element"),this.radius=gn(r.radius,"vdw"),this.scale=gn(r.scale,1),this.assembly=gn(r.assembly,"default"),this.defaultAssembly=gn(r.defaultAssembly,""),"auto"===r.quality&&(r.quality=this.getQuality()),t.prototype.init.call(this,r),this.selection.signals.stringChanged.add(function(){this.build()},this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,r=this.getAssembly();return t=r?r.getAtomCount(e):e.atomCount,Ff&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.create=function(){if(0!==this.structureView.atomCount){var t=this.getAssembly();if(t)t.partList.forEach(function(t,e){var r=t.getView(this.structureView);if(0!==r.atomCount){var i=this.createData(r,e);i&&(i.sview=r,i.instanceList=t.getInstanceList(),this.dataList.push(i))}},this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach(function(e){e.bufferList.length>0&&this.updateData(t,e)},this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,r,i){return r=r||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,r.radius=!0,zf&&!this.disableImpostor||(i=!0)),e&&void 0!==e.radius&&(r.radius=!0,zf&&!this.disableImpostor||(i=!0)),e&&void 0!==e.scale&&(r.radius=!0,zf&&!this.disableImpostor||(i=!0)),e&&void 0!==e.defaultAssembly&&(i=!0),t.prototype.setParameters.call(this,e,r,i),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,r=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(i){r.push(i),e.add(i,t.instanceList)})}),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,r),e}(Jy),Mb=new g,Tb=new g,Eb=new g,Pb=new g(0,1,0),Cb=function(t){function e(e,r){var i=e||{},n=r||{},o=gn(n.radialSegments,10),a=gn(n.openEnded,!0),s=(new v).makeRotationX(Math.PI/2),c=new vr(1,1,1,o,1,a);c.applyMatrix(s);var u=i.position1.length,h=i.radius.length,l=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*l);zo(p,l,0,d),zo(p,l,p*l,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:i.picking},n,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*h),this.setAttributes(i,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){Tb.fromArray(this._from,r),Eb.fromArray(this._to,r),t.lookAt(Tb,Eb,Pb);var i=this._radius[e];Mb.set(i,i,Tb.distanceTo(Eb)),t.scale(Mb)},e.prototype.setAttributes=function(e,r){var i={};e.position1&&e.position2&&(Do(e.position1,e.position2,this.__center),Do(e.position1,this.__center,this._position),Do(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),i.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),i.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),i.radius=this._radius),t.prototype.setAttributes.call(this,i,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb);qf.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),qf.add("shader/CylinderImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var Ib=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Rb=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Lb=function(t){function e(e,r){t.call(this,e,r);var i=r||{};this.openEnded=gn(i.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new v},ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return r.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var r=t.prototype.getDefines.call(this,e);return this.openEnded||(r.CAP=1),r},r.isImpostor.get=function(){return!0},r.vertexShader.get=function(){return"CylinderImpostor.vert"},r.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,r),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return r.mapping.get=function(){return Ib},r.mappingIndices.get=function(){return Rb},r.mappingIndicesSize.get=function(){return 12},r.mappingType.get=function(){return"v3"},r.mappingSize.get=function(){return 6},r.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,r),e}(lb)),Ob=function(t,e){return t.color2||(t.color2=t.color),!zf||e&&e.disableImpostor?new Cb(t,e):new Lb(t,e)};Kf.add("cylinder",Ob);var Db=function(t){function e(e,r){var i=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*i),color:new Float32Array(3*i)},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,r,i,n,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,r=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(i=t.color,n=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&r&&(d=e[u],f=e[u+1],m=e[u+2],h=(d+(g=r[u]))/2,l=(f+(v=r[u+1]))/2,p=(m+(y=r[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=h,o[c+4]=l,o[c+5]=p,o[c+6]=h,o[c+7]=l,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),i&&n&&(a[c]=a[c+3]=i[u],a[c+1]=a[c+4]=i[u+1],a[c+2]=a[c+5]=i[u+2],a[c+6]=a[c+9]=n[u],a[c+7]=a[c+10]=n[u+1],a[c+8]=a[c+11]=n[u+2])},r.isLine.get=function(){return!0},r.vertexShader.get=function(){return"Line.vert"},r.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,r),e}(Wy),Nb=function(t){function e(e,r,i){t.call(this,e.structure,r,i),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"uniform"),r.colorValue=gn(r.colorValue,14540253),this.drawLine=gn(r.drawLine,!0),this.drawCylinder=gn(r.drawCylinder,!1),this.drawPoint=gn(r.drawPoint,!1),this.drawSphere=gn(r.drawSphere,!1),this.pointSize=gn(r.pointSize,1),this.sizeAttenuation=gn(r.sizeAttenuation,!1),this.sort=gn(r.sort,!0),t.prototype.init.call(this,r)},e.prototype.attach=function(){var t=this;this.bufferList.forEach(function(e){return t.viewer.add(e)}),this.setVisibility(this.visible),this.tasks.decrement()},e.prototype.create=function(){var t=this;if(console.log("create",this.structureView.atomCount),0!==this.structureView.atomCount){var e=this.structureView.getAtomIndices()[0];this.trajectory.getPath(e,function(e){var r=e.length/3,i=new tt(t.colorValue);if(t.drawSphere){var n=new gb({position:e,color:ko(r,i.r,i.g,i.b),radius:No(r,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(n)}if(t.drawCylinder){var o=new Ob({position1:e.subarray(0,-3),position2:e.subarray(3),color:ko(r-1,i.r,i.g,i.b),color2:ko(r-1,i.r,i.g,i.b),radius:No(r,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new vb({position:e,color:ko(r,i.r,i.g,i.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new Db({position1:e.subarray(0,-3),position2:e.subarray(3),color:ko(r-1,i.r,i.g,i.b),color2:ko(r-1,i.r,i.g,i.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()})}},e}(Ab),kb=0,Fb=new v,Bb=new g,zb=function(t,e){Object.defineProperty(this,"id",{value:kb++});var r=e||{};this.name=r.name,this.uuid=Wn(),this.visible=void 0===r.visible||r.visible,this.signals={representationAdded:new no,representationRemoved:new no,visibilityChanged:new no,matrixChanged:new no,statusChanged:new no,nameChanged:new no,disposed:new no},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new v,this.position=new g,this.quaternion=new m,this.scale=new g(1,1,1),this.transform=new v,this.controls=new Og(this)},Ub={type:{}};Ub.type.get=function(){return"component"},zb.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},zb.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new ft).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof ft?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},zb.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},zb.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},zb.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Bb);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Fb.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Fb),Fb.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Fb);var r=this.position;Fb.makeTranslation(r.x+e.x,r.y+e.y,r.z+e.z),this.matrix.premultiply(Fb),this.matrix.premultiply(this.transform),this.reprList.forEach(function(e){e.setParameters({matrix:t.matrix})}),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},zb.prototype.addAnnotation=function(t,e,r){var i=new Cg(this,t,e,r);return this.annotationList.push(i),i},zb.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},zb.prototype.removeAllAnnotations=function(){this.annotationList.forEach(function(t){t.dispose()}),this.annotationList.length=0},zb.prototype.addRepresentation=function(t,e,r){var i=r||{},n=this.stage.getParameters();i.matrix=this.matrix.clone(),i.quality=i.quality||n.quality,i.disableImpostor=gn(i.disableImpostor,!n.impostor),i.useWorker=gn(i.useWorker,n.workerDefault),i.visible=gn(i.visible,!0);var o=Object.assign({},i,{visible:this.visible&&i.visible}),a=zs(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,i);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},zb.prototype.addBufferRepresentation=function(t,e){return zb.prototype.addRepresentation.call(this,"buffer",t,e)},zb.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},zb.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},zb.prototype.updateRepresentations=function(t){this.reprList.forEach(function(e){e.update(t)}),this.stage.viewer.requestRender()},zb.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach(function(t){t.dispose()})},zb.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},zb.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation(function(t){t.updateVisibility()}),this.annotationList.forEach(function(t){t.updateVisibility()}),this.signals.visibilityChanged.dispatch(t),this},zb.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},zb.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},zb.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},zb.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},zb.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},zb.prototype.getBoxUntransformed=function(){},zb.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},zb.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),gn(t,0))},zb.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(zb.prototype,Ub),zb.prototype.__getRepresentationComponent=function(t,e){return new jb(this.stage,t,e,this)};var jb=function(t){function e(e,r,i,n){var o=i||{};o.name=gn(o.name,r.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new no}),this.parent=n,this.setRepresentation(r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,r),e}(zb),Gb=function(t){var e=this;this.list=t||[];for(var r=this.list.length,i=0;i<r;++i)e.list[i].signals.disposed.add(e._remove,e)};Gb.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},Gb.prototype._invoke=function(t,e){for(var r=this,i=this.list.length,n=0;n<i;++n){var o=r.list[n],a=o[t];"function"==typeof a&&a.apply(o,e)}return this},Gb.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},Gb.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},Gb.prototype.dispose=function(){return this._invoke("dispose")};var Vb=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(Gb),$b=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(Gb),Hb=new g,Wb=function(t,e){if(this.signals={parametersChanged:new no,fullscreenChanged:new no,componentAdded:new no,componentRemoved:new no,clicked:new no,hovered:new no},this.tasks=new vm,this.compList=[],this.defaultFileParams={},this.viewer=new ta(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new Nm(this.viewer.renderer.domElement),this.viewerControls=new ng(this),this.trackballControls=new Hm(this),this.pickingControls=new Ym(this),this.animationControls=new vg(this),this.mouseControls=new _g(this),this.keyControls=new Ag(this),this.pickingBehavior=new Mg(this),this.mouseBehavior=new Tg(this),this.animationBehavior=new Eg(this),this.keyBehavior=new Pg(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var r=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.parameters={backgroundColor:{type:"color"},quality:{type:"select",options:{auto:"auto",low:"low",medium:"medium",high:"high"}},sampleLevel:{type:"range",step:1,max:5,min:-1},impostor:{type:"boolean"},workerDefault:{type:"boolean"},rotateSpeed:{type:"number",precision:1,max:10,min:0},zoomSpeed:{type:"number",precision:1,max:10,min:0},panSpeed:{type:"number",precision:1,max:10,min:0},clipNear:{type:"range",step:1,max:100,min:0},clipFar:{type:"range",step:1,max:100,min:0},clipDist:{type:"integer",max:200,min:0},fogNear:{type:"range",step:1,max:100,min:0},fogFar:{type:"range",step:1,max:100,min:0},cameraType:{type:"select",options:{perspective:"perspective",orthographic:"orthographic"}},cameraFov:{type:"range",step:1,max:120,min:15},lightColor:{type:"color"},lightIntensity:{type:"number",precision:2,max:10,min:0},ambientColor:{type:"color"},ambientIntensity:{type:"number",precision:2,max:10,min:0},hoverTimeout:{type:"integer",max:1e4,min:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(r),this.viewer.animate()}};Wb.prototype.setParameters=function(t){var e=Object.assign({},t),r=this.parameters,i=this.viewer,n=this.trackballControls;for(var o in e)void 0!==e[o]&&r[o]&&(r[o].int&&(e[o]=parseInt(e[o])),r[o].float&&(e[o]=parseFloat(e[o])),r[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(n.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(n.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(n.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),i.setClip(e.clipNear,e.clipFar,e.clipDist),i.setFog(void 0,e.fogNear,e.fogFar),i.setCamera(e.cameraType,e.cameraFov),i.setSampling(e.sampleLevel),i.setBackground(e.backgroundColor),i.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},Wb.prototype.getParameters=function(){var t=this,e={};for(var r in t.parameters)e[r]=t.parameters[r].value;return e},Wb.prototype.defaultFileRepresentation=function(e){if("structure"===e.type){e.setSelection("/0");var r,i,n,o=e.structure;if(o.biomolDict.BU1){var a=o.biomolDict.BU1;r=a.getAtomCount(o),i=a.getResidueCount(o),n=a.getInstanceCount(),e.setDefaultAssembly("BU1")}else r=o.getModelProxy(0).atomCount,i=o.getModelProxy(0).residueCount,n=1;var s=r;Ff&&(s*=4);var c=o.atomStore.count/o.residueStore.count<2;c&&(s*=10);var u="chainname",h="RdYlBu",l=!1;if(1===o.getChainnameCount("polymer and /0")&&(u="residueindex",h="spectral",l=!0),t.Debug&&console.log(s,r,n,c),i/n<4)e.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(n>5&&s>15e3||s>7e5){var p=Math.min(1.5,Math.max(.1,2e3/(s/n)));c&&(p=Math.min(p,.15)),e.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:p,colorScheme:u,colorScale:h,colorReverse:l,useWorker:!1})}else s>25e4?e.addRepresentation("backbone",{lineOnly:!0,colorScheme:u,colorScale:h,colorReverse:l}):s>1e5?e.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:u,colorScale:h,colorReverse:l,scale:2}):s>8e4?e.addRepresentation("backbone",{colorScheme:u,colorScale:h,colorReverse:l,scale:2}):(e.addRepresentation("cartoon",{colorScheme:u,colorScale:h,colorReverse:l,scale:.7,aspectRatio:5,quality:"auto"}),s<5e4&&e.addRepresentation("base",{colorScheme:u,colorScale:h,colorReverse:l,quality:"auto"}),e.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));e.structure.frames.length&&e.addTrajectory()}else"surface"!==e.type&&"volume"!==e.type||e.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},Wb.prototype.loadFile=function(t,e){var r=Object.assign({},this.defaultFileParams,e),i=new zb(this,r);i.name=wn(t).name,this.addComponent(i);var n=this.tasks;n.increment();var o=function(t){return this.removeComponent(i),i=this.addComponentFromObject(t,r),"script"===i.type?i.run():r.defaultRepresentation&&this.defaultFileRepresentation(i),n.decrement(),i}.bind(this),a=function(t){throw i.setStatus(t),n.decrement(),t},s=gn(r.ext,wn(t).ext);return(Xf.isTrajectory(s)?Promise.reject(new Error('loadFile: ext "'+s+'" is a trajectory and must be loaded into a structure component')):Mo(t,r)).then(o,a)},Wb.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):Uf.warn("Stage.addComponent: no component given")},Wb.prototype.addComponentFromObject=function(t,e){var r=Zf.get(t.type);if(r){var i=new r(this,t,e);return this.addComponent(i),i}Uf.warn("no component for object type",t.type)},Wb.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},Wb.prototype.removeAllComponents=function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},Wb.prototype.handleResize=function(){this.viewer.handleResize()},Wb.prototype.setSize=function(t,e){var r=this.viewer.container;r!==document.body&&(void 0!==t&&(r.style.width=t),void 0!==e&&(r.style.height=e),this.handleResize())},Wb.prototype.toggleFullscreen=function(t){function e(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!e()&&i.lastFullscreenElement){var t=i.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),i.handleResize(),i.signals.fullscreenChanged.dispatch(!1)}}if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var i=this;t=t||this.viewer.container,this.lastFullscreenElement=t,e()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){i.handleResize()},100))}else Uf.log("fullscreen mode (currently) not possible")},Wb.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},Wb.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},Wb.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},Wb.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},Wb.prototype.setFocus=function(t){var e=Yn(t/2,0,49.9),r=100-e,i=(r-e)/2;this.setParameters({clipNear:e,clipFar:r,fogNear:Zn(r-i),fogFar:Zn(r+i)})},Wb.prototype.getZoomForBox=function(t){var e=t.getSize(Hb),r=Math.max(e.x,e.y,e.z),i=Math.min(e.x,e.y,e.z),n=r+Math.sqrt(i),o=$n(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=a/s,u=s<a?1:c;return n=Math.abs(.5*n/u/Math.sin(o/2)),-(n+=this.parameters.clipDist.value)},Wb.prototype.getBox=function(){return this.viewer.boundingBox},Wb.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},Wb.prototype.getCenter=function(t){return this.getBox().getCenter(t)},Wb.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),gn(t,0))},Wb.prototype.makeImage=function(t){var e=this.viewer,r=this.tasks;return new Promise(function(i,n){function o(){r.increment(),e.makeImage(t).then(function(t){r.decrement(),i(t)}).catch(function(t){r.decrement(),n(t)})}r.onZeroOnce(o)})},Wb.prototype.setImpostor=function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(r){if("script"!==r.type&&e.includes(r.getType())){var i=r.getParameters();i.disableImpostor=!t,r.build(i)}})},Wb.prototype.setQuality=function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],r=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(i){if("script"!==i.type){var n=i.getParameters();if(!e.includes(i.getType())){if(!r.includes(i.getType()))return;if(!n.disableImpostor)return void(i.repr.quality=t)}n.quality=t,i.build(n)}})},Wb.prototype.eachComponent=function(t,e){this.compList.slice().forEach(function(r,i){e&&r.type!==e||t(r,i)})},Wb.prototype.eachRepresentation=function(t,e){this.eachComponent(function(e){e.reprList.slice().forEach(function(r){t(r,e)})},e)},Wb.prototype.getComponentsByName=function(t,e){var r=[];return this.eachComponent(function(e){(void 0===t||Us(t,e))&&r.push(e)},e),new Vb(r)},Wb.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent(function(r){r[r.type]===t&&e.push(r)}),new Vb(e)},Wb.prototype.getRepresentationsByName=function(t,e){var r,i;"object"!=typeof t||t instanceof RegExp?(r=void 0,i=t):(r=t.comp,i=t.repr);var n=[];return this.eachRepresentation(function(t,e){(void 0===r||Us(r,e))&&(void 0===i||Us(i,t))&&n.push(t)},e),new $b(n)},Wb.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,r=this.getRepresentationsByName(t).list;return new Gb(e.concat(r))},Wb.prototype.dispose=function(){this.tasks.dispose()};var Xb=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]],qb=[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]],Yb=function(){return{blosum62:js("ARNDCQEGHILKMFPSTWYVBZ?",qb),blosum62x:js("ACDEFGHIKLMNPQRSTVWY",Xb)}}(),Zb=function(t,e,r,i,n){this.seq1=t,this.seq2=e,this.gapPenalty=r||-10,this.gapExtensionPenalty=i||-1,this.substMatrix=n||"blosum62",this.substMatrix&&(this.substMatrix=Yb[this.substMatrix])};Zb.prototype.initMatrices=function(){var t=this;this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[];var e,r;for(e=0;e<=this.n;++e)for(t.S[e]=[],t.V[e]=[],t.H[e]=[],r=0;r<=this.m;++r)t.S[e][r]=0,t.V[e][r]=0,t.H[e][r]=0;for(e=0;e<=this.n;++e)t.S[e][0]=t.gap(0),t.H[e][0]=-1/0;for(r=0;r<=this.m;++r)t.S[0][r]=t.gap(0),t.V[0][r]=-1/0;this.S[0][0]=0},Zb.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},Zb.prototype.makeScoreFn=function(){var t,e,r=this.seq1,i=this.seq2,n=this.substMatrix;return n?function(o,a){t=r[o],e=i[a];try{return n[t][e]}catch(t){return-4}}:(Uf.warn("Alignment: no subst matrix"),function(n,o){return t=r[n],e=i[o],t===e?5:-3})},Zb.prototype.calc=function(){t.Debug&&Uf.time("Alignment.calc"),this.initMatrices();var e,r,i,n,o,a,s,c=this.gap(0),u=this.makeScoreFn(),h=this.gapExtensionPenalty,l=this.V,p=this.H,d=this.S,f=this.n,m=this.m;for(a=1;a<=f;++a)for(r=d[a-1],e=l[a-1],i=l[a],n=p[a],o=d[a],s=1;s<=m;++s)i[s]=Math.max(r[s]+c,e[s]+h),n[s]=Math.max(o[s-1]+c,n[s-1]+h),o[s]=Math.max(r[s-1]+u(a-1,s-1),i[s],n[s]);t.Debug&&Uf.timeEnd("Alignment.calc"),t.Debug&&Uf.log(this.S,this.V,this.H)},Zb.prototype.trace=function(){var e=this;t.Debug&&Uf.time("Alignment.trace"),this.ali1="",this.ali2="";var r,i=this.makeScoreFn(),n=this.n,o=this.m;for(this.S[n][o]>=this.V[n][o]?(r="S",this.score=this.S[n][o]):this.V[n][o]>=this.H[n][o]?(r="V",this.score=this.V[n][o]):(r="H",this.score=this.H[n][o]),t.Debug&&Uf.log("Alignment: SCORE",this.score),t.Debug&&Uf.log("Alignment: S, V, H",this.S[n][o],this.V[n][o],this.H[n][o]);n>0&&o>0;)"S"===r?e.S[n][o]===e.S[n-1][o-1]+i(n-1,o-1)?(e.ali1=e.seq1[n-1]+e.ali1,e.ali2=e.seq2[o-1]+e.ali2,--n,--o,r="S"):e.S[n][o]===e.V[n][o]?r="V":e.S[n][o]===e.H[n][o]?r="H":(--n,--o):"V"===r?e.V[n][o]===e.V[n-1][o]+e.gapExtensionPenalty?(e.ali1=e.seq1[n-1]+e.ali1,e.ali2="-"+e.ali2,--n,r="V"):e.V[n][o]===e.S[n-1][o]+e.gap(0)?(e.ali1=e.seq1[n-1]+e.ali1,e.ali2="-"+e.ali2,--n,r="S"):--n:"H"===r?e.H[n][o]===e.H[n][o-1]+e.gapExtensionPenalty?(e.ali1="-"+e.ali1,e.ali2=e.seq2[o-1]+e.ali2,--o,r="H"):e.H[n][o]===e.S[n][o-1]+e.gap(0)?(e.ali1="-"+e.ali1,e.ali2=e.seq2[o-1]+e.ali2,--o,r="S"):--o:Uf.error("Alignment: no matrix");for(;n>0;)e.ali1=e.seq1[n-1]+e.ali1,e.ali2="-"+e.ali2,--n;for(;o>0;)e.ali1="-"+e.ali1,e.ali2=e.seq2[o-1]+e.ali2,--o;t.Debug&&Uf.timeEnd("Alignment.trace"),t.Debug&&Uf.log([this.ali1,this.ali2])};var Kb=function(t){function e(e){var r=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=gn(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel(function(t){r.domain=[t.atomOffset,t.atomEnd],r.scalePerModel[t.index]=r.getScale()})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(lf);$f.add("atomindex",Kb);var Qb=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var r,i=1/0,n=-1/0;e.sele&&(r=new Pf(e.sele)),this.structure.eachAtom(function(t){var e=t.bfactor;i=Math.min(i,e),n=Math.max(n,e)},r),this.domain=[i,n]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(lf);$f.add("bfactor",Qb);var Jb=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var r={},i={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain(function(t){void 0===n[t.chainid]&&(n[t.chainid]=e,e+=1)}),this.domain=[0,e-1],r[t.index]=n,i[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=r[t.modelIndex];return i[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("chainid",Jb);var tx=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.chainIndex)}}else{var i={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],i[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return i[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("chainindex",tx);var ex=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var r={},i={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain(function(t){void 0===n[t.chainname]&&(n[t.chainname]=e,e+=1)}),this.domain=[0,e-1],r[t.index]=n,i[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=r[t.modelIndex];return i[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("chainname",ex);var rx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var r=e.structure.validation||{};this.rsrzDict=r.rsrzDict||{},this.rsccDict=r.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var r=this.rsrzDict[e];if(void 0!==r)return this.rsrzScale(r);var i=this.rsccDict[e];return void 0!==i?this.rsccScale(i):9474192},e}(lf);$f.add("densityfit",rx);var ix={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}},nx=12,ox=1.04,ax=.25,sx=function(t){function e(e){function r(t){return t.isProtein()?ix[t.resname]&&ix[t.resname][t.atomname]||ix.backbone[t.atomname]||0:0}t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var i=this.getScale(),n=this.structure,o=new Float32Array(n.atomCount),a=[],s=[];n.eachAtom(function(t){if(o[t.index]=r(t)*t.occupancy,"N"===t.atomname){var e=Vs(t);void 0!==e&&(a.push(e),s.push(ax*t.occupancy))}});var c=this.structure.getBoundingBox();c.expandByScalar(ox);var u=$s(a),h=new qa(u,c),l=new qa(this.structure.atomStore,c),p=this.atomProxy,d=new g,f=nx*nx;this.positionColor=function(t){for(var e=0,r=l.within(t.x,t.y,t.z,nx),n=0;n<r.length;n++){var a=r[n],c=o[a];if(0!==c){p.index=a,d.x=t.x-p.x,d.y=t.y-p.y,d.z=t.z-p.z;var m=d.lengthSq();m<f&&(e+=c/m)}}for(var g=h.within(t.x,t.y,t.z,nx),v=0;v<g.length;v++){var y=g[v];d.x=t.x-u.x[y],d.y=t.y-u.y[y],d.z=t.z-u.z[y];var b=d.lengthSq();b<f&&(e+=s[y]/b)}return i(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("electrostatic",sx);var cx={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},ux=function(t){function e(e){var r=e||{};r.value=gn(r.value,cx.C),t.call(this,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:cx[e]||16777215},e}(lf);$f.add("element",ux);var hx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var r=this.getScale();this.atomColor=function(t){return r(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("entityindex",hx);var lx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case bv:return 8374655;case xv:return 16629894;case _v:return 12496596;case wv:return 3697840;default:return 16777113}},e}(lf);$f.add("entitytype",lx);var px=function(t){function e(e){t.call(this,e);var r=e.structure.validation||{};this.geoAtomDict=r.geoAtomDict||{},this.geoDict=r.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var r,i=this.geoAtomDict[e];return r=void 0!==i?Xn(i[t.atomname]||0):this.geoDict[e]||0,0===r?2188972:1===r?16703627:2===r?16018755:r>=3?10813478:9474192},e}(lf);$f.add("geoquality",px);var dx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlGn");var r,i={};for(r in Nv)i[r]=Nv[r][0];if(!e.domain){var n,o=1/0,a=-1/0;for(r in i)n=i[r],o=Math.min(o,n),a=Math.max(a,n);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(i[t.resname]||kv)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("hydrophobicity",dx);var fx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var r=this.getScale();this.atomColor=function(t){return r(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("modelindex",fx);var mx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(lf);$f.add("moleculetype",mx);var gx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var r=this.getScale();this.atomColor=function(t){return r(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("occupancy",gx);var vx=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-1,1]),this.partialchargeScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.partialchargeScale(t.partialCharge)},e}(lf);$f.add("partialcharge",vx);var yx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return Hs()},e.prototype.volumeColor=function(){return Hs()},e.prototype.positionColor=function(){return Hs()},e}(lf);$f.add("random",yx);var bx=function(t){function e(e){var r=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=gn(e.reverse,!0)),e.domain){var i=this.getScale();this.atomColor=function(t){return i(t.residueIndex)}}else{var n={};this.structure.eachChain(function(t){r.domain=[t.residueOffset,t.residueEnd],n[t.index]=r.getScale()}),this.atomColor=function(t){return n[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lf);$f.add("residueindex",bx);var xx={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},_x=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return xx[t.resname]||16711935},e}(lf);$f.add("resname",_x);var wx={alphaHelix:16711808,threeTenHelix:10485888,piHelix:6291584,betaStrand:16762880,betaTurn:6324479,coil:16777215,dna:11403518,rna:16580962,carbohydrate:10921722},Sx=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,r=this.rp;return"h"===e?wx.alphaHelix:"g"===e?wx.threeTenHelix:"i"===e?wx.piHelix:"e"===e||"b"===e?wx.betaStrand:"t"===e?wx.betaTurn:(r.index=t.residueIndex,r.isDna()?wx.dna:r.isRna()?wx.rna:r.isSaccharide()?wx.carbohydrate:r.isProtein()||"s"===e||"l"===e?wx.coil:8421504)},e}(lf);$f.add("sstruc",Sx);var Ax=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(lf);$f.add("uniform",Ax);var Mx=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(lf);$f.add("value",Mx);var Tx=function(t){function e(e){t.call(this,e);var r=this.volume;if(r&&r.inverseMatrix){var i=this.getScale(),n=r.inverseMatrix,o=r.data,a=r.nx,s=r.ny,c=a*s,u=new g;this.positionColor=function(t){u.copy(t),u.applyMatrix4(n);var e=Math.floor(u.x),r=Math.floor(u.y),h=Math.floor(u.z),l=(h*s+r)*a+e,p=l+1,d=l+a,f=l+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[l],x=o[p],_=o[d],w=o[f],S=o[m],A=o[g],M=o[v],T=o[y],E=u.x-e,P=u.y-r,C=u.z-h,I=Qn(b,x,E),R=Qn(w,A,E),L=Qn(_,S,E),O=Qn(M,T,E),D=Qn(Qn(I,L,P),Qn(R,O,P),C);return i(D)}}else{var h=this.value;this.positionColor=function(){return h}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(lf);$f.add("volume",Tx);var Ex=function(t){function e(e,r,i){var n=this,o=i||{};o.name=gn(o.name,r.name),t.call(this,e,o),this.script=r,this.status="loaded",this.script.signals.nameChanged.add(function(t){n.setName(t)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then(function(){t.setStatus("finished")}),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,r),e}(zb);Zf.add("script",Ex);var Px=function(t){function e(e,r,i){var n=i||{};n.name=gn(n.name,r.name),t.call(this,e,n),this.shape=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,r){return t.prototype.addRepresentation.call(this,e,this.shape,r)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,r),e}(zb);Zf.add("shape",Px);var Cx=function(t){function e(e,r,i,n){var o=this,a=i||{};a.name=gn(a.name,r.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new no,playerChanged:new no,countChanged:new no,parametersChanged:new no}),this.trajectory=r,this.parent=n,this.status="loaded",this.defaultStep=gn(a.defaultStep,void 0),this.defaultTimeout=gn(a.defaultTimeout,50),this.defaultInterpolateType=gn(a.defaultInterpolateType,""),this.defaultInterpolateStep=gn(a.defaultInterpolateStep,5),this.defaultMode=gn(a.defaultMode,"loop"),this.defaultDirection=gn(a.defaultDirection,"forward"),r.signals.frameChanged.add(function(t){o.signals.frameChanged.dispatch(t)}),r.signals.playerChanged.add(function(t){o.signals.playerChanged.dispatch(t)}),r.signals.countChanged.add(function(t){o.signals.countChanged.dispatch(t)}),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,r){return t.prototype.addRepresentation.call(this,e,this.trajectory,r)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,r),e}(zb),Ix=function(t){function e(e,r,i){var n=i||{};n.timeOffset=gn(n.timeOffset,e.timeOffset),n.deltaTime=gn(n.deltaTime,e.deltaTime),t.call(this,"",r,n),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this._init(r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"frames"},e.prototype._makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var r,i=this.frames[t];if(this.atomIndices){var n=this.atomIndices,o=n.length;r=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*n[a];r[s+0]=i[c+0],r[s+1]=i[c+1],r[s+2]=i[c+2]}}else r=new Float32Array(i);var u=this.boxes[t],h=this.frames.length;this._process(t,u,r,h),"function"==typeof e&&e()},e.prototype._loadFrameCount=function(){this.frames&&this._setFrameCount(this.frames.length)},e.prototype.getPath=function(t,e){for(var r=this,i=this.frameCount,n=3*t,o=new Float32Array(3*i),a=0;a<i;++a){var s=3*a,c=r.frames[a];o[s+0]=c[n+0],o[s+1]=c[n+1],o[s+2]=c[n+2]}e(o)},Object.defineProperties(e.prototype,r),e}(Vy),Rx=function(t){function e(e,r,i){t.call(this,"",r,i),this._init(r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"structure"},e.prototype._makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var r,i=this.structure,n=i.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;r=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];r[c+0]=n[u+0],r[c+1]=n[u+1],r[c+2]=n[u+2]}}else r=new Float32Array(n);var h=i.boxes[t],l=i.frames.length;this._process(t,h,r,l),"function"==typeof e&&e()},e.prototype._loadFrameCount=function(){this._setFrameCount(this.structure.frames.length)},e.prototype.getPath=function(t,e){for(var r=this,i=this.frameCount,n=3*t,o=new Float32Array(3*i),a=0;a<i;++a){var s=3*a,c=r.structure.frames[a];o[s+0]=c[n+0],o[s+1]=c[n+1],o[s+2]=c[n+2]}e(o)},Object.defineProperties(e.prototype,r),e}(Vy),Lx=function(t){function e(e,r,i){t.call(this,e,r,i),this._init(r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"remote"},e.prototype._makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){for(var e=this.structure.getAtomIndices(),r=e.length,i=e[0],n=e[0],o=1;o<r;++o){var a=e[o];n+1<a&&(t.push([i,n+1]),i=a),n=a}t.push([i,n+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var r=this,i=new window.XMLHttpRequest,n=Hf.trajectory,o=n.getFrameUrl(this.trajPath,t),a=n.getFrameParams(this.trajPath,this.atomIndices);i.open("POST",o,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){var n=i.response;if(n){var a=new Int32Array(n,0,1)[0],s=new Float32Array(n,8,9),c=new Float32Array(n,44);r._process(t,s,c,a),"function"==typeof e&&e()}else Uf.error("empty arrayBuffer for '"+o+"'")},!1),i.send(a)},e.prototype._loadFrameCount=function(){var t=this,e=new window.XMLHttpRequest,r=Hf.trajectory.getCountUrl(this.trajPath);e.open("GET",r,!0),e.addEventListener("load",function(){t._setFrameCount(parseInt(e.response))},!1),e.send(null)},e.prototype.getPath=function(t,e){var r=this;if(this.pathCache[t])e(this.pathCache[t]);else{Uf.time("loadPath");var i=new window.XMLHttpRequest,n=Hf.trajectory.getPathUrl(this.trajPath,t);i.open("POST",n,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){Uf.timeEnd("loadPath");var o=i.response;if(o){var a=new Float32Array(o);r.pathCache[t]=a,e(a)}else Uf.error("empty arrayBuffer for '"+n+"'")},!1),i.send("")}},Object.defineProperties(e.prototype,r),e}(Vy);By.prototype.getView=function(t){return new Ox(this,t)};var Ox=function(e){function r(t,r){e.call(this),this.structure=t,this.selection=r,this.center=new g,this.boundingBox=new st,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return r.prototype.init=function(){},i.type.get=function(){return"StructureView"},i.name.get=function(){return this.structure.name},i.path.get=function(){return this.structure.path},i.title.get=function(){return this.structure.title},i.id.get=function(){return this.structure.id},i.atomSetDict.get=function(){return this.structure.atomSetDict},i.biomolDict.get=function(){return this.structure.biomolDict},i.entityList.get=function(){return this.structure.entityList},i.unitcell.get=function(){return this.structure.unitcell},i.frames.get=function(){return this.structure.frames},i.boxes.get=function(){return this.structure.boxes},i.validation.get=function(){return this.structure.validation},i.bondStore.get=function(){return this.structure.bondStore},i.backboneBondStore.get=function(){return this.structure.backboneBondStore},i.rungBondStore.get=function(){return this.structure.rungBondStore},i.atomStore.get=function(){return this.structure.atomStore},i.residueStore.get=function(){return this.structure.residueStore},i.chainStore.get=function(){return this.structure.chainStore},i.modelStore.get=function(){return this.structure.modelStore},i.atomMap.get=function(){return this.structure.atomMap},i.residueMap.get=function(){return this.structure.residueMap},i.bondHash.get=function(){return this.structure.bondHash},i.spatialHash.get=function(){return this.structure.spatialHash},r.prototype.refresh=function(){var e=this;t.Debug&&Uf.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet();for(var r in e.atomSetDict){var i=e.atomSetDict[r];e.atomSetCache["__"+r]=i.makeIntersection(e.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),t.Debug&&Uf.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},r.prototype.setSelection=function(t){this.selection=t,this.refresh()},r.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var r=this.structure.getSelection();r&&r.string&&e.push(r.string),this.selection&&this.selection.string&&e.push(this.selection.string);var i="";return e.length>0&&(i="( "+e.join(" ) AND ( ")+" )"),new Pf(i)},r.prototype.getStructure=function(){return this.structure.getStructure()},r.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},r.prototype.eachAtom=function(t,e){var r=this.getAtomProxy(),i=this.getAtomSet(e),n=this.atomStore.count;if(i.getSize()<n)i.forEach(function(e){r.index=e,t(r)});else for(var o=0;o<n;++o)r.index=o,t(r)},r.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},r.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},r.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},r.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},r.prototype.getAtomSet=function(t,e){var r=this.structure.getAtomSet(t);return!e&&this.atomSet&&(r=r.makeIntersection(this.atomSet)),r},r.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},r.prototype.refreshPosition=function(){return this.structure.refreshPosition()},r.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(r.prototype,i),r}(By),Dx=function(t){function e(e,r,i){var n=i||{};n.name=gn(n.name,r.name),t.call(this,e,n),this.signals=Object.assign(this.signals,{trajectoryAdded:new no,trajectoryRemoved:new no,defaultAssemblyChanged:new no}),this.structure=r,this.trajList=[],this.initSelection(n.sele),this.setDefaultAssembly(n.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new Pf(t),this.structureView=new Ox(this.structure,this.selection),this.selection.signals.stringChanged.add(function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()})},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach(function(t){t.setParameters({defaultAssembly:e.defaultAssembly})}),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach(function(t){t.build()})},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach(function(e){e.trajectory.setStructure(t.structureView)})},e.prototype.addRepresentation=function(e,r){var i=r||{};return i.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,i)},e.prototype.addTrajectory=function(t,e){var r=this,i=Ws(t,this.structureView,e);i.signals.frameChanged.add(function(){r.updateRepresentations({position:!0})});var n=new Cx(this.stage,i,e,this);return this.trajList.push(n),this.signals.trajectoryAdded.dispatch(n),n},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach(function(t){t.dispose()}),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),gn(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new Pf(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new Pf(t)):this.structure.center},e.prototype.superpose=function(t,e,r,i){return Gs(this.structureView,t.structureView,e,r,i),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach(function(t){t.setVisibility(e)}),this},Object.defineProperties(e.prototype,r),e}(zb);Zf.add("structure",Dx),Zf.add("structureview",Dx);var Nx=function(t){function e(e,r,i){var n=i||{};n.name=gn(n.name,r.name),t.call(this,e,n),this.surface=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,r){return t.prototype.addRepresentation.call(this,e,this.surface,r)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,r),e}(zb);Zf.add("surface",Nx);var kx=function(t){function e(e,r,i){var n=i||{};n.name=gn(n.name,r.name),t.call(this,e,n),this.volume=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,r){return t.prototype.addRepresentation.call(this,e,this.volume,r)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,r),e}(zb);Zf.add("volume",kx);var Fx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.radius=gn(r.radius,.5),r.colorValue=gn(r.colorValue,"lightgreen"),this.showAxes=gn(r.showAxes,!0),this.showBox=gn(r.showBox,!1),t.prototype.init.call(this,r)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),r=new tt(this.colorValue),i=0,n=0;this.showAxes&&(i+=6,n+=3),this.showBox&&(i+=8,n+=12);var o=new Float32Array(3*i),a=ko(i,r.r,r.g,r.b),s=No(i,this.radius),c=new Float32Array(3*n),u=new Float32Array(3*n),h=ko(n,r.r,r.g,r.b),l=No(n,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new g,m=e.getProjectedScaleForAtoms(t),v=m.d1a,y=m.d2a,b=m.d3a,x=m.d1b,_=m.d2b,w=m.d3b;console.log(v,y,b,x,_,w);var S=2*p,A=function(t,r,i){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,r).addScaledVector(e.normVecC,i),f.toArray(o,S),S+=3};A(v,y,b),A(v,y,w),A(v,_,w),A(v,_,b),A(x,_,w),A(x,_,b),A(x,y,b),A(x,y,w);var M=p,T=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,M),f.fromArray(o,2*p+3*e).toArray(u,M),M+=3};T(0,1),T(0,3),T(0,6),T(1,2),T(1,7),T(2,3),T(2,4),T(3,5),T(4,5),T(4,7),T(5,6),T(6,7)}var E=new Jg(e);return{vertex:{position:o,color:a,radius:s,picking:E},edge:{position1:c,position2:u,color:h,color2:h,radius:l,picking:E}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new gb(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Ob(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var r=this.getAxesData(e.sview),i={},n={};t&&!t.position||(i.position=r.vertex.position,n.position1=r.edge.position1,n.position2=r.edge.position2),t&&!t.color||(i.color=r.vertex.color,n.color=r.edge.color,n.color2=r.edge.color),t&&!t.radius||(i.radius=r.vertex.radius,n.radius=r.edge.radius),this.sphereBuffer.setAttributes(i),this.cylinderBuffer.setAttributes(n)},e}(Ab);Wf.add("axes",Fx);var Bx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="ball+stick",this.parameters=Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.radius=gn(r.radius,.15),this.aspectRatio=gn(r.aspectRatio,2),this.lineOnly=gn(r.lineOnly,!1),this.cylinderOnly=gn(r.cylinderOnly,!1),this.multipleBond=gn(r.multipleBond,"off"),this.bondSpacing=gn(r.bondSpacing,1),this.bondScale=gn(r.bondScale,.4),t.prototype.init.call(this,r)},e.prototype.getAtomParams=function(e,r){return r=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},r),t.prototype.getAtomParams.call(this,e,r)},e.prototype.getAtomData=function(t,e,r){return t.getAtomData(this.getAtomParams(e,r))},e.prototype.getBondParams=function(e,r){return r=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},r),t.prototype.getBondParams.call(this,e,r)},e.prototype.getBondData=function(t,e,r){return t.getBondData(this.getBondParams(e,r))},e.prototype.createData=function(t){var e=this.getBondData(t),r=[];if(this.lineOnly)this.lineBuffer=new Db(e,this.getBufferParams()),r.push(this.lineBuffer);else{var i=new Ob(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(r.push(i),!this.cylinderOnly){var n=new gb(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));r.push(n)}}return{bufferList:r}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var r=this.getBondData(e.sview,t);if(this.lineOnly){var i={};t&&!t.position||(i.position1=r.position1,i.position2=r.position2),t&&!t.color||(i.color=r.color,i.color2=r.color2),e.bufferList[0].setAttributes(i)}else{var n={};if(t&&!t.position||(n.position1=r.position1,n.position2=r.position2),t&&!t.color||(n.color=r.color,n.color2=r.color2),t&&!t.radius||(n.radius=r.radius),e.bufferList[0].setAttributes(n),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},e.prototype.setParameters=function(e){var r=!1,i={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(i.radius=!0,zf&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,i,r),this},e}(Ab);Wf.add("ball+stick",Bx);var zx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.aspectRatio=gn(r.aspectRatio,1),r.radius=gn(r.radius,.25),t.prototype.init.call(this,r)},e.prototype.getAtomData=function(t,e,r){return t.getBackboneAtomData(this.getAtomParams(e,r))},e.prototype.getBondData=function(t,e,r){return t.getBackboneBondData(this.getBondParams(e,r))},e}(Bx);Wf.add("backbone",zx);var Ux=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.aspectRatio=gn(r.aspectRatio,1),r.radius=gn(r.radius,.3),t.prototype.init.call(this,r)},e.prototype.getAtomData=function(t,e,r){return t.getRungAtomData(this.getAtomParams(e,r))},e.prototype.getBondData=function(t,e,r){var i=this.getBondParams(e,r);return i.colorParams.rung=!0,t.getRungBondData(i)},e}(Bx);Wf.add("base",Ux),qs.prototype={constructor:qs,getAtomIterator:function(t,e){function r(){var t=this.get(u);return u+=1,t}function i(r){var i=h[c%4];if(i.index=o.getAtomIndexByType(r,t),e&&r>0&&r<s&&"e"===i.sstruc){var n=l[c%4];return p.index=o.getAtomIndexByType(r+1,t),d.index=o.getAtomIndexByType(r-1,t),n.addVectors(p,d).add(i).add(i).multiplyScalar(.25),c+=1,n}return c+=1,i}function n(){c=0,u=-1}var o=this.polymer,a=o.structure,s=o.residueCount,c=0,u=-1,h=[a.getAtomProxy(),a.getAtomProxy(),a.getAtomProxy(),a.getAtomProxy()],l=[new g,new g,new g,new g],p=a.getAtomProxy(),d=a.getAtomProxy();return{size:s,next:r,get:i,reset:n}},getSubdividedColor:function(t){function e(t,e,r){c.atomColorToArray(t,e,r)}var r=this.subdiv,i=this.polymer,n=(i.residueCount-1)*r*3+3;i.isCyclic&&(n+=3*r);var o=new Float32Array(n),a=this.getAtomIterator("trace"),s=t||{};s.structure=i.structure;var c=$f.getScheme(s);return this.interpolator.getColor(a,e,o,0,i.isCyclic),{color:o}},getSubdividedPicking:function(){function t(t){return t.index}var e=this.subdiv,r=this.polymer,i=(r.residueCount-1)*e+1;r.isCyclic&&(i+=e);var n=r.structure,o=this.getAtomIterator("trace"),a=new Float32Array(i);return this.interpolator.getPicking(o,t,a,0,r.isCyclic),{picking:new Qg(a,n)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){function r(t){return c.atomRadius(t)}var i=this.subdiv,n=this.polymer,o=(n.residueCount-1)*i+1;n.isCyclic&&(o+=i);var a=new Float32Array(o),s=this.getAtomIterator("trace"),c=new Ta(t,e);return this.interpolator.getSize(s,r,a,0,n.isCyclic),{size:a}},getPosition:function(){var t=this.subdiv,e=this.polymer,r=(e.residueCount-1)*t*3+3;e.isCyclic&&(r+=3*t);var i=new Float32Array(r),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(n,i,0,e.isCyclic),i},getTangent:function(){var t=this.subdiv,e=this.polymer,r=(this.size-1)*t*3+3;e.isCyclic&&(r+=3*t);var i=new Float32Array(r),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(n,i,0,e.isCyclic),i},getNormals:function(t){var e=this.subdiv,r=this.polymer,i=r.isProtein(),n=this.size,o=(n-1)*e*3+3;r.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,r.isCyclic,i)}else this.interpolator.getNormal(n,t,a,s,0,r.isCyclic,i);return{normal:a,binormal:s}}};var jx=new g,Gx=new g,Vx=function(t){function e(e,r){var i=e||{},n=r||{},o=gn(n.radialSegments,4),a=gn(n.capped,!1),s=a?o:0,c=a?o-2:0,u=i.position.length/3,h=u*o*3+2*s*3,l=2*(u-1)*o*3+2*c*3,p=new Float32Array(h),d=new Float32Array(h),f=new Float32Array(h),m=On(l,h/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:i.picking},n),this.aspectRatio=gn(n.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,i.primitiveId=Bo(u),this.setAttributes(i),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,r,i,n,o,a,s,c,u,h,l,p=this.aspectRatio,d=this.size2,f=d-1,m=this.radialSegments,g=this.geometry.attributes;t.position&&(e=t.position,r=t.normal,i=t.binormal,n=t.tangent,a=t.size,c=g.position.array,h=g.normal.array,g.position.needsUpdate=!0,g.normal.needsUpdate=!0),t.color&&(o=t.color,u=g.color.array,g.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,l=g.primitiveId.array,g.primitiveId.needsUpdate=!0);var v,y,b,x,_,w,S,A,M,T,E,P,C,I,R,L,O,D,N,k,F,B,z,U=[],j=[],G=[],V=[],$=[],H=[];if(e)for(y=0;y<m;++y)S=y/m*2*Math.PI,U[y]=p*Math.cos(S),j[y]=Math.sin(S),G[y]=p*Math.cos(S-.01),V[y]=Math.sin(S-.01),$[y]=p*Math.cos(S+.01),H[y]=Math.sin(S+.01);for(v=0;v<d;++v)for(x=(b=3*v)*m,e&&(jx.set(n[b],n[b+1],n[b+2]),R=r[b],L=r[b+1],O=r[b+2],D=i[b],N=i[b+1],k=i[b+2],F=e[b],B=e[b+1],z=e[b+2],I=a[v]),y=0;y<m;++y)_=x+3*y,e&&(A=-I*U[y],M=I*j[y],T=-I*G[y],E=I*V[y],P=-I*$[y],C=I*H[y],c[_]=F+A*R+M*D,c[_+1]=B+A*L+M*N,c[_+2]=z+A*O+M*k,Gx.set(P*R+C*D-(T*R+E*D),P*L+C*N-(T*L+E*N),P*O+C*k-(T*O+E*k)).cross(jx),h[_]=Gx.x,h[_+1]=Gx.y,h[_+2]=Gx.z),o&&(u[_]=o[b],u[_+1]=o[b+1],u[_+2]=o[b+2]),s&&(l[v*m+y]=s[v]);for(b=0,x=3*d*m,y=0;y<m;++y)_=b+3*y,w=x+3*y,e&&(c[w]=c[_],c[w+1]=c[_+1],c[w+2]=c[_+2],h[w]=n[b],h[w+1]=n[b+1],h[w+2]=n[b+2]),o&&(u[w]=u[_],u[w+1]=u[_+1],u[w+2]=u[_+2]),s&&(l[d*m+y]=l[0+y]);for(b=3*(d-1)*m,x=3*(d+1)*m,y=0;y<m;++y)_=b+3*y,w=x+3*y,e&&(c[w]=c[_],c[w+1]=c[_+1],c[w+2]=c[_+2],h[w]=n[3*f],h[w+1]=n[3*f+1],h[w+2]=n[3*f+2]),o&&(u[w]=u[_],u[w+1]=u[_+1],u[w+2]=u[_+2]),s&&(l[(d+1)*m+y]=l[(d-1)*m+y])},e.prototype.makeIndex=function(){var t,e,r,i,n,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,h=this.radialSegments,l=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*h*3*2,r=t*h,i=(t+1)*h,o=0;o<h;++o)a[n=e+3*o*2]=r+o,a[n+1]=r+(o+1)%h,a[n+2]=i+o,a[n+3]=i+o,a[n+4]=r+(o+1)%h,a[n+5]=i+(o+1)%h;var p=[0];for(o=1;o<l/2;++o)p.push(o),h-o!==o&&p.push(h-o);for(n=c*h*3*2,e=s*h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0]);for(n=c*h*3*2+3*u,e=s*h+h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0])},e}(qy),$x=function(e){function r(t,r,i){e.call(this,t,r,i),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(i)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.init=function(t){var r=t||{};r.colorScheme=gn(r.colorScheme,"chainname"),r.colorScale=gn(r.colorScale,"RdYlBu"),r.radius=gn(r.radius,"sstruc"),r.scale=gn(r.scale,.7),this.aspectRatio=gn(r.aspectRatio,5),this.tension=gn(r.tension,NaN),this.capped=gn(r.capped,!0),this.smoothSheet=gn(r.smoothSheet,!1),"low"===r.quality?(this.subdiv=3,this.radialSegments=6):"medium"===r.quality?this.subdiv=6:"high"===r.quality?this.subdiv=12:this.subdiv=gn(r.subdiv,6),e.prototype.init.call(this,r)},r.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},r.prototype.getSpline=function(t){return new qs(t,this.getSplineParams())},r.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},r.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},r.prototype.createData=function(t){var e=this,r=[],i=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){i.push(t);var n=e.getSpline(t),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.getScale(t));r.push(new Vx(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}},t.getSelection()),{bufferList:r,polymerList:i}},r.prototype.updateData=function(e,r){var i=this;t.Debug&&Uf.time(this.type+" repr update"),e=e||{};for(var n=0,o=r.polymerList.length;n<o;++n){var a={},s=r.polymerList[n],c=i.getSpline(s);if(r.bufferList[n].aspectRatio=i.getAspectRatio(s),e.position||e.radius){var u=c.getSubdividedPosition(),h=c.getSubdividedOrientation(),l=c.getSubdividedSize(i.radius,i.getScale(s));a.position=u.position,a.normal=h.normal,a.binormal=h.binormal,a.tangent=h.tangent,a.size=l.size}if(e.color){var p=c.getSubdividedColor(i.getColorParams());a.color=p.color}if(e.picking){var d=c.getSubdividedPicking();a.picking=d.picking}r.bufferList[n].setAttributes(a)}t.Debug&&Uf.timeEnd(this.type+" repr update")},r.prototype.setParameters=function(t){var r={};return t&&t.aspectRatio&&(r.radius=!0),t&&t.tension&&(r.position=!0),e.prototype.setParameters.call(this,t,r,!1),this},r}(Ab);Wf.add("cartoon",$x);var Hx=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new hs(e)};Hx.prototype.within=function(t,e){Uf.time("Contact within");var r=this.kdtree2,i=this.sview1.getAtomProxy(),n=this.sview1.getAtomSet(!1),o=new sy;this.sview1.eachAtom(function(a){for(var s=!1,c=r.nearest(a,1/0,t),u=0,h=c.length;u<h;++u){var l=c[u];i.index=l.index,a.residueIndex!==i.residueIndex&&(!e||l.distance>e)&&(s=!0,n.set(i.index),o.addBond(a,i,1))}s&&n.set(a.index)});var a=new vv(o.count,!0);return Uf.timeEnd("Contact within"),{atomSet:n,bondSet:a,bondStore:o}};var Wx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="contact",this.parameters=Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1,max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.radius=gn(r.radius,.25),this.contactType=gn(r.contactType,"polarBackbone"),this.maxDistance=gn(r.maxDistance,3.5),this.maxAngle=gn(r.maxAngle,40),t.prototype.init.call(this,r)},e.prototype.getContactData=function(t){return{polar:Ys,polarBackbone:Zs}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,r){var i=t.getBondData(this.getBondParams(e,r));return i.picking&&(i.picking=new ev(i.picking.array,i.picking.structure,r.bondStore)),i},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new Ob(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var r=this.getContactData(e.sview);e.bondSet=r.bondSet,e.bondStore=r.bondStore}var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,i),o={};t&&!t.position||(o.position=Do(n.position1,n.position2),o.position1=n.position1,o.position2=n.position2),t&&!t.color||(o.color=n.color,o.color2=n.color2),t&&!t.radius||(o.radius=n.radius),e.bufferList[0].setAttributes(o)},e}(Ab);Wf.add("contact",Wx),qf.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),qf.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var Xx={},qx=function(t){var e=Object.assign({},t);if(this.font=gn(e.font,["sans-serif"]),this.size=gn(e.size,36),this.style=gn(e.style,"normal"),this.variant=gn(e.variant,"normal"),this.weight=gn(e.weight,"normal"),this.outline=gn(e.outline,0),this.width=gn(e.width,2048),this.height=gn(e.height,2048),this.gamma=1,"undefined"!=typeof navigator){var r=navigator.userAgent;r.match(/Chrome/)&&r.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new Fe(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};qx.prototype.build=function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,r=document.createElement("canvas");r.width=e,r.height=t;var i=r.getContext("2d");i.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,i.fillStyle="#FF0000",i.textAlign="left",i.textBaseline="bottom",i.lineJoin="round";for(var n=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);n.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=r,this.context=i,this.lineHeight=t,this.maxWidth=e,this.colors=n,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},qx.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},qx.prototype.get=function(t){return this.mapped[t]||this.placeholder},qx.prototype.draw=function(t){var e=this.lineHeight,r=this.outline,i=this.context,n=this.scratch,o=this.maxWidth,a=this.colors,s=r,c=e-this.outline,u=i.measureText(t),h=Math.min(o,Math.ceil(u.width+2*s+1));i.clearRect(0,0,h,e);var l,p,d,f,m;if(0===this.outline)for(i.fillText(t,s,c),d=3,l=0,p=(m=(f=i.getImageData(0,0,h,e)).data).length/4;l<p;++l)n[l]=m[d],d+=4;else{for(i.globalCompositeOperation="source-over",l=r+1;l>0;--l)d=l>1?2*l-2:l,i.strokeStyle=a[d-1],i.lineWidth=d,i.strokeText(t,s,c);i.globalCompositeOperation="multiply",i.fillStyle="#FF00FF",i.fillText(t,s,c),m=(f=i.getImageData(0,0,h,e)).data,d=0;var g=this.gamma;for(l=0,p=m.length/4;l<p;++l){var v=m[d],y=v?m[d+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));n[l]=Math.max(0,Math.min(255,x+2)),m[d+3]=n[l],d+=4}}i.putImageData(f,0,0),this.scratchW=h,this.scratchH=e},qx.prototype.populate=function(){var t=this;this.placeholder=this.map(String.fromCharCode(65533));for(var e=0;e<127;++e)t.map(String.fromCharCode(e));for(var r=128;r<255;++r)t.map(String.fromCharCode(r));for(var i=880;i<1023;++i)t.map(String.fromCharCode(i));for(var n=1024;n<1279;++n)t.map(String.fromCharCode(n));this.map(String.fromCharCode(8491))};var Yx=function(t){function e(e,r){var i=e||{},n=r||{};n.forceTransparent=!0;for(var o=i.position.length/3,a=0,s=0;s<o;++s)a+=i.text[s].length;var c=a;n.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new cv},n),this.fontFamily=gn(n.fontFamily,"sans-serif"),this.fontStyle=gn(n.fontStyle,"normal"),this.fontWeight=gn(n.fontWeight,"bold"),this.fontSize=gn(n.fontSize,48),this.sdf=gn(n.sdf,"Chrome"===kf),this.xOffset=gn(n.xOffset,0),this.yOffset=gn(n.yOffset,0),this.zOffset=gn(n.zOffset,.5),this.attachment=gn(n.attachment,"bottom-left"),this.showBorder=gn(n.showBorder,!1),this.borderColor=gn(n.borderColor,"lightgrey"),this.borderWidth=gn(n.borderWidth,.15),this.showBackground=gn(n.showBackground,!1),this.backgroundColor=gn(n.backgroundColor,"lightgrey"),this.backgroundMargin=gn(n.backgroundMargin,.5),this.backgroundOpacity=gn(n.backgroundOpacity,1),this.text=i.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new tt(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new tt(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return r.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,r=this.material;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var i=this.wireframeMaterial;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0;var n=this.pickingMaterial;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,r,i,n,o,a,s=this,c=this.text,u=this.geometry.attributes;t.position&&(e=t.position,n=u.position.array,u.position.needsUpdate=!0),t.size&&(r=t.size,o=u.inputSize.array,u.inputSize.needsUpdate=!0),t.color&&(i=t.color,a=u.color.array,u.color.needsUpdate=!0);for(var h,l,p,d,f=this.positionCount,m=0,g=0;g<f;++g)for(l=3*g,d=c[g].length,s.showBackground&&(d+=1),p=0;p<d;++p,++m)for(var v=0;v<4;v++)h=4*m*3+3*v,e&&(n[h]=e[l],n[h+1]=e[l+1],n[h+2]=e[l+2]),r&&(o[4*m+v]=r[g]),i&&(a[h]=i[l],a[h+1]=i[l+1],a[h+2]=i[l+2])},e.prototype.makeTexture=function(){this.textAtlas=Ks({font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0}),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,r,i,n,o,a,s,c=this,u=this.textAtlas,h=this.text,l=this.attachment,p=u.lineHeight*this.backgroundMargin*.1-10,d=this.geometry.attributes.inputTexCoord.array,f=this.geometry.attributes.mapping.array,m=this.positionCount,g=0,v=0;v<m;++v){for(i=0,o=(r=h[v]).length,n=0;n<o;++n)i+=(t=u.get(r[n])).w-2*u.outline;for(s=l.startsWith("top")?u.lineHeight/1.25:l.startsWith("middle")?u.lineHeight/2.5:0,a=l.endsWith("right")?i:l.endsWith("center")?i/2:0,a+=u.outline,s+=u.outline,c.showBackground&&(f[(e=2*g*4)+0]=-u.lineHeight/6-a-p,f[e+1]=u.lineHeight-s+p,f[e+2]=-u.lineHeight/6-a-p,f[e+3]=0-s-p,f[e+4]=i+u.lineHeight/6-a+2*u.outline+p,f[e+5]=u.lineHeight-s+p,f[e+6]=i+u.lineHeight/6-a+2*u.outline+p,f[e+7]=0-s-p,d[e+0]=10,d[e+2]=10,d[e+4]=10,d[e+6]=10,g+=1),i=0,n=0;n<o;++n,++g){t=u.get(r[n]),f[(e=2*g*4)+0]=i-a,f[e+1]=t.h-s,f[e+2]=i-a,f[e+3]=0-s,f[e+4]=i+t.w-a,f[e+5]=t.h-s,f[e+6]=i+t.w-a,f[e+7]=0-s;var y=u.width,b=u.height,x=[t.x/y,t.y/b,t.x/y,(t.y+t.h)/b,(t.x+t.w)/y,t.y/b,(t.x+t.w)/y,(t.y+t.h)/b];d.set(x,e),i+=t.w-2*u.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var r=t.prototype.getDefines.call(this,e);return this.sdf&&(r.SDF=1),r},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},r.wireframe.set=function(t){},r.wireframe.get=function(){return!1},r.isText.get=function(){return!0},r.vertexShader.get=function(){return"SDFFont.vert"},r.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,r),e}(fb);Kf.add("text",Yx);var Zx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.radius=gn(r.radius,.15),this.fontFamily=gn(r.fontFamily,"sans-serif"),this.fontStyle=gn(r.fontStyle,"normal"),this.fontWeight=gn(r.fontWeight,"bold"),this.sdf=gn(r.sdf,"Firefox"!==kf),this.labelSize=gn(r.labelSize,2),this.labelColor=gn(r.labelColor,16777215),this.labelVisible=gn(r.labelVisible,!0),this.labelZOffset=gn(r.labelZOffset,.5),this.labelUnit=gn(r.labelUnit,""),this.atomPair=gn(r.atomPair,[]),t.prototype.init.call(this,r)},e.prototype.getDistanceData=function(t,e){var r=e.length,i=new Array(r),n=new Float32Array(3*r),o=new Pf,a=new Pf,s=new sy,c=t.getAtomProxy(),u=t.getAtomProxy(),h=0;e.forEach(function(e,r){var l=e[0],p=e[1];if(Number.isInteger(l)&&Number.isInteger(p))c.index=l,u.index=p;else{o.setString(l),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(h+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),r-=h;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":i[r]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":i[r]=(m/10).toFixed(2)+" nm";break;default:i[r]=m.toFixed(2)}var g=3*r;n[g+0]=(c.x+u.x)/2,n[g+1]=(c.y+u.y)/2,n[g+2]=(c.z+u.z)/2},this),h>0&&(r-=h,n=n.subarray(0,3*r));var l=new vv(s.count,!0);return{text:i,position:n,bondSet:l,bondStore:s}},e.prototype.getBondData=function(t,e,r){var i=t.getBondData(this.getBondParams(e,r));return i.picking&&(i.picking=new nv(i.picking.array,i.picking.structure,r.bondStore)),i},e.prototype.create=function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),r=new tt(this.labelColor);this.textBuffer=new Yx({position:e.position,size:No(t,this.labelSize),color:ko(t,r.r,r.g,r.b),text:e.text},this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(this.structureView,void 0,i);this.cylinderBuffer=new Ob(n,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var r={bondSet:e.bondSet,bondStore:e.bondStore},i=this.getBondData(e.sview,t,r),n={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=No(a,this.labelSize)),t.labelColor){var s=new tt(this.labelColor);o.color=ko(a,s.r,s.g,s.b)}t.color&&(n.color=i.color,n.color2=i.color2),(t.radius||t.scale)&&(n.radius=i.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(n)},e.prototype.setVisibility=function(e,r){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),r||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var r={};return e&&e.labelSize&&(r.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(r.labelColor=!0),t.prototype.setParameters.call(this,e,r,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(Ab);Wf.add("distance",Zx);var Kx=function(t){function e(e,r){var i=r||{},n=2*(e.position.length/3),o=new tt(gn(i.color,"grey")),a=new Float32Array(3*n),s=ko(n,o.r,o.g,o.b);t.call(this,{position:a,color:s},i),this.scale=gn(i.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,r,i,n=this.geometry.attributes;t.position&&t.vector&&(e=t.position,r=t.vector,i=n.position.array,n.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,i[(o=2*u*3)+0]=e[a+0],i[o+1]=e[a+1],i[o+2]=e[a+2],i[o+3]=e[a+0]+r[a+0]*c,i[o+4]=e[a+1]+r[a+1]*c,i[o+5]=e[a+2]+r[a+2]*c},r.isLine.get=function(){return!0},r.vertexShader.get=function(){return"Line.vert"},r.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,r),e}(Wy),Qx=function(e){function r(t,r,i){e.call(this,t,r,i),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(i)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.init=function(t){var r=t||{};r.colorScheme=gn(r.colorScheme,"sstruc"),r.radius=gn(r.radius,.15),r.scale=gn(r.scale,1),e.prototype.init.call(this,r)},r.prototype.createData=function(t){var e=this,r=[],i=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){i.push(t);var n=new as(t),o=n.getPosition(),a=n.getColor(e.getColorParams()),s=n.getSize(e.radius,e.scale),c=n.getPicking();r.push(new gb({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new Kx({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new Kx({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}},t.getSelection()),{bufferList:r,polymerList:i}},r.prototype.updateData=function(e,r){t.Debug&&Uf.time(this.type+" repr update"),e=e||{};for(var i=0,n=r.polymerList.length;i<n;++i){var o=3*i,a={},s=new as(r.polymerList[i]);if(e.position){var c=s.getPosition();a.position=c.center,r.bufferList[o+1].setAttributes({position:c.center,vector:c.axis}),r.bufferList[o+2].setAttributes({position:c.center,vector:c.resdir})}r.bufferList[o].setAttributes(a)}t.Debug&&Uf.timeEnd(this.type+" repr update")},r}(Ab);Wf.add("helixorient",Qx);var Jx=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.aspectRatio=1,t.prototype.init.call(this,r)},e}(Bx);Wf.add("licorice",Jx),qf.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),qf.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var t_=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),e_=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),r_=function(t){function e(e,r){t.call(this,e,r);var i=e||{},n=gn((r||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new v},modelViewProjectionMatrixInverse:{value:new v},modelViewMatrixInverseTranspose:{value:new v},shrink:{value:n}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(i),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return r.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},r.isImpostor.get=function(){return!0},r.vertexShader.get=function(){return"HyperballStickImpostor.vert"},r.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,r),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return r.mapping.get=function(){return t_},r.mappingIndices.get=function(){return e_},r.mappingIndicesSize.get=function(){return 36},r.mappingType.get=function(){return"v3"},r.mappingSize.get=function(){return 8},r.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,r),e}(lb)),i_=function(t,e){return!zf||e&&e.disableImpostor?(t.radius=Uo(t.radius1,t.radius2),new Cb(t,e)):new r_(t,e)},n_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.scale=gn(r.scale,.2),r.radius=gn(r.radius,"vdw"),this.shrink=gn(r.shrink,.12),t.prototype.init.call(this,r)},e.prototype.getBondParams=function(e,r){return e&&!e.radius||(r=Object.assign({radius2:!0},r)),t.prototype.getBondParams.call(this,e,r)},e.prototype.createData=function(t){var e=new gb(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new i_(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var r=e.sview.getAtomData(this.getAtomParams()),i=e.sview.getBondData(this.getBondParams()),n={},o={};if(!t||t.position){n.position=r.position;var a=i.position1,s=i.position2;o.position=Do(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(n.color=r.color,o.color=i.color,o.color2=i.color2),t&&!t.radius||(n.radius=r.radius,o.radius=i.radius,o.radius2=i.radius2),e.bufferList[0].setAttributes(n),e.bufferList[1].setAttributes(o)},e}(Jx);Wf.add("hyperball",n_),Qs.prototype={constructor:Qs,atomLabel:function(t){var e;switch(this.type){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var r=t.resname.toUpperCase();e=(Fv[r]||r)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},Qs.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"};var o_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:Qs.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};this.labelType=gn(r.labelType,"res"),this.labelText=gn(r.labelText,{}),this.fontFamily=gn(r.fontFamily,"sans-serif"),this.fontStyle=gn(r.fontStyle,"normal"),this.fontWeight=gn(r.fontWeight,"bold"),this.sdf=gn(r.sdf,"Chrome"===kf),this.xOffset=gn(r.xOffset,0),this.yOffset=gn(r.yOffset,0),this.zOffset=gn(r.zOffset,.5),this.attachment=gn(r.attachment,"bottom-left"),this.showBorder=gn(r.showBorder,!1),this.borderColor=gn(r.borderColor,"lightgrey"),this.borderWidth=gn(r.borderWidth,.15),this.showBackground=gn(r.showBackground,!1),this.backgroundColor=gn(r.backgroundColor,"lightgrey"),this.backgroundMargin=gn(r.backgroundMargin,.5),this.backgroundOpacity=gn(r.backgroundOpacity,1),t.prototype.init.call(this,r)},e.prototype.createData=function(t){var e={position:!0,color:!0,radius:!0},r=t.getAtomData(this.getAtomParams(e)),i=[],n=new Qs(this.labelType,this.labelText);return t.eachAtom(function(t){i.push(n.atomLabel(t))}),{bufferList:[new Yx({position:r.position,size:r.radius,color:r.color,text:i},this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}))]}},e.prototype.updateData=function(t,e){var r=e.sview.getAtomData(this.getAtomParams(t)),i={};t&&!t.position||(i.position=r.position),t&&!t.radius||(i.size=r.radius),t&&!t.color||(i.color=r.color),e.bufferList[0].setAttributes(i)},e}(Ab);Wf.add("label",o_);var a_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};this.multipleBond=gn(r.multipleBond,"off"),this.bondSpacing=gn(r.bondSpacing,1),t.prototype.init.call(this,r)},e.prototype.getBondParams=function(e,r){return r=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},r),t.prototype.getBondParams.call(this,e,r)},e.prototype.createData=function(t){var e={position:!0,color:!0},r=t.getBondData(this.getBondParams(e));return{bufferList:[new Db(r,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var r=e.sview.getBondData(this.getBondParams(t)),i={};t&&!t.position||(i.position1=r.position1,i.position2=r.position2),t&&!t.color||(i.color=r.color,i.color2=r.color2),e.bufferList[0].setAttributes(i)},e.prototype.setParameters=function(e){var r={};return e&&e.bondSpacing&&(r.position=!0),t.prototype.setParameters.call(this,e,r,!1),this},e}(Ab);Wf.add("line",a_),tc.__deps=[ns,is,os,sa,Js],rc.__deps=[ns,os,No,sa,va,pa,ya,ec,gn],Vf.add("molsurf",function(t,e){var r=t.data.args,i=t.data.params;if(r&&i){var n=new("av"===i.type?rc:tc)(r.coordList,r.radiusList,r.indexList).getSurface(i.type,i.probeRadius,i.scaleFactor,i.cutoff,!0,i.smooth,i.contour),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:i},o)}},[tc,rc]);var s_=function(t){this.structure=t};s_.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},s_.prototype._makeSurface=function(t,e){var r=new Jv(e.name,"",t);return r.info.type=e.type,r.info.probeRadius=e.probeRadius,r.info.scaleFactor=e.scaleFactor,r.info.smooth=e.smooth,r.info.cutoff=e.cutoff,r},s_.prototype.getSurface=function(t){var e=t||{},r=this._getAtomData(),i=r.position,n=r.radius,o=r.index,a=new("av"===e.type?rc:tc)(i,n,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},s_.prototype.getSurfaceWorker=function(t,e){var r=this,i=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new Ya("molsurf"));var n=this._getAtomData(),o=n.position,a=n.radius,s=n.index,c={args:{coordList:o,radiusList:a,indexList:s},params:i},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,function(t){e(r._makeSurface(t.data.sd,i))},function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),r.worker.terminate(),r.worker=void 0;var n=r.getSurface(i);e(n)})}else{var h=this.getSurface(i);e(h)}},s_.prototype.dispose=function(){this.worker&&this.worker.terminate()};var c_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="surface",this.parameters=Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add(function(){this.__forceNewMolsurf=!0},this),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"uniform"),r.colorValue=gn(r.colorValue,14540253),r.disablePicking=gn(r.disablePicking,!0),this.surfaceType=gn(r.surfaceType,"ms"),this.probeRadius=gn(r.probeRadius,1.4),this.smooth=gn(r.smooth,2),this.scaleFactor=gn(r.scaleFactor,2),this.cutoff=gn(r.cutoff,0),this.contour=gn(r.contour,!1),this.background=gn(r.background,!1),this.opaqueBack=gn(r.opaqueBack,!0),this.filterSele=gn(r.filterSele,""),this.colorVolume=gn(r.colorVolume,void 0),this.useWorker=gn(r.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,r){var i=this.__infoList[e];if(i||(i={},this.__infoList[e]=i),i.molsurf&&i.sele===t.selection.string)r(e);else{if(this.filterSele){var n=t.structure.getView(new Pf(this.filterSele)),o=n.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(n.center,a/2+6);t=t.getView(new Pf(t.getAtomSetWithinSelection(s,3).toSeleString()))}i.sele=t.selection.string,i.molsurf=new s_(t);var c=this.getSurfaceParams(),u=function(t){i.surface=t,r(e)};this.useWorker?i.molsurf.getSurfaceWorker(c,u):u(i.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}),this.__infoList.length=0),0!==this.structureView.atomCount){var r=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),i="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[i];n?n.partList.forEach(function(t,i){var o=t.getView(e.structureView);e.prepareData(o,i,function(t){t===n.partList.length-1&&r()})}):this.prepareData(this.structureView,0,r)}else t()},e.prototype.createData=function(t,e){var r=this.__infoList[e],i=r.surface,n={position:i.getPosition(),color:i.getColor(this.getColorParams()),index:i.getFilteredIndex(this.filterSele,t)},o=[];if(i.contour){var a=new nb(n,this.getBufferParams({wireframe:!1}));o.push(a)}else{n.normal=i.getNormal(),n.picking=i.getPicking(t.getStructure());var s=new eb(n,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new rb(s);o.push(c)}return{bufferList:o,info:r}},e.prototype.updateData=function(t,e){var r={};if(t.position)return this.__forceNewMolsurf=!0,void this.build();t.color&&(r.color=e.info.surface.getColor(this.getColorParams())),t.index&&(r.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e,r,i){return r=r||{},e&&e.filterSele&&(r.index=!0),e&&void 0!==e.colorVolume&&(r.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,r,i),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(Ab);Wf.add("surface",c_);var u_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="point",this.parameters=Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};this.pointSize=gn(r.pointSize,1),this.sizeAttenuation=gn(r.sizeAttenuation,!0),this.sortParticles=gn(r.sortParticles,!1),this.useTexture=gn(r.useTexture,!1),this.alphaTest=gn(r.alphaTest,.5),this.forceTransparent=gn(r.forceTransparent,!1),this.edgeBleach=gn(r.edgeBleach,0),t.prototype.init.call(this,r)},e.prototype.createData=function(t){var e={position:!0,color:!0,picking:!0},r=t.getAtomData(this.getAtomParams(e));return{bufferList:[new vb(r,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var r=e.sview.getAtomData(this.getAtomParams(t)),i={};t&&!t.position||(i.position=r.position),t&&!t.color||(i.color=r.color),e.bufferList[0].setAttributes(i)},e}(Ab);Wf.add("point",u_),qf.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}");var h_=new Uint16Array([0,1,2,1,3,2]),l_=function(t){function e(e,r){var i=e||{},n=i.position.length/3-1,o=4*n,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),h=On(a,a/3);t.call(this,{position:s,color:c,index:h,normal:u,picking:i.picking},r),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),i.primitiveId=Bo(n),this.setAttributes(i),this.meshIndex=h,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,r,i,n,o,a,s,c,u,h,l,p,d=this.size/4,f=this.geometry.attributes;t.position&&(e=t.position,s=f.position.array,f.position.needsUpdate=!0),t.normal&&(r=t.normal,c=f.normal.array,f.normal.needsUpdate=!0),t.size&&(i=t.size,u=f.size.array,f.size.needsUpdate=!0),t.dir&&(n=t.dir,h=f.dir.array,f.dir.needsUpdate=!0),t.color&&(o=t.color,l=f.color.array,f.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=f.primitiveId.array,f.primitiveId.needsUpdate=!0);var m,g,v,y,b,x,_,w=i?i[0]:null;for(m=0;m<d;++m){for(x=3*m,v=3*m*4,b=4*m,e&&(s[v]=s[v+3]=e[x],s[v+1]=s[v+4]=e[x+1],s[v+2]=s[v+5]=e[x+2],s[v+6]=s[v+9]=e[x+3],s[v+7]=s[v+10]=e[x+4],s[v+8]=s[v+11]=e[x+5]),r&&(c[v]=c[v+3]=-r[x],c[v+1]=c[v+4]=-r[x+1],c[v+2]=c[v+5]=-r[x+2],c[v+6]=c[v+9]=-r[x+3],c[v+7]=c[v+10]=-r[x+4],c[v+8]=c[v+11]=-r[x+5]),g=0;g<4;++g)y=v+3*g,o&&(l[y]=o[x],l[y+1]=o[x+1],l[y+2]=o[x+2]),a&&(p[b+g]=a[m]);i&&(_=i[m],w!==i[m]?(u[b]=w,u[b+1]=w,u[b+2]=_,u[b+3]=_):(u[b]=_,u[b+1]=_,u[b+2]=_,u[b+3]=_),w=_),n&&(h[v]=n[x],h[v+1]=n[x+1],h[v+2]=n[x+2],h[v+3]=-n[x],h[v+4]=-n[x+1],h[v+5]=-n[x+2],h[v+6]=n[x+3],h[v+7]=n[x+4],h[v+8]=n[x+5],h[v+9]=-n[x+3],h[v+10]=-n[x+4],h[v+11]=-n[x+5])}},e.prototype.makeIndex=function(){var t,e,r,i,n=this.meshIndex,o=n.length/4/3;for(e=0;e<o;++e)for(r=6*e,i=4*e,n.set(h_,r),t=0;t<6;++t)n[r+t]+=i},r.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,r),e}(qy),p_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"chainname"),r.colorScale=gn(r.colorScale,"RdYlBu"),r.radius=gn(r.radius,"sstruc"),r.scale=gn(r.scale,4),"low"===r.quality?this.subdiv=3:"medium"===r.quality?this.subdiv=6:"high"===r.quality?this.subdiv=12:this.subdiv=gn(r.subdiv,6),this.tension=gn(r.tension,NaN),this.smoothSheet=gn(r.smoothSheet,!1),t.prototype.init.call(this,r)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,r=[],i=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){i.push(t);var n=new qs(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.scale);r.push(new l_({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}},t.getSelection()),{bufferList:r,polymerList:i}},e.prototype.updateData=function(t,e){var r=this;t=t||{};var i=0,n=e.polymerList.length;for(i=0;i<n;++i){var o={},a=new qs(e.polymerList[i],r.getSplineParams());if(t.position){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation();o.position=s.position,o.normal=c.binormal,o.dir=c.normal}if(t.radius||t.scale){var u=a.getSubdividedSize(r.radius,r.scale);o.size=u.size}if(t.color){var h=a.getSubdividedColor(r.getColorParams());o.color=h.color}e.bufferList[i].setAttributes(o)}},e.prototype.setParameters=function(e){var r={};return e&&e.tension&&(r.position=!0),t.prototype.setParameters.call(this,e,r,!1),this},e}(Ab);Wf.add("ribbon",p_);var d_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"sstruc"),r.radius=gn(r.radius,1.5),r.scale=gn(r.scale,1),r.openEnded=gn(r.openEnded,!1),this.localAngle=gn(r.localAngle,30),this.centerDist=gn(r.centerDist,2.5),this.ssBorder=gn(r.ssBorder,!1),t.prototype.init.call(this,r)},e.prototype.createData=function(t){var e=this,r=0,i=[],n=[];this.structure.eachPolymer(function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new ss(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);r+=a.size.length,i.push(a),n.push(o)}},t.getSelection());var o={begin:new Float32Array(3*r),end:new Float32Array(3*r),size:new Float32Array(r),color:new Float32Array(3*r),picking:new Float32Array(r)},a=0;return i.forEach(function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length}),r&&(o.picking=new Qg(o.picking,t.getStructure())),{bufferList:[new Ob({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:i,helixbundleList:n,axisData:o}},e.prototype.updateData=function(t,e){var r=this;if((t=t||{}).position)this.build();else{var i={};if(t.color||t.radius){var n=0;e.helixbundleList.forEach(function(i){var o=i.getAxis(r.localAngle,r.centerDist,r.ssBorder,r.getColorParams(),r.radius,r.scale);t.color&&e.axisData.color.set(o.color,3*n),(t.radius||t.scale)&&e.axisData.size.set(o.size,n),n+=o.size.length}),t.color&&(i.color=e.axisData.color,i.color2=e.axisData.color),(t.radius||t.scale)&&(i.radius=e.axisData.size)}e.bufferList[0].setAttributes(i)}},e}(Ab);Wf.add("rocket",d_);var f_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.aspectRatio=1,r.tension=gn(r.tension,.5),r.scale=gn(r.scale,5),r.smoothSheet=!1,this.smooth=gn(r.smooth,2),t.prototype.init.call(this,r)},e.prototype.getSpline=function(t){var e=new as(t);return new qs(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}($x);Wf.add("rope",f_);var m_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};t.prototype.init.call(this,r)},e.prototype.createData=function(t){return{bufferList:[new gb(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var r=e.sview.getAtomData(this.getAtomParams(t)),i={};t&&!t.position||(i.position=r.position),t&&!t.color||(i.color=r.color),t&&!t.radius||(i.radius=r.radius),e.bufferList[0].setAttributes(i)},e}(Ab);Wf.add("spacefill",m_);var g_=function(t){function e(e,r){var i=e||{},n=r||{},o=i.position.length/3-1,a=new Float32Array(3*o*2),s=new Float32Array(3*o*2);t.call(this,{position:a,color:s},n),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,r,i,n,o=this.geometry.attributes;if(t.position&&(e=t.position,i=o.position.array,o.position.needsUpdate=!0),t.color&&(r=t.color,n=o.color.array,o.color.needsUpdate=!0),e||r)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(i[s]=e[a],i[s+1]=e[a+1],i[s+2]=e[a+2],i[s+3]=e[a+3],i[s+4]=e[a+4],i[s+5]=e[a+5]),r&&(n[s]=r[a],n[s+1]=r[a+1],n[s+2]=r[a+2],n[s+3]=r[a+3],n[s+4]=r[a+4],n[s+5]=r[a+5]);else Uf.warn("TraceBuffer.prototype.setAttributes no data")},r.isLine.get=function(){return!0},r.vertexShader.get=function(){return"Line.vert"},r.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,r),e}(Wy),v_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorScheme=gn(r.colorScheme,"chainname"),r.colorScale=gn(r.colorScale,"RdYlBu"),"low"===r.quality?this.subdiv=3:"medium"===r.quality?this.subdiv=6:"high"===r.quality?this.subdiv=12:this.subdiv=gn(r.subdiv,6),this.tension=gn(r.tension,NaN),this.smoothSheet=gn(r.smoothSheet,!1),t.prototype.init.call(this,r)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,r=[],i=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){i.push(t);var n=new qs(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedColor(e.getColorParams());r.push(new g_(Object.assign({},o,a),e.getBufferParams()))}},t.getSelection()),{bufferList:r,polymerList:i}},e.prototype.updateData=function(t,e){var r=this;t=t||{};var i=0,n=e.polymerList.length;for(i=0;i<n;++i){var o={},a=new qs(e.polymerList[i],r.getSplineParams());if(t.position){var s=a.getSubdividedPosition();o.position=s.position}if(t.color){var c=a.getSubdividedColor(r.getColorParams());o.color=c.color}e.bufferList[i].setAttributes(o)}},e.prototype.setParameters=function(e){var r={};return e&&e.tension&&(r.position=!0),t.prototype.setParameters.call(this,e,r,!1),this},e}(Ab);Wf.add("trace",v_);var y_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.aspectRatio=1,r.scale=gn(r.scale,2),"low"===r.quality&&(this.radialSegments=5),t.prototype.init.call(this,r)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}($x);Wf.add("tube",y_);var b_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{},i=.5;this.structure.unitcell&&(i=Math.cbrt(this.structure.unitcell.volume)/200),r.radius=gn(r.radius,i),r.colorValue=gn(r.colorValue,"orange"),t.prototype.init.call(this,r)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new gb(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Ob(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var r=e.sview.getStructure(),i=this.getUnitcellData(r),n={},o={};t&&!t.position||(n.position=i.vertexPosition,o.position1=i.edgePosition1,o.position2=i.edgePosition2),t&&!t.color||(n.color=i.vertexColor,o.color=i.edgeColor,o.color2=i.edgeColor),t&&!t.radius||(n.radius=i.vertexRadius,o.radius=i.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(o)},e}(Ab);Wf.add("unitcell",b_);var x_=function(t){function e(e,r,i){t.call(this,e,r,i),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var r=e||{};r.colorValue=gn(r.colorValue,"#f0027f"),t.prototype.init.call(this,r)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new Ob(e,this.getBufferParams({openEnded:!1}))]}}},e}(Ab);Wf.add("validation",x_);var __=new g,w_=new g,S_=new g,A_=new g(0,1,0),M_=function(t){function e(e,r){var i=r||{},n=gn(i.radialSegments,60),o=gn(i.openEnded,!1),a=(new v).makeRotationX(-Math.PI/2),s=new br(1,1,n,1,o);s.applyMatrix(a);var c=new Float32Array(e.position1.length);t.call(this,{position:c,color:e.color,picking:e.picking},i,s),this._position=c,this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){w_.fromArray(this._position1,r),S_.fromArray(this._position2,r),t.lookAt(w_,S_,A_);var i=this._radius[e];__.set(i,i,w_.distanceTo(S_)),t.scale(__)},e.prototype.setAttributes=function(e,r){e.position1&&e.position2&&(Do(e.position1,e.position2,this._position),this._position1=e.position1,this._position2=e.position2,e.position=this._position),e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb),T_=function(t,e){return new M_(t,e)};Kf.add("cone",T_);var E_=function(t){this.geometryList=t,this.boundingBox=null};E_.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new st,this.geometryList.forEach(function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)})};var P_=function(t,e){var r=t||{},i=e||{};this.aspectRatio=gn(i.aspectRatio,1.5),this.wireframe=gn(i.wireframe,!1),this.splitPosition=new Float32Array(r.position1.length),this.cylinderRadius=new Float32Array(r.radius.length);var n=this.makeAttributes(r),o={radialSegments:gn(i.radialSegments,50),openEnded:gn(i.openEnded,!1),disableImpostor:gn(i.disableImpostor,!1)};this.cylinderBuffer=new Ob(n.cylinder,o),this.coneBuffer=new T_(n.cone,o),this.geometry=new E_([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new Ne,this.wireframeGroup=new Ne,this.pickingGroup=new Ne,this.matrix=gn(i.matrix,new v),this.picking=r.picking},C_={matrix:{},pickable:{}};C_.matrix.set=function(t){Wy.prototype.setMatrix.call(this,t)},C_.matrix.get=function(){return this.group.matrix.clone()},C_.pickable.get=function(){return!!this.picking},P_.prototype.makeAttributes=function(t){var e,r,i=this.splitPosition,n=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,r=n.length;e<r;++e)n[e]=t.radius[e]/o;a.radius=n,s.radius=t.radius}if(t.position1&&t.position2){var c=new g,u=new g,h=new g,l=new g;for(e=0,r=i.length;e<r;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),h.subVectors(c,u);var p=h.length(),d=n[e/3]*o*2,f=Math.min(p,d);h.setLength(f),l.copy(u).add(h),l.toArray(i,e)}a.position1=t.position1,a.position2=i,s.position1=i,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},P_.prototype.getMesh=function(t){return(new Ne).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},P_.prototype.getWireframeMesh=function(){return(new Ne).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},P_.prototype.getPickingMesh=function(){return(new Ne).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},P_.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},P_.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},P_.prototype.setVisibility=function(){Wy.prototype.setVisibility.apply(this,arguments)},P_.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(P_.prototype,C_),Kf.add("arrow",P_);var I_=new g,R_=new g,L_=new g,O_=new g(0,0,0),D_=function(t){function e(e,r){var i=r||{},n=new Rt(1,1,1);t.call(this,e,i,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){R_.fromArray(this._heightAxis,r),L_.fromArray(this._depthAxis,r),t.lookAt(O_,R_,L_),I_.set(this._size[e],L_.length(),R_.length()),t.scale(I_)},e.prototype.setAttributes=function(e,r){e.size&&(this._size=e.size),e.heightAxis&&(this._heightAxis=e.heightAxis),e.depthAxis&&(this._depthAxis=e.depthAxis),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb);Kf.add("box",D_);var N_=new g,k_=new g,F_=new g,B_=new g(0,0,0),z_=function(t){function e(e,r){var i=r||{},n=new qe(1,gn(i.sphereDetail,2));t.call(this,e,i,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){k_.fromArray(this._majorAxis,r),F_.fromArray(this._minorAxis,r),t.lookAt(B_,k_,F_),N_.set(this._radius[e],F_.length(),k_.length()),t.scale(N_)},e.prototype.setAttributes=function(e,r){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb),U_=function(t,e){return new z_(t,e)};Kf.add("ellipsoid",U_);var j_=new g,G_=new g,V_=new g,$_=new g(0,0,0),H_=function(t){function e(e,r){var i=r||{},n=new We(1,0);t.call(this,e,i,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){G_.fromArray(this._heightAxis,r),V_.fromArray(this._depthAxis,r),t.lookAt($_,G_,V_),j_.set(this._size[e],V_.length(),G_.length()),t.scale(j_)},e.prototype.setAttributes=function(e,r){e.size&&(this._size=e.size),e.heightAxis&&(this._heightAxis=e.heightAxis),e.depthAxis&&(this._depthAxis=e.depthAxis),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb);Kf.add("octahedron",H_);var W_=new g,X_=new g,q_=new g,Y_=new g(0,0,0),Z_=function(t){function e(e,r){var i=r||{},n=new $e(1,0);t.call(this,e,i,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){X_.fromArray(this._heightAxis,r),q_.fromArray(this._depthAxis,r),t.lookAt(Y_,X_,q_),W_.set(this._size[e],q_.length(),X_.length()),t.scale(W_)},e.prototype.setAttributes=function(e,r){e.size&&(this._size=e.size),e.heightAxis&&(this._heightAxis=e.heightAxis),e.depthAxis&&(this._depthAxis=e.depthAxis),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb);Kf.add("tetrahedron",Z_);var K_=new g,Q_=new g,J_=new g,tw=new g(0,0,0),ew=function(t){function e(e,r){var i=r||{},n=new rr(1,gn(i.radiusRatio,.2),gn(i.radialSegments,16),gn(i.tubularSegments,32));t.call(this,e,r,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,r){Q_.fromArray(this._majorAxis,r),J_.fromArray(this._minorAxis,r),t.lookAt(tw,Q_,J_);var i=this._radius[e];K_.set(i,i,i),t.scale(K_)},e.prototype.setAttributes=function(e,r){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,r)},r.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,r),e}(cb);Kf.add("torus",ew);var rw=function(t,e){var r=e||{};this.streamer=t,this.name=gn(r.name,""),this.path=gn(r.path,"")},iw={type:{},__objName:{},isBinary:{},isJson:{},isXml:{}};iw.type.get=function(){return""},iw.__objName.get=function(){return""},iw.isBinary.get=function(){return!1},iw.isJson.get=function(){return!1},iw.isXml.get=function(){return!1},rw.prototype.parse=function(){var t=this;return this.streamer.read().then(function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]})},rw.prototype._parse=function(){},rw.prototype._beforeParse=function(){},rw.prototype._afterParse=function(){t.Debug&&Uf.log(this[this.__objName])},Object.defineProperties(rw.prototype,iw);var nw=function(t){function e(e,r){var i=r||{};t.call(this,e,i),this.firstModelOnly=gn(i.firstModelOnly,!1),this.asTrajectory=gn(i.asTrajectory,!1),this.cAlphaOnly=gn(i.cAlphaOnly,!1),this.structure=new By(this.name,this.path),this.structureBuilder=new ic(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"structure"},r.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,r),e}(rw),ow=function(t,e,r,i,n){this.structure=t,this.index=e,this.description=r||"",this.entityType=nc(i||""),this.chainIndexList=n||[],n.forEach(function(r){t.chainStore.entityIndex[r]=e})},aw={type:{}};aw.type.get=function(){return"Entity"},ow.prototype.getEntityType=function(){return this.entityType},ow.prototype.isPolymer=function(){return this.entityType===bv},ow.prototype.isNonPolymer=function(){return this.entityType===xv},ow.prototype.isMacrolide=function(){return this.entityType===_v},ow.prototype.isWater=function(){return this.entityType===wv},ow.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach(function(r){e.index=r,t(e)})},Object.defineProperties(ow.prototype,aw);var sw=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new v;var r=$n(this.alpha),i=$n(this.beta),n=$n(this.gamma),o=Math.cos(r),a=Math.cos(i),s=Math.cos(n),c=Math.sin(i),u=Math.sin(n);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var h=this.a*this.b*u/this.volume,l=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*l,1/h,0,0,0,0,1).transpose(),this.cartToFrac=(new v).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};sw.prototype.getPosition=function(t){function e(t,e,s){o.set(t,e,s).multiply(n).applyMatrix4(i.fracToCart).toArray(r,a),a+=3}var r=new Float32Array(24),i=t.unitcell,n=t.center.clone().applyMatrix4(i.cartToFrac).floor().multiplyScalar(2).addScalar(1),o=new g,a=0;return e(0,0,0),e(1,0,0),e(0,1,0),e(0,0,1),e(1,1,0),e(1,0,1),e(0,1,1),e(1,1,1),r},sw.prototype.getCenter=function(t){return Fo(this.getPosition(t))},sw.prototype.getData=function(t,e){function r(t,e){s.fromArray(c,3*t).toArray(l,m),s.fromArray(c,3*e).toArray(p,m),m+=3}var i=e||{},n=gn(i.colorValue,"orange"),o=gn(i.radius,Math.cbrt(this.volume)/200),a=new tt(n),s=new g,c=this.getPosition(t),u=ko(8,a.r,a.g,a.b),h=No(8,o),l=new Float32Array(36),p=new Float32Array(36),d=ko(12,a.r,a.g,a.b),f=No(12,o),m=0;r(0,1),r(0,2),r(0,3),r(1,4),r(1,5),r(2,6),r(3,5),r(4,7),r(5,7),r(2,4),r(7,6),r(3,6);var v=new fv(this,t);return{vertex:{position:c,color:u,radius:h,picking:v},edge:{position1:l,position2:p,color:d,color2:d,radius:f,picking:v}}};var cw={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},uw=["DAL","DAR","DSG","DAS","DCY","DGL","DGN","DHI","DIL","DLE","DLY","MED","DPN","DPR","DSN","DTH","DTR","DTY","DVA","DNE"],hw=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],lw=/\s+/,pw=function(e){function r(t,r){var i=r||{};e.call(this,t,i),this.hex=gn(i.hex,!1)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"pdb"},r.prototype._parse=function(){function e(t,e,i){for(var n=t;n<e;++n)if(l=i[n],"ATOM  "===(p=l.substr(0,6))||"HETATM"===p){if(gt&&(X?(K?(a=new Float32Array(3*lt.count),Y.push(a)):a=[],s=0):W||(J={}),O=(L=1).toString(),D=!0,gt=!1),W&&mt>0)continue;var o=void 0,st=void 0,vt=void 0,yt=void 0,bt=void 0;if(U){if(yt=l.split(lw),bt=10===yt.length?1:0,x=yt[2],q&&"CA"!==x)continue;o=parseFloat(yt[6-bt]),st=parseFloat(yt[7-bt]),vt=parseFloat(yt[8-bt])}else{if(x=l.substr(12,4).trim(),q&&"CA"!==x)continue;o=parseFloat(l.substr(30,8)),st=parseFloat(l.substr(38,8)),vt=parseFloat(l.substr(46,8))}if(X){var xt=3*s;if(a[xt+0]=o,a[xt+1]=st,a[xt+2]=vt,s+=1,K)continue}var _t=void 0;U?(d=parseInt(yt[1]),_t="",_="H"===l[0]?1:0,f=bt?"":yt[4],m=parseInt(yt[5-bt]),b="",g=yt[3],S="",y=0):(d=parseInt(l.substr(6,5),$),V&&99999===d&&($=16),_="H"===l[0]?1:0,f=l[21].trim(),m=parseInt(l.substr(22,4),H)||1,V&&9999===m&&(H=16),b=l[26].trim(),g=l.substr(17,4).trim()||"MOL",w=parseFloat(l.substr(60,6)),S=l[16].trim(),y=parseFloat(l.substr(54,6)),r||(_t=l.substr(76,2).trim(),f||(f=l.substr(72,4).trim()))),lt.growIfFull(),lt.atomTypeId[ft]=ht.add(x,_t),lt.x[ft]=o,lt.y[ft]=st,lt.z[ft]=vt,lt.serial[ft]=d,lt.altloc[ft]=S.charCodeAt(0),lt.occupancy[ft]=isNaN(y)?0:y,U?(lt.partialCharge[ft]=parseFloat(yt[9-bt]),lt.radius[ft]=parseFloat(yt[10-bt])):lt.bfactor[ft]=isNaN(w)?0:w;var wt=oc(m,f,b);!_||nt[wt]||uw.includes(g)?D||N===f||(O=(L+=1).toString()):N===f&&F===g&&(Gv.includes(g)||k===m&&B===b)||(O=(L+=1).toString(),k=m,F=g,B=b),G.addAtom(mt,f,O,g,m,_,void 0,b),J[d]=ft,ft+=1,D=!1,N=f}else if("CONECT"===p){var St=J[parseInt(l.substr(6,5))],At=[11,16,21,26],Mt={};if(void 0===St)continue;for(var Tt=0;Tt<4;++Tt){var Et=parseInt(l.substr(At[Tt],5));if(!Number.isNaN(Et)&&void 0!==(Et=J[Et]))if(St<Et?(pt.index=St,dt.index=Et):(pt.index=Et,dt.index=St),void 0!==Mt[Et])j.bondStore.bondOrder[Mt[Et]]+=1;else{var Pt=pt.index+"|"+dt.index;void 0===et[Pt]&&(et[Pt]=!0,Mt[Et]=j.bondStore.count,j.bondStore.addBond(pt,dt,1))}}}else if("HELIX "===p){A=l[19].trim(),M=parseInt(l.substr(21,4)),T=l[25].trim(),E=l[31].trim(),P=parseInt(l.substr(33,4)),C=l[37].trim();var Ct=parseInt(l.substr(39,1));Ct=(cw[Ct]||cw[""]).charCodeAt(0),ct.push([A,M,T,E,P,C,Ct])}else if("SHEET "===p)A=l[21].trim(),M=parseInt(l.substr(22,4)),T=l[26].trim(),E=l[32].trim(),P=parseInt(l.substr(33,4)),C=l[37].trim(),ut.push([A,M,T,E,P,C]);else if("HETNAM"===p)it[l.substr(11,3)]=l.substr(15).trim();else if("SEQRES"===p){var It=l[11].trim();It!==z&&(at[It]=[],z=It),(de=at[It]).push.apply(de,l.substr(19).trim().split(lw))}else if("MODRES"===p){var Rt=l.substr(12,3).trim(),Lt=l[16].trim(),Ot=l[22].trim(),Dt=parseInt(l.substr(18,4).trim()),Nt=oc(Dt,Lt,Ot);nt[Nt]={resname:Rt,chainname:Lt,inscode:Ot,resno:Dt}}else if("COMPND"===p){var kt=l.substr(10,70).trim(),Ft=kt.indexOf(":"),Bt=kt.substring(0,Ft),zt=void 0;hw.includes(Bt)?(R=Bt,zt=kt.substring(Ft+2)):zt=kt,zt=zt.replace(/;$/,""),"MOL_ID"===R?(I={chainList:[],name:""},rt.push(I)):"MOLECULE"===R?(I.name&&(I.name+=" "),I.name+=zt):"CHAIN"===R&&Array.prototype.push.apply(I.chainList,zt.split(/\s*,\s*/))}else if(l.startsWith("TER")){var Ut=j.getChainProxy(j.chainStore.count-1);ot[Ut.chainname]=Ut.index,O=(L+=1).toString(),D=!0}else if("REMARK"===p&&"350"===l.substr(7,3)){if("BIOMOLECULE:"===l.substr(11,12)){var jt=l.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(jt)&&(jt="BU"+jt),c=new fy(jt),Q[jt]=c}else if("BIOMT"===l.substr(13,5)){var Gt=l.split(/\s+/),Vt=parseInt(l[18])-1;0===Vt&&(h=new v,u.matrixList.push(h));var $t=h.elements;$t[0+Vt]=parseFloat(Gt[4]),$t[4+Vt]=parseFloat(Gt[5]),$t[8+Vt]=parseFloat(Gt[6]),$t[12+Vt]=parseFloat(Gt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===l.substr(11,30)||"                   AND CHAINS:"===l.substr(11,30)){"APPLY"===l.substr(11,5)&&(u=c.addPart());for(var Ht=l.substr(41,30).split(","),Wt=0,Xt=Ht.length;Wt<Xt;++Wt){var qt=Ht[Wt].trim();qt&&u.chainList.push(qt)}}}else if("HEADER"===p)j.id=l.substr(62,4);else if("TITLE "===p)j.title+=(j.title?" ":"")+l.substr(10,70).trim();else if("MODEL "===p)gt=!0;else if("ENDMDL"===p||l.startsWith("END")){if(gt)continue;X&&!K&&(Y.push(new Float32Array(a)),K=!0),mt+=1,gt=!0}else if("MTRIX"===l.substr(0,5)){if("1"===l[59])continue;var Yt=l.split(/\s+/),Zt=Yt[1].trim();if("1"===l[5]&&"1"===Zt){c=new fy("NCS"),Q.NCS=c,u=c.addPart()}var Kt=parseInt(l[5])-1;0===Kt&&(h=new v,u.matrixList.push(h));var Qt=h.elements;Qt[0+Kt]=parseFloat(Yt[2]),Qt[4+Kt]=parseFloat(Yt[3]),Qt[8+Kt]=parseFloat(Yt[4]),Qt[12+Kt]=parseFloat(Yt[5])}else if("ORIGX"===l.substr(0,5)){tt.origx||(tt.origx=new v);var Jt=l.split(/\s+/),te=parseInt(l[5])-1,ee=tt.origx.elements;ee[0+te]=parseFloat(Jt[1]),ee[4+te]=parseFloat(Jt[2]),ee[8+te]=parseFloat(Jt[3]),ee[12+te]=parseFloat(Jt[4])}else if("SCALE"===l.substr(0,5)){tt.scale||(tt.scale=new v);var re=l.split(/\s+/),ie=parseInt(l[5])-1,ne=tt.scale.elements;ne[0+ie]=parseFloat(re[1]),ne[4+ie]=parseFloat(re[2]),ne[8+ie]=parseFloat(re[3]),ne[12+ie]=parseFloat(re[4])}else if("CRYST1"===p){var oe=parseFloat(l.substr(6,9)),ae=parseFloat(l.substr(15,9)),se=parseFloat(l.substr(24,9)),ce=parseFloat(l.substr(33,7)),ue=parseFloat(l.substr(40,7)),he=parseFloat(l.substr(47,7)),le=l.substr(55,11).trim(),pe=new Float32Array(9);pe[0]=oe,pe[4]=ae,pe[8]=se,Z.push(pe),0===mt&&(tt.a=oe,tt.b=ae,tt.c=se,tt.alpha=ce,tt.beta=ue,tt.gamma=he,tt.spacegroup=le)}var de}t.Debug&&Uf.time("PdbParser._parse "+this.name);var r=!1,i=this.streamer.peekLines(1)[0],n=i.substr(62,4),o=i.substr(72,4);n===o&&o.trim()&&(r=!0);var a,s,c,u,h,l,p,d,f,m,g,y,b,x,_,w,S,A,M,T,E,P,C,I,R,L,O,D,N,k,F,B,z,U="pqr"===this.type,j=this.structure,G=this.structureBuilder,V=this.hex,$=10,H=10,W=this.firstModelOnly,X=this.asTrajectory,q=this.cAlphaOnly,Y=j.frames,Z=j.boxes,K=!1,Q=j.biomolDict,J={},tt={},et={},rt=[],it={},nt={},ot={},at={},st={helices:[],sheets:[]},ct=st.helices,ut=st.sheets,ht=j.atomMap,lt=j.atomStore;lt.resize(Math.round(this.streamer.data.length/80)),U&&(lt.addField("partialCharge",1,"float32"),lt.addField("radius",1,"float32"));var pt=j.getAtomProxy(),dt=j.getAtomProxy(),ft=0,mt=0,gt=!0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)});var vt=rt.length;if(vt){j.eachChain(function(t){t.entityIndex=vt}),rt.forEach(function(t,e){var r=t.chainList.map(function(t){return ot[t]});j.entityList.push(new ow(j,e,t.name,"polymer",r))});var yt=rt.length,bt=j.getResidueProxy(),xt={};j.eachChain(function(t){t.entityIndex===vt&&(bt.index=t.residueOffset,xt[bt.resname]||(xt[bt.resname]=[]),xt[bt.resname].push(t.index))}),Object.keys(xt).forEach(function(t){var e=xt[t],r="non-polymer",i=it[t]||t;Gv.includes(t)&&(i="water",r="water"),j.entityList.push(new ow(j,yt,i,r,e)),yt+=1})}void 0!==tt.a?j.unitcell=new sw(tt):j.unitcell=void 0,(ct.length||ut.length)&&ds(j,st),G.finalize(),j.finalizeAtoms(),r||ms(j),gs(j),j.finalizeBonds(),ct.length||ut.length||yy(j),_s(j),t.Debug&&Uf.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("pdb",pw),Xf.add("pdb1",pw),Xf.add("ent",pw);var dw=/\s+/,fw=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,mw=/"/g,gw=/^['"]+|['"]+$/g,vw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"cif"},r.prototype._parse=function(){function e(e,q,Y){for(var Z=e;Z<q;++Z)if(n=Y[Z],((o=n.trim())||L||N)&&"#"!==o[0])if("data_"===o.substring(0,5))C.data=o.substring(5).trim();else if(";"===o[0])L?(N?(B===F.length&&(B=0),F[B].push(O),B+=1):!1===U?C[z]=O:C[z][U]=O,L=!1,O=null):(L=!0,O=o.substring(1));else if("loop_"===o)N=!0,k=!0,F.length=0,G.length=0,B=0;else if("_"===o[0]){var K,Q,J;if(N&&!k&&(N=!1),N)Q=(K=o.split("."))[0].substring(1),J=K[1],1===K.length?(J=!1,C[Q]||(C[Q]=[]),F.push(C[Q])):(C[Q]||(C[Q]={}),C[Q][J]?t.Debug&&Uf.warn(Q,J,"already exists"):(C[Q][J]=[],F.push(C[Q][J]),G.push(J))),z=Q,U=J,j=!0;else{var tt=o.match(fw),et=tt[0],rt=tt[1];Q=(K=et.split("."))[0].substring(1),J=K[1],1===K.length?(J=!1,C[Q]=rt):(C[Q]||(C[Q]={}),C[Q][J]?t.Debug&&Uf.warn(Q,J,"already exists"):C[Q][J]=rt),rt||(D=!0),z=Q,U=J}}else if(L)O+=n;else if(N){if(!o)continue;if("atom_site"===z){var it=o.split(dw);j&&(a=G.indexOf("auth_asym_id"),s=G.indexOf("auth_seq_id"),c=G.indexOf("label_atom_id"),u=G.indexOf("label_comp_id"),h=G.indexOf("label_asym_id"),l=G.indexOf("label_entity_id"),p=G.indexOf("label_alt_id"),y=G.indexOf("Cartn_x"),b=G.indexOf("Cartn_y"),x=G.indexOf("Cartn_z"),f=G.indexOf("id"),m=G.indexOf("type_symbol"),d=G.indexOf("group_PDB"),_=G.indexOf("B_iso_or_equiv"),g=G.indexOf("pdbx_PDB_model_num"),v=G.indexOf("pdbx_PDB_ins_code"),w=G.indexOf("occupancy"),j=!1,H=parseInt(it[g]),T&&(r=[],i=0));var nt=parseInt(it[g]);if(H!==nt&&(T&&(0===X&&P.push(new Float32Array(r)),r=new Float32Array(3*$.count),P.push(r),i=0),X+=1),H=nt,M&&X>0)continue;var ot=it[c].replace(mw,"");if(E&&"CA"!==ot)continue;var at=parseFloat(it[y]),st=parseFloat(it[b]),ct=parseFloat(it[x]);if(T){var ut=3*i;if(r[ut+0]=at,r[ut+1]=st,r[ut+2]=ct,i+=1,X>0)continue}var ht=it[u],lt=parseInt(it[s]),pt=it[v];pt="?"===pt?"":pt;var dt=it[a],ft=it[h],mt="H"===it[d][0]?1:0,gt=it[m],vt=parseFloat(it[_]),yt=parseFloat(it[w]),bt=it[p];if(bt="."===bt?"":bt,$.growIfFull(),$.atomTypeId[W]=V.add(ot,gt),$.x[W]=at,$.y[W]=st,$.z[W]=ct,$.serial[W]=parseInt(it[f]),$.bfactor[W]=isNaN(vt)?0:vt,$.occupancy[W]=isNaN(yt)?0:yt,$.altloc[W]=bt.charCodeAt(0),A.addAtom(X,dt,ft,ht,lt,mt,void 0,pt),t.Debug){var xt=I[ft];void 0!==xt&&xt!==dt&&t.Debug&&Uf.warn(xt,dt)}I[ft]=dt;var _t=it[l];R[_t]||(R[_t]=new Set),R[_t].add(S.chainStore.count-1),W+=1}else{var wt=o.match(fw),St=wt.length;B===F.length&&(B=0);for(var At=0;At<St;++At)F[B+At].push(wt[At]);B+=St}k=!1}else if("'"===o[0]&&"'"===o[o.length-1]){var Mt=o.substring(1,o.length-1);!1===U?C[z]=Mt:C[z][U]=Mt}else D?!1===U?C[z]=o:C[z][U]=o:t.Debug&&Uf.log("CifParser._parse: unknown state",o);else L=!1,N=!1,D=!1,F.length=0,B=null,z=null,U=null,j=null,G.length=0}Uf.time("CifParser._parse "+this.name);var r,i,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S=this.structure,A=this.structureBuilder,M=this.firstModelOnly,T=this.asTrajectory,E=this.cAlphaOnly,P=S.frames,C={},I={},R={},L=!1,O=null,D=!1,N=!1,k=!1,F=[],B=null,z=null,U=null,j=null,G=[],V=S.atomMap,$=S.atomStore;$.resize(this.streamer.data.length/100);var H,W=0,X=0;if(this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),C.chem_comp&&C.chem_comp_atom)lc(C,S,A),A.finalize(),S.finalizeAtoms(),S.finalizeBonds(),Ss(S);else if(C.atom_site_type_symbol&&C.atom_site_label&&C.atom_site_fract_x)pc(C,S,A),A.finalize(),S.finalizeAtoms(),gs(S),S.finalizeBonds();else{var q=dc(C,S,I);if(fc(C,S,I),mc(C,S,I),gc(C,S,R),C.struct&&C.struct.title&&(S.title=C.struct.title.trim().replace(gw,"")),C.entry&&C.entry.id&&(S.id=C.entry.id.trim().replace(gw,"")),C.pdbx_audit_revision_history){if(C.pdbx_audit_revision_history.revision_date){sc(C.pdbx_audit_revision_history,"revision_date");var Y=C.pdbx_audit_revision_history.revision_date.filter(cc);Y.length&&(S.header.releaseDate=Y[0])}if(C.pdbx_database_status.recvd_initial_deposition_date){sc(C.pdbx_database_status,"recvd_initial_deposition_date");var Z=C.pdbx_database_status.recvd_initial_deposition_date.filter(cc);Z.length&&(S.header.depositionDate=Z[0])}}else if(C.database_PDB_rev){if(C.database_PDB_rev.date){sc(C.database_PDB_rev,"date");var K=C.database_PDB_rev.date.filter(cc);K.length&&(S.header.releaseDate=K[0])}if(C.database_PDB_rev.date_original){sc(C.database_PDB_rev,"date_original");var Q=C.database_PDB_rev.date_original.filter(cc);Q.length&&(S.header.depositionDate=Q[0])}}C.reflns&&C.reflns.d_resolution_high?cc(C.reflns.d_resolution_high)&&(S.header.resolution=parseFloat(C.reflns.d_resolution_high)):C.refine&&C.refine.ls_d_res_high&&cc(C.refine.ls_d_res_high)&&(S.header.resolution=parseFloat(C.refine.ls_d_res_high)),C.refine&&C.refine.ls_R_factor_R_free&&cc(C.refine.ls_R_factor_R_free)&&(S.header.rFree=parseFloat(C.refine.ls_R_factor_R_free)),C.refine&&C.refine.ls_R_factor_R_work&&cc(C.refine.ls_R_factor_R_work)&&(S.header.rWork=parseFloat(C.refine.ls_R_factor_R_work)),C.exptl&&C.exptl.method&&(sc(C.exptl,"method"),S.header.experimentalMethods=C.exptl.method.map(function(t){return t.replace(gw,"")})),A.finalize(),S.finalizeAtoms(),gs(S),S.finalizeBonds(),q?ds(S,q):yy(S),_s(S),S.extraData.cif=C}t.Debug&&Uf.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("cif",vw),Xf.add("mcif",vw),Xf.add("mmcif",vw);var yw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"gro"},r.prototype._parse=function(){function e(t,e,n){for(var l=t;l<e;++l){var E=++T-1,P=n[l];if(P)if(E%_==0)s&&(r=new Float32Array(3*x),u.push(r),i=0);else if(E%_==1);else if(E%_==_-1){var C=P.trim().split(/\s+/),I=new Float32Array(9);if(I[0]=10*parseFloat(C[0]),I[4]=10*parseFloat(C[1]),I[8]=10*parseFloat(C[2]),h.push(I),a)return!0;M+=1}else{if(p=P.substr(10,5).trim(),c&&"CA"!==p)continue;var R=10*parseFloat(P.substr(v,g)),L=10*parseFloat(P.substr(y,g)),O=10*parseFloat(P.substr(b,g));if(s){var D=3*i;if(r[D+0]=R,r[D+1]=L,r[D+2]=O,i+=1,E>_)continue}d=P.substr(5,5).trim(),f=parseInt(P.substr(0,5)),m=parseInt(P.substr(15,5)),S.growIfFull(),S.atomTypeId[A]=w.add(p),S.x[A]=R,S.y[A]=L,S.z[A]=O,S.serial[A]=m,o.addAtom(M,"","",d,f,0,"l"),A+=1}}}t.Debug&&Uf.time("GroParser._parse "+this.name);var r,i,n=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=this.cAlphaOnly,u=n.frames,h=n.boxes,l=this.streamer.peekLines(3);n.title=l[0].trim();var p,d,f,m,g=5+(l[2].length-l[2].lastIndexOf(".")-1),v=20,y=20+g,b=20+2*g,x=parseInt(l[1]),_=x+3,w=n.atomMap,S=n.atomStore;S.resize(x);var A=0,M=0,T=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),o.finalize(),n.finalizeAtoms(),ms(n),gs(n),n.finalizeBonds(),yy(n),t.Debug&&Uf.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("gro",yw);var bw=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],xw=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(bw),_w={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)},ww=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"mmtf"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("MmtfParser._parse "+this.name);var e,r,i,n,o,a=this.structure,s=Bc(kc(this.streamer.data));["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach(function(t){void 0!==s[t]&&(a.header[t]=s[t])});var c,u,h,l,p,d;if(a.id=s.structureId,a.title=s.title,this.firstModelOnly||this.asTrajectory){for(p=1,h=0,e=0,r=l=s.chainsPerModel[0];e<r;++e)h+=s.groupsPerChain[e];for(u=0,e=0,r=h;e<r;++e)u+=(o=s.groupList[s.groupTypeList[e]]).atomNameList.length;c=s.numBonds,d=[l]}else c=s.numBonds,u=s.numAtoms,h=s.numGroups,l=s.numChains,p=s.numModels,d=s.chainsPerModel;if(c+=h,this.asTrajectory)for(e=0,r=s.numModels;e<r;++e){var f=new Float32Array(3*u),m=u*e;for(i=0;i<u;++i){var g=3*i,y=i+m;f[g]=s.xCoordList[y],f[g+1]=s.yCoordList[y],f[g+2]=s.zCoordList[y]}a.frames.push(f)}var b=new Uint32Array(c),x=new Uint32Array(c),_=new Uint8Array(c),w=new Uint32Array(u),S=new Uint32Array(h),A=new Uint32Array(h),M=new Uint16Array(h),T=new Uint16Array(l),E=new Uint32Array(l),P=new Uint32Array(l),C=new Uint32Array(p),I=new Uint32Array(p),R=0;for(e=0,r=p;e<r;++e){var L=d[e];for(C[e]=R,I[e]=L,i=0;i<L;++i)T[i+R]=e;R+=L}var O=s.groupsPerChain,D=0;for(e=0,r=l;e<r;++e){var N=O[e];for(E[e]=D,P[e]=N,i=0;i<N;++i)S[i+D]=e;D+=N}var k=0,F=0;for(e=0,r=h;e<r;++e){var B=(o=s.groupList[s.groupTypeList[e]]).atomNameList.length,z=o.bondAtomList,U=o.bondOrderList;for(i=0,n=U.length;i<n;++i)b[F]=k+z[2*i],x[F]=k+z[2*i+1],_[F]=U[i],F+=1;for(A[e]=k,M[e]=B,i=0;i<B;++i)w[k]=e,k+=1}var j=s.bondAtomList;if(j)for(s.bondOrderList&&_.set(s.bondOrderList,F),e=0,r=j.length;e<r;e+=2){var G=j[e],V=j[e+1];G<u&&V<u&&(b[F]=G,x[F]=V,F+=1)}a.bondStore.length=_.length,a.bondStore.count=F,a.bondStore.atomIndex1=b,a.bondStore.atomIndex2=x,a.bondStore.bondOrder=_,a.atomStore.length=u,a.atomStore.count=u,a.atomStore.residueIndex=w,a.atomStore.atomTypeId=new Uint16Array(u),a.atomStore.x=s.xCoordList.subarray(0,u),a.atomStore.y=s.yCoordList.subarray(0,u),a.atomStore.z=s.zCoordList.subarray(0,u),a.atomStore.serial=s.atomIdList.subarray(0,u),a.atomStore.bfactor=s.bFactorList.subarray(0,u),a.atomStore.altloc=s.altLocList.subarray(0,u),a.atomStore.occupancy=s.occupancyList.subarray(0,u),a.residueStore.length=h,a.residueStore.count=h,a.residueStore.chainIndex=S,a.residueStore.residueTypeId=s.groupTypeList,a.residueStore.atomOffset=A,a.residueStore.atomCount=M,a.residueStore.resno=s.groupIdList.subarray(0,h),a.residueStore.sstruc=s.secStructList.subarray(0,h),a.residueStore.inscode=s.insCodeList.subarray(0,h),a.chainStore.length=l,a.chainStore.count=l,a.chainStore.entityIndex=new Uint16Array(l),a.chainStore.modelIndex=T,a.chainStore.residueOffset=E,a.chainStore.residueCount=P,a.chainStore.chainname=s.chainNameList.subarray(0,4*l),a.chainStore.chainid=s.chainIdList.subarray(0,4*l),a.modelStore.length=p,a.modelStore.count=p,a.modelStore.chainOffset=C,a.modelStore.chainCount=I;var $={};for(e=0,r=s.groupList.length;e<r;++e){var H=s.groupList[e],W=[];for(i=0,n=H.atomNameList.length;i<n;++i){var X=H.elementList[i].toUpperCase(),q=H.atomNameList[i];W.push(a.atomMap.add(q,X))}var Y=H.chemCompType.toUpperCase(),Z=Cv.includes(Y),K=H.bondOrderList.length,Q=new Array(K),J=new Array(K);for(i=0;i<K;++i)Q[i]=H.bondAtomList[2*i],J[i]=H.bondAtomList[2*i+1];var tt={atomIndices1:Q,atomIndices2:J,bondOrders:H.bondOrderList};$[e]=a.residueMap.add(H.groupName,W,Z,Y,tt)}for(e=0,r=h;e<r;++e)a.residueStore.residueTypeId[e]=$[a.residueStore.residueTypeId[e]];for(e=0,r=a.atomStore.count;e<r;++e){var et=a.atomStore.residueIndex[e],rt=a.residueMap.list[a.residueStore.residueTypeId[et]],it=a.residueStore.atomOffset[et];a.atomStore.atomTypeId[e]=rt.atomTypeIdList[e-it]}if(s.secStructList){var nt=s.secStructList.length;for(e=0,r=a.residueStore.count;e<r;++e){var ot=_w[a.residueStore.sstruc[e%nt]];void 0!==ot&&(a.residueStore.sstruc[e]=ot)}}if(s.entityList&&s.entityList.forEach(function(t,e){a.entityList[e]=new ow(a,e,t.description,t.type,t.chainIndexList)}),s.bioAssemblyList&&s.bioAssemblyList.forEach(function(t,e){var r=e+1,i=new fy(r);a.biomolDict["BU"+r]=i;var n={};t.transformList.forEach(function(t){var e=(new v).fromArray(t.matrix).transpose(),r=t.chainIndexList.map(function(t){for(var e="",r=0;r<4;++r){var i=s.chainNameList[4*t+r];if(!i)break;e+=String.fromCharCode(i)}return e}),o=n[r];o?o.matrixList.push(e):n[r]=i.addPart([e],r)})}),s.ncsOperatorList){var at=new fy("NCS"),st=at.addPart();s.ncsOperatorList.forEach(function(t){var e=(new v).fromArray(t).transpose();st.matrixList.push(e)}),st.matrixList.length>0&&(a.biomolDict.NCS=at)}var ct=s.unitCell;ct&&Array.isArray(ct)&&ct[0]?a.unitcell=new sw({a:ct[0],b:ct[1],c:ct[2],alpha:ct[3],beta:ct[4],gamma:ct[5],spacegroup:s.spaceGroup}):a.unitcell=void 0,xs(a,!0),bs(a,!0),a.finalizeAtoms(),a.finalizeBonds(),_s(a),t.Debug&&Uf.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("mmtf",ww);var Sw=/\s+/,Aw={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0},Mw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"mol2"},r.prototype._parse=function(){function e(t,e,S){for(var A=t;A<e;++A){var M=S[A].trim();if(""!==M&&"#"!==M[0])if("@"===M[0])"@<TRIPOS>MOLECULE"===M?(v=y,d=0,++m):"@<TRIPOS>ATOM"===M?(v=b,f=l.count,s&&(i=0,r=new Float32Array(3*g),c.push(r),m>0&&(u=!0))):v="@<TRIPOS>BOND"===M?x:0;else if(v===y){if(0===d)n.title=M,n.id=M;else if(1===d){var T=M.split(Sw);g=parseInt(T[0])}++d}else if(v===b){var E=M.split(Sw);if(a&&m>0)continue;var P=parseFloat(E[2]),C=parseFloat(E[3]),I=parseFloat(E[4]);if(s){var R=3*i;if(r[R+0]=P,r[R+1]=C,r[R+2]=I,i+=1,u)continue}var L=E[0],O=E[1],D=E[5].split(".")[0],N=E[6]?parseInt(E[6]):1,k=E[7]?E[7]:"",F=E[8]?parseFloat(E[8]):0;l.growIfFull(),l.atomTypeId[p]=h.add(O,D),l.x[p]=P,l.y[p]=C,l.z[p]=I,l.serial[p]=L,l.partialCharge[p]=F,o.addAtom(m,"","",k,N,1),p+=1}else if(v===x){if(a&&m>0)continue;if(s&&m>0)continue;var B=M.split(Sw);_.index=parseInt(B[1])-1+f,w.index=parseInt(B[2])-1+f;var z=Aw[B[3]];n.bondStore.addBond(_,w,z)}}}t.Debug&&Uf.time("Mol2Parser._parse "+this.name);var r,i,n=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=n.frames,u=!1,h=n.atomMap,l=n.atomStore;l.resize(Math.round(this.streamer.data.length/60)),l.addField("partialCharge",1,"float32");var p=0,d=0,f=0,m=-1,g=0,v=0,y=1,b=2,x=3,_=n.getAtomProxy(),w=n.getAtomProxy();this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),o.finalize(),n.finalizeAtoms(),ms(n),bs(n,!0),xs(n,!0),n.finalizeBonds(),Ss(n),yy(n),t.Debug&&Uf.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("mol2",Mw);var Tw=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,r),e}(pw);Xf.add("pqr",Tw);var Ew=/> <(.+)>/,Pw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"sdf"},r.prototype._parse=function(){function e(t,e,a){for(var C=t;C<e;++C){var I=a[C];if("$$$$"===I.substr(0,4))v=-1,++y,b=p.count,x.push(w),w={},_=!1;else if(3===v)S=parseInt(I.substr(0,3)),A=parseInt(I.substr(3,3)),P=(E=T=(M=4)+S)+A,o&&(c=0,s=new Float32Array(3*S),u.push(s),y>0&&(h=!0));else if(v>=M&&v<T){if(n&&y>0)continue;var R=parseFloat(I.substr(0,10)),L=parseFloat(I.substr(10,10)),O=parseFloat(I.substr(20,10));if(o){var D=3*c;if(s[D+0]=R,s[D+1]=L,s[D+2]=O,c+=1,h)continue}var N=I.substr(31,3).trim(),k=N+(g+1);p.growIfFull(),p.atomTypeId[g]=l.add(k,N),p.x[g]=R,p.y[g]=L,p.z[g]=O,p.serial[g]=g,i.addAtom(y,"","","HET",1,1),g+=1}else if(v>=E&&v<P){if(n&&y>0)continue;if(o&&y>0)continue;f.index=parseInt(I.substr(0,3))-1+b,m.index=parseInt(I.substr(3,3))-1+b;var F=parseInt(I.substr(6,3));r.bondStore.addBond(f,m,F)}else(d=I.match(Ew))?(_=d[1],w[_]=[]):!1!==_&&I&&w[_].push(I);++v}}t.Debug&&Uf.time("SdfParser._parse "+this.name);var r=this.structure,i=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=this.streamer.peekLines(2);r.id=a[0].trim(),r.title=a[1].trim();var s,c,u=r.frames,h=!1,l=r.atomMap,p=r.atomStore;p.resize(Math.round(this.streamer.data.length/50));var d,f=r.getAtomProxy(),m=r.getAtomProxy(),g=0,v=0,y=0,b=0,x=[],_=!1,w={};r.extraData.sdf=x;var S,A,M,T,E,P;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),i.finalize(),r.finalizeAtoms(),r.finalizeBonds(),Ss(r),t.Debug&&Uf.timeEnd("SdfParser._parse "+this.name)},r.prototype._postProcess=function(){Ss(this.structure)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("sdf",Pw),Xf.add("sd",Pw);var Cw=18.2223,Iw=1,Rw=2,Lw=3,Ow=4,Dw=5,Nw=6,kw=7,Fw=8,Bw=9,zw=10,Uw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"prmtop"},r.prototype._parse=function(){function e(t,e,r){for(var i=t;i<e;++i){var n=r[i],x=n.trim();if(x)if(n.startsWith("%FORMAT"));else if(n.startsWith("%FLAG")){var _=n.substr(5).trim();y=0,"TITLE"===_?v=Iw:"POINTERS"===_?v=Rw:"ATOM_NAME"===_?v=Lw:"CHARGE"===_?v=Ow:"MASS"===_?v=Dw:"RESIDUE_LABEL"===_?v=Nw:"RESIDUE_POINTER"===_?v=kw:"BONDS_INC_HYDROGEN"===_?(b=0,v=Fw):"BONDS_WITHOUT_HYDROGEN"===_?(b=s.NBONH,v=Bw):v="RADII"===_?zw:void 0}else if(v===Iw)a.push(x);else if(v===Rw){for(var w=Math.min(y+10,32),S=0;y<w;++S,++y)s[c[y]]=parseInt(n.substr(8*S,8).trim());u=new Array(s.NATOM),h=new Float32Array(s.NATOM),l=new Float32Array(s.NATOM),o.resize(s.NATOM);var A=s.NBONH+s.MBONA;p=new Uint32Array(A),d=new Uint32Array(A),f=new Uint8Array(A),m=new Array(s.NRES),g=new Uint32Array(s.NRES)}else if(v===Lw)for(var M=Math.min(y+20,s.NATOM),T=0;y<M;++T,++y)u[y]=n.substr(4*T,4).trim();else if(v===Ow)for(var E=Math.min(y+5,s.NATOM),P=0;y<E;++P,++y)h[y]=parseFloat(n.substr(16*P,16))/Cw;else if(v===Dw);else if(v===Nw)for(var C=Math.min(y+20,s.NRES),I=0;y<C;++I,++y)m[y]=n.substr(4*I,4).trim();else if(v===kw)for(var R=Math.min(y+10,s.NRES),L=0;y<R;++L,++y)g[y]=zc(n,8*L,8);else if(v===Fw)for(var O=Math.min(y+10,3*s.NBONH),D=0;y<O;++D,++y){var N=y%3;0===N&&(p[b]=zc(n,8*D,8)/3),1===N&&(d[b]=zc(n,8*D,8)/3,f[b]=1,++b)}else if(v===Bw)for(var k=Math.min(y+10,3*s.MBONA),F=0;y<k;++F,++y){var B=y%3;0===B&&(p[b]=zc(n,8*F,8)/3),1===B&&(d[b]=zc(n,8*F,8)/3,f[b]=1,++b)}else if(v===zw)for(var z=Math.min(y+5,s.NATOM),U=0;y<z;++U,++y)l[y]=parseFloat(n.substr(16*U,16))}}t.Debug&&Uf.time("PrmtopParser._parse "+this.name);var r=this.structure,i=this.structureBuilder,n=r.atomMap,o=r.atomStore;o.addField("partialCharge",1,"float32"),o.addField("radius",1,"float32");var a=[],s={},c=["NATOM","NTYPES","NBONH","MBONA","NTHETH","MTHETA","NPHIH","MPHIA","NHPARM","NPARM","NNB","NRES","NBONA","NTHETA","NPHIA","NUMBND","NUMANG","NPTRA","NATYP","NPHB","IFPERT","NBPER","NGPER","NDPER","MBPER","MGPER","MDPER","IFBOX","NMXRS","IFCAP","NUMEXTRA","NCOPY"];c.forEach(function(t){s[t]=0});var u,h,l,p,d,f,m,g,v,y,b;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.title=a.join(" ");for(var x=s.NATOM,_=0,w=m[0],S=1,A=0;A<x;++A)A+1===g[_+1]&&(w=m[++_],S=_+1),o.atomTypeId[A]=n.add(u[A]),o.serial[A]=A+1,i.addAtom(0,"","",w,S);o.partialCharge.set(h),o.radius.set(l),r.bondStore.length=f.length,r.bondStore.count=f.length,r.bondStore.atomIndex1=p,r.bondStore.atomIndex2=d,r.bondStore.bondOrder=f,i.finalize(),r.finalizeAtoms(),r.finalizeBonds(),bs(r,!0),xs(r,!0,!0),ms(r,!0),Ss(r),t.Debug&&Uf.timeEnd("PrmtopParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("prmtop",Uw),Xf.add("parm7",Uw);var jw=1,Gw=2,Vw=3,$w=4,Hw=5,Ww=6,Xw=/\s+/,qw=/(^\*|REMARK)*/,Yw=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"psf"},r.prototype._parse=function(){function e(t,e,r){for(var g=t;g<e;++g){var v=r[g].trim();if(v)if(a===Gw){var y=v.split(Xw),b=parseInt(y[0]),x=y[1],_=parseInt(y[2]),w=y[3],S=y[4],A=parseFloat(y[6]);x!==c&&(s=fs(f),++f),o.growIfFull(),o.atomTypeId[d]=n.add(S),o.serial[d]=b,o.partialCharge[d]=A,i.addAtom(0,s,s,w,_),d+=1,c=x}else if(a===Vw)for(var M=v.split(Xw),T=0,E=M.length;T<E;T+=2)u[m]=parseInt(M[T])-1,h[m]=parseInt(M[T+1])-1,l[m]=1,m+=1;else if(a===jw)p.push(v.replace(qw,"").trim());else if(a===$w);else if(a===Hw);else if(a===Ww);else if(v.includes("!NATOM")){a=Gw;var P=parseInt(v.split(Xw)[0]);o.resize(P)}else if(v.includes("!NBOND")){a=Vw;var C=parseInt(v.split(Xw)[0]);u=new Uint32Array(C),h=new Uint32Array(C),l=new Uint8Array(C)}else v.includes("!NTITLE")?a=jw:v.includes("!NTHETA")?a=$w:v.includes("!NPHI")?a=Hw:v.includes("!NIMPHI")&&(a=Ww);else a=void 0}}t.Debug&&Uf.time("PsfParser._parse "+this.name);var r=this.structure,i=this.structureBuilder,n=r.atomMap,o=r.atomStore;o.addField("partialCharge",1,"float32");var a,s,c,u,h,l,p=[],d=0,f=0,m=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.title=p.join(" "),r.bondStore.length=l.length,r.bondStore.count=m,r.bondStore.atomIndex1=u,r.bondStore.atomIndex2=h,r.bondStore.bondOrder=l,i.finalize(),r.finalizeAtoms(),r.finalizeBonds(),bs(r,!0),xs(r,!0,!0),Ss(r),t.Debug&&Uf.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("psf",Yw);var Zw=1,Kw=2,Qw=3,Jw=4,tS=5,eS=/\[ (.+) \]/,rS=/\s+/,iS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"top"},r.prototype._parse=function(){function e(t,e,i){for(var n=t;n<e;++n){var o=i[n],a=o.trim();if(a&&"*"!==a[0]&&";"!==a[0]){if(a.startsWith("#include"))throw new Error("TopParser: #include statements not allowed");var l=o.match(eS);if(null===l){var p=a.indexOf(";");if(-1!==p&&(a=a.substring(0,p).trim()),c===Qw){var d=a.split(rS)[0];h[d]=s}else if(c===Jw){var f=a.split(rS);s.atoms.push([parseInt(f[2]),f[3],f[4],parseFloat(f[6])])}else if(c===tS){var m=a.split(rS);s.bonds.push([parseInt(m[0]),parseInt(m[1])])}else if(c===Zw)r.title=a;else if(c===Kw){var g=a.split(rS);u.push([g[0],parseInt(g[1])])}}else{var v=l[1];"moleculetype"===v?(c=Qw,s={atoms:[],bonds:[]}):c="atoms"===v?Jw:"bonds"===v?tS:"system"===v?Zw:"molecules"===v?Kw:void 0}}}}t.Debug&&Uf.time("TopParser._parse "+this.name);var r=this.structure,i=this.structureBuilder,n=r.atomMap,o=r.bondStore,a=r.atomStore;a.addField("partialCharge",1,"float32");var s,c,u=[],h={};this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)});var l=0,p=0;u.forEach(function(t){var e=t[0],r=t[1],i=h[e];l+=r*i.atoms.length,p+=r*i.bonds.length}),a.resize(l),o.resize(p);var d,f=0,m=0,g=0,v=0,y=0,b=0;u.forEach(function(t){for(var e=t[0],r=t[1],s=h[e],c=fs(v),u=0;u<r;++u)!function(t){d=-1;var r=Gv.includes(e)?c:fs(g);s.atoms.forEach(function(t){var e=t[0],o=t[1],s=t[2],u=t[3];e!==d&&++m,a.atomTypeId[f]=n.add(s),a.serial[f]=f+1,a.partialCharge[f]=u,i.addAtom(0,c,r,o,m+1),++f,d=e}),s.bonds.forEach(function(t){o.atomIndex1[y]=b+t[0]-1,o.atomIndex2[y]=b+t[1]-1,++y}),++g,b+=s.atoms.length}();++v}),o.count=p,i.finalize(),r.finalizeAtoms(),r.finalizeBonds(),bs(r,!0),xs(r,!0,!0),Ss(r),t.Debug&&Uf.timeEnd("TopParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(nw);Xf.add("top",iS);var nS=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[],this.times=[],this.timeOffset=0,this.deltaTime=1},oS={type:{}};oS.type.get=function(){return"Frames"},Object.defineProperties(nS.prototype,oS);var aS=function(t){function e(e,r){t.call(this,e,r),this.frames=new nS(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"trajectory"},r.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,r),e}(rw),sS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"dcd"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("DcdParser._parse "+this.name);var e=Nn(this.streamer.data),r=new DataView(e),i=this.frames,n=i.coordinates,o=i.boxes,a={},s=0,c=new Int32Array(e,0,23),u=c[0]!==r.getInt32(0);if(84!==c[0])for(var h=e.byteLength,l=0;l<h;l+=4)r.setFloat32(l,r.getFloat32(l),!0);84!==c[0]&&Uf.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&Uf.error("dcd bad format, format string");var p=!1,d=!1,f=!1;0!==c[22]&&(p=!0,0!==c[12]&&(d=!0),1===c[13]&&(f=!0)),a.NSET=c[2],a.ISTART=c[3],a.NSAVC=c[4],a.NAMNF=c[10],a.DELTA=p?r.getFloat32(44,u):r.getFloat64(44,u),84!==c[22]&&Uf.error("dcd bad format, header block end"),s=s+84+8;var m=r.getInt32(s,u),g=s+1;if((m-4)%80!=0&&Uf.error("dcd bad format, title block start"),a.TITLE=In(new Uint8Array(e,g,m)),r.getInt32(g+m+4-1,u)!==m&&Uf.error("dcd bad format, title block end"),s=s+m+8,4!==r.getInt32(s,u)&&Uf.error("dcd bad format, natom block start"),a.NATOM=r.getInt32(s+4,u),4!==r.getInt32(s+8,u)&&Uf.error("dcd bad format, natom block end"),s=s+4+8,a.NAMNF>0)Uf.error("dcd format with fixed atoms unsupported, aborting");else{for(var v=a.NATOM,y=4*v,b=0,x=a.NSET;b<x;++b){if(d){s+=4;var _=new Float32Array(9);_[0]=r.getFloat64(s,u),_[4]=r.getFloat64(s+16,u),_[8]=r.getFloat64(s+40,u),o.push(_),s+=48,s+=4}for(var w=new Float32Array(3*v),S=0;S<3;++S){r.getInt32(s,u)!==y&&Uf.error("dcd bad format, coord block start",b,S),s+=4;for(var A=new Float32Array(e,s,v),M=0;M<v;++M)w[3*M+S]=A[M];s+=y,r.getInt32(s,u)!==y&&Uf.error("dcd bad format, coord block end",b,S),s+=4}n.push(w),f&&(s+=4+r.getInt32(s,u)+4)}a.DELTA&&(i.deltaTime=20.45482949774598*a.DELTA),a.ISTART>=1&&(i.timeOffset=(a.ISTART-1)*i.deltaTime),t.Debug&&Uf.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(r.prototype,i),r}(aS);Xf.add("dcd",sS);var cS={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6},uS=0,hS=10,lS=11,pS=12,dS=function(t){var e=new mm(t);e.setBigEndian(),Uc("CDF"!==e.readChars(3),"should start with CDF");var r=e.readByte();Uc(r>2,"unknown version"),this.header=Kc(e,r),this.buffer=e},fS={version:{},recordDimension:{},dimensions:{},globalAttributes:{},variables:{}};fS.version.get=function(){return 1===this.header.version?"classic format":"64-bit offset format"},fS.recordDimension.get=function(){return this.header.recordDimension},fS.dimensions.get=function(){return this.header.dimensions},fS.globalAttributes.get=function(){return this.header.globalAttributes},fS.variables.get=function(){return this.header.variables},dS.prototype.hasDataVariable=function(t){return-1!==this.header.variables.findIndex(function(e){return e.name===t})},dS.prototype.getDataVariable=function(t){var e;return e="string"==typeof t?this.header.variables.find(function(e){return e.name===t}):t,Uc(void 0===e,"variable not found"),this.buffer.seek(e.offset),e.record?Zc(this.buffer,e,this.header.recordDimension):Yc(this.buffer,e)},Object.defineProperties(dS.prototype,fS);var mS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"nctraj"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("NctrajParser._parse "+this.name);var e=new dS(this.streamer.data),r=this.frames,i=r.coordinates,n=r.boxes,o=r.times;e.getDataVariable("coordinates").forEach(function(t){i.push(new Float32Array(t))}),e.hasDataVariable("cell_lengths")&&e.getDataVariable("cell_lengths").forEach(function(t){n.push(new Float32Array(t))}),e.hasDataVariable("time")&&e.getDataVariable("time").forEach(function(t){o.push(t)}),o.length>=1&&(r.timeOffset=o[0]),o.length>=2&&(r.deltaTime=o[1]-o[0]),t.Debug&&Uf.timeEnd("NctrajParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(aS);Xf.add("nctraj",mS),Xf.add("ncdf",mS),Xf.add("nc",mS);var gS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"trr"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("TrrParser._parse "+this.name);for(var e=Nn(this.streamer.data),r=new DataView(e),i=this.frames,n=i.coordinates,o=i.boxes,a=i.times,s=0;;){s+=8;var c=r.getInt32(s);s+=4,s+=c;var u=r.getInt32(s+8),h=r.getInt32(s+12),l=r.getInt32(s+16),p=r.getInt32(s+28),d=r.getInt32(s+32),f=r.getInt32(s+36),m=r.getInt32(s+40);s+=52;var g=u/9,v=3*m;if(8===g?a.push(r.getFloat64(s)):a.push(r.getFloat32(s)),s+=2*g,u){var y=new Float32Array(9);if(8===g)for(var b=0;b<9;++b)y[b]=10*r.getFloat64(s),s+=8;else for(var x=0;x<9;++x)y[x]=10*r.getFloat32(s),s+=4;o.push(y)}if(s+=h,s+=l,p){var _=void 0;if(8===g){_=new Float32Array(v);for(var w=0;w<v;++w)_[w]=10*r.getFloat64(s),s+=8}else{for(var S=new Uint32Array(e,s,v),A=0;A<v;++A){var M=S[A];S[A]=(255&M)<<24|(65280&M)<<8|M>>8&65280|M>>24&255}_=new Float32Array(e,s,v);for(var T=0;T<v;++T)_[T]*=10,s+=4}n.push(_)}if(s+=d,(s+=f)>=e.byteLength)break}a.length>=1&&(i.timeOffset=a[0]),a.length>=2&&(i.deltaTime=a[1]-a[0]),t.Debug&&Uf.timeEnd("TrrParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(aS);Xf.add("trr",gS);var vS=new Uint32Array([0,0,0,0,0,0,0,0,0,8,10,12,16,20,25,32,40,50,64,80,101,128,161,203,256,322,406,512,645,812,1024,1290,1625,2048,2580,3250,4096,5060,6501,8192,10321,13003,16384,20642,26007,32768,41285,52015,65536,82570,104031,131072,165140,208063,262144,330280,416127,524287,660561,832255,1048576,1321122,1664510,2097152,2642245,3329021,4194304,5284491,6658042,8388607,10568983,13316085,16777216]),yS=new Uint8Array(32),bS=new Int32Array(32),xS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"xtc"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("XtcParser._parse "+this.name);for(var e=Nn(this.streamer.data),r=new DataView(e),i=this.frames,n=i.coordinates,o=i.boxes,a=i.times,s=new Int32Array(6),c=new Int32Array(3),u=new Int32Array(3),h=new Uint32Array(3),l=new Float32Array(3),p=new Float32Array(3),d=0,f=new Int32Array(3),m=new Uint32Array(f.buffer);;){var g=void 0,v=r.getInt32(d+4);d+=12;var y=3*v;a.push(r.getFloat32(d)),d+=4;for(var b=new Float32Array(9),x=0;x<9;++x)b[x]=10*r.getFloat32(d),d+=4;if(o.push(b),v<=9)for(var _=0;_<v;++_)g[_]=r.getFloat32(d),d+=4;else{f[0]=f[1]=f[2]=0,c[0]=c[1]=c[2]=0,h[0]=h[1]=h[2]=0,u[0]=u[1]=u[2]=0,l[0]=l[1]=l[2]=0,p[0]=p[1]=p[2]=0,g=new Float32Array(y);var w=0,S=r.getInt32(d);d+=4;var A=r.getFloat32(d);d+=4,s[0]=r.getInt32(d),s[1]=r.getInt32(d+4),s[2]=r.getInt32(d+8),s[3]=r.getInt32(d+12),s[4]=r.getInt32(d+16),s[5]=r.getInt32(d+20),c[0]=s[3]-s[0]+1,c[1]=s[4]-s[1]+1,c[2]=s[5]-s[2]+1,d+=24;var M=void 0;(c[0]|c[1]|c[2])>16777215?(u[0]=eu(c[0]),u[1]=eu(c[1]),u[2]=eu(c[2]),M=0):M=ru(3,c);var T=r.getInt32(d);d+=4;var E=T-1,P=vS[E=9>E?9:E]/2|0,C=vS[T]/2|0;h[0]=h[1]=h[2]=vS[T];var I=4*Math.ceil(r.getInt32(d)/4);d+=4;var R=1/A,L=0,O=0,D=new Uint8Array(e,d);for(l[0]=l[1]=l[2]=0;O<S;){0===M?(l[0]=iu(f,D,u[0],m),l[1]=iu(f,D,u[1],m),l[2]=iu(f,D,u[2],m)):nu(f,D,3,M,c,l,m),O++,l[0]+=s[0],l[1]+=s[1],l[2]+=s[2],p[0]=l[0],p[1]=l[1],p[2]=l[2];var N=0;if(1===iu(f,D,1,m)&&(L=iu(f,D,5,m),L-=N=L%3,N--),L>0){l[0]=l[1]=l[2]=0;for(var k=0;k<L;k+=3){if(nu(f,D,3,T,h,l,m),O++,l[0]+=p[0]-C,l[1]+=p[1]-C,l[2]+=p[2]-C,0===k){var F=l[0];l[0]=p[0],p[0]=F,F=l[1],l[1]=p[1],p[1]=F,F=l[2],l[2]=p[2],p[2]=F,g[w++]=p[0]*R,g[w++]=p[1]*R,g[w++]=p[2]*R}else p[0]=l[0],p[1]=l[1],p[2]=l[2];g[w++]=l[0]*R,g[w++]=l[1]*R,g[w++]=l[2]*R}}else g[w++]=l[0]*R,g[w++]=l[1]*R,g[w++]=l[2]*R;if(T+=N,N<0?(C=P,P=T>9?vS[T-1]/2|0:0):N>0&&(P=C,C=vS[T]/2|0),h[0]=h[1]=h[2]=vS[T],0===h[0]||0===h[1]||0===h[2])return void console.error("(xdrfile error) Undefined error.")}d+=I}for(var B=0;B<y;B++)g[B]*=10;if(n.push(g),d>=e.byteLength)break}a.length>=1&&(i.timeOffset=a[0]),a.length>=2&&(i.deltaTime=a[1]-a[0]),t.Debug&&Uf.timeEnd("XtcParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(aS);Xf.add("xtc",xS);var _S=function(t){function e(e,r){var i=r||{};t.call(this,e,i),this.volume=new ey(this.name,this.path),this.voxelSize=gn(i.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"volume"},r.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix()),t.prototype._afterParse.call(this)},e.prototype.getMatrix=function(){return new v},Object.defineProperties(e.prototype,r),e}(rw),wS=/\s+/,SS=/-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/g,AS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"cube"},r.prototype._parse=function(){function e(t,e){var r=n[t].trim().split(wS)[e];return parseFloat(r)}function r(t,e,r){for(var i=t;i<e;++i){var n=r[i].trim();if(""!==n&&u>=o.atomCount+6+h)for(var a=n.match(SS),l=0,p=a.length;l<p;++l)s[c]=parseFloat(a[l]),++c;++u}}t.Debug&&Uf.time("CubeParser._parse "+this.name);var i=this.volume,n=this.streamer.peekLines(6),o={},a=.529177210859*this.voxelSize;o.atomCount=Math.abs(e(2,0)),o.originX=.529177210859*e(2,1),o.originY=.529177210859*e(2,2),o.originZ=.529177210859*e(2,3),o.NVX=e(3,0),o.NVY=e(4,0),o.NVZ=e(5,0),o.basisX=new g(e(3,1),e(3,2),e(3,3)).multiplyScalar(a),o.basisY=new g(e(4,1),e(4,2),e(4,3)).multiplyScalar(a),o.basisZ=new g(e(5,1),e(5,2),e(5,3)).multiplyScalar(a);var s=new Float32Array(o.NVX*o.NVY*o.NVZ),c=0,u=0,h=e(2,0)>0?0:1;this.streamer.eachChunkOfLines(function(t){r(0,t.length,t)}),i.header=o,i.setData(s,o.NVZ,o.NVY,o.NVX),t.Debug&&Uf.timeEnd("CubeParser._parse "+this.name)},r.prototype.getMatrix=function(){var t=this.volume.header,e=new v;return e.multiply((new v).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new v).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(r.prototype,i),r}(_S);Xf.add("cub",AS),Xf.add("cube",AS);var MS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"dsn6"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("Dsn6Parser._parse "+this.name);var e,r,i=this.volume,n={},o=Nn(this.streamer.data),a=new Int16Array(o),s=new Uint8Array(o),c=String.fromCharCode.apply(null,s.subarray(0,512));if(c.startsWith(":-)"))n.xStart=parseInt(c.substr(10,5)),n.yStart=parseInt(c.substr(15,5)),n.zStart=parseInt(c.substr(20,5)),n.xExtent=parseInt(c.substr(32,5)),n.yExtent=parseInt(c.substr(38,5)),n.zExtent=parseInt(c.substr(42,5)),n.xRate=parseInt(c.substr(52,5)),n.yRate=parseInt(c.substr(58,5)),n.zRate=parseInt(c.substr(62,5)),n.xlen=parseFloat(c.substr(73,10))*this.voxelSize,n.ylen=parseFloat(c.substr(83,10))*this.voxelSize,n.zlen=parseFloat(c.substr(93,10))*this.voxelSize,n.alpha=parseFloat(c.substr(103,10)),n.beta=parseFloat(c.substr(113,10)),n.gamma=parseFloat(c.substr(123,10)),e=parseFloat(c.substr(138,12))/100,r=parseInt(c.substr(155,8)),n.sigma=100*parseFloat(c.substr(170,12));else{if(100!==a[18])for(var u=0,h=a.length;u<h;++u){var l=a[u];a[u]=(255&l)<<8|l>>8&255}n.xStart=a[0],n.yStart=a[1],n.zStart=a[2],n.xExtent=a[3],n.yExtent=a[4],n.zExtent=a[5],n.xRate=a[6],n.yRate=a[7],n.zRate=a[8];var p=1/a[17],d=p*this.voxelSize;n.xlen=a[9]*d,n.ylen=a[10]*d,n.zlen=a[11]*d,n.alpha=a[12]*p,n.beta=a[13]*p,n.gamma=a[14]*p,e=a[15]/100,r=a[16],n.gamma=a[14]*p}i.header=n,t.Debug&&Uf.log(n,e,r);for(var f=new Float32Array(n.xExtent*n.yExtent*n.zExtent),m=512,g=Math.ceil(n.xExtent/8),v=Math.ceil(n.yExtent/8),y=Math.ceil(n.zExtent/8),b=0;b<y;++b)for(var x=0;x<v;++x)for(var _=0;_<g;++_)for(var w=0;w<8;++w)for(var S=8*b+w,A=0;A<8;++A)for(var M=8*x+A,T=0;T<8;++T){var E=8*_+T;if(!(E<n.xExtent&&M<n.yExtent&&S<n.zExtent)){m+=8-T;break}f[(E*n.yExtent+M)*n.zExtent+S]=(s[m]-r)/e,++m}i.setData(f,n.zExtent,n.yExtent,n.xExtent),n.sigma&&i.setStats(void 0,void 0,void 0,n.sigma),t.Debug&&Uf.timeEnd("Dsn6Parser._parse "+this.name)},r.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],r=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],i=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];i[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-i[1]*i[1]);var n=[0,e,r,i],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new v;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new v).makeRotationY($n(90))),s.multiply((new v).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new v).makeScale(-1,1,1)),s},Object.defineProperties(r.prototype,i),r}(_S);Xf.add("dsn6",MS),Xf.add("brix",MS);var TS=/\s+/,ES=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"dx"},r.prototype._parse=function(){function e(t,e,r){for(var i=t;i<e;++i){if(u<s&&h>a){var n=r[i].trim();if(""!==n)for(var o=n.split(TS),l=0,p=o.length;l<p;++l)c[u]=parseFloat(o[l]),++u}++h}}t.Debug&&Uf.time("DxParser._parse "+this.name);var r=this.volume,i=this.streamer.peekLines(30),n=this.parseHeaderLines(i),o=this.volume.header,a=n.dataLineStart,s=o.nx*o.ny*o.nz,c=new Float32Array(s),u=0,h=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.setData(c,o.nz,o.ny,o.nx),t.Debug&&Uf.timeEnd("DxParser._parse "+this.name)},r.prototype.parseHeaderLines=function(t){for(var e=this,r={},i=t.length,n=0,o=0,a=0,s=0;s<i;++s){var c=void 0,u=t[s];if(u.startsWith("object 1"))c=u.split(TS),r.nx=parseInt(c[5]),r.ny=parseInt(c[6]),r.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(TS),r.xmin=parseFloat(c[1]),r.ymin=parseFloat(c[2]),r.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(TS),0===a?r.hx=parseFloat(c[1])*e.voxelSize:1===a?r.hy=parseFloat(c[2])*e.voxelSize:2===a&&(r.hz=parseFloat(c[3])*e.voxelSize),a+=1;else if(u.startsWith("object 3")){n=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=r,{dataLineStart:n,headerByteCount:o}},r.prototype.getMatrix=function(){var t=this.volume.header,e=new v;return e.multiply((new v).makeRotationY($n(90))),e.multiply((new v).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new v).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(r.prototype,i),r}(_S);Xf.add("dx",ES);var PS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"dxbin"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("DxbinParser._parse "+this.name);for(var e=Nn(this.streamer.data),r=Rn(new Uint8Array(e,0,1e3)),i=this.parseHeaderLines(r),n=this.volume.header,o=i.headerByteCount,a=n.nx*n.ny*n.nz,s=new DataView(e),c=new Float32Array(a),u=0;u<a;++u)c[u]=s.getFloat64(8*u+o,!0);this.volume.setData(c,n.nz,n.ny,n.nx),t.Debug&&Uf.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(ES);Xf.add("dxbin",PS);var CS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},isBinary:{}};return i.type.get=function(){return"mrc"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("MrcParser._parse "+this.name);var e=this.volume,r={},i=Nn(this.streamer.data),n=new Int32Array(i,0,56),o=new Float32Array(i,0,56),a=new DataView(i);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=i.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);r.NX=n[0],r.NY=n[1],r.NZ=n[2],r.MODE=n[3],r.NXSTART=n[4],r.NYSTART=n[5],r.NZSTART=n[6],r.MX=n[7],r.MY=n[8],r.MZ=n[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=n[16],r.MAPR=n[17],r.MAPS=n[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=n[22],r.NSYMBT=n[23],r.LSKFLG=n[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],e.header=r;var u;if(2===r.MODE)u=new Float32Array(i,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(u=new Float32Array(new Int8Array(i,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===n[39]&&127===n[40])for(var h=(r.DMAX-r.DMIN)/255,l=.5*(r.DMIN+r.DMAX+h),p=0,d=u.length;p<d;++p)u[p]=h*u[p]+l}else Uf.error("MrcParser unknown mode",r.MODE);e.setData(u,r.NX,r.NY,r.NZ),0!==r.ARMS&&e.setStats(r.DMIN,r.DMAX,r.DMEAN,r.ARMS),t.Debug&&Uf.timeEnd("MrcParser._parse "+this.name)},r.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],r=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],i=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];i[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-i[1]*i[1]);var n=[0,e,r,i],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new v;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new g(t.originX,t.originY,t.originZ)),s.multiply((new v).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(r.prototype,i),r}(_S);Xf.add("mrc",CS),Xf.add("ccp4",CS),Xf.add("map",CS);var IS=/\s+/,RS=function(e){function r(){e.apply(this,arguments)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{}};return i.type.get=function(){return"xplor"},r.prototype._parse=function(){function e(t,e,r){for(var i=t;i<e;++i){var n=r[i];if(g>=a&&(g-a)%f!=0&&m<p)for(var s=0;s<6;++s)d[m]=parseFloat(n.substr(12*s,12)),++m;else if(m===p){var c=n.trim();if(c&&"-9999"!==c){var u=ou(n);o.RAVE=u[0],o.RSIGMA=u[1]}}++g}}t.Debug&&Uf.time("XplorParser._parse "+this.name);var r,i=this.volume,n=this.streamer.peekLines(8),o={},a=(r=n[2].startsWith("REMARKS")?parseInt(n[1].substring(0,8))+2:5)+3,s=ou(n[r]);o.NA=s[0],o.AMIN=s[1],o.AMAX=s[2],o.NB=s[3],o.BMIN=s[4],o.BMAX=s[5],o.NC=s[6],o.CMIN=s[7],o.CMAX=s[8];var c=ou(n[r+1]);o.a=c[0]*this.voxelSize,o.b=c[1]*this.voxelSize,o.c=c[2]*this.voxelSize,o.alpha=c[3],o.beta=c[4],o.gamma=c[5];var u=o.AMAX-o.AMIN+1,h=o.BMAX-o.BMIN+1,l=o.CMAX-o.CMIN+1,p=u*h*l,d=new Float32Array(p),f=1+u*h/6,m=0,g=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),i.header=o,i.setData(d,u,h,l),0!==o.RAVE&&1!==o.RSIGMA&&i.setStats(void 0,void 0,o.RAVE,o.RSIGMA),t.Debug&&Uf.timeEnd("XplorParser._parse "+this.name)},r.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],r=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],i=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];i[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-i[1]*i[1]);var n=[0,e,r,i],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new v;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new v).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(r.prototype,i),r}(_S);Xf.add("xplor",RS),Xf.add("cns",RS);var LS=function(t){function e(e,r){t.call(this,e,r),this.loader=this.getLoader(),this.surface=new Jv(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"surface"},r.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,r),e}(rw);au.prototype={constructor:au,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var r=parseInt(t,10);return 3*(r>=0?r-1:r+e/3)},parseNormalIndex:function(t,e){var r=parseInt(t,10);return 3*(r>=0?r-1:r+e/3)},addVertex:function(t,e,r){var i=this.vertices,n=this.object.geometry.vertices;n.push(i[t+0]),n.push(i[t+1]),n.push(i[t+2]),n.push(i[e+0]),n.push(i[e+1]),n.push(i[e+2]),n.push(i[r+0]),n.push(i[r+1]),n.push(i[r+2])},addVertexLine:function(t){var e=this.vertices,r=this.object.geometry.vertices;r.push(e[t+0]),r.push(e[t+1]),r.push(e[t+2])},addNormal:function(t,e,r){var i=this.normals,n=this.object.geometry.normals;n.push(i[t+0]),n.push(i[t+1]),n.push(i[t+2]),n.push(i[e+0]),n.push(i[e+1]),n.push(i[e+2]),n.push(i[r+0]),n.push(i[r+1]),n.push(i[r+2])},addFace:function(t,e,r,i,n,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),p=this.parseVertexIndex(r,u);if(void 0===i?this.addVertex(h,l,p):(c=this.parseVertexIndex(i,u),this.addVertex(h,l,c),this.addVertex(l,p,c)),void 0!==n){var d=this.normals.length;h=this.parseNormalIndex(n,d),l=n===o?h:this.parseNormalIndex(o,d),p=n===a?h:this.parseNormalIndex(a,d),void 0===i?this.addNormal(h,l,p):(c=this.parseNormalIndex(s,d),this.addNormal(h,l,c),this.addNormal(l,p,c))}},addLineGeometry:function(t){var e=this;this.object.geometry.type="Line";for(var r=this.vertices.length,i=0,n=t.length;i<n;i++)e.addVertexLine(e.parseVertexIndex(t[i],r))}};return t.startObject("",!1),t},parse:function(t){var e=this,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var i,n,o=t.split("\n"),a="",s="",c="",u=[],h="function"==typeof"".trimLeft;for(i=0,n=o.length;i<n;i++)if(a=o[i],a=h?a.trimLeft():a.trim(),0!==a.length&&"#"!==(s=a.charAt(0)))if("v"===s){if(" "===(c=a.charAt(1))&&null!==(u=e.regexp.vertex_pattern.exec(a)))r.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));else if("n"===c&&null!==(u=e.regexp.normal_pattern.exec(a)))r.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));else if("t"!==c||null===e.regexp.uv_pattern.exec(a))throw new Error("Unexpected vertex/normal/uv line: '"+a+"'")}else if("f"===s)if(null!==(u=e.regexp.face_vertex_uv_normal.exec(a)))r.addFace(u[1],u[4],u[7],u[10],u[3],u[6],u[9],u[12]);else if(null!==e.regexp.face_vertex_uv.exec(a));else if(null!==(u=e.regexp.face_vertex_normal.exec(a)))r.addFace(u[1],u[3],u[5],u[7],u[2],u[4],u[6],u[8]);else{if(null===(u=e.regexp.face_vertex.exec(a)))throw new Error("Unexpected face line: '"+a+"'");r.addFace(u[1],u[2],u[3],u[4])}else if("l"===s){var l=a.substring(1).trim().split(" "),p=[],d=[];if(-1===a.indexOf("/"))p=l;else for(var f=0,m=l.length;f<m;f++){var g=l[f].split("/");""!==g[0]&&p.push(g[0]),""!==g[1]&&d.push(g[1])}r.addLineGeometry(p,d)}else if(null!==(u=e.regexp.object_pattern.exec(a))){var v=u[0].substr(1).trim();r.startObject(v)}else if(e.regexp.material_use_pattern.test(a));else if(e.regexp.material_library_pattern.test(a));else if(null===e.regexp.smoothing_pattern.exec(a)){if("\0"===a)continue;throw new Error("Unexpected line: '"+a+"'")}var y=[];for(i=0,n=r.objects.length;i<n;i++){var b=r.objects[i].geometry;if(0!==b.vertices.length){var x=new Ct;x.addAttribute("position",new St(new Float32Array(b.vertices),3)),b.normals.length>0?x.addAttribute("normal",new St(new Float32Array(b.normals),3)):x.computeVertexNormals(),y.push(x)}}return y}};var OS=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new au},Object.defineProperties(e.prototype,r),e}(LS);Xf.add("obj",OS),su.prototype={constructor:su,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),r="",i=0;i<t.byteLength;i++)r+=String.fromCharCode(e[i]);return r},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e=this,r="",i=0,n=/ply([\s\S]*)end_header\s/.exec(t);null!==n&&(r=n[1],i=n[0].length);for(var o,a,s,c={comments:[],elements:[],headerLength:i},u=r.split("\n"),h=0;h<u.length;h++){var l=u[h];if(""!==(l=l.trim()))switch(s=l.split(/\s+/),a=s.shift(),l=s.join(" "),a){case"format":c.format=s[0],c.version=s[1];break;case"comment":c.comments.push(l);break;case"element":void 0!==o&&c.elements.push(o),(o={}).name=s[0],o.count=parseInt(s[1]),o.properties=[];break;case"property":o.properties.push(function(t,e){var r={type:t[0]};return"list"===r.type?(r.name=t[3],r.countType=t[1],r.itemType=t[2]):r.name=t[1],r.name in e&&(r.name=e[r.name]),r}(s,e.propertyNameMapping));break;default:console.log("unhandled",a,s)}}return void 0!==o&&c.elements.push(o),c},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var r=this,i=e.split(/\s+/),n={},o=0;o<t.length;o++)if("list"===t[o].type){for(var a=[],s=r.parseASCIINumber(i.shift(),t[o].countType),c=0;c<s;c++)a.push(r.parseASCIINumber(i.shift(),t[o].itemType));n[t[o].name]=a}else n[t[o].name]=r.parseASCIINumber(i.shift(),t[o].type);return n},parseASCII:function(t){var e,r=this,i=new wt,n=this.parseHeader(t),o="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(o=e[1]);var a=o.split("\n"),s=0,c=0;i.useColor=!1;for(var u=0;u<a.length;u++){var h=a[u];if(""!==(h=h.trim())){c>=n.elements[s].count&&(s++,c=0);var l=r.parseASCIIElement(n.elements[s].properties,h);r.handleElement(i,n.elements[s].name,l),c++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,r){if("vertex"===e){if(t.vertices.push(new g(r.x,r.y,r.z)),"red"in r&&"green"in r&&"blue"in r){t.useColor=!0;var i=new tt;i.setRGB(r.red/255,r.green/255,r.blue/255),t.colors.push(i)}}else if("face"===e){var n=r.vertex_indices;3===n.length?t.faces.push(new xt(n[0],n[1],n[2])):4===n.length&&t.faces.push(new xt(n[0],n[1],n[3]),new xt(n[1],n[2],n[3]))}},binaryRead:function(t,e,r,i){switch(r){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,i),2];case"uint16":case"ushort":return[t.getUint16(e,i),2];case"int32":case"int":return[t.getInt32(e,i),4];case"uint32":case"uint":return[t.getUint32(e,i),4];case"float32":case"float":return[t.getFloat32(e,i),4];case"float64":case"double":return[t.getFloat64(e,i),8]}},binaryReadElement:function(t,e,r,i){for(var n,o=this,a={},s=0,c=0;c<r.length;c++)if("list"===r[c].type){var u=[],h=(n=o.binaryRead(t,e+s,r[c].countType,i))[0];s+=n[1];for(var l=0;l<h;l++)n=o.binaryRead(t,e+s,r[c].itemType,i),u.push(n[0]),s+=n[1];a[r[c].name]=u}else n=o.binaryRead(t,e+s,r[c].type,i),a[r[c].name]=n[0],s+=n[1];return[a,s]},parseBinary:function(t){for(var e,r=this,i=new wt,n=this.parseHeader(this.bin2str(t)),o="binary_little_endian"===n.format,a=new DataView(t,n.headerLength),s=0,c=0;c<n.elements.length;c++)for(var u=0;u<n.elements[c].count;u++){s+=(e=r.binaryReadElement(a,s,n.elements[c].properties,o))[1];var h=e[0];r.handleElement(i,n.elements[c].name,h)}return this.postProcess(i)}};var DS=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{}};return r.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new su},Object.defineProperties(e.prototype,r),e}(LS);Xf.add("ply",DS);var NS=function(t){function e(e,r){var i=r||{};t.call(this,e,i),this.delimiter=gn(i.delimiter,","),this.comment=gn(i.comment,"#"),this.columnNames=gn(i.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"csv"},r.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,r=new RegExp("\\s*"+this.delimiter+"\\s*"),i=0;this.streamer.eachChunkOfLines(function(n){for(var o=n.length,a=0;a<o;++a){var s=n[a].trim();if(!s.startsWith(t.comment)){var c=s.split(r);0===i?t.table.columnNames=c:s&&e.push(c),++i}}})},Object.defineProperties(e.prototype,r),e}(rw);Xf.add("csv",NS);var kS=function(t){function e(e,r){var i=r||{};t.call(this,e,i),this.string=gn(i.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{},isJson:{}};return r.type.get=function(){return"json"},r.__objName.get=function(){return"json"},r.isJson.get=function(){return!0},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,r),e}(rw);Xf.add("json",kS);var FS=function(e){function r(t,r){var i=r||{};e.call(this,t,i),this.msgpack={name:this.name,path:this.path,data:void 0}}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},__objName:{},isBinary:{}};return i.type.get=function(){return"msgpack"},i.__objName.get=function(){return"msgpack"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("MsgpackParser._parse "+this.name),this.msgpack.data=kc(this.streamer.data),t.Debug&&Uf.timeEnd("MsgpackParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(rw);Xf.add("msgpack",FS);var BS=function(e){function r(t,r){var i=r||{};e.call(this,t,i),this.netcdf={name:this.name,path:this.path,data:void 0}}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},__objName:{},isBinary:{}};return i.type.get=function(){return"netcdf"},i.__objName.get=function(){return"netcdf"},i.isBinary.get=function(){return!0},r.prototype._parse=function(){t.Debug&&Uf.time("NetcdfParser._parse "+this.name),this.netcdf.data=new dS(this.streamer.data),t.Debug&&Uf.timeEnd("NetcdfParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(rw);Xf.add("netcdf",BS);var zS=function(t){function e(e,r){t.call(this,e,r),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={type:{},__objName:{}};return r.type.get=function(){return"text"},r.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,r),e}(rw);Xf.add("txt",zS),Xf.add("text",zS);var US=/^['"]|['"]$/g,jS=/^<([\w-:.]+)\s*/,GS=/^([^<]*)/,VS=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/,$S=function(e){function r(t,r){var i=r||{};e.call(this,t,i),this.useDomParser=gn(i.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={type:{},__objName:{},isXml:{}};return i.type.get=function(){return"xml"},i.__objName.get=function(){return"xml"},i.isXml.get=function(){return!0},r.prototype.__xmlParser=function(t){return uu(t)},r.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},r.prototype._parse=function(){t.Debug&&Uf.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),t.Debug&&Uf.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}(rw);Xf.add("xml",$S);var HS=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},WS={type:{}};WS.type.get=function(){return"validation"},HS.prototype.fromXml=function(e){t.Debug&&Uf.time("Validation.fromXml");var r=this.rsrzDict,i=this.rsccDict,n=this.clashDict,o=this.clashArray,a=this.geoDict,s=this.geoAtomDict,c=this.atomDict,u=e.getElementsByTagName("ModelledSubgroup"),h={},l=[];t.Debug&&Uf.time("Validation.fromXml#clashDict");for(var p=0,d=u.length;p<d;++p){var f=u[p],m=f.attributes,g=hu(m);void 0!==m.rsrz&&(r[g]=parseFloat(m.rsrz.value)),void 0!==m.rscc&&(i[g]=parseFloat(m.rscc.value)),m.sele=g;for(var v=f.getElementsByTagName("clash"),y=0,b=v.length;y<b;++y){var x=v[y].attributes,_=x.atom.value;if("H"!==ws(_)){var w=x.cid.value,S=hu(m,_,!0);if(c[S]=!0,void 0===h[w])h[w]={sele1:S,res1:g};else{var A=h[w];A.res1!==g&&(A.sele2=S,A.res2=g,l.push(A.res1,g),n[w]=A,o.push(A))}}}}t.Debug&&Uf.timeEnd("Validation.fromXml#clashDict");for(var M=0,T=u.length;M<T;++M){var E=u[M],P=E.attributes,C=P.sele;if("."!==P.seq.value){var I=fu(n,E,P);I>0&&(a[C]=I)}else{var R=E.getElementsByTagName("clash"),L=E.getElementsByTagName("mog-bond-outlier"),O=E.getElementsByTagName("mog-angle-outlier");if(L.length>0||O.length>0||R.length>0){var D={};s[C]=D;for(var N=0,k=R.length;N<k;++N){var F=R[N].attributes;n[F.cid.value]&&lu(D,F.atom.value,1)}for(var B=0,z=L.length;B<z;++B)L[B].attributes.atoms.value.split(",").forEach(function(t){lu(D,t,2)});for(var U=0,j=O.length;U<j;++U)O[U].attributes.atoms.value.split(",").forEach(function(t){lu(D,t,4)})}}}this.clashSele=l.length?l.join(" OR "):"NONE",t.Debug&&Uf.timeEnd("Validation.fromXml")},HS.prototype.getClashData=function(e){t.Debug&&Uf.time("Validation.getClashData");var r=e||{},i=r.structure,n=i.atomSet,o=new tt(gn(r.color,"#f0027f")),a=i.getAtomProxy(),s=i.getAtomProxy(),c=new g,u=new g,h=new g,l=this.clashArray,p=l.length,d=new Float32Array(3*p),f=new Float32Array(3*p),m=ko(p,o.r,o.g,o.b),v=new Float32Array(p),y=new Float32Array(p);t.Debug&&Uf.time("Validation.getClashData#atomDict");var b=this.atomDict;i.eachAtom(function(t){var e=du(t);!0===b[e]&&(b[e]=t.index)}),t.Debug&&Uf.timeEnd("Validation.getClashData#atomDict");var x=0;return l.forEach(function(t,e){if(a.index=b[t.sele1],s.index=b[t.sele2],void 0!==a.index&&void 0!==s.index&&n.isSet(a.index,s.index)){c.subVectors(s,a).setLength(a.vdw),u.copy(a).add(c),c.subVectors(a,s).setLength(s.vdw),h.copy(s).add(c);var r=a.distanceTo(s)/2,i=Math.sqrt(a.vdw*a.vdw-r*r),o=Math.sqrt(s.vdw*s.vdw-r*r);u.toArray(d,3*x),h.toArray(f,3*x),v[x]=(i+o)/2,y[x]=e,++x}}),t.Debug&&Uf.timeEnd("Validation.getClashData"),{position1:d.subarray(0,3*x),position2:f.subarray(0,3*x),color:m.subarray(0,3*x),color2:m.subarray(0,3*x),radius:v.subarray(0,x),picking:new iv(y.subarray(0,x),this,i)}},Object.defineProperties(HS.prototype,WS);var XS=function(e){function r(t,r){var i=r||{};e.call(this,t,i),this.useDomParser=!0,this.validation=new HS(this.name,this.path)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={__objName:{},isXml:{}};return i.__objName.get=function(){return"validation"},i.isXml.get=function(){return!0},r.prototype._parse=function(){e.prototype._parse.call(this),t.Debug&&Uf.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),t.Debug&&Uf.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(r.prototype,i),r}($S);Xf.add("validation",XS);var qS,YS,ZS=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}(),KS=30,QS=12,JS=15,tA=852,eA=592,rA=0,iA=1,nA=2,oA=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],aA=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],sA=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],cA=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],uA=0,hA=1,lA=2,pA=4,dA=5,fA=6,mA=0,gA=1,vA=2,yA=-2,bA=-3,xA=-4,_A=-5,wA=8,SA=1,AA=2,MA=3,TA=4,EA=5,PA=6,CA=7,IA=8,RA=9,LA=10,OA=11,DA=12,NA=13,kA=14,FA=15,BA=16,zA=17,UA=18,jA=19,GA=20,VA=21,$A=22,HA=23,WA=24,XA=25,qA=26,YA=27,ZA=28,KA=29,QA=30,JA=31,tM=32,eM=852,rM=592,iM=!0,nM=!0,oM=!0;try{String.fromCharCode.apply(null,[0])}catch(t){nM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){oM=!1}for(var aM=new Uint8Array(256),sM=0;sM<256;sM++)aM[sM]=sM>=252?6:sM>=248?5:sM>=240?4:sM>=224?3:sM>=192?2:1;aM[254]=aM[254]=1;var cM=0,uM={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},hM=Object.prototype.toString;Gu.prototype.push=function(t,e){var r,i,n,o,a,s,c=this,u=this.strm,h=this.options.chunkSize,l=this.options.dictionary,p=!1;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?u.input=Fu(t):"[object ArrayBuffer]"===hM.call(t)?u.input=new Uint8Array(t):u.input=t,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new Uint8Array(h),u.next_out=0,u.avail_out=h),2===(r=Ru(u,0))&&l&&(s="string"==typeof l?Nu(l):"[object ArrayBuffer]"===hM.call(l)?new Uint8Array(l):l,r=Du(c.strm,s)),-5===r&&!0===p&&(r=cM,p=!1),1!==r&&r!==cM)return c.onEnd(r),c.ended=!0,!1;u.next_out&&(0!==u.avail_out&&1!==r&&(0!==u.avail_in||4!==i&&2!==i)||("string"===c.options.to?(n=zu(u.output,u.next_out),o=u.next_out-n,a=Bu(u.output,n),u.next_out=o,u.avail_out=h-o,o&&vu(u.output,u.output,n,o,0),c.onData(a)):c.onData(gu(u.output,u.next_out)))),0===u.avail_in&&0===u.avail_out&&(p=!0)}while((u.avail_in>0||0===u.avail_out)&&1!==r);return 1===r&&(i=4),4===i?(r=Lu(this.strm),this.onEnd(r),this.ended=!0,r===cM):2!==i||(this.onEnd(cM),u.avail_out=0,!0)},Gu.prototype.onData=function(t){this.chunks.push(t)},Gu.prototype.onEnd=function(t){t===cM&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yu(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Yf.add("gz",$u);var lM=function(){};lM.prototype.getUrl=function(t){},lM.prototype.getExt=function(t){};var pM="//mmtf.rcsb.org/v1.0/full/",dM=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUrl=function(t){var e,r=wn(t),i=r.name.substr(0,4);return!["pdb","cif"].includes(r.ext)||!1!==r.compressed&&"gz"!==r.compressed?"mmtf"===r.ext?e=r.base.endsWith(".bb")?"//mmtf.rcsb.org/v1.0/reduced/"+i:pM+i:r.ext?(Uf.warn("unsupported ext",r.ext),e=pM+i):e=pM+i:e="//files.rcsb.org/download/"+r.path,yn()+e},e.prototype.getExt=function(t){var e=wn(t);if("mmtf"===e.ext||!e.ext)return"mmtf"},e}(lM);Hf.add("rcsb",new dM);var fM="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",mM=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUrl=function(t){var e,r=wn(t),i=r.name;return r.ext&&"sdf"!==r.ext?(Uf.warn("unsupported ext",r.ext),e=fM+i+"/SDF?record_type=3d"):e=fM+i+"/SDF?record_type=3d",yn()+e},e.prototype.getExt=function(t){var e=wn(t);if(!e.ext||"sdf"===e.ext)return"sdf"},e}(lM);Hf.add("pubchem",new mM);var gM=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUrl=function(t){return t},e}(lM);Hf.add("ftp",new gM),Hf.add("http",new gM),Hf.add("https",new gM);var vM=/^((http|https|ftp):)*\/\//,yM=function(t){function e(e){t.call(this),this.baseUrl=e||""}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUrl=function(t){var e=wn(t),r=this.baseUrl+e.path;return vM.test(this.baseUrl)||(r=xn(r)),r},e}(lM),bM=function(t){function e(e){t.call(this),this.baseUrl=e||""}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getListing=function(t){t=t||"";var e=this.baseUrl+"dir/"+t;return"/"!==e[e.length-1]&&(e+="/"),Mo(e,{ext:"json"}).then(function(e){return{path:t,data:e.data}})},e.prototype.getUrl=function(t){var e=wn(t);return this.baseUrl+"file/"+e.path},e.prototype.getCountUrl=function(t){var e=wn(t);return this.baseUrl+"traj/numframes/"+e.path},e.prototype.getFrameUrl=function(t,e){var r=wn(t);return this.baseUrl+"traj/frame/"+e+"/"+r.path},e.prototype.getFrameParams=function(t,e){return"atomIndices="+e.join(";")},e.prototype.getPathUrl=function(t,e){var r=wn(t);return this.baseUrl+"traj/path/"+e+"/"+r.path},e}(lM);"undefined"==typeof window||window.Promise||(window.Promise=i),t.Version="0.10.5-15",t.setDebug=So,t.ScriptExtensions=Gf,t.DatasourceRegistry=Hf,t.DecompressorRegistry=Yf,t.StaticDatasource=yM,t.MdsrvDatasource=bM,t.ParserRegistry=Xf,t.autoLoad=Mo,t.RepresentationRegistry=Wf,t.ColormakerRegistry=$f,t.Colormaker=lf,t.Selection=Pf,t.PdbWriter=dm,t.StlWriter=gm,t.Stage=Wb,t.Collection=Gb,t.ComponentCollection=Vb,t.RepresentationCollection=$b,t.Assembly=fy,t.TrajectoryPlayer=jy,t.superpose=Gs,t.guessElement=ws,t.flatten=vn,t.Queue=Os,t.Counter=vm,t.throttle=Sn,t.download=_n,t.getQuery=mn,t.getDataInfo=Ao,t.getFileInfo=wn,t.uniqueArray=Cn,t.BufferRepresentation=tb,t.ArrowBuffer=P_,t.BoxBuffer=D_,t.ConeBuffer=T_,t.CylinderBuffer=Ob,t.EllipsoidBuffer=U_,t.OctahedronBuffer=H_,t.SphereBuffer=gb,t.TetrahedronBuffer=Z_,t.TextBuffer=Yx,t.TorusBuffer=ew,t.Shape=Ky,t.Structure=By,t.Kdtree=hs,t.SpatialHash=qa,t.MolecularSurface=s_,t.Volume=ey,t.LeftMouseButton=1,t.MiddleMouseButton=2,t.RightMouseButton=3,t.MouseActions=bg,t.KeyActions=wg,t.Signal=no,t.Matrix3=ut,t.Matrix4=v,t.Vector2=l,t.Vector3=g,t.Box3=st,t.Quaternion=m,t.Euler=ft,t.Plane=ht,t.Color=tt,Object.defineProperty(t,"__esModule",{value:!0})});
	
	/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4).setImmediate, __webpack_require__(7).Buffer))

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

	var apply = Function.prototype.apply;
	
	// DOM APIs, for completeness
	
	exports.setTimeout = function() {
	  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
	};
	exports.setInterval = function() {
	  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
	};
	exports.clearTimeout =
	exports.clearInterval = function(timeout) {
	  if (timeout) {
	    timeout.close();
	  }
	};
	
	function Timeout(id, clearFn) {
	  this._id = id;
	  this._clearFn = clearFn;
	}
	Timeout.prototype.unref = Timeout.prototype.ref = function() {};
	Timeout.prototype.close = function() {
	  this._clearFn.call(window, this._id);
	};
	
	// Does not start the time, just sets up the members needed.
	exports.enroll = function(item, msecs) {
	  clearTimeout(item._idleTimeoutId);
	  item._idleTimeout = msecs;
	};
	
	exports.unenroll = function(item) {
	  clearTimeout(item._idleTimeoutId);
	  item._idleTimeout = -1;
	};
	
	exports._unrefActive = exports.active = function(item) {
	  clearTimeout(item._idleTimeoutId);
	
	  var msecs = item._idleTimeout;
	  if (msecs >= 0) {
	    item._idleTimeoutId = setTimeout(function onTimeout() {
	      if (item._onTimeout)
	        item._onTimeout();
	    }, msecs);
	  }
	};
	
	// setimmediate attaches itself to the global object
	__webpack_require__(5);
	exports.setImmediate = setImmediate;
	exports.clearImmediate = clearImmediate;


/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

	/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
	    "use strict";
	
	    if (global.setImmediate) {
	        return;
	    }
	
	    var nextHandle = 1; // Spec says greater than zero
	    var tasksByHandle = {};
	    var currentlyRunningATask = false;
	    var doc = global.document;
	    var registerImmediate;
	
	    function setImmediate(callback) {
	      // Callback can either be a function or a string
	      if (typeof callback !== "function") {
	        callback = new Function("" + callback);
	      }
	      // Copy function arguments
	      var args = new Array(arguments.length - 1);
	      for (var i = 0; i < args.length; i++) {
	          args[i] = arguments[i + 1];
	      }
	      // Store and register the task
	      var task = { callback: callback, args: args };
	      tasksByHandle[nextHandle] = task;
	      registerImmediate(nextHandle);
	      return nextHandle++;
	    }
	
	    function clearImmediate(handle) {
	        delete tasksByHandle[handle];
	    }
	
	    function run(task) {
	        var callback = task.callback;
	        var args = task.args;
	        switch (args.length) {
	        case 0:
	            callback();
	            break;
	        case 1:
	            callback(args[0]);
	            break;
	        case 2:
	            callback(args[0], args[1]);
	            break;
	        case 3:
	            callback(args[0], args[1], args[2]);
	            break;
	        default:
	            callback.apply(undefined, args);
	            break;
	        }
	    }
	
	    function runIfPresent(handle) {
	        // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
	        // So if we're currently running a task, we'll need to delay this invocation.
	        if (currentlyRunningATask) {
	            // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
	            // "too much recursion" error.
	            setTimeout(runIfPresent, 0, handle);
	        } else {
	            var task = tasksByHandle[handle];
	            if (task) {
	                currentlyRunningATask = true;
	                try {
	                    run(task);
	                } finally {
	                    clearImmediate(handle);
	                    currentlyRunningATask = false;
	                }
	            }
	        }
	    }
	
	    function installNextTickImplementation() {
	        registerImmediate = function(handle) {
	            process.nextTick(function () { runIfPresent(handle); });
	        };
	    }
	
	    function canUsePostMessage() {
	        // The test against `importScripts` prevents this implementation from being installed inside a web worker,
	        // where `global.postMessage` means something completely different and can't be used for this purpose.
	        if (global.postMessage && !global.importScripts) {
	            var postMessageIsAsynchronous = true;
	            var oldOnMessage = global.onmessage;
	            global.onmessage = function() {
	                postMessageIsAsynchronous = false;
	            };
	            global.postMessage("", "*");
	            global.onmessage = oldOnMessage;
	            return postMessageIsAsynchronous;
	        }
	    }
	
	    function installPostMessageImplementation() {
	        // Installs an event handler on `global` for the `message` event: see
	        // * https://developer.mozilla.org/en/DOM/window.postMessage
	        // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
	
	        var messagePrefix = "setImmediate$" + Math.random() + "$";
	        var onGlobalMessage = function(event) {
	            if (event.source === global &&
	                typeof event.data === "string" &&
	                event.data.indexOf(messagePrefix) === 0) {
	                runIfPresent(+event.data.slice(messagePrefix.length));
	            }
	        };
	
	        if (global.addEventListener) {
	            global.addEventListener("message", onGlobalMessage, false);
	        } else {
	            global.attachEvent("onmessage", onGlobalMessage);
	        }
	
	        registerImmediate = function(handle) {
	            global.postMessage(messagePrefix + handle, "*");
	        };
	    }
	
	    function installMessageChannelImplementation() {
	        var channel = new MessageChannel();
	        channel.port1.onmessage = function(event) {
	            var handle = event.data;
	            runIfPresent(handle);
	        };
	
	        registerImmediate = function(handle) {
	            channel.port2.postMessage(handle);
	        };
	    }
	
	    function installReadyStateChangeImplementation() {
	        var html = doc.documentElement;
	        registerImmediate = function(handle) {
	            // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
	            // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
	            var script = doc.createElement("script");
	            script.onreadystatechange = function () {
	                runIfPresent(handle);
	                script.onreadystatechange = null;
	                html.removeChild(script);
	                script = null;
	            };
	            html.appendChild(script);
	        };
	    }
	
	    function installSetTimeoutImplementation() {
	        registerImmediate = function(handle) {
	            setTimeout(runIfPresent, 0, handle);
	        };
	    }
	
	    // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
	    var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
	    attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
	
	    // Don't get fooled by e.g. browserify environments.
	    if ({}.toString.call(global.process) === "[object process]") {
	        // For Node.js before 0.9
	        installNextTickImplementation();
	
	    } else if (canUsePostMessage()) {
	        // For non-IE10 modern browsers
	        installPostMessageImplementation();
	
	    } else if (global.MessageChannel) {
	        // For web workers, where supported
	        installMessageChannelImplementation();
	
	    } else if (doc && "onreadystatechange" in doc.createElement("script")) {
	        // For IE 6–8
	        installReadyStateChangeImplementation();
	
	    } else {
	        // For older browsers
	        installSetTimeoutImplementation();
	    }
	
	    attachTo.setImmediate = setImmediate;
	    attachTo.clearImmediate = clearImmediate;
	}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
	
	/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(6)))

/***/ }),
/* 6 */
/***/ (function(module, exports) {

	// shim for using process in browser
	var process = module.exports = {};
	
	// cached from whatever global is present so that test runners that stub it
	// don't break things.  But we need to wrap it in a try catch in case it is
	// wrapped in strict mode code which doesn't define any globals.  It's inside a
	// function because try/catches deoptimize in certain engines.
	
	var cachedSetTimeout;
	var cachedClearTimeout;
	
	function defaultSetTimout() {
	    throw new Error('setTimeout has not been defined');
	}
	function defaultClearTimeout () {
	    throw new Error('clearTimeout has not been defined');
	}
	(function () {
	    try {
	        if (typeof setTimeout === 'function') {
	            cachedSetTimeout = setTimeout;
	        } else {
	            cachedSetTimeout = defaultSetTimout;
	        }
	    } catch (e) {
	        cachedSetTimeout = defaultSetTimout;
	    }
	    try {
	        if (typeof clearTimeout === 'function') {
	            cachedClearTimeout = clearTimeout;
	        } else {
	            cachedClearTimeout = defaultClearTimeout;
	        }
	    } catch (e) {
	        cachedClearTimeout = defaultClearTimeout;
	    }
	} ())
	function runTimeout(fun) {
	    if (cachedSetTimeout === setTimeout) {
	        //normal enviroments in sane situations
	        return setTimeout(fun, 0);
	    }
	    // if setTimeout wasn't available but was latter defined
	    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
	        cachedSetTimeout = setTimeout;
	        return setTimeout(fun, 0);
	    }
	    try {
	        // when when somebody has screwed with setTimeout but no I.E. maddness
	        return cachedSetTimeout(fun, 0);
	    } catch(e){
	        try {
	            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
	            return cachedSetTimeout.call(null, fun, 0);
	        } catch(e){
	            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
	            return cachedSetTimeout.call(this, fun, 0);
	        }
	    }
	
	
	}
	function runClearTimeout(marker) {
	    if (cachedClearTimeout === clearTimeout) {
	        //normal enviroments in sane situations
	        return clearTimeout(marker);
	    }
	    // if clearTimeout wasn't available but was latter defined
	    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
	        cachedClearTimeout = clearTimeout;
	        return clearTimeout(marker);
	    }
	    try {
	        // when when somebody has screwed with setTimeout but no I.E. maddness
	        return cachedClearTimeout(marker);
	    } catch (e){
	        try {
	            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
	            return cachedClearTimeout.call(null, marker);
	        } catch (e){
	            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
	            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
	            return cachedClearTimeout.call(this, marker);
	        }
	    }
	
	
	
	}
	var queue = [];
	var draining = false;
	var currentQueue;
	var queueIndex = -1;
	
	function cleanUpNextTick() {
	    if (!draining || !currentQueue) {
	        return;
	    }
	    draining = false;
	    if (currentQueue.length) {
	        queue = currentQueue.concat(queue);
	    } else {
	        queueIndex = -1;
	    }
	    if (queue.length) {
	        drainQueue();
	    }
	}
	
	function drainQueue() {
	    if (draining) {
	        return;
	    }
	    var timeout = runTimeout(cleanUpNextTick);
	    draining = true;
	
	    var len = queue.length;
	    while(len) {
	        currentQueue = queue;
	        queue = [];
	        while (++queueIndex < len) {
	            if (currentQueue) {
	                currentQueue[queueIndex].run();
	            }
	        }
	        queueIndex = -1;
	        len = queue.length;
	    }
	    currentQueue = null;
	    draining = false;
	    runClearTimeout(timeout);
	}
	
	process.nextTick = function (fun) {
	    var args = new Array(arguments.length - 1);
	    if (arguments.length > 1) {
	        for (var i = 1; i < arguments.length; i++) {
	            args[i - 1] = arguments[i];
	        }
	    }
	    queue.push(new Item(fun, args));
	    if (queue.length === 1 && !draining) {
	        runTimeout(drainQueue);
	    }
	};
	
	// v8 likes predictible objects
	function Item(fun, array) {
	    this.fun = fun;
	    this.array = array;
	}
	Item.prototype.run = function () {
	    this.fun.apply(null, this.array);
	};
	process.title = 'browser';
	process.browser = true;
	process.env = {};
	process.argv = [];
	process.version = ''; // empty string to avoid regexp issues
	process.versions = {};
	
	function noop() {}
	
	process.on = noop;
	process.addListener = noop;
	process.once = noop;
	process.off = noop;
	process.removeListener = noop;
	process.removeAllListeners = noop;
	process.emit = noop;
	process.prependListener = noop;
	process.prependOnceListener = noop;
	
	process.listeners = function (name) { return [] }
	
	process.binding = function (name) {
	    throw new Error('process.binding is not supported');
	};
	
	process.cwd = function () { return '/' };
	process.chdir = function (dir) {
	    throw new Error('process.chdir is not supported');
	};
	process.umask = function() { return 0; };


/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

	/* WEBPACK VAR INJECTION */(function(global) {/*!
	 * The buffer module from node.js, for the browser.
	 *
	 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
	 * @license  MIT
	 */
	/* eslint-disable no-proto */
	
	'use strict'
	
	var base64 = __webpack_require__(8)
	var ieee754 = __webpack_require__(9)
	var isArray = __webpack_require__(10)
	
	exports.Buffer = Buffer
	exports.SlowBuffer = SlowBuffer
	exports.INSPECT_MAX_BYTES = 50
	
	/**
	 * If `Buffer.TYPED_ARRAY_SUPPORT`:
	 *   === true    Use Uint8Array implementation (fastest)
	 *   === false   Use Object implementation (most compatible, even IE6)
	 *
	 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
	 * Opera 11.6+, iOS 4.2+.
	 *
	 * Due to various browser bugs, sometimes the Object implementation will be used even
	 * when the browser supports typed arrays.
	 *
	 * Note:
	 *
	 *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
	 *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
	 *
	 *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
	 *
	 *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
	 *     incorrect length in some situations.
	
	 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
	 * get the Object implementation, which is slower but behaves correctly.
	 */
	Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
	  ? global.TYPED_ARRAY_SUPPORT
	  : typedArraySupport()
	
	/*
	 * Export kMaxLength after typed array support is determined.
	 */
	exports.kMaxLength = kMaxLength()
	
	function typedArraySupport () {
	  try {
	    var arr = new Uint8Array(1)
	    arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
	    return arr.foo() === 42 && // typed array instances can be augmented
	        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
	        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
	  } catch (e) {
	    return false
	  }
	}
	
	function kMaxLength () {
	  return Buffer.TYPED_ARRAY_SUPPORT
	    ? 0x7fffffff
	    : 0x3fffffff
	}
	
	function createBuffer (that, length) {
	  if (kMaxLength() < length) {
	    throw new RangeError('Invalid typed array length')
	  }
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    // Return an augmented `Uint8Array` instance, for best performance
	    that = new Uint8Array(length)
	    that.__proto__ = Buffer.prototype
	  } else {
	    // Fallback: Return an object instance of the Buffer class
	    if (that === null) {
	      that = new Buffer(length)
	    }
	    that.length = length
	  }
	
	  return that
	}
	
	/**
	 * The Buffer constructor returns instances of `Uint8Array` that have their
	 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
	 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
	 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
	 * returns a single octet.
	 *
	 * The `Uint8Array` prototype remains unmodified.
	 */
	
	function Buffer (arg, encodingOrOffset, length) {
	  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
	    return new Buffer(arg, encodingOrOffset, length)
	  }
	
	  // Common case.
	  if (typeof arg === 'number') {
	    if (typeof encodingOrOffset === 'string') {
	      throw new Error(
	        'If encoding is specified then the first argument must be a string'
	      )
	    }
	    return allocUnsafe(this, arg)
	  }
	  return from(this, arg, encodingOrOffset, length)
	}
	
	Buffer.poolSize = 8192 // not used by this implementation
	
	// TODO: Legacy, not needed anymore. Remove in next major version.
	Buffer._augment = function (arr) {
	  arr.__proto__ = Buffer.prototype
	  return arr
	}
	
	function from (that, value, encodingOrOffset, length) {
	  if (typeof value === 'number') {
	    throw new TypeError('"value" argument must not be a number')
	  }
	
	  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
	    return fromArrayBuffer(that, value, encodingOrOffset, length)
	  }
	
	  if (typeof value === 'string') {
	    return fromString(that, value, encodingOrOffset)
	  }
	
	  return fromObject(that, value)
	}
	
	/**
	 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
	 * if value is a number.
	 * Buffer.from(str[, encoding])
	 * Buffer.from(array)
	 * Buffer.from(buffer)
	 * Buffer.from(arrayBuffer[, byteOffset[, length]])
	 **/
	Buffer.from = function (value, encodingOrOffset, length) {
	  return from(null, value, encodingOrOffset, length)
	}
	
	if (Buffer.TYPED_ARRAY_SUPPORT) {
	  Buffer.prototype.__proto__ = Uint8Array.prototype
	  Buffer.__proto__ = Uint8Array
	  if (typeof Symbol !== 'undefined' && Symbol.species &&
	      Buffer[Symbol.species] === Buffer) {
	    // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
	    Object.defineProperty(Buffer, Symbol.species, {
	      value: null,
	      configurable: true
	    })
	  }
	}
	
	function assertSize (size) {
	  if (typeof size !== 'number') {
	    throw new TypeError('"size" argument must be a number')
	  } else if (size < 0) {
	    throw new RangeError('"size" argument must not be negative')
	  }
	}
	
	function alloc (that, size, fill, encoding) {
	  assertSize(size)
	  if (size <= 0) {
	    return createBuffer(that, size)
	  }
	  if (fill !== undefined) {
	    // Only pay attention to encoding if it's a string. This
	    // prevents accidentally sending in a number that would
	    // be interpretted as a start offset.
	    return typeof encoding === 'string'
	      ? createBuffer(that, size).fill(fill, encoding)
	      : createBuffer(that, size).fill(fill)
	  }
	  return createBuffer(that, size)
	}
	
	/**
	 * Creates a new filled Buffer instance.
	 * alloc(size[, fill[, encoding]])
	 **/
	Buffer.alloc = function (size, fill, encoding) {
	  return alloc(null, size, fill, encoding)
	}
	
	function allocUnsafe (that, size) {
	  assertSize(size)
	  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
	  if (!Buffer.TYPED_ARRAY_SUPPORT) {
	    for (var i = 0; i < size; ++i) {
	      that[i] = 0
	    }
	  }
	  return that
	}
	
	/**
	 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
	 * */
	Buffer.allocUnsafe = function (size) {
	  return allocUnsafe(null, size)
	}
	/**
	 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
	 */
	Buffer.allocUnsafeSlow = function (size) {
	  return allocUnsafe(null, size)
	}
	
	function fromString (that, string, encoding) {
	  if (typeof encoding !== 'string' || encoding === '') {
	    encoding = 'utf8'
	  }
	
	  if (!Buffer.isEncoding(encoding)) {
	    throw new TypeError('"encoding" must be a valid string encoding')
	  }
	
	  var length = byteLength(string, encoding) | 0
	  that = createBuffer(that, length)
	
	  var actual = that.write(string, encoding)
	
	  if (actual !== length) {
	    // Writing a hex string, for example, that contains invalid characters will
	    // cause everything after the first invalid character to be ignored. (e.g.
	    // 'abxxcd' will be treated as 'ab')
	    that = that.slice(0, actual)
	  }
	
	  return that
	}
	
	function fromArrayLike (that, array) {
	  var length = array.length < 0 ? 0 : checked(array.length) | 0
	  that = createBuffer(that, length)
	  for (var i = 0; i < length; i += 1) {
	    that[i] = array[i] & 255
	  }
	  return that
	}
	
	function fromArrayBuffer (that, array, byteOffset, length) {
	  array.byteLength // this throws if `array` is not a valid ArrayBuffer
	
	  if (byteOffset < 0 || array.byteLength < byteOffset) {
	    throw new RangeError('\'offset\' is out of bounds')
	  }
	
	  if (array.byteLength < byteOffset + (length || 0)) {
	    throw new RangeError('\'length\' is out of bounds')
	  }
	
	  if (byteOffset === undefined && length === undefined) {
	    array = new Uint8Array(array)
	  } else if (length === undefined) {
	    array = new Uint8Array(array, byteOffset)
	  } else {
	    array = new Uint8Array(array, byteOffset, length)
	  }
	
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    // Return an augmented `Uint8Array` instance, for best performance
	    that = array
	    that.__proto__ = Buffer.prototype
	  } else {
	    // Fallback: Return an object instance of the Buffer class
	    that = fromArrayLike(that, array)
	  }
	  return that
	}
	
	function fromObject (that, obj) {
	  if (Buffer.isBuffer(obj)) {
	    var len = checked(obj.length) | 0
	    that = createBuffer(that, len)
	
	    if (that.length === 0) {
	      return that
	    }
	
	    obj.copy(that, 0, 0, len)
	    return that
	  }
	
	  if (obj) {
	    if ((typeof ArrayBuffer !== 'undefined' &&
	        obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
	      if (typeof obj.length !== 'number' || isnan(obj.length)) {
	        return createBuffer(that, 0)
	      }
	      return fromArrayLike(that, obj)
	    }
	
	    if (obj.type === 'Buffer' && isArray(obj.data)) {
	      return fromArrayLike(that, obj.data)
	    }
	  }
	
	  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
	}
	
	function checked (length) {
	  // Note: cannot use `length < kMaxLength()` here because that fails when
	  // length is NaN (which is otherwise coerced to zero.)
	  if (length >= kMaxLength()) {
	    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
	                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
	  }
	  return length | 0
	}
	
	function SlowBuffer (length) {
	  if (+length != length) { // eslint-disable-line eqeqeq
	    length = 0
	  }
	  return Buffer.alloc(+length)
	}
	
	Buffer.isBuffer = function isBuffer (b) {
	  return !!(b != null && b._isBuffer)
	}
	
	Buffer.compare = function compare (a, b) {
	  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
	    throw new TypeError('Arguments must be Buffers')
	  }
	
	  if (a === b) return 0
	
	  var x = a.length
	  var y = b.length
	
	  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
	    if (a[i] !== b[i]) {
	      x = a[i]
	      y = b[i]
	      break
	    }
	  }
	
	  if (x < y) return -1
	  if (y < x) return 1
	  return 0
	}
	
	Buffer.isEncoding = function isEncoding (encoding) {
	  switch (String(encoding).toLowerCase()) {
	    case 'hex':
	    case 'utf8':
	    case 'utf-8':
	    case 'ascii':
	    case 'latin1':
	    case 'binary':
	    case 'base64':
	    case 'ucs2':
	    case 'ucs-2':
	    case 'utf16le':
	    case 'utf-16le':
	      return true
	    default:
	      return false
	  }
	}
	
	Buffer.concat = function concat (list, length) {
	  if (!isArray(list)) {
	    throw new TypeError('"list" argument must be an Array of Buffers')
	  }
	
	  if (list.length === 0) {
	    return Buffer.alloc(0)
	  }
	
	  var i
	  if (length === undefined) {
	    length = 0
	    for (i = 0; i < list.length; ++i) {
	      length += list[i].length
	    }
	  }
	
	  var buffer = Buffer.allocUnsafe(length)
	  var pos = 0
	  for (i = 0; i < list.length; ++i) {
	    var buf = list[i]
	    if (!Buffer.isBuffer(buf)) {
	      throw new TypeError('"list" argument must be an Array of Buffers')
	    }
	    buf.copy(buffer, pos)
	    pos += buf.length
	  }
	  return buffer
	}
	
	function byteLength (string, encoding) {
	  if (Buffer.isBuffer(string)) {
	    return string.length
	  }
	  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
	      (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
	    return string.byteLength
	  }
	  if (typeof string !== 'string') {
	    string = '' + string
	  }
	
	  var len = string.length
	  if (len === 0) return 0
	
	  // Use a for loop to avoid recursion
	  var loweredCase = false
	  for (;;) {
	    switch (encoding) {
	      case 'ascii':
	      case 'latin1':
	      case 'binary':
	        return len
	      case 'utf8':
	      case 'utf-8':
	      case undefined:
	        return utf8ToBytes(string).length
	      case 'ucs2':
	      case 'ucs-2':
	      case 'utf16le':
	      case 'utf-16le':
	        return len * 2
	      case 'hex':
	        return len >>> 1
	      case 'base64':
	        return base64ToBytes(string).length
	      default:
	        if (loweredCase) return utf8ToBytes(string).length // assume utf8
	        encoding = ('' + encoding).toLowerCase()
	        loweredCase = true
	    }
	  }
	}
	Buffer.byteLength = byteLength
	
	function slowToString (encoding, start, end) {
	  var loweredCase = false
	
	  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
	  // property of a typed array.
	
	  // This behaves neither like String nor Uint8Array in that we set start/end
	  // to their upper/lower bounds if the value passed is out of range.
	  // undefined is handled specially as per ECMA-262 6th Edition,
	  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
	  if (start === undefined || start < 0) {
	    start = 0
	  }
	  // Return early if start > this.length. Done here to prevent potential uint32
	  // coercion fail below.
	  if (start > this.length) {
	    return ''
	  }
	
	  if (end === undefined || end > this.length) {
	    end = this.length
	  }
	
	  if (end <= 0) {
	    return ''
	  }
	
	  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
	  end >>>= 0
	  start >>>= 0
	
	  if (end <= start) {
	    return ''
	  }
	
	  if (!encoding) encoding = 'utf8'
	
	  while (true) {
	    switch (encoding) {
	      case 'hex':
	        return hexSlice(this, start, end)
	
	      case 'utf8':
	      case 'utf-8':
	        return utf8Slice(this, start, end)
	
	      case 'ascii':
	        return asciiSlice(this, start, end)
	
	      case 'latin1':
	      case 'binary':
	        return latin1Slice(this, start, end)
	
	      case 'base64':
	        return base64Slice(this, start, end)
	
	      case 'ucs2':
	      case 'ucs-2':
	      case 'utf16le':
	      case 'utf-16le':
	        return utf16leSlice(this, start, end)
	
	      default:
	        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
	        encoding = (encoding + '').toLowerCase()
	        loweredCase = true
	    }
	  }
	}
	
	// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
	// Buffer instances.
	Buffer.prototype._isBuffer = true
	
	function swap (b, n, m) {
	  var i = b[n]
	  b[n] = b[m]
	  b[m] = i
	}
	
	Buffer.prototype.swap16 = function swap16 () {
	  var len = this.length
	  if (len % 2 !== 0) {
	    throw new RangeError('Buffer size must be a multiple of 16-bits')
	  }
	  for (var i = 0; i < len; i += 2) {
	    swap(this, i, i + 1)
	  }
	  return this
	}
	
	Buffer.prototype.swap32 = function swap32 () {
	  var len = this.length
	  if (len % 4 !== 0) {
	    throw new RangeError('Buffer size must be a multiple of 32-bits')
	  }
	  for (var i = 0; i < len; i += 4) {
	    swap(this, i, i + 3)
	    swap(this, i + 1, i + 2)
	  }
	  return this
	}
	
	Buffer.prototype.swap64 = function swap64 () {
	  var len = this.length
	  if (len % 8 !== 0) {
	    throw new RangeError('Buffer size must be a multiple of 64-bits')
	  }
	  for (var i = 0; i < len; i += 8) {
	    swap(this, i, i + 7)
	    swap(this, i + 1, i + 6)
	    swap(this, i + 2, i + 5)
	    swap(this, i + 3, i + 4)
	  }
	  return this
	}
	
	Buffer.prototype.toString = function toString () {
	  var length = this.length | 0
	  if (length === 0) return ''
	  if (arguments.length === 0) return utf8Slice(this, 0, length)
	  return slowToString.apply(this, arguments)
	}
	
	Buffer.prototype.equals = function equals (b) {
	  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
	  if (this === b) return true
	  return Buffer.compare(this, b) === 0
	}
	
	Buffer.prototype.inspect = function inspect () {
	  var str = ''
	  var max = exports.INSPECT_MAX_BYTES
	  if (this.length > 0) {
	    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
	    if (this.length > max) str += ' ... '
	  }
	  return '<Buffer ' + str + '>'
	}
	
	Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
	  if (!Buffer.isBuffer(target)) {
	    throw new TypeError('Argument must be a Buffer')
	  }
	
	  if (start === undefined) {
	    start = 0
	  }
	  if (end === undefined) {
	    end = target ? target.length : 0
	  }
	  if (thisStart === undefined) {
	    thisStart = 0
	  }
	  if (thisEnd === undefined) {
	    thisEnd = this.length
	  }
	
	  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
	    throw new RangeError('out of range index')
	  }
	
	  if (thisStart >= thisEnd && start >= end) {
	    return 0
	  }
	  if (thisStart >= thisEnd) {
	    return -1
	  }
	  if (start >= end) {
	    return 1
	  }
	
	  start >>>= 0
	  end >>>= 0
	  thisStart >>>= 0
	  thisEnd >>>= 0
	
	  if (this === target) return 0
	
	  var x = thisEnd - thisStart
	  var y = end - start
	  var len = Math.min(x, y)
	
	  var thisCopy = this.slice(thisStart, thisEnd)
	  var targetCopy = target.slice(start, end)
	
	  for (var i = 0; i < len; ++i) {
	    if (thisCopy[i] !== targetCopy[i]) {
	      x = thisCopy[i]
	      y = targetCopy[i]
	      break
	    }
	  }
	
	  if (x < y) return -1
	  if (y < x) return 1
	  return 0
	}
	
	// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
	// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
	//
	// Arguments:
	// - buffer - a Buffer to search
	// - val - a string, Buffer, or number
	// - byteOffset - an index into `buffer`; will be clamped to an int32
	// - encoding - an optional encoding, relevant is val is a string
	// - dir - true for indexOf, false for lastIndexOf
	function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
	  // Empty buffer means no match
	  if (buffer.length === 0) return -1
	
	  // Normalize byteOffset
	  if (typeof byteOffset === 'string') {
	    encoding = byteOffset
	    byteOffset = 0
	  } else if (byteOffset > 0x7fffffff) {
	    byteOffset = 0x7fffffff
	  } else if (byteOffset < -0x80000000) {
	    byteOffset = -0x80000000
	  }
	  byteOffset = +byteOffset  // Coerce to Number.
	  if (isNaN(byteOffset)) {
	    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
	    byteOffset = dir ? 0 : (buffer.length - 1)
	  }
	
	  // Normalize byteOffset: negative offsets start from the end of the buffer
	  if (byteOffset < 0) byteOffset = buffer.length + byteOffset
	  if (byteOffset >= buffer.length) {
	    if (dir) return -1
	    else byteOffset = buffer.length - 1
	  } else if (byteOffset < 0) {
	    if (dir) byteOffset = 0
	    else return -1
	  }
	
	  // Normalize val
	  if (typeof val === 'string') {
	    val = Buffer.from(val, encoding)
	  }
	
	  // Finally, search either indexOf (if dir is true) or lastIndexOf
	  if (Buffer.isBuffer(val)) {
	    // Special case: looking for empty string/buffer always fails
	    if (val.length === 0) {
	      return -1
	    }
	    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
	  } else if (typeof val === 'number') {
	    val = val & 0xFF // Search for a byte value [0-255]
	    if (Buffer.TYPED_ARRAY_SUPPORT &&
	        typeof Uint8Array.prototype.indexOf === 'function') {
	      if (dir) {
	        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
	      } else {
	        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
	      }
	    }
	    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
	  }
	
	  throw new TypeError('val must be string, number or Buffer')
	}
	
	function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
	  var indexSize = 1
	  var arrLength = arr.length
	  var valLength = val.length
	
	  if (encoding !== undefined) {
	    encoding = String(encoding).toLowerCase()
	    if (encoding === 'ucs2' || encoding === 'ucs-2' ||
	        encoding === 'utf16le' || encoding === 'utf-16le') {
	      if (arr.length < 2 || val.length < 2) {
	        return -1
	      }
	      indexSize = 2
	      arrLength /= 2
	      valLength /= 2
	      byteOffset /= 2
	    }
	  }
	
	  function read (buf, i) {
	    if (indexSize === 1) {
	      return buf[i]
	    } else {
	      return buf.readUInt16BE(i * indexSize)
	    }
	  }
	
	  var i
	  if (dir) {
	    var foundIndex = -1
	    for (i = byteOffset; i < arrLength; i++) {
	      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
	        if (foundIndex === -1) foundIndex = i
	        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
	      } else {
	        if (foundIndex !== -1) i -= i - foundIndex
	        foundIndex = -1
	      }
	    }
	  } else {
	    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
	    for (i = byteOffset; i >= 0; i--) {
	      var found = true
	      for (var j = 0; j < valLength; j++) {
	        if (read(arr, i + j) !== read(val, j)) {
	          found = false
	          break
	        }
	      }
	      if (found) return i
	    }
	  }
	
	  return -1
	}
	
	Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
	  return this.indexOf(val, byteOffset, encoding) !== -1
	}
	
	Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
	  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
	}
	
	Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
	  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
	}
	
	function hexWrite (buf, string, offset, length) {
	  offset = Number(offset) || 0
	  var remaining = buf.length - offset
	  if (!length) {
	    length = remaining
	  } else {
	    length = Number(length)
	    if (length > remaining) {
	      length = remaining
	    }
	  }
	
	  // must be an even number of digits
	  var strLen = string.length
	  if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
	
	  if (length > strLen / 2) {
	    length = strLen / 2
	  }
	  for (var i = 0; i < length; ++i) {
	    var parsed = parseInt(string.substr(i * 2, 2), 16)
	    if (isNaN(parsed)) return i
	    buf[offset + i] = parsed
	  }
	  return i
	}
	
	function utf8Write (buf, string, offset, length) {
	  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
	}
	
	function asciiWrite (buf, string, offset, length) {
	  return blitBuffer(asciiToBytes(string), buf, offset, length)
	}
	
	function latin1Write (buf, string, offset, length) {
	  return asciiWrite(buf, string, offset, length)
	}
	
	function base64Write (buf, string, offset, length) {
	  return blitBuffer(base64ToBytes(string), buf, offset, length)
	}
	
	function ucs2Write (buf, string, offset, length) {
	  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
	}
	
	Buffer.prototype.write = function write (string, offset, length, encoding) {
	  // Buffer#write(string)
	  if (offset === undefined) {
	    encoding = 'utf8'
	    length = this.length
	    offset = 0
	  // Buffer#write(string, encoding)
	  } else if (length === undefined && typeof offset === 'string') {
	    encoding = offset
	    length = this.length
	    offset = 0
	  // Buffer#write(string, offset[, length][, encoding])
	  } else if (isFinite(offset)) {
	    offset = offset | 0
	    if (isFinite(length)) {
	      length = length | 0
	      if (encoding === undefined) encoding = 'utf8'
	    } else {
	      encoding = length
	      length = undefined
	    }
	  // legacy write(string, encoding, offset, length) - remove in v0.13
	  } else {
	    throw new Error(
	      'Buffer.write(string, encoding, offset[, length]) is no longer supported'
	    )
	  }
	
	  var remaining = this.length - offset
	  if (length === undefined || length > remaining) length = remaining
	
	  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
	    throw new RangeError('Attempt to write outside buffer bounds')
	  }
	
	  if (!encoding) encoding = 'utf8'
	
	  var loweredCase = false
	  for (;;) {
	    switch (encoding) {
	      case 'hex':
	        return hexWrite(this, string, offset, length)
	
	      case 'utf8':
	      case 'utf-8':
	        return utf8Write(this, string, offset, length)
	
	      case 'ascii':
	        return asciiWrite(this, string, offset, length)
	
	      case 'latin1':
	      case 'binary':
	        return latin1Write(this, string, offset, length)
	
	      case 'base64':
	        // Warning: maxLength not taken into account in base64Write
	        return base64Write(this, string, offset, length)
	
	      case 'ucs2':
	      case 'ucs-2':
	      case 'utf16le':
	      case 'utf-16le':
	        return ucs2Write(this, string, offset, length)
	
	      default:
	        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
	        encoding = ('' + encoding).toLowerCase()
	        loweredCase = true
	    }
	  }
	}
	
	Buffer.prototype.toJSON = function toJSON () {
	  return {
	    type: 'Buffer',
	    data: Array.prototype.slice.call(this._arr || this, 0)
	  }
	}
	
	function base64Slice (buf, start, end) {
	  if (start === 0 && end === buf.length) {
	    return base64.fromByteArray(buf)
	  } else {
	    return base64.fromByteArray(buf.slice(start, end))
	  }
	}
	
	function utf8Slice (buf, start, end) {
	  end = Math.min(buf.length, end)
	  var res = []
	
	  var i = start
	  while (i < end) {
	    var firstByte = buf[i]
	    var codePoint = null
	    var bytesPerSequence = (firstByte > 0xEF) ? 4
	      : (firstByte > 0xDF) ? 3
	      : (firstByte > 0xBF) ? 2
	      : 1
	
	    if (i + bytesPerSequence <= end) {
	      var secondByte, thirdByte, fourthByte, tempCodePoint
	
	      switch (bytesPerSequence) {
	        case 1:
	          if (firstByte < 0x80) {
	            codePoint = firstByte
	          }
	          break
	        case 2:
	          secondByte = buf[i + 1]
	          if ((secondByte & 0xC0) === 0x80) {
	            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
	            if (tempCodePoint > 0x7F) {
	              codePoint = tempCodePoint
	            }
	          }
	          break
	        case 3:
	          secondByte = buf[i + 1]
	          thirdByte = buf[i + 2]
	          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
	            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
	            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
	              codePoint = tempCodePoint
	            }
	          }
	          break
	        case 4:
	          secondByte = buf[i + 1]
	          thirdByte = buf[i + 2]
	          fourthByte = buf[i + 3]
	          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
	            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
	            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
	              codePoint = tempCodePoint
	            }
	          }
	      }
	    }
	
	    if (codePoint === null) {
	      // we did not generate a valid codePoint so insert a
	      // replacement char (U+FFFD) and advance only 1 byte
	      codePoint = 0xFFFD
	      bytesPerSequence = 1
	    } else if (codePoint > 0xFFFF) {
	      // encode to utf16 (surrogate pair dance)
	      codePoint -= 0x10000
	      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
	      codePoint = 0xDC00 | codePoint & 0x3FF
	    }
	
	    res.push(codePoint)
	    i += bytesPerSequence
	  }
	
	  return decodeCodePointsArray(res)
	}
	
	// Based on http://stackoverflow.com/a/22747272/680742, the browser with
	// the lowest limit is Chrome, with 0x10000 args.
	// We go 1 magnitude less, for safety
	var MAX_ARGUMENTS_LENGTH = 0x1000
	
	function decodeCodePointsArray (codePoints) {
	  var len = codePoints.length
	  if (len <= MAX_ARGUMENTS_LENGTH) {
	    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
	  }
	
	  // Decode in chunks to avoid "call stack size exceeded".
	  var res = ''
	  var i = 0
	  while (i < len) {
	    res += String.fromCharCode.apply(
	      String,
	      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
	    )
	  }
	  return res
	}
	
	function asciiSlice (buf, start, end) {
	  var ret = ''
	  end = Math.min(buf.length, end)
	
	  for (var i = start; i < end; ++i) {
	    ret += String.fromCharCode(buf[i] & 0x7F)
	  }
	  return ret
	}
	
	function latin1Slice (buf, start, end) {
	  var ret = ''
	  end = Math.min(buf.length, end)
	
	  for (var i = start; i < end; ++i) {
	    ret += String.fromCharCode(buf[i])
	  }
	  return ret
	}
	
	function hexSlice (buf, start, end) {
	  var len = buf.length
	
	  if (!start || start < 0) start = 0
	  if (!end || end < 0 || end > len) end = len
	
	  var out = ''
	  for (var i = start; i < end; ++i) {
	    out += toHex(buf[i])
	  }
	  return out
	}
	
	function utf16leSlice (buf, start, end) {
	  var bytes = buf.slice(start, end)
	  var res = ''
	  for (var i = 0; i < bytes.length; i += 2) {
	    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
	  }
	  return res
	}
	
	Buffer.prototype.slice = function slice (start, end) {
	  var len = this.length
	  start = ~~start
	  end = end === undefined ? len : ~~end
	
	  if (start < 0) {
	    start += len
	    if (start < 0) start = 0
	  } else if (start > len) {
	    start = len
	  }
	
	  if (end < 0) {
	    end += len
	    if (end < 0) end = 0
	  } else if (end > len) {
	    end = len
	  }
	
	  if (end < start) end = start
	
	  var newBuf
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    newBuf = this.subarray(start, end)
	    newBuf.__proto__ = Buffer.prototype
	  } else {
	    var sliceLen = end - start
	    newBuf = new Buffer(sliceLen, undefined)
	    for (var i = 0; i < sliceLen; ++i) {
	      newBuf[i] = this[i + start]
	    }
	  }
	
	  return newBuf
	}
	
	/*
	 * Need to make sure that buffer isn't trying to write out of bounds.
	 */
	function checkOffset (offset, ext, length) {
	  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
	  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
	}
	
	Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) checkOffset(offset, byteLength, this.length)
	
	  var val = this[offset]
	  var mul = 1
	  var i = 0
	  while (++i < byteLength && (mul *= 0x100)) {
	    val += this[offset + i] * mul
	  }
	
	  return val
	}
	
	Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) {
	    checkOffset(offset, byteLength, this.length)
	  }
	
	  var val = this[offset + --byteLength]
	  var mul = 1
	  while (byteLength > 0 && (mul *= 0x100)) {
	    val += this[offset + --byteLength] * mul
	  }
	
	  return val
	}
	
	Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 1, this.length)
	  return this[offset]
	}
	
	Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 2, this.length)
	  return this[offset] | (this[offset + 1] << 8)
	}
	
	Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 2, this.length)
	  return (this[offset] << 8) | this[offset + 1]
	}
	
	Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	
	  return ((this[offset]) |
	      (this[offset + 1] << 8) |
	      (this[offset + 2] << 16)) +
	      (this[offset + 3] * 0x1000000)
	}
	
	Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	
	  return (this[offset] * 0x1000000) +
	    ((this[offset + 1] << 16) |
	    (this[offset + 2] << 8) |
	    this[offset + 3])
	}
	
	Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) checkOffset(offset, byteLength, this.length)
	
	  var val = this[offset]
	  var mul = 1
	  var i = 0
	  while (++i < byteLength && (mul *= 0x100)) {
	    val += this[offset + i] * mul
	  }
	  mul *= 0x80
	
	  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
	
	  return val
	}
	
	Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) checkOffset(offset, byteLength, this.length)
	
	  var i = byteLength
	  var mul = 1
	  var val = this[offset + --i]
	  while (i > 0 && (mul *= 0x100)) {
	    val += this[offset + --i] * mul
	  }
	  mul *= 0x80
	
	  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
	
	  return val
	}
	
	Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 1, this.length)
	  if (!(this[offset] & 0x80)) return (this[offset])
	  return ((0xff - this[offset] + 1) * -1)
	}
	
	Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 2, this.length)
	  var val = this[offset] | (this[offset + 1] << 8)
	  return (val & 0x8000) ? val | 0xFFFF0000 : val
	}
	
	Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 2, this.length)
	  var val = this[offset + 1] | (this[offset] << 8)
	  return (val & 0x8000) ? val | 0xFFFF0000 : val
	}
	
	Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	
	  return (this[offset]) |
	    (this[offset + 1] << 8) |
	    (this[offset + 2] << 16) |
	    (this[offset + 3] << 24)
	}
	
	Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	
	  return (this[offset] << 24) |
	    (this[offset + 1] << 16) |
	    (this[offset + 2] << 8) |
	    (this[offset + 3])
	}
	
	Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	  return ieee754.read(this, offset, true, 23, 4)
	}
	
	Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 4, this.length)
	  return ieee754.read(this, offset, false, 23, 4)
	}
	
	Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 8, this.length)
	  return ieee754.read(this, offset, true, 52, 8)
	}
	
	Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
	  if (!noAssert) checkOffset(offset, 8, this.length)
	  return ieee754.read(this, offset, false, 52, 8)
	}
	
	function checkInt (buf, value, offset, ext, max, min) {
	  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
	  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
	  if (offset + ext > buf.length) throw new RangeError('Index out of range')
	}
	
	Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
	  value = +value
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) {
	    var maxBytes = Math.pow(2, 8 * byteLength) - 1
	    checkInt(this, value, offset, byteLength, maxBytes, 0)
	  }
	
	  var mul = 1
	  var i = 0
	  this[offset] = value & 0xFF
	  while (++i < byteLength && (mul *= 0x100)) {
	    this[offset + i] = (value / mul) & 0xFF
	  }
	
	  return offset + byteLength
	}
	
	Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
	  value = +value
	  offset = offset | 0
	  byteLength = byteLength | 0
	  if (!noAssert) {
	    var maxBytes = Math.pow(2, 8 * byteLength) - 1
	    checkInt(this, value, offset, byteLength, maxBytes, 0)
	  }
	
	  var i = byteLength - 1
	  var mul = 1
	  this[offset + i] = value & 0xFF
	  while (--i >= 0 && (mul *= 0x100)) {
	    this[offset + i] = (value / mul) & 0xFF
	  }
	
	  return offset + byteLength
	}
	
	Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
	  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
	  this[offset] = (value & 0xff)
	  return offset + 1
	}
	
	function objectWriteUInt16 (buf, value, offset, littleEndian) {
	  if (value < 0) value = 0xffff + value + 1
	  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
	    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
	      (littleEndian ? i : 1 - i) * 8
	  }
	}
	
	Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value & 0xff)
	    this[offset + 1] = (value >>> 8)
	  } else {
	    objectWriteUInt16(this, value, offset, true)
	  }
	  return offset + 2
	}
	
	Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value >>> 8)
	    this[offset + 1] = (value & 0xff)
	  } else {
	    objectWriteUInt16(this, value, offset, false)
	  }
	  return offset + 2
	}
	
	function objectWriteUInt32 (buf, value, offset, littleEndian) {
	  if (value < 0) value = 0xffffffff + value + 1
	  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
	    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
	  }
	}
	
	Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset + 3] = (value >>> 24)
	    this[offset + 2] = (value >>> 16)
	    this[offset + 1] = (value >>> 8)
	    this[offset] = (value & 0xff)
	  } else {
	    objectWriteUInt32(this, value, offset, true)
	  }
	  return offset + 4
	}
	
	Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value >>> 24)
	    this[offset + 1] = (value >>> 16)
	    this[offset + 2] = (value >>> 8)
	    this[offset + 3] = (value & 0xff)
	  } else {
	    objectWriteUInt32(this, value, offset, false)
	  }
	  return offset + 4
	}
	
	Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) {
	    var limit = Math.pow(2, 8 * byteLength - 1)
	
	    checkInt(this, value, offset, byteLength, limit - 1, -limit)
	  }
	
	  var i = 0
	  var mul = 1
	  var sub = 0
	  this[offset] = value & 0xFF
	  while (++i < byteLength && (mul *= 0x100)) {
	    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
	      sub = 1
	    }
	    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
	  }
	
	  return offset + byteLength
	}
	
	Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) {
	    var limit = Math.pow(2, 8 * byteLength - 1)
	
	    checkInt(this, value, offset, byteLength, limit - 1, -limit)
	  }
	
	  var i = byteLength - 1
	  var mul = 1
	  var sub = 0
	  this[offset + i] = value & 0xFF
	  while (--i >= 0 && (mul *= 0x100)) {
	    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
	      sub = 1
	    }
	    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
	  }
	
	  return offset + byteLength
	}
	
	Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
	  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
	  if (value < 0) value = 0xff + value + 1
	  this[offset] = (value & 0xff)
	  return offset + 1
	}
	
	Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value & 0xff)
	    this[offset + 1] = (value >>> 8)
	  } else {
	    objectWriteUInt16(this, value, offset, true)
	  }
	  return offset + 2
	}
	
	Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value >>> 8)
	    this[offset + 1] = (value & 0xff)
	  } else {
	    objectWriteUInt16(this, value, offset, false)
	  }
	  return offset + 2
	}
	
	Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value & 0xff)
	    this[offset + 1] = (value >>> 8)
	    this[offset + 2] = (value >>> 16)
	    this[offset + 3] = (value >>> 24)
	  } else {
	    objectWriteUInt32(this, value, offset, true)
	  }
	  return offset + 4
	}
	
	Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
	  value = +value
	  offset = offset | 0
	  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
	  if (value < 0) value = 0xffffffff + value + 1
	  if (Buffer.TYPED_ARRAY_SUPPORT) {
	    this[offset] = (value >>> 24)
	    this[offset + 1] = (value >>> 16)
	    this[offset + 2] = (value >>> 8)
	    this[offset + 3] = (value & 0xff)
	  } else {
	    objectWriteUInt32(this, value, offset, false)
	  }
	  return offset + 4
	}
	
	function checkIEEE754 (buf, value, offset, ext, max, min) {
	  if (offset + ext > buf.length) throw new RangeError('Index out of range')
	  if (offset < 0) throw new RangeError('Index out of range')
	}
	
	function writeFloat (buf, value, offset, littleEndian, noAssert) {
	  if (!noAssert) {
	    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
	  }
	  ieee754.write(buf, value, offset, littleEndian, 23, 4)
	  return offset + 4
	}
	
	Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
	  return writeFloat(this, value, offset, true, noAssert)
	}
	
	Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
	  return writeFloat(this, value, offset, false, noAssert)
	}
	
	function writeDouble (buf, value, offset, littleEndian, noAssert) {
	  if (!noAssert) {
	    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
	  }
	  ieee754.write(buf, value, offset, littleEndian, 52, 8)
	  return offset + 8
	}
	
	Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
	  return writeDouble(this, value, offset, true, noAssert)
	}
	
	Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
	  return writeDouble(this, value, offset, false, noAssert)
	}
	
	// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
	Buffer.prototype.copy = function copy (target, targetStart, start, end) {
	  if (!start) start = 0
	  if (!end && end !== 0) end = this.length
	  if (targetStart >= target.length) targetStart = target.length
	  if (!targetStart) targetStart = 0
	  if (end > 0 && end < start) end = start
	
	  // Copy 0 bytes; we're done
	  if (end === start) return 0
	  if (target.length === 0 || this.length === 0) return 0
	
	  // Fatal error conditions
	  if (targetStart < 0) {
	    throw new RangeError('targetStart out of bounds')
	  }
	  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
	  if (end < 0) throw new RangeError('sourceEnd out of bounds')
	
	  // Are we oob?
	  if (end > this.length) end = this.length
	  if (target.length - targetStart < end - start) {
	    end = target.length - targetStart + start
	  }
	
	  var len = end - start
	  var i
	
	  if (this === target && start < targetStart && targetStart < end) {
	    // descending copy from end
	    for (i = len - 1; i >= 0; --i) {
	      target[i + targetStart] = this[i + start]
	    }
	  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
	    // ascending copy from start
	    for (i = 0; i < len; ++i) {
	      target[i + targetStart] = this[i + start]
	    }
	  } else {
	    Uint8Array.prototype.set.call(
	      target,
	      this.subarray(start, start + len),
	      targetStart
	    )
	  }
	
	  return len
	}
	
	// Usage:
	//    buffer.fill(number[, offset[, end]])
	//    buffer.fill(buffer[, offset[, end]])
	//    buffer.fill(string[, offset[, end]][, encoding])
	Buffer.prototype.fill = function fill (val, start, end, encoding) {
	  // Handle string cases:
	  if (typeof val === 'string') {
	    if (typeof start === 'string') {
	      encoding = start
	      start = 0
	      end = this.length
	    } else if (typeof end === 'string') {
	      encoding = end
	      end = this.length
	    }
	    if (val.length === 1) {
	      var code = val.charCodeAt(0)
	      if (code < 256) {
	        val = code
	      }
	    }
	    if (encoding !== undefined && typeof encoding !== 'string') {
	      throw new TypeError('encoding must be a string')
	    }
	    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
	      throw new TypeError('Unknown encoding: ' + encoding)
	    }
	  } else if (typeof val === 'number') {
	    val = val & 255
	  }
	
	  // Invalid ranges are not set to a default, so can range check early.
	  if (start < 0 || this.length < start || this.length < end) {
	    throw new RangeError('Out of range index')
	  }
	
	  if (end <= start) {
	    return this
	  }
	
	  start = start >>> 0
	  end = end === undefined ? this.length : end >>> 0
	
	  if (!val) val = 0
	
	  var i
	  if (typeof val === 'number') {
	    for (i = start; i < end; ++i) {
	      this[i] = val
	    }
	  } else {
	    var bytes = Buffer.isBuffer(val)
	      ? val
	      : utf8ToBytes(new Buffer(val, encoding).toString())
	    var len = bytes.length
	    for (i = 0; i < end - start; ++i) {
	      this[i + start] = bytes[i % len]
	    }
	  }
	
	  return this
	}
	
	// HELPER FUNCTIONS
	// ================
	
	var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
	
	function base64clean (str) {
	  // Node strips out invalid characters like \n and \t from the string, base64-js does not
	  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
	  // Node converts strings with length < 2 to ''
	  if (str.length < 2) return ''
	  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
	  while (str.length % 4 !== 0) {
	    str = str + '='
	  }
	  return str
	}
	
	function stringtrim (str) {
	  if (str.trim) return str.trim()
	  return str.replace(/^\s+|\s+$/g, '')
	}
	
	function toHex (n) {
	  if (n < 16) return '0' + n.toString(16)
	  return n.toString(16)
	}
	
	function utf8ToBytes (string, units) {
	  units = units || Infinity
	  var codePoint
	  var length = string.length
	  var leadSurrogate = null
	  var bytes = []
	
	  for (var i = 0; i < length; ++i) {
	    codePoint = string.charCodeAt(i)
	
	    // is surrogate component
	    if (codePoint > 0xD7FF && codePoint < 0xE000) {
	      // last char was a lead
	      if (!leadSurrogate) {
	        // no lead yet
	        if (codePoint > 0xDBFF) {
	          // unexpected trail
	          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
	          continue
	        } else if (i + 1 === length) {
	          // unpaired lead
	          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
	          continue
	        }
	
	        // valid lead
	        leadSurrogate = codePoint
	
	        continue
	      }
	
	      // 2 leads in a row
	      if (codePoint < 0xDC00) {
	        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
	        leadSurrogate = codePoint
	        continue
	      }
	
	      // valid surrogate pair
	      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
	    } else if (leadSurrogate) {
	      // valid bmp char, but last char was a lead
	      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
	    }
	
	    leadSurrogate = null
	
	    // encode utf8
	    if (codePoint < 0x80) {
	      if ((units -= 1) < 0) break
	      bytes.push(codePoint)
	    } else if (codePoint < 0x800) {
	      if ((units -= 2) < 0) break
	      bytes.push(
	        codePoint >> 0x6 | 0xC0,
	        codePoint & 0x3F | 0x80
	      )
	    } else if (codePoint < 0x10000) {
	      if ((units -= 3) < 0) break
	      bytes.push(
	        codePoint >> 0xC | 0xE0,
	        codePoint >> 0x6 & 0x3F | 0x80,
	        codePoint & 0x3F | 0x80
	      )
	    } else if (codePoint < 0x110000) {
	      if ((units -= 4) < 0) break
	      bytes.push(
	        codePoint >> 0x12 | 0xF0,
	        codePoint >> 0xC & 0x3F | 0x80,
	        codePoint >> 0x6 & 0x3F | 0x80,
	        codePoint & 0x3F | 0x80
	      )
	    } else {
	      throw new Error('Invalid code point')
	    }
	  }
	
	  return bytes
	}
	
	function asciiToBytes (str) {
	  var byteArray = []
	  for (var i = 0; i < str.length; ++i) {
	    // Node's code seems to be doing this and not & 0x7F..
	    byteArray.push(str.charCodeAt(i) & 0xFF)
	  }
	  return byteArray
	}
	
	function utf16leToBytes (str, units) {
	  var c, hi, lo
	  var byteArray = []
	  for (var i = 0; i < str.length; ++i) {
	    if ((units -= 2) < 0) break
	
	    c = str.charCodeAt(i)
	    hi = c >> 8
	    lo = c % 256
	    byteArray.push(lo)
	    byteArray.push(hi)
	  }
	
	  return byteArray
	}
	
	function base64ToBytes (str) {
	  return base64.toByteArray(base64clean(str))
	}
	
	function blitBuffer (src, dst, offset, length) {
	  for (var i = 0; i < length; ++i) {
	    if ((i + offset >= dst.length) || (i >= src.length)) break
	    dst[i + offset] = src[i]
	  }
	  return i
	}
	
	function isnan (val) {
	  return val !== val // eslint-disable-line no-self-compare
	}
	
	/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))

/***/ }),
/* 8 */
/***/ (function(module, exports) {

	'use strict'
	
	exports.byteLength = byteLength
	exports.toByteArray = toByteArray
	exports.fromByteArray = fromByteArray
	
	var lookup = []
	var revLookup = []
	var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
	
	var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
	for (var i = 0, len = code.length; i < len; ++i) {
	  lookup[i] = code[i]
	  revLookup[code.charCodeAt(i)] = i
	}
	
	revLookup['-'.charCodeAt(0)] = 62
	revLookup['_'.charCodeAt(0)] = 63
	
	function placeHoldersCount (b64) {
	  var len = b64.length
	  if (len % 4 > 0) {
	    throw new Error('Invalid string. Length must be a multiple of 4')
	  }
	
	  // the number of equal signs (place holders)
	  // if there are two placeholders, than the two characters before it
	  // represent one byte
	  // if there is only one, then the three characters before it represent 2 bytes
	  // this is just a cheap hack to not do indexOf twice
	  return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
	}
	
	function byteLength (b64) {
	  // base64 is 4/3 + up to two characters of the original data
	  return b64.length * 3 / 4 - placeHoldersCount(b64)
	}
	
	function toByteArray (b64) {
	  var i, j, l, tmp, placeHolders, arr
	  var len = b64.length
	  placeHolders = placeHoldersCount(b64)
	
	  arr = new Arr(len * 3 / 4 - placeHolders)
	
	  // if there are placeholders, only get up to the last complete 4 chars
	  l = placeHolders > 0 ? len - 4 : len
	
	  var L = 0
	
	  for (i = 0, j = 0; i < l; i += 4, j += 3) {
	    tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
	    arr[L++] = (tmp >> 16) & 0xFF
	    arr[L++] = (tmp >> 8) & 0xFF
	    arr[L++] = tmp & 0xFF
	  }
	
	  if (placeHolders === 2) {
	    tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
	    arr[L++] = tmp & 0xFF
	  } else if (placeHolders === 1) {
	    tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
	    arr[L++] = (tmp >> 8) & 0xFF
	    arr[L++] = tmp & 0xFF
	  }
	
	  return arr
	}
	
	function tripletToBase64 (num) {
	  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
	}
	
	function encodeChunk (uint8, start, end) {
	  var tmp
	  var output = []
	  for (var i = start; i < end; i += 3) {
	    tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
	    output.push(tripletToBase64(tmp))
	  }
	  return output.join('')
	}
	
	function fromByteArray (uint8) {
	  var tmp
	  var len = uint8.length
	  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
	  var output = ''
	  var parts = []
	  var maxChunkLength = 16383 // must be multiple of 3
	
	  // go through the array every three bytes, we'll deal with trailing stuff later
	  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
	    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
	  }
	
	  // pad the end with zeros, but make sure to not forget the extra bytes
	  if (extraBytes === 1) {
	    tmp = uint8[len - 1]
	    output += lookup[tmp >> 2]
	    output += lookup[(tmp << 4) & 0x3F]
	    output += '=='
	  } else if (extraBytes === 2) {
	    tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
	    output += lookup[tmp >> 10]
	    output += lookup[(tmp >> 4) & 0x3F]
	    output += lookup[(tmp << 2) & 0x3F]
	    output += '='
	  }
	
	  parts.push(output)
	
	  return parts.join('')
	}


/***/ }),
/* 9 */
/***/ (function(module, exports) {

	exports.read = function (buffer, offset, isLE, mLen, nBytes) {
	  var e, m
	  var eLen = nBytes * 8 - mLen - 1
	  var eMax = (1 << eLen) - 1
	  var eBias = eMax >> 1
	  var nBits = -7
	  var i = isLE ? (nBytes - 1) : 0
	  var d = isLE ? -1 : 1
	  var s = buffer[offset + i]
	
	  i += d
	
	  e = s & ((1 << (-nBits)) - 1)
	  s >>= (-nBits)
	  nBits += eLen
	  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
	
	  m = e & ((1 << (-nBits)) - 1)
	  e >>= (-nBits)
	  nBits += mLen
	  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
	
	  if (e === 0) {
	    e = 1 - eBias
	  } else if (e === eMax) {
	    return m ? NaN : ((s ? -1 : 1) * Infinity)
	  } else {
	    m = m + Math.pow(2, mLen)
	    e = e - eBias
	  }
	  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
	}
	
	exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
	  var e, m, c
	  var eLen = nBytes * 8 - mLen - 1
	  var eMax = (1 << eLen) - 1
	  var eBias = eMax >> 1
	  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
	  var i = isLE ? 0 : (nBytes - 1)
	  var d = isLE ? 1 : -1
	  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
	
	  value = Math.abs(value)
	
	  if (isNaN(value) || value === Infinity) {
	    m = isNaN(value) ? 1 : 0
	    e = eMax
	  } else {
	    e = Math.floor(Math.log(value) / Math.LN2)
	    if (value * (c = Math.pow(2, -e)) < 1) {
	      e--
	      c *= 2
	    }
	    if (e + eBias >= 1) {
	      value += rt / c
	    } else {
	      value += rt * Math.pow(2, 1 - eBias)
	    }
	    if (value * c >= 2) {
	      e++
	      c /= 2
	    }
	
	    if (e + eBias >= eMax) {
	      m = 0
	      e = eMax
	    } else if (e + eBias >= 1) {
	      m = (value * c - 1) * Math.pow(2, mLen)
	      e = e + eBias
	    } else {
	      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
	      e = 0
	    }
	  }
	
	  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
	
	  e = (e << mLen) | m
	  eLen += mLen
	  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
	
	  buffer[offset + i - d] |= s * 128
	}


/***/ }),
/* 10 */
/***/ (function(module, exports) {

	var toString = {}.toString;
	
	module.exports = Array.isArray || function (arr) {
	  return toString.call(arr) == '[object Array]';
	};


/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery JavaScript Library v2.2.4
	 * http://jquery.com/
	 *
	 * Includes Sizzle.js
	 * http://sizzlejs.com/
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license
	 * http://jquery.org/license
	 *
	 * Date: 2016-05-20T17:23Z
	 */
	
	(function( global, factory ) {
	
		if ( typeof module === "object" && typeof module.exports === "object" ) {
			// For CommonJS and CommonJS-like environments where a proper `window`
			// is present, execute the factory and get jQuery.
			// For environments that do not have a `window` with a `document`
			// (such as Node.js), expose a factory as module.exports.
			// This accentuates the need for the creation of a real `window`.
			// e.g. var jQuery = require("jquery")(window);
			// See ticket #14549 for more info.
			module.exports = global.document ?
				factory( global, true ) :
				function( w ) {
					if ( !w.document ) {
						throw new Error( "jQuery requires a window with a document" );
					}
					return factory( w );
				};
		} else {
			factory( global );
		}
	
	// Pass this if window is not defined yet
	}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
	
	// Support: Firefox 18+
	// Can't be in strict mode, several libs including ASP.NET trace
	// the stack via arguments.caller.callee and Firefox dies if
	// you try to trace through "use strict" call chains. (#13335)
	//"use strict";
	var arr = [];
	
	var document = window.document;
	
	var slice = arr.slice;
	
	var concat = arr.concat;
	
	var push = arr.push;
	
	var indexOf = arr.indexOf;
	
	var class2type = {};
	
	var toString = class2type.toString;
	
	var hasOwn = class2type.hasOwnProperty;
	
	var support = {};
	
	
	
	var
		version = "2.2.4",
	
		// Define a local copy of jQuery
		jQuery = function( selector, context ) {
	
			// The jQuery object is actually just the init constructor 'enhanced'
			// Need init if jQuery is called (just allow error to be thrown if not included)
			return new jQuery.fn.init( selector, context );
		},
	
		// Support: Android<4.1
		// Make sure we trim BOM and NBSP
		rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
	
		// Matches dashed string for camelizing
		rmsPrefix = /^-ms-/,
		rdashAlpha = /-([\da-z])/gi,
	
		// Used by jQuery.camelCase as callback to replace()
		fcamelCase = function( all, letter ) {
			return letter.toUpperCase();
		};
	
	jQuery.fn = jQuery.prototype = {
	
		// The current version of jQuery being used
		jquery: version,
	
		constructor: jQuery,
	
		// Start with an empty selector
		selector: "",
	
		// The default length of a jQuery object is 0
		length: 0,
	
		toArray: function() {
			return slice.call( this );
		},
	
		// Get the Nth element in the matched element set OR
		// Get the whole matched element set as a clean array
		get: function( num ) {
			return num != null ?
	
				// Return just the one element from the set
				( num < 0 ? this[ num + this.length ] : this[ num ] ) :
	
				// Return all the elements in a clean array
				slice.call( this );
		},
	
		// Take an array of elements and push it onto the stack
		// (returning the new matched element set)
		pushStack: function( elems ) {
	
			// Build a new jQuery matched element set
			var ret = jQuery.merge( this.constructor(), elems );
	
			// Add the old object onto the stack (as a reference)
			ret.prevObject = this;
			ret.context = this.context;
	
			// Return the newly-formed element set
			return ret;
		},
	
		// Execute a callback for every element in the matched set.
		each: function( callback ) {
			return jQuery.each( this, callback );
		},
	
		map: function( callback ) {
			return this.pushStack( jQuery.map( this, function( elem, i ) {
				return callback.call( elem, i, elem );
			} ) );
		},
	
		slice: function() {
			return this.pushStack( slice.apply( this, arguments ) );
		},
	
		first: function() {
			return this.eq( 0 );
		},
	
		last: function() {
			return this.eq( -1 );
		},
	
		eq: function( i ) {
			var len = this.length,
				j = +i + ( i < 0 ? len : 0 );
			return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
		},
	
		end: function() {
			return this.prevObject || this.constructor();
		},
	
		// For internal use only.
		// Behaves like an Array's method, not like a jQuery method.
		push: push,
		sort: arr.sort,
		splice: arr.splice
	};
	
	jQuery.extend = jQuery.fn.extend = function() {
		var options, name, src, copy, copyIsArray, clone,
			target = arguments[ 0 ] || {},
			i = 1,
			length = arguments.length,
			deep = false;
	
		// Handle a deep copy situation
		if ( typeof target === "boolean" ) {
			deep = target;
	
			// Skip the boolean and the target
			target = arguments[ i ] || {};
			i++;
		}
	
		// Handle case when target is a string or something (possible in deep copy)
		if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
			target = {};
		}
	
		// Extend jQuery itself if only one argument is passed
		if ( i === length ) {
			target = this;
			i--;
		}
	
		for ( ; i < length; i++ ) {
	
			// Only deal with non-null/undefined values
			if ( ( options = arguments[ i ] ) != null ) {
	
				// Extend the base object
				for ( name in options ) {
					src = target[ name ];
					copy = options[ name ];
	
					// Prevent never-ending loop
					if ( target === copy ) {
						continue;
					}
	
					// Recurse if we're merging plain objects or arrays
					if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
						( copyIsArray = jQuery.isArray( copy ) ) ) ) {
	
						if ( copyIsArray ) {
							copyIsArray = false;
							clone = src && jQuery.isArray( src ) ? src : [];
	
						} else {
							clone = src && jQuery.isPlainObject( src ) ? src : {};
						}
	
						// Never move original objects, clone them
						target[ name ] = jQuery.extend( deep, clone, copy );
	
					// Don't bring in undefined values
					} else if ( copy !== undefined ) {
						target[ name ] = copy;
					}
				}
			}
		}
	
		// Return the modified object
		return target;
	};
	
	jQuery.extend( {
	
		// Unique for each copy of jQuery on the page
		expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
	
		// Assume jQuery is ready without the ready module
		isReady: true,
	
		error: function( msg ) {
			throw new Error( msg );
		},
	
		noop: function() {},
	
		isFunction: function( obj ) {
			return jQuery.type( obj ) === "function";
		},
	
		isArray: Array.isArray,
	
		isWindow: function( obj ) {
			return obj != null && obj === obj.window;
		},
	
		isNumeric: function( obj ) {
	
			// parseFloat NaNs numeric-cast false positives (null|true|false|"")
			// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
			// subtraction forces infinities to NaN
			// adding 1 corrects loss of precision from parseFloat (#15100)
			var realStringObj = obj && obj.toString();
			return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
		},
	
		isPlainObject: function( obj ) {
			var key;
	
			// Not plain objects:
			// - Any object or value whose internal [[Class]] property is not "[object Object]"
			// - DOM nodes
			// - window
			if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
				return false;
			}
	
			// Not own constructor property must be Object
			if ( obj.constructor &&
					!hasOwn.call( obj, "constructor" ) &&
					!hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
				return false;
			}
	
			// Own properties are enumerated firstly, so to speed up,
			// if last one is own, then all properties are own
			for ( key in obj ) {}
	
			return key === undefined || hasOwn.call( obj, key );
		},
	
		isEmptyObject: function( obj ) {
			var name;
			for ( name in obj ) {
				return false;
			}
			return true;
		},
	
		type: function( obj ) {
			if ( obj == null ) {
				return obj + "";
			}
	
			// Support: Android<4.0, iOS<6 (functionish RegExp)
			return typeof obj === "object" || typeof obj === "function" ?
				class2type[ toString.call( obj ) ] || "object" :
				typeof obj;
		},
	
		// Evaluates a script in a global context
		globalEval: function( code ) {
			var script,
				indirect = eval;
	
			code = jQuery.trim( code );
	
			if ( code ) {
	
				// If the code includes a valid, prologue position
				// strict mode pragma, execute code by injecting a
				// script tag into the document.
				if ( code.indexOf( "use strict" ) === 1 ) {
					script = document.createElement( "script" );
					script.text = code;
					document.head.appendChild( script ).parentNode.removeChild( script );
				} else {
	
					// Otherwise, avoid the DOM node creation, insertion
					// and removal by using an indirect global eval
	
					indirect( code );
				}
			}
		},
	
		// Convert dashed to camelCase; used by the css and data modules
		// Support: IE9-11+
		// Microsoft forgot to hump their vendor prefix (#9572)
		camelCase: function( string ) {
			return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
		},
	
		nodeName: function( elem, name ) {
			return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
		},
	
		each: function( obj, callback ) {
			var length, i = 0;
	
			if ( isArrayLike( obj ) ) {
				length = obj.length;
				for ( ; i < length; i++ ) {
					if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
						break;
					}
				}
			} else {
				for ( i in obj ) {
					if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
						break;
					}
				}
			}
	
			return obj;
		},
	
		// Support: Android<4.1
		trim: function( text ) {
			return text == null ?
				"" :
				( text + "" ).replace( rtrim, "" );
		},
	
		// results is for internal usage only
		makeArray: function( arr, results ) {
			var ret = results || [];
	
			if ( arr != null ) {
				if ( isArrayLike( Object( arr ) ) ) {
					jQuery.merge( ret,
						typeof arr === "string" ?
						[ arr ] : arr
					);
				} else {
					push.call( ret, arr );
				}
			}
	
			return ret;
		},
	
		inArray: function( elem, arr, i ) {
			return arr == null ? -1 : indexOf.call( arr, elem, i );
		},
	
		merge: function( first, second ) {
			var len = +second.length,
				j = 0,
				i = first.length;
	
			for ( ; j < len; j++ ) {
				first[ i++ ] = second[ j ];
			}
	
			first.length = i;
	
			return first;
		},
	
		grep: function( elems, callback, invert ) {
			var callbackInverse,
				matches = [],
				i = 0,
				length = elems.length,
				callbackExpect = !invert;
	
			// Go through the array, only saving the items
			// that pass the validator function
			for ( ; i < length; i++ ) {
				callbackInverse = !callback( elems[ i ], i );
				if ( callbackInverse !== callbackExpect ) {
					matches.push( elems[ i ] );
				}
			}
	
			return matches;
		},
	
		// arg is for internal usage only
		map: function( elems, callback, arg ) {
			var length, value,
				i = 0,
				ret = [];
	
			// Go through the array, translating each of the items to their new values
			if ( isArrayLike( elems ) ) {
				length = elems.length;
				for ( ; i < length; i++ ) {
					value = callback( elems[ i ], i, arg );
	
					if ( value != null ) {
						ret.push( value );
					}
				}
	
			// Go through every key on the object,
			} else {
				for ( i in elems ) {
					value = callback( elems[ i ], i, arg );
	
					if ( value != null ) {
						ret.push( value );
					}
				}
			}
	
			// Flatten any nested arrays
			return concat.apply( [], ret );
		},
	
		// A global GUID counter for objects
		guid: 1,
	
		// Bind a function to a context, optionally partially applying any
		// arguments.
		proxy: function( fn, context ) {
			var tmp, args, proxy;
	
			if ( typeof context === "string" ) {
				tmp = fn[ context ];
				context = fn;
				fn = tmp;
			}
	
			// Quick check to determine if target is callable, in the spec
			// this throws a TypeError, but we will just return undefined.
			if ( !jQuery.isFunction( fn ) ) {
				return undefined;
			}
	
			// Simulated bind
			args = slice.call( arguments, 2 );
			proxy = function() {
				return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
			};
	
			// Set the guid of unique handler to the same of original handler, so it can be removed
			proxy.guid = fn.guid = fn.guid || jQuery.guid++;
	
			return proxy;
		},
	
		now: Date.now,
	
		// jQuery.support is not used in Core but other projects attach their
		// properties to it so it needs to exist.
		support: support
	} );
	
	// JSHint would error on this code due to the Symbol not being defined in ES5.
	// Defining this global in .jshintrc would create a danger of using the global
	// unguarded in another place, it seems safer to just disable JSHint for these
	// three lines.
	/* jshint ignore: start */
	if ( typeof Symbol === "function" ) {
		jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
	}
	/* jshint ignore: end */
	
	// Populate the class2type map
	jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
	function( i, name ) {
		class2type[ "[object " + name + "]" ] = name.toLowerCase();
	} );
	
	function isArrayLike( obj ) {
	
		// Support: iOS 8.2 (not reproducible in simulator)
		// `in` check used to prevent JIT error (gh-2145)
		// hasOwn isn't used here due to false negatives
		// regarding Nodelist length in IE
		var length = !!obj && "length" in obj && obj.length,
			type = jQuery.type( obj );
	
		if ( type === "function" || jQuery.isWindow( obj ) ) {
			return false;
		}
	
		return type === "array" || length === 0 ||
			typeof length === "number" && length > 0 && ( length - 1 ) in obj;
	}
	var Sizzle =
	/*!
	 * Sizzle CSS Selector Engine v2.2.1
	 * http://sizzlejs.com/
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license
	 * http://jquery.org/license
	 *
	 * Date: 2015-10-17
	 */
	(function( window ) {
	
	var i,
		support,
		Expr,
		getText,
		isXML,
		tokenize,
		compile,
		select,
		outermostContext,
		sortInput,
		hasDuplicate,
	
		// Local document vars
		setDocument,
		document,
		docElem,
		documentIsHTML,
		rbuggyQSA,
		rbuggyMatches,
		matches,
		contains,
	
		// Instance-specific data
		expando = "sizzle" + 1 * new Date(),
		preferredDoc = window.document,
		dirruns = 0,
		done = 0,
		classCache = createCache(),
		tokenCache = createCache(),
		compilerCache = createCache(),
		sortOrder = function( a, b ) {
			if ( a === b ) {
				hasDuplicate = true;
			}
			return 0;
		},
	
		// General-purpose constants
		MAX_NEGATIVE = 1 << 31,
	
		// Instance methods
		hasOwn = ({}).hasOwnProperty,
		arr = [],
		pop = arr.pop,
		push_native = arr.push,
		push = arr.push,
		slice = arr.slice,
		// Use a stripped-down indexOf as it's faster than native
		// http://jsperf.com/thor-indexof-vs-for/5
		indexOf = function( list, elem ) {
			var i = 0,
				len = list.length;
			for ( ; i < len; i++ ) {
				if ( list[i] === elem ) {
					return i;
				}
			}
			return -1;
		},
	
		booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
	
		// Regular expressions
	
		// http://www.w3.org/TR/css3-selectors/#whitespace
		whitespace = "[\\x20\\t\\r\\n\\f]",
	
		// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
		identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
	
		// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
		attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
			// Operator (capture 2)
			"*([*^$|!~]?=)" + whitespace +
			// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
			"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
			"*\\]",
	
		pseudos = ":(" + identifier + ")(?:\\((" +
			// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
			// 1. quoted (capture 3; capture 4 or capture 5)
			"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
			// 2. simple (capture 6)
			"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
			// 3. anything else (capture 2)
			".*" +
			")\\)|)",
	
		// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
		rwhitespace = new RegExp( whitespace + "+", "g" ),
		rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
	
		rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
		rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
	
		rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
	
		rpseudo = new RegExp( pseudos ),
		ridentifier = new RegExp( "^" + identifier + "$" ),
	
		matchExpr = {
			"ID": new RegExp( "^#(" + identifier + ")" ),
			"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
			"TAG": new RegExp( "^(" + identifier + "|[*])" ),
			"ATTR": new RegExp( "^" + attributes ),
			"PSEUDO": new RegExp( "^" + pseudos ),
			"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
				"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
				"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
			"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
			// For use in libraries implementing .is()
			// We use this for POS matching in `select`
			"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
				whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
		},
	
		rinputs = /^(?:input|select|textarea|button)$/i,
		rheader = /^h\d$/i,
	
		rnative = /^[^{]+\{\s*\[native \w/,
	
		// Easily-parseable/retrievable ID or TAG or CLASS selectors
		rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
	
		rsibling = /[+~]/,
		rescape = /'|\\/g,
	
		// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
		runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
		funescape = function( _, escaped, escapedWhitespace ) {
			var high = "0x" + escaped - 0x10000;
			// NaN means non-codepoint
			// Support: Firefox<24
			// Workaround erroneous numeric interpretation of +"0x"
			return high !== high || escapedWhitespace ?
				escaped :
				high < 0 ?
					// BMP codepoint
					String.fromCharCode( high + 0x10000 ) :
					// Supplemental Plane codepoint (surrogate pair)
					String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
		},
	
		// Used for iframes
		// See setDocument()
		// Removing the function wrapper causes a "Permission Denied"
		// error in IE
		unloadHandler = function() {
			setDocument();
		};
	
	// Optimize for push.apply( _, NodeList )
	try {
		push.apply(
			(arr = slice.call( preferredDoc.childNodes )),
			preferredDoc.childNodes
		);
		// Support: Android<4.0
		// Detect silently failing push.apply
		arr[ preferredDoc.childNodes.length ].nodeType;
	} catch ( e ) {
		push = { apply: arr.length ?
	
			// Leverage slice if possible
			function( target, els ) {
				push_native.apply( target, slice.call(els) );
			} :
	
			// Support: IE<9
			// Otherwise append directly
			function( target, els ) {
				var j = target.length,
					i = 0;
				// Can't trust NodeList.length
				while ( (target[j++] = els[i++]) ) {}
				target.length = j - 1;
			}
		};
	}
	
	function Sizzle( selector, context, results, seed ) {
		var m, i, elem, nid, nidselect, match, groups, newSelector,
			newContext = context && context.ownerDocument,
	
			// nodeType defaults to 9, since context defaults to document
			nodeType = context ? context.nodeType : 9;
	
		results = results || [];
	
		// Return early from calls with invalid selector or context
		if ( typeof selector !== "string" || !selector ||
			nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
	
			return results;
		}
	
		// Try to shortcut find operations (as opposed to filters) in HTML documents
		if ( !seed ) {
	
			if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
				setDocument( context );
			}
			context = context || document;
	
			if ( documentIsHTML ) {
	
				// If the selector is sufficiently simple, try using a "get*By*" DOM method
				// (excepting DocumentFragment context, where the methods don't exist)
				if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
	
					// ID selector
					if ( (m = match[1]) ) {
	
						// Document context
						if ( nodeType === 9 ) {
							if ( (elem = context.getElementById( m )) ) {
	
								// Support: IE, Opera, Webkit
								// TODO: identify versions
								// getElementById can match elements by name instead of ID
								if ( elem.id === m ) {
									results.push( elem );
									return results;
								}
							} else {
								return results;
							}
	
						// Element context
						} else {
	
							// Support: IE, Opera, Webkit
							// TODO: identify versions
							// getElementById can match elements by name instead of ID
							if ( newContext && (elem = newContext.getElementById( m )) &&
								contains( context, elem ) &&
								elem.id === m ) {
	
								results.push( elem );
								return results;
							}
						}
	
					// Type selector
					} else if ( match[2] ) {
						push.apply( results, context.getElementsByTagName( selector ) );
						return results;
	
					// Class selector
					} else if ( (m = match[3]) && support.getElementsByClassName &&
						context.getElementsByClassName ) {
	
						push.apply( results, context.getElementsByClassName( m ) );
						return results;
					}
				}
	
				// Take advantage of querySelectorAll
				if ( support.qsa &&
					!compilerCache[ selector + " " ] &&
					(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
	
					if ( nodeType !== 1 ) {
						newContext = context;
						newSelector = selector;
	
					// qSA looks outside Element context, which is not what we want
					// Thanks to Andrew Dupont for this workaround technique
					// Support: IE <=8
					// Exclude object elements
					} else if ( context.nodeName.toLowerCase() !== "object" ) {
	
						// Capture the context ID, setting it first if necessary
						if ( (nid = context.getAttribute( "id" )) ) {
							nid = nid.replace( rescape, "\\$&" );
						} else {
							context.setAttribute( "id", (nid = expando) );
						}
	
						// Prefix every selector in the list
						groups = tokenize( selector );
						i = groups.length;
						nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
						while ( i-- ) {
							groups[i] = nidselect + " " + toSelector( groups[i] );
						}
						newSelector = groups.join( "," );
	
						// Expand context for sibling selectors
						newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
							context;
					}
	
					if ( newSelector ) {
						try {
							push.apply( results,
								newContext.querySelectorAll( newSelector )
							);
							return results;
						} catch ( qsaError ) {
						} finally {
							if ( nid === expando ) {
								context.removeAttribute( "id" );
							}
						}
					}
				}
			}
		}
	
		// All others
		return select( selector.replace( rtrim, "$1" ), context, results, seed );
	}
	
	/**
	 * Create key-value caches of limited size
	 * @returns {function(string, object)} Returns the Object data after storing it on itself with
	 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
	 *	deleting the oldest entry
	 */
	function createCache() {
		var keys = [];
	
		function cache( key, value ) {
			// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
			if ( keys.push( key + " " ) > Expr.cacheLength ) {
				// Only keep the most recent entries
				delete cache[ keys.shift() ];
			}
			return (cache[ key + " " ] = value);
		}
		return cache;
	}
	
	/**
	 * Mark a function for special use by Sizzle
	 * @param {Function} fn The function to mark
	 */
	function markFunction( fn ) {
		fn[ expando ] = true;
		return fn;
	}
	
	/**
	 * Support testing using an element
	 * @param {Function} fn Passed the created div and expects a boolean result
	 */
	function assert( fn ) {
		var div = document.createElement("div");
	
		try {
			return !!fn( div );
		} catch (e) {
			return false;
		} finally {
			// Remove from its parent by default
			if ( div.parentNode ) {
				div.parentNode.removeChild( div );
			}
			// release memory in IE
			div = null;
		}
	}
	
	/**
	 * Adds the same handler for all of the specified attrs
	 * @param {String} attrs Pipe-separated list of attributes
	 * @param {Function} handler The method that will be applied
	 */
	function addHandle( attrs, handler ) {
		var arr = attrs.split("|"),
			i = arr.length;
	
		while ( i-- ) {
			Expr.attrHandle[ arr[i] ] = handler;
		}
	}
	
	/**
	 * Checks document order of two siblings
	 * @param {Element} a
	 * @param {Element} b
	 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
	 */
	function siblingCheck( a, b ) {
		var cur = b && a,
			diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
				( ~b.sourceIndex || MAX_NEGATIVE ) -
				( ~a.sourceIndex || MAX_NEGATIVE );
	
		// Use IE sourceIndex if available on both nodes
		if ( diff ) {
			return diff;
		}
	
		// Check if b follows a
		if ( cur ) {
			while ( (cur = cur.nextSibling) ) {
				if ( cur === b ) {
					return -1;
				}
			}
		}
	
		return a ? 1 : -1;
	}
	
	/**
	 * Returns a function to use in pseudos for input types
	 * @param {String} type
	 */
	function createInputPseudo( type ) {
		return function( elem ) {
			var name = elem.nodeName.toLowerCase();
			return name === "input" && elem.type === type;
		};
	}
	
	/**
	 * Returns a function to use in pseudos for buttons
	 * @param {String} type
	 */
	function createButtonPseudo( type ) {
		return function( elem ) {
			var name = elem.nodeName.toLowerCase();
			return (name === "input" || name === "button") && elem.type === type;
		};
	}
	
	/**
	 * Returns a function to use in pseudos for positionals
	 * @param {Function} fn
	 */
	function createPositionalPseudo( fn ) {
		return markFunction(function( argument ) {
			argument = +argument;
			return markFunction(function( seed, matches ) {
				var j,
					matchIndexes = fn( [], seed.length, argument ),
					i = matchIndexes.length;
	
				// Match elements found at the specified indexes
				while ( i-- ) {
					if ( seed[ (j = matchIndexes[i]) ] ) {
						seed[j] = !(matches[j] = seed[j]);
					}
				}
			});
		});
	}
	
	/**
	 * Checks a node for validity as a Sizzle context
	 * @param {Element|Object=} context
	 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
	 */
	function testContext( context ) {
		return context && typeof context.getElementsByTagName !== "undefined" && context;
	}
	
	// Expose support vars for convenience
	support = Sizzle.support = {};
	
	/**
	 * Detects XML nodes
	 * @param {Element|Object} elem An element or a document
	 * @returns {Boolean} True iff elem is a non-HTML XML node
	 */
	isXML = Sizzle.isXML = function( elem ) {
		// documentElement is verified for cases where it doesn't yet exist
		// (such as loading iframes in IE - #4833)
		var documentElement = elem && (elem.ownerDocument || elem).documentElement;
		return documentElement ? documentElement.nodeName !== "HTML" : false;
	};
	
	/**
	 * Sets document-related variables once based on the current document
	 * @param {Element|Object} [doc] An element or document object to use to set the document
	 * @returns {Object} Returns the current document
	 */
	setDocument = Sizzle.setDocument = function( node ) {
		var hasCompare, parent,
			doc = node ? node.ownerDocument || node : preferredDoc;
	
		// Return early if doc is invalid or already selected
		if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
			return document;
		}
	
		// Update global variables
		document = doc;
		docElem = document.documentElement;
		documentIsHTML = !isXML( document );
	
		// Support: IE 9-11, Edge
		// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
		if ( (parent = document.defaultView) && parent.top !== parent ) {
			// Support: IE 11
			if ( parent.addEventListener ) {
				parent.addEventListener( "unload", unloadHandler, false );
	
			// Support: IE 9 - 10 only
			} else if ( parent.attachEvent ) {
				parent.attachEvent( "onunload", unloadHandler );
			}
		}
	
		/* Attributes
		---------------------------------------------------------------------- */
	
		// Support: IE<8
		// Verify that getAttribute really returns attributes and not properties
		// (excepting IE8 booleans)
		support.attributes = assert(function( div ) {
			div.className = "i";
			return !div.getAttribute("className");
		});
	
		/* getElement(s)By*
		---------------------------------------------------------------------- */
	
		// Check if getElementsByTagName("*") returns only elements
		support.getElementsByTagName = assert(function( div ) {
			div.appendChild( document.createComment("") );
			return !div.getElementsByTagName("*").length;
		});
	
		// Support: IE<9
		support.getElementsByClassName = rnative.test( document.getElementsByClassName );
	
		// Support: IE<10
		// Check if getElementById returns elements by name
		// The broken getElementById methods don't pick up programatically-set names,
		// so use a roundabout getElementsByName test
		support.getById = assert(function( div ) {
			docElem.appendChild( div ).id = expando;
			return !document.getElementsByName || !document.getElementsByName( expando ).length;
		});
	
		// ID find and filter
		if ( support.getById ) {
			Expr.find["ID"] = function( id, context ) {
				if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
					var m = context.getElementById( id );
					return m ? [ m ] : [];
				}
			};
			Expr.filter["ID"] = function( id ) {
				var attrId = id.replace( runescape, funescape );
				return function( elem ) {
					return elem.getAttribute("id") === attrId;
				};
			};
		} else {
			// Support: IE6/7
			// getElementById is not reliable as a find shortcut
			delete Expr.find["ID"];
	
			Expr.filter["ID"] =  function( id ) {
				var attrId = id.replace( runescape, funescape );
				return function( elem ) {
					var node = typeof elem.getAttributeNode !== "undefined" &&
						elem.getAttributeNode("id");
					return node && node.value === attrId;
				};
			};
		}
	
		// Tag
		Expr.find["TAG"] = support.getElementsByTagName ?
			function( tag, context ) {
				if ( typeof context.getElementsByTagName !== "undefined" ) {
					return context.getElementsByTagName( tag );
	
				// DocumentFragment nodes don't have gEBTN
				} else if ( support.qsa ) {
					return context.querySelectorAll( tag );
				}
			} :
	
			function( tag, context ) {
				var elem,
					tmp = [],
					i = 0,
					// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
					results = context.getElementsByTagName( tag );
	
				// Filter out possible comments
				if ( tag === "*" ) {
					while ( (elem = results[i++]) ) {
						if ( elem.nodeType === 1 ) {
							tmp.push( elem );
						}
					}
	
					return tmp;
				}
				return results;
			};
	
		// Class
		Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
			if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
				return context.getElementsByClassName( className );
			}
		};
	
		/* QSA/matchesSelector
		---------------------------------------------------------------------- */
	
		// QSA and matchesSelector support
	
		// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
		rbuggyMatches = [];
	
		// qSa(:focus) reports false when true (Chrome 21)
		// We allow this because of a bug in IE8/9 that throws an error
		// whenever `document.activeElement` is accessed on an iframe
		// So, we allow :focus to pass through QSA all the time to avoid the IE error
		// See http://bugs.jquery.com/ticket/13378
		rbuggyQSA = [];
	
		if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
			// Build QSA regex
			// Regex strategy adopted from Diego Perini
			assert(function( div ) {
				// Select is set to empty string on purpose
				// This is to test IE's treatment of not explicitly
				// setting a boolean content attribute,
				// since its presence should be enough
				// http://bugs.jquery.com/ticket/12359
				docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
					"<select id='" + expando + "-\r\\' msallowcapture=''>" +
					"<option selected=''></option></select>";
	
				// Support: IE8, Opera 11-12.16
				// Nothing should be selected when empty strings follow ^= or $= or *=
				// The test attribute must be unknown in Opera but "safe" for WinRT
				// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
				if ( div.querySelectorAll("[msallowcapture^='']").length ) {
					rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
				}
	
				// Support: IE8
				// Boolean attributes and "value" are not treated correctly
				if ( !div.querySelectorAll("[selected]").length ) {
					rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
				}
	
				// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
				if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
					rbuggyQSA.push("~=");
				}
	
				// Webkit/Opera - :checked should return selected option elements
				// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
				// IE8 throws error here and will not see later tests
				if ( !div.querySelectorAll(":checked").length ) {
					rbuggyQSA.push(":checked");
				}
	
				// Support: Safari 8+, iOS 8+
				// https://bugs.webkit.org/show_bug.cgi?id=136851
				// In-page `selector#id sibing-combinator selector` fails
				if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
					rbuggyQSA.push(".#.+[+~]");
				}
			});
	
			assert(function( div ) {
				// Support: Windows 8 Native Apps
				// The type and name attributes are restricted during .innerHTML assignment
				var input = document.createElement("input");
				input.setAttribute( "type", "hidden" );
				div.appendChild( input ).setAttribute( "name", "D" );
	
				// Support: IE8
				// Enforce case-sensitivity of name attribute
				if ( div.querySelectorAll("[name=d]").length ) {
					rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
				}
	
				// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
				// IE8 throws error here and will not see later tests
				if ( !div.querySelectorAll(":enabled").length ) {
					rbuggyQSA.push( ":enabled", ":disabled" );
				}
	
				// Opera 10-11 does not throw on post-comma invalid pseudos
				div.querySelectorAll("*,:x");
				rbuggyQSA.push(",.*:");
			});
		}
	
		if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
			docElem.webkitMatchesSelector ||
			docElem.mozMatchesSelector ||
			docElem.oMatchesSelector ||
			docElem.msMatchesSelector) )) ) {
	
			assert(function( div ) {
				// Check to see if it's possible to do matchesSelector
				// on a disconnected node (IE 9)
				support.disconnectedMatch = matches.call( div, "div" );
	
				// This should fail with an exception
				// Gecko does not error, returns false instead
				matches.call( div, "[s!='']:x" );
				rbuggyMatches.push( "!=", pseudos );
			});
		}
	
		rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
		rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
	
		/* Contains
		---------------------------------------------------------------------- */
		hasCompare = rnative.test( docElem.compareDocumentPosition );
	
		// Element contains another
		// Purposefully self-exclusive
		// As in, an element does not contain itself
		contains = hasCompare || rnative.test( docElem.contains ) ?
			function( a, b ) {
				var adown = a.nodeType === 9 ? a.documentElement : a,
					bup = b && b.parentNode;
				return a === bup || !!( bup && bup.nodeType === 1 && (
					adown.contains ?
						adown.contains( bup ) :
						a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
				));
			} :
			function( a, b ) {
				if ( b ) {
					while ( (b = b.parentNode) ) {
						if ( b === a ) {
							return true;
						}
					}
				}
				return false;
			};
	
		/* Sorting
		---------------------------------------------------------------------- */
	
		// Document order sorting
		sortOrder = hasCompare ?
		function( a, b ) {
	
			// Flag for duplicate removal
			if ( a === b ) {
				hasDuplicate = true;
				return 0;
			}
	
			// Sort on method existence if only one input has compareDocumentPosition
			var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
			if ( compare ) {
				return compare;
			}
	
			// Calculate position if both inputs belong to the same document
			compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
				a.compareDocumentPosition( b ) :
	
				// Otherwise we know they are disconnected
				1;
	
			// Disconnected nodes
			if ( compare & 1 ||
				(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
	
				// Choose the first element that is related to our preferred document
				if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
					return -1;
				}
				if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
					return 1;
				}
	
				// Maintain original order
				return sortInput ?
					( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
					0;
			}
	
			return compare & 4 ? -1 : 1;
		} :
		function( a, b ) {
			// Exit early if the nodes are identical
			if ( a === b ) {
				hasDuplicate = true;
				return 0;
			}
	
			var cur,
				i = 0,
				aup = a.parentNode,
				bup = b.parentNode,
				ap = [ a ],
				bp = [ b ];
	
			// Parentless nodes are either documents or disconnected
			if ( !aup || !bup ) {
				return a === document ? -1 :
					b === document ? 1 :
					aup ? -1 :
					bup ? 1 :
					sortInput ?
					( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
					0;
	
			// If the nodes are siblings, we can do a quick check
			} else if ( aup === bup ) {
				return siblingCheck( a, b );
			}
	
			// Otherwise we need full lists of their ancestors for comparison
			cur = a;
			while ( (cur = cur.parentNode) ) {
				ap.unshift( cur );
			}
			cur = b;
			while ( (cur = cur.parentNode) ) {
				bp.unshift( cur );
			}
	
			// Walk down the tree looking for a discrepancy
			while ( ap[i] === bp[i] ) {
				i++;
			}
	
			return i ?
				// Do a sibling check if the nodes have a common ancestor
				siblingCheck( ap[i], bp[i] ) :
	
				// Otherwise nodes in our document sort first
				ap[i] === preferredDoc ? -1 :
				bp[i] === preferredDoc ? 1 :
				0;
		};
	
		return document;
	};
	
	Sizzle.matches = function( expr, elements ) {
		return Sizzle( expr, null, null, elements );
	};
	
	Sizzle.matchesSelector = function( elem, expr ) {
		// Set document vars if needed
		if ( ( elem.ownerDocument || elem ) !== document ) {
			setDocument( elem );
		}
	
		// Make sure that attribute selectors are quoted
		expr = expr.replace( rattributeQuotes, "='$1']" );
	
		if ( support.matchesSelector && documentIsHTML &&
			!compilerCache[ expr + " " ] &&
			( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
			( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
	
			try {
				var ret = matches.call( elem, expr );
	
				// IE 9's matchesSelector returns false on disconnected nodes
				if ( ret || support.disconnectedMatch ||
						// As well, disconnected nodes are said to be in a document
						// fragment in IE 9
						elem.document && elem.document.nodeType !== 11 ) {
					return ret;
				}
			} catch (e) {}
		}
	
		return Sizzle( expr, document, null, [ elem ] ).length > 0;
	};
	
	Sizzle.contains = function( context, elem ) {
		// Set document vars if needed
		if ( ( context.ownerDocument || context ) !== document ) {
			setDocument( context );
		}
		return contains( context, elem );
	};
	
	Sizzle.attr = function( elem, name ) {
		// Set document vars if needed
		if ( ( elem.ownerDocument || elem ) !== document ) {
			setDocument( elem );
		}
	
		var fn = Expr.attrHandle[ name.toLowerCase() ],
			// Don't get fooled by Object.prototype properties (jQuery #13807)
			val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
				fn( elem, name, !documentIsHTML ) :
				undefined;
	
		return val !== undefined ?
			val :
			support.attributes || !documentIsHTML ?
				elem.getAttribute( name ) :
				(val = elem.getAttributeNode(name)) && val.specified ?
					val.value :
					null;
	};
	
	Sizzle.error = function( msg ) {
		throw new Error( "Syntax error, unrecognized expression: " + msg );
	};
	
	/**
	 * Document sorting and removing duplicates
	 * @param {ArrayLike} results
	 */
	Sizzle.uniqueSort = function( results ) {
		var elem,
			duplicates = [],
			j = 0,
			i = 0;
	
		// Unless we *know* we can detect duplicates, assume their presence
		hasDuplicate = !support.detectDuplicates;
		sortInput = !support.sortStable && results.slice( 0 );
		results.sort( sortOrder );
	
		if ( hasDuplicate ) {
			while ( (elem = results[i++]) ) {
				if ( elem === results[ i ] ) {
					j = duplicates.push( i );
				}
			}
			while ( j-- ) {
				results.splice( duplicates[ j ], 1 );
			}
		}
	
		// Clear input after sorting to release objects
		// See https://github.com/jquery/sizzle/pull/225
		sortInput = null;
	
		return results;
	};
	
	/**
	 * Utility function for retrieving the text value of an array of DOM nodes
	 * @param {Array|Element} elem
	 */
	getText = Sizzle.getText = function( elem ) {
		var node,
			ret = "",
			i = 0,
			nodeType = elem.nodeType;
	
		if ( !nodeType ) {
			// If no nodeType, this is expected to be an array
			while ( (node = elem[i++]) ) {
				// Do not traverse comment nodes
				ret += getText( node );
			}
		} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
			// Use textContent for elements
			// innerText usage removed for consistency of new lines (jQuery #11153)
			if ( typeof elem.textContent === "string" ) {
				return elem.textContent;
			} else {
				// Traverse its children
				for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
					ret += getText( elem );
				}
			}
		} else if ( nodeType === 3 || nodeType === 4 ) {
			return elem.nodeValue;
		}
		// Do not include comment or processing instruction nodes
	
		return ret;
	};
	
	Expr = Sizzle.selectors = {
	
		// Can be adjusted by the user
		cacheLength: 50,
	
		createPseudo: markFunction,
	
		match: matchExpr,
	
		attrHandle: {},
	
		find: {},
	
		relative: {
			">": { dir: "parentNode", first: true },
			" ": { dir: "parentNode" },
			"+": { dir: "previousSibling", first: true },
			"~": { dir: "previousSibling" }
		},
	
		preFilter: {
			"ATTR": function( match ) {
				match[1] = match[1].replace( runescape, funescape );
	
				// Move the given value to match[3] whether quoted or unquoted
				match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
	
				if ( match[2] === "~=" ) {
					match[3] = " " + match[3] + " ";
				}
	
				return match.slice( 0, 4 );
			},
	
			"CHILD": function( match ) {
				/* matches from matchExpr["CHILD"]
					1 type (only|nth|...)
					2 what (child|of-type)
					3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
					4 xn-component of xn+y argument ([+-]?\d*n|)
					5 sign of xn-component
					6 x of xn-component
					7 sign of y-component
					8 y of y-component
				*/
				match[1] = match[1].toLowerCase();
	
				if ( match[1].slice( 0, 3 ) === "nth" ) {
					// nth-* requires argument
					if ( !match[3] ) {
						Sizzle.error( match[0] );
					}
	
					// numeric x and y parameters for Expr.filter.CHILD
					// remember that false/true cast respectively to 0/1
					match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
					match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
	
				// other types prohibit arguments
				} else if ( match[3] ) {
					Sizzle.error( match[0] );
				}
	
				return match;
			},
	
			"PSEUDO": function( match ) {
				var excess,
					unquoted = !match[6] && match[2];
	
				if ( matchExpr["CHILD"].test( match[0] ) ) {
					return null;
				}
	
				// Accept quoted arguments as-is
				if ( match[3] ) {
					match[2] = match[4] || match[5] || "";
	
				// Strip excess characters from unquoted arguments
				} else if ( unquoted && rpseudo.test( unquoted ) &&
					// Get excess from tokenize (recursively)
					(excess = tokenize( unquoted, true )) &&
					// advance to the next closing parenthesis
					(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
	
					// excess is a negative index
					match[0] = match[0].slice( 0, excess );
					match[2] = unquoted.slice( 0, excess );
				}
	
				// Return only captures needed by the pseudo filter method (type and argument)
				return match.slice( 0, 3 );
			}
		},
	
		filter: {
	
			"TAG": function( nodeNameSelector ) {
				var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
				return nodeNameSelector === "*" ?
					function() { return true; } :
					function( elem ) {
						return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
					};
			},
	
			"CLASS": function( className ) {
				var pattern = classCache[ className + " " ];
	
				return pattern ||
					(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
					classCache( className, function( elem ) {
						return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
					});
			},
	
			"ATTR": function( name, operator, check ) {
				return function( elem ) {
					var result = Sizzle.attr( elem, name );
	
					if ( result == null ) {
						return operator === "!=";
					}
					if ( !operator ) {
						return true;
					}
	
					result += "";
	
					return operator === "=" ? result === check :
						operator === "!=" ? result !== check :
						operator === "^=" ? check && result.indexOf( check ) === 0 :
						operator === "*=" ? check && result.indexOf( check ) > -1 :
						operator === "$=" ? check && result.slice( -check.length ) === check :
						operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
						operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
						false;
				};
			},
	
			"CHILD": function( type, what, argument, first, last ) {
				var simple = type.slice( 0, 3 ) !== "nth",
					forward = type.slice( -4 ) !== "last",
					ofType = what === "of-type";
	
				return first === 1 && last === 0 ?
	
					// Shortcut for :nth-*(n)
					function( elem ) {
						return !!elem.parentNode;
					} :
	
					function( elem, context, xml ) {
						var cache, uniqueCache, outerCache, node, nodeIndex, start,
							dir = simple !== forward ? "nextSibling" : "previousSibling",
							parent = elem.parentNode,
							name = ofType && elem.nodeName.toLowerCase(),
							useCache = !xml && !ofType,
							diff = false;
	
						if ( parent ) {
	
							// :(first|last|only)-(child|of-type)
							if ( simple ) {
								while ( dir ) {
									node = elem;
									while ( (node = node[ dir ]) ) {
										if ( ofType ?
											node.nodeName.toLowerCase() === name :
											node.nodeType === 1 ) {
	
											return false;
										}
									}
									// Reverse direction for :only-* (if we haven't yet done so)
									start = dir = type === "only" && !start && "nextSibling";
								}
								return true;
							}
	
							start = [ forward ? parent.firstChild : parent.lastChild ];
	
							// non-xml :nth-child(...) stores cache data on `parent`
							if ( forward && useCache ) {
	
								// Seek `elem` from a previously-cached index
	
								// ...in a gzip-friendly way
								node = parent;
								outerCache = node[ expando ] || (node[ expando ] = {});
	
								// Support: IE <9 only
								// Defend against cloned attroperties (jQuery gh-1709)
								uniqueCache = outerCache[ node.uniqueID ] ||
									(outerCache[ node.uniqueID ] = {});
	
								cache = uniqueCache[ type ] || [];
								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
								diff = nodeIndex && cache[ 2 ];
								node = nodeIndex && parent.childNodes[ nodeIndex ];
	
								while ( (node = ++nodeIndex && node && node[ dir ] ||
	
									// Fallback to seeking `elem` from the start
									(diff = nodeIndex = 0) || start.pop()) ) {
	
									// When found, cache indexes on `parent` and break
									if ( node.nodeType === 1 && ++diff && node === elem ) {
										uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
										break;
									}
								}
	
							} else {
								// Use previously-cached element index if available
								if ( useCache ) {
									// ...in a gzip-friendly way
									node = elem;
									outerCache = node[ expando ] || (node[ expando ] = {});
	
									// Support: IE <9 only
									// Defend against cloned attroperties (jQuery gh-1709)
									uniqueCache = outerCache[ node.uniqueID ] ||
										(outerCache[ node.uniqueID ] = {});
	
									cache = uniqueCache[ type ] || [];
									nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
									diff = nodeIndex;
								}
	
								// xml :nth-child(...)
								// or :nth-last-child(...) or :nth(-last)?-of-type(...)
								if ( diff === false ) {
									// Use the same loop as above to seek `elem` from the start
									while ( (node = ++nodeIndex && node && node[ dir ] ||
										(diff = nodeIndex = 0) || start.pop()) ) {
	
										if ( ( ofType ?
											node.nodeName.toLowerCase() === name :
											node.nodeType === 1 ) &&
											++diff ) {
	
											// Cache the index of each encountered element
											if ( useCache ) {
												outerCache = node[ expando ] || (node[ expando ] = {});
	
												// Support: IE <9 only
												// Defend against cloned attroperties (jQuery gh-1709)
												uniqueCache = outerCache[ node.uniqueID ] ||
													(outerCache[ node.uniqueID ] = {});
	
												uniqueCache[ type ] = [ dirruns, diff ];
											}
	
											if ( node === elem ) {
												break;
											}
										}
									}
								}
							}
	
							// Incorporate the offset, then check against cycle size
							diff -= last;
							return diff === first || ( diff % first === 0 && diff / first >= 0 );
						}
					};
			},
	
			"PSEUDO": function( pseudo, argument ) {
				// pseudo-class names are case-insensitive
				// http://www.w3.org/TR/selectors/#pseudo-classes
				// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
				// Remember that setFilters inherits from pseudos
				var args,
					fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
						Sizzle.error( "unsupported pseudo: " + pseudo );
	
				// The user may use createPseudo to indicate that
				// arguments are needed to create the filter function
				// just as Sizzle does
				if ( fn[ expando ] ) {
					return fn( argument );
				}
	
				// But maintain support for old signatures
				if ( fn.length > 1 ) {
					args = [ pseudo, pseudo, "", argument ];
					return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
						markFunction(function( seed, matches ) {
							var idx,
								matched = fn( seed, argument ),
								i = matched.length;
							while ( i-- ) {
								idx = indexOf( seed, matched[i] );
								seed[ idx ] = !( matches[ idx ] = matched[i] );
							}
						}) :
						function( elem ) {
							return fn( elem, 0, args );
						};
				}
	
				return fn;
			}
		},
	
		pseudos: {
			// Potentially complex pseudos
			"not": markFunction(function( selector ) {
				// Trim the selector passed to compile
				// to avoid treating leading and trailing
				// spaces as combinators
				var input = [],
					results = [],
					matcher = compile( selector.replace( rtrim, "$1" ) );
	
				return matcher[ expando ] ?
					markFunction(function( seed, matches, context, xml ) {
						var elem,
							unmatched = matcher( seed, null, xml, [] ),
							i = seed.length;
	
						// Match elements unmatched by `matcher`
						while ( i-- ) {
							if ( (elem = unmatched[i]) ) {
								seed[i] = !(matches[i] = elem);
							}
						}
					}) :
					function( elem, context, xml ) {
						input[0] = elem;
						matcher( input, null, xml, results );
						// Don't keep the element (issue #299)
						input[0] = null;
						return !results.pop();
					};
			}),
	
			"has": markFunction(function( selector ) {
				return function( elem ) {
					return Sizzle( selector, elem ).length > 0;
				};
			}),
	
			"contains": markFunction(function( text ) {
				text = text.replace( runescape, funescape );
				return function( elem ) {
					return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
				};
			}),
	
			// "Whether an element is represented by a :lang() selector
			// is based solely on the element's language value
			// being equal to the identifier C,
			// or beginning with the identifier C immediately followed by "-".
			// The matching of C against the element's language value is performed case-insensitively.
			// The identifier C does not have to be a valid language name."
			// http://www.w3.org/TR/selectors/#lang-pseudo
			"lang": markFunction( function( lang ) {
				// lang value must be a valid identifier
				if ( !ridentifier.test(lang || "") ) {
					Sizzle.error( "unsupported lang: " + lang );
				}
				lang = lang.replace( runescape, funescape ).toLowerCase();
				return function( elem ) {
					var elemLang;
					do {
						if ( (elemLang = documentIsHTML ?
							elem.lang :
							elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
	
							elemLang = elemLang.toLowerCase();
							return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
						}
					} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
					return false;
				};
			}),
	
			// Miscellaneous
			"target": function( elem ) {
				var hash = window.location && window.location.hash;
				return hash && hash.slice( 1 ) === elem.id;
			},
	
			"root": function( elem ) {
				return elem === docElem;
			},
	
			"focus": function( elem ) {
				return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
			},
	
			// Boolean properties
			"enabled": function( elem ) {
				return elem.disabled === false;
			},
	
			"disabled": function( elem ) {
				return elem.disabled === true;
			},
	
			"checked": function( elem ) {
				// In CSS3, :checked should return both checked and selected elements
				// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
				var nodeName = elem.nodeName.toLowerCase();
				return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
			},
	
			"selected": function( elem ) {
				// Accessing this property makes selected-by-default
				// options in Safari work properly
				if ( elem.parentNode ) {
					elem.parentNode.selectedIndex;
				}
	
				return elem.selected === true;
			},
	
			// Contents
			"empty": function( elem ) {
				// http://www.w3.org/TR/selectors/#empty-pseudo
				// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
				//   but not by others (comment: 8; processing instruction: 7; etc.)
				// nodeType < 6 works because attributes (2) do not appear as children
				for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
					if ( elem.nodeType < 6 ) {
						return false;
					}
				}
				return true;
			},
	
			"parent": function( elem ) {
				return !Expr.pseudos["empty"]( elem );
			},
	
			// Element/input types
			"header": function( elem ) {
				return rheader.test( elem.nodeName );
			},
	
			"input": function( elem ) {
				return rinputs.test( elem.nodeName );
			},
	
			"button": function( elem ) {
				var name = elem.nodeName.toLowerCase();
				return name === "input" && elem.type === "button" || name === "button";
			},
	
			"text": function( elem ) {
				var attr;
				return elem.nodeName.toLowerCase() === "input" &&
					elem.type === "text" &&
	
					// Support: IE<8
					// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
					( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
			},
	
			// Position-in-collection
			"first": createPositionalPseudo(function() {
				return [ 0 ];
			}),
	
			"last": createPositionalPseudo(function( matchIndexes, length ) {
				return [ length - 1 ];
			}),
	
			"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
				return [ argument < 0 ? argument + length : argument ];
			}),
	
			"even": createPositionalPseudo(function( matchIndexes, length ) {
				var i = 0;
				for ( ; i < length; i += 2 ) {
					matchIndexes.push( i );
				}
				return matchIndexes;
			}),
	
			"odd": createPositionalPseudo(function( matchIndexes, length ) {
				var i = 1;
				for ( ; i < length; i += 2 ) {
					matchIndexes.push( i );
				}
				return matchIndexes;
			}),
	
			"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
				var i = argument < 0 ? argument + length : argument;
				for ( ; --i >= 0; ) {
					matchIndexes.push( i );
				}
				return matchIndexes;
			}),
	
			"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
				var i = argument < 0 ? argument + length : argument;
				for ( ; ++i < length; ) {
					matchIndexes.push( i );
				}
				return matchIndexes;
			})
		}
	};
	
	Expr.pseudos["nth"] = Expr.pseudos["eq"];
	
	// Add button/input type pseudos
	for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
		Expr.pseudos[ i ] = createInputPseudo( i );
	}
	for ( i in { submit: true, reset: true } ) {
		Expr.pseudos[ i ] = createButtonPseudo( i );
	}
	
	// Easy API for creating new setFilters
	function setFilters() {}
	setFilters.prototype = Expr.filters = Expr.pseudos;
	Expr.setFilters = new setFilters();
	
	tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
		var matched, match, tokens, type,
			soFar, groups, preFilters,
			cached = tokenCache[ selector + " " ];
	
		if ( cached ) {
			return parseOnly ? 0 : cached.slice( 0 );
		}
	
		soFar = selector;
		groups = [];
		preFilters = Expr.preFilter;
	
		while ( soFar ) {
	
			// Comma and first run
			if ( !matched || (match = rcomma.exec( soFar )) ) {
				if ( match ) {
					// Don't consume trailing commas as valid
					soFar = soFar.slice( match[0].length ) || soFar;
				}
				groups.push( (tokens = []) );
			}
	
			matched = false;
	
			// Combinators
			if ( (match = rcombinators.exec( soFar )) ) {
				matched = match.shift();
				tokens.push({
					value: matched,
					// Cast descendant combinators to space
					type: match[0].replace( rtrim, " " )
				});
				soFar = soFar.slice( matched.length );
			}
	
			// Filters
			for ( type in Expr.filter ) {
				if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
					(match = preFilters[ type ]( match ))) ) {
					matched = match.shift();
					tokens.push({
						value: matched,
						type: type,
						matches: match
					});
					soFar = soFar.slice( matched.length );
				}
			}
	
			if ( !matched ) {
				break;
			}
		}
	
		// Return the length of the invalid excess
		// if we're just parsing
		// Otherwise, throw an error or return tokens
		return parseOnly ?
			soFar.length :
			soFar ?
				Sizzle.error( selector ) :
				// Cache the tokens
				tokenCache( selector, groups ).slice( 0 );
	};
	
	function toSelector( tokens ) {
		var i = 0,
			len = tokens.length,
			selector = "";
		for ( ; i < len; i++ ) {
			selector += tokens[i].value;
		}
		return selector;
	}
	
	function addCombinator( matcher, combinator, base ) {
		var dir = combinator.dir,
			checkNonElements = base && dir === "parentNode",
			doneName = done++;
	
		return combinator.first ?
			// Check against closest ancestor/preceding element
			function( elem, context, xml ) {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						return matcher( elem, context, xml );
					}
				}
			} :
	
			// Check against all ancestor/preceding elements
			function( elem, context, xml ) {
				var oldCache, uniqueCache, outerCache,
					newCache = [ dirruns, doneName ];
	
				// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
				if ( xml ) {
					while ( (elem = elem[ dir ]) ) {
						if ( elem.nodeType === 1 || checkNonElements ) {
							if ( matcher( elem, context, xml ) ) {
								return true;
							}
						}
					}
				} else {
					while ( (elem = elem[ dir ]) ) {
						if ( elem.nodeType === 1 || checkNonElements ) {
							outerCache = elem[ expando ] || (elem[ expando ] = {});
	
							// Support: IE <9 only
							// Defend against cloned attroperties (jQuery gh-1709)
							uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
	
							if ( (oldCache = uniqueCache[ dir ]) &&
								oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
	
								// Assign to newCache so results back-propagate to previous elements
								return (newCache[ 2 ] = oldCache[ 2 ]);
							} else {
								// Reuse newcache so results back-propagate to previous elements
								uniqueCache[ dir ] = newCache;
	
								// A match means we're done; a fail means we have to keep checking
								if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
									return true;
								}
							}
						}
					}
				}
			};
	}
	
	function elementMatcher( matchers ) {
		return matchers.length > 1 ?
			function( elem, context, xml ) {
				var i = matchers.length;
				while ( i-- ) {
					if ( !matchers[i]( elem, context, xml ) ) {
						return false;
					}
				}
				return true;
			} :
			matchers[0];
	}
	
	function multipleContexts( selector, contexts, results ) {
		var i = 0,
			len = contexts.length;
		for ( ; i < len; i++ ) {
			Sizzle( selector, contexts[i], results );
		}
		return results;
	}
	
	function condense( unmatched, map, filter, context, xml ) {
		var elem,
			newUnmatched = [],
			i = 0,
			len = unmatched.length,
			mapped = map != null;
	
		for ( ; i < len; i++ ) {
			if ( (elem = unmatched[i]) ) {
				if ( !filter || filter( elem, context, xml ) ) {
					newUnmatched.push( elem );
					if ( mapped ) {
						map.push( i );
					}
				}
			}
		}
	
		return newUnmatched;
	}
	
	function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
		if ( postFilter && !postFilter[ expando ] ) {
			postFilter = setMatcher( postFilter );
		}
		if ( postFinder && !postFinder[ expando ] ) {
			postFinder = setMatcher( postFinder, postSelector );
		}
		return markFunction(function( seed, results, context, xml ) {
			var temp, i, elem,
				preMap = [],
				postMap = [],
				preexisting = results.length,
	
				// Get initial elements from seed or context
				elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
	
				// Prefilter to get matcher input, preserving a map for seed-results synchronization
				matcherIn = preFilter && ( seed || !selector ) ?
					condense( elems, preMap, preFilter, context, xml ) :
					elems,
	
				matcherOut = matcher ?
					// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
					postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
	
						// ...intermediate processing is necessary
						[] :
	
						// ...otherwise use results directly
						results :
					matcherIn;
	
			// Find primary matches
			if ( matcher ) {
				matcher( matcherIn, matcherOut, context, xml );
			}
	
			// Apply postFilter
			if ( postFilter ) {
				temp = condense( matcherOut, postMap );
				postFilter( temp, [], context, xml );
	
				// Un-match failing elements by moving them back to matcherIn
				i = temp.length;
				while ( i-- ) {
					if ( (elem = temp[i]) ) {
						matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
					}
				}
			}
	
			if ( seed ) {
				if ( postFinder || preFilter ) {
					if ( postFinder ) {
						// Get the final matcherOut by condensing this intermediate into postFinder contexts
						temp = [];
						i = matcherOut.length;
						while ( i-- ) {
							if ( (elem = matcherOut[i]) ) {
								// Restore matcherIn since elem is not yet a final match
								temp.push( (matcherIn[i] = elem) );
							}
						}
						postFinder( null, (matcherOut = []), temp, xml );
					}
	
					// Move matched elements from seed to results to keep them synchronized
					i = matcherOut.length;
					while ( i-- ) {
						if ( (elem = matcherOut[i]) &&
							(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
	
							seed[temp] = !(results[temp] = elem);
						}
					}
				}
	
			// Add elements to results, through postFinder if defined
			} else {
				matcherOut = condense(
					matcherOut === results ?
						matcherOut.splice( preexisting, matcherOut.length ) :
						matcherOut
				);
				if ( postFinder ) {
					postFinder( null, results, matcherOut, xml );
				} else {
					push.apply( results, matcherOut );
				}
			}
		});
	}
	
	function matcherFromTokens( tokens ) {
		var checkContext, matcher, j,
			len = tokens.length,
			leadingRelative = Expr.relative[ tokens[0].type ],
			implicitRelative = leadingRelative || Expr.relative[" "],
			i = leadingRelative ? 1 : 0,
	
			// The foundational matcher ensures that elements are reachable from top-level context(s)
			matchContext = addCombinator( function( elem ) {
				return elem === checkContext;
			}, implicitRelative, true ),
			matchAnyContext = addCombinator( function( elem ) {
				return indexOf( checkContext, elem ) > -1;
			}, implicitRelative, true ),
			matchers = [ function( elem, context, xml ) {
				var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
					(checkContext = context).nodeType ?
						matchContext( elem, context, xml ) :
						matchAnyContext( elem, context, xml ) );
				// Avoid hanging onto element (issue #299)
				checkContext = null;
				return ret;
			} ];
	
		for ( ; i < len; i++ ) {
			if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
				matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
			} else {
				matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
	
				// Return special upon seeing a positional matcher
				if ( matcher[ expando ] ) {
					// Find the next relative operator (if any) for proper handling
					j = ++i;
					for ( ; j < len; j++ ) {
						if ( Expr.relative[ tokens[j].type ] ) {
							break;
						}
					}
					return setMatcher(
						i > 1 && elementMatcher( matchers ),
						i > 1 && toSelector(
							// If the preceding token was a descendant combinator, insert an implicit any-element `*`
							tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
						).replace( rtrim, "$1" ),
						matcher,
						i < j && matcherFromTokens( tokens.slice( i, j ) ),
						j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
						j < len && toSelector( tokens )
					);
				}
				matchers.push( matcher );
			}
		}
	
		return elementMatcher( matchers );
	}
	
	function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
		var bySet = setMatchers.length > 0,
			byElement = elementMatchers.length > 0,
			superMatcher = function( seed, context, xml, results, outermost ) {
				var elem, j, matcher,
					matchedCount = 0,
					i = "0",
					unmatched = seed && [],
					setMatched = [],
					contextBackup = outermostContext,
					// We must always have either seed elements or outermost context
					elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
					// Use integer dirruns iff this is the outermost matcher
					dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
					len = elems.length;
	
				if ( outermost ) {
					outermostContext = context === document || context || outermost;
				}
	
				// Add elements passing elementMatchers directly to results
				// Support: IE<9, Safari
				// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
				for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
					if ( byElement && elem ) {
						j = 0;
						if ( !context && elem.ownerDocument !== document ) {
							setDocument( elem );
							xml = !documentIsHTML;
						}
						while ( (matcher = elementMatchers[j++]) ) {
							if ( matcher( elem, context || document, xml) ) {
								results.push( elem );
								break;
							}
						}
						if ( outermost ) {
							dirruns = dirrunsUnique;
						}
					}
	
					// Track unmatched elements for set filters
					if ( bySet ) {
						// They will have gone through all possible matchers
						if ( (elem = !matcher && elem) ) {
							matchedCount--;
						}
	
						// Lengthen the array for every element, matched or not
						if ( seed ) {
							unmatched.push( elem );
						}
					}
				}
	
				// `i` is now the count of elements visited above, and adding it to `matchedCount`
				// makes the latter nonnegative.
				matchedCount += i;
	
				// Apply set filters to unmatched elements
				// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
				// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
				// no element matchers and no seed.
				// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
				// case, which will result in a "00" `matchedCount` that differs from `i` but is also
				// numerically zero.
				if ( bySet && i !== matchedCount ) {
					j = 0;
					while ( (matcher = setMatchers[j++]) ) {
						matcher( unmatched, setMatched, context, xml );
					}
	
					if ( seed ) {
						// Reintegrate element matches to eliminate the need for sorting
						if ( matchedCount > 0 ) {
							while ( i-- ) {
								if ( !(unmatched[i] || setMatched[i]) ) {
									setMatched[i] = pop.call( results );
								}
							}
						}
	
						// Discard index placeholder values to get only actual matches
						setMatched = condense( setMatched );
					}
	
					// Add matches to results
					push.apply( results, setMatched );
	
					// Seedless set matches succeeding multiple successful matchers stipulate sorting
					if ( outermost && !seed && setMatched.length > 0 &&
						( matchedCount + setMatchers.length ) > 1 ) {
	
						Sizzle.uniqueSort( results );
					}
				}
	
				// Override manipulation of globals by nested matchers
				if ( outermost ) {
					dirruns = dirrunsUnique;
					outermostContext = contextBackup;
				}
	
				return unmatched;
			};
	
		return bySet ?
			markFunction( superMatcher ) :
			superMatcher;
	}
	
	compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
		var i,
			setMatchers = [],
			elementMatchers = [],
			cached = compilerCache[ selector + " " ];
	
		if ( !cached ) {
			// Generate a function of recursive functions that can be used to check each element
			if ( !match ) {
				match = tokenize( selector );
			}
			i = match.length;
			while ( i-- ) {
				cached = matcherFromTokens( match[i] );
				if ( cached[ expando ] ) {
					setMatchers.push( cached );
				} else {
					elementMatchers.push( cached );
				}
			}
	
			// Cache the compiled function
			cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
	
			// Save selector and tokenization
			cached.selector = selector;
		}
		return cached;
	};
	
	/**
	 * A low-level selection function that works with Sizzle's compiled
	 *  selector functions
	 * @param {String|Function} selector A selector or a pre-compiled
	 *  selector function built with Sizzle.compile
	 * @param {Element} context
	 * @param {Array} [results]
	 * @param {Array} [seed] A set of elements to match against
	 */
	select = Sizzle.select = function( selector, context, results, seed ) {
		var i, tokens, token, type, find,
			compiled = typeof selector === "function" && selector,
			match = !seed && tokenize( (selector = compiled.selector || selector) );
	
		results = results || [];
	
		// Try to minimize operations if there is only one selector in the list and no seed
		// (the latter of which guarantees us context)
		if ( match.length === 1 ) {
	
			// Reduce context if the leading compound selector is an ID
			tokens = match[0] = match[0].slice( 0 );
			if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
					support.getById && context.nodeType === 9 && documentIsHTML &&
					Expr.relative[ tokens[1].type ] ) {
	
				context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
				if ( !context ) {
					return results;
	
				// Precompiled matchers will still verify ancestry, so step up a level
				} else if ( compiled ) {
					context = context.parentNode;
				}
	
				selector = selector.slice( tokens.shift().value.length );
			}
	
			// Fetch a seed set for right-to-left matching
			i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
			while ( i-- ) {
				token = tokens[i];
	
				// Abort if we hit a combinator
				if ( Expr.relative[ (type = token.type) ] ) {
					break;
				}
				if ( (find = Expr.find[ type ]) ) {
					// Search, expanding context for leading sibling combinators
					if ( (seed = find(
						token.matches[0].replace( runescape, funescape ),
						rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
					)) ) {
	
						// If seed is empty or no tokens remain, we can return early
						tokens.splice( i, 1 );
						selector = seed.length && toSelector( tokens );
						if ( !selector ) {
							push.apply( results, seed );
							return results;
						}
	
						break;
					}
				}
			}
		}
	
		// Compile and execute a filtering function if one is not provided
		// Provide `match` to avoid retokenization if we modified the selector above
		( compiled || compile( selector, match ) )(
			seed,
			context,
			!documentIsHTML,
			results,
			!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
		);
		return results;
	};
	
	// One-time assignments
	
	// Sort stability
	support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
	
	// Support: Chrome 14-35+
	// Always assume duplicates if they aren't passed to the comparison function
	support.detectDuplicates = !!hasDuplicate;
	
	// Initialize against the default document
	setDocument();
	
	// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
	// Detached nodes confoundingly follow *each other*
	support.sortDetached = assert(function( div1 ) {
		// Should return 1, but returns 4 (following)
		return div1.compareDocumentPosition( document.createElement("div") ) & 1;
	});
	
	// Support: IE<8
	// Prevent attribute/property "interpolation"
	// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
	if ( !assert(function( div ) {
		div.innerHTML = "<a href='#'></a>";
		return div.firstChild.getAttribute("href") === "#" ;
	}) ) {
		addHandle( "type|href|height|width", function( elem, name, isXML ) {
			if ( !isXML ) {
				return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
			}
		});
	}
	
	// Support: IE<9
	// Use defaultValue in place of getAttribute("value")
	if ( !support.attributes || !assert(function( div ) {
		div.innerHTML = "<input/>";
		div.firstChild.setAttribute( "value", "" );
		return div.firstChild.getAttribute( "value" ) === "";
	}) ) {
		addHandle( "value", function( elem, name, isXML ) {
			if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
				return elem.defaultValue;
			}
		});
	}
	
	// Support: IE<9
	// Use getAttributeNode to fetch booleans when getAttribute lies
	if ( !assert(function( div ) {
		return div.getAttribute("disabled") == null;
	}) ) {
		addHandle( booleans, function( elem, name, isXML ) {
			var val;
			if ( !isXML ) {
				return elem[ name ] === true ? name.toLowerCase() :
						(val = elem.getAttributeNode( name )) && val.specified ?
						val.value :
					null;
			}
		});
	}
	
	return Sizzle;
	
	})( window );
	
	
	
	jQuery.find = Sizzle;
	jQuery.expr = Sizzle.selectors;
	jQuery.expr[ ":" ] = jQuery.expr.pseudos;
	jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
	jQuery.text = Sizzle.getText;
	jQuery.isXMLDoc = Sizzle.isXML;
	jQuery.contains = Sizzle.contains;
	
	
	
	var dir = function( elem, dir, until ) {
		var matched = [],
			truncate = until !== undefined;
	
		while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
			if ( elem.nodeType === 1 ) {
				if ( truncate && jQuery( elem ).is( until ) ) {
					break;
				}
				matched.push( elem );
			}
		}
		return matched;
	};
	
	
	var siblings = function( n, elem ) {
		var matched = [];
	
		for ( ; n; n = n.nextSibling ) {
			if ( n.nodeType === 1 && n !== elem ) {
				matched.push( n );
			}
		}
	
		return matched;
	};
	
	
	var rneedsContext = jQuery.expr.match.needsContext;
	
	var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
	
	
	
	var risSimple = /^.[^:#\[\.,]*$/;
	
	// Implement the identical functionality for filter and not
	function winnow( elements, qualifier, not ) {
		if ( jQuery.isFunction( qualifier ) ) {
			return jQuery.grep( elements, function( elem, i ) {
				/* jshint -W018 */
				return !!qualifier.call( elem, i, elem ) !== not;
			} );
	
		}
	
		if ( qualifier.nodeType ) {
			return jQuery.grep( elements, function( elem ) {
				return ( elem === qualifier ) !== not;
			} );
	
		}
	
		if ( typeof qualifier === "string" ) {
			if ( risSimple.test( qualifier ) ) {
				return jQuery.filter( qualifier, elements, not );
			}
	
			qualifier = jQuery.filter( qualifier, elements );
		}
	
		return jQuery.grep( elements, function( elem ) {
			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
		} );
	}
	
	jQuery.filter = function( expr, elems, not ) {
		var elem = elems[ 0 ];
	
		if ( not ) {
			expr = ":not(" + expr + ")";
		}
	
		return elems.length === 1 && elem.nodeType === 1 ?
			jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
			jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
				return elem.nodeType === 1;
			} ) );
	};
	
	jQuery.fn.extend( {
		find: function( selector ) {
			var i,
				len = this.length,
				ret = [],
				self = this;
	
			if ( typeof selector !== "string" ) {
				return this.pushStack( jQuery( selector ).filter( function() {
					for ( i = 0; i < len; i++ ) {
						if ( jQuery.contains( self[ i ], this ) ) {
							return true;
						}
					}
				} ) );
			}
	
			for ( i = 0; i < len; i++ ) {
				jQuery.find( selector, self[ i ], ret );
			}
	
			// Needed because $( selector, context ) becomes $( context ).find( selector )
			ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
			ret.selector = this.selector ? this.selector + " " + selector : selector;
			return ret;
		},
		filter: function( selector ) {
			return this.pushStack( winnow( this, selector || [], false ) );
		},
		not: function( selector ) {
			return this.pushStack( winnow( this, selector || [], true ) );
		},
		is: function( selector ) {
			return !!winnow(
				this,
	
				// If this is a positional/relative selector, check membership in the returned set
				// so $("p:first").is("p:last") won't return true for a doc with two "p".
				typeof selector === "string" && rneedsContext.test( selector ) ?
					jQuery( selector ) :
					selector || [],
				false
			).length;
		}
	} );
	
	
	// Initialize a jQuery object
	
	
	// A central reference to the root jQuery(document)
	var rootjQuery,
	
		// A simple way to check for HTML strings
		// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
		// Strict HTML recognition (#11290: must start with <)
		rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
	
		init = jQuery.fn.init = function( selector, context, root ) {
			var match, elem;
	
			// HANDLE: $(""), $(null), $(undefined), $(false)
			if ( !selector ) {
				return this;
			}
	
			// Method init() accepts an alternate rootjQuery
			// so migrate can support jQuery.sub (gh-2101)
			root = root || rootjQuery;
	
			// Handle HTML strings
			if ( typeof selector === "string" ) {
				if ( selector[ 0 ] === "<" &&
					selector[ selector.length - 1 ] === ">" &&
					selector.length >= 3 ) {
	
					// Assume that strings that start and end with <> are HTML and skip the regex check
					match = [ null, selector, null ];
	
				} else {
					match = rquickExpr.exec( selector );
				}
	
				// Match html or make sure no context is specified for #id
				if ( match && ( match[ 1 ] || !context ) ) {
	
					// HANDLE: $(html) -> $(array)
					if ( match[ 1 ] ) {
						context = context instanceof jQuery ? context[ 0 ] : context;
	
						// Option to run scripts is true for back-compat
						// Intentionally let the error be thrown if parseHTML is not present
						jQuery.merge( this, jQuery.parseHTML(
							match[ 1 ],
							context && context.nodeType ? context.ownerDocument || context : document,
							true
						) );
	
						// HANDLE: $(html, props)
						if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
							for ( match in context ) {
	
								// Properties of context are called as methods if possible
								if ( jQuery.isFunction( this[ match ] ) ) {
									this[ match ]( context[ match ] );
	
								// ...and otherwise set as attributes
								} else {
									this.attr( match, context[ match ] );
								}
							}
						}
	
						return this;
	
					// HANDLE: $(#id)
					} else {
						elem = document.getElementById( match[ 2 ] );
	
						// Support: Blackberry 4.6
						// gEBID returns nodes no longer in the document (#6963)
						if ( elem && elem.parentNode ) {
	
							// Inject the element directly into the jQuery object
							this.length = 1;
							this[ 0 ] = elem;
						}
	
						this.context = document;
						this.selector = selector;
						return this;
					}
	
				// HANDLE: $(expr, $(...))
				} else if ( !context || context.jquery ) {
					return ( context || root ).find( selector );
	
				// HANDLE: $(expr, context)
				// (which is just equivalent to: $(context).find(expr)
				} else {
					return this.constructor( context ).find( selector );
				}
	
			// HANDLE: $(DOMElement)
			} else if ( selector.nodeType ) {
				this.context = this[ 0 ] = selector;
				this.length = 1;
				return this;
	
			// HANDLE: $(function)
			// Shortcut for document ready
			} else if ( jQuery.isFunction( selector ) ) {
				return root.ready !== undefined ?
					root.ready( selector ) :
	
					// Execute immediately if ready is not present
					selector( jQuery );
			}
	
			if ( selector.selector !== undefined ) {
				this.selector = selector.selector;
				this.context = selector.context;
			}
	
			return jQuery.makeArray( selector, this );
		};
	
	// Give the init function the jQuery prototype for later instantiation
	init.prototype = jQuery.fn;
	
	// Initialize central reference
	rootjQuery = jQuery( document );
	
	
	var rparentsprev = /^(?:parents|prev(?:Until|All))/,
	
		// Methods guaranteed to produce a unique set when starting from a unique set
		guaranteedUnique = {
			children: true,
			contents: true,
			next: true,
			prev: true
		};
	
	jQuery.fn.extend( {
		has: function( target ) {
			var targets = jQuery( target, this ),
				l = targets.length;
	
			return this.filter( function() {
				var i = 0;
				for ( ; i < l; i++ ) {
					if ( jQuery.contains( this, targets[ i ] ) ) {
						return true;
					}
				}
			} );
		},
	
		closest: function( selectors, context ) {
			var cur,
				i = 0,
				l = this.length,
				matched = [],
				pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
					jQuery( selectors, context || this.context ) :
					0;
	
			for ( ; i < l; i++ ) {
				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
	
					// Always skip document fragments
					if ( cur.nodeType < 11 && ( pos ?
						pos.index( cur ) > -1 :
	
						// Don't pass non-elements to Sizzle
						cur.nodeType === 1 &&
							jQuery.find.matchesSelector( cur, selectors ) ) ) {
	
						matched.push( cur );
						break;
					}
				}
			}
	
			return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
		},
	
		// Determine the position of an element within the set
		index: function( elem ) {
	
			// No argument, return index in parent
			if ( !elem ) {
				return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
			}
	
			// Index in selector
			if ( typeof elem === "string" ) {
				return indexOf.call( jQuery( elem ), this[ 0 ] );
			}
	
			// Locate the position of the desired element
			return indexOf.call( this,
	
				// If it receives a jQuery object, the first element is used
				elem.jquery ? elem[ 0 ] : elem
			);
		},
	
		add: function( selector, context ) {
			return this.pushStack(
				jQuery.uniqueSort(
					jQuery.merge( this.get(), jQuery( selector, context ) )
				)
			);
		},
	
		addBack: function( selector ) {
			return this.add( selector == null ?
				this.prevObject : this.prevObject.filter( selector )
			);
		}
	} );
	
	function sibling( cur, dir ) {
		while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
		return cur;
	}
	
	jQuery.each( {
		parent: function( elem ) {
			var parent = elem.parentNode;
			return parent && parent.nodeType !== 11 ? parent : null;
		},
		parents: function( elem ) {
			return dir( elem, "parentNode" );
		},
		parentsUntil: function( elem, i, until ) {
			return dir( elem, "parentNode", until );
		},
		next: function( elem ) {
			return sibling( elem, "nextSibling" );
		},
		prev: function( elem ) {
			return sibling( elem, "previousSibling" );
		},
		nextAll: function( elem ) {
			return dir( elem, "nextSibling" );
		},
		prevAll: function( elem ) {
			return dir( elem, "previousSibling" );
		},
		nextUntil: function( elem, i, until ) {
			return dir( elem, "nextSibling", until );
		},
		prevUntil: function( elem, i, until ) {
			return dir( elem, "previousSibling", until );
		},
		siblings: function( elem ) {
			return siblings( ( elem.parentNode || {} ).firstChild, elem );
		},
		children: function( elem ) {
			return siblings( elem.firstChild );
		},
		contents: function( elem ) {
			return elem.contentDocument || jQuery.merge( [], elem.childNodes );
		}
	}, function( name, fn ) {
		jQuery.fn[ name ] = function( until, selector ) {
			var matched = jQuery.map( this, fn, until );
	
			if ( name.slice( -5 ) !== "Until" ) {
				selector = until;
			}
	
			if ( selector && typeof selector === "string" ) {
				matched = jQuery.filter( selector, matched );
			}
	
			if ( this.length > 1 ) {
	
				// Remove duplicates
				if ( !guaranteedUnique[ name ] ) {
					jQuery.uniqueSort( matched );
				}
	
				// Reverse order for parents* and prev-derivatives
				if ( rparentsprev.test( name ) ) {
					matched.reverse();
				}
			}
	
			return this.pushStack( matched );
		};
	} );
	var rnotwhite = ( /\S+/g );
	
	
	
	// Convert String-formatted options into Object-formatted ones
	function createOptions( options ) {
		var object = {};
		jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
			object[ flag ] = true;
		} );
		return object;
	}
	
	/*
	 * Create a callback list using the following parameters:
	 *
	 *	options: an optional list of space-separated options that will change how
	 *			the callback list behaves or a more traditional option object
	 *
	 * By default a callback list will act like an event callback list and can be
	 * "fired" multiple times.
	 *
	 * Possible options:
	 *
	 *	once:			will ensure the callback list can only be fired once (like a Deferred)
	 *
	 *	memory:			will keep track of previous values and will call any callback added
	 *					after the list has been fired right away with the latest "memorized"
	 *					values (like a Deferred)
	 *
	 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
	 *
	 *	stopOnFalse:	interrupt callings when a callback returns false
	 *
	 */
	jQuery.Callbacks = function( options ) {
	
		// Convert options from String-formatted to Object-formatted if needed
		// (we check in cache first)
		options = typeof options === "string" ?
			createOptions( options ) :
			jQuery.extend( {}, options );
	
		var // Flag to know if list is currently firing
			firing,
	
			// Last fire value for non-forgettable lists
			memory,
	
			// Flag to know if list was already fired
			fired,
	
			// Flag to prevent firing
			locked,
	
			// Actual callback list
			list = [],
	
			// Queue of execution data for repeatable lists
			queue = [],
	
			// Index of currently firing callback (modified by add/remove as needed)
			firingIndex = -1,
	
			// Fire callbacks
			fire = function() {
	
				// Enforce single-firing
				locked = options.once;
	
				// Execute callbacks for all pending executions,
				// respecting firingIndex overrides and runtime changes
				fired = firing = true;
				for ( ; queue.length; firingIndex = -1 ) {
					memory = queue.shift();
					while ( ++firingIndex < list.length ) {
	
						// Run callback and check for early termination
						if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
							options.stopOnFalse ) {
	
							// Jump to end and forget the data so .add doesn't re-fire
							firingIndex = list.length;
							memory = false;
						}
					}
				}
	
				// Forget the data if we're done with it
				if ( !options.memory ) {
					memory = false;
				}
	
				firing = false;
	
				// Clean up if we're done firing for good
				if ( locked ) {
	
					// Keep an empty list if we have data for future add calls
					if ( memory ) {
						list = [];
	
					// Otherwise, this object is spent
					} else {
						list = "";
					}
				}
			},
	
			// Actual Callbacks object
			self = {
	
				// Add a callback or a collection of callbacks to the list
				add: function() {
					if ( list ) {
	
						// If we have memory from a past run, we should fire after adding
						if ( memory && !firing ) {
							firingIndex = list.length - 1;
							queue.push( memory );
						}
	
						( function add( args ) {
							jQuery.each( args, function( _, arg ) {
								if ( jQuery.isFunction( arg ) ) {
									if ( !options.unique || !self.has( arg ) ) {
										list.push( arg );
									}
								} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
	
									// Inspect recursively
									add( arg );
								}
							} );
						} )( arguments );
	
						if ( memory && !firing ) {
							fire();
						}
					}
					return this;
				},
	
				// Remove a callback from the list
				remove: function() {
					jQuery.each( arguments, function( _, arg ) {
						var index;
						while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
							list.splice( index, 1 );
	
							// Handle firing indexes
							if ( index <= firingIndex ) {
								firingIndex--;
							}
						}
					} );
					return this;
				},
	
				// Check if a given callback is in the list.
				// If no argument is given, return whether or not list has callbacks attached.
				has: function( fn ) {
					return fn ?
						jQuery.inArray( fn, list ) > -1 :
						list.length > 0;
				},
	
				// Remove all callbacks from the list
				empty: function() {
					if ( list ) {
						list = [];
					}
					return this;
				},
	
				// Disable .fire and .add
				// Abort any current/pending executions
				// Clear all callbacks and values
				disable: function() {
					locked = queue = [];
					list = memory = "";
					return this;
				},
				disabled: function() {
					return !list;
				},
	
				// Disable .fire
				// Also disable .add unless we have memory (since it would have no effect)
				// Abort any pending executions
				lock: function() {
					locked = queue = [];
					if ( !memory ) {
						list = memory = "";
					}
					return this;
				},
				locked: function() {
					return !!locked;
				},
	
				// Call all callbacks with the given context and arguments
				fireWith: function( context, args ) {
					if ( !locked ) {
						args = args || [];
						args = [ context, args.slice ? args.slice() : args ];
						queue.push( args );
						if ( !firing ) {
							fire();
						}
					}
					return this;
				},
	
				// Call all the callbacks with the given arguments
				fire: function() {
					self.fireWith( this, arguments );
					return this;
				},
	
				// To know if the callbacks have already been called at least once
				fired: function() {
					return !!fired;
				}
			};
	
		return self;
	};
	
	
	jQuery.extend( {
	
		Deferred: function( func ) {
			var tuples = [
	
					// action, add listener, listener list, final state
					[ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
					[ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
					[ "notify", "progress", jQuery.Callbacks( "memory" ) ]
				],
				state = "pending",
				promise = {
					state: function() {
						return state;
					},
					always: function() {
						deferred.done( arguments ).fail( arguments );
						return this;
					},
					then: function( /* fnDone, fnFail, fnProgress */ ) {
						var fns = arguments;
						return jQuery.Deferred( function( newDefer ) {
							jQuery.each( tuples, function( i, tuple ) {
								var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
	
								// deferred[ done | fail | progress ] for forwarding actions to newDefer
								deferred[ tuple[ 1 ] ]( function() {
									var returned = fn && fn.apply( this, arguments );
									if ( returned && jQuery.isFunction( returned.promise ) ) {
										returned.promise()
											.progress( newDefer.notify )
											.done( newDefer.resolve )
											.fail( newDefer.reject );
									} else {
										newDefer[ tuple[ 0 ] + "With" ](
											this === promise ? newDefer.promise() : this,
											fn ? [ returned ] : arguments
										);
									}
								} );
							} );
							fns = null;
						} ).promise();
					},
	
					// Get a promise for this deferred
					// If obj is provided, the promise aspect is added to the object
					promise: function( obj ) {
						return obj != null ? jQuery.extend( obj, promise ) : promise;
					}
				},
				deferred = {};
	
			// Keep pipe for back-compat
			promise.pipe = promise.then;
	
			// Add list-specific methods
			jQuery.each( tuples, function( i, tuple ) {
				var list = tuple[ 2 ],
					stateString = tuple[ 3 ];
	
				// promise[ done | fail | progress ] = list.add
				promise[ tuple[ 1 ] ] = list.add;
	
				// Handle state
				if ( stateString ) {
					list.add( function() {
	
						// state = [ resolved | rejected ]
						state = stateString;
	
					// [ reject_list | resolve_list ].disable; progress_list.lock
					}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
				}
	
				// deferred[ resolve | reject | notify ]
				deferred[ tuple[ 0 ] ] = function() {
					deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
					return this;
				};
				deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
			} );
	
			// Make the deferred a promise
			promise.promise( deferred );
	
			// Call given func if any
			if ( func ) {
				func.call( deferred, deferred );
			}
	
			// All done!
			return deferred;
		},
	
		// Deferred helper
		when: function( subordinate /* , ..., subordinateN */ ) {
			var i = 0,
				resolveValues = slice.call( arguments ),
				length = resolveValues.length,
	
				// the count of uncompleted subordinates
				remaining = length !== 1 ||
					( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
	
				// the master Deferred.
				// If resolveValues consist of only a single Deferred, just use that.
				deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
	
				// Update function for both resolve and progress values
				updateFunc = function( i, contexts, values ) {
					return function( value ) {
						contexts[ i ] = this;
						values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
						if ( values === progressValues ) {
							deferred.notifyWith( contexts, values );
						} else if ( !( --remaining ) ) {
							deferred.resolveWith( contexts, values );
						}
					};
				},
	
				progressValues, progressContexts, resolveContexts;
	
			// Add listeners to Deferred subordinates; treat others as resolved
			if ( length > 1 ) {
				progressValues = new Array( length );
				progressContexts = new Array( length );
				resolveContexts = new Array( length );
				for ( ; i < length; i++ ) {
					if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
						resolveValues[ i ].promise()
							.progress( updateFunc( i, progressContexts, progressValues ) )
							.done( updateFunc( i, resolveContexts, resolveValues ) )
							.fail( deferred.reject );
					} else {
						--remaining;
					}
				}
			}
	
			// If we're not waiting on anything, resolve the master
			if ( !remaining ) {
				deferred.resolveWith( resolveContexts, resolveValues );
			}
	
			return deferred.promise();
		}
	} );
	
	
	// The deferred used on DOM ready
	var readyList;
	
	jQuery.fn.ready = function( fn ) {
	
		// Add the callback
		jQuery.ready.promise().done( fn );
	
		return this;
	};
	
	jQuery.extend( {
	
		// Is the DOM ready to be used? Set to true once it occurs.
		isReady: false,
	
		// A counter to track how many items to wait for before
		// the ready event fires. See #6781
		readyWait: 1,
	
		// Hold (or release) the ready event
		holdReady: function( hold ) {
			if ( hold ) {
				jQuery.readyWait++;
			} else {
				jQuery.ready( true );
			}
		},
	
		// Handle when the DOM is ready
		ready: function( wait ) {
	
			// Abort if there are pending holds or we're already ready
			if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
				return;
			}
	
			// Remember that the DOM is ready
			jQuery.isReady = true;
	
			// If a normal DOM Ready event fired, decrement, and wait if need be
			if ( wait !== true && --jQuery.readyWait > 0 ) {
				return;
			}
	
			// If there are functions bound, to execute
			readyList.resolveWith( document, [ jQuery ] );
	
			// Trigger any bound ready events
			if ( jQuery.fn.triggerHandler ) {
				jQuery( document ).triggerHandler( "ready" );
				jQuery( document ).off( "ready" );
			}
		}
	} );
	
	/**
	 * The ready event handler and self cleanup method
	 */
	function completed() {
		document.removeEventListener( "DOMContentLoaded", completed );
		window.removeEventListener( "load", completed );
		jQuery.ready();
	}
	
	jQuery.ready.promise = function( obj ) {
		if ( !readyList ) {
	
			readyList = jQuery.Deferred();
	
			// Catch cases where $(document).ready() is called
			// after the browser event has already occurred.
			// Support: IE9-10 only
			// Older IE sometimes signals "interactive" too soon
			if ( document.readyState === "complete" ||
				( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
	
				// Handle it asynchronously to allow scripts the opportunity to delay ready
				window.setTimeout( jQuery.ready );
	
			} else {
	
				// Use the handy event callback
				document.addEventListener( "DOMContentLoaded", completed );
	
				// A fallback to window.onload, that will always work
				window.addEventListener( "load", completed );
			}
		}
		return readyList.promise( obj );
	};
	
	// Kick off the DOM ready check even if the user does not
	jQuery.ready.promise();
	
	
	
	
	// Multifunctional method to get and set values of a collection
	// The value/s can optionally be executed if it's a function
	var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
		var i = 0,
			len = elems.length,
			bulk = key == null;
	
		// Sets many values
		if ( jQuery.type( key ) === "object" ) {
			chainable = true;
			for ( i in key ) {
				access( elems, fn, i, key[ i ], true, emptyGet, raw );
			}
	
		// Sets one value
		} else if ( value !== undefined ) {
			chainable = true;
	
			if ( !jQuery.isFunction( value ) ) {
				raw = true;
			}
	
			if ( bulk ) {
	
				// Bulk operations run against the entire set
				if ( raw ) {
					fn.call( elems, value );
					fn = null;
	
				// ...except when executing function values
				} else {
					bulk = fn;
					fn = function( elem, key, value ) {
						return bulk.call( jQuery( elem ), value );
					};
				}
			}
	
			if ( fn ) {
				for ( ; i < len; i++ ) {
					fn(
						elems[ i ], key, raw ?
						value :
						value.call( elems[ i ], i, fn( elems[ i ], key ) )
					);
				}
			}
		}
	
		return chainable ?
			elems :
	
			// Gets
			bulk ?
				fn.call( elems ) :
				len ? fn( elems[ 0 ], key ) : emptyGet;
	};
	var acceptData = function( owner ) {
	
		// Accepts only:
		//  - Node
		//    - Node.ELEMENT_NODE
		//    - Node.DOCUMENT_NODE
		//  - Object
		//    - Any
		/* jshint -W018 */
		return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
	};
	
	
	
	
	function Data() {
		this.expando = jQuery.expando + Data.uid++;
	}
	
	Data.uid = 1;
	
	Data.prototype = {
	
		register: function( owner, initial ) {
			var value = initial || {};
	
			// If it is a node unlikely to be stringify-ed or looped over
			// use plain assignment
			if ( owner.nodeType ) {
				owner[ this.expando ] = value;
	
			// Otherwise secure it in a non-enumerable, non-writable property
			// configurability must be true to allow the property to be
			// deleted with the delete operator
			} else {
				Object.defineProperty( owner, this.expando, {
					value: value,
					writable: true,
					configurable: true
				} );
			}
			return owner[ this.expando ];
		},
		cache: function( owner ) {
	
			// We can accept data for non-element nodes in modern browsers,
			// but we should not, see #8335.
			// Always return an empty object.
			if ( !acceptData( owner ) ) {
				return {};
			}
	
			// Check if the owner object already has a cache
			var value = owner[ this.expando ];
	
			// If not, create one
			if ( !value ) {
				value = {};
	
				// We can accept data for non-element nodes in modern browsers,
				// but we should not, see #8335.
				// Always return an empty object.
				if ( acceptData( owner ) ) {
	
					// If it is a node unlikely to be stringify-ed or looped over
					// use plain assignment
					if ( owner.nodeType ) {
						owner[ this.expando ] = value;
	
					// Otherwise secure it in a non-enumerable property
					// configurable must be true to allow the property to be
					// deleted when data is removed
					} else {
						Object.defineProperty( owner, this.expando, {
							value: value,
							configurable: true
						} );
					}
				}
			}
	
			return value;
		},
		set: function( owner, data, value ) {
			var prop,
				cache = this.cache( owner );
	
			// Handle: [ owner, key, value ] args
			if ( typeof data === "string" ) {
				cache[ data ] = value;
	
			// Handle: [ owner, { properties } ] args
			} else {
	
				// Copy the properties one-by-one to the cache object
				for ( prop in data ) {
					cache[ prop ] = data[ prop ];
				}
			}
			return cache;
		},
		get: function( owner, key ) {
			return key === undefined ?
				this.cache( owner ) :
				owner[ this.expando ] && owner[ this.expando ][ key ];
		},
		access: function( owner, key, value ) {
			var stored;
	
			// In cases where either:
			//
			//   1. No key was specified
			//   2. A string key was specified, but no value provided
			//
			// Take the "read" path and allow the get method to determine
			// which value to return, respectively either:
			//
			//   1. The entire cache object
			//   2. The data stored at the key
			//
			if ( key === undefined ||
					( ( key && typeof key === "string" ) && value === undefined ) ) {
	
				stored = this.get( owner, key );
	
				return stored !== undefined ?
					stored : this.get( owner, jQuery.camelCase( key ) );
			}
	
			// When the key is not a string, or both a key and value
			// are specified, set or extend (existing objects) with either:
			//
			//   1. An object of properties
			//   2. A key and value
			//
			this.set( owner, key, value );
	
			// Since the "set" path can have two possible entry points
			// return the expected data based on which path was taken[*]
			return value !== undefined ? value : key;
		},
		remove: function( owner, key ) {
			var i, name, camel,
				cache = owner[ this.expando ];
	
			if ( cache === undefined ) {
				return;
			}
	
			if ( key === undefined ) {
				this.register( owner );
	
			} else {
	
				// Support array or space separated string of keys
				if ( jQuery.isArray( key ) ) {
	
					// If "name" is an array of keys...
					// When data is initially created, via ("key", "val") signature,
					// keys will be converted to camelCase.
					// Since there is no way to tell _how_ a key was added, remove
					// both plain key and camelCase key. #12786
					// This will only penalize the array argument path.
					name = key.concat( key.map( jQuery.camelCase ) );
				} else {
					camel = jQuery.camelCase( key );
	
					// Try the string as a key before any manipulation
					if ( key in cache ) {
						name = [ key, camel ];
					} else {
	
						// If a key with the spaces exists, use it.
						// Otherwise, create an array by matching non-whitespace
						name = camel;
						name = name in cache ?
							[ name ] : ( name.match( rnotwhite ) || [] );
					}
				}
	
				i = name.length;
	
				while ( i-- ) {
					delete cache[ name[ i ] ];
				}
			}
	
			// Remove the expando if there's no more data
			if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
	
				// Support: Chrome <= 35-45+
				// Webkit & Blink performance suffers when deleting properties
				// from DOM nodes, so set to undefined instead
				// https://code.google.com/p/chromium/issues/detail?id=378607
				if ( owner.nodeType ) {
					owner[ this.expando ] = undefined;
				} else {
					delete owner[ this.expando ];
				}
			}
		},
		hasData: function( owner ) {
			var cache = owner[ this.expando ];
			return cache !== undefined && !jQuery.isEmptyObject( cache );
		}
	};
	var dataPriv = new Data();
	
	var dataUser = new Data();
	
	
	
	//	Implementation Summary
	//
	//	1. Enforce API surface and semantic compatibility with 1.9.x branch
	//	2. Improve the module's maintainability by reducing the storage
	//		paths to a single mechanism.
	//	3. Use the same single mechanism to support "private" and "user" data.
	//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
	//	5. Avoid exposing implementation details on user objects (eg. expando properties)
	//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
	
	var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
		rmultiDash = /[A-Z]/g;
	
	function dataAttr( elem, key, data ) {
		var name;
	
		// If nothing was found internally, try to fetch any
		// data from the HTML5 data-* attribute
		if ( data === undefined && elem.nodeType === 1 ) {
			name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
			data = elem.getAttribute( name );
	
			if ( typeof data === "string" ) {
				try {
					data = data === "true" ? true :
						data === "false" ? false :
						data === "null" ? null :
	
						// Only convert to a number if it doesn't change the string
						+data + "" === data ? +data :
						rbrace.test( data ) ? jQuery.parseJSON( data ) :
						data;
				} catch ( e ) {}
	
				// Make sure we set the data so it isn't changed later
				dataUser.set( elem, key, data );
			} else {
				data = undefined;
			}
		}
		return data;
	}
	
	jQuery.extend( {
		hasData: function( elem ) {
			return dataUser.hasData( elem ) || dataPriv.hasData( elem );
		},
	
		data: function( elem, name, data ) {
			return dataUser.access( elem, name, data );
		},
	
		removeData: function( elem, name ) {
			dataUser.remove( elem, name );
		},
	
		// TODO: Now that all calls to _data and _removeData have been replaced
		// with direct calls to dataPriv methods, these can be deprecated.
		_data: function( elem, name, data ) {
			return dataPriv.access( elem, name, data );
		},
	
		_removeData: function( elem, name ) {
			dataPriv.remove( elem, name );
		}
	} );
	
	jQuery.fn.extend( {
		data: function( key, value ) {
			var i, name, data,
				elem = this[ 0 ],
				attrs = elem && elem.attributes;
	
			// Gets all values
			if ( key === undefined ) {
				if ( this.length ) {
					data = dataUser.get( elem );
	
					if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
						i = attrs.length;
						while ( i-- ) {
	
							// Support: IE11+
							// The attrs elements can be null (#14894)
							if ( attrs[ i ] ) {
								name = attrs[ i ].name;
								if ( name.indexOf( "data-" ) === 0 ) {
									name = jQuery.camelCase( name.slice( 5 ) );
									dataAttr( elem, name, data[ name ] );
								}
							}
						}
						dataPriv.set( elem, "hasDataAttrs", true );
					}
				}
	
				return data;
			}
	
			// Sets multiple values
			if ( typeof key === "object" ) {
				return this.each( function() {
					dataUser.set( this, key );
				} );
			}
	
			return access( this, function( value ) {
				var data, camelKey;
	
				// The calling jQuery object (element matches) is not empty
				// (and therefore has an element appears at this[ 0 ]) and the
				// `value` parameter was not undefined. An empty jQuery object
				// will result in `undefined` for elem = this[ 0 ] which will
				// throw an exception if an attempt to read a data cache is made.
				if ( elem && value === undefined ) {
	
					// Attempt to get data from the cache
					// with the key as-is
					data = dataUser.get( elem, key ) ||
	
						// Try to find dashed key if it exists (gh-2779)
						// This is for 2.2.x only
						dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() );
	
					if ( data !== undefined ) {
						return data;
					}
	
					camelKey = jQuery.camelCase( key );
	
					// Attempt to get data from the cache
					// with the key camelized
					data = dataUser.get( elem, camelKey );
					if ( data !== undefined ) {
						return data;
					}
	
					// Attempt to "discover" the data in
					// HTML5 custom data-* attrs
					data = dataAttr( elem, camelKey, undefined );
					if ( data !== undefined ) {
						return data;
					}
	
					// We tried really hard, but the data doesn't exist.
					return;
				}
	
				// Set the data...
				camelKey = jQuery.camelCase( key );
				this.each( function() {
	
					// First, attempt to store a copy or reference of any
					// data that might've been store with a camelCased key.
					var data = dataUser.get( this, camelKey );
	
					// For HTML5 data-* attribute interop, we have to
					// store property names with dashes in a camelCase form.
					// This might not apply to all properties...*
					dataUser.set( this, camelKey, value );
	
					// *... In the case of properties that might _actually_
					// have dashes, we need to also store a copy of that
					// unchanged property.
					if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
						dataUser.set( this, key, value );
					}
				} );
			}, null, value, arguments.length > 1, null, true );
		},
	
		removeData: function( key ) {
			return this.each( function() {
				dataUser.remove( this, key );
			} );
		}
	} );
	
	
	jQuery.extend( {
		queue: function( elem, type, data ) {
			var queue;
	
			if ( elem ) {
				type = ( type || "fx" ) + "queue";
				queue = dataPriv.get( elem, type );
	
				// Speed up dequeue by getting out quickly if this is just a lookup
				if ( data ) {
					if ( !queue || jQuery.isArray( data ) ) {
						queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
					} else {
						queue.push( data );
					}
				}
				return queue || [];
			}
		},
	
		dequeue: function( elem, type ) {
			type = type || "fx";
	
			var queue = jQuery.queue( elem, type ),
				startLength = queue.length,
				fn = queue.shift(),
				hooks = jQuery._queueHooks( elem, type ),
				next = function() {
					jQuery.dequeue( elem, type );
				};
	
			// If the fx queue is dequeued, always remove the progress sentinel
			if ( fn === "inprogress" ) {
				fn = queue.shift();
				startLength--;
			}
	
			if ( fn ) {
	
				// Add a progress sentinel to prevent the fx queue from being
				// automatically dequeued
				if ( type === "fx" ) {
					queue.unshift( "inprogress" );
				}
	
				// Clear up the last queue stop function
				delete hooks.stop;
				fn.call( elem, next, hooks );
			}
	
			if ( !startLength && hooks ) {
				hooks.empty.fire();
			}
		},
	
		// Not public - generate a queueHooks object, or return the current one
		_queueHooks: function( elem, type ) {
			var key = type + "queueHooks";
			return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
				empty: jQuery.Callbacks( "once memory" ).add( function() {
					dataPriv.remove( elem, [ type + "queue", key ] );
				} )
			} );
		}
	} );
	
	jQuery.fn.extend( {
		queue: function( type, data ) {
			var setter = 2;
	
			if ( typeof type !== "string" ) {
				data = type;
				type = "fx";
				setter--;
			}
	
			if ( arguments.length < setter ) {
				return jQuery.queue( this[ 0 ], type );
			}
	
			return data === undefined ?
				this :
				this.each( function() {
					var queue = jQuery.queue( this, type, data );
	
					// Ensure a hooks for this queue
					jQuery._queueHooks( this, type );
	
					if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
						jQuery.dequeue( this, type );
					}
				} );
		},
		dequeue: function( type ) {
			return this.each( function() {
				jQuery.dequeue( this, type );
			} );
		},
		clearQueue: function( type ) {
			return this.queue( type || "fx", [] );
		},
	
		// Get a promise resolved when queues of a certain type
		// are emptied (fx is the type by default)
		promise: function( type, obj ) {
			var tmp,
				count = 1,
				defer = jQuery.Deferred(),
				elements = this,
				i = this.length,
				resolve = function() {
					if ( !( --count ) ) {
						defer.resolveWith( elements, [ elements ] );
					}
				};
	
			if ( typeof type !== "string" ) {
				obj = type;
				type = undefined;
			}
			type = type || "fx";
	
			while ( i-- ) {
				tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
				if ( tmp && tmp.empty ) {
					count++;
					tmp.empty.add( resolve );
				}
			}
			resolve();
			return defer.promise( obj );
		}
	} );
	var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
	
	var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
	
	
	var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
	
	var isHidden = function( elem, el ) {
	
			// isHidden might be called from jQuery#filter function;
			// in that case, element will be second argument
			elem = el || elem;
			return jQuery.css( elem, "display" ) === "none" ||
				!jQuery.contains( elem.ownerDocument, elem );
		};
	
	
	
	function adjustCSS( elem, prop, valueParts, tween ) {
		var adjusted,
			scale = 1,
			maxIterations = 20,
			currentValue = tween ?
				function() { return tween.cur(); } :
				function() { return jQuery.css( elem, prop, "" ); },
			initial = currentValue(),
			unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
	
			// Starting value computation is required for potential unit mismatches
			initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
				rcssNum.exec( jQuery.css( elem, prop ) );
	
		if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
	
			// Trust units reported by jQuery.css
			unit = unit || initialInUnit[ 3 ];
	
			// Make sure we update the tween properties later on
			valueParts = valueParts || [];
	
			// Iteratively approximate from a nonzero starting point
			initialInUnit = +initial || 1;
	
			do {
	
				// If previous iteration zeroed out, double until we get *something*.
				// Use string for doubling so we don't accidentally see scale as unchanged below
				scale = scale || ".5";
	
				// Adjust and apply
				initialInUnit = initialInUnit / scale;
				jQuery.style( elem, prop, initialInUnit + unit );
	
			// Update scale, tolerating zero or NaN from tween.cur()
			// Break the loop if scale is unchanged or perfect, or if we've just had enough.
			} while (
				scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
			);
		}
	
		if ( valueParts ) {
			initialInUnit = +initialInUnit || +initial || 0;
	
			// Apply relative offset (+=/-=) if specified
			adjusted = valueParts[ 1 ] ?
				initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
				+valueParts[ 2 ];
			if ( tween ) {
				tween.unit = unit;
				tween.start = initialInUnit;
				tween.end = adjusted;
			}
		}
		return adjusted;
	}
	var rcheckableType = ( /^(?:checkbox|radio)$/i );
	
	var rtagName = ( /<([\w:-]+)/ );
	
	var rscriptType = ( /^$|\/(?:java|ecma)script/i );
	
	
	
	// We have to close these tags to support XHTML (#13200)
	var wrapMap = {
	
		// Support: IE9
		option: [ 1, "<select multiple='multiple'>", "</select>" ],
	
		// XHTML parsers do not magically insert elements in the
		// same way that tag soup parsers do. So we cannot shorten
		// this by omitting <tbody> or other required elements.
		thead: [ 1, "<table>", "</table>" ],
		col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
		tr: [ 2, "<table><tbody>", "</tbody></table>" ],
		td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
	
		_default: [ 0, "", "" ]
	};
	
	// Support: IE9
	wrapMap.optgroup = wrapMap.option;
	
	wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
	wrapMap.th = wrapMap.td;
	
	
	function getAll( context, tag ) {
	
		// Support: IE9-11+
		// Use typeof to avoid zero-argument method invocation on host objects (#15151)
		var ret = typeof context.getElementsByTagName !== "undefined" ?
				context.getElementsByTagName( tag || "*" ) :
				typeof context.querySelectorAll !== "undefined" ?
					context.querySelectorAll( tag || "*" ) :
				[];
	
		return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
			jQuery.merge( [ context ], ret ) :
			ret;
	}
	
	
	// Mark scripts as having already been evaluated
	function setGlobalEval( elems, refElements ) {
		var i = 0,
			l = elems.length;
	
		for ( ; i < l; i++ ) {
			dataPriv.set(
				elems[ i ],
				"globalEval",
				!refElements || dataPriv.get( refElements[ i ], "globalEval" )
			);
		}
	}
	
	
	var rhtml = /<|&#?\w+;/;
	
	function buildFragment( elems, context, scripts, selection, ignored ) {
		var elem, tmp, tag, wrap, contains, j,
			fragment = context.createDocumentFragment(),
			nodes = [],
			i = 0,
			l = elems.length;
	
		for ( ; i < l; i++ ) {
			elem = elems[ i ];
	
			if ( elem || elem === 0 ) {
	
				// Add nodes directly
				if ( jQuery.type( elem ) === "object" ) {
	
					// Support: Android<4.1, PhantomJS<2
					// push.apply(_, arraylike) throws on ancient WebKit
					jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
	
				// Convert non-html into a text node
				} else if ( !rhtml.test( elem ) ) {
					nodes.push( context.createTextNode( elem ) );
	
				// Convert html into DOM nodes
				} else {
					tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
	
					// Deserialize a standard representation
					tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
					wrap = wrapMap[ tag ] || wrapMap._default;
					tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
	
					// Descend through wrappers to the right content
					j = wrap[ 0 ];
					while ( j-- ) {
						tmp = tmp.lastChild;
					}
	
					// Support: Android<4.1, PhantomJS<2
					// push.apply(_, arraylike) throws on ancient WebKit
					jQuery.merge( nodes, tmp.childNodes );
	
					// Remember the top-level container
					tmp = fragment.firstChild;
	
					// Ensure the created nodes are orphaned (#12392)
					tmp.textContent = "";
				}
			}
		}
	
		// Remove wrapper from fragment
		fragment.textContent = "";
	
		i = 0;
		while ( ( elem = nodes[ i++ ] ) ) {
	
			// Skip elements already in the context collection (trac-4087)
			if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
				if ( ignored ) {
					ignored.push( elem );
				}
				continue;
			}
	
			contains = jQuery.contains( elem.ownerDocument, elem );
	
			// Append to fragment
			tmp = getAll( fragment.appendChild( elem ), "script" );
	
			// Preserve script evaluation history
			if ( contains ) {
				setGlobalEval( tmp );
			}
	
			// Capture executables
			if ( scripts ) {
				j = 0;
				while ( ( elem = tmp[ j++ ] ) ) {
					if ( rscriptType.test( elem.type || "" ) ) {
						scripts.push( elem );
					}
				}
			}
		}
	
		return fragment;
	}
	
	
	( function() {
		var fragment = document.createDocumentFragment(),
			div = fragment.appendChild( document.createElement( "div" ) ),
			input = document.createElement( "input" );
	
		// Support: Android 4.0-4.3, Safari<=5.1
		// Check state lost if the name is set (#11217)
		// Support: Windows Web Apps (WWA)
		// `name` and `type` must use .setAttribute for WWA (#14901)
		input.setAttribute( "type", "radio" );
		input.setAttribute( "checked", "checked" );
		input.setAttribute( "name", "t" );
	
		div.appendChild( input );
	
		// Support: Safari<=5.1, Android<4.2
		// Older WebKit doesn't clone checked state correctly in fragments
		support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
	
		// Support: IE<=11+
		// Make sure textarea (and checkbox) defaultValue is properly cloned
		div.innerHTML = "<textarea>x</textarea>";
		support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
	} )();
	
	
	var
		rkeyEvent = /^key/,
		rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
		rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
	
	function returnTrue() {
		return true;
	}
	
	function returnFalse() {
		return false;
	}
	
	// Support: IE9
	// See #13393 for more info
	function safeActiveElement() {
		try {
			return document.activeElement;
		} catch ( err ) { }
	}
	
	function on( elem, types, selector, data, fn, one ) {
		var origFn, type;
	
		// Types can be a map of types/handlers
		if ( typeof types === "object" ) {
	
			// ( types-Object, selector, data )
			if ( typeof selector !== "string" ) {
	
				// ( types-Object, data )
				data = data || selector;
				selector = undefined;
			}
			for ( type in types ) {
				on( elem, type, selector, data, types[ type ], one );
			}
			return elem;
		}
	
		if ( data == null && fn == null ) {
	
			// ( types, fn )
			fn = selector;
			data = selector = undefined;
		} else if ( fn == null ) {
			if ( typeof selector === "string" ) {
	
				// ( types, selector, fn )
				fn = data;
				data = undefined;
			} else {
	
				// ( types, data, fn )
				fn = data;
				data = selector;
				selector = undefined;
			}
		}
		if ( fn === false ) {
			fn = returnFalse;
		} else if ( !fn ) {
			return elem;
		}
	
		if ( one === 1 ) {
			origFn = fn;
			fn = function( event ) {
	
				// Can use an empty set, since event contains the info
				jQuery().off( event );
				return origFn.apply( this, arguments );
			};
	
			// Use same guid so caller can remove using origFn
			fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
		}
		return elem.each( function() {
			jQuery.event.add( this, types, fn, data, selector );
		} );
	}
	
	/*
	 * Helper functions for managing events -- not part of the public interface.
	 * Props to Dean Edwards' addEvent library for many of the ideas.
	 */
	jQuery.event = {
	
		global: {},
	
		add: function( elem, types, handler, data, selector ) {
	
			var handleObjIn, eventHandle, tmp,
				events, t, handleObj,
				special, handlers, type, namespaces, origType,
				elemData = dataPriv.get( elem );
	
			// Don't attach events to noData or text/comment nodes (but allow plain objects)
			if ( !elemData ) {
				return;
			}
	
			// Caller can pass in an object of custom data in lieu of the handler
			if ( handler.handler ) {
				handleObjIn = handler;
				handler = handleObjIn.handler;
				selector = handleObjIn.selector;
			}
	
			// Make sure that the handler has a unique ID, used to find/remove it later
			if ( !handler.guid ) {
				handler.guid = jQuery.guid++;
			}
	
			// Init the element's event structure and main handler, if this is the first
			if ( !( events = elemData.events ) ) {
				events = elemData.events = {};
			}
			if ( !( eventHandle = elemData.handle ) ) {
				eventHandle = elemData.handle = function( e ) {
	
					// Discard the second event of a jQuery.event.trigger() and
					// when an event is called after a page has unloaded
					return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
						jQuery.event.dispatch.apply( elem, arguments ) : undefined;
				};
			}
	
			// Handle multiple events separated by a space
			types = ( types || "" ).match( rnotwhite ) || [ "" ];
			t = types.length;
			while ( t-- ) {
				tmp = rtypenamespace.exec( types[ t ] ) || [];
				type = origType = tmp[ 1 ];
				namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
	
				// There *must* be a type, no attaching namespace-only handlers
				if ( !type ) {
					continue;
				}
	
				// If event changes its type, use the special event handlers for the changed type
				special = jQuery.event.special[ type ] || {};
	
				// If selector defined, determine special event api type, otherwise given type
				type = ( selector ? special.delegateType : special.bindType ) || type;
	
				// Update special based on newly reset type
				special = jQuery.event.special[ type ] || {};
	
				// handleObj is passed to all event handlers
				handleObj = jQuery.extend( {
					type: type,
					origType: origType,
					data: data,
					handler: handler,
					guid: handler.guid,
					selector: selector,
					needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
					namespace: namespaces.join( "." )
				}, handleObjIn );
	
				// Init the event handler queue if we're the first
				if ( !( handlers = events[ type ] ) ) {
					handlers = events[ type ] = [];
					handlers.delegateCount = 0;
	
					// Only use addEventListener if the special events handler returns false
					if ( !special.setup ||
						special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
	
						if ( elem.addEventListener ) {
							elem.addEventListener( type, eventHandle );
						}
					}
				}
	
				if ( special.add ) {
					special.add.call( elem, handleObj );
	
					if ( !handleObj.handler.guid ) {
						handleObj.handler.guid = handler.guid;
					}
				}
	
				// Add to the element's handler list, delegates in front
				if ( selector ) {
					handlers.splice( handlers.delegateCount++, 0, handleObj );
				} else {
					handlers.push( handleObj );
				}
	
				// Keep track of which events have ever been used, for event optimization
				jQuery.event.global[ type ] = true;
			}
	
		},
	
		// Detach an event or set of events from an element
		remove: function( elem, types, handler, selector, mappedTypes ) {
	
			var j, origCount, tmp,
				events, t, handleObj,
				special, handlers, type, namespaces, origType,
				elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
	
			if ( !elemData || !( events = elemData.events ) ) {
				return;
			}
	
			// Once for each type.namespace in types; type may be omitted
			types = ( types || "" ).match( rnotwhite ) || [ "" ];
			t = types.length;
			while ( t-- ) {
				tmp = rtypenamespace.exec( types[ t ] ) || [];
				type = origType = tmp[ 1 ];
				namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
	
				// Unbind all events (on this namespace, if provided) for the element
				if ( !type ) {
					for ( type in events ) {
						jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
					}
					continue;
				}
	
				special = jQuery.event.special[ type ] || {};
				type = ( selector ? special.delegateType : special.bindType ) || type;
				handlers = events[ type ] || [];
				tmp = tmp[ 2 ] &&
					new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
	
				// Remove matching events
				origCount = j = handlers.length;
				while ( j-- ) {
					handleObj = handlers[ j ];
	
					if ( ( mappedTypes || origType === handleObj.origType ) &&
						( !handler || handler.guid === handleObj.guid ) &&
						( !tmp || tmp.test( handleObj.namespace ) ) &&
						( !selector || selector === handleObj.selector ||
							selector === "**" && handleObj.selector ) ) {
						handlers.splice( j, 1 );
	
						if ( handleObj.selector ) {
							handlers.delegateCount--;
						}
						if ( special.remove ) {
							special.remove.call( elem, handleObj );
						}
					}
				}
	
				// Remove generic event handler if we removed something and no more handlers exist
				// (avoids potential for endless recursion during removal of special event handlers)
				if ( origCount && !handlers.length ) {
					if ( !special.teardown ||
						special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
	
						jQuery.removeEvent( elem, type, elemData.handle );
					}
	
					delete events[ type ];
				}
			}
	
			// Remove data and the expando if it's no longer used
			if ( jQuery.isEmptyObject( events ) ) {
				dataPriv.remove( elem, "handle events" );
			}
		},
	
		dispatch: function( event ) {
	
			// Make a writable jQuery.Event from the native event object
			event = jQuery.event.fix( event );
	
			var i, j, ret, matched, handleObj,
				handlerQueue = [],
				args = slice.call( arguments ),
				handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
				special = jQuery.event.special[ event.type ] || {};
	
			// Use the fix-ed jQuery.Event rather than the (read-only) native event
			args[ 0 ] = event;
			event.delegateTarget = this;
	
			// Call the preDispatch hook for the mapped type, and let it bail if desired
			if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
				return;
			}
	
			// Determine handlers
			handlerQueue = jQuery.event.handlers.call( this, event, handlers );
	
			// Run delegates first; they may want to stop propagation beneath us
			i = 0;
			while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
				event.currentTarget = matched.elem;
	
				j = 0;
				while ( ( handleObj = matched.handlers[ j++ ] ) &&
					!event.isImmediatePropagationStopped() ) {
	
					// Triggered event must either 1) have no namespace, or 2) have namespace(s)
					// a subset or equal to those in the bound event (both can have no namespace).
					if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
	
						event.handleObj = handleObj;
						event.data = handleObj.data;
	
						ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
							handleObj.handler ).apply( matched.elem, args );
	
						if ( ret !== undefined ) {
							if ( ( event.result = ret ) === false ) {
								event.preventDefault();
								event.stopPropagation();
							}
						}
					}
				}
			}
	
			// Call the postDispatch hook for the mapped type
			if ( special.postDispatch ) {
				special.postDispatch.call( this, event );
			}
	
			return event.result;
		},
	
		handlers: function( event, handlers ) {
			var i, matches, sel, handleObj,
				handlerQueue = [],
				delegateCount = handlers.delegateCount,
				cur = event.target;
	
			// Support (at least): Chrome, IE9
			// Find delegate handlers
			// Black-hole SVG <use> instance trees (#13180)
			//
			// Support: Firefox<=42+
			// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
			if ( delegateCount && cur.nodeType &&
				( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
	
				for ( ; cur !== this; cur = cur.parentNode || this ) {
	
					// Don't check non-elements (#13208)
					// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
					if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
						matches = [];
						for ( i = 0; i < delegateCount; i++ ) {
							handleObj = handlers[ i ];
	
							// Don't conflict with Object.prototype properties (#13203)
							sel = handleObj.selector + " ";
	
							if ( matches[ sel ] === undefined ) {
								matches[ sel ] = handleObj.needsContext ?
									jQuery( sel, this ).index( cur ) > -1 :
									jQuery.find( sel, this, null, [ cur ] ).length;
							}
							if ( matches[ sel ] ) {
								matches.push( handleObj );
							}
						}
						if ( matches.length ) {
							handlerQueue.push( { elem: cur, handlers: matches } );
						}
					}
				}
			}
	
			// Add the remaining (directly-bound) handlers
			if ( delegateCount < handlers.length ) {
				handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
			}
	
			return handlerQueue;
		},
	
		// Includes some event props shared by KeyEvent and MouseEvent
		props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
			"metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
	
		fixHooks: {},
	
		keyHooks: {
			props: "char charCode key keyCode".split( " " ),
			filter: function( event, original ) {
	
				// Add which for key events
				if ( event.which == null ) {
					event.which = original.charCode != null ? original.charCode : original.keyCode;
				}
	
				return event;
			}
		},
	
		mouseHooks: {
			props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " +
				"screenX screenY toElement" ).split( " " ),
			filter: function( event, original ) {
				var eventDoc, doc, body,
					button = original.button;
	
				// Calculate pageX/Y if missing and clientX/Y available
				if ( event.pageX == null && original.clientX != null ) {
					eventDoc = event.target.ownerDocument || document;
					doc = eventDoc.documentElement;
					body = eventDoc.body;
	
					event.pageX = original.clientX +
						( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
						( doc && doc.clientLeft || body && body.clientLeft || 0 );
					event.pageY = original.clientY +
						( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) -
						( doc && doc.clientTop  || body && body.clientTop  || 0 );
				}
	
				// Add which for click: 1 === left; 2 === middle; 3 === right
				// Note: button is not normalized, so don't use it
				if ( !event.which && button !== undefined ) {
					event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
				}
	
				return event;
			}
		},
	
		fix: function( event ) {
			if ( event[ jQuery.expando ] ) {
				return event;
			}
	
			// Create a writable copy of the event object and normalize some properties
			var i, prop, copy,
				type = event.type,
				originalEvent = event,
				fixHook = this.fixHooks[ type ];
	
			if ( !fixHook ) {
				this.fixHooks[ type ] = fixHook =
					rmouseEvent.test( type ) ? this.mouseHooks :
					rkeyEvent.test( type ) ? this.keyHooks :
					{};
			}
			copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
	
			event = new jQuery.Event( originalEvent );
	
			i = copy.length;
			while ( i-- ) {
				prop = copy[ i ];
				event[ prop ] = originalEvent[ prop ];
			}
	
			// Support: Cordova 2.5 (WebKit) (#13255)
			// All events should have a target; Cordova deviceready doesn't
			if ( !event.target ) {
				event.target = document;
			}
	
			// Support: Safari 6.0+, Chrome<28
			// Target should not be a text node (#504, #13143)
			if ( event.target.nodeType === 3 ) {
				event.target = event.target.parentNode;
			}
	
			return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
		},
	
		special: {
			load: {
	
				// Prevent triggered image.load events from bubbling to window.load
				noBubble: true
			},
			focus: {
	
				// Fire native event if possible so blur/focus sequence is correct
				trigger: function() {
					if ( this !== safeActiveElement() && this.focus ) {
						this.focus();
						return false;
					}
				},
				delegateType: "focusin"
			},
			blur: {
				trigger: function() {
					if ( this === safeActiveElement() && this.blur ) {
						this.blur();
						return false;
					}
				},
				delegateType: "focusout"
			},
			click: {
	
				// For checkbox, fire native event so checked state will be right
				trigger: function() {
					if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
						this.click();
						return false;
					}
				},
	
				// For cross-browser consistency, don't fire native .click() on links
				_default: function( event ) {
					return jQuery.nodeName( event.target, "a" );
				}
			},
	
			beforeunload: {
				postDispatch: function( event ) {
	
					// Support: Firefox 20+
					// Firefox doesn't alert if the returnValue field is not set.
					if ( event.result !== undefined && event.originalEvent ) {
						event.originalEvent.returnValue = event.result;
					}
				}
			}
		}
	};
	
	jQuery.removeEvent = function( elem, type, handle ) {
	
		// This "if" is needed for plain objects
		if ( elem.removeEventListener ) {
			elem.removeEventListener( type, handle );
		}
	};
	
	jQuery.Event = function( src, props ) {
	
		// Allow instantiation without the 'new' keyword
		if ( !( this instanceof jQuery.Event ) ) {
			return new jQuery.Event( src, props );
		}
	
		// Event object
		if ( src && src.type ) {
			this.originalEvent = src;
			this.type = src.type;
	
			// Events bubbling up the document may have been marked as prevented
			// by a handler lower down the tree; reflect the correct value.
			this.isDefaultPrevented = src.defaultPrevented ||
					src.defaultPrevented === undefined &&
	
					// Support: Android<4.0
					src.returnValue === false ?
				returnTrue :
				returnFalse;
	
		// Event type
		} else {
			this.type = src;
		}
	
		// Put explicitly provided properties onto the event object
		if ( props ) {
			jQuery.extend( this, props );
		}
	
		// Create a timestamp if incoming event doesn't have one
		this.timeStamp = src && src.timeStamp || jQuery.now();
	
		// Mark it as fixed
		this[ jQuery.expando ] = true;
	};
	
	// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
	// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
	jQuery.Event.prototype = {
		constructor: jQuery.Event,
		isDefaultPrevented: returnFalse,
		isPropagationStopped: returnFalse,
		isImmediatePropagationStopped: returnFalse,
		isSimulated: false,
	
		preventDefault: function() {
			var e = this.originalEvent;
	
			this.isDefaultPrevented = returnTrue;
	
			if ( e && !this.isSimulated ) {
				e.preventDefault();
			}
		},
		stopPropagation: function() {
			var e = this.originalEvent;
	
			this.isPropagationStopped = returnTrue;
	
			if ( e && !this.isSimulated ) {
				e.stopPropagation();
			}
		},
		stopImmediatePropagation: function() {
			var e = this.originalEvent;
	
			this.isImmediatePropagationStopped = returnTrue;
	
			if ( e && !this.isSimulated ) {
				e.stopImmediatePropagation();
			}
	
			this.stopPropagation();
		}
	};
	
	// Create mouseenter/leave events using mouseover/out and event-time checks
	// so that event delegation works in jQuery.
	// Do the same for pointerenter/pointerleave and pointerover/pointerout
	//
	// Support: Safari 7 only
	// Safari sends mouseenter too often; see:
	// https://code.google.com/p/chromium/issues/detail?id=470258
	// for the description of the bug (it existed in older Chrome versions as well).
	jQuery.each( {
		mouseenter: "mouseover",
		mouseleave: "mouseout",
		pointerenter: "pointerover",
		pointerleave: "pointerout"
	}, function( orig, fix ) {
		jQuery.event.special[ orig ] = {
			delegateType: fix,
			bindType: fix,
	
			handle: function( event ) {
				var ret,
					target = this,
					related = event.relatedTarget,
					handleObj = event.handleObj;
	
				// For mouseenter/leave call the handler if related is outside the target.
				// NB: No relatedTarget if the mouse left/entered the browser window
				if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
					event.type = handleObj.origType;
					ret = handleObj.handler.apply( this, arguments );
					event.type = fix;
				}
				return ret;
			}
		};
	} );
	
	jQuery.fn.extend( {
		on: function( types, selector, data, fn ) {
			return on( this, types, selector, data, fn );
		},
		one: function( types, selector, data, fn ) {
			return on( this, types, selector, data, fn, 1 );
		},
		off: function( types, selector, fn ) {
			var handleObj, type;
			if ( types && types.preventDefault && types.handleObj ) {
	
				// ( event )  dispatched jQuery.Event
				handleObj = types.handleObj;
				jQuery( types.delegateTarget ).off(
					handleObj.namespace ?
						handleObj.origType + "." + handleObj.namespace :
						handleObj.origType,
					handleObj.selector,
					handleObj.handler
				);
				return this;
			}
			if ( typeof types === "object" ) {
	
				// ( types-object [, selector] )
				for ( type in types ) {
					this.off( type, selector, types[ type ] );
				}
				return this;
			}
			if ( selector === false || typeof selector === "function" ) {
	
				// ( types [, fn] )
				fn = selector;
				selector = undefined;
			}
			if ( fn === false ) {
				fn = returnFalse;
			}
			return this.each( function() {
				jQuery.event.remove( this, types, fn, selector );
			} );
		}
	} );
	
	
	var
		rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
	
		// Support: IE 10-11, Edge 10240+
		// In IE/Edge using regex groups here causes severe slowdowns.
		// See https://connect.microsoft.com/IE/feedback/details/1736512/
		rnoInnerhtml = /<script|<style|<link/i,
	
		// checked="checked" or checked
		rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
		rscriptTypeMasked = /^true\/(.*)/,
		rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
	
	// Manipulating tables requires a tbody
	function manipulationTarget( elem, content ) {
		return jQuery.nodeName( elem, "table" ) &&
			jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
	
			elem.getElementsByTagName( "tbody" )[ 0 ] ||
				elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
			elem;
	}
	
	// Replace/restore the type attribute of script elements for safe DOM manipulation
	function disableScript( elem ) {
		elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
		return elem;
	}
	function restoreScript( elem ) {
		var match = rscriptTypeMasked.exec( elem.type );
	
		if ( match ) {
			elem.type = match[ 1 ];
		} else {
			elem.removeAttribute( "type" );
		}
	
		return elem;
	}
	
	function cloneCopyEvent( src, dest ) {
		var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
	
		if ( dest.nodeType !== 1 ) {
			return;
		}
	
		// 1. Copy private data: events, handlers, etc.
		if ( dataPriv.hasData( src ) ) {
			pdataOld = dataPriv.access( src );
			pdataCur = dataPriv.set( dest, pdataOld );
			events = pdataOld.events;
	
			if ( events ) {
				delete pdataCur.handle;
				pdataCur.events = {};
	
				for ( type in events ) {
					for ( i = 0, l = events[ type ].length; i < l; i++ ) {
						jQuery.event.add( dest, type, events[ type ][ i ] );
					}
				}
			}
		}
	
		// 2. Copy user data
		if ( dataUser.hasData( src ) ) {
			udataOld = dataUser.access( src );
			udataCur = jQuery.extend( {}, udataOld );
	
			dataUser.set( dest, udataCur );
		}
	}
	
	// Fix IE bugs, see support tests
	function fixInput( src, dest ) {
		var nodeName = dest.nodeName.toLowerCase();
	
		// Fails to persist the checked state of a cloned checkbox or radio button.
		if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
			dest.checked = src.checked;
	
		// Fails to return the selected option to the default selected state when cloning options
		} else if ( nodeName === "input" || nodeName === "textarea" ) {
			dest.defaultValue = src.defaultValue;
		}
	}
	
	function domManip( collection, args, callback, ignored ) {
	
		// Flatten any nested arrays
		args = concat.apply( [], args );
	
		var fragment, first, scripts, hasScripts, node, doc,
			i = 0,
			l = collection.length,
			iNoClone = l - 1,
			value = args[ 0 ],
			isFunction = jQuery.isFunction( value );
	
		// We can't cloneNode fragments that contain checked, in WebKit
		if ( isFunction ||
				( l > 1 && typeof value === "string" &&
					!support.checkClone && rchecked.test( value ) ) ) {
			return collection.each( function( index ) {
				var self = collection.eq( index );
				if ( isFunction ) {
					args[ 0 ] = value.call( this, index, self.html() );
				}
				domManip( self, args, callback, ignored );
			} );
		}
	
		if ( l ) {
			fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
			first = fragment.firstChild;
	
			if ( fragment.childNodes.length === 1 ) {
				fragment = first;
			}
	
			// Require either new content or an interest in ignored elements to invoke the callback
			if ( first || ignored ) {
				scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
				hasScripts = scripts.length;
	
				// Use the original fragment for the last item
				// instead of the first because it can end up
				// being emptied incorrectly in certain situations (#8070).
				for ( ; i < l; i++ ) {
					node = fragment;
	
					if ( i !== iNoClone ) {
						node = jQuery.clone( node, true, true );
	
						// Keep references to cloned scripts for later restoration
						if ( hasScripts ) {
	
							// Support: Android<4.1, PhantomJS<2
							// push.apply(_, arraylike) throws on ancient WebKit
							jQuery.merge( scripts, getAll( node, "script" ) );
						}
					}
	
					callback.call( collection[ i ], node, i );
				}
	
				if ( hasScripts ) {
					doc = scripts[ scripts.length - 1 ].ownerDocument;
	
					// Reenable scripts
					jQuery.map( scripts, restoreScript );
	
					// Evaluate executable scripts on first document insertion
					for ( i = 0; i < hasScripts; i++ ) {
						node = scripts[ i ];
						if ( rscriptType.test( node.type || "" ) &&
							!dataPriv.access( node, "globalEval" ) &&
							jQuery.contains( doc, node ) ) {
	
							if ( node.src ) {
	
								// Optional AJAX dependency, but won't run scripts if not present
								if ( jQuery._evalUrl ) {
									jQuery._evalUrl( node.src );
								}
							} else {
								jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
							}
						}
					}
				}
			}
		}
	
		return collection;
	}
	
	function remove( elem, selector, keepData ) {
		var node,
			nodes = selector ? jQuery.filter( selector, elem ) : elem,
			i = 0;
	
		for ( ; ( node = nodes[ i ] ) != null; i++ ) {
			if ( !keepData && node.nodeType === 1 ) {
				jQuery.cleanData( getAll( node ) );
			}
	
			if ( node.parentNode ) {
				if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
					setGlobalEval( getAll( node, "script" ) );
				}
				node.parentNode.removeChild( node );
			}
		}
	
		return elem;
	}
	
	jQuery.extend( {
		htmlPrefilter: function( html ) {
			return html.replace( rxhtmlTag, "<$1></$2>" );
		},
	
		clone: function( elem, dataAndEvents, deepDataAndEvents ) {
			var i, l, srcElements, destElements,
				clone = elem.cloneNode( true ),
				inPage = jQuery.contains( elem.ownerDocument, elem );
	
			// Fix IE cloning issues
			if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
					!jQuery.isXMLDoc( elem ) ) {
	
				// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
				destElements = getAll( clone );
				srcElements = getAll( elem );
	
				for ( i = 0, l = srcElements.length; i < l; i++ ) {
					fixInput( srcElements[ i ], destElements[ i ] );
				}
			}
	
			// Copy the events from the original to the clone
			if ( dataAndEvents ) {
				if ( deepDataAndEvents ) {
					srcElements = srcElements || getAll( elem );
					destElements = destElements || getAll( clone );
	
					for ( i = 0, l = srcElements.length; i < l; i++ ) {
						cloneCopyEvent( srcElements[ i ], destElements[ i ] );
					}
				} else {
					cloneCopyEvent( elem, clone );
				}
			}
	
			// Preserve script evaluation history
			destElements = getAll( clone, "script" );
			if ( destElements.length > 0 ) {
				setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
			}
	
			// Return the cloned set
			return clone;
		},
	
		cleanData: function( elems ) {
			var data, elem, type,
				special = jQuery.event.special,
				i = 0;
	
			for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
				if ( acceptData( elem ) ) {
					if ( ( data = elem[ dataPriv.expando ] ) ) {
						if ( data.events ) {
							for ( type in data.events ) {
								if ( special[ type ] ) {
									jQuery.event.remove( elem, type );
	
								// This is a shortcut to avoid jQuery.event.remove's overhead
								} else {
									jQuery.removeEvent( elem, type, data.handle );
								}
							}
						}
	
						// Support: Chrome <= 35-45+
						// Assign undefined instead of using delete, see Data#remove
						elem[ dataPriv.expando ] = undefined;
					}
					if ( elem[ dataUser.expando ] ) {
	
						// Support: Chrome <= 35-45+
						// Assign undefined instead of using delete, see Data#remove
						elem[ dataUser.expando ] = undefined;
					}
				}
			}
		}
	} );
	
	jQuery.fn.extend( {
	
		// Keep domManip exposed until 3.0 (gh-2225)
		domManip: domManip,
	
		detach: function( selector ) {
			return remove( this, selector, true );
		},
	
		remove: function( selector ) {
			return remove( this, selector );
		},
	
		text: function( value ) {
			return access( this, function( value ) {
				return value === undefined ?
					jQuery.text( this ) :
					this.empty().each( function() {
						if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
							this.textContent = value;
						}
					} );
			}, null, value, arguments.length );
		},
	
		append: function() {
			return domManip( this, arguments, function( elem ) {
				if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
					var target = manipulationTarget( this, elem );
					target.appendChild( elem );
				}
			} );
		},
	
		prepend: function() {
			return domManip( this, arguments, function( elem ) {
				if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
					var target = manipulationTarget( this, elem );
					target.insertBefore( elem, target.firstChild );
				}
			} );
		},
	
		before: function() {
			return domManip( this, arguments, function( elem ) {
				if ( this.parentNode ) {
					this.parentNode.insertBefore( elem, this );
				}
			} );
		},
	
		after: function() {
			return domManip( this, arguments, function( elem ) {
				if ( this.parentNode ) {
					this.parentNode.insertBefore( elem, this.nextSibling );
				}
			} );
		},
	
		empty: function() {
			var elem,
				i = 0;
	
			for ( ; ( elem = this[ i ] ) != null; i++ ) {
				if ( elem.nodeType === 1 ) {
	
					// Prevent memory leaks
					jQuery.cleanData( getAll( elem, false ) );
	
					// Remove any remaining nodes
					elem.textContent = "";
				}
			}
	
			return this;
		},
	
		clone: function( dataAndEvents, deepDataAndEvents ) {
			dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
			deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
	
			return this.map( function() {
				return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
			} );
		},
	
		html: function( value ) {
			return access( this, function( value ) {
				var elem = this[ 0 ] || {},
					i = 0,
					l = this.length;
	
				if ( value === undefined && elem.nodeType === 1 ) {
					return elem.innerHTML;
				}
	
				// See if we can take a shortcut and just use innerHTML
				if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
					!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
	
					value = jQuery.htmlPrefilter( value );
	
					try {
						for ( ; i < l; i++ ) {
							elem = this[ i ] || {};
	
							// Remove element nodes and prevent memory leaks
							if ( elem.nodeType === 1 ) {
								jQuery.cleanData( getAll( elem, false ) );
								elem.innerHTML = value;
							}
						}
	
						elem = 0;
	
					// If using innerHTML throws an exception, use the fallback method
					} catch ( e ) {}
				}
	
				if ( elem ) {
					this.empty().append( value );
				}
			}, null, value, arguments.length );
		},
	
		replaceWith: function() {
			var ignored = [];
	
			// Make the changes, replacing each non-ignored context element with the new content
			return domManip( this, arguments, function( elem ) {
				var parent = this.parentNode;
	
				if ( jQuery.inArray( this, ignored ) < 0 ) {
					jQuery.cleanData( getAll( this ) );
					if ( parent ) {
						parent.replaceChild( elem, this );
					}
				}
	
			// Force callback invocation
			}, ignored );
		}
	} );
	
	jQuery.each( {
		appendTo: "append",
		prependTo: "prepend",
		insertBefore: "before",
		insertAfter: "after",
		replaceAll: "replaceWith"
	}, function( name, original ) {
		jQuery.fn[ name ] = function( selector ) {
			var elems,
				ret = [],
				insert = jQuery( selector ),
				last = insert.length - 1,
				i = 0;
	
			for ( ; i <= last; i++ ) {
				elems = i === last ? this : this.clone( true );
				jQuery( insert[ i ] )[ original ]( elems );
	
				// Support: QtWebKit
				// .get() because push.apply(_, arraylike) throws
				push.apply( ret, elems.get() );
			}
	
			return this.pushStack( ret );
		};
	} );
	
	
	var iframe,
		elemdisplay = {
	
			// Support: Firefox
			// We have to pre-define these values for FF (#10227)
			HTML: "block",
			BODY: "block"
		};
	
	/**
	 * Retrieve the actual display of a element
	 * @param {String} name nodeName of the element
	 * @param {Object} doc Document object
	 */
	
	// Called only from within defaultDisplay
	function actualDisplay( name, doc ) {
		var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
	
			display = jQuery.css( elem[ 0 ], "display" );
	
		// We don't have any data stored on the element,
		// so use "detach" method as fast way to get rid of the element
		elem.detach();
	
		return display;
	}
	
	/**
	 * Try to determine the default display value of an element
	 * @param {String} nodeName
	 */
	function defaultDisplay( nodeName ) {
		var doc = document,
			display = elemdisplay[ nodeName ];
	
		if ( !display ) {
			display = actualDisplay( nodeName, doc );
	
			// If the simple way fails, read from inside an iframe
			if ( display === "none" || !display ) {
	
				// Use the already-created iframe if possible
				iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
					.appendTo( doc.documentElement );
	
				// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
				doc = iframe[ 0 ].contentDocument;
	
				// Support: IE
				doc.write();
				doc.close();
	
				display = actualDisplay( nodeName, doc );
				iframe.detach();
			}
	
			// Store the correct default display
			elemdisplay[ nodeName ] = display;
		}
	
		return display;
	}
	var rmargin = ( /^margin/ );
	
	var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
	
	var getStyles = function( elem ) {
	
			// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
			// IE throws on elements created in popups
			// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
			var view = elem.ownerDocument.defaultView;
	
			if ( !view || !view.opener ) {
				view = window;
			}
	
			return view.getComputedStyle( elem );
		};
	
	var swap = function( elem, options, callback, args ) {
		var ret, name,
			old = {};
	
		// Remember the old values, and insert the new ones
		for ( name in options ) {
			old[ name ] = elem.style[ name ];
			elem.style[ name ] = options[ name ];
		}
	
		ret = callback.apply( elem, args || [] );
	
		// Revert the old values
		for ( name in options ) {
			elem.style[ name ] = old[ name ];
		}
	
		return ret;
	};
	
	
	var documentElement = document.documentElement;
	
	
	
	( function() {
		var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
			container = document.createElement( "div" ),
			div = document.createElement( "div" );
	
		// Finish early in limited (non-browser) environments
		if ( !div.style ) {
			return;
		}
	
		// Support: IE9-11+
		// Style of cloned element affects source element cloned (#8908)
		div.style.backgroundClip = "content-box";
		div.cloneNode( true ).style.backgroundClip = "";
		support.clearCloneStyle = div.style.backgroundClip === "content-box";
	
		container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
			"padding:0;margin-top:1px;position:absolute";
		container.appendChild( div );
	
		// Executing both pixelPosition & boxSizingReliable tests require only one layout
		// so they're executed at the same time to save the second computation.
		function computeStyleTests() {
			div.style.cssText =
	
				// Support: Firefox<29, Android 2.3
				// Vendor-prefix box-sizing
				"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
				"position:relative;display:block;" +
				"margin:auto;border:1px;padding:1px;" +
				"top:1%;width:50%";
			div.innerHTML = "";
			documentElement.appendChild( container );
	
			var divStyle = window.getComputedStyle( div );
			pixelPositionVal = divStyle.top !== "1%";
			reliableMarginLeftVal = divStyle.marginLeft === "2px";
			boxSizingReliableVal = divStyle.width === "4px";
	
			// Support: Android 4.0 - 4.3 only
			// Some styles come back with percentage values, even though they shouldn't
			div.style.marginRight = "50%";
			pixelMarginRightVal = divStyle.marginRight === "4px";
	
			documentElement.removeChild( container );
		}
	
		jQuery.extend( support, {
			pixelPosition: function() {
	
				// This test is executed only once but we still do memoizing
				// since we can use the boxSizingReliable pre-computing.
				// No need to check if the test was already performed, though.
				computeStyleTests();
				return pixelPositionVal;
			},
			boxSizingReliable: function() {
				if ( boxSizingReliableVal == null ) {
					computeStyleTests();
				}
				return boxSizingReliableVal;
			},
			pixelMarginRight: function() {
	
				// Support: Android 4.0-4.3
				// We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
				// since that compresses better and they're computed together anyway.
				if ( boxSizingReliableVal == null ) {
					computeStyleTests();
				}
				return pixelMarginRightVal;
			},
			reliableMarginLeft: function() {
	
				// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
				if ( boxSizingReliableVal == null ) {
					computeStyleTests();
				}
				return reliableMarginLeftVal;
			},
			reliableMarginRight: function() {
	
				// Support: Android 2.3
				// Check if div with explicit width and no margin-right incorrectly
				// gets computed margin-right based on width of container. (#3333)
				// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
				// This support function is only executed once so no memoizing is needed.
				var ret,
					marginDiv = div.appendChild( document.createElement( "div" ) );
	
				// Reset CSS: box-sizing; display; margin; border; padding
				marginDiv.style.cssText = div.style.cssText =
	
					// Support: Android 2.3
					// Vendor-prefix box-sizing
					"-webkit-box-sizing:content-box;box-sizing:content-box;" +
					"display:block;margin:0;border:0;padding:0";
				marginDiv.style.marginRight = marginDiv.style.width = "0";
				div.style.width = "1px";
				documentElement.appendChild( container );
	
				ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
	
				documentElement.removeChild( container );
				div.removeChild( marginDiv );
	
				return ret;
			}
		} );
	} )();
	
	
	function curCSS( elem, name, computed ) {
		var width, minWidth, maxWidth, ret,
			style = elem.style;
	
		computed = computed || getStyles( elem );
		ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
	
		// Support: Opera 12.1x only
		// Fall back to style even without computed
		// computed is undefined for elems on document fragments
		if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
			ret = jQuery.style( elem, name );
		}
	
		// Support: IE9
		// getPropertyValue is only needed for .css('filter') (#12537)
		if ( computed ) {
	
			// A tribute to the "awesome hack by Dean Edwards"
			// Android Browser returns percentage for some values,
			// but width seems to be reliably pixels.
			// This is against the CSSOM draft spec:
			// http://dev.w3.org/csswg/cssom/#resolved-values
			if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
	
				// Remember the original values
				width = style.width;
				minWidth = style.minWidth;
				maxWidth = style.maxWidth;
	
				// Put in the new values to get a computed value out
				style.minWidth = style.maxWidth = style.width = ret;
				ret = computed.width;
	
				// Revert the changed values
				style.width = width;
				style.minWidth = minWidth;
				style.maxWidth = maxWidth;
			}
		}
	
		return ret !== undefined ?
	
			// Support: IE9-11+
			// IE returns zIndex value as an integer.
			ret + "" :
			ret;
	}
	
	
	function addGetHookIf( conditionFn, hookFn ) {
	
		// Define the hook, we'll check on the first run if it's really needed.
		return {
			get: function() {
				if ( conditionFn() ) {
	
					// Hook not needed (or it's not possible to use it due
					// to missing dependency), remove it.
					delete this.get;
					return;
				}
	
				// Hook needed; redefine it so that the support test is not executed again.
				return ( this.get = hookFn ).apply( this, arguments );
			}
		};
	}
	
	
	var
	
		// Swappable if display is none or starts with table
		// except "table", "table-cell", or "table-caption"
		// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
		rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	
		cssShow = { position: "absolute", visibility: "hidden", display: "block" },
		cssNormalTransform = {
			letterSpacing: "0",
			fontWeight: "400"
		},
	
		cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
		emptyStyle = document.createElement( "div" ).style;
	
	// Return a css property mapped to a potentially vendor prefixed property
	function vendorPropName( name ) {
	
		// Shortcut for names that are not vendor prefixed
		if ( name in emptyStyle ) {
			return name;
		}
	
		// Check for vendor prefixed names
		var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
			i = cssPrefixes.length;
	
		while ( i-- ) {
			name = cssPrefixes[ i ] + capName;
			if ( name in emptyStyle ) {
				return name;
			}
		}
	}
	
	function setPositiveNumber( elem, value, subtract ) {
	
		// Any relative (+/-) values have already been
		// normalized at this point
		var matches = rcssNum.exec( value );
		return matches ?
	
			// Guard against undefined "subtract", e.g., when used as in cssHooks
			Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
			value;
	}
	
	function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
		var i = extra === ( isBorderBox ? "border" : "content" ) ?
	
			// If we already have the right measurement, avoid augmentation
			4 :
	
			// Otherwise initialize for horizontal or vertical properties
			name === "width" ? 1 : 0,
	
			val = 0;
	
		for ( ; i < 4; i += 2 ) {
	
			// Both box models exclude margin, so add it if we want it
			if ( extra === "margin" ) {
				val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
			}
	
			if ( isBorderBox ) {
	
				// border-box includes padding, so remove it if we want content
				if ( extra === "content" ) {
					val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
				}
	
				// At this point, extra isn't border nor margin, so remove border
				if ( extra !== "margin" ) {
					val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
				}
			} else {
	
				// At this point, extra isn't content, so add padding
				val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
	
				// At this point, extra isn't content nor padding, so add border
				if ( extra !== "padding" ) {
					val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
				}
			}
		}
	
		return val;
	}
	
	function getWidthOrHeight( elem, name, extra ) {
	
		// Start with offset property, which is equivalent to the border-box value
		var valueIsBorderBox = true,
			val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
			styles = getStyles( elem ),
			isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
	
		// Some non-html elements return undefined for offsetWidth, so check for null/undefined
		// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
		// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
		if ( val <= 0 || val == null ) {
	
			// Fall back to computed then uncomputed css if necessary
			val = curCSS( elem, name, styles );
			if ( val < 0 || val == null ) {
				val = elem.style[ name ];
			}
	
			// Computed unit is not pixels. Stop here and return.
			if ( rnumnonpx.test( val ) ) {
				return val;
			}
	
			// Check for style in case a browser which returns unreliable values
			// for getComputedStyle silently falls back to the reliable elem.style
			valueIsBorderBox = isBorderBox &&
				( support.boxSizingReliable() || val === elem.style[ name ] );
	
			// Normalize "", auto, and prepare for extra
			val = parseFloat( val ) || 0;
		}
	
		// Use the active box-sizing model to add/subtract irrelevant styles
		return ( val +
			augmentWidthOrHeight(
				elem,
				name,
				extra || ( isBorderBox ? "border" : "content" ),
				valueIsBorderBox,
				styles
			)
		) + "px";
	}
	
	function showHide( elements, show ) {
		var display, elem, hidden,
			values = [],
			index = 0,
			length = elements.length;
	
		for ( ; index < length; index++ ) {
			elem = elements[ index ];
			if ( !elem.style ) {
				continue;
			}
	
			values[ index ] = dataPriv.get( elem, "olddisplay" );
			display = elem.style.display;
			if ( show ) {
	
				// Reset the inline display of this element to learn if it is
				// being hidden by cascaded rules or not
				if ( !values[ index ] && display === "none" ) {
					elem.style.display = "";
				}
	
				// Set elements which have been overridden with display: none
				// in a stylesheet to whatever the default browser style is
				// for such an element
				if ( elem.style.display === "" && isHidden( elem ) ) {
					values[ index ] = dataPriv.access(
						elem,
						"olddisplay",
						defaultDisplay( elem.nodeName )
					);
				}
			} else {
				hidden = isHidden( elem );
	
				if ( display !== "none" || !hidden ) {
					dataPriv.set(
						elem,
						"olddisplay",
						hidden ? display : jQuery.css( elem, "display" )
					);
				}
			}
		}
	
		// Set the display of most of the elements in a second loop
		// to avoid the constant reflow
		for ( index = 0; index < length; index++ ) {
			elem = elements[ index ];
			if ( !elem.style ) {
				continue;
			}
			if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
				elem.style.display = show ? values[ index ] || "" : "none";
			}
		}
	
		return elements;
	}
	
	jQuery.extend( {
	
		// Add in style property hooks for overriding the default
		// behavior of getting and setting a style property
		cssHooks: {
			opacity: {
				get: function( elem, computed ) {
					if ( computed ) {
	
						// We should always get a number back from opacity
						var ret = curCSS( elem, "opacity" );
						return ret === "" ? "1" : ret;
					}
				}
			}
		},
	
		// Don't automatically add "px" to these possibly-unitless properties
		cssNumber: {
			"animationIterationCount": true,
			"columnCount": true,
			"fillOpacity": true,
			"flexGrow": true,
			"flexShrink": true,
			"fontWeight": true,
			"lineHeight": true,
			"opacity": true,
			"order": true,
			"orphans": true,
			"widows": true,
			"zIndex": true,
			"zoom": true
		},
	
		// Add in properties whose names you wish to fix before
		// setting or getting the value
		cssProps: {
			"float": "cssFloat"
		},
	
		// Get and set the style property on a DOM Node
		style: function( elem, name, value, extra ) {
	
			// Don't set styles on text and comment nodes
			if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
				return;
			}
	
			// Make sure that we're working with the right name
			var ret, type, hooks,
				origName = jQuery.camelCase( name ),
				style = elem.style;
	
			name = jQuery.cssProps[ origName ] ||
				( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
	
			// Gets hook for the prefixed version, then unprefixed version
			hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
	
			// Check if we're setting a value
			if ( value !== undefined ) {
				type = typeof value;
	
				// Convert "+=" or "-=" to relative numbers (#7345)
				if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
					value = adjustCSS( elem, name, ret );
	
					// Fixes bug #9237
					type = "number";
				}
	
				// Make sure that null and NaN values aren't set (#7116)
				if ( value == null || value !== value ) {
					return;
				}
	
				// If a number was passed in, add the unit (except for certain CSS properties)
				if ( type === "number" ) {
					value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
				}
	
				// Support: IE9-11+
				// background-* props affect original clone's values
				if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
					style[ name ] = "inherit";
				}
	
				// If a hook was provided, use that value, otherwise just set the specified value
				if ( !hooks || !( "set" in hooks ) ||
					( value = hooks.set( elem, value, extra ) ) !== undefined ) {
	
					style[ name ] = value;
				}
	
			} else {
	
				// If a hook was provided get the non-computed value from there
				if ( hooks && "get" in hooks &&
					( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
	
					return ret;
				}
	
				// Otherwise just get the value from the style object
				return style[ name ];
			}
		},
	
		css: function( elem, name, extra, styles ) {
			var val, num, hooks,
				origName = jQuery.camelCase( name );
	
			// Make sure that we're working with the right name
			name = jQuery.cssProps[ origName ] ||
				( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
	
			// Try prefixed name followed by the unprefixed name
			hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
	
			// If a hook was provided get the computed value from there
			if ( hooks && "get" in hooks ) {
				val = hooks.get( elem, true, extra );
			}
	
			// Otherwise, if a way to get the computed value exists, use that
			if ( val === undefined ) {
				val = curCSS( elem, name, styles );
			}
	
			// Convert "normal" to computed value
			if ( val === "normal" && name in cssNormalTransform ) {
				val = cssNormalTransform[ name ];
			}
	
			// Make numeric if forced or a qualifier was provided and val looks numeric
			if ( extra === "" || extra ) {
				num = parseFloat( val );
				return extra === true || isFinite( num ) ? num || 0 : val;
			}
			return val;
		}
	} );
	
	jQuery.each( [ "height", "width" ], function( i, name ) {
		jQuery.cssHooks[ name ] = {
			get: function( elem, computed, extra ) {
				if ( computed ) {
	
					// Certain elements can have dimension info if we invisibly show them
					// but it must have a current display style that would benefit
					return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
						elem.offsetWidth === 0 ?
							swap( elem, cssShow, function() {
								return getWidthOrHeight( elem, name, extra );
							} ) :
							getWidthOrHeight( elem, name, extra );
				}
			},
	
			set: function( elem, value, extra ) {
				var matches,
					styles = extra && getStyles( elem ),
					subtract = extra && augmentWidthOrHeight(
						elem,
						name,
						extra,
						jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
						styles
					);
	
				// Convert to pixels if value adjustment is needed
				if ( subtract && ( matches = rcssNum.exec( value ) ) &&
					( matches[ 3 ] || "px" ) !== "px" ) {
	
					elem.style[ name ] = value;
					value = jQuery.css( elem, name );
				}
	
				return setPositiveNumber( elem, value, subtract );
			}
		};
	} );
	
	jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
		function( elem, computed ) {
			if ( computed ) {
				return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
					elem.getBoundingClientRect().left -
						swap( elem, { marginLeft: 0 }, function() {
							return elem.getBoundingClientRect().left;
						} )
					) + "px";
			}
		}
	);
	
	// Support: Android 2.3
	jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
		function( elem, computed ) {
			if ( computed ) {
				return swap( elem, { "display": "inline-block" },
					curCSS, [ elem, "marginRight" ] );
			}
		}
	);
	
	// These hooks are used by animate to expand properties
	jQuery.each( {
		margin: "",
		padding: "",
		border: "Width"
	}, function( prefix, suffix ) {
		jQuery.cssHooks[ prefix + suffix ] = {
			expand: function( value ) {
				var i = 0,
					expanded = {},
	
					// Assumes a single number if not a string
					parts = typeof value === "string" ? value.split( " " ) : [ value ];
	
				for ( ; i < 4; i++ ) {
					expanded[ prefix + cssExpand[ i ] + suffix ] =
						parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
				}
	
				return expanded;
			}
		};
	
		if ( !rmargin.test( prefix ) ) {
			jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
		}
	} );
	
	jQuery.fn.extend( {
		css: function( name, value ) {
			return access( this, function( elem, name, value ) {
				var styles, len,
					map = {},
					i = 0;
	
				if ( jQuery.isArray( name ) ) {
					styles = getStyles( elem );
					len = name.length;
	
					for ( ; i < len; i++ ) {
						map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
					}
	
					return map;
				}
	
				return value !== undefined ?
					jQuery.style( elem, name, value ) :
					jQuery.css( elem, name );
			}, name, value, arguments.length > 1 );
		},
		show: function() {
			return showHide( this, true );
		},
		hide: function() {
			return showHide( this );
		},
		toggle: function( state ) {
			if ( typeof state === "boolean" ) {
				return state ? this.show() : this.hide();
			}
	
			return this.each( function() {
				if ( isHidden( this ) ) {
					jQuery( this ).show();
				} else {
					jQuery( this ).hide();
				}
			} );
		}
	} );
	
	
	function Tween( elem, options, prop, end, easing ) {
		return new Tween.prototype.init( elem, options, prop, end, easing );
	}
	jQuery.Tween = Tween;
	
	Tween.prototype = {
		constructor: Tween,
		init: function( elem, options, prop, end, easing, unit ) {
			this.elem = elem;
			this.prop = prop;
			this.easing = easing || jQuery.easing._default;
			this.options = options;
			this.start = this.now = this.cur();
			this.end = end;
			this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
		},
		cur: function() {
			var hooks = Tween.propHooks[ this.prop ];
	
			return hooks && hooks.get ?
				hooks.get( this ) :
				Tween.propHooks._default.get( this );
		},
		run: function( percent ) {
			var eased,
				hooks = Tween.propHooks[ this.prop ];
	
			if ( this.options.duration ) {
				this.pos = eased = jQuery.easing[ this.easing ](
					percent, this.options.duration * percent, 0, 1, this.options.duration
				);
			} else {
				this.pos = eased = percent;
			}
			this.now = ( this.end - this.start ) * eased + this.start;
	
			if ( this.options.step ) {
				this.options.step.call( this.elem, this.now, this );
			}
	
			if ( hooks && hooks.set ) {
				hooks.set( this );
			} else {
				Tween.propHooks._default.set( this );
			}
			return this;
		}
	};
	
	Tween.prototype.init.prototype = Tween.prototype;
	
	Tween.propHooks = {
		_default: {
			get: function( tween ) {
				var result;
	
				// Use a property on the element directly when it is not a DOM element,
				// or when there is no matching style property that exists.
				if ( tween.elem.nodeType !== 1 ||
					tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
					return tween.elem[ tween.prop ];
				}
	
				// Passing an empty string as a 3rd parameter to .css will automatically
				// attempt a parseFloat and fallback to a string if the parse fails.
				// Simple values such as "10px" are parsed to Float;
				// complex values such as "rotate(1rad)" are returned as-is.
				result = jQuery.css( tween.elem, tween.prop, "" );
	
				// Empty strings, null, undefined and "auto" are converted to 0.
				return !result || result === "auto" ? 0 : result;
			},
			set: function( tween ) {
	
				// Use step hook for back compat.
				// Use cssHook if its there.
				// Use .style if available and use plain properties where available.
				if ( jQuery.fx.step[ tween.prop ] ) {
					jQuery.fx.step[ tween.prop ]( tween );
				} else if ( tween.elem.nodeType === 1 &&
					( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
						jQuery.cssHooks[ tween.prop ] ) ) {
					jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
				} else {
					tween.elem[ tween.prop ] = tween.now;
				}
			}
		}
	};
	
	// Support: IE9
	// Panic based approach to setting things on disconnected nodes
	Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
		set: function( tween ) {
			if ( tween.elem.nodeType && tween.elem.parentNode ) {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	};
	
	jQuery.easing = {
		linear: function( p ) {
			return p;
		},
		swing: function( p ) {
			return 0.5 - Math.cos( p * Math.PI ) / 2;
		},
		_default: "swing"
	};
	
	jQuery.fx = Tween.prototype.init;
	
	// Back Compat <1.8 extension point
	jQuery.fx.step = {};
	
	
	
	
	var
		fxNow, timerId,
		rfxtypes = /^(?:toggle|show|hide)$/,
		rrun = /queueHooks$/;
	
	// Animations created synchronously will run synchronously
	function createFxNow() {
		window.setTimeout( function() {
			fxNow = undefined;
		} );
		return ( fxNow = jQuery.now() );
	}
	
	// Generate parameters to create a standard animation
	function genFx( type, includeWidth ) {
		var which,
			i = 0,
			attrs = { height: type };
	
		// If we include width, step value is 1 to do all cssExpand values,
		// otherwise step value is 2 to skip over Left and Right
		includeWidth = includeWidth ? 1 : 0;
		for ( ; i < 4 ; i += 2 - includeWidth ) {
			which = cssExpand[ i ];
			attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
		}
	
		if ( includeWidth ) {
			attrs.opacity = attrs.width = type;
		}
	
		return attrs;
	}
	
	function createTween( value, prop, animation ) {
		var tween,
			collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
			index = 0,
			length = collection.length;
		for ( ; index < length; index++ ) {
			if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
	
				// We're done with this property
				return tween;
			}
		}
	}
	
	function defaultPrefilter( elem, props, opts ) {
		/* jshint validthis: true */
		var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
			anim = this,
			orig = {},
			style = elem.style,
			hidden = elem.nodeType && isHidden( elem ),
			dataShow = dataPriv.get( elem, "fxshow" );
	
		// Handle queue: false promises
		if ( !opts.queue ) {
			hooks = jQuery._queueHooks( elem, "fx" );
			if ( hooks.unqueued == null ) {
				hooks.unqueued = 0;
				oldfire = hooks.empty.fire;
				hooks.empty.fire = function() {
					if ( !hooks.unqueued ) {
						oldfire();
					}
				};
			}
			hooks.unqueued++;
	
			anim.always( function() {
	
				// Ensure the complete handler is called before this completes
				anim.always( function() {
					hooks.unqueued--;
					if ( !jQuery.queue( elem, "fx" ).length ) {
						hooks.empty.fire();
					}
				} );
			} );
		}
	
		// Height/width overflow pass
		if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
	
			// Make sure that nothing sneaks out
			// Record all 3 overflow attributes because IE9-10 do not
			// change the overflow attribute when overflowX and
			// overflowY are set to the same value
			opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
	
			// Set display property to inline-block for height/width
			// animations on inline elements that are having width/height animated
			display = jQuery.css( elem, "display" );
	
			// Test default display if display is currently "none"
			checkDisplay = display === "none" ?
				dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
	
			if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
				style.display = "inline-block";
			}
		}
	
		if ( opts.overflow ) {
			style.overflow = "hidden";
			anim.always( function() {
				style.overflow = opts.overflow[ 0 ];
				style.overflowX = opts.overflow[ 1 ];
				style.overflowY = opts.overflow[ 2 ];
			} );
		}
	
		// show/hide pass
		for ( prop in props ) {
			value = props[ prop ];
			if ( rfxtypes.exec( value ) ) {
				delete props[ prop ];
				toggle = toggle || value === "toggle";
				if ( value === ( hidden ? "hide" : "show" ) ) {
	
					// If there is dataShow left over from a stopped hide or show
					// and we are going to proceed with show, we should pretend to be hidden
					if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
						hidden = true;
					} else {
						continue;
					}
				}
				orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
	
			// Any non-fx value stops us from restoring the original display value
			} else {
				display = undefined;
			}
		}
	
		if ( !jQuery.isEmptyObject( orig ) ) {
			if ( dataShow ) {
				if ( "hidden" in dataShow ) {
					hidden = dataShow.hidden;
				}
			} else {
				dataShow = dataPriv.access( elem, "fxshow", {} );
			}
	
			// Store state if its toggle - enables .stop().toggle() to "reverse"
			if ( toggle ) {
				dataShow.hidden = !hidden;
			}
			if ( hidden ) {
				jQuery( elem ).show();
			} else {
				anim.done( function() {
					jQuery( elem ).hide();
				} );
			}
			anim.done( function() {
				var prop;
	
				dataPriv.remove( elem, "fxshow" );
				for ( prop in orig ) {
					jQuery.style( elem, prop, orig[ prop ] );
				}
			} );
			for ( prop in orig ) {
				tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
	
				if ( !( prop in dataShow ) ) {
					dataShow[ prop ] = tween.start;
					if ( hidden ) {
						tween.end = tween.start;
						tween.start = prop === "width" || prop === "height" ? 1 : 0;
					}
				}
			}
	
		// If this is a noop like .hide().hide(), restore an overwritten display value
		} else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
			style.display = display;
		}
	}
	
	function propFilter( props, specialEasing ) {
		var index, name, easing, value, hooks;
	
		// camelCase, specialEasing and expand cssHook pass
		for ( index in props ) {
			name = jQuery.camelCase( index );
			easing = specialEasing[ name ];
			value = props[ index ];
			if ( jQuery.isArray( value ) ) {
				easing = value[ 1 ];
				value = props[ index ] = value[ 0 ];
			}
	
			if ( index !== name ) {
				props[ name ] = value;
				delete props[ index ];
			}
	
			hooks = jQuery.cssHooks[ name ];
			if ( hooks && "expand" in hooks ) {
				value = hooks.expand( value );
				delete props[ name ];
	
				// Not quite $.extend, this won't overwrite existing keys.
				// Reusing 'index' because we have the correct "name"
				for ( index in value ) {
					if ( !( index in props ) ) {
						props[ index ] = value[ index ];
						specialEasing[ index ] = easing;
					}
				}
			} else {
				specialEasing[ name ] = easing;
			}
		}
	}
	
	function Animation( elem, properties, options ) {
		var result,
			stopped,
			index = 0,
			length = Animation.prefilters.length,
			deferred = jQuery.Deferred().always( function() {
	
				// Don't match elem in the :animated selector
				delete tick.elem;
			} ),
			tick = function() {
				if ( stopped ) {
					return false;
				}
				var currentTime = fxNow || createFxNow(),
					remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
	
					// Support: Android 2.3
					// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
					temp = remaining / animation.duration || 0,
					percent = 1 - temp,
					index = 0,
					length = animation.tweens.length;
	
				for ( ; index < length ; index++ ) {
					animation.tweens[ index ].run( percent );
				}
	
				deferred.notifyWith( elem, [ animation, percent, remaining ] );
	
				if ( percent < 1 && length ) {
					return remaining;
				} else {
					deferred.resolveWith( elem, [ animation ] );
					return false;
				}
			},
			animation = deferred.promise( {
				elem: elem,
				props: jQuery.extend( {}, properties ),
				opts: jQuery.extend( true, {
					specialEasing: {},
					easing: jQuery.easing._default
				}, options ),
				originalProperties: properties,
				originalOptions: options,
				startTime: fxNow || createFxNow(),
				duration: options.duration,
				tweens: [],
				createTween: function( prop, end ) {
					var tween = jQuery.Tween( elem, animation.opts, prop, end,
							animation.opts.specialEasing[ prop ] || animation.opts.easing );
					animation.tweens.push( tween );
					return tween;
				},
				stop: function( gotoEnd ) {
					var index = 0,
	
						// If we are going to the end, we want to run all the tweens
						// otherwise we skip this part
						length = gotoEnd ? animation.tweens.length : 0;
					if ( stopped ) {
						return this;
					}
					stopped = true;
					for ( ; index < length ; index++ ) {
						animation.tweens[ index ].run( 1 );
					}
	
					// Resolve when we played the last frame; otherwise, reject
					if ( gotoEnd ) {
						deferred.notifyWith( elem, [ animation, 1, 0 ] );
						deferred.resolveWith( elem, [ animation, gotoEnd ] );
					} else {
						deferred.rejectWith( elem, [ animation, gotoEnd ] );
					}
					return this;
				}
			} ),
			props = animation.props;
	
		propFilter( props, animation.opts.specialEasing );
	
		for ( ; index < length ; index++ ) {
			result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
			if ( result ) {
				if ( jQuery.isFunction( result.stop ) ) {
					jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
						jQuery.proxy( result.stop, result );
				}
				return result;
			}
		}
	
		jQuery.map( props, createTween, animation );
	
		if ( jQuery.isFunction( animation.opts.start ) ) {
			animation.opts.start.call( elem, animation );
		}
	
		jQuery.fx.timer(
			jQuery.extend( tick, {
				elem: elem,
				anim: animation,
				queue: animation.opts.queue
			} )
		);
	
		// attach callbacks from options
		return animation.progress( animation.opts.progress )
			.done( animation.opts.done, animation.opts.complete )
			.fail( animation.opts.fail )
			.always( animation.opts.always );
	}
	
	jQuery.Animation = jQuery.extend( Animation, {
		tweeners: {
			"*": [ function( prop, value ) {
				var tween = this.createTween( prop, value );
				adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
				return tween;
			} ]
		},
	
		tweener: function( props, callback ) {
			if ( jQuery.isFunction( props ) ) {
				callback = props;
				props = [ "*" ];
			} else {
				props = props.match( rnotwhite );
			}
	
			var prop,
				index = 0,
				length = props.length;
	
			for ( ; index < length ; index++ ) {
				prop = props[ index ];
				Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
				Animation.tweeners[ prop ].unshift( callback );
			}
		},
	
		prefilters: [ defaultPrefilter ],
	
		prefilter: function( callback, prepend ) {
			if ( prepend ) {
				Animation.prefilters.unshift( callback );
			} else {
				Animation.prefilters.push( callback );
			}
		}
	} );
	
	jQuery.speed = function( speed, easing, fn ) {
		var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
			complete: fn || !fn && easing ||
				jQuery.isFunction( speed ) && speed,
			duration: speed,
			easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
		};
	
		opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
			opt.duration : opt.duration in jQuery.fx.speeds ?
				jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
	
		// Normalize opt.queue - true/undefined/null -> "fx"
		if ( opt.queue == null || opt.queue === true ) {
			opt.queue = "fx";
		}
	
		// Queueing
		opt.old = opt.complete;
	
		opt.complete = function() {
			if ( jQuery.isFunction( opt.old ) ) {
				opt.old.call( this );
			}
	
			if ( opt.queue ) {
				jQuery.dequeue( this, opt.queue );
			}
		};
	
		return opt;
	};
	
	jQuery.fn.extend( {
		fadeTo: function( speed, to, easing, callback ) {
	
			// Show any hidden elements after setting opacity to 0
			return this.filter( isHidden ).css( "opacity", 0 ).show()
	
				// Animate to the value specified
				.end().animate( { opacity: to }, speed, easing, callback );
		},
		animate: function( prop, speed, easing, callback ) {
			var empty = jQuery.isEmptyObject( prop ),
				optall = jQuery.speed( speed, easing, callback ),
				doAnimation = function() {
	
					// Operate on a copy of prop so per-property easing won't be lost
					var anim = Animation( this, jQuery.extend( {}, prop ), optall );
	
					// Empty animations, or finishing resolves immediately
					if ( empty || dataPriv.get( this, "finish" ) ) {
						anim.stop( true );
					}
				};
				doAnimation.finish = doAnimation;
	
			return empty || optall.queue === false ?
				this.each( doAnimation ) :
				this.queue( optall.queue, doAnimation );
		},
		stop: function( type, clearQueue, gotoEnd ) {
			var stopQueue = function( hooks ) {
				var stop = hooks.stop;
				delete hooks.stop;
				stop( gotoEnd );
			};
	
			if ( typeof type !== "string" ) {
				gotoEnd = clearQueue;
				clearQueue = type;
				type = undefined;
			}
			if ( clearQueue && type !== false ) {
				this.queue( type || "fx", [] );
			}
	
			return this.each( function() {
				var dequeue = true,
					index = type != null && type + "queueHooks",
					timers = jQuery.timers,
					data = dataPriv.get( this );
	
				if ( index ) {
					if ( data[ index ] && data[ index ].stop ) {
						stopQueue( data[ index ] );
					}
				} else {
					for ( index in data ) {
						if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
							stopQueue( data[ index ] );
						}
					}
				}
	
				for ( index = timers.length; index--; ) {
					if ( timers[ index ].elem === this &&
						( type == null || timers[ index ].queue === type ) ) {
	
						timers[ index ].anim.stop( gotoEnd );
						dequeue = false;
						timers.splice( index, 1 );
					}
				}
	
				// Start the next in the queue if the last step wasn't forced.
				// Timers currently will call their complete callbacks, which
				// will dequeue but only if they were gotoEnd.
				if ( dequeue || !gotoEnd ) {
					jQuery.dequeue( this, type );
				}
			} );
		},
		finish: function( type ) {
			if ( type !== false ) {
				type = type || "fx";
			}
			return this.each( function() {
				var index,
					data = dataPriv.get( this ),
					queue = data[ type + "queue" ],
					hooks = data[ type + "queueHooks" ],
					timers = jQuery.timers,
					length = queue ? queue.length : 0;
	
				// Enable finishing flag on private data
				data.finish = true;
	
				// Empty the queue first
				jQuery.queue( this, type, [] );
	
				if ( hooks && hooks.stop ) {
					hooks.stop.call( this, true );
				}
	
				// Look for any active animations, and finish them
				for ( index = timers.length; index--; ) {
					if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
						timers[ index ].anim.stop( true );
						timers.splice( index, 1 );
					}
				}
	
				// Look for any animations in the old queue and finish them
				for ( index = 0; index < length; index++ ) {
					if ( queue[ index ] && queue[ index ].finish ) {
						queue[ index ].finish.call( this );
					}
				}
	
				// Turn off finishing flag
				delete data.finish;
			} );
		}
	} );
	
	jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
		var cssFn = jQuery.fn[ name ];
		jQuery.fn[ name ] = function( speed, easing, callback ) {
			return speed == null || typeof speed === "boolean" ?
				cssFn.apply( this, arguments ) :
				this.animate( genFx( name, true ), speed, easing, callback );
		};
	} );
	
	// Generate shortcuts for custom animations
	jQuery.each( {
		slideDown: genFx( "show" ),
		slideUp: genFx( "hide" ),
		slideToggle: genFx( "toggle" ),
		fadeIn: { opacity: "show" },
		fadeOut: { opacity: "hide" },
		fadeToggle: { opacity: "toggle" }
	}, function( name, props ) {
		jQuery.fn[ name ] = function( speed, easing, callback ) {
			return this.animate( props, speed, easing, callback );
		};
	} );
	
	jQuery.timers = [];
	jQuery.fx.tick = function() {
		var timer,
			i = 0,
			timers = jQuery.timers;
	
		fxNow = jQuery.now();
	
		for ( ; i < timers.length; i++ ) {
			timer = timers[ i ];
	
			// Checks the timer has not already been removed
			if ( !timer() && timers[ i ] === timer ) {
				timers.splice( i--, 1 );
			}
		}
	
		if ( !timers.length ) {
			jQuery.fx.stop();
		}
		fxNow = undefined;
	};
	
	jQuery.fx.timer = function( timer ) {
		jQuery.timers.push( timer );
		if ( timer() ) {
			jQuery.fx.start();
		} else {
			jQuery.timers.pop();
		}
	};
	
	jQuery.fx.interval = 13;
	jQuery.fx.start = function() {
		if ( !timerId ) {
			timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
		}
	};
	
	jQuery.fx.stop = function() {
		window.clearInterval( timerId );
	
		timerId = null;
	};
	
	jQuery.fx.speeds = {
		slow: 600,
		fast: 200,
	
		// Default speed
		_default: 400
	};
	
	
	// Based off of the plugin by Clint Helfers, with permission.
	// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
	jQuery.fn.delay = function( time, type ) {
		time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
		type = type || "fx";
	
		return this.queue( type, function( next, hooks ) {
			var timeout = window.setTimeout( next, time );
			hooks.stop = function() {
				window.clearTimeout( timeout );
			};
		} );
	};
	
	
	( function() {
		var input = document.createElement( "input" ),
			select = document.createElement( "select" ),
			opt = select.appendChild( document.createElement( "option" ) );
	
		input.type = "checkbox";
	
		// Support: iOS<=5.1, Android<=4.2+
		// Default value for a checkbox should be "on"
		support.checkOn = input.value !== "";
	
		// Support: IE<=11+
		// Must access selectedIndex to make default options select
		support.optSelected = opt.selected;
	
		// Support: Android<=2.3
		// Options inside disabled selects are incorrectly marked as disabled
		select.disabled = true;
		support.optDisabled = !opt.disabled;
	
		// Support: IE<=11+
		// An input loses its value after becoming a radio
		input = document.createElement( "input" );
		input.value = "t";
		input.type = "radio";
		support.radioValue = input.value === "t";
	} )();
	
	
	var boolHook,
		attrHandle = jQuery.expr.attrHandle;
	
	jQuery.fn.extend( {
		attr: function( name, value ) {
			return access( this, jQuery.attr, name, value, arguments.length > 1 );
		},
	
		removeAttr: function( name ) {
			return this.each( function() {
				jQuery.removeAttr( this, name );
			} );
		}
	} );
	
	jQuery.extend( {
		attr: function( elem, name, value ) {
			var ret, hooks,
				nType = elem.nodeType;
	
			// Don't get/set attributes on text, comment and attribute nodes
			if ( nType === 3 || nType === 8 || nType === 2 ) {
				return;
			}
	
			// Fallback to prop when attributes are not supported
			if ( typeof elem.getAttribute === "undefined" ) {
				return jQuery.prop( elem, name, value );
			}
	
			// All attributes are lowercase
			// Grab necessary hook if one is defined
			if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
				name = name.toLowerCase();
				hooks = jQuery.attrHooks[ name ] ||
					( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
			}
	
			if ( value !== undefined ) {
				if ( value === null ) {
					jQuery.removeAttr( elem, name );
					return;
				}
	
				if ( hooks && "set" in hooks &&
					( ret = hooks.set( elem, value, name ) ) !== undefined ) {
					return ret;
				}
	
				elem.setAttribute( name, value + "" );
				return value;
			}
	
			if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
				return ret;
			}
	
			ret = jQuery.find.attr( elem, name );
	
			// Non-existent attributes return null, we normalize to undefined
			return ret == null ? undefined : ret;
		},
	
		attrHooks: {
			type: {
				set: function( elem, value ) {
					if ( !support.radioValue && value === "radio" &&
						jQuery.nodeName( elem, "input" ) ) {
						var val = elem.value;
						elem.setAttribute( "type", value );
						if ( val ) {
							elem.value = val;
						}
						return value;
					}
				}
			}
		},
	
		removeAttr: function( elem, value ) {
			var name, propName,
				i = 0,
				attrNames = value && value.match( rnotwhite );
	
			if ( attrNames && elem.nodeType === 1 ) {
				while ( ( name = attrNames[ i++ ] ) ) {
					propName = jQuery.propFix[ name ] || name;
	
					// Boolean attributes get special treatment (#10870)
					if ( jQuery.expr.match.bool.test( name ) ) {
	
						// Set corresponding property to false
						elem[ propName ] = false;
					}
	
					elem.removeAttribute( name );
				}
			}
		}
	} );
	
	// Hooks for boolean attributes
	boolHook = {
		set: function( elem, value, name ) {
			if ( value === false ) {
	
				// Remove boolean attributes when set to false
				jQuery.removeAttr( elem, name );
			} else {
				elem.setAttribute( name, name );
			}
			return name;
		}
	};
	jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
		var getter = attrHandle[ name ] || jQuery.find.attr;
	
		attrHandle[ name ] = function( elem, name, isXML ) {
			var ret, handle;
			if ( !isXML ) {
	
				// Avoid an infinite loop by temporarily removing this function from the getter
				handle = attrHandle[ name ];
				attrHandle[ name ] = ret;
				ret = getter( elem, name, isXML ) != null ?
					name.toLowerCase() :
					null;
				attrHandle[ name ] = handle;
			}
			return ret;
		};
	} );
	
	
	
	
	var rfocusable = /^(?:input|select|textarea|button)$/i,
		rclickable = /^(?:a|area)$/i;
	
	jQuery.fn.extend( {
		prop: function( name, value ) {
			return access( this, jQuery.prop, name, value, arguments.length > 1 );
		},
	
		removeProp: function( name ) {
			return this.each( function() {
				delete this[ jQuery.propFix[ name ] || name ];
			} );
		}
	} );
	
	jQuery.extend( {
		prop: function( elem, name, value ) {
			var ret, hooks,
				nType = elem.nodeType;
	
			// Don't get/set properties on text, comment and attribute nodes
			if ( nType === 3 || nType === 8 || nType === 2 ) {
				return;
			}
	
			if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
	
				// Fix name and attach hooks
				name = jQuery.propFix[ name ] || name;
				hooks = jQuery.propHooks[ name ];
			}
	
			if ( value !== undefined ) {
				if ( hooks && "set" in hooks &&
					( ret = hooks.set( elem, value, name ) ) !== undefined ) {
					return ret;
				}
	
				return ( elem[ name ] = value );
			}
	
			if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
				return ret;
			}
	
			return elem[ name ];
		},
	
		propHooks: {
			tabIndex: {
				get: function( elem ) {
	
					// elem.tabIndex doesn't always return the
					// correct value when it hasn't been explicitly set
					// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
					// Use proper attribute retrieval(#12072)
					var tabindex = jQuery.find.attr( elem, "tabindex" );
	
					return tabindex ?
						parseInt( tabindex, 10 ) :
						rfocusable.test( elem.nodeName ) ||
							rclickable.test( elem.nodeName ) && elem.href ?
								0 :
								-1;
				}
			}
		},
	
		propFix: {
			"for": "htmlFor",
			"class": "className"
		}
	} );
	
	// Support: IE <=11 only
	// Accessing the selectedIndex property
	// forces the browser to respect setting selected
	// on the option
	// The getter ensures a default option is selected
	// when in an optgroup
	if ( !support.optSelected ) {
		jQuery.propHooks.selected = {
			get: function( elem ) {
				var parent = elem.parentNode;
				if ( parent && parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
				return null;
			},
			set: function( elem ) {
				var parent = elem.parentNode;
				if ( parent ) {
					parent.selectedIndex;
	
					if ( parent.parentNode ) {
						parent.parentNode.selectedIndex;
					}
				}
			}
		};
	}
	
	jQuery.each( [
		"tabIndex",
		"readOnly",
		"maxLength",
		"cellSpacing",
		"cellPadding",
		"rowSpan",
		"colSpan",
		"useMap",
		"frameBorder",
		"contentEditable"
	], function() {
		jQuery.propFix[ this.toLowerCase() ] = this;
	} );
	
	
	
	
	var rclass = /[\t\r\n\f]/g;
	
	function getClass( elem ) {
		return elem.getAttribute && elem.getAttribute( "class" ) || "";
	}
	
	jQuery.fn.extend( {
		addClass: function( value ) {
			var classes, elem, cur, curValue, clazz, j, finalValue,
				i = 0;
	
			if ( jQuery.isFunction( value ) ) {
				return this.each( function( j ) {
					jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
				} );
			}
	
			if ( typeof value === "string" && value ) {
				classes = value.match( rnotwhite ) || [];
	
				while ( ( elem = this[ i++ ] ) ) {
					curValue = getClass( elem );
					cur = elem.nodeType === 1 &&
						( " " + curValue + " " ).replace( rclass, " " );
	
					if ( cur ) {
						j = 0;
						while ( ( clazz = classes[ j++ ] ) ) {
							if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
								cur += clazz + " ";
							}
						}
	
						// Only assign if different to avoid unneeded rendering.
						finalValue = jQuery.trim( cur );
						if ( curValue !== finalValue ) {
							elem.setAttribute( "class", finalValue );
						}
					}
				}
			}
	
			return this;
		},
	
		removeClass: function( value ) {
			var classes, elem, cur, curValue, clazz, j, finalValue,
				i = 0;
	
			if ( jQuery.isFunction( value ) ) {
				return this.each( function( j ) {
					jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
				} );
			}
	
			if ( !arguments.length ) {
				return this.attr( "class", "" );
			}
	
			if ( typeof value === "string" && value ) {
				classes = value.match( rnotwhite ) || [];
	
				while ( ( elem = this[ i++ ] ) ) {
					curValue = getClass( elem );
	
					// This expression is here for better compressibility (see addClass)
					cur = elem.nodeType === 1 &&
						( " " + curValue + " " ).replace( rclass, " " );
	
					if ( cur ) {
						j = 0;
						while ( ( clazz = classes[ j++ ] ) ) {
	
							// Remove *all* instances
							while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
								cur = cur.replace( " " + clazz + " ", " " );
							}
						}
	
						// Only assign if different to avoid unneeded rendering.
						finalValue = jQuery.trim( cur );
						if ( curValue !== finalValue ) {
							elem.setAttribute( "class", finalValue );
						}
					}
				}
			}
	
			return this;
		},
	
		toggleClass: function( value, stateVal ) {
			var type = typeof value;
	
			if ( typeof stateVal === "boolean" && type === "string" ) {
				return stateVal ? this.addClass( value ) : this.removeClass( value );
			}
	
			if ( jQuery.isFunction( value ) ) {
				return this.each( function( i ) {
					jQuery( this ).toggleClass(
						value.call( this, i, getClass( this ), stateVal ),
						stateVal
					);
				} );
			}
	
			return this.each( function() {
				var className, i, self, classNames;
	
				if ( type === "string" ) {
	
					// Toggle individual class names
					i = 0;
					self = jQuery( this );
					classNames = value.match( rnotwhite ) || [];
	
					while ( ( className = classNames[ i++ ] ) ) {
	
						// Check each className given, space separated list
						if ( self.hasClass( className ) ) {
							self.removeClass( className );
						} else {
							self.addClass( className );
						}
					}
	
				// Toggle whole class name
				} else if ( value === undefined || type === "boolean" ) {
					className = getClass( this );
					if ( className ) {
	
						// Store className if set
						dataPriv.set( this, "__className__", className );
					}
	
					// If the element has a class name or if we're passed `false`,
					// then remove the whole classname (if there was one, the above saved it).
					// Otherwise bring back whatever was previously saved (if anything),
					// falling back to the empty string if nothing was stored.
					if ( this.setAttribute ) {
						this.setAttribute( "class",
							className || value === false ?
							"" :
							dataPriv.get( this, "__className__" ) || ""
						);
					}
				}
			} );
		},
	
		hasClass: function( selector ) {
			var className, elem,
				i = 0;
	
			className = " " + selector + " ";
			while ( ( elem = this[ i++ ] ) ) {
				if ( elem.nodeType === 1 &&
					( " " + getClass( elem ) + " " ).replace( rclass, " " )
						.indexOf( className ) > -1
				) {
					return true;
				}
			}
	
			return false;
		}
	} );
	
	
	
	
	var rreturn = /\r/g,
		rspaces = /[\x20\t\r\n\f]+/g;
	
	jQuery.fn.extend( {
		val: function( value ) {
			var hooks, ret, isFunction,
				elem = this[ 0 ];
	
			if ( !arguments.length ) {
				if ( elem ) {
					hooks = jQuery.valHooks[ elem.type ] ||
						jQuery.valHooks[ elem.nodeName.toLowerCase() ];
	
					if ( hooks &&
						"get" in hooks &&
						( ret = hooks.get( elem, "value" ) ) !== undefined
					) {
						return ret;
					}
	
					ret = elem.value;
	
					return typeof ret === "string" ?
	
						// Handle most common string cases
						ret.replace( rreturn, "" ) :
	
						// Handle cases where value is null/undef or number
						ret == null ? "" : ret;
				}
	
				return;
			}
	
			isFunction = jQuery.isFunction( value );
	
			return this.each( function( i ) {
				var val;
	
				if ( this.nodeType !== 1 ) {
					return;
				}
	
				if ( isFunction ) {
					val = value.call( this, i, jQuery( this ).val() );
				} else {
					val = value;
				}
	
				// Treat null/undefined as ""; convert numbers to string
				if ( val == null ) {
					val = "";
	
				} else if ( typeof val === "number" ) {
					val += "";
	
				} else if ( jQuery.isArray( val ) ) {
					val = jQuery.map( val, function( value ) {
						return value == null ? "" : value + "";
					} );
				}
	
				hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
	
				// If set returns undefined, fall back to normal setting
				if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
					this.value = val;
				}
			} );
		}
	} );
	
	jQuery.extend( {
		valHooks: {
			option: {
				get: function( elem ) {
	
					var val = jQuery.find.attr( elem, "value" );
					return val != null ?
						val :
	
						// Support: IE10-11+
						// option.text throws exceptions (#14686, #14858)
						// Strip and collapse whitespace
						// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
						jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
				}
			},
			select: {
				get: function( elem ) {
					var value, option,
						options = elem.options,
						index = elem.selectedIndex,
						one = elem.type === "select-one" || index < 0,
						values = one ? null : [],
						max = one ? index + 1 : options.length,
						i = index < 0 ?
							max :
							one ? index : 0;
	
					// Loop through all the selected options
					for ( ; i < max; i++ ) {
						option = options[ i ];
	
						// IE8-9 doesn't update selected after form reset (#2551)
						if ( ( option.selected || i === index ) &&
	
								// Don't return options that are disabled or in a disabled optgroup
								( support.optDisabled ?
									!option.disabled : option.getAttribute( "disabled" ) === null ) &&
								( !option.parentNode.disabled ||
									!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
	
							// Get the specific value for the option
							value = jQuery( option ).val();
	
							// We don't need an array for one selects
							if ( one ) {
								return value;
							}
	
							// Multi-Selects return an array
							values.push( value );
						}
					}
	
					return values;
				},
	
				set: function( elem, value ) {
					var optionSet, option,
						options = elem.options,
						values = jQuery.makeArray( value ),
						i = options.length;
	
					while ( i-- ) {
						option = options[ i ];
						if ( option.selected =
							jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
						) {
							optionSet = true;
						}
					}
	
					// Force browsers to behave consistently when non-matching value is set
					if ( !optionSet ) {
						elem.selectedIndex = -1;
					}
					return values;
				}
			}
		}
	} );
	
	// Radios and checkboxes getter/setter
	jQuery.each( [ "radio", "checkbox" ], function() {
		jQuery.valHooks[ this ] = {
			set: function( elem, value ) {
				if ( jQuery.isArray( value ) ) {
					return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
				}
			}
		};
		if ( !support.checkOn ) {
			jQuery.valHooks[ this ].get = function( elem ) {
				return elem.getAttribute( "value" ) === null ? "on" : elem.value;
			};
		}
	} );
	
	
	
	
	// Return jQuery for attributes-only inclusion
	
	
	var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
	
	jQuery.extend( jQuery.event, {
	
		trigger: function( event, data, elem, onlyHandlers ) {
	
			var i, cur, tmp, bubbleType, ontype, handle, special,
				eventPath = [ elem || document ],
				type = hasOwn.call( event, "type" ) ? event.type : event,
				namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
	
			cur = tmp = elem = elem || document;
	
			// Don't do events on text and comment nodes
			if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
				return;
			}
	
			// focus/blur morphs to focusin/out; ensure we're not firing them right now
			if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
				return;
			}
	
			if ( type.indexOf( "." ) > -1 ) {
	
				// Namespaced trigger; create a regexp to match event type in handle()
				namespaces = type.split( "." );
				type = namespaces.shift();
				namespaces.sort();
			}
			ontype = type.indexOf( ":" ) < 0 && "on" + type;
	
			// Caller can pass in a jQuery.Event object, Object, or just an event type string
			event = event[ jQuery.expando ] ?
				event :
				new jQuery.Event( type, typeof event === "object" && event );
	
			// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
			event.isTrigger = onlyHandlers ? 2 : 3;
			event.namespace = namespaces.join( "." );
			event.rnamespace = event.namespace ?
				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
				null;
	
			// Clean up the event in case it is being reused
			event.result = undefined;
			if ( !event.target ) {
				event.target = elem;
			}
	
			// Clone any incoming data and prepend the event, creating the handler arg list
			data = data == null ?
				[ event ] :
				jQuery.makeArray( data, [ event ] );
	
			// Allow special events to draw outside the lines
			special = jQuery.event.special[ type ] || {};
			if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
				return;
			}
	
			// Determine event propagation path in advance, per W3C events spec (#9951)
			// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
			if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
	
				bubbleType = special.delegateType || type;
				if ( !rfocusMorph.test( bubbleType + type ) ) {
					cur = cur.parentNode;
				}
				for ( ; cur; cur = cur.parentNode ) {
					eventPath.push( cur );
					tmp = cur;
				}
	
				// Only add window if we got to document (e.g., not plain obj or detached DOM)
				if ( tmp === ( elem.ownerDocument || document ) ) {
					eventPath.push( tmp.defaultView || tmp.parentWindow || window );
				}
			}
	
			// Fire handlers on the event path
			i = 0;
			while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
	
				event.type = i > 1 ?
					bubbleType :
					special.bindType || type;
	
				// jQuery handler
				handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
					dataPriv.get( cur, "handle" );
				if ( handle ) {
					handle.apply( cur, data );
				}
	
				// Native handler
				handle = ontype && cur[ ontype ];
				if ( handle && handle.apply && acceptData( cur ) ) {
					event.result = handle.apply( cur, data );
					if ( event.result === false ) {
						event.preventDefault();
					}
				}
			}
			event.type = type;
	
			// If nobody prevented the default action, do it now
			if ( !onlyHandlers && !event.isDefaultPrevented() ) {
	
				if ( ( !special._default ||
					special._default.apply( eventPath.pop(), data ) === false ) &&
					acceptData( elem ) ) {
	
					// Call a native DOM method on the target with the same name name as the event.
					// Don't do default actions on window, that's where global variables be (#6170)
					if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
	
						// Don't re-trigger an onFOO event when we call its FOO() method
						tmp = elem[ ontype ];
	
						if ( tmp ) {
							elem[ ontype ] = null;
						}
	
						// Prevent re-triggering of the same event, since we already bubbled it above
						jQuery.event.triggered = type;
						elem[ type ]();
						jQuery.event.triggered = undefined;
	
						if ( tmp ) {
							elem[ ontype ] = tmp;
						}
					}
				}
			}
	
			return event.result;
		},
	
		// Piggyback on a donor event to simulate a different one
		// Used only for `focus(in | out)` events
		simulate: function( type, elem, event ) {
			var e = jQuery.extend(
				new jQuery.Event(),
				event,
				{
					type: type,
					isSimulated: true
				}
			);
	
			jQuery.event.trigger( e, null, elem );
		}
	
	} );
	
	jQuery.fn.extend( {
	
		trigger: function( type, data ) {
			return this.each( function() {
				jQuery.event.trigger( type, data, this );
			} );
		},
		triggerHandler: function( type, data ) {
			var elem = this[ 0 ];
			if ( elem ) {
				return jQuery.event.trigger( type, data, elem, true );
			}
		}
	} );
	
	
	jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
		"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
		"change select submit keydown keypress keyup error contextmenu" ).split( " " ),
		function( i, name ) {
	
		// Handle event binding
		jQuery.fn[ name ] = function( data, fn ) {
			return arguments.length > 0 ?
				this.on( name, null, data, fn ) :
				this.trigger( name );
		};
	} );
	
	jQuery.fn.extend( {
		hover: function( fnOver, fnOut ) {
			return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
		}
	} );
	
	
	
	
	support.focusin = "onfocusin" in window;
	
	
	// Support: Firefox
	// Firefox doesn't have focus(in | out) events
	// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
	//
	// Support: Chrome, Safari
	// focus(in | out) events fire after focus & blur events,
	// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
	// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
	if ( !support.focusin ) {
		jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
	
			// Attach a single capturing handler on the document while someone wants focusin/focusout
			var handler = function( event ) {
				jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
			};
	
			jQuery.event.special[ fix ] = {
				setup: function() {
					var doc = this.ownerDocument || this,
						attaches = dataPriv.access( doc, fix );
	
					if ( !attaches ) {
						doc.addEventListener( orig, handler, true );
					}
					dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
				},
				teardown: function() {
					var doc = this.ownerDocument || this,
						attaches = dataPriv.access( doc, fix ) - 1;
	
					if ( !attaches ) {
						doc.removeEventListener( orig, handler, true );
						dataPriv.remove( doc, fix );
	
					} else {
						dataPriv.access( doc, fix, attaches );
					}
				}
			};
		} );
	}
	var location = window.location;
	
	var nonce = jQuery.now();
	
	var rquery = ( /\?/ );
	
	
	
	// Support: Android 2.3
	// Workaround failure to string-cast null input
	jQuery.parseJSON = function( data ) {
		return JSON.parse( data + "" );
	};
	
	
	// Cross-browser xml parsing
	jQuery.parseXML = function( data ) {
		var xml;
		if ( !data || typeof data !== "string" ) {
			return null;
		}
	
		// Support: IE9
		try {
			xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
		} catch ( e ) {
			xml = undefined;
		}
	
		if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
			jQuery.error( "Invalid XML: " + data );
		}
		return xml;
	};
	
	
	var
		rhash = /#.*$/,
		rts = /([?&])_=[^&]*/,
		rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
	
		// #7653, #8125, #8152: local protocol detection
		rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
		rnoContent = /^(?:GET|HEAD)$/,
		rprotocol = /^\/\//,
	
		/* Prefilters
		 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
		 * 2) These are called:
		 *    - BEFORE asking for a transport
		 *    - AFTER param serialization (s.data is a string if s.processData is true)
		 * 3) key is the dataType
		 * 4) the catchall symbol "*" can be used
		 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
		 */
		prefilters = {},
	
		/* Transports bindings
		 * 1) key is the dataType
		 * 2) the catchall symbol "*" can be used
		 * 3) selection will start with transport dataType and THEN go to "*" if needed
		 */
		transports = {},
	
		// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
		allTypes = "*/".concat( "*" ),
	
		// Anchor tag for parsing the document origin
		originAnchor = document.createElement( "a" );
		originAnchor.href = location.href;
	
	// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
	function addToPrefiltersOrTransports( structure ) {
	
		// dataTypeExpression is optional and defaults to "*"
		return function( dataTypeExpression, func ) {
	
			if ( typeof dataTypeExpression !== "string" ) {
				func = dataTypeExpression;
				dataTypeExpression = "*";
			}
	
			var dataType,
				i = 0,
				dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
	
			if ( jQuery.isFunction( func ) ) {
	
				// For each dataType in the dataTypeExpression
				while ( ( dataType = dataTypes[ i++ ] ) ) {
	
					// Prepend if requested
					if ( dataType[ 0 ] === "+" ) {
						dataType = dataType.slice( 1 ) || "*";
						( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
	
					// Otherwise append
					} else {
						( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
					}
				}
			}
		};
	}
	
	// Base inspection function for prefilters and transports
	function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
	
		var inspected = {},
			seekingTransport = ( structure === transports );
	
		function inspect( dataType ) {
			var selected;
			inspected[ dataType ] = true;
			jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
				var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
				if ( typeof dataTypeOrTransport === "string" &&
					!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
	
					options.dataTypes.unshift( dataTypeOrTransport );
					inspect( dataTypeOrTransport );
					return false;
				} else if ( seekingTransport ) {
					return !( selected = dataTypeOrTransport );
				}
			} );
			return selected;
		}
	
		return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
	}
	
	// A special extend for ajax options
	// that takes "flat" options (not to be deep extended)
	// Fixes #9887
	function ajaxExtend( target, src ) {
		var key, deep,
			flatOptions = jQuery.ajaxSettings.flatOptions || {};
	
		for ( key in src ) {
			if ( src[ key ] !== undefined ) {
				( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
			}
		}
		if ( deep ) {
			jQuery.extend( true, target, deep );
		}
	
		return target;
	}
	
	/* Handles responses to an ajax request:
	 * - finds the right dataType (mediates between content-type and expected dataType)
	 * - returns the corresponding response
	 */
	function ajaxHandleResponses( s, jqXHR, responses ) {
	
		var ct, type, finalDataType, firstDataType,
			contents = s.contents,
			dataTypes = s.dataTypes;
	
		// Remove auto dataType and get content-type in the process
		while ( dataTypes[ 0 ] === "*" ) {
			dataTypes.shift();
			if ( ct === undefined ) {
				ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
			}
		}
	
		// Check if we're dealing with a known content-type
		if ( ct ) {
			for ( type in contents ) {
				if ( contents[ type ] && contents[ type ].test( ct ) ) {
					dataTypes.unshift( type );
					break;
				}
			}
		}
	
		// Check to see if we have a response for the expected dataType
		if ( dataTypes[ 0 ] in responses ) {
			finalDataType = dataTypes[ 0 ];
		} else {
	
			// Try convertible dataTypes
			for ( type in responses ) {
				if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
					finalDataType = type;
					break;
				}
				if ( !firstDataType ) {
					firstDataType = type;
				}
			}
	
			// Or just use first one
			finalDataType = finalDataType || firstDataType;
		}
	
		// If we found a dataType
		// We add the dataType to the list if needed
		// and return the corresponding response
		if ( finalDataType ) {
			if ( finalDataType !== dataTypes[ 0 ] ) {
				dataTypes.unshift( finalDataType );
			}
			return responses[ finalDataType ];
		}
	}
	
	/* Chain conversions given the request and the original response
	 * Also sets the responseXXX fields on the jqXHR instance
	 */
	function ajaxConvert( s, response, jqXHR, isSuccess ) {
		var conv2, current, conv, tmp, prev,
			converters = {},
	
			// Work with a copy of dataTypes in case we need to modify it for conversion
			dataTypes = s.dataTypes.slice();
	
		// Create converters map with lowercased keys
		if ( dataTypes[ 1 ] ) {
			for ( conv in s.converters ) {
				converters[ conv.toLowerCase() ] = s.converters[ conv ];
			}
		}
	
		current = dataTypes.shift();
	
		// Convert to each sequential dataType
		while ( current ) {
	
			if ( s.responseFields[ current ] ) {
				jqXHR[ s.responseFields[ current ] ] = response;
			}
	
			// Apply the dataFilter if provided
			if ( !prev && isSuccess && s.dataFilter ) {
				response = s.dataFilter( response, s.dataType );
			}
	
			prev = current;
			current = dataTypes.shift();
	
			if ( current ) {
	
			// There's only work to do if current dataType is non-auto
				if ( current === "*" ) {
	
					current = prev;
	
				// Convert response if prev dataType is non-auto and differs from current
				} else if ( prev !== "*" && prev !== current ) {
	
					// Seek a direct converter
					conv = converters[ prev + " " + current ] || converters[ "* " + current ];
	
					// If none found, seek a pair
					if ( !conv ) {
						for ( conv2 in converters ) {
	
							// If conv2 outputs current
							tmp = conv2.split( " " );
							if ( tmp[ 1 ] === current ) {
	
								// If prev can be converted to accepted input
								conv = converters[ prev + " " + tmp[ 0 ] ] ||
									converters[ "* " + tmp[ 0 ] ];
								if ( conv ) {
	
									// Condense equivalence converters
									if ( conv === true ) {
										conv = converters[ conv2 ];
	
									// Otherwise, insert the intermediate dataType
									} else if ( converters[ conv2 ] !== true ) {
										current = tmp[ 0 ];
										dataTypes.unshift( tmp[ 1 ] );
									}
									break;
								}
							}
						}
					}
	
					// Apply converter (if not an equivalence)
					if ( conv !== true ) {
	
						// Unless errors are allowed to bubble, catch and return them
						if ( conv && s.throws ) {
							response = conv( response );
						} else {
							try {
								response = conv( response );
							} catch ( e ) {
								return {
									state: "parsererror",
									error: conv ? e : "No conversion from " + prev + " to " + current
								};
							}
						}
					}
				}
			}
		}
	
		return { state: "success", data: response };
	}
	
	jQuery.extend( {
	
		// Counter for holding the number of active queries
		active: 0,
	
		// Last-Modified header cache for next request
		lastModified: {},
		etag: {},
	
		ajaxSettings: {
			url: location.href,
			type: "GET",
			isLocal: rlocalProtocol.test( location.protocol ),
			global: true,
			processData: true,
			async: true,
			contentType: "application/x-www-form-urlencoded; charset=UTF-8",
			/*
			timeout: 0,
			data: null,
			dataType: null,
			username: null,
			password: null,
			cache: null,
			throws: false,
			traditional: false,
			headers: {},
			*/
	
			accepts: {
				"*": allTypes,
				text: "text/plain",
				html: "text/html",
				xml: "application/xml, text/xml",
				json: "application/json, text/javascript"
			},
	
			contents: {
				xml: /\bxml\b/,
				html: /\bhtml/,
				json: /\bjson\b/
			},
	
			responseFields: {
				xml: "responseXML",
				text: "responseText",
				json: "responseJSON"
			},
	
			// Data converters
			// Keys separate source (or catchall "*") and destination types with a single space
			converters: {
	
				// Convert anything to text
				"* text": String,
	
				// Text to html (true = no transformation)
				"text html": true,
	
				// Evaluate text as a json expression
				"text json": jQuery.parseJSON,
	
				// Parse text as xml
				"text xml": jQuery.parseXML
			},
	
			// For options that shouldn't be deep extended:
			// you can add your own custom options here if
			// and when you create one that shouldn't be
			// deep extended (see ajaxExtend)
			flatOptions: {
				url: true,
				context: true
			}
		},
	
		// Creates a full fledged settings object into target
		// with both ajaxSettings and settings fields.
		// If target is omitted, writes into ajaxSettings.
		ajaxSetup: function( target, settings ) {
			return settings ?
	
				// Building a settings object
				ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
	
				// Extending ajaxSettings
				ajaxExtend( jQuery.ajaxSettings, target );
		},
	
		ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
		ajaxTransport: addToPrefiltersOrTransports( transports ),
	
		// Main method
		ajax: function( url, options ) {
	
			// If url is an object, simulate pre-1.5 signature
			if ( typeof url === "object" ) {
				options = url;
				url = undefined;
			}
	
			// Force options to be an object
			options = options || {};
	
			var transport,
	
				// URL without anti-cache param
				cacheURL,
	
				// Response headers
				responseHeadersString,
				responseHeaders,
	
				// timeout handle
				timeoutTimer,
	
				// Url cleanup var
				urlAnchor,
	
				// To know if global events are to be dispatched
				fireGlobals,
	
				// Loop variable
				i,
	
				// Create the final options object
				s = jQuery.ajaxSetup( {}, options ),
	
				// Callbacks context
				callbackContext = s.context || s,
	
				// Context for global events is callbackContext if it is a DOM node or jQuery collection
				globalEventContext = s.context &&
					( callbackContext.nodeType || callbackContext.jquery ) ?
						jQuery( callbackContext ) :
						jQuery.event,
	
				// Deferreds
				deferred = jQuery.Deferred(),
				completeDeferred = jQuery.Callbacks( "once memory" ),
	
				// Status-dependent callbacks
				statusCode = s.statusCode || {},
	
				// Headers (they are sent all at once)
				requestHeaders = {},
				requestHeadersNames = {},
	
				// The jqXHR state
				state = 0,
	
				// Default abort message
				strAbort = "canceled",
	
				// Fake xhr
				jqXHR = {
					readyState: 0,
	
					// Builds headers hashtable if needed
					getResponseHeader: function( key ) {
						var match;
						if ( state === 2 ) {
							if ( !responseHeaders ) {
								responseHeaders = {};
								while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
									responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
								}
							}
							match = responseHeaders[ key.toLowerCase() ];
						}
						return match == null ? null : match;
					},
	
					// Raw string
					getAllResponseHeaders: function() {
						return state === 2 ? responseHeadersString : null;
					},
	
					// Caches the header
					setRequestHeader: function( name, value ) {
						var lname = name.toLowerCase();
						if ( !state ) {
							name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
							requestHeaders[ name ] = value;
						}
						return this;
					},
	
					// Overrides response content-type header
					overrideMimeType: function( type ) {
						if ( !state ) {
							s.mimeType = type;
						}
						return this;
					},
	
					// Status-dependent callbacks
					statusCode: function( map ) {
						var code;
						if ( map ) {
							if ( state < 2 ) {
								for ( code in map ) {
	
									// Lazy-add the new callback in a way that preserves old ones
									statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
								}
							} else {
	
								// Execute the appropriate callbacks
								jqXHR.always( map[ jqXHR.status ] );
							}
						}
						return this;
					},
	
					// Cancel the request
					abort: function( statusText ) {
						var finalText = statusText || strAbort;
						if ( transport ) {
							transport.abort( finalText );
						}
						done( 0, finalText );
						return this;
					}
				};
	
			// Attach deferreds
			deferred.promise( jqXHR ).complete = completeDeferred.add;
			jqXHR.success = jqXHR.done;
			jqXHR.error = jqXHR.fail;
	
			// Remove hash character (#7531: and string promotion)
			// Add protocol if not provided (prefilters might expect it)
			// Handle falsy url in the settings object (#10093: consistency with old signature)
			// We also use the url parameter if available
			s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
				.replace( rprotocol, location.protocol + "//" );
	
			// Alias method option to type as per ticket #12004
			s.type = options.method || options.type || s.method || s.type;
	
			// Extract dataTypes list
			s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
	
			// A cross-domain request is in order when the origin doesn't match the current origin.
			if ( s.crossDomain == null ) {
				urlAnchor = document.createElement( "a" );
	
				// Support: IE8-11+
				// IE throws exception if url is malformed, e.g. http://example.com:80x/
				try {
					urlAnchor.href = s.url;
	
					// Support: IE8-11+
					// Anchor's host property isn't correctly set when s.url is relative
					urlAnchor.href = urlAnchor.href;
					s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
						urlAnchor.protocol + "//" + urlAnchor.host;
				} catch ( e ) {
	
					// If there is an error parsing the URL, assume it is crossDomain,
					// it can be rejected by the transport if it is invalid
					s.crossDomain = true;
				}
			}
	
			// Convert data if not already a string
			if ( s.data && s.processData && typeof s.data !== "string" ) {
				s.data = jQuery.param( s.data, s.traditional );
			}
	
			// Apply prefilters
			inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
	
			// If request was aborted inside a prefilter, stop there
			if ( state === 2 ) {
				return jqXHR;
			}
	
			// We can fire global events as of now if asked to
			// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
			fireGlobals = jQuery.event && s.global;
	
			// Watch for a new set of requests
			if ( fireGlobals && jQuery.active++ === 0 ) {
				jQuery.event.trigger( "ajaxStart" );
			}
	
			// Uppercase the type
			s.type = s.type.toUpperCase();
	
			// Determine if request has content
			s.hasContent = !rnoContent.test( s.type );
	
			// Save the URL in case we're toying with the If-Modified-Since
			// and/or If-None-Match header later on
			cacheURL = s.url;
	
			// More options handling for requests with no content
			if ( !s.hasContent ) {
	
				// If data is available, append data to url
				if ( s.data ) {
					cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
	
					// #9682: remove data so that it's not used in an eventual retry
					delete s.data;
				}
	
				// Add anti-cache in url if needed
				if ( s.cache === false ) {
					s.url = rts.test( cacheURL ) ?
	
						// If there is already a '_' parameter, set its value
						cacheURL.replace( rts, "$1_=" + nonce++ ) :
	
						// Otherwise add one to the end
						cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
				}
			}
	
			// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
			if ( s.ifModified ) {
				if ( jQuery.lastModified[ cacheURL ] ) {
					jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
				}
				if ( jQuery.etag[ cacheURL ] ) {
					jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
				}
			}
	
			// Set the correct header, if data is being sent
			if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
				jqXHR.setRequestHeader( "Content-Type", s.contentType );
			}
	
			// Set the Accepts header for the server, depending on the dataType
			jqXHR.setRequestHeader(
				"Accept",
				s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
					s.accepts[ s.dataTypes[ 0 ] ] +
						( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
					s.accepts[ "*" ]
			);
	
			// Check for headers option
			for ( i in s.headers ) {
				jqXHR.setRequestHeader( i, s.headers[ i ] );
			}
	
			// Allow custom headers/mimetypes and early abort
			if ( s.beforeSend &&
				( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
	
				// Abort if not done already and return
				return jqXHR.abort();
			}
	
			// Aborting is no longer a cancellation
			strAbort = "abort";
	
			// Install callbacks on deferreds
			for ( i in { success: 1, error: 1, complete: 1 } ) {
				jqXHR[ i ]( s[ i ] );
			}
	
			// Get transport
			transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
	
			// If no transport, we auto-abort
			if ( !transport ) {
				done( -1, "No Transport" );
			} else {
				jqXHR.readyState = 1;
	
				// Send global event
				if ( fireGlobals ) {
					globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
				}
	
				// If request was aborted inside ajaxSend, stop there
				if ( state === 2 ) {
					return jqXHR;
				}
	
				// Timeout
				if ( s.async && s.timeout > 0 ) {
					timeoutTimer = window.setTimeout( function() {
						jqXHR.abort( "timeout" );
					}, s.timeout );
				}
	
				try {
					state = 1;
					transport.send( requestHeaders, done );
				} catch ( e ) {
	
					// Propagate exception as error if not done
					if ( state < 2 ) {
						done( -1, e );
	
					// Simply rethrow otherwise
					} else {
						throw e;
					}
				}
			}
	
			// Callback for when everything is done
			function done( status, nativeStatusText, responses, headers ) {
				var isSuccess, success, error, response, modified,
					statusText = nativeStatusText;
	
				// Called once
				if ( state === 2 ) {
					return;
				}
	
				// State is "done" now
				state = 2;
	
				// Clear timeout if it exists
				if ( timeoutTimer ) {
					window.clearTimeout( timeoutTimer );
				}
	
				// Dereference transport for early garbage collection
				// (no matter how long the jqXHR object will be used)
				transport = undefined;
	
				// Cache response headers
				responseHeadersString = headers || "";
	
				// Set readyState
				jqXHR.readyState = status > 0 ? 4 : 0;
	
				// Determine if successful
				isSuccess = status >= 200 && status < 300 || status === 304;
	
				// Get response data
				if ( responses ) {
					response = ajaxHandleResponses( s, jqXHR, responses );
				}
	
				// Convert no matter what (that way responseXXX fields are always set)
				response = ajaxConvert( s, response, jqXHR, isSuccess );
	
				// If successful, handle type chaining
				if ( isSuccess ) {
	
					// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
					if ( s.ifModified ) {
						modified = jqXHR.getResponseHeader( "Last-Modified" );
						if ( modified ) {
							jQuery.lastModified[ cacheURL ] = modified;
						}
						modified = jqXHR.getResponseHeader( "etag" );
						if ( modified ) {
							jQuery.etag[ cacheURL ] = modified;
						}
					}
	
					// if no content
					if ( status === 204 || s.type === "HEAD" ) {
						statusText = "nocontent";
	
					// if not modified
					} else if ( status === 304 ) {
						statusText = "notmodified";
	
					// If we have data, let's convert it
					} else {
						statusText = response.state;
						success = response.data;
						error = response.error;
						isSuccess = !error;
					}
				} else {
	
					// Extract error from statusText and normalize for non-aborts
					error = statusText;
					if ( status || !statusText ) {
						statusText = "error";
						if ( status < 0 ) {
							status = 0;
						}
					}
				}
	
				// Set data for the fake xhr object
				jqXHR.status = status;
				jqXHR.statusText = ( nativeStatusText || statusText ) + "";
	
				// Success/Error
				if ( isSuccess ) {
					deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
				} else {
					deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
				}
	
				// Status-dependent callbacks
				jqXHR.statusCode( statusCode );
				statusCode = undefined;
	
				if ( fireGlobals ) {
					globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
						[ jqXHR, s, isSuccess ? success : error ] );
				}
	
				// Complete
				completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
	
				if ( fireGlobals ) {
					globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
	
					// Handle the global AJAX counter
					if ( !( --jQuery.active ) ) {
						jQuery.event.trigger( "ajaxStop" );
					}
				}
			}
	
			return jqXHR;
		},
	
		getJSON: function( url, data, callback ) {
			return jQuery.get( url, data, callback, "json" );
		},
	
		getScript: function( url, callback ) {
			return jQuery.get( url, undefined, callback, "script" );
		}
	} );
	
	jQuery.each( [ "get", "post" ], function( i, method ) {
		jQuery[ method ] = function( url, data, callback, type ) {
	
			// Shift arguments if data argument was omitted
			if ( jQuery.isFunction( data ) ) {
				type = type || callback;
				callback = data;
				data = undefined;
			}
	
			// The url can be an options object (which then must have .url)
			return jQuery.ajax( jQuery.extend( {
				url: url,
				type: method,
				dataType: type,
				data: data,
				success: callback
			}, jQuery.isPlainObject( url ) && url ) );
		};
	} );
	
	
	jQuery._evalUrl = function( url ) {
		return jQuery.ajax( {
			url: url,
	
			// Make this explicit, since user can override this through ajaxSetup (#11264)
			type: "GET",
			dataType: "script",
			async: false,
			global: false,
			"throws": true
		} );
	};
	
	
	jQuery.fn.extend( {
		wrapAll: function( html ) {
			var wrap;
	
			if ( jQuery.isFunction( html ) ) {
				return this.each( function( i ) {
					jQuery( this ).wrapAll( html.call( this, i ) );
				} );
			}
	
			if ( this[ 0 ] ) {
	
				// The elements to wrap the target around
				wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
	
				if ( this[ 0 ].parentNode ) {
					wrap.insertBefore( this[ 0 ] );
				}
	
				wrap.map( function() {
					var elem = this;
	
					while ( elem.firstElementChild ) {
						elem = elem.firstElementChild;
					}
	
					return elem;
				} ).append( this );
			}
	
			return this;
		},
	
		wrapInner: function( html ) {
			if ( jQuery.isFunction( html ) ) {
				return this.each( function( i ) {
					jQuery( this ).wrapInner( html.call( this, i ) );
				} );
			}
	
			return this.each( function() {
				var self = jQuery( this ),
					contents = self.contents();
	
				if ( contents.length ) {
					contents.wrapAll( html );
	
				} else {
					self.append( html );
				}
			} );
		},
	
		wrap: function( html ) {
			var isFunction = jQuery.isFunction( html );
	
			return this.each( function( i ) {
				jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
			} );
		},
	
		unwrap: function() {
			return this.parent().each( function() {
				if ( !jQuery.nodeName( this, "body" ) ) {
					jQuery( this ).replaceWith( this.childNodes );
				}
			} ).end();
		}
	} );
	
	
	jQuery.expr.filters.hidden = function( elem ) {
		return !jQuery.expr.filters.visible( elem );
	};
	jQuery.expr.filters.visible = function( elem ) {
	
		// Support: Opera <= 12.12
		// Opera reports offsetWidths and offsetHeights less than zero on some elements
		// Use OR instead of AND as the element is not visible if either is true
		// See tickets #10406 and #13132
		return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
	};
	
	
	
	
	var r20 = /%20/g,
		rbracket = /\[\]$/,
		rCRLF = /\r?\n/g,
		rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
		rsubmittable = /^(?:input|select|textarea|keygen)/i;
	
	function buildParams( prefix, obj, traditional, add ) {
		var name;
	
		if ( jQuery.isArray( obj ) ) {
	
			// Serialize array item.
			jQuery.each( obj, function( i, v ) {
				if ( traditional || rbracket.test( prefix ) ) {
	
					// Treat each array item as a scalar.
					add( prefix, v );
	
				} else {
	
					// Item is non-scalar (array or object), encode its numeric index.
					buildParams(
						prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
						v,
						traditional,
						add
					);
				}
			} );
	
		} else if ( !traditional && jQuery.type( obj ) === "object" ) {
	
			// Serialize object item.
			for ( name in obj ) {
				buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
			}
	
		} else {
	
			// Serialize scalar item.
			add( prefix, obj );
		}
	}
	
	// Serialize an array of form elements or a set of
	// key/values into a query string
	jQuery.param = function( a, traditional ) {
		var prefix,
			s = [],
			add = function( key, value ) {
	
				// If value is a function, invoke it and return its value
				value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
				s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
			};
	
		// Set traditional to true for jQuery <= 1.3.2 behavior.
		if ( traditional === undefined ) {
			traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
		}
	
		// If an array was passed in, assume that it is an array of form elements.
		if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
	
			// Serialize the form elements
			jQuery.each( a, function() {
				add( this.name, this.value );
			} );
	
		} else {
	
			// If traditional, encode the "old" way (the way 1.3.2 or older
			// did it), otherwise encode params recursively.
			for ( prefix in a ) {
				buildParams( prefix, a[ prefix ], traditional, add );
			}
		}
	
		// Return the resulting serialization
		return s.join( "&" ).replace( r20, "+" );
	};
	
	jQuery.fn.extend( {
		serialize: function() {
			return jQuery.param( this.serializeArray() );
		},
		serializeArray: function() {
			return this.map( function() {
	
				// Can add propHook for "elements" to filter or add form elements
				var elements = jQuery.prop( this, "elements" );
				return elements ? jQuery.makeArray( elements ) : this;
			} )
			.filter( function() {
				var type = this.type;
	
				// Use .is( ":disabled" ) so that fieldset[disabled] works
				return this.name && !jQuery( this ).is( ":disabled" ) &&
					rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
					( this.checked || !rcheckableType.test( type ) );
			} )
			.map( function( i, elem ) {
				var val = jQuery( this ).val();
	
				return val == null ?
					null :
					jQuery.isArray( val ) ?
						jQuery.map( val, function( val ) {
							return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
						} ) :
						{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
			} ).get();
		}
	} );
	
	
	jQuery.ajaxSettings.xhr = function() {
		try {
			return new window.XMLHttpRequest();
		} catch ( e ) {}
	};
	
	var xhrSuccessStatus = {
	
			// File protocol always yields status code 0, assume 200
			0: 200,
	
			// Support: IE9
			// #1450: sometimes IE returns 1223 when it should be 204
			1223: 204
		},
		xhrSupported = jQuery.ajaxSettings.xhr();
	
	support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
	support.ajax = xhrSupported = !!xhrSupported;
	
	jQuery.ajaxTransport( function( options ) {
		var callback, errorCallback;
	
		// Cross domain only allowed if supported through XMLHttpRequest
		if ( support.cors || xhrSupported && !options.crossDomain ) {
			return {
				send: function( headers, complete ) {
					var i,
						xhr = options.xhr();
	
					xhr.open(
						options.type,
						options.url,
						options.async,
						options.username,
						options.password
					);
	
					// Apply custom fields if provided
					if ( options.xhrFields ) {
						for ( i in options.xhrFields ) {
							xhr[ i ] = options.xhrFields[ i ];
						}
					}
	
					// Override mime type if needed
					if ( options.mimeType && xhr.overrideMimeType ) {
						xhr.overrideMimeType( options.mimeType );
					}
	
					// X-Requested-With header
					// For cross-domain requests, seeing as conditions for a preflight are
					// akin to a jigsaw puzzle, we simply never set it to be sure.
					// (it can always be set on a per-request basis or even using ajaxSetup)
					// For same-domain requests, won't change header if already provided.
					if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
						headers[ "X-Requested-With" ] = "XMLHttpRequest";
					}
	
					// Set headers
					for ( i in headers ) {
						xhr.setRequestHeader( i, headers[ i ] );
					}
	
					// Callback
					callback = function( type ) {
						return function() {
							if ( callback ) {
								callback = errorCallback = xhr.onload =
									xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
	
								if ( type === "abort" ) {
									xhr.abort();
								} else if ( type === "error" ) {
	
									// Support: IE9
									// On a manual native abort, IE9 throws
									// errors on any property access that is not readyState
									if ( typeof xhr.status !== "number" ) {
										complete( 0, "error" );
									} else {
										complete(
	
											// File: protocol always yields status 0; see #8605, #14207
											xhr.status,
											xhr.statusText
										);
									}
								} else {
									complete(
										xhrSuccessStatus[ xhr.status ] || xhr.status,
										xhr.statusText,
	
										// Support: IE9 only
										// IE9 has no XHR2 but throws on binary (trac-11426)
										// For XHR2 non-text, let the caller handle it (gh-2498)
										( xhr.responseType || "text" ) !== "text"  ||
										typeof xhr.responseText !== "string" ?
											{ binary: xhr.response } :
											{ text: xhr.responseText },
										xhr.getAllResponseHeaders()
									);
								}
							}
						};
					};
	
					// Listen to events
					xhr.onload = callback();
					errorCallback = xhr.onerror = callback( "error" );
	
					// Support: IE9
					// Use onreadystatechange to replace onabort
					// to handle uncaught aborts
					if ( xhr.onabort !== undefined ) {
						xhr.onabort = errorCallback;
					} else {
						xhr.onreadystatechange = function() {
	
							// Check readyState before timeout as it changes
							if ( xhr.readyState === 4 ) {
	
								// Allow onerror to be called first,
								// but that will not handle a native abort
								// Also, save errorCallback to a variable
								// as xhr.onerror cannot be accessed
								window.setTimeout( function() {
									if ( callback ) {
										errorCallback();
									}
								} );
							}
						};
					}
	
					// Create the abort callback
					callback = callback( "abort" );
	
					try {
	
						// Do send the request (this may raise an exception)
						xhr.send( options.hasContent && options.data || null );
					} catch ( e ) {
	
						// #14683: Only rethrow if this hasn't been notified as an error yet
						if ( callback ) {
							throw e;
						}
					}
				},
	
				abort: function() {
					if ( callback ) {
						callback();
					}
				}
			};
		}
	} );
	
	
	
	
	// Install script dataType
	jQuery.ajaxSetup( {
		accepts: {
			script: "text/javascript, application/javascript, " +
				"application/ecmascript, application/x-ecmascript"
		},
		contents: {
			script: /\b(?:java|ecma)script\b/
		},
		converters: {
			"text script": function( text ) {
				jQuery.globalEval( text );
				return text;
			}
		}
	} );
	
	// Handle cache's special case and crossDomain
	jQuery.ajaxPrefilter( "script", function( s ) {
		if ( s.cache === undefined ) {
			s.cache = false;
		}
		if ( s.crossDomain ) {
			s.type = "GET";
		}
	} );
	
	// Bind script tag hack transport
	jQuery.ajaxTransport( "script", function( s ) {
	
		// This transport only deals with cross domain requests
		if ( s.crossDomain ) {
			var script, callback;
			return {
				send: function( _, complete ) {
					script = jQuery( "<script>" ).prop( {
						charset: s.scriptCharset,
						src: s.url
					} ).on(
						"load error",
						callback = function( evt ) {
							script.remove();
							callback = null;
							if ( evt ) {
								complete( evt.type === "error" ? 404 : 200, evt.type );
							}
						}
					);
	
					// Use native DOM manipulation to avoid our domManip AJAX trickery
					document.head.appendChild( script[ 0 ] );
				},
				abort: function() {
					if ( callback ) {
						callback();
					}
				}
			};
		}
	} );
	
	
	
	
	var oldCallbacks = [],
		rjsonp = /(=)\?(?=&|$)|\?\?/;
	
	// Default jsonp settings
	jQuery.ajaxSetup( {
		jsonp: "callback",
		jsonpCallback: function() {
			var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
			this[ callback ] = true;
			return callback;
		}
	} );
	
	// Detect, normalize options and install callbacks for jsonp requests
	jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
	
		var callbackName, overwritten, responseContainer,
			jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
				"url" :
				typeof s.data === "string" &&
					( s.contentType || "" )
						.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
					rjsonp.test( s.data ) && "data"
			);
	
		// Handle iff the expected data type is "jsonp" or we have a parameter to set
		if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
	
			// Get callback name, remembering preexisting value associated with it
			callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
				s.jsonpCallback() :
				s.jsonpCallback;
	
			// Insert callback into url or form data
			if ( jsonProp ) {
				s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
			} else if ( s.jsonp !== false ) {
				s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
			}
	
			// Use data converter to retrieve json after script execution
			s.converters[ "script json" ] = function() {
				if ( !responseContainer ) {
					jQuery.error( callbackName + " was not called" );
				}
				return responseContainer[ 0 ];
			};
	
			// Force json dataType
			s.dataTypes[ 0 ] = "json";
	
			// Install callback
			overwritten = window[ callbackName ];
			window[ callbackName ] = function() {
				responseContainer = arguments;
			};
	
			// Clean-up function (fires after converters)
			jqXHR.always( function() {
	
				// If previous value didn't exist - remove it
				if ( overwritten === undefined ) {
					jQuery( window ).removeProp( callbackName );
	
				// Otherwise restore preexisting value
				} else {
					window[ callbackName ] = overwritten;
				}
	
				// Save back as free
				if ( s[ callbackName ] ) {
	
					// Make sure that re-using the options doesn't screw things around
					s.jsonpCallback = originalSettings.jsonpCallback;
	
					// Save the callback name for future use
					oldCallbacks.push( callbackName );
				}
	
				// Call if it was a function and we have a response
				if ( responseContainer && jQuery.isFunction( overwritten ) ) {
					overwritten( responseContainer[ 0 ] );
				}
	
				responseContainer = overwritten = undefined;
			} );
	
			// Delegate to script
			return "script";
		}
	} );
	
	
	
	
	// Argument "data" should be string of html
	// context (optional): If specified, the fragment will be created in this context,
	// defaults to document
	// keepScripts (optional): If true, will include scripts passed in the html string
	jQuery.parseHTML = function( data, context, keepScripts ) {
		if ( !data || typeof data !== "string" ) {
			return null;
		}
		if ( typeof context === "boolean" ) {
			keepScripts = context;
			context = false;
		}
		context = context || document;
	
		var parsed = rsingleTag.exec( data ),
			scripts = !keepScripts && [];
	
		// Single tag
		if ( parsed ) {
			return [ context.createElement( parsed[ 1 ] ) ];
		}
	
		parsed = buildFragment( [ data ], context, scripts );
	
		if ( scripts && scripts.length ) {
			jQuery( scripts ).remove();
		}
	
		return jQuery.merge( [], parsed.childNodes );
	};
	
	
	// Keep a copy of the old load method
	var _load = jQuery.fn.load;
	
	/**
	 * Load a url into a page
	 */
	jQuery.fn.load = function( url, params, callback ) {
		if ( typeof url !== "string" && _load ) {
			return _load.apply( this, arguments );
		}
	
		var selector, type, response,
			self = this,
			off = url.indexOf( " " );
	
		if ( off > -1 ) {
			selector = jQuery.trim( url.slice( off ) );
			url = url.slice( 0, off );
		}
	
		// If it's a function
		if ( jQuery.isFunction( params ) ) {
	
			// We assume that it's the callback
			callback = params;
			params = undefined;
	
		// Otherwise, build a param string
		} else if ( params && typeof params === "object" ) {
			type = "POST";
		}
	
		// If we have elements to modify, make the request
		if ( self.length > 0 ) {
			jQuery.ajax( {
				url: url,
	
				// If "type" variable is undefined, then "GET" method will be used.
				// Make value of this field explicit since
				// user can override it through ajaxSetup method
				type: type || "GET",
				dataType: "html",
				data: params
			} ).done( function( responseText ) {
	
				// Save response for use in complete callback
				response = arguments;
	
				self.html( selector ?
	
					// If a selector was specified, locate the right elements in a dummy div
					// Exclude scripts to avoid IE 'Permission Denied' errors
					jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
	
					// Otherwise use the full result
					responseText );
	
			// If the request succeeds, this function gets "data", "status", "jqXHR"
			// but they are ignored because response was set above.
			// If it fails, this function gets "jqXHR", "status", "error"
			} ).always( callback && function( jqXHR, status ) {
				self.each( function() {
					callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
				} );
			} );
		}
	
		return this;
	};
	
	
	
	
	// Attach a bunch of functions for handling common AJAX events
	jQuery.each( [
		"ajaxStart",
		"ajaxStop",
		"ajaxComplete",
		"ajaxError",
		"ajaxSuccess",
		"ajaxSend"
	], function( i, type ) {
		jQuery.fn[ type ] = function( fn ) {
			return this.on( type, fn );
		};
	} );
	
	
	
	
	jQuery.expr.filters.animated = function( elem ) {
		return jQuery.grep( jQuery.timers, function( fn ) {
			return elem === fn.elem;
		} ).length;
	};
	
	
	
	
	/**
	 * Gets a window from an element
	 */
	function getWindow( elem ) {
		return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
	}
	
	jQuery.offset = {
		setOffset: function( elem, options, i ) {
			var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
				position = jQuery.css( elem, "position" ),
				curElem = jQuery( elem ),
				props = {};
	
			// Set position first, in-case top/left are set even on static elem
			if ( position === "static" ) {
				elem.style.position = "relative";
			}
	
			curOffset = curElem.offset();
			curCSSTop = jQuery.css( elem, "top" );
			curCSSLeft = jQuery.css( elem, "left" );
			calculatePosition = ( position === "absolute" || position === "fixed" ) &&
				( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
	
			// Need to be able to calculate position if either
			// top or left is auto and position is either absolute or fixed
			if ( calculatePosition ) {
				curPosition = curElem.position();
				curTop = curPosition.top;
				curLeft = curPosition.left;
	
			} else {
				curTop = parseFloat( curCSSTop ) || 0;
				curLeft = parseFloat( curCSSLeft ) || 0;
			}
	
			if ( jQuery.isFunction( options ) ) {
	
				// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
				options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
			}
	
			if ( options.top != null ) {
				props.top = ( options.top - curOffset.top ) + curTop;
			}
			if ( options.left != null ) {
				props.left = ( options.left - curOffset.left ) + curLeft;
			}
	
			if ( "using" in options ) {
				options.using.call( elem, props );
	
			} else {
				curElem.css( props );
			}
		}
	};
	
	jQuery.fn.extend( {
		offset: function( options ) {
			if ( arguments.length ) {
				return options === undefined ?
					this :
					this.each( function( i ) {
						jQuery.offset.setOffset( this, options, i );
					} );
			}
	
			var docElem, win,
				elem = this[ 0 ],
				box = { top: 0, left: 0 },
				doc = elem && elem.ownerDocument;
	
			if ( !doc ) {
				return;
			}
	
			docElem = doc.documentElement;
	
			// Make sure it's not a disconnected DOM node
			if ( !jQuery.contains( docElem, elem ) ) {
				return box;
			}
	
			box = elem.getBoundingClientRect();
			win = getWindow( doc );
			return {
				top: box.top + win.pageYOffset - docElem.clientTop,
				left: box.left + win.pageXOffset - docElem.clientLeft
			};
		},
	
		position: function() {
			if ( !this[ 0 ] ) {
				return;
			}
	
			var offsetParent, offset,
				elem = this[ 0 ],
				parentOffset = { top: 0, left: 0 };
	
			// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
			// because it is its only offset parent
			if ( jQuery.css( elem, "position" ) === "fixed" ) {
	
				// Assume getBoundingClientRect is there when computed position is fixed
				offset = elem.getBoundingClientRect();
	
			} else {
	
				// Get *real* offsetParent
				offsetParent = this.offsetParent();
	
				// Get correct offsets
				offset = this.offset();
				if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
					parentOffset = offsetParent.offset();
				}
	
				// Add offsetParent borders
				parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
				parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
			}
	
			// Subtract parent offsets and element margins
			return {
				top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
				left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
			};
		},
	
		// This method will return documentElement in the following cases:
		// 1) For the element inside the iframe without offsetParent, this method will return
		//    documentElement of the parent window
		// 2) For the hidden or detached element
		// 3) For body or html element, i.e. in case of the html node - it will return itself
		//
		// but those exceptions were never presented as a real life use-cases
		// and might be considered as more preferable results.
		//
		// This logic, however, is not guaranteed and can change at any point in the future
		offsetParent: function() {
			return this.map( function() {
				var offsetParent = this.offsetParent;
	
				while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
					offsetParent = offsetParent.offsetParent;
				}
	
				return offsetParent || documentElement;
			} );
		}
	} );
	
	// Create scrollLeft and scrollTop methods
	jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
		var top = "pageYOffset" === prop;
	
		jQuery.fn[ method ] = function( val ) {
			return access( this, function( elem, method, val ) {
				var win = getWindow( elem );
	
				if ( val === undefined ) {
					return win ? win[ prop ] : elem[ method ];
				}
	
				if ( win ) {
					win.scrollTo(
						!top ? val : win.pageXOffset,
						top ? val : win.pageYOffset
					);
	
				} else {
					elem[ method ] = val;
				}
			}, method, val, arguments.length );
		};
	} );
	
	// Support: Safari<7-8+, Chrome<37-44+
	// Add the top/left cssHooks using jQuery.fn.position
	// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
	// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
	// getComputedStyle returns percent when specified for top/left/bottom/right;
	// rather than make the css module depend on the offset module, just check for it here
	jQuery.each( [ "top", "left" ], function( i, prop ) {
		jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
			function( elem, computed ) {
				if ( computed ) {
					computed = curCSS( elem, prop );
	
					// If curCSS returns percentage, fallback to offset
					return rnumnonpx.test( computed ) ?
						jQuery( elem ).position()[ prop ] + "px" :
						computed;
				}
			}
		);
	} );
	
	
	// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
	jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
		jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
			function( defaultExtra, funcName ) {
	
			// Margin is only for outerHeight, outerWidth
			jQuery.fn[ funcName ] = function( margin, value ) {
				var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
					extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
	
				return access( this, function( elem, type, value ) {
					var doc;
	
					if ( jQuery.isWindow( elem ) ) {
	
						// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
						// isn't a whole lot we can do. See pull request at this URL for discussion:
						// https://github.com/jquery/jquery/pull/764
						return elem.document.documentElement[ "client" + name ];
					}
	
					// Get document width or height
					if ( elem.nodeType === 9 ) {
						doc = elem.documentElement;
	
						// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
						// whichever is greatest
						return Math.max(
							elem.body[ "scroll" + name ], doc[ "scroll" + name ],
							elem.body[ "offset" + name ], doc[ "offset" + name ],
							doc[ "client" + name ]
						);
					}
	
					return value === undefined ?
	
						// Get width or height on the element, requesting but not forcing parseFloat
						jQuery.css( elem, type, extra ) :
	
						// Set width or height on the element
						jQuery.style( elem, type, value, extra );
				}, type, chainable ? margin : undefined, chainable, null );
			};
		} );
	} );
	
	
	jQuery.fn.extend( {
	
		bind: function( types, data, fn ) {
			return this.on( types, null, data, fn );
		},
		unbind: function( types, fn ) {
			return this.off( types, null, fn );
		},
	
		delegate: function( selector, types, data, fn ) {
			return this.on( types, selector, data, fn );
		},
		undelegate: function( selector, types, fn ) {
	
			// ( namespace ) or ( selector, types [, fn] )
			return arguments.length === 1 ?
				this.off( selector, "**" ) :
				this.off( types, selector || "**", fn );
		},
		size: function() {
			return this.length;
		}
	} );
	
	jQuery.fn.andSelf = jQuery.fn.addBack;
	
	
	
	
	// Register as a named AMD module, since jQuery can be concatenated with other
	// files that may use define, but not via a proper concatenation script that
	// understands anonymous AMD modules. A named AMD is safest and most robust
	// way to register. Lowercase jquery is used because AMD module names are
	// derived from file names, and jQuery is normally delivered in a lowercase
	// file name. Do this after creating the global so that if an AMD module wants
	// to call noConflict to hide this version of jQuery, it will work.
	
	// Note that for maximum portability, libraries that are not jQuery should
	// declare themselves as anonymous modules, and avoid setting a global if an
	// AMD loader is present. jQuery is a special case. For more information, see
	// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
	
	if ( true ) {
		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
			return jQuery;
		}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	}
	
	
	
	var
	
		// Map over jQuery in case of overwrite
		_jQuery = window.jQuery,
	
		// Map over the $ in case of overwrite
		_$ = window.$;
	
	jQuery.noConflict = function( deep ) {
		if ( window.$ === jQuery ) {
			window.$ = _$;
		}
	
		if ( deep && window.jQuery === jQuery ) {
			window.jQuery = _jQuery;
		}
	
		return jQuery;
	};
	
	// Expose jQuery and $ identifiers, even in AMD
	// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
	// and CommonJS for browser emulators (#13566)
	if ( !noGlobal ) {
		window.jQuery = window.$ = jQuery;
	}
	
	return jQuery;
	}));


/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//     Underscore.js 1.8.3
	//     http://underscorejs.org
	//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
	//     Underscore may be freely distributed under the MIT license.
	
	(function() {
	
	  // Baseline setup
	  // --------------
	
	  // Establish the root object, `window` in the browser, or `exports` on the server.
	  var root = this;
	
	  // Save the previous value of the `_` variable.
	  var previousUnderscore = root._;
	
	  // Save bytes in the minified (but not gzipped) version:
	  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
	
	  // Create quick reference variables for speed access to core prototypes.
	  var
	    push             = ArrayProto.push,
	    slice            = ArrayProto.slice,
	    toString         = ObjProto.toString,
	    hasOwnProperty   = ObjProto.hasOwnProperty;
	
	  // All **ECMAScript 5** native function implementations that we hope to use
	  // are declared here.
	  var
	    nativeIsArray      = Array.isArray,
	    nativeKeys         = Object.keys,
	    nativeBind         = FuncProto.bind,
	    nativeCreate       = Object.create;
	
	  // Naked function reference for surrogate-prototype-swapping.
	  var Ctor = function(){};
	
	  // Create a safe reference to the Underscore object for use below.
	  var _ = function(obj) {
	    if (obj instanceof _) return obj;
	    if (!(this instanceof _)) return new _(obj);
	    this._wrapped = obj;
	  };
	
	  // Export the Underscore object for **Node.js**, with
	  // backwards-compatibility for the old `require()` API. If we're in
	  // the browser, add `_` as a global object.
	  if (true) {
	    if (typeof module !== 'undefined' && module.exports) {
	      exports = module.exports = _;
	    }
	    exports._ = _;
	  } else {
	    root._ = _;
	  }
	
	  // Current version.
	  _.VERSION = '1.8.3';
	
	  // Internal function that returns an efficient (for current engines) version
	  // of the passed-in callback, to be repeatedly applied in other Underscore
	  // functions.
	  var optimizeCb = function(func, context, argCount) {
	    if (context === void 0) return func;
	    switch (argCount == null ? 3 : argCount) {
	      case 1: return function(value) {
	        return func.call(context, value);
	      };
	      case 2: return function(value, other) {
	        return func.call(context, value, other);
	      };
	      case 3: return function(value, index, collection) {
	        return func.call(context, value, index, collection);
	      };
	      case 4: return function(accumulator, value, index, collection) {
	        return func.call(context, accumulator, value, index, collection);
	      };
	    }
	    return function() {
	      return func.apply(context, arguments);
	    };
	  };
	
	  // A mostly-internal function to generate callbacks that can be applied
	  // to each element in a collection, returning the desired result — either
	  // identity, an arbitrary callback, a property matcher, or a property accessor.
	  var cb = function(value, context, argCount) {
	    if (value == null) return _.identity;
	    if (_.isFunction(value)) return optimizeCb(value, context, argCount);
	    if (_.isObject(value)) return _.matcher(value);
	    return _.property(value);
	  };
	  _.iteratee = function(value, context) {
	    return cb(value, context, Infinity);
	  };
	
	  // An internal function for creating assigner functions.
	  var createAssigner = function(keysFunc, undefinedOnly) {
	    return function(obj) {
	      var length = arguments.length;
	      if (length < 2 || obj == null) return obj;
	      for (var index = 1; index < length; index++) {
	        var source = arguments[index],
	            keys = keysFunc(source),
	            l = keys.length;
	        for (var i = 0; i < l; i++) {
	          var key = keys[i];
	          if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
	        }
	      }
	      return obj;
	    };
	  };
	
	  // An internal function for creating a new object that inherits from another.
	  var baseCreate = function(prototype) {
	    if (!_.isObject(prototype)) return {};
	    if (nativeCreate) return nativeCreate(prototype);
	    Ctor.prototype = prototype;
	    var result = new Ctor;
	    Ctor.prototype = null;
	    return result;
	  };
	
	  var property = function(key) {
	    return function(obj) {
	      return obj == null ? void 0 : obj[key];
	    };
	  };
	
	  // Helper for collection methods to determine whether a collection
	  // should be iterated as an array or as an object
	  // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
	  // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
	  var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
	  var getLength = property('length');
	  var isArrayLike = function(collection) {
	    var length = getLength(collection);
	    return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
	  };
	
	  // Collection Functions
	  // --------------------
	
	  // The cornerstone, an `each` implementation, aka `forEach`.
	  // Handles raw objects in addition to array-likes. Treats all
	  // sparse array-likes as if they were dense.
	  _.each = _.forEach = function(obj, iteratee, context) {
	    iteratee = optimizeCb(iteratee, context);
	    var i, length;
	    if (isArrayLike(obj)) {
	      for (i = 0, length = obj.length; i < length; i++) {
	        iteratee(obj[i], i, obj);
	      }
	    } else {
	      var keys = _.keys(obj);
	      for (i = 0, length = keys.length; i < length; i++) {
	        iteratee(obj[keys[i]], keys[i], obj);
	      }
	    }
	    return obj;
	  };
	
	  // Return the results of applying the iteratee to each element.
	  _.map = _.collect = function(obj, iteratee, context) {
	    iteratee = cb(iteratee, context);
	    var keys = !isArrayLike(obj) && _.keys(obj),
	        length = (keys || obj).length,
	        results = Array(length);
	    for (var index = 0; index < length; index++) {
	      var currentKey = keys ? keys[index] : index;
	      results[index] = iteratee(obj[currentKey], currentKey, obj);
	    }
	    return results;
	  };
	
	  // Create a reducing function iterating left or right.
	  function createReduce(dir) {
	    // Optimized iterator function as using arguments.length
	    // in the main function will deoptimize the, see #1991.
	    function iterator(obj, iteratee, memo, keys, index, length) {
	      for (; index >= 0 && index < length; index += dir) {
	        var currentKey = keys ? keys[index] : index;
	        memo = iteratee(memo, obj[currentKey], currentKey, obj);
	      }
	      return memo;
	    }
	
	    return function(obj, iteratee, memo, context) {
	      iteratee = optimizeCb(iteratee, context, 4);
	      var keys = !isArrayLike(obj) && _.keys(obj),
	          length = (keys || obj).length,
	          index = dir > 0 ? 0 : length - 1;
	      // Determine the initial value if none is provided.
	      if (arguments.length < 3) {
	        memo = obj[keys ? keys[index] : index];
	        index += dir;
	      }
	      return iterator(obj, iteratee, memo, keys, index, length);
	    };
	  }
	
	  // **Reduce** builds up a single result from a list of values, aka `inject`,
	  // or `foldl`.
	  _.reduce = _.foldl = _.inject = createReduce(1);
	
	  // The right-associative version of reduce, also known as `foldr`.
	  _.reduceRight = _.foldr = createReduce(-1);
	
	  // Return the first value which passes a truth test. Aliased as `detect`.
	  _.find = _.detect = function(obj, predicate, context) {
	    var key;
	    if (isArrayLike(obj)) {
	      key = _.findIndex(obj, predicate, context);
	    } else {
	      key = _.findKey(obj, predicate, context);
	    }
	    if (key !== void 0 && key !== -1) return obj[key];
	  };
	
	  // Return all the elements that pass a truth test.
	  // Aliased as `select`.
	  _.filter = _.select = function(obj, predicate, context) {
	    var results = [];
	    predicate = cb(predicate, context);
	    _.each(obj, function(value, index, list) {
	      if (predicate(value, index, list)) results.push(value);
	    });
	    return results;
	  };
	
	  // Return all the elements for which a truth test fails.
	  _.reject = function(obj, predicate, context) {
	    return _.filter(obj, _.negate(cb(predicate)), context);
	  };
	
	  // Determine whether all of the elements match a truth test.
	  // Aliased as `all`.
	  _.every = _.all = function(obj, predicate, context) {
	    predicate = cb(predicate, context);
	    var keys = !isArrayLike(obj) && _.keys(obj),
	        length = (keys || obj).length;
	    for (var index = 0; index < length; index++) {
	      var currentKey = keys ? keys[index] : index;
	      if (!predicate(obj[currentKey], currentKey, obj)) return false;
	    }
	    return true;
	  };
	
	  // Determine if at least one element in the object matches a truth test.
	  // Aliased as `any`.
	  _.some = _.any = function(obj, predicate, context) {
	    predicate = cb(predicate, context);
	    var keys = !isArrayLike(obj) && _.keys(obj),
	        length = (keys || obj).length;
	    for (var index = 0; index < length; index++) {
	      var currentKey = keys ? keys[index] : index;
	      if (predicate(obj[currentKey], currentKey, obj)) return true;
	    }
	    return false;
	  };
	
	  // Determine if the array or object contains a given item (using `===`).
	  // Aliased as `includes` and `include`.
	  _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
	    if (!isArrayLike(obj)) obj = _.values(obj);
	    if (typeof fromIndex != 'number' || guard) fromIndex = 0;
	    return _.indexOf(obj, item, fromIndex) >= 0;
	  };
	
	  // Invoke a method (with arguments) on every item in a collection.
	  _.invoke = function(obj, method) {
	    var args = slice.call(arguments, 2);
	    var isFunc = _.isFunction(method);
	    return _.map(obj, function(value) {
	      var func = isFunc ? method : value[method];
	      return func == null ? func : func.apply(value, args);
	    });
	  };
	
	  // Convenience version of a common use case of `map`: fetching a property.
	  _.pluck = function(obj, key) {
	    return _.map(obj, _.property(key));
	  };
	
	  // Convenience version of a common use case of `filter`: selecting only objects
	  // containing specific `key:value` pairs.
	  _.where = function(obj, attrs) {
	    return _.filter(obj, _.matcher(attrs));
	  };
	
	  // Convenience version of a common use case of `find`: getting the first object
	  // containing specific `key:value` pairs.
	  _.findWhere = function(obj, attrs) {
	    return _.find(obj, _.matcher(attrs));
	  };
	
	  // Return the maximum element (or element-based computation).
	  _.max = function(obj, iteratee, context) {
	    var result = -Infinity, lastComputed = -Infinity,
	        value, computed;
	    if (iteratee == null && obj != null) {
	      obj = isArrayLike(obj) ? obj : _.values(obj);
	      for (var i = 0, length = obj.length; i < length; i++) {
	        value = obj[i];
	        if (value > result) {
	          result = value;
	        }
	      }
	    } else {
	      iteratee = cb(iteratee, context);
	      _.each(obj, function(value, index, list) {
	        computed = iteratee(value, index, list);
	        if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
	          result = value;
	          lastComputed = computed;
	        }
	      });
	    }
	    return result;
	  };
	
	  // Return the minimum element (or element-based computation).
	  _.min = function(obj, iteratee, context) {
	    var result = Infinity, lastComputed = Infinity,
	        value, computed;
	    if (iteratee == null && obj != null) {
	      obj = isArrayLike(obj) ? obj : _.values(obj);
	      for (var i = 0, length = obj.length; i < length; i++) {
	        value = obj[i];
	        if (value < result) {
	          result = value;
	        }
	      }
	    } else {
	      iteratee = cb(iteratee, context);
	      _.each(obj, function(value, index, list) {
	        computed = iteratee(value, index, list);
	        if (computed < lastComputed || computed === Infinity && result === Infinity) {
	          result = value;
	          lastComputed = computed;
	        }
	      });
	    }
	    return result;
	  };
	
	  // Shuffle a collection, using the modern version of the
	  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
	  _.shuffle = function(obj) {
	    var set = isArrayLike(obj) ? obj : _.values(obj);
	    var length = set.length;
	    var shuffled = Array(length);
	    for (var index = 0, rand; index < length; index++) {
	      rand = _.random(0, index);
	      if (rand !== index) shuffled[index] = shuffled[rand];
	      shuffled[rand] = set[index];
	    }
	    return shuffled;
	  };
	
	  // Sample **n** random values from a collection.
	  // If **n** is not specified, returns a single random element.
	  // The internal `guard` argument allows it to work with `map`.
	  _.sample = function(obj, n, guard) {
	    if (n == null || guard) {
	      if (!isArrayLike(obj)) obj = _.values(obj);
	      return obj[_.random(obj.length - 1)];
	    }
	    return _.shuffle(obj).slice(0, Math.max(0, n));
	  };
	
	  // Sort the object's values by a criterion produced by an iteratee.
	  _.sortBy = function(obj, iteratee, context) {
	    iteratee = cb(iteratee, context);
	    return _.pluck(_.map(obj, function(value, index, list) {
	      return {
	        value: value,
	        index: index,
	        criteria: iteratee(value, index, list)
	      };
	    }).sort(function(left, right) {
	      var a = left.criteria;
	      var b = right.criteria;
	      if (a !== b) {
	        if (a > b || a === void 0) return 1;
	        if (a < b || b === void 0) return -1;
	      }
	      return left.index - right.index;
	    }), 'value');
	  };
	
	  // An internal function used for aggregate "group by" operations.
	  var group = function(behavior) {
	    return function(obj, iteratee, context) {
	      var result = {};
	      iteratee = cb(iteratee, context);
	      _.each(obj, function(value, index) {
	        var key = iteratee(value, index, obj);
	        behavior(result, value, key);
	      });
	      return result;
	    };
	  };
	
	  // Groups the object's values by a criterion. Pass either a string attribute
	  // to group by, or a function that returns the criterion.
	  _.groupBy = group(function(result, value, key) {
	    if (_.has(result, key)) result[key].push(value); else result[key] = [value];
	  });
	
	  // Indexes the object's values by a criterion, similar to `groupBy`, but for
	  // when you know that your index values will be unique.
	  _.indexBy = group(function(result, value, key) {
	    result[key] = value;
	  });
	
	  // Counts instances of an object that group by a certain criterion. Pass
	  // either a string attribute to count by, or a function that returns the
	  // criterion.
	  _.countBy = group(function(result, value, key) {
	    if (_.has(result, key)) result[key]++; else result[key] = 1;
	  });
	
	  // Safely create a real, live array from anything iterable.
	  _.toArray = function(obj) {
	    if (!obj) return [];
	    if (_.isArray(obj)) return slice.call(obj);
	    if (isArrayLike(obj)) return _.map(obj, _.identity);
	    return _.values(obj);
	  };
	
	  // Return the number of elements in an object.
	  _.size = function(obj) {
	    if (obj == null) return 0;
	    return isArrayLike(obj) ? obj.length : _.keys(obj).length;
	  };
	
	  // Split a collection into two arrays: one whose elements all satisfy the given
	  // predicate, and one whose elements all do not satisfy the predicate.
	  _.partition = function(obj, predicate, context) {
	    predicate = cb(predicate, context);
	    var pass = [], fail = [];
	    _.each(obj, function(value, key, obj) {
	      (predicate(value, key, obj) ? pass : fail).push(value);
	    });
	    return [pass, fail];
	  };
	
	  // Array Functions
	  // ---------------
	
	  // Get the first element of an array. Passing **n** will return the first N
	  // values in the array. Aliased as `head` and `take`. The **guard** check
	  // allows it to work with `_.map`.
	  _.first = _.head = _.take = function(array, n, guard) {
	    if (array == null) return void 0;
	    if (n == null || guard) return array[0];
	    return _.initial(array, array.length - n);
	  };
	
	  // Returns everything but the last entry of the array. Especially useful on
	  // the arguments object. Passing **n** will return all the values in
	  // the array, excluding the last N.
	  _.initial = function(array, n, guard) {
	    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
	  };
	
	  // Get the last element of an array. Passing **n** will return the last N
	  // values in the array.
	  _.last = function(array, n, guard) {
	    if (array == null) return void 0;
	    if (n == null || guard) return array[array.length - 1];
	    return _.rest(array, Math.max(0, array.length - n));
	  };
	
	  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
	  // Especially useful on the arguments object. Passing an **n** will return
	  // the rest N values in the array.
	  _.rest = _.tail = _.drop = function(array, n, guard) {
	    return slice.call(array, n == null || guard ? 1 : n);
	  };
	
	  // Trim out all falsy values from an array.
	  _.compact = function(array) {
	    return _.filter(array, _.identity);
	  };
	
	  // Internal implementation of a recursive `flatten` function.
	  var flatten = function(input, shallow, strict, startIndex) {
	    var output = [], idx = 0;
	    for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
	      var value = input[i];
	      if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
	        //flatten current level of array or arguments object
	        if (!shallow) value = flatten(value, shallow, strict);
	        var j = 0, len = value.length;
	        output.length += len;
	        while (j < len) {
	          output[idx++] = value[j++];
	        }
	      } else if (!strict) {
	        output[idx++] = value;
	      }
	    }
	    return output;
	  };
	
	  // Flatten out an array, either recursively (by default), or just one level.
	  _.flatten = function(array, shallow) {
	    return flatten(array, shallow, false);
	  };
	
	  // Return a version of the array that does not contain the specified value(s).
	  _.without = function(array) {
	    return _.difference(array, slice.call(arguments, 1));
	  };
	
	  // Produce a duplicate-free version of the array. If the array has already
	  // been sorted, you have the option of using a faster algorithm.
	  // Aliased as `unique`.
	  _.uniq = _.unique = function(array, isSorted, iteratee, context) {
	    if (!_.isBoolean(isSorted)) {
	      context = iteratee;
	      iteratee = isSorted;
	      isSorted = false;
	    }
	    if (iteratee != null) iteratee = cb(iteratee, context);
	    var result = [];
	    var seen = [];
	    for (var i = 0, length = getLength(array); i < length; i++) {
	      var value = array[i],
	          computed = iteratee ? iteratee(value, i, array) : value;
	      if (isSorted) {
	        if (!i || seen !== computed) result.push(value);
	        seen = computed;
	      } else if (iteratee) {
	        if (!_.contains(seen, computed)) {
	          seen.push(computed);
	          result.push(value);
	        }
	      } else if (!_.contains(result, value)) {
	        result.push(value);
	      }
	    }
	    return result;
	  };
	
	  // Produce an array that contains the union: each distinct element from all of
	  // the passed-in arrays.
	  _.union = function() {
	    return _.uniq(flatten(arguments, true, true));
	  };
	
	  // Produce an array that contains every item shared between all the
	  // passed-in arrays.
	  _.intersection = function(array) {
	    var result = [];
	    var argsLength = arguments.length;
	    for (var i = 0, length = getLength(array); i < length; i++) {
	      var item = array[i];
	      if (_.contains(result, item)) continue;
	      for (var j = 1; j < argsLength; j++) {
	        if (!_.contains(arguments[j], item)) break;
	      }
	      if (j === argsLength) result.push(item);
	    }
	    return result;
	  };
	
	  // Take the difference between one array and a number of other arrays.
	  // Only the elements present in just the first array will remain.
	  _.difference = function(array) {
	    var rest = flatten(arguments, true, true, 1);
	    return _.filter(array, function(value){
	      return !_.contains(rest, value);
	    });
	  };
	
	  // Zip together multiple lists into a single array -- elements that share
	  // an index go together.
	  _.zip = function() {
	    return _.unzip(arguments);
	  };
	
	  // Complement of _.zip. Unzip accepts an array of arrays and groups
	  // each array's elements on shared indices
	  _.unzip = function(array) {
	    var length = array && _.max(array, getLength).length || 0;
	    var result = Array(length);
	
	    for (var index = 0; index < length; index++) {
	      result[index] = _.pluck(array, index);
	    }
	    return result;
	  };
	
	  // Converts lists into objects. Pass either a single array of `[key, value]`
	  // pairs, or two parallel arrays of the same length -- one of keys, and one of
	  // the corresponding values.
	  _.object = function(list, values) {
	    var result = {};
	    for (var i = 0, length = getLength(list); i < length; i++) {
	      if (values) {
	        result[list[i]] = values[i];
	      } else {
	        result[list[i][0]] = list[i][1];
	      }
	    }
	    return result;
	  };
	
	  // Generator function to create the findIndex and findLastIndex functions
	  function createPredicateIndexFinder(dir) {
	    return function(array, predicate, context) {
	      predicate = cb(predicate, context);
	      var length = getLength(array);
	      var index = dir > 0 ? 0 : length - 1;
	      for (; index >= 0 && index < length; index += dir) {
	        if (predicate(array[index], index, array)) return index;
	      }
	      return -1;
	    };
	  }
	
	  // Returns the first index on an array-like that passes a predicate test
	  _.findIndex = createPredicateIndexFinder(1);
	  _.findLastIndex = createPredicateIndexFinder(-1);
	
	  // Use a comparator function to figure out the smallest index at which
	  // an object should be inserted so as to maintain order. Uses binary search.
	  _.sortedIndex = function(array, obj, iteratee, context) {
	    iteratee = cb(iteratee, context, 1);
	    var value = iteratee(obj);
	    var low = 0, high = getLength(array);
	    while (low < high) {
	      var mid = Math.floor((low + high) / 2);
	      if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
	    }
	    return low;
	  };
	
	  // Generator function to create the indexOf and lastIndexOf functions
	  function createIndexFinder(dir, predicateFind, sortedIndex) {
	    return function(array, item, idx) {
	      var i = 0, length = getLength(array);
	      if (typeof idx == 'number') {
	        if (dir > 0) {
	            i = idx >= 0 ? idx : Math.max(idx + length, i);
	        } else {
	            length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
	        }
	      } else if (sortedIndex && idx && length) {
	        idx = sortedIndex(array, item);
	        return array[idx] === item ? idx : -1;
	      }
	      if (item !== item) {
	        idx = predicateFind(slice.call(array, i, length), _.isNaN);
	        return idx >= 0 ? idx + i : -1;
	      }
	      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
	        if (array[idx] === item) return idx;
	      }
	      return -1;
	    };
	  }
	
	  // Return the position of the first occurrence of an item in an array,
	  // or -1 if the item is not included in the array.
	  // If the array is large and already in sort order, pass `true`
	  // for **isSorted** to use binary search.
	  _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
	  _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
	
	  // Generate an integer Array containing an arithmetic progression. A port of
	  // the native Python `range()` function. See
	  // [the Python documentation](http://docs.python.org/library/functions.html#range).
	  _.range = function(start, stop, step) {
	    if (stop == null) {
	      stop = start || 0;
	      start = 0;
	    }
	    step = step || 1;
	
	    var length = Math.max(Math.ceil((stop - start) / step), 0);
	    var range = Array(length);
	
	    for (var idx = 0; idx < length; idx++, start += step) {
	      range[idx] = start;
	    }
	
	    return range;
	  };
	
	  // Function (ahem) Functions
	  // ------------------
	
	  // Determines whether to execute a function as a constructor
	  // or a normal function with the provided arguments
	  var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
	    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
	    var self = baseCreate(sourceFunc.prototype);
	    var result = sourceFunc.apply(self, args);
	    if (_.isObject(result)) return result;
	    return self;
	  };
	
	  // Create a function bound to a given object (assigning `this`, and arguments,
	  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
	  // available.
	  _.bind = function(func, context) {
	    if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
	    if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
	    var args = slice.call(arguments, 2);
	    var bound = function() {
	      return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
	    };
	    return bound;
	  };
	
	  // Partially apply a function by creating a version that has had some of its
	  // arguments pre-filled, without changing its dynamic `this` context. _ acts
	  // as a placeholder, allowing any combination of arguments to be pre-filled.
	  _.partial = function(func) {
	    var boundArgs = slice.call(arguments, 1);
	    var bound = function() {
	      var position = 0, length = boundArgs.length;
	      var args = Array(length);
	      for (var i = 0; i < length; i++) {
	        args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
	      }
	      while (position < arguments.length) args.push(arguments[position++]);
	      return executeBound(func, bound, this, this, args);
	    };
	    return bound;
	  };
	
	  // Bind a number of an object's methods to that object. Remaining arguments
	  // are the method names to be bound. Useful for ensuring that all callbacks
	  // defined on an object belong to it.
	  _.bindAll = function(obj) {
	    var i, length = arguments.length, key;
	    if (length <= 1) throw new Error('bindAll must be passed function names');
	    for (i = 1; i < length; i++) {
	      key = arguments[i];
	      obj[key] = _.bind(obj[key], obj);
	    }
	    return obj;
	  };
	
	  // Memoize an expensive function by storing its results.
	  _.memoize = function(func, hasher) {
	    var memoize = function(key) {
	      var cache = memoize.cache;
	      var address = '' + (hasher ? hasher.apply(this, arguments) : key);
	      if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
	      return cache[address];
	    };
	    memoize.cache = {};
	    return memoize;
	  };
	
	  // Delays a function for the given number of milliseconds, and then calls
	  // it with the arguments supplied.
	  _.delay = function(func, wait) {
	    var args = slice.call(arguments, 2);
	    return setTimeout(function(){
	      return func.apply(null, args);
	    }, wait);
	  };
	
	  // Defers a function, scheduling it to run after the current call stack has
	  // cleared.
	  _.defer = _.partial(_.delay, _, 1);
	
	  // Returns a function, that, when invoked, will only be triggered at most once
	  // during a given window of time. Normally, the throttled function will run
	  // as much as it can, without ever going more than once per `wait` duration;
	  // but if you'd like to disable the execution on the leading edge, pass
	  // `{leading: false}`. To disable execution on the trailing edge, ditto.
	  _.throttle = function(func, wait, options) {
	    var context, args, result;
	    var timeout = null;
	    var previous = 0;
	    if (!options) options = {};
	    var later = function() {
	      previous = options.leading === false ? 0 : _.now();
	      timeout = null;
	      result = func.apply(context, args);
	      if (!timeout) context = args = null;
	    };
	    return function() {
	      var now = _.now();
	      if (!previous && options.leading === false) previous = now;
	      var remaining = wait - (now - previous);
	      context = this;
	      args = arguments;
	      if (remaining <= 0 || remaining > wait) {
	        if (timeout) {
	          clearTimeout(timeout);
	          timeout = null;
	        }
	        previous = now;
	        result = func.apply(context, args);
	        if (!timeout) context = args = null;
	      } else if (!timeout && options.trailing !== false) {
	        timeout = setTimeout(later, remaining);
	      }
	      return result;
	    };
	  };
	
	  // Returns a function, that, as long as it continues to be invoked, will not
	  // be triggered. The function will be called after it stops being called for
	  // N milliseconds. If `immediate` is passed, trigger the function on the
	  // leading edge, instead of the trailing.
	  _.debounce = function(func, wait, immediate) {
	    var timeout, args, context, timestamp, result;
	
	    var later = function() {
	      var last = _.now() - timestamp;
	
	      if (last < wait && last >= 0) {
	        timeout = setTimeout(later, wait - last);
	      } else {
	        timeout = null;
	        if (!immediate) {
	          result = func.apply(context, args);
	          if (!timeout) context = args = null;
	        }
	      }
	    };
	
	    return function() {
	      context = this;
	      args = arguments;
	      timestamp = _.now();
	      var callNow = immediate && !timeout;
	      if (!timeout) timeout = setTimeout(later, wait);
	      if (callNow) {
	        result = func.apply(context, args);
	        context = args = null;
	      }
	
	      return result;
	    };
	  };
	
	  // Returns the first function passed as an argument to the second,
	  // allowing you to adjust arguments, run code before and after, and
	  // conditionally execute the original function.
	  _.wrap = function(func, wrapper) {
	    return _.partial(wrapper, func);
	  };
	
	  // Returns a negated version of the passed-in predicate.
	  _.negate = function(predicate) {
	    return function() {
	      return !predicate.apply(this, arguments);
	    };
	  };
	
	  // Returns a function that is the composition of a list of functions, each
	  // consuming the return value of the function that follows.
	  _.compose = function() {
	    var args = arguments;
	    var start = args.length - 1;
	    return function() {
	      var i = start;
	      var result = args[start].apply(this, arguments);
	      while (i--) result = args[i].call(this, result);
	      return result;
	    };
	  };
	
	  // Returns a function that will only be executed on and after the Nth call.
	  _.after = function(times, func) {
	    return function() {
	      if (--times < 1) {
	        return func.apply(this, arguments);
	      }
	    };
	  };
	
	  // Returns a function that will only be executed up to (but not including) the Nth call.
	  _.before = function(times, func) {
	    var memo;
	    return function() {
	      if (--times > 0) {
	        memo = func.apply(this, arguments);
	      }
	      if (times <= 1) func = null;
	      return memo;
	    };
	  };
	
	  // Returns a function that will be executed at most one time, no matter how
	  // often you call it. Useful for lazy initialization.
	  _.once = _.partial(_.before, 2);
	
	  // Object Functions
	  // ----------------
	
	  // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
	  var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
	  var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
	                      'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
	
	  function collectNonEnumProps(obj, keys) {
	    var nonEnumIdx = nonEnumerableProps.length;
	    var constructor = obj.constructor;
	    var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
	
	    // Constructor is a special case.
	    var prop = 'constructor';
	    if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
	
	    while (nonEnumIdx--) {
	      prop = nonEnumerableProps[nonEnumIdx];
	      if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
	        keys.push(prop);
	      }
	    }
	  }
	
	  // Retrieve the names of an object's own properties.
	  // Delegates to **ECMAScript 5**'s native `Object.keys`
	  _.keys = function(obj) {
	    if (!_.isObject(obj)) return [];
	    if (nativeKeys) return nativeKeys(obj);
	    var keys = [];
	    for (var key in obj) if (_.has(obj, key)) keys.push(key);
	    // Ahem, IE < 9.
	    if (hasEnumBug) collectNonEnumProps(obj, keys);
	    return keys;
	  };
	
	  // Retrieve all the property names of an object.
	  _.allKeys = function(obj) {
	    if (!_.isObject(obj)) return [];
	    var keys = [];
	    for (var key in obj) keys.push(key);
	    // Ahem, IE < 9.
	    if (hasEnumBug) collectNonEnumProps(obj, keys);
	    return keys;
	  };
	
	  // Retrieve the values of an object's properties.
	  _.values = function(obj) {
	    var keys = _.keys(obj);
	    var length = keys.length;
	    var values = Array(length);
	    for (var i = 0; i < length; i++) {
	      values[i] = obj[keys[i]];
	    }
	    return values;
	  };
	
	  // Returns the results of applying the iteratee to each element of the object
	  // In contrast to _.map it returns an object
	  _.mapObject = function(obj, iteratee, context) {
	    iteratee = cb(iteratee, context);
	    var keys =  _.keys(obj),
	          length = keys.length,
	          results = {},
	          currentKey;
	      for (var index = 0; index < length; index++) {
	        currentKey = keys[index];
	        results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
	      }
	      return results;
	  };
	
	  // Convert an object into a list of `[key, value]` pairs.
	  _.pairs = function(obj) {
	    var keys = _.keys(obj);
	    var length = keys.length;
	    var pairs = Array(length);
	    for (var i = 0; i < length; i++) {
	      pairs[i] = [keys[i], obj[keys[i]]];
	    }
	    return pairs;
	  };
	
	  // Invert the keys and values of an object. The values must be serializable.
	  _.invert = function(obj) {
	    var result = {};
	    var keys = _.keys(obj);
	    for (var i = 0, length = keys.length; i < length; i++) {
	      result[obj[keys[i]]] = keys[i];
	    }
	    return result;
	  };
	
	  // Return a sorted list of the function names available on the object.
	  // Aliased as `methods`
	  _.functions = _.methods = function(obj) {
	    var names = [];
	    for (var key in obj) {
	      if (_.isFunction(obj[key])) names.push(key);
	    }
	    return names.sort();
	  };
	
	  // Extend a given object with all the properties in passed-in object(s).
	  _.extend = createAssigner(_.allKeys);
	
	  // Assigns a given object with all the own properties in the passed-in object(s)
	  // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
	  _.extendOwn = _.assign = createAssigner(_.keys);
	
	  // Returns the first key on an object that passes a predicate test
	  _.findKey = function(obj, predicate, context) {
	    predicate = cb(predicate, context);
	    var keys = _.keys(obj), key;
	    for (var i = 0, length = keys.length; i < length; i++) {
	      key = keys[i];
	      if (predicate(obj[key], key, obj)) return key;
	    }
	  };
	
	  // Return a copy of the object only containing the whitelisted properties.
	  _.pick = function(object, oiteratee, context) {
	    var result = {}, obj = object, iteratee, keys;
	    if (obj == null) return result;
	    if (_.isFunction(oiteratee)) {
	      keys = _.allKeys(obj);
	      iteratee = optimizeCb(oiteratee, context);
	    } else {
	      keys = flatten(arguments, false, false, 1);
	      iteratee = function(value, key, obj) { return key in obj; };
	      obj = Object(obj);
	    }
	    for (var i = 0, length = keys.length; i < length; i++) {
	      var key = keys[i];
	      var value = obj[key];
	      if (iteratee(value, key, obj)) result[key] = value;
	    }
	    return result;
	  };
	
	   // Return a copy of the object without the blacklisted properties.
	  _.omit = function(obj, iteratee, context) {
	    if (_.isFunction(iteratee)) {
	      iteratee = _.negate(iteratee);
	    } else {
	      var keys = _.map(flatten(arguments, false, false, 1), String);
	      iteratee = function(value, key) {
	        return !_.contains(keys, key);
	      };
	    }
	    return _.pick(obj, iteratee, context);
	  };
	
	  // Fill in a given object with default properties.
	  _.defaults = createAssigner(_.allKeys, true);
	
	  // Creates an object that inherits from the given prototype object.
	  // If additional properties are provided then they will be added to the
	  // created object.
	  _.create = function(prototype, props) {
	    var result = baseCreate(prototype);
	    if (props) _.extendOwn(result, props);
	    return result;
	  };
	
	  // Create a (shallow-cloned) duplicate of an object.
	  _.clone = function(obj) {
	    if (!_.isObject(obj)) return obj;
	    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
	  };
	
	  // Invokes interceptor with the obj, and then returns obj.
	  // The primary purpose of this method is to "tap into" a method chain, in
	  // order to perform operations on intermediate results within the chain.
	  _.tap = function(obj, interceptor) {
	    interceptor(obj);
	    return obj;
	  };
	
	  // Returns whether an object has a given set of `key:value` pairs.
	  _.isMatch = function(object, attrs) {
	    var keys = _.keys(attrs), length = keys.length;
	    if (object == null) return !length;
	    var obj = Object(object);
	    for (var i = 0; i < length; i++) {
	      var key = keys[i];
	      if (attrs[key] !== obj[key] || !(key in obj)) return false;
	    }
	    return true;
	  };
	
	
	  // Internal recursive comparison function for `isEqual`.
	  var eq = function(a, b, aStack, bStack) {
	    // Identical objects are equal. `0 === -0`, but they aren't identical.
	    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
	    if (a === b) return a !== 0 || 1 / a === 1 / b;
	    // A strict comparison is necessary because `null == undefined`.
	    if (a == null || b == null) return a === b;
	    // Unwrap any wrapped objects.
	    if (a instanceof _) a = a._wrapped;
	    if (b instanceof _) b = b._wrapped;
	    // Compare `[[Class]]` names.
	    var className = toString.call(a);
	    if (className !== toString.call(b)) return false;
	    switch (className) {
	      // Strings, numbers, regular expressions, dates, and booleans are compared by value.
	      case '[object RegExp]':
	      // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
	      case '[object String]':
	        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
	        // equivalent to `new String("5")`.
	        return '' + a === '' + b;
	      case '[object Number]':
	        // `NaN`s are equivalent, but non-reflexive.
	        // Object(NaN) is equivalent to NaN
	        if (+a !== +a) return +b !== +b;
	        // An `egal` comparison is performed for other numeric values.
	        return +a === 0 ? 1 / +a === 1 / b : +a === +b;
	      case '[object Date]':
	      case '[object Boolean]':
	        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
	        // millisecond representations. Note that invalid dates with millisecond representations
	        // of `NaN` are not equivalent.
	        return +a === +b;
	    }
	
	    var areArrays = className === '[object Array]';
	    if (!areArrays) {
	      if (typeof a != 'object' || typeof b != 'object') return false;
	
	      // Objects with different constructors are not equivalent, but `Object`s or `Array`s
	      // from different frames are.
	      var aCtor = a.constructor, bCtor = b.constructor;
	      if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
	                               _.isFunction(bCtor) && bCtor instanceof bCtor)
	                          && ('constructor' in a && 'constructor' in b)) {
	        return false;
	      }
	    }
	    // Assume equality for cyclic structures. The algorithm for detecting cyclic
	    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
	
	    // Initializing stack of traversed objects.
	    // It's done here since we only need them for objects and arrays comparison.
	    aStack = aStack || [];
	    bStack = bStack || [];
	    var length = aStack.length;
	    while (length--) {
	      // Linear search. Performance is inversely proportional to the number of
	      // unique nested structures.
	      if (aStack[length] === a) return bStack[length] === b;
	    }
	
	    // Add the first object to the stack of traversed objects.
	    aStack.push(a);
	    bStack.push(b);
	
	    // Recursively compare objects and arrays.
	    if (areArrays) {
	      // Compare array lengths to determine if a deep comparison is necessary.
	      length = a.length;
	      if (length !== b.length) return false;
	      // Deep compare the contents, ignoring non-numeric properties.
	      while (length--) {
	        if (!eq(a[length], b[length], aStack, bStack)) return false;
	      }
	    } else {
	      // Deep compare objects.
	      var keys = _.keys(a), key;
	      length = keys.length;
	      // Ensure that both objects contain the same number of properties before comparing deep equality.
	      if (_.keys(b).length !== length) return false;
	      while (length--) {
	        // Deep compare each member
	        key = keys[length];
	        if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
	      }
	    }
	    // Remove the first object from the stack of traversed objects.
	    aStack.pop();
	    bStack.pop();
	    return true;
	  };
	
	  // Perform a deep comparison to check if two objects are equal.
	  _.isEqual = function(a, b) {
	    return eq(a, b);
	  };
	
	  // Is a given array, string, or object empty?
	  // An "empty" object has no enumerable own-properties.
	  _.isEmpty = function(obj) {
	    if (obj == null) return true;
	    if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
	    return _.keys(obj).length === 0;
	  };
	
	  // Is a given value a DOM element?
	  _.isElement = function(obj) {
	    return !!(obj && obj.nodeType === 1);
	  };
	
	  // Is a given value an array?
	  // Delegates to ECMA5's native Array.isArray
	  _.isArray = nativeIsArray || function(obj) {
	    return toString.call(obj) === '[object Array]';
	  };
	
	  // Is a given variable an object?
	  _.isObject = function(obj) {
	    var type = typeof obj;
	    return type === 'function' || type === 'object' && !!obj;
	  };
	
	  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
	  _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
	    _['is' + name] = function(obj) {
	      return toString.call(obj) === '[object ' + name + ']';
	    };
	  });
	
	  // Define a fallback version of the method in browsers (ahem, IE < 9), where
	  // there isn't any inspectable "Arguments" type.
	  if (!_.isArguments(arguments)) {
	    _.isArguments = function(obj) {
	      return _.has(obj, 'callee');
	    };
	  }
	
	  // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
	  // IE 11 (#1621), and in Safari 8 (#1929).
	  if (typeof /./ != 'function' && typeof Int8Array != 'object') {
	    _.isFunction = function(obj) {
	      return typeof obj == 'function' || false;
	    };
	  }
	
	  // Is a given object a finite number?
	  _.isFinite = function(obj) {
	    return isFinite(obj) && !isNaN(parseFloat(obj));
	  };
	
	  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
	  _.isNaN = function(obj) {
	    return _.isNumber(obj) && obj !== +obj;
	  };
	
	  // Is a given value a boolean?
	  _.isBoolean = function(obj) {
	    return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
	  };
	
	  // Is a given value equal to null?
	  _.isNull = function(obj) {
	    return obj === null;
	  };
	
	  // Is a given variable undefined?
	  _.isUndefined = function(obj) {
	    return obj === void 0;
	  };
	
	  // Shortcut function for checking if an object has a given property directly
	  // on itself (in other words, not on a prototype).
	  _.has = function(obj, key) {
	    return obj != null && hasOwnProperty.call(obj, key);
	  };
	
	  // Utility Functions
	  // -----------------
	
	  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
	  // previous owner. Returns a reference to the Underscore object.
	  _.noConflict = function() {
	    root._ = previousUnderscore;
	    return this;
	  };
	
	  // Keep the identity function around for default iteratees.
	  _.identity = function(value) {
	    return value;
	  };
	
	  // Predicate-generating functions. Often useful outside of Underscore.
	  _.constant = function(value) {
	    return function() {
	      return value;
	    };
	  };
	
	  _.noop = function(){};
	
	  _.property = property;
	
	  // Generates a function for a given object that returns a given property.
	  _.propertyOf = function(obj) {
	    return obj == null ? function(){} : function(key) {
	      return obj[key];
	    };
	  };
	
	  // Returns a predicate for checking whether an object has a given set of
	  // `key:value` pairs.
	  _.matcher = _.matches = function(attrs) {
	    attrs = _.extendOwn({}, attrs);
	    return function(obj) {
	      return _.isMatch(obj, attrs);
	    };
	  };
	
	  // Run a function **n** times.
	  _.times = function(n, iteratee, context) {
	    var accum = Array(Math.max(0, n));
	    iteratee = optimizeCb(iteratee, context, 1);
	    for (var i = 0; i < n; i++) accum[i] = iteratee(i);
	    return accum;
	  };
	
	  // Return a random integer between min and max (inclusive).
	  _.random = function(min, max) {
	    if (max == null) {
	      max = min;
	      min = 0;
	    }
	    return min + Math.floor(Math.random() * (max - min + 1));
	  };
	
	  // A (possibly faster) way to get the current timestamp as an integer.
	  _.now = Date.now || function() {
	    return new Date().getTime();
	  };
	
	   // List of HTML entities for escaping.
	  var escapeMap = {
	    '&': '&amp;',
	    '<': '&lt;',
	    '>': '&gt;',
	    '"': '&quot;',
	    "'": '&#x27;',
	    '`': '&#x60;'
	  };
	  var unescapeMap = _.invert(escapeMap);
	
	  // Functions for escaping and unescaping strings to/from HTML interpolation.
	  var createEscaper = function(map) {
	    var escaper = function(match) {
	      return map[match];
	    };
	    // Regexes for identifying a key that needs to be escaped
	    var source = '(?:' + _.keys(map).join('|') + ')';
	    var testRegexp = RegExp(source);
	    var replaceRegexp = RegExp(source, 'g');
	    return function(string) {
	      string = string == null ? '' : '' + string;
	      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
	    };
	  };
	  _.escape = createEscaper(escapeMap);
	  _.unescape = createEscaper(unescapeMap);
	
	  // If the value of the named `property` is a function then invoke it with the
	  // `object` as context; otherwise, return it.
	  _.result = function(object, property, fallback) {
	    var value = object == null ? void 0 : object[property];
	    if (value === void 0) {
	      value = fallback;
	    }
	    return _.isFunction(value) ? value.call(object) : value;
	  };
	
	  // Generate a unique integer id (unique within the entire client session).
	  // Useful for temporary DOM ids.
	  var idCounter = 0;
	  _.uniqueId = function(prefix) {
	    var id = ++idCounter + '';
	    return prefix ? prefix + id : id;
	  };
	
	  // By default, Underscore uses ERB-style template delimiters, change the
	  // following template settings to use alternative delimiters.
	  _.templateSettings = {
	    evaluate    : /<%([\s\S]+?)%>/g,
	    interpolate : /<%=([\s\S]+?)%>/g,
	    escape      : /<%-([\s\S]+?)%>/g
	  };
	
	  // When customizing `templateSettings`, if you don't want to define an
	  // interpolation, evaluation or escaping regex, we need one that is
	  // guaranteed not to match.
	  var noMatch = /(.)^/;
	
	  // Certain characters need to be escaped so that they can be put into a
	  // string literal.
	  var escapes = {
	    "'":      "'",
	    '\\':     '\\',
	    '\r':     'r',
	    '\n':     'n',
	    '\u2028': 'u2028',
	    '\u2029': 'u2029'
	  };
	
	  var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
	
	  var escapeChar = function(match) {
	    return '\\' + escapes[match];
	  };
	
	  // JavaScript micro-templating, similar to John Resig's implementation.
	  // Underscore templating handles arbitrary delimiters, preserves whitespace,
	  // and correctly escapes quotes within interpolated code.
	  // NB: `oldSettings` only exists for backwards compatibility.
	  _.template = function(text, settings, oldSettings) {
	    if (!settings && oldSettings) settings = oldSettings;
	    settings = _.defaults({}, settings, _.templateSettings);
	
	    // Combine delimiters into one regular expression via alternation.
	    var matcher = RegExp([
	      (settings.escape || noMatch).source,
	      (settings.interpolate || noMatch).source,
	      (settings.evaluate || noMatch).source
	    ].join('|') + '|$', 'g');
	
	    // Compile the template source, escaping string literals appropriately.
	    var index = 0;
	    var source = "__p+='";
	    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
	      source += text.slice(index, offset).replace(escaper, escapeChar);
	      index = offset + match.length;
	
	      if (escape) {
	        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
	      } else if (interpolate) {
	        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
	      } else if (evaluate) {
	        source += "';\n" + evaluate + "\n__p+='";
	      }
	
	      // Adobe VMs need the match returned to produce the correct offest.
	      return match;
	    });
	    source += "';\n";
	
	    // If a variable is not specified, place data values in local scope.
	    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
	
	    source = "var __t,__p='',__j=Array.prototype.join," +
	      "print=function(){__p+=__j.call(arguments,'');};\n" +
	      source + 'return __p;\n';
	
	    try {
	      var render = new Function(settings.variable || 'obj', '_', source);
	    } catch (e) {
	      e.source = source;
	      throw e;
	    }
	
	    var template = function(data) {
	      return render.call(this, data, _);
	    };
	
	    // Provide the compiled source as a convenience for precompilation.
	    var argument = settings.variable || 'obj';
	    template.source = 'function(' + argument + '){\n' + source + '}';
	
	    return template;
	  };
	
	  // Add a "chain" function. Start chaining a wrapped Underscore object.
	  _.chain = function(obj) {
	    var instance = _(obj);
	    instance._chain = true;
	    return instance;
	  };
	
	  // OOP
	  // ---------------
	  // If Underscore is called as a function, it returns a wrapped object that
	  // can be used OO-style. This wrapper holds altered versions of all the
	  // underscore functions. Wrapped objects may be chained.
	
	  // Helper function to continue chaining intermediate results.
	  var result = function(instance, obj) {
	    return instance._chain ? _(obj).chain() : obj;
	  };
	
	  // Add your own custom functions to the Underscore object.
	  _.mixin = function(obj) {
	    _.each(_.functions(obj), function(name) {
	      var func = _[name] = obj[name];
	      _.prototype[name] = function() {
	        var args = [this._wrapped];
	        push.apply(args, arguments);
	        return result(this, func.apply(_, args));
	      };
	    });
	  };
	
	  // Add all of the Underscore functions to the wrapper object.
	  _.mixin(_);
	
	  // Add all mutator Array functions to the wrapper.
	  _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
	    var method = ArrayProto[name];
	    _.prototype[name] = function() {
	      var obj = this._wrapped;
	      method.apply(obj, arguments);
	      if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
	      return result(this, obj);
	    };
	  });
	
	  // Add all accessor Array functions to the wrapper.
	  _.each(['concat', 'join', 'slice'], function(name) {
	    var method = ArrayProto[name];
	    _.prototype[name] = function() {
	      return result(this, method.apply(this._wrapped, arguments));
	    };
	  });
	
	  // Extracts the result from a wrapped and chained object.
	  _.prototype.value = function() {
	    return this._wrapped;
	  };
	
	  // Provide unwrapping proxy for some methods used in engine operations
	  // such as arithmetic and JSON stringification.
	  _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
	
	  _.prototype.toString = function() {
	    return '' + this._wrapped;
	  };
	
	  // AMD registration happens at the end for compatibility with AMD loaders
	  // that may not enforce next-turn semantics on modules. Even though general
	  // practice for AMD registration is to be anonymous, underscore registers
	  // as a named module because, like jQuery, it is a base library that is
	  // popular enough to be bundled in a third party lib, but not be part of
	  // an AMD load request. Those cases could generate an error when an
	  // anonymous define() is called outside of a loader request.
	  if (true) {
	    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
	      return _;
	    }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	  }
	}.call(this));


/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Draggable 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Draggable
	//>>group: Interactions
	//>>description: Enables dragging functionality for any element.
	//>>docs: http://api.jqueryui.com/draggable/
	//>>demos: http://jqueryui.com/draggable/
	//>>css.structure: ../../themes/base/draggable.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(14),
				__webpack_require__(18),
				__webpack_require__(19),
				__webpack_require__(22),
				__webpack_require__(20),
				__webpack_require__(21),
				__webpack_require__(16),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	$.widget( "ui.draggable", $.ui.mouse, {
		version: "1.12.1",
		widgetEventPrefix: "drag",
		options: {
			addClasses: true,
			appendTo: "parent",
			axis: false,
			connectToSortable: false,
			containment: false,
			cursor: "auto",
			cursorAt: false,
			grid: false,
			handle: false,
			helper: "original",
			iframeFix: false,
			opacity: false,
			refreshPositions: false,
			revert: false,
			revertDuration: 500,
			scope: "default",
			scroll: true,
			scrollSensitivity: 20,
			scrollSpeed: 20,
			snap: false,
			snapMode: "both",
			snapTolerance: 20,
			stack: false,
			zIndex: false,
	
			// Callbacks
			drag: null,
			start: null,
			stop: null
		},
		_create: function() {
	
			if ( this.options.helper === "original" ) {
				this._setPositionRelative();
			}
			if ( this.options.addClasses ) {
				this._addClass( "ui-draggable" );
			}
			this._setHandleClassName();
	
			this._mouseInit();
		},
	
		_setOption: function( key, value ) {
			this._super( key, value );
			if ( key === "handle" ) {
				this._removeHandleClassName();
				this._setHandleClassName();
			}
		},
	
		_destroy: function() {
			if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
				this.destroyOnClear = true;
				return;
			}
			this._removeHandleClassName();
			this._mouseDestroy();
		},
	
		_mouseCapture: function( event ) {
			var o = this.options;
	
			// Among others, prevent a drag on a resizable-handle
			if ( this.helper || o.disabled ||
					$( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
				return false;
			}
	
			//Quit if we're not on a valid handle
			this.handle = this._getHandle( event );
			if ( !this.handle ) {
				return false;
			}
	
			this._blurActiveElement( event );
	
			this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
	
			return true;
	
		},
	
		_blockFrames: function( selector ) {
			this.iframeBlocks = this.document.find( selector ).map( function() {
				var iframe = $( this );
	
				return $( "<div>" )
					.css( "position", "absolute" )
					.appendTo( iframe.parent() )
					.outerWidth( iframe.outerWidth() )
					.outerHeight( iframe.outerHeight() )
					.offset( iframe.offset() )[ 0 ];
			} );
		},
	
		_unblockFrames: function() {
			if ( this.iframeBlocks ) {
				this.iframeBlocks.remove();
				delete this.iframeBlocks;
			}
		},
	
		_blurActiveElement: function( event ) {
			var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
				target = $( event.target );
	
			// Don't blur if the event occurred on an element that is within
			// the currently focused element
			// See #10527, #12472
			if ( target.closest( activeElement ).length ) {
				return;
			}
	
			// Blur any element that currently has focus, see #4261
			$.ui.safeBlur( activeElement );
		},
	
		_mouseStart: function( event ) {
	
			var o = this.options;
	
			//Create and append the visible helper
			this.helper = this._createHelper( event );
	
			this._addClass( this.helper, "ui-draggable-dragging" );
	
			//Cache the helper size
			this._cacheHelperProportions();
	
			//If ddmanager is used for droppables, set the global draggable
			if ( $.ui.ddmanager ) {
				$.ui.ddmanager.current = this;
			}
	
			/*
			 * - Position generation -
			 * This block generates everything position related - it's the core of draggables.
			 */
	
			//Cache the margins of the original element
			this._cacheMargins();
	
			//Store the helper's css position
			this.cssPosition = this.helper.css( "position" );
			this.scrollParent = this.helper.scrollParent( true );
			this.offsetParent = this.helper.offsetParent();
			this.hasFixedAncestor = this.helper.parents().filter( function() {
					return $( this ).css( "position" ) === "fixed";
				} ).length > 0;
	
			//The element's absolute position on the page minus margins
			this.positionAbs = this.element.offset();
			this._refreshOffsets( event );
	
			//Generate the original position
			this.originalPosition = this.position = this._generatePosition( event, false );
			this.originalPageX = event.pageX;
			this.originalPageY = event.pageY;
	
			//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
			( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
	
			//Set a containment if given in the options
			this._setContainment();
	
			//Trigger event + callbacks
			if ( this._trigger( "start", event ) === false ) {
				this._clear();
				return false;
			}
	
			//Recache the helper size
			this._cacheHelperProportions();
	
			//Prepare the droppable offsets
			if ( $.ui.ddmanager && !o.dropBehaviour ) {
				$.ui.ddmanager.prepareOffsets( this, event );
			}
	
			// Execute the drag once - this causes the helper not to be visible before getting its
			// correct position
			this._mouseDrag( event, true );
	
			// If the ddmanager is used for droppables, inform the manager that dragging has started
			// (see #5003)
			if ( $.ui.ddmanager ) {
				$.ui.ddmanager.dragStart( this, event );
			}
	
			return true;
		},
	
		_refreshOffsets: function( event ) {
			this.offset = {
				top: this.positionAbs.top - this.margins.top,
				left: this.positionAbs.left - this.margins.left,
				scroll: false,
				parent: this._getParentOffset(),
				relative: this._getRelativeOffset()
			};
	
			this.offset.click = {
				left: event.pageX - this.offset.left,
				top: event.pageY - this.offset.top
			};
		},
	
		_mouseDrag: function( event, noPropagation ) {
	
			// reset any necessary cached properties (see #5009)
			if ( this.hasFixedAncestor ) {
				this.offset.parent = this._getParentOffset();
			}
	
			//Compute the helpers position
			this.position = this._generatePosition( event, true );
			this.positionAbs = this._convertPositionTo( "absolute" );
	
			//Call plugins and callbacks and use the resulting position if something is returned
			if ( !noPropagation ) {
				var ui = this._uiHash();
				if ( this._trigger( "drag", event, ui ) === false ) {
					this._mouseUp( new $.Event( "mouseup", event ) );
					return false;
				}
				this.position = ui.position;
			}
	
			this.helper[ 0 ].style.left = this.position.left + "px";
			this.helper[ 0 ].style.top = this.position.top + "px";
	
			if ( $.ui.ddmanager ) {
				$.ui.ddmanager.drag( this, event );
			}
	
			return false;
		},
	
		_mouseStop: function( event ) {
	
			//If we are using droppables, inform the manager about the drop
			var that = this,
				dropped = false;
			if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
				dropped = $.ui.ddmanager.drop( this, event );
			}
	
			//if a drop comes from outside (a sortable)
			if ( this.dropped ) {
				dropped = this.dropped;
				this.dropped = false;
			}
	
			if ( ( this.options.revert === "invalid" && !dropped ) ||
					( this.options.revert === "valid" && dropped ) ||
					this.options.revert === true || ( $.isFunction( this.options.revert ) &&
					this.options.revert.call( this.element, dropped ) )
			) {
				$( this.helper ).animate(
					this.originalPosition,
					parseInt( this.options.revertDuration, 10 ),
					function() {
						if ( that._trigger( "stop", event ) !== false ) {
							that._clear();
						}
					}
				);
			} else {
				if ( this._trigger( "stop", event ) !== false ) {
					this._clear();
				}
			}
	
			return false;
		},
	
		_mouseUp: function( event ) {
			this._unblockFrames();
	
			// If the ddmanager is used for droppables, inform the manager that dragging has stopped
			// (see #5003)
			if ( $.ui.ddmanager ) {
				$.ui.ddmanager.dragStop( this, event );
			}
	
			// Only need to focus if the event occurred on the draggable itself, see #10527
			if ( this.handleElement.is( event.target ) ) {
	
				// The interaction is over; whether or not the click resulted in a drag,
				// focus the element
				this.element.trigger( "focus" );
			}
	
			return $.ui.mouse.prototype._mouseUp.call( this, event );
		},
	
		cancel: function() {
	
			if ( this.helper.is( ".ui-draggable-dragging" ) ) {
				this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
			} else {
				this._clear();
			}
	
			return this;
	
		},
	
		_getHandle: function( event ) {
			return this.options.handle ?
				!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
				true;
		},
	
		_setHandleClassName: function() {
			this.handleElement = this.options.handle ?
				this.element.find( this.options.handle ) : this.element;
			this._addClass( this.handleElement, "ui-draggable-handle" );
		},
	
		_removeHandleClassName: function() {
			this._removeClass( this.handleElement, "ui-draggable-handle" );
		},
	
		_createHelper: function( event ) {
	
			var o = this.options,
				helperIsFunction = $.isFunction( o.helper ),
				helper = helperIsFunction ?
					$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
					( o.helper === "clone" ?
						this.element.clone().removeAttr( "id" ) :
						this.element );
	
			if ( !helper.parents( "body" ).length ) {
				helper.appendTo( ( o.appendTo === "parent" ?
					this.element[ 0 ].parentNode :
					o.appendTo ) );
			}
	
			// Http://bugs.jqueryui.com/ticket/9446
			// a helper function can return the original element
			// which wouldn't have been set to relative in _create
			if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
				this._setPositionRelative();
			}
	
			if ( helper[ 0 ] !== this.element[ 0 ] &&
					!( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
				helper.css( "position", "absolute" );
			}
	
			return helper;
	
		},
	
		_setPositionRelative: function() {
			if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
				this.element[ 0 ].style.position = "relative";
			}
		},
	
		_adjustOffsetFromHelper: function( obj ) {
			if ( typeof obj === "string" ) {
				obj = obj.split( " " );
			}
			if ( $.isArray( obj ) ) {
				obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
			}
			if ( "left" in obj ) {
				this.offset.click.left = obj.left + this.margins.left;
			}
			if ( "right" in obj ) {
				this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
			}
			if ( "top" in obj ) {
				this.offset.click.top = obj.top + this.margins.top;
			}
			if ( "bottom" in obj ) {
				this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
			}
		},
	
		_isRootNode: function( element ) {
			return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
		},
	
		_getParentOffset: function() {
	
			//Get the offsetParent and cache its position
			var po = this.offsetParent.offset(),
				document = this.document[ 0 ];
	
			// This is a special case where we need to modify a offset calculated on start, since the
			// following happened:
			// 1. The position of the helper is absolute, so it's position is calculated based on the
			// next positioned parent
			// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
			// the document, which means that the scroll is included in the initial calculation of the
			// offset of the parent, and never recalculated upon drag
			if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
					$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
				po.left += this.scrollParent.scrollLeft();
				po.top += this.scrollParent.scrollTop();
			}
	
			if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
				po = { top: 0, left: 0 };
			}
	
			return {
				top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
				left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
			};
	
		},
	
		_getRelativeOffset: function() {
			if ( this.cssPosition !== "relative" ) {
				return { top: 0, left: 0 };
			}
	
			var p = this.element.position(),
				scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
	
			return {
				top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
					( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
				left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
					( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
			};
	
		},
	
		_cacheMargins: function() {
			this.margins = {
				left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
				top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
				right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
				bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
			};
		},
	
		_cacheHelperProportions: function() {
			this.helperProportions = {
				width: this.helper.outerWidth(),
				height: this.helper.outerHeight()
			};
		},
	
		_setContainment: function() {
	
			var isUserScrollable, c, ce,
				o = this.options,
				document = this.document[ 0 ];
	
			this.relativeContainer = null;
	
			if ( !o.containment ) {
				this.containment = null;
				return;
			}
	
			if ( o.containment === "window" ) {
				this.containment = [
					$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
					$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
					$( window ).scrollLeft() + $( window ).width() -
						this.helperProportions.width - this.margins.left,
					$( window ).scrollTop() +
						( $( window ).height() || document.body.parentNode.scrollHeight ) -
						this.helperProportions.height - this.margins.top
				];
				return;
			}
	
			if ( o.containment === "document" ) {
				this.containment = [
					0,
					0,
					$( document ).width() - this.helperProportions.width - this.margins.left,
					( $( document ).height() || document.body.parentNode.scrollHeight ) -
						this.helperProportions.height - this.margins.top
				];
				return;
			}
	
			if ( o.containment.constructor === Array ) {
				this.containment = o.containment;
				return;
			}
	
			if ( o.containment === "parent" ) {
				o.containment = this.helper[ 0 ].parentNode;
			}
	
			c = $( o.containment );
			ce = c[ 0 ];
	
			if ( !ce ) {
				return;
			}
	
			isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
	
			this.containment = [
				( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
					( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
				( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
					( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
				( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
					( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
					( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
					this.helperProportions.width -
					this.margins.left -
					this.margins.right,
				( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
					( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
					( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
					this.helperProportions.height -
					this.margins.top -
					this.margins.bottom
			];
			this.relativeContainer = c;
		},
	
		_convertPositionTo: function( d, pos ) {
	
			if ( !pos ) {
				pos = this.position;
			}
	
			var mod = d === "absolute" ? 1 : -1,
				scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
	
			return {
				top: (
	
					// The absolute mouse position
					pos.top	+
	
					// Only for relative positioned nodes: Relative offset from element to offset parent
					this.offset.relative.top * mod +
	
					// The offsetParent's offset without borders (offset + border)
					this.offset.parent.top * mod -
					( ( this.cssPosition === "fixed" ?
						-this.offset.scroll.top :
						( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
				),
				left: (
	
					// The absolute mouse position
					pos.left +
	
					// Only for relative positioned nodes: Relative offset from element to offset parent
					this.offset.relative.left * mod +
	
					// The offsetParent's offset without borders (offset + border)
					this.offset.parent.left * mod	-
					( ( this.cssPosition === "fixed" ?
						-this.offset.scroll.left :
						( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
				)
			};
	
		},
	
		_generatePosition: function( event, constrainPosition ) {
	
			var containment, co, top, left,
				o = this.options,
				scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
				pageX = event.pageX,
				pageY = event.pageY;
	
			// Cache the scroll
			if ( !scrollIsRootNode || !this.offset.scroll ) {
				this.offset.scroll = {
					top: this.scrollParent.scrollTop(),
					left: this.scrollParent.scrollLeft()
				};
			}
	
			/*
			 * - Position constraining -
			 * Constrain the position to a mix of grid, containment.
			 */
	
			// If we are not dragging yet, we won't check for options
			if ( constrainPosition ) {
				if ( this.containment ) {
					if ( this.relativeContainer ) {
						co = this.relativeContainer.offset();
						containment = [
							this.containment[ 0 ] + co.left,
							this.containment[ 1 ] + co.top,
							this.containment[ 2 ] + co.left,
							this.containment[ 3 ] + co.top
						];
					} else {
						containment = this.containment;
					}
	
					if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
						pageX = containment[ 0 ] + this.offset.click.left;
					}
					if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
						pageY = containment[ 1 ] + this.offset.click.top;
					}
					if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
						pageX = containment[ 2 ] + this.offset.click.left;
					}
					if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
						pageY = containment[ 3 ] + this.offset.click.top;
					}
				}
	
				if ( o.grid ) {
	
					//Check for grid elements set to 0 to prevent divide by 0 error causing invalid
					// argument errors in IE (see ticket #6950)
					top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
						this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
					pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
						top - this.offset.click.top > containment[ 3 ] ) ?
							top :
							( ( top - this.offset.click.top >= containment[ 1 ] ) ?
								top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
	
					left = o.grid[ 0 ] ? this.originalPageX +
						Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
						this.originalPageX;
					pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
						left - this.offset.click.left > containment[ 2 ] ) ?
							left :
							( ( left - this.offset.click.left >= containment[ 0 ] ) ?
								left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
				}
	
				if ( o.axis === "y" ) {
					pageX = this.originalPageX;
				}
	
				if ( o.axis === "x" ) {
					pageY = this.originalPageY;
				}
			}
	
			return {
				top: (
	
					// The absolute mouse position
					pageY -
	
					// Click offset (relative to the element)
					this.offset.click.top -
	
					// Only for relative positioned nodes: Relative offset from element to offset parent
					this.offset.relative.top -
	
					// The offsetParent's offset without borders (offset + border)
					this.offset.parent.top +
					( this.cssPosition === "fixed" ?
						-this.offset.scroll.top :
						( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
				),
				left: (
	
					// The absolute mouse position
					pageX -
	
					// Click offset (relative to the element)
					this.offset.click.left -
	
					// Only for relative positioned nodes: Relative offset from element to offset parent
					this.offset.relative.left -
	
					// The offsetParent's offset without borders (offset + border)
					this.offset.parent.left +
					( this.cssPosition === "fixed" ?
						-this.offset.scroll.left :
						( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
				)
			};
	
		},
	
		_clear: function() {
			this._removeClass( this.helper, "ui-draggable-dragging" );
			if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
				this.helper.remove();
			}
			this.helper = null;
			this.cancelHelperRemoval = false;
			if ( this.destroyOnClear ) {
				this.destroy();
			}
		},
	
		// From now on bulk stuff - mainly helpers
	
		_trigger: function( type, event, ui ) {
			ui = ui || this._uiHash();
			$.ui.plugin.call( this, type, [ event, ui, this ], true );
	
			// Absolute position and offset (see #6884 ) have to be recalculated after plugins
			if ( /^(drag|start|stop)/.test( type ) ) {
				this.positionAbs = this._convertPositionTo( "absolute" );
				ui.offset = this.positionAbs;
			}
			return $.Widget.prototype._trigger.call( this, type, event, ui );
		},
	
		plugins: {},
	
		_uiHash: function() {
			return {
				helper: this.helper,
				position: this.position,
				originalPosition: this.originalPosition,
				offset: this.positionAbs
			};
		}
	
	} );
	
	$.ui.plugin.add( "draggable", "connectToSortable", {
		start: function( event, ui, draggable ) {
			var uiSortable = $.extend( {}, ui, {
				item: draggable.element
			} );
	
			draggable.sortables = [];
			$( draggable.options.connectToSortable ).each( function() {
				var sortable = $( this ).sortable( "instance" );
	
				if ( sortable && !sortable.options.disabled ) {
					draggable.sortables.push( sortable );
	
					// RefreshPositions is called at drag start to refresh the containerCache
					// which is used in drag. This ensures it's initialized and synchronized
					// with any changes that might have happened on the page since initialization.
					sortable.refreshPositions();
					sortable._trigger( "activate", event, uiSortable );
				}
			} );
		},
		stop: function( event, ui, draggable ) {
			var uiSortable = $.extend( {}, ui, {
				item: draggable.element
			} );
	
			draggable.cancelHelperRemoval = false;
	
			$.each( draggable.sortables, function() {
				var sortable = this;
	
				if ( sortable.isOver ) {
					sortable.isOver = 0;
	
					// Allow this sortable to handle removing the helper
					draggable.cancelHelperRemoval = true;
					sortable.cancelHelperRemoval = false;
	
					// Use _storedCSS To restore properties in the sortable,
					// as this also handles revert (#9675) since the draggable
					// may have modified them in unexpected ways (#8809)
					sortable._storedCSS = {
						position: sortable.placeholder.css( "position" ),
						top: sortable.placeholder.css( "top" ),
						left: sortable.placeholder.css( "left" )
					};
	
					sortable._mouseStop( event );
	
					// Once drag has ended, the sortable should return to using
					// its original helper, not the shared helper from draggable
					sortable.options.helper = sortable.options._helper;
				} else {
	
					// Prevent this Sortable from removing the helper.
					// However, don't set the draggable to remove the helper
					// either as another connected Sortable may yet handle the removal.
					sortable.cancelHelperRemoval = true;
	
					sortable._trigger( "deactivate", event, uiSortable );
				}
			} );
		},
		drag: function( event, ui, draggable ) {
			$.each( draggable.sortables, function() {
				var innermostIntersecting = false,
					sortable = this;
	
				// Copy over variables that sortable's _intersectsWith uses
				sortable.positionAbs = draggable.positionAbs;
				sortable.helperProportions = draggable.helperProportions;
				sortable.offset.click = draggable.offset.click;
	
				if ( sortable._intersectsWith( sortable.containerCache ) ) {
					innermostIntersecting = true;
	
					$.each( draggable.sortables, function() {
	
						// Copy over variables that sortable's _intersectsWith uses
						this.positionAbs = draggable.positionAbs;
						this.helperProportions = draggable.helperProportions;
						this.offset.click = draggable.offset.click;
	
						if ( this !== sortable &&
								this._intersectsWith( this.containerCache ) &&
								$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
							innermostIntersecting = false;
						}
	
						return innermostIntersecting;
					} );
				}
	
				if ( innermostIntersecting ) {
	
					// If it intersects, we use a little isOver variable and set it once,
					// so that the move-in stuff gets fired only once.
					if ( !sortable.isOver ) {
						sortable.isOver = 1;
	
						// Store draggable's parent in case we need to reappend to it later.
						draggable._parent = ui.helper.parent();
	
						sortable.currentItem = ui.helper
							.appendTo( sortable.element )
							.data( "ui-sortable-item", true );
	
						// Store helper option to later restore it
						sortable.options._helper = sortable.options.helper;
	
						sortable.options.helper = function() {
							return ui.helper[ 0 ];
						};
	
						// Fire the start events of the sortable with our passed browser event,
						// and our own helper (so it doesn't create a new one)
						event.target = sortable.currentItem[ 0 ];
						sortable._mouseCapture( event, true );
						sortable._mouseStart( event, true, true );
	
						// Because the browser event is way off the new appended portlet,
						// modify necessary variables to reflect the changes
						sortable.offset.click.top = draggable.offset.click.top;
						sortable.offset.click.left = draggable.offset.click.left;
						sortable.offset.parent.left -= draggable.offset.parent.left -
							sortable.offset.parent.left;
						sortable.offset.parent.top -= draggable.offset.parent.top -
							sortable.offset.parent.top;
	
						draggable._trigger( "toSortable", event );
	
						// Inform draggable that the helper is in a valid drop zone,
						// used solely in the revert option to handle "valid/invalid".
						draggable.dropped = sortable.element;
	
						// Need to refreshPositions of all sortables in the case that
						// adding to one sortable changes the location of the other sortables (#9675)
						$.each( draggable.sortables, function() {
							this.refreshPositions();
						} );
	
						// Hack so receive/update callbacks work (mostly)
						draggable.currentItem = draggable.element;
						sortable.fromOutside = draggable;
					}
	
					if ( sortable.currentItem ) {
						sortable._mouseDrag( event );
	
						// Copy the sortable's position because the draggable's can potentially reflect
						// a relative position, while sortable is always absolute, which the dragged
						// element has now become. (#8809)
						ui.position = sortable.position;
					}
				} else {
	
					// If it doesn't intersect with the sortable, and it intersected before,
					// we fake the drag stop of the sortable, but make sure it doesn't remove
					// the helper by using cancelHelperRemoval.
					if ( sortable.isOver ) {
	
						sortable.isOver = 0;
						sortable.cancelHelperRemoval = true;
	
						// Calling sortable's mouseStop would trigger a revert,
						// so revert must be temporarily false until after mouseStop is called.
						sortable.options._revert = sortable.options.revert;
						sortable.options.revert = false;
	
						sortable._trigger( "out", event, sortable._uiHash( sortable ) );
						sortable._mouseStop( event, true );
	
						// Restore sortable behaviors that were modfied
						// when the draggable entered the sortable area (#9481)
						sortable.options.revert = sortable.options._revert;
						sortable.options.helper = sortable.options._helper;
	
						if ( sortable.placeholder ) {
							sortable.placeholder.remove();
						}
	
						// Restore and recalculate the draggable's offset considering the sortable
						// may have modified them in unexpected ways. (#8809, #10669)
						ui.helper.appendTo( draggable._parent );
						draggable._refreshOffsets( event );
						ui.position = draggable._generatePosition( event, true );
	
						draggable._trigger( "fromSortable", event );
	
						// Inform draggable that the helper is no longer in a valid drop zone
						draggable.dropped = false;
	
						// Need to refreshPositions of all sortables just in case removing
						// from one sortable changes the location of other sortables (#9675)
						$.each( draggable.sortables, function() {
							this.refreshPositions();
						} );
					}
				}
			} );
		}
	} );
	
	$.ui.plugin.add( "draggable", "cursor", {
		start: function( event, ui, instance ) {
			var t = $( "body" ),
				o = instance.options;
	
			if ( t.css( "cursor" ) ) {
				o._cursor = t.css( "cursor" );
			}
			t.css( "cursor", o.cursor );
		},
		stop: function( event, ui, instance ) {
			var o = instance.options;
			if ( o._cursor ) {
				$( "body" ).css( "cursor", o._cursor );
			}
		}
	} );
	
	$.ui.plugin.add( "draggable", "opacity", {
		start: function( event, ui, instance ) {
			var t = $( ui.helper ),
				o = instance.options;
			if ( t.css( "opacity" ) ) {
				o._opacity = t.css( "opacity" );
			}
			t.css( "opacity", o.opacity );
		},
		stop: function( event, ui, instance ) {
			var o = instance.options;
			if ( o._opacity ) {
				$( ui.helper ).css( "opacity", o._opacity );
			}
		}
	} );
	
	$.ui.plugin.add( "draggable", "scroll", {
		start: function( event, ui, i ) {
			if ( !i.scrollParentNotHidden ) {
				i.scrollParentNotHidden = i.helper.scrollParent( false );
			}
	
			if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
					i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
				i.overflowOffset = i.scrollParentNotHidden.offset();
			}
		},
		drag: function( event, ui, i  ) {
	
			var o = i.options,
				scrolled = false,
				scrollParent = i.scrollParentNotHidden[ 0 ],
				document = i.document[ 0 ];
	
			if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
				if ( !o.axis || o.axis !== "x" ) {
					if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
							o.scrollSensitivity ) {
						scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
					} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
						scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
					}
				}
	
				if ( !o.axis || o.axis !== "y" ) {
					if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
							o.scrollSensitivity ) {
						scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
					} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
						scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
					}
				}
	
			} else {
	
				if ( !o.axis || o.axis !== "x" ) {
					if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
						scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
					} else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
							o.scrollSensitivity ) {
						scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
					}
				}
	
				if ( !o.axis || o.axis !== "y" ) {
					if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
						scrolled = $( document ).scrollLeft(
							$( document ).scrollLeft() - o.scrollSpeed
						);
					} else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
							o.scrollSensitivity ) {
						scrolled = $( document ).scrollLeft(
							$( document ).scrollLeft() + o.scrollSpeed
						);
					}
				}
	
			}
	
			if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
				$.ui.ddmanager.prepareOffsets( i, event );
			}
	
		}
	} );
	
	$.ui.plugin.add( "draggable", "snap", {
		start: function( event, ui, i ) {
	
			var o = i.options;
	
			i.snapElements = [];
	
			$( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
				.each( function() {
					var $t = $( this ),
						$o = $t.offset();
					if ( this !== i.element[ 0 ] ) {
						i.snapElements.push( {
							item: this,
							width: $t.outerWidth(), height: $t.outerHeight(),
							top: $o.top, left: $o.left
						} );
					}
				} );
	
		},
		drag: function( event, ui, inst ) {
	
			var ts, bs, ls, rs, l, r, t, b, i, first,
				o = inst.options,
				d = o.snapTolerance,
				x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
				y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
	
			for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
	
				l = inst.snapElements[ i ].left - inst.margins.left;
				r = l + inst.snapElements[ i ].width;
				t = inst.snapElements[ i ].top - inst.margins.top;
				b = t + inst.snapElements[ i ].height;
	
				if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
						!$.contains( inst.snapElements[ i ].item.ownerDocument,
						inst.snapElements[ i ].item ) ) {
					if ( inst.snapElements[ i ].snapping ) {
						( inst.options.snap.release &&
							inst.options.snap.release.call(
								inst.element,
								event,
								$.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
							) );
					}
					inst.snapElements[ i ].snapping = false;
					continue;
				}
	
				if ( o.snapMode !== "inner" ) {
					ts = Math.abs( t - y2 ) <= d;
					bs = Math.abs( b - y1 ) <= d;
					ls = Math.abs( l - x2 ) <= d;
					rs = Math.abs( r - x1 ) <= d;
					if ( ts ) {
						ui.position.top = inst._convertPositionTo( "relative", {
							top: t - inst.helperProportions.height,
							left: 0
						} ).top;
					}
					if ( bs ) {
						ui.position.top = inst._convertPositionTo( "relative", {
							top: b,
							left: 0
						} ).top;
					}
					if ( ls ) {
						ui.position.left = inst._convertPositionTo( "relative", {
							top: 0,
							left: l - inst.helperProportions.width
						} ).left;
					}
					if ( rs ) {
						ui.position.left = inst._convertPositionTo( "relative", {
							top: 0,
							left: r
						} ).left;
					}
				}
	
				first = ( ts || bs || ls || rs );
	
				if ( o.snapMode !== "outer" ) {
					ts = Math.abs( t - y1 ) <= d;
					bs = Math.abs( b - y2 ) <= d;
					ls = Math.abs( l - x1 ) <= d;
					rs = Math.abs( r - x2 ) <= d;
					if ( ts ) {
						ui.position.top = inst._convertPositionTo( "relative", {
							top: t,
							left: 0
						} ).top;
					}
					if ( bs ) {
						ui.position.top = inst._convertPositionTo( "relative", {
							top: b - inst.helperProportions.height,
							left: 0
						} ).top;
					}
					if ( ls ) {
						ui.position.left = inst._convertPositionTo( "relative", {
							top: 0,
							left: l
						} ).left;
					}
					if ( rs ) {
						ui.position.left = inst._convertPositionTo( "relative", {
							top: 0,
							left: r - inst.helperProportions.width
						} ).left;
					}
				}
	
				if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
					( inst.options.snap.snap &&
						inst.options.snap.snap.call(
							inst.element,
							event,
							$.extend( inst._uiHash(), {
								snapItem: inst.snapElements[ i ].item
							} ) ) );
				}
				inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
	
			}
	
		}
	} );
	
	$.ui.plugin.add( "draggable", "stack", {
		start: function( event, ui, instance ) {
			var min,
				o = instance.options,
				group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
					return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
						( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
				} );
	
			if ( !group.length ) { return; }
	
			min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
			$( group ).each( function( i ) {
				$( this ).css( "zIndex", min + i );
			} );
			this.css( "zIndex", ( min + group.length ) );
		}
	} );
	
	$.ui.plugin.add( "draggable", "zIndex", {
		start: function( event, ui, instance ) {
			var t = $( ui.helper ),
				o = instance.options;
	
			if ( t.css( "zIndex" ) ) {
				o._zIndex = t.css( "zIndex" );
			}
			t.css( "zIndex", o.zIndex );
		},
		stop: function( event, ui, instance ) {
			var o = instance.options;
	
			if ( o._zIndex ) {
				$( ui.helper ).css( "zIndex", o._zIndex );
			}
		}
	} );
	
	return $.ui.draggable;
	
	} ) );


/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Mouse 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Mouse
	//>>group: Widgets
	//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
	//>>docs: http://api.jqueryui.com/mouse/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(15),
				__webpack_require__(16),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	var mouseHandled = false;
	$( document ).on( "mouseup", function() {
		mouseHandled = false;
	} );
	
	return $.widget( "ui.mouse", {
		version: "1.12.1",
		options: {
			cancel: "input, textarea, button, select, option",
			distance: 1,
			delay: 0
		},
		_mouseInit: function() {
			var that = this;
	
			this.element
				.on( "mousedown." + this.widgetName, function( event ) {
					return that._mouseDown( event );
				} )
				.on( "click." + this.widgetName, function( event ) {
					if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
						$.removeData( event.target, that.widgetName + ".preventClickEvent" );
						event.stopImmediatePropagation();
						return false;
					}
				} );
	
			this.started = false;
		},
	
		// TODO: make sure destroying one instance of mouse doesn't mess with
		// other instances of mouse
		_mouseDestroy: function() {
			this.element.off( "." + this.widgetName );
			if ( this._mouseMoveDelegate ) {
				this.document
					.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
					.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
			}
		},
	
		_mouseDown: function( event ) {
	
			// don't let more than one widget handle mouseStart
			if ( mouseHandled ) {
				return;
			}
	
			this._mouseMoved = false;
	
			// We may have missed mouseup (out of window)
			( this._mouseStarted && this._mouseUp( event ) );
	
			this._mouseDownEvent = event;
	
			var that = this,
				btnIsLeft = ( event.which === 1 ),
	
				// event.target.nodeName works around a bug in IE 8 with
				// disabled inputs (#7620)
				elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
					$( event.target ).closest( this.options.cancel ).length : false );
			if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
				return true;
			}
	
			this.mouseDelayMet = !this.options.delay;
			if ( !this.mouseDelayMet ) {
				this._mouseDelayTimer = setTimeout( function() {
					that.mouseDelayMet = true;
				}, this.options.delay );
			}
	
			if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
				this._mouseStarted = ( this._mouseStart( event ) !== false );
				if ( !this._mouseStarted ) {
					event.preventDefault();
					return true;
				}
			}
	
			// Click event may never have fired (Gecko & Opera)
			if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
				$.removeData( event.target, this.widgetName + ".preventClickEvent" );
			}
	
			// These delegates are required to keep context
			this._mouseMoveDelegate = function( event ) {
				return that._mouseMove( event );
			};
			this._mouseUpDelegate = function( event ) {
				return that._mouseUp( event );
			};
	
			this.document
				.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
				.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
	
			event.preventDefault();
	
			mouseHandled = true;
			return true;
		},
	
		_mouseMove: function( event ) {
	
			// Only check for mouseups outside the document if you've moved inside the document
			// at least once. This prevents the firing of mouseup in the case of IE<9, which will
			// fire a mousemove event if content is placed under the cursor. See #7778
			// Support: IE <9
			if ( this._mouseMoved ) {
	
				// IE mouseup check - mouseup happened when mouse was out of window
				if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
						!event.button ) {
					return this._mouseUp( event );
	
				// Iframe mouseup check - mouseup occurred in another document
				} else if ( !event.which ) {
	
					// Support: Safari <=8 - 9
					// Safari sets which to 0 if you press any of the following keys
					// during a drag (#14461)
					if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
							event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
						this.ignoreMissingWhich = true;
					} else if ( !this.ignoreMissingWhich ) {
						return this._mouseUp( event );
					}
				}
			}
	
			if ( event.which || event.button ) {
				this._mouseMoved = true;
			}
	
			if ( this._mouseStarted ) {
				this._mouseDrag( event );
				return event.preventDefault();
			}
	
			if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
				this._mouseStarted =
					( this._mouseStart( this._mouseDownEvent, event ) !== false );
				( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
			}
	
			return !this._mouseStarted;
		},
	
		_mouseUp: function( event ) {
			this.document
				.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
				.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
	
			if ( this._mouseStarted ) {
				this._mouseStarted = false;
	
				if ( event.target === this._mouseDownEvent.target ) {
					$.data( event.target, this.widgetName + ".preventClickEvent", true );
				}
	
				this._mouseStop( event );
			}
	
			if ( this._mouseDelayTimer ) {
				clearTimeout( this._mouseDelayTimer );
				delete this._mouseDelayTimer;
			}
	
			this.ignoreMissingWhich = false;
			mouseHandled = false;
			event.preventDefault();
		},
	
		_mouseDistanceMet: function( event ) {
			return ( Math.max(
					Math.abs( this._mouseDownEvent.pageX - event.pageX ),
					Math.abs( this._mouseDownEvent.pageY - event.pageY )
				) >= this.options.distance
			);
		},
	
		_mouseDelayMet: function( /* event */ ) {
			return this.mouseDelayMet;
		},
	
		// These are placeholder methods, to be overriden by extending plugin
		_mouseStart: function( /* event */ ) {},
		_mouseDrag: function( /* event */ ) {},
		_mouseStop: function( /* event */ ) {},
		_mouseCapture: function( /* event */ ) { return true; }
	} );
	
	} ) );


/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	// This file is deprecated
	return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
	} ) );


/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	$.ui = $.ui || {};
	
	return $.ui.version = "1.12.1";
	
	} ) );


/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Widget 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Widget
	//>>group: Core
	//>>description: Provides a factory for creating stateful widgets with a common API.
	//>>docs: http://api.jqueryui.com/jQuery.widget/
	//>>demos: http://jqueryui.com/widget/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	var widgetUuid = 0;
	var widgetSlice = Array.prototype.slice;
	
	$.cleanData = ( function( orig ) {
		return function( elems ) {
			var events, elem, i;
			for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
				try {
	
					// Only trigger remove when necessary to save time
					events = $._data( elem, "events" );
					if ( events && events.remove ) {
						$( elem ).triggerHandler( "remove" );
					}
	
				// Http://bugs.jquery.com/ticket/8235
				} catch ( e ) {}
			}
			orig( elems );
		};
	} )( $.cleanData );
	
	$.widget = function( name, base, prototype ) {
		var existingConstructor, constructor, basePrototype;
	
		// ProxiedPrototype allows the provided prototype to remain unmodified
		// so that it can be used as a mixin for multiple widgets (#8876)
		var proxiedPrototype = {};
	
		var namespace = name.split( "." )[ 0 ];
		name = name.split( "." )[ 1 ];
		var fullName = namespace + "-" + name;
	
		if ( !prototype ) {
			prototype = base;
			base = $.Widget;
		}
	
		if ( $.isArray( prototype ) ) {
			prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
		}
	
		// Create selector for plugin
		$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
			return !!$.data( elem, fullName );
		};
	
		$[ namespace ] = $[ namespace ] || {};
		existingConstructor = $[ namespace ][ name ];
		constructor = $[ namespace ][ name ] = function( options, element ) {
	
			// Allow instantiation without "new" keyword
			if ( !this._createWidget ) {
				return new constructor( options, element );
			}
	
			// Allow instantiation without initializing for simple inheritance
			// must use "new" keyword (the code above always passes args)
			if ( arguments.length ) {
				this._createWidget( options, element );
			}
		};
	
		// Extend with the existing constructor to carry over any static properties
		$.extend( constructor, existingConstructor, {
			version: prototype.version,
	
			// Copy the object used to create the prototype in case we need to
			// redefine the widget later
			_proto: $.extend( {}, prototype ),
	
			// Track widgets that inherit from this widget in case this widget is
			// redefined after a widget inherits from it
			_childConstructors: []
		} );
	
		basePrototype = new base();
	
		// We need to make the options hash a property directly on the new instance
		// otherwise we'll modify the options hash on the prototype that we're
		// inheriting from
		basePrototype.options = $.widget.extend( {}, basePrototype.options );
		$.each( prototype, function( prop, value ) {
			if ( !$.isFunction( value ) ) {
				proxiedPrototype[ prop ] = value;
				return;
			}
			proxiedPrototype[ prop ] = ( function() {
				function _super() {
					return base.prototype[ prop ].apply( this, arguments );
				}
	
				function _superApply( args ) {
					return base.prototype[ prop ].apply( this, args );
				}
	
				return function() {
					var __super = this._super;
					var __superApply = this._superApply;
					var returnValue;
	
					this._super = _super;
					this._superApply = _superApply;
	
					returnValue = value.apply( this, arguments );
	
					this._super = __super;
					this._superApply = __superApply;
	
					return returnValue;
				};
			} )();
		} );
		constructor.prototype = $.widget.extend( basePrototype, {
	
			// TODO: remove support for widgetEventPrefix
			// always use the name + a colon as the prefix, e.g., draggable:start
			// don't prefix for widgets that aren't DOM-based
			widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
		}, proxiedPrototype, {
			constructor: constructor,
			namespace: namespace,
			widgetName: name,
			widgetFullName: fullName
		} );
	
		// If this widget is being redefined then we need to find all widgets that
		// are inheriting from it and redefine all of them so that they inherit from
		// the new version of this widget. We're essentially trying to replace one
		// level in the prototype chain.
		if ( existingConstructor ) {
			$.each( existingConstructor._childConstructors, function( i, child ) {
				var childPrototype = child.prototype;
	
				// Redefine the child widget using the same prototype that was
				// originally used, but inherit from the new version of the base
				$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
					child._proto );
			} );
	
			// Remove the list of existing child constructors from the old constructor
			// so the old child constructors can be garbage collected
			delete existingConstructor._childConstructors;
		} else {
			base._childConstructors.push( constructor );
		}
	
		$.widget.bridge( name, constructor );
	
		return constructor;
	};
	
	$.widget.extend = function( target ) {
		var input = widgetSlice.call( arguments, 1 );
		var inputIndex = 0;
		var inputLength = input.length;
		var key;
		var value;
	
		for ( ; inputIndex < inputLength; inputIndex++ ) {
			for ( key in input[ inputIndex ] ) {
				value = input[ inputIndex ][ key ];
				if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
	
					// Clone objects
					if ( $.isPlainObject( value ) ) {
						target[ key ] = $.isPlainObject( target[ key ] ) ?
							$.widget.extend( {}, target[ key ], value ) :
	
							// Don't extend strings, arrays, etc. with objects
							$.widget.extend( {}, value );
	
					// Copy everything else by reference
					} else {
						target[ key ] = value;
					}
				}
			}
		}
		return target;
	};
	
	$.widget.bridge = function( name, object ) {
		var fullName = object.prototype.widgetFullName || name;
		$.fn[ name ] = function( options ) {
			var isMethodCall = typeof options === "string";
			var args = widgetSlice.call( arguments, 1 );
			var returnValue = this;
	
			if ( isMethodCall ) {
	
				// If this is an empty collection, we need to have the instance method
				// return undefined instead of the jQuery instance
				if ( !this.length && options === "instance" ) {
					returnValue = undefined;
				} else {
					this.each( function() {
						var methodValue;
						var instance = $.data( this, fullName );
	
						if ( options === "instance" ) {
							returnValue = instance;
							return false;
						}
	
						if ( !instance ) {
							return $.error( "cannot call methods on " + name +
								" prior to initialization; " +
								"attempted to call method '" + options + "'" );
						}
	
						if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
							return $.error( "no such method '" + options + "' for " + name +
								" widget instance" );
						}
	
						methodValue = instance[ options ].apply( instance, args );
	
						if ( methodValue !== instance && methodValue !== undefined ) {
							returnValue = methodValue && methodValue.jquery ?
								returnValue.pushStack( methodValue.get() ) :
								methodValue;
							return false;
						}
					} );
				}
			} else {
	
				// Allow multiple hashes to be passed on init
				if ( args.length ) {
					options = $.widget.extend.apply( null, [ options ].concat( args ) );
				}
	
				this.each( function() {
					var instance = $.data( this, fullName );
					if ( instance ) {
						instance.option( options || {} );
						if ( instance._init ) {
							instance._init();
						}
					} else {
						$.data( this, fullName, new object( options, this ) );
					}
				} );
			}
	
			return returnValue;
		};
	};
	
	$.Widget = function( /* options, element */ ) {};
	$.Widget._childConstructors = [];
	
	$.Widget.prototype = {
		widgetName: "widget",
		widgetEventPrefix: "",
		defaultElement: "<div>",
	
		options: {
			classes: {},
			disabled: false,
	
			// Callbacks
			create: null
		},
	
		_createWidget: function( options, element ) {
			element = $( element || this.defaultElement || this )[ 0 ];
			this.element = $( element );
			this.uuid = widgetUuid++;
			this.eventNamespace = "." + this.widgetName + this.uuid;
	
			this.bindings = $();
			this.hoverable = $();
			this.focusable = $();
			this.classesElementLookup = {};
	
			if ( element !== this ) {
				$.data( element, this.widgetFullName, this );
				this._on( true, this.element, {
					remove: function( event ) {
						if ( event.target === element ) {
							this.destroy();
						}
					}
				} );
				this.document = $( element.style ?
	
					// Element within the document
					element.ownerDocument :
	
					// Element is window or document
					element.document || element );
				this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
			}
	
			this.options = $.widget.extend( {},
				this.options,
				this._getCreateOptions(),
				options );
	
			this._create();
	
			if ( this.options.disabled ) {
				this._setOptionDisabled( this.options.disabled );
			}
	
			this._trigger( "create", null, this._getCreateEventData() );
			this._init();
		},
	
		_getCreateOptions: function() {
			return {};
		},
	
		_getCreateEventData: $.noop,
	
		_create: $.noop,
	
		_init: $.noop,
	
		destroy: function() {
			var that = this;
	
			this._destroy();
			$.each( this.classesElementLookup, function( key, value ) {
				that._removeClass( value, key );
			} );
	
			// We can probably remove the unbind calls in 2.0
			// all event bindings should go through this._on()
			this.element
				.off( this.eventNamespace )
				.removeData( this.widgetFullName );
			this.widget()
				.off( this.eventNamespace )
				.removeAttr( "aria-disabled" );
	
			// Clean up events and states
			this.bindings.off( this.eventNamespace );
		},
	
		_destroy: $.noop,
	
		widget: function() {
			return this.element;
		},
	
		option: function( key, value ) {
			var options = key;
			var parts;
			var curOption;
			var i;
	
			if ( arguments.length === 0 ) {
	
				// Don't return a reference to the internal hash
				return $.widget.extend( {}, this.options );
			}
	
			if ( typeof key === "string" ) {
	
				// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
				options = {};
				parts = key.split( "." );
				key = parts.shift();
				if ( parts.length ) {
					curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
					for ( i = 0; i < parts.length - 1; i++ ) {
						curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
						curOption = curOption[ parts[ i ] ];
					}
					key = parts.pop();
					if ( arguments.length === 1 ) {
						return curOption[ key ] === undefined ? null : curOption[ key ];
					}
					curOption[ key ] = value;
				} else {
					if ( arguments.length === 1 ) {
						return this.options[ key ] === undefined ? null : this.options[ key ];
					}
					options[ key ] = value;
				}
			}
	
			this._setOptions( options );
	
			return this;
		},
	
		_setOptions: function( options ) {
			var key;
	
			for ( key in options ) {
				this._setOption( key, options[ key ] );
			}
	
			return this;
		},
	
		_setOption: function( key, value ) {
			if ( key === "classes" ) {
				this._setOptionClasses( value );
			}
	
			this.options[ key ] = value;
	
			if ( key === "disabled" ) {
				this._setOptionDisabled( value );
			}
	
			return this;
		},
	
		_setOptionClasses: function( value ) {
			var classKey, elements, currentElements;
	
			for ( classKey in value ) {
				currentElements = this.classesElementLookup[ classKey ];
				if ( value[ classKey ] === this.options.classes[ classKey ] ||
						!currentElements ||
						!currentElements.length ) {
					continue;
				}
	
				// We are doing this to create a new jQuery object because the _removeClass() call
				// on the next line is going to destroy the reference to the current elements being
				// tracked. We need to save a copy of this collection so that we can add the new classes
				// below.
				elements = $( currentElements.get() );
				this._removeClass( currentElements, classKey );
	
				// We don't use _addClass() here, because that uses this.options.classes
				// for generating the string of classes. We want to use the value passed in from
				// _setOption(), this is the new value of the classes option which was passed to
				// _setOption(). We pass this value directly to _classes().
				elements.addClass( this._classes( {
					element: elements,
					keys: classKey,
					classes: value,
					add: true
				} ) );
			}
		},
	
		_setOptionDisabled: function( value ) {
			this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
	
			// If the widget is becoming disabled, then nothing is interactive
			if ( value ) {
				this._removeClass( this.hoverable, null, "ui-state-hover" );
				this._removeClass( this.focusable, null, "ui-state-focus" );
			}
		},
	
		enable: function() {
			return this._setOptions( { disabled: false } );
		},
	
		disable: function() {
			return this._setOptions( { disabled: true } );
		},
	
		_classes: function( options ) {
			var full = [];
			var that = this;
	
			options = $.extend( {
				element: this.element,
				classes: this.options.classes || {}
			}, options );
	
			function processClassString( classes, checkOption ) {
				var current, i;
				for ( i = 0; i < classes.length; i++ ) {
					current = that.classesElementLookup[ classes[ i ] ] || $();
					if ( options.add ) {
						current = $( $.unique( current.get().concat( options.element.get() ) ) );
					} else {
						current = $( current.not( options.element ).get() );
					}
					that.classesElementLookup[ classes[ i ] ] = current;
					full.push( classes[ i ] );
					if ( checkOption && options.classes[ classes[ i ] ] ) {
						full.push( options.classes[ classes[ i ] ] );
					}
				}
			}
	
			this._on( options.element, {
				"remove": "_untrackClassesElement"
			} );
	
			if ( options.keys ) {
				processClassString( options.keys.match( /\S+/g ) || [], true );
			}
			if ( options.extra ) {
				processClassString( options.extra.match( /\S+/g ) || [] );
			}
	
			return full.join( " " );
		},
	
		_untrackClassesElement: function( event ) {
			var that = this;
			$.each( that.classesElementLookup, function( key, value ) {
				if ( $.inArray( event.target, value ) !== -1 ) {
					that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
				}
			} );
		},
	
		_removeClass: function( element, keys, extra ) {
			return this._toggleClass( element, keys, extra, false );
		},
	
		_addClass: function( element, keys, extra ) {
			return this._toggleClass( element, keys, extra, true );
		},
	
		_toggleClass: function( element, keys, extra, add ) {
			add = ( typeof add === "boolean" ) ? add : extra;
			var shift = ( typeof element === "string" || element === null ),
				options = {
					extra: shift ? keys : extra,
					keys: shift ? element : keys,
					element: shift ? this.element : element,
					add: add
				};
			options.element.toggleClass( this._classes( options ), add );
			return this;
		},
	
		_on: function( suppressDisabledCheck, element, handlers ) {
			var delegateElement;
			var instance = this;
	
			// No suppressDisabledCheck flag, shuffle arguments
			if ( typeof suppressDisabledCheck !== "boolean" ) {
				handlers = element;
				element = suppressDisabledCheck;
				suppressDisabledCheck = false;
			}
	
			// No element argument, shuffle and use this.element
			if ( !handlers ) {
				handlers = element;
				element = this.element;
				delegateElement = this.widget();
			} else {
				element = delegateElement = $( element );
				this.bindings = this.bindings.add( element );
			}
	
			$.each( handlers, function( event, handler ) {
				function handlerProxy() {
	
					// Allow widgets to customize the disabled handling
					// - disabled as an array instead of boolean
					// - disabled class as method for disabling individual parts
					if ( !suppressDisabledCheck &&
							( instance.options.disabled === true ||
							$( this ).hasClass( "ui-state-disabled" ) ) ) {
						return;
					}
					return ( typeof handler === "string" ? instance[ handler ] : handler )
						.apply( instance, arguments );
				}
	
				// Copy the guid so direct unbinding works
				if ( typeof handler !== "string" ) {
					handlerProxy.guid = handler.guid =
						handler.guid || handlerProxy.guid || $.guid++;
				}
	
				var match = event.match( /^([\w:-]*)\s*(.*)$/ );
				var eventName = match[ 1 ] + instance.eventNamespace;
				var selector = match[ 2 ];
	
				if ( selector ) {
					delegateElement.on( eventName, selector, handlerProxy );
				} else {
					element.on( eventName, handlerProxy );
				}
			} );
		},
	
		_off: function( element, eventName ) {
			eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
				this.eventNamespace;
			element.off( eventName ).off( eventName );
	
			// Clear the stack to avoid memory leaks (#10056)
			this.bindings = $( this.bindings.not( element ).get() );
			this.focusable = $( this.focusable.not( element ).get() );
			this.hoverable = $( this.hoverable.not( element ).get() );
		},
	
		_delay: function( handler, delay ) {
			function handlerProxy() {
				return ( typeof handler === "string" ? instance[ handler ] : handler )
					.apply( instance, arguments );
			}
			var instance = this;
			return setTimeout( handlerProxy, delay || 0 );
		},
	
		_hoverable: function( element ) {
			this.hoverable = this.hoverable.add( element );
			this._on( element, {
				mouseenter: function( event ) {
					this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
				},
				mouseleave: function( event ) {
					this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
				}
			} );
		},
	
		_focusable: function( element ) {
			this.focusable = this.focusable.add( element );
			this._on( element, {
				focusin: function( event ) {
					this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
				},
				focusout: function( event ) {
					this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
				}
			} );
		},
	
		_trigger: function( type, event, data ) {
			var prop, orig;
			var callback = this.options[ type ];
	
			data = data || {};
			event = $.Event( event );
			event.type = ( type === this.widgetEventPrefix ?
				type :
				this.widgetEventPrefix + type ).toLowerCase();
	
			// The original event may come from any element
			// so we need to reset the target on the new event
			event.target = this.element[ 0 ];
	
			// Copy original event properties over to the new event
			orig = event.originalEvent;
			if ( orig ) {
				for ( prop in orig ) {
					if ( !( prop in event ) ) {
						event[ prop ] = orig[ prop ];
					}
				}
			}
	
			this.element.trigger( event, data );
			return !( $.isFunction( callback ) &&
				callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
				event.isDefaultPrevented() );
		}
	};
	
	$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
		$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
			if ( typeof options === "string" ) {
				options = { effect: options };
			}
	
			var hasOptions;
			var effectName = !options ?
				method :
				options === true || typeof options === "number" ?
					defaultEffect :
					options.effect || defaultEffect;
	
			options = options || {};
			if ( typeof options === "number" ) {
				options = { duration: options };
			}
	
			hasOptions = !$.isEmptyObject( options );
			options.complete = callback;
	
			if ( options.delay ) {
				element.delay( options.delay );
			}
	
			if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
				element[ method ]( options );
			} else if ( effectName !== method && element[ effectName ] ) {
				element[ effectName ]( options.duration, options.easing, callback );
			} else {
				element.queue( function( next ) {
					$( this )[ method ]();
					if ( callback ) {
						callback.call( element[ 0 ] );
					}
					next();
				} );
			}
		};
	} );
	
	return $.widget;
	
	} ) );


/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI :data 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: :data Selector
	//>>group: Core
	//>>description: Selects elements which have data stored under the specified key.
	//>>docs: http://api.jqueryui.com/data-selector/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	return $.extend( $.expr[ ":" ], {
		data: $.expr.createPseudo ?
			$.expr.createPseudo( function( dataName ) {
				return function( elem ) {
					return !!$.data( elem, dataName );
				};
			} ) :
	
			// Support: jQuery <1.8
			function( elem, i, match ) {
				return !!$.data( elem, match[ 3 ] );
			}
	} );
	} ) );


/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	// $.ui.plugin is deprecated. Use $.widget() extensions instead.
	return $.ui.plugin = {
		add: function( module, option, set ) {
			var i,
				proto = $.ui[ module ].prototype;
			for ( i in set ) {
				proto.plugins[ i ] = proto.plugins[ i ] || [];
				proto.plugins[ i ].push( [ option, set[ i ] ] );
			}
		},
		call: function( instance, name, args, allowDisconnected ) {
			var i,
				set = instance.plugins[ name ];
	
			if ( !set ) {
				return;
			}
	
			if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
					instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
				return;
			}
	
			for ( i = 0; i < set.length; i++ ) {
				if ( instance.options[ set[ i ][ 0 ] ] ) {
					set[ i ][ 1 ].apply( instance.element, args );
				}
			}
		}
	};
	
	} ) );


/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	return $.ui.safeBlur = function( element ) {
	
		// Support: IE9 - 10 only
		// If the <body> is blurred, IE will switch windows, see #9420
		if ( element && element.nodeName.toLowerCase() !== "body" ) {
			$( element ).trigger( "blur" );
		}
	};
	
	} ) );


/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Scroll Parent 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: scrollParent
	//>>group: Core
	//>>description: Get the closest ancestor element that is scrollable.
	//>>docs: http://api.jqueryui.com/scrollParent/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	return $.fn.scrollParent = function( includeHidden ) {
		var position = this.css( "position" ),
			excludeStaticParent = position === "absolute",
			overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
			scrollParent = this.parents().filter( function() {
				var parent = $( this );
				if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
					return false;
				}
				return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
					parent.css( "overflow-x" ) );
			} ).eq( 0 );
	
		return position === "fixed" || !scrollParent.length ?
			$( this[ 0 ].ownerDocument || document ) :
			scrollParent;
	};
	
	} ) );


/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	return $.ui.safeActiveElement = function( document ) {
		var activeElement;
	
		// Support: IE 9 only
		// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
		try {
			activeElement = document.activeElement;
		} catch ( error ) {
			activeElement = document.body;
		}
	
		// Support: IE 9 - 11 only
		// IE may return null instead of an element
		// Interestingly, this only seems to occur when NOT in an iframe
		if ( !activeElement ) {
			activeElement = document.body;
		}
	
		// Support: IE 11 only
		// IE11 returns a seemingly empty object in some cases when accessing
		// document.activeElement from an <iframe>
		if ( !activeElement.nodeName ) {
			activeElement = document.body;
		}
	
		return activeElement;
	};
	
	} ) );


/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Slider 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Slider
	//>>group: Widgets
	//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
	//>>docs: http://api.jqueryui.com/slider/
	//>>demos: http://jqueryui.com/slider/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/slider.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(14),
				__webpack_require__(24),
				__webpack_require__(16),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	return $.widget( "ui.slider", $.ui.mouse, {
		version: "1.12.1",
		widgetEventPrefix: "slide",
	
		options: {
			animate: false,
			classes: {
				"ui-slider": "ui-corner-all",
				"ui-slider-handle": "ui-corner-all",
	
				// Note: ui-widget-header isn't the most fittingly semantic framework class for this
				// element, but worked best visually with a variety of themes
				"ui-slider-range": "ui-corner-all ui-widget-header"
			},
			distance: 0,
			max: 100,
			min: 0,
			orientation: "horizontal",
			range: false,
			step: 1,
			value: 0,
			values: null,
	
			// Callbacks
			change: null,
			slide: null,
			start: null,
			stop: null
		},
	
		// Number of pages in a slider
		// (how many times can you page up/down to go through the whole range)
		numPages: 5,
	
		_create: function() {
			this._keySliding = false;
			this._mouseSliding = false;
			this._animateOff = true;
			this._handleIndex = null;
			this._detectOrientation();
			this._mouseInit();
			this._calculateNewMax();
	
			this._addClass( "ui-slider ui-slider-" + this.orientation,
				"ui-widget ui-widget-content" );
	
			this._refresh();
	
			this._animateOff = false;
		},
	
		_refresh: function() {
			this._createRange();
			this._createHandles();
			this._setupEvents();
			this._refreshValue();
		},
	
		_createHandles: function() {
			var i, handleCount,
				options = this.options,
				existingHandles = this.element.find( ".ui-slider-handle" ),
				handle = "<span tabindex='0'></span>",
				handles = [];
	
			handleCount = ( options.values && options.values.length ) || 1;
	
			if ( existingHandles.length > handleCount ) {
				existingHandles.slice( handleCount ).remove();
				existingHandles = existingHandles.slice( 0, handleCount );
			}
	
			for ( i = existingHandles.length; i < handleCount; i++ ) {
				handles.push( handle );
			}
	
			this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
	
			this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
	
			this.handle = this.handles.eq( 0 );
	
			this.handles.each( function( i ) {
				$( this )
					.data( "ui-slider-handle-index", i )
					.attr( "tabIndex", 0 );
			} );
		},
	
		_createRange: function() {
			var options = this.options;
	
			if ( options.range ) {
				if ( options.range === true ) {
					if ( !options.values ) {
						options.values = [ this._valueMin(), this._valueMin() ];
					} else if ( options.values.length && options.values.length !== 2 ) {
						options.values = [ options.values[ 0 ], options.values[ 0 ] ];
					} else if ( $.isArray( options.values ) ) {
						options.values = options.values.slice( 0 );
					}
				}
	
				if ( !this.range || !this.range.length ) {
					this.range = $( "<div>" )
						.appendTo( this.element );
	
					this._addClass( this.range, "ui-slider-range" );
				} else {
					this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
	
					// Handle range switching from true to min/max
					this.range.css( {
						"left": "",
						"bottom": ""
					} );
				}
				if ( options.range === "min" || options.range === "max" ) {
					this._addClass( this.range, "ui-slider-range-" + options.range );
				}
			} else {
				if ( this.range ) {
					this.range.remove();
				}
				this.range = null;
			}
		},
	
		_setupEvents: function() {
			this._off( this.handles );
			this._on( this.handles, this._handleEvents );
			this._hoverable( this.handles );
			this._focusable( this.handles );
		},
	
		_destroy: function() {
			this.handles.remove();
			if ( this.range ) {
				this.range.remove();
			}
	
			this._mouseDestroy();
		},
	
		_mouseCapture: function( event ) {
			var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
				that = this,
				o = this.options;
	
			if ( o.disabled ) {
				return false;
			}
	
			this.elementSize = {
				width: this.element.outerWidth(),
				height: this.element.outerHeight()
			};
			this.elementOffset = this.element.offset();
	
			position = { x: event.pageX, y: event.pageY };
			normValue = this._normValueFromMouse( position );
			distance = this._valueMax() - this._valueMin() + 1;
			this.handles.each( function( i ) {
				var thisDistance = Math.abs( normValue - that.values( i ) );
				if ( ( distance > thisDistance ) ||
					( distance === thisDistance &&
						( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
					distance = thisDistance;
					closestHandle = $( this );
					index = i;
				}
			} );
	
			allowed = this._start( event, index );
			if ( allowed === false ) {
				return false;
			}
			this._mouseSliding = true;
	
			this._handleIndex = index;
	
			this._addClass( closestHandle, null, "ui-state-active" );
			closestHandle.trigger( "focus" );
	
			offset = closestHandle.offset();
			mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
			this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
				left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
				top: event.pageY - offset.top -
					( closestHandle.height() / 2 ) -
					( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
					( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
					( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
			};
	
			if ( !this.handles.hasClass( "ui-state-hover" ) ) {
				this._slide( event, index, normValue );
			}
			this._animateOff = true;
			return true;
		},
	
		_mouseStart: function() {
			return true;
		},
	
		_mouseDrag: function( event ) {
			var position = { x: event.pageX, y: event.pageY },
				normValue = this._normValueFromMouse( position );
	
			this._slide( event, this._handleIndex, normValue );
	
			return false;
		},
	
		_mouseStop: function( event ) {
			this._removeClass( this.handles, null, "ui-state-active" );
			this._mouseSliding = false;
	
			this._stop( event, this._handleIndex );
			this._change( event, this._handleIndex );
	
			this._handleIndex = null;
			this._clickOffset = null;
			this._animateOff = false;
	
			return false;
		},
	
		_detectOrientation: function() {
			this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
		},
	
		_normValueFromMouse: function( position ) {
			var pixelTotal,
				pixelMouse,
				percentMouse,
				valueTotal,
				valueMouse;
	
			if ( this.orientation === "horizontal" ) {
				pixelTotal = this.elementSize.width;
				pixelMouse = position.x - this.elementOffset.left -
					( this._clickOffset ? this._clickOffset.left : 0 );
			} else {
				pixelTotal = this.elementSize.height;
				pixelMouse = position.y - this.elementOffset.top -
					( this._clickOffset ? this._clickOffset.top : 0 );
			}
	
			percentMouse = ( pixelMouse / pixelTotal );
			if ( percentMouse > 1 ) {
				percentMouse = 1;
			}
			if ( percentMouse < 0 ) {
				percentMouse = 0;
			}
			if ( this.orientation === "vertical" ) {
				percentMouse = 1 - percentMouse;
			}
	
			valueTotal = this._valueMax() - this._valueMin();
			valueMouse = this._valueMin() + percentMouse * valueTotal;
	
			return this._trimAlignValue( valueMouse );
		},
	
		_uiHash: function( index, value, values ) {
			var uiHash = {
				handle: this.handles[ index ],
				handleIndex: index,
				value: value !== undefined ? value : this.value()
			};
	
			if ( this._hasMultipleValues() ) {
				uiHash.value = value !== undefined ? value : this.values( index );
				uiHash.values = values || this.values();
			}
	
			return uiHash;
		},
	
		_hasMultipleValues: function() {
			return this.options.values && this.options.values.length;
		},
	
		_start: function( event, index ) {
			return this._trigger( "start", event, this._uiHash( index ) );
		},
	
		_slide: function( event, index, newVal ) {
			var allowed, otherVal,
				currentValue = this.value(),
				newValues = this.values();
	
			if ( this._hasMultipleValues() ) {
				otherVal = this.values( index ? 0 : 1 );
				currentValue = this.values( index );
	
				if ( this.options.values.length === 2 && this.options.range === true ) {
					newVal =  index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
				}
	
				newValues[ index ] = newVal;
			}
	
			if ( newVal === currentValue ) {
				return;
			}
	
			allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
	
			// A slide can be canceled by returning false from the slide callback
			if ( allowed === false ) {
				return;
			}
	
			if ( this._hasMultipleValues() ) {
				this.values( index, newVal );
			} else {
				this.value( newVal );
			}
		},
	
		_stop: function( event, index ) {
			this._trigger( "stop", event, this._uiHash( index ) );
		},
	
		_change: function( event, index ) {
			if ( !this._keySliding && !this._mouseSliding ) {
	
				//store the last changed value index for reference when handles overlap
				this._lastChangedValue = index;
				this._trigger( "change", event, this._uiHash( index ) );
			}
		},
	
		value: function( newValue ) {
			if ( arguments.length ) {
				this.options.value = this._trimAlignValue( newValue );
				this._refreshValue();
				this._change( null, 0 );
				return;
			}
	
			return this._value();
		},
	
		values: function( index, newValue ) {
			var vals,
				newValues,
				i;
	
			if ( arguments.length > 1 ) {
				this.options.values[ index ] = this._trimAlignValue( newValue );
				this._refreshValue();
				this._change( null, index );
				return;
			}
	
			if ( arguments.length ) {
				if ( $.isArray( arguments[ 0 ] ) ) {
					vals = this.options.values;
					newValues = arguments[ 0 ];
					for ( i = 0; i < vals.length; i += 1 ) {
						vals[ i ] = this._trimAlignValue( newValues[ i ] );
						this._change( null, i );
					}
					this._refreshValue();
				} else {
					if ( this._hasMultipleValues() ) {
						return this._values( index );
					} else {
						return this.value();
					}
				}
			} else {
				return this._values();
			}
		},
	
		_setOption: function( key, value ) {
			var i,
				valsLength = 0;
	
			if ( key === "range" && this.options.range === true ) {
				if ( value === "min" ) {
					this.options.value = this._values( 0 );
					this.options.values = null;
				} else if ( value === "max" ) {
					this.options.value = this._values( this.options.values.length - 1 );
					this.options.values = null;
				}
			}
	
			if ( $.isArray( this.options.values ) ) {
				valsLength = this.options.values.length;
			}
	
			this._super( key, value );
	
			switch ( key ) {
				case "orientation":
					this._detectOrientation();
					this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
						._addClass( "ui-slider-" + this.orientation );
					this._refreshValue();
					if ( this.options.range ) {
						this._refreshRange( value );
					}
	
					// Reset positioning from previous orientation
					this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
					break;
				case "value":
					this._animateOff = true;
					this._refreshValue();
					this._change( null, 0 );
					this._animateOff = false;
					break;
				case "values":
					this._animateOff = true;
					this._refreshValue();
	
					// Start from the last handle to prevent unreachable handles (#9046)
					for ( i = valsLength - 1; i >= 0; i-- ) {
						this._change( null, i );
					}
					this._animateOff = false;
					break;
				case "step":
				case "min":
				case "max":
					this._animateOff = true;
					this._calculateNewMax();
					this._refreshValue();
					this._animateOff = false;
					break;
				case "range":
					this._animateOff = true;
					this._refresh();
					this._animateOff = false;
					break;
			}
		},
	
		_setOptionDisabled: function( value ) {
			this._super( value );
	
			this._toggleClass( null, "ui-state-disabled", !!value );
		},
	
		//internal value getter
		// _value() returns value trimmed by min and max, aligned by step
		_value: function() {
			var val = this.options.value;
			val = this._trimAlignValue( val );
	
			return val;
		},
	
		//internal values getter
		// _values() returns array of values trimmed by min and max, aligned by step
		// _values( index ) returns single value trimmed by min and max, aligned by step
		_values: function( index ) {
			var val,
				vals,
				i;
	
			if ( arguments.length ) {
				val = this.options.values[ index ];
				val = this._trimAlignValue( val );
	
				return val;
			} else if ( this._hasMultipleValues() ) {
	
				// .slice() creates a copy of the array
				// this copy gets trimmed by min and max and then returned
				vals = this.options.values.slice();
				for ( i = 0; i < vals.length; i += 1 ) {
					vals[ i ] = this._trimAlignValue( vals[ i ] );
				}
	
				return vals;
			} else {
				return [];
			}
		},
	
		// Returns the step-aligned value that val is closest to, between (inclusive) min and max
		_trimAlignValue: function( val ) {
			if ( val <= this._valueMin() ) {
				return this._valueMin();
			}
			if ( val >= this._valueMax() ) {
				return this._valueMax();
			}
			var step = ( this.options.step > 0 ) ? this.options.step : 1,
				valModStep = ( val - this._valueMin() ) % step,
				alignValue = val - valModStep;
	
			if ( Math.abs( valModStep ) * 2 >= step ) {
				alignValue += ( valModStep > 0 ) ? step : ( -step );
			}
	
			// Since JavaScript has problems with large floats, round
			// the final value to 5 digits after the decimal point (see #4124)
			return parseFloat( alignValue.toFixed( 5 ) );
		},
	
		_calculateNewMax: function() {
			var max = this.options.max,
				min = this._valueMin(),
				step = this.options.step,
				aboveMin = Math.round( ( max - min ) / step ) * step;
			max = aboveMin + min;
			if ( max > this.options.max ) {
	
				//If max is not divisible by step, rounding off may increase its value
				max -= step;
			}
			this.max = parseFloat( max.toFixed( this._precision() ) );
		},
	
		_precision: function() {
			var precision = this._precisionOf( this.options.step );
			if ( this.options.min !== null ) {
				precision = Math.max( precision, this._precisionOf( this.options.min ) );
			}
			return precision;
		},
	
		_precisionOf: function( num ) {
			var str = num.toString(),
				decimal = str.indexOf( "." );
			return decimal === -1 ? 0 : str.length - decimal - 1;
		},
	
		_valueMin: function() {
			return this.options.min;
		},
	
		_valueMax: function() {
			return this.max;
		},
	
		_refreshRange: function( orientation ) {
			if ( orientation === "vertical" ) {
				this.range.css( { "width": "", "left": "" } );
			}
			if ( orientation === "horizontal" ) {
				this.range.css( { "height": "", "bottom": "" } );
			}
		},
	
		_refreshValue: function() {
			var lastValPercent, valPercent, value, valueMin, valueMax,
				oRange = this.options.range,
				o = this.options,
				that = this,
				animate = ( !this._animateOff ) ? o.animate : false,
				_set = {};
	
			if ( this._hasMultipleValues() ) {
				this.handles.each( function( i ) {
					valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
						that._valueMin() ) * 100;
					_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
					$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
					if ( that.options.range === true ) {
						if ( that.orientation === "horizontal" ) {
							if ( i === 0 ) {
								that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
									left: valPercent + "%"
								}, o.animate );
							}
							if ( i === 1 ) {
								that.range[ animate ? "animate" : "css" ]( {
									width: ( valPercent - lastValPercent ) + "%"
								}, {
									queue: false,
									duration: o.animate
								} );
							}
						} else {
							if ( i === 0 ) {
								that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
									bottom: ( valPercent ) + "%"
								}, o.animate );
							}
							if ( i === 1 ) {
								that.range[ animate ? "animate" : "css" ]( {
									height: ( valPercent - lastValPercent ) + "%"
								}, {
									queue: false,
									duration: o.animate
								} );
							}
						}
					}
					lastValPercent = valPercent;
				} );
			} else {
				value = this.value();
				valueMin = this._valueMin();
				valueMax = this._valueMax();
				valPercent = ( valueMax !== valueMin ) ?
						( value - valueMin ) / ( valueMax - valueMin ) * 100 :
						0;
				_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
				this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
	
				if ( oRange === "min" && this.orientation === "horizontal" ) {
					this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
						width: valPercent + "%"
					}, o.animate );
				}
				if ( oRange === "max" && this.orientation === "horizontal" ) {
					this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
						width: ( 100 - valPercent ) + "%"
					}, o.animate );
				}
				if ( oRange === "min" && this.orientation === "vertical" ) {
					this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
						height: valPercent + "%"
					}, o.animate );
				}
				if ( oRange === "max" && this.orientation === "vertical" ) {
					this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
						height: ( 100 - valPercent ) + "%"
					}, o.animate );
				}
			}
		},
	
		_handleEvents: {
			keydown: function( event ) {
				var allowed, curVal, newVal, step,
					index = $( event.target ).data( "ui-slider-handle-index" );
	
				switch ( event.keyCode ) {
					case $.ui.keyCode.HOME:
					case $.ui.keyCode.END:
					case $.ui.keyCode.PAGE_UP:
					case $.ui.keyCode.PAGE_DOWN:
					case $.ui.keyCode.UP:
					case $.ui.keyCode.RIGHT:
					case $.ui.keyCode.DOWN:
					case $.ui.keyCode.LEFT:
						event.preventDefault();
						if ( !this._keySliding ) {
							this._keySliding = true;
							this._addClass( $( event.target ), null, "ui-state-active" );
							allowed = this._start( event, index );
							if ( allowed === false ) {
								return;
							}
						}
						break;
				}
	
				step = this.options.step;
				if ( this._hasMultipleValues() ) {
					curVal = newVal = this.values( index );
				} else {
					curVal = newVal = this.value();
				}
	
				switch ( event.keyCode ) {
					case $.ui.keyCode.HOME:
						newVal = this._valueMin();
						break;
					case $.ui.keyCode.END:
						newVal = this._valueMax();
						break;
					case $.ui.keyCode.PAGE_UP:
						newVal = this._trimAlignValue(
							curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
						);
						break;
					case $.ui.keyCode.PAGE_DOWN:
						newVal = this._trimAlignValue(
							curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
						break;
					case $.ui.keyCode.UP:
					case $.ui.keyCode.RIGHT:
						if ( curVal === this._valueMax() ) {
							return;
						}
						newVal = this._trimAlignValue( curVal + step );
						break;
					case $.ui.keyCode.DOWN:
					case $.ui.keyCode.LEFT:
						if ( curVal === this._valueMin() ) {
							return;
						}
						newVal = this._trimAlignValue( curVal - step );
						break;
				}
	
				this._slide( event, index, newVal );
			},
			keyup: function( event ) {
				var index = $( event.target ).data( "ui-slider-handle-index" );
	
				if ( this._keySliding ) {
					this._keySliding = false;
					this._stop( event, index );
					this._change( event, index );
					this._removeClass( $( event.target ), null, "ui-state-active" );
				}
			}
		}
	} );
	
	} ) );


/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Keycode 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Keycode
	//>>group: Core
	//>>description: Provide keycodes as keynames
	//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	return $.ui.keyCode = {
		BACKSPACE: 8,
		COMMA: 188,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		LEFT: 37,
		PAGE_DOWN: 34,
		PAGE_UP: 33,
		PERIOD: 190,
		RIGHT: 39,
		SPACE: 32,
		TAB: 9,
		UP: 38
	};
	
	} ) );


/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Dialog 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Dialog
	//>>group: Widgets
	//>>description: Displays customizable dialog windows.
	//>>docs: http://api.jqueryui.com/dialog/
	//>>demos: http://jqueryui.com/dialog/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/dialog.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(26),
				__webpack_require__(13),
				__webpack_require__(14),
				__webpack_require__(33),
				__webpack_require__(35),
				__webpack_require__(24),
				__webpack_require__(38),
				__webpack_require__(22),
				__webpack_require__(20),
				__webpack_require__(36),
				__webpack_require__(37),
				__webpack_require__(16),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	$.widget( "ui.dialog", {
		version: "1.12.1",
		options: {
			appendTo: "body",
			autoOpen: true,
			buttons: [],
			classes: {
				"ui-dialog": "ui-corner-all",
				"ui-dialog-titlebar": "ui-corner-all"
			},
			closeOnEscape: true,
			closeText: "Close",
			draggable: true,
			hide: null,
			height: "auto",
			maxHeight: null,
			maxWidth: null,
			minHeight: 150,
			minWidth: 150,
			modal: false,
			position: {
				my: "center",
				at: "center",
				of: window,
				collision: "fit",
	
				// Ensure the titlebar is always visible
				using: function( pos ) {
					var topOffset = $( this ).css( pos ).offset().top;
					if ( topOffset < 0 ) {
						$( this ).css( "top", pos.top - topOffset );
					}
				}
			},
			resizable: true,
			show: null,
			title: null,
			width: 300,
	
			// Callbacks
			beforeClose: null,
			close: null,
			drag: null,
			dragStart: null,
			dragStop: null,
			focus: null,
			open: null,
			resize: null,
			resizeStart: null,
			resizeStop: null
		},
	
		sizeRelatedOptions: {
			buttons: true,
			height: true,
			maxHeight: true,
			maxWidth: true,
			minHeight: true,
			minWidth: true,
			width: true
		},
	
		resizableRelatedOptions: {
			maxHeight: true,
			maxWidth: true,
			minHeight: true,
			minWidth: true
		},
	
		_create: function() {
			this.originalCss = {
				display: this.element[ 0 ].style.display,
				width: this.element[ 0 ].style.width,
				minHeight: this.element[ 0 ].style.minHeight,
				maxHeight: this.element[ 0 ].style.maxHeight,
				height: this.element[ 0 ].style.height
			};
			this.originalPosition = {
				parent: this.element.parent(),
				index: this.element.parent().children().index( this.element )
			};
			this.originalTitle = this.element.attr( "title" );
			if ( this.options.title == null && this.originalTitle != null ) {
				this.options.title = this.originalTitle;
			}
	
			// Dialogs can't be disabled
			if ( this.options.disabled ) {
				this.options.disabled = false;
			}
	
			this._createWrapper();
	
			this.element
				.show()
				.removeAttr( "title" )
				.appendTo( this.uiDialog );
	
			this._addClass( "ui-dialog-content", "ui-widget-content" );
	
			this._createTitlebar();
			this._createButtonPane();
	
			if ( this.options.draggable && $.fn.draggable ) {
				this._makeDraggable();
			}
			if ( this.options.resizable && $.fn.resizable ) {
				this._makeResizable();
			}
	
			this._isOpen = false;
	
			this._trackFocus();
		},
	
		_init: function() {
			if ( this.options.autoOpen ) {
				this.open();
			}
		},
	
		_appendTo: function() {
			var element = this.options.appendTo;
			if ( element && ( element.jquery || element.nodeType ) ) {
				return $( element );
			}
			return this.document.find( element || "body" ).eq( 0 );
		},
	
		_destroy: function() {
			var next,
				originalPosition = this.originalPosition;
	
			this._untrackInstance();
			this._destroyOverlay();
	
			this.element
				.removeUniqueId()
				.css( this.originalCss )
	
				// Without detaching first, the following becomes really slow
				.detach();
	
			this.uiDialog.remove();
	
			if ( this.originalTitle ) {
				this.element.attr( "title", this.originalTitle );
			}
	
			next = originalPosition.parent.children().eq( originalPosition.index );
	
			// Don't try to place the dialog next to itself (#8613)
			if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
				next.before( this.element );
			} else {
				originalPosition.parent.append( this.element );
			}
		},
	
		widget: function() {
			return this.uiDialog;
		},
	
		disable: $.noop,
		enable: $.noop,
	
		close: function( event ) {
			var that = this;
	
			if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
				return;
			}
	
			this._isOpen = false;
			this._focusedElement = null;
			this._destroyOverlay();
			this._untrackInstance();
	
			if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
	
				// Hiding a focused element doesn't trigger blur in WebKit
				// so in case we have nothing to focus on, explicitly blur the active element
				// https://bugs.webkit.org/show_bug.cgi?id=47182
				$.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
			}
	
			this._hide( this.uiDialog, this.options.hide, function() {
				that._trigger( "close", event );
			} );
		},
	
		isOpen: function() {
			return this._isOpen;
		},
	
		moveToTop: function() {
			this._moveToTop();
		},
	
		_moveToTop: function( event, silent ) {
			var moved = false,
				zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
					return +$( this ).css( "z-index" );
				} ).get(),
				zIndexMax = Math.max.apply( null, zIndices );
	
			if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
				this.uiDialog.css( "z-index", zIndexMax + 1 );
				moved = true;
			}
	
			if ( moved && !silent ) {
				this._trigger( "focus", event );
			}
			return moved;
		},
	
		open: function() {
			var that = this;
			if ( this._isOpen ) {
				if ( this._moveToTop() ) {
					this._focusTabbable();
				}
				return;
			}
	
			this._isOpen = true;
			this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
	
			this._size();
			this._position();
			this._createOverlay();
			this._moveToTop( null, true );
	
			// Ensure the overlay is moved to the top with the dialog, but only when
			// opening. The overlay shouldn't move after the dialog is open so that
			// modeless dialogs opened after the modal dialog stack properly.
			if ( this.overlay ) {
				this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
			}
	
			this._show( this.uiDialog, this.options.show, function() {
				that._focusTabbable();
				that._trigger( "focus" );
			} );
	
			// Track the dialog immediately upon openening in case a focus event
			// somehow occurs outside of the dialog before an element inside the
			// dialog is focused (#10152)
			this._makeFocusTarget();
	
			this._trigger( "open" );
		},
	
		_focusTabbable: function() {
	
			// Set focus to the first match:
			// 1. An element that was focused previously
			// 2. First element inside the dialog matching [autofocus]
			// 3. Tabbable element inside the content element
			// 4. Tabbable element inside the buttonpane
			// 5. The close button
			// 6. The dialog itself
			var hasFocus = this._focusedElement;
			if ( !hasFocus ) {
				hasFocus = this.element.find( "[autofocus]" );
			}
			if ( !hasFocus.length ) {
				hasFocus = this.element.find( ":tabbable" );
			}
			if ( !hasFocus.length ) {
				hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
			}
			if ( !hasFocus.length ) {
				hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
			}
			if ( !hasFocus.length ) {
				hasFocus = this.uiDialog;
			}
			hasFocus.eq( 0 ).trigger( "focus" );
		},
	
		_keepFocus: function( event ) {
			function checkFocus() {
				var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
					isActive = this.uiDialog[ 0 ] === activeElement ||
						$.contains( this.uiDialog[ 0 ], activeElement );
				if ( !isActive ) {
					this._focusTabbable();
				}
			}
			event.preventDefault();
			checkFocus.call( this );
	
			// support: IE
			// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
			// so we check again later
			this._delay( checkFocus );
		},
	
		_createWrapper: function() {
			this.uiDialog = $( "<div>" )
				.hide()
				.attr( {
	
					// Setting tabIndex makes the div focusable
					tabIndex: -1,
					role: "dialog"
				} )
				.appendTo( this._appendTo() );
	
			this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
			this._on( this.uiDialog, {
				keydown: function( event ) {
					if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
							event.keyCode === $.ui.keyCode.ESCAPE ) {
						event.preventDefault();
						this.close( event );
						return;
					}
	
					// Prevent tabbing out of dialogs
					if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
						return;
					}
					var tabbables = this.uiDialog.find( ":tabbable" ),
						first = tabbables.filter( ":first" ),
						last = tabbables.filter( ":last" );
	
					if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
							!event.shiftKey ) {
						this._delay( function() {
							first.trigger( "focus" );
						} );
						event.preventDefault();
					} else if ( ( event.target === first[ 0 ] ||
							event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
						this._delay( function() {
							last.trigger( "focus" );
						} );
						event.preventDefault();
					}
				},
				mousedown: function( event ) {
					if ( this._moveToTop( event ) ) {
						this._focusTabbable();
					}
				}
			} );
	
			// We assume that any existing aria-describedby attribute means
			// that the dialog content is marked up properly
			// otherwise we brute force the content as the description
			if ( !this.element.find( "[aria-describedby]" ).length ) {
				this.uiDialog.attr( {
					"aria-describedby": this.element.uniqueId().attr( "id" )
				} );
			}
		},
	
		_createTitlebar: function() {
			var uiDialogTitle;
	
			this.uiDialogTitlebar = $( "<div>" );
			this._addClass( this.uiDialogTitlebar,
				"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
			this._on( this.uiDialogTitlebar, {
				mousedown: function( event ) {
	
					// Don't prevent click on close button (#8838)
					// Focusing a dialog that is partially scrolled out of view
					// causes the browser to scroll it into view, preventing the click event
					if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
	
						// Dialog isn't getting focus when dragging (#8063)
						this.uiDialog.trigger( "focus" );
					}
				}
			} );
	
			// Support: IE
			// Use type="button" to prevent enter keypresses in textboxes from closing the
			// dialog in IE (#9312)
			this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
				.button( {
					label: $( "<a>" ).text( this.options.closeText ).html(),
					icon: "ui-icon-closethick",
					showLabel: false
				} )
				.appendTo( this.uiDialogTitlebar );
	
			this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
			this._on( this.uiDialogTitlebarClose, {
				click: function( event ) {
					event.preventDefault();
					this.close( event );
				}
			} );
	
			uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
			this._addClass( uiDialogTitle, "ui-dialog-title" );
			this._title( uiDialogTitle );
	
			this.uiDialogTitlebar.prependTo( this.uiDialog );
	
			this.uiDialog.attr( {
				"aria-labelledby": uiDialogTitle.attr( "id" )
			} );
		},
	
		_title: function( title ) {
			if ( this.options.title ) {
				title.text( this.options.title );
			} else {
				title.html( "&#160;" );
			}
		},
	
		_createButtonPane: function() {
			this.uiDialogButtonPane = $( "<div>" );
			this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
				"ui-widget-content ui-helper-clearfix" );
	
			this.uiButtonSet = $( "<div>" )
				.appendTo( this.uiDialogButtonPane );
			this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
	
			this._createButtons();
		},
	
		_createButtons: function() {
			var that = this,
				buttons = this.options.buttons;
	
			// If we already have a button pane, remove it
			this.uiDialogButtonPane.remove();
			this.uiButtonSet.empty();
	
			if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
				this._removeClass( this.uiDialog, "ui-dialog-buttons" );
				return;
			}
	
			$.each( buttons, function( name, props ) {
				var click, buttonOptions;
				props = $.isFunction( props ) ?
					{ click: props, text: name } :
					props;
	
				// Default to a non-submitting button
				props = $.extend( { type: "button" }, props );
	
				// Change the context for the click callback to be the main element
				click = props.click;
				buttonOptions = {
					icon: props.icon,
					iconPosition: props.iconPosition,
					showLabel: props.showLabel,
	
					// Deprecated options
					icons: props.icons,
					text: props.text
				};
	
				delete props.click;
				delete props.icon;
				delete props.iconPosition;
				delete props.showLabel;
	
				// Deprecated options
				delete props.icons;
				if ( typeof props.text === "boolean" ) {
					delete props.text;
				}
	
				$( "<button></button>", props )
					.button( buttonOptions )
					.appendTo( that.uiButtonSet )
					.on( "click", function() {
						click.apply( that.element[ 0 ], arguments );
					} );
			} );
			this._addClass( this.uiDialog, "ui-dialog-buttons" );
			this.uiDialogButtonPane.appendTo( this.uiDialog );
		},
	
		_makeDraggable: function() {
			var that = this,
				options = this.options;
	
			function filteredUi( ui ) {
				return {
					position: ui.position,
					offset: ui.offset
				};
			}
	
			this.uiDialog.draggable( {
				cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
				handle: ".ui-dialog-titlebar",
				containment: "document",
				start: function( event, ui ) {
					that._addClass( $( this ), "ui-dialog-dragging" );
					that._blockFrames();
					that._trigger( "dragStart", event, filteredUi( ui ) );
				},
				drag: function( event, ui ) {
					that._trigger( "drag", event, filteredUi( ui ) );
				},
				stop: function( event, ui ) {
					var left = ui.offset.left - that.document.scrollLeft(),
						top = ui.offset.top - that.document.scrollTop();
	
					options.position = {
						my: "left top",
						at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
							"top" + ( top >= 0 ? "+" : "" ) + top,
						of: that.window
					};
					that._removeClass( $( this ), "ui-dialog-dragging" );
					that._unblockFrames();
					that._trigger( "dragStop", event, filteredUi( ui ) );
				}
			} );
		},
	
		_makeResizable: function() {
			var that = this,
				options = this.options,
				handles = options.resizable,
	
				// .ui-resizable has position: relative defined in the stylesheet
				// but dialogs have to use absolute or fixed positioning
				position = this.uiDialog.css( "position" ),
				resizeHandles = typeof handles === "string" ?
					handles :
					"n,e,s,w,se,sw,ne,nw";
	
			function filteredUi( ui ) {
				return {
					originalPosition: ui.originalPosition,
					originalSize: ui.originalSize,
					position: ui.position,
					size: ui.size
				};
			}
	
			this.uiDialog.resizable( {
				cancel: ".ui-dialog-content",
				containment: "document",
				alsoResize: this.element,
				maxWidth: options.maxWidth,
				maxHeight: options.maxHeight,
				minWidth: options.minWidth,
				minHeight: this._minHeight(),
				handles: resizeHandles,
				start: function( event, ui ) {
					that._addClass( $( this ), "ui-dialog-resizing" );
					that._blockFrames();
					that._trigger( "resizeStart", event, filteredUi( ui ) );
				},
				resize: function( event, ui ) {
					that._trigger( "resize", event, filteredUi( ui ) );
				},
				stop: function( event, ui ) {
					var offset = that.uiDialog.offset(),
						left = offset.left - that.document.scrollLeft(),
						top = offset.top - that.document.scrollTop();
	
					options.height = that.uiDialog.height();
					options.width = that.uiDialog.width();
					options.position = {
						my: "left top",
						at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
							"top" + ( top >= 0 ? "+" : "" ) + top,
						of: that.window
					};
					that._removeClass( $( this ), "ui-dialog-resizing" );
					that._unblockFrames();
					that._trigger( "resizeStop", event, filteredUi( ui ) );
				}
			} )
				.css( "position", position );
		},
	
		_trackFocus: function() {
			this._on( this.widget(), {
				focusin: function( event ) {
					this._makeFocusTarget();
					this._focusedElement = $( event.target );
				}
			} );
		},
	
		_makeFocusTarget: function() {
			this._untrackInstance();
			this._trackingInstances().unshift( this );
		},
	
		_untrackInstance: function() {
			var instances = this._trackingInstances(),
				exists = $.inArray( this, instances );
			if ( exists !== -1 ) {
				instances.splice( exists, 1 );
			}
		},
	
		_trackingInstances: function() {
			var instances = this.document.data( "ui-dialog-instances" );
			if ( !instances ) {
				instances = [];
				this.document.data( "ui-dialog-instances", instances );
			}
			return instances;
		},
	
		_minHeight: function() {
			var options = this.options;
	
			return options.height === "auto" ?
				options.minHeight :
				Math.min( options.minHeight, options.height );
		},
	
		_position: function() {
	
			// Need to show the dialog to get the actual offset in the position plugin
			var isVisible = this.uiDialog.is( ":visible" );
			if ( !isVisible ) {
				this.uiDialog.show();
			}
			this.uiDialog.position( this.options.position );
			if ( !isVisible ) {
				this.uiDialog.hide();
			}
		},
	
		_setOptions: function( options ) {
			var that = this,
				resize = false,
				resizableOptions = {};
	
			$.each( options, function( key, value ) {
				that._setOption( key, value );
	
				if ( key in that.sizeRelatedOptions ) {
					resize = true;
				}
				if ( key in that.resizableRelatedOptions ) {
					resizableOptions[ key ] = value;
				}
			} );
	
			if ( resize ) {
				this._size();
				this._position();
			}
			if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
				this.uiDialog.resizable( "option", resizableOptions );
			}
		},
	
		_setOption: function( key, value ) {
			var isDraggable, isResizable,
				uiDialog = this.uiDialog;
	
			if ( key === "disabled" ) {
				return;
			}
	
			this._super( key, value );
	
			if ( key === "appendTo" ) {
				this.uiDialog.appendTo( this._appendTo() );
			}
	
			if ( key === "buttons" ) {
				this._createButtons();
			}
	
			if ( key === "closeText" ) {
				this.uiDialogTitlebarClose.button( {
	
					// Ensure that we always pass a string
					label: $( "<a>" ).text( "" + this.options.closeText ).html()
				} );
			}
	
			if ( key === "draggable" ) {
				isDraggable = uiDialog.is( ":data(ui-draggable)" );
				if ( isDraggable && !value ) {
					uiDialog.draggable( "destroy" );
				}
	
				if ( !isDraggable && value ) {
					this._makeDraggable();
				}
			}
	
			if ( key === "position" ) {
				this._position();
			}
	
			if ( key === "resizable" ) {
	
				// currently resizable, becoming non-resizable
				isResizable = uiDialog.is( ":data(ui-resizable)" );
				if ( isResizable && !value ) {
					uiDialog.resizable( "destroy" );
				}
	
				// Currently resizable, changing handles
				if ( isResizable && typeof value === "string" ) {
					uiDialog.resizable( "option", "handles", value );
				}
	
				// Currently non-resizable, becoming resizable
				if ( !isResizable && value !== false ) {
					this._makeResizable();
				}
			}
	
			if ( key === "title" ) {
				this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
			}
		},
	
		_size: function() {
	
			// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
			// divs will both have width and height set, so we need to reset them
			var nonContentHeight, minContentHeight, maxContentHeight,
				options = this.options;
	
			// Reset content sizing
			this.element.show().css( {
				width: "auto",
				minHeight: 0,
				maxHeight: "none",
				height: 0
			} );
	
			if ( options.minWidth > options.width ) {
				options.width = options.minWidth;
			}
	
			// Reset wrapper sizing
			// determine the height of all the non-content elements
			nonContentHeight = this.uiDialog.css( {
				height: "auto",
				width: options.width
			} )
				.outerHeight();
			minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
			maxContentHeight = typeof options.maxHeight === "number" ?
				Math.max( 0, options.maxHeight - nonContentHeight ) :
				"none";
	
			if ( options.height === "auto" ) {
				this.element.css( {
					minHeight: minContentHeight,
					maxHeight: maxContentHeight,
					height: "auto"
				} );
			} else {
				this.element.height( Math.max( 0, options.height - nonContentHeight ) );
			}
	
			if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
				this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
			}
		},
	
		_blockFrames: function() {
			this.iframeBlocks = this.document.find( "iframe" ).map( function() {
				var iframe = $( this );
	
				return $( "<div>" )
					.css( {
						position: "absolute",
						width: iframe.outerWidth(),
						height: iframe.outerHeight()
					} )
					.appendTo( iframe.parent() )
					.offset( iframe.offset() )[ 0 ];
			} );
		},
	
		_unblockFrames: function() {
			if ( this.iframeBlocks ) {
				this.iframeBlocks.remove();
				delete this.iframeBlocks;
			}
		},
	
		_allowInteraction: function( event ) {
			if ( $( event.target ).closest( ".ui-dialog" ).length ) {
				return true;
			}
	
			// TODO: Remove hack when datepicker implements
			// the .ui-front logic (#8989)
			return !!$( event.target ).closest( ".ui-datepicker" ).length;
		},
	
		_createOverlay: function() {
			if ( !this.options.modal ) {
				return;
			}
	
			// We use a delay in case the overlay is created from an
			// event that we're going to be cancelling (#2804)
			var isOpening = true;
			this._delay( function() {
				isOpening = false;
			} );
	
			if ( !this.document.data( "ui-dialog-overlays" ) ) {
	
				// Prevent use of anchors and inputs
				// Using _on() for an event handler shared across many instances is
				// safe because the dialogs stack and must be closed in reverse order
				this._on( this.document, {
					focusin: function( event ) {
						if ( isOpening ) {
							return;
						}
	
						if ( !this._allowInteraction( event ) ) {
							event.preventDefault();
							this._trackingInstances()[ 0 ]._focusTabbable();
						}
					}
				} );
			}
	
			this.overlay = $( "<div>" )
				.appendTo( this._appendTo() );
	
			this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
			this._on( this.overlay, {
				mousedown: "_keepFocus"
			} );
			this.document.data( "ui-dialog-overlays",
				( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
		},
	
		_destroyOverlay: function() {
			if ( !this.options.modal ) {
				return;
			}
	
			if ( this.overlay ) {
				var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
	
				if ( !overlays ) {
					this._off( this.document, "focusin" );
					this.document.removeData( "ui-dialog-overlays" );
				} else {
					this.document.data( "ui-dialog-overlays", overlays );
				}
	
				this.overlay.remove();
				this.overlay = null;
			}
		}
	} );
	
	// DEPRECATED
	// TODO: switch return back to widget declaration at top of file when this is removed
	if ( $.uiBackCompat !== false ) {
	
		// Backcompat for dialogClass option
		$.widget( "ui.dialog", $.ui.dialog, {
			options: {
				dialogClass: ""
			},
			_createWrapper: function() {
				this._super();
				this.uiDialog.addClass( this.options.dialogClass );
			},
			_setOption: function( key, value ) {
				if ( key === "dialogClass" ) {
					this.uiDialog
						.removeClass( this.options.dialogClass )
						.addClass( value );
				}
				this._superApply( arguments );
			}
		} );
	}
	
	return $.ui.dialog;
	
	} ) );


/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Button 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Button
	//>>group: Widgets
	//>>description: Enhances a form with themeable buttons.
	//>>docs: http://api.jqueryui.com/button/
	//>>demos: http://jqueryui.com/button/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/button.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
	
				// These are only for backcompat
				// TODO: Remove after 1.12
				__webpack_require__(27),
				__webpack_require__(28),
	
				__webpack_require__(24),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	$.widget( "ui.button", {
		version: "1.12.1",
		defaultElement: "<button>",
		options: {
			classes: {
				"ui-button": "ui-corner-all"
			},
			disabled: null,
			icon: null,
			iconPosition: "beginning",
			label: null,
			showLabel: true
		},
	
		_getCreateOptions: function() {
			var disabled,
	
				// This is to support cases like in jQuery Mobile where the base widget does have
				// an implementation of _getCreateOptions
				options = this._super() || {};
	
			this.isInput = this.element.is( "input" );
	
			disabled = this.element[ 0 ].disabled;
			if ( disabled != null ) {
				options.disabled = disabled;
			}
	
			this.originalLabel = this.isInput ? this.element.val() : this.element.html();
			if ( this.originalLabel ) {
				options.label = this.originalLabel;
			}
	
			return options;
		},
	
		_create: function() {
			if ( !this.option.showLabel & !this.options.icon ) {
				this.options.showLabel = true;
			}
	
			// We have to check the option again here even though we did in _getCreateOptions,
			// because null may have been passed on init which would override what was set in
			// _getCreateOptions
			if ( this.options.disabled == null ) {
				this.options.disabled = this.element[ 0 ].disabled || false;
			}
	
			this.hasTitle = !!this.element.attr( "title" );
	
			// Check to see if the label needs to be set or if its already correct
			if ( this.options.label && this.options.label !== this.originalLabel ) {
				if ( this.isInput ) {
					this.element.val( this.options.label );
				} else {
					this.element.html( this.options.label );
				}
			}
			this._addClass( "ui-button", "ui-widget" );
			this._setOption( "disabled", this.options.disabled );
			this._enhance();
	
			if ( this.element.is( "a" ) ) {
				this._on( {
					"keyup": function( event ) {
						if ( event.keyCode === $.ui.keyCode.SPACE ) {
							event.preventDefault();
	
							// Support: PhantomJS <= 1.9, IE 8 Only
							// If a native click is available use it so we actually cause navigation
							// otherwise just trigger a click event
							if ( this.element[ 0 ].click ) {
								this.element[ 0 ].click();
							} else {
								this.element.trigger( "click" );
							}
						}
					}
				} );
			}
		},
	
		_enhance: function() {
			if ( !this.element.is( "button" ) ) {
				this.element.attr( "role", "button" );
			}
	
			if ( this.options.icon ) {
				this._updateIcon( "icon", this.options.icon );
				this._updateTooltip();
			}
		},
	
		_updateTooltip: function() {
			this.title = this.element.attr( "title" );
	
			if ( !this.options.showLabel && !this.title ) {
				this.element.attr( "title", this.options.label );
			}
		},
	
		_updateIcon: function( option, value ) {
			var icon = option !== "iconPosition",
				position = icon ? this.options.iconPosition : value,
				displayBlock = position === "top" || position === "bottom";
	
			// Create icon
			if ( !this.icon ) {
				this.icon = $( "<span>" );
	
				this._addClass( this.icon, "ui-button-icon", "ui-icon" );
	
				if ( !this.options.showLabel ) {
					this._addClass( "ui-button-icon-only" );
				}
			} else if ( icon ) {
	
				// If we are updating the icon remove the old icon class
				this._removeClass( this.icon, null, this.options.icon );
			}
	
			// If we are updating the icon add the new icon class
			if ( icon ) {
				this._addClass( this.icon, null, value );
			}
	
			this._attachIcon( position );
	
			// If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
			// the iconSpace if there is one.
			if ( displayBlock ) {
				this._addClass( this.icon, null, "ui-widget-icon-block" );
				if ( this.iconSpace ) {
					this.iconSpace.remove();
				}
			} else {
	
				// Position is beginning or end so remove the ui-widget-icon-block class and add the
				// space if it does not exist
				if ( !this.iconSpace ) {
					this.iconSpace = $( "<span> </span>" );
					this._addClass( this.iconSpace, "ui-button-icon-space" );
				}
				this._removeClass( this.icon, null, "ui-wiget-icon-block" );
				this._attachIconSpace( position );
			}
		},
	
		_destroy: function() {
			this.element.removeAttr( "role" );
	
			if ( this.icon ) {
				this.icon.remove();
			}
			if ( this.iconSpace ) {
				this.iconSpace.remove();
			}
			if ( !this.hasTitle ) {
				this.element.removeAttr( "title" );
			}
		},
	
		_attachIconSpace: function( iconPosition ) {
			this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
		},
	
		_attachIcon: function( iconPosition ) {
			this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
		},
	
		_setOptions: function( options ) {
			var newShowLabel = options.showLabel === undefined ?
					this.options.showLabel :
					options.showLabel,
				newIcon = options.icon === undefined ? this.options.icon : options.icon;
	
			if ( !newShowLabel && !newIcon ) {
				options.showLabel = true;
			}
			this._super( options );
		},
	
		_setOption: function( key, value ) {
			if ( key === "icon" ) {
				if ( value ) {
					this._updateIcon( key, value );
				} else if ( this.icon ) {
					this.icon.remove();
					if ( this.iconSpace ) {
						this.iconSpace.remove();
					}
				}
			}
	
			if ( key === "iconPosition" ) {
				this._updateIcon( key, value );
			}
	
			// Make sure we can't end up with a button that has neither text nor icon
			if ( key === "showLabel" ) {
					this._toggleClass( "ui-button-icon-only", null, !value );
					this._updateTooltip();
			}
	
			if ( key === "label" ) {
				if ( this.isInput ) {
					this.element.val( value );
				} else {
	
					// If there is an icon, append it, else nothing then append the value
					// this avoids removal of the icon when setting label text
					this.element.html( value );
					if ( this.icon ) {
						this._attachIcon( this.options.iconPosition );
						this._attachIconSpace( this.options.iconPosition );
					}
				}
			}
	
			this._super( key, value );
	
			if ( key === "disabled" ) {
				this._toggleClass( null, "ui-state-disabled", value );
				this.element[ 0 ].disabled = value;
				if ( value ) {
					this.element.blur();
				}
			}
		},
	
		refresh: function() {
	
			// Make sure to only check disabled if its an element that supports this otherwise
			// check for the disabled class to determine state
			var isDisabled = this.element.is( "input, button" ) ?
				this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
	
			if ( isDisabled !== this.options.disabled ) {
				this._setOptions( { disabled: isDisabled } );
			}
	
			this._updateTooltip();
		}
	} );
	
	// DEPRECATED
	if ( $.uiBackCompat !== false ) {
	
		// Text and Icons options
		$.widget( "ui.button", $.ui.button, {
			options: {
				text: true,
				icons: {
					primary: null,
					secondary: null
				}
			},
	
			_create: function() {
				if ( this.options.showLabel && !this.options.text ) {
					this.options.showLabel = this.options.text;
				}
				if ( !this.options.showLabel && this.options.text ) {
					this.options.text = this.options.showLabel;
				}
				if ( !this.options.icon && ( this.options.icons.primary ||
						this.options.icons.secondary ) ) {
					if ( this.options.icons.primary ) {
						this.options.icon = this.options.icons.primary;
					} else {
						this.options.icon = this.options.icons.secondary;
						this.options.iconPosition = "end";
					}
				} else if ( this.options.icon ) {
					this.options.icons.primary = this.options.icon;
				}
				this._super();
			},
	
			_setOption: function( key, value ) {
				if ( key === "text" ) {
					this._super( "showLabel", value );
					return;
				}
				if ( key === "showLabel" ) {
					this.options.text = value;
				}
				if ( key === "icon" ) {
					this.options.icons.primary = value;
				}
				if ( key === "icons" ) {
					if ( value.primary ) {
						this._super( "icon", value.primary );
						this._super( "iconPosition", "beginning" );
					} else if ( value.secondary ) {
						this._super( "icon", value.secondary );
						this._super( "iconPosition", "end" );
					}
				}
				this._superApply( arguments );
			}
		} );
	
		$.fn.button = ( function( orig ) {
			return function() {
				if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
						( this.length && this[ 0 ].tagName === "INPUT" && (
							this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
						) ) ) {
					return orig.apply( this, arguments );
				}
				if ( !$.ui.checkboxradio ) {
					$.error( "Checkboxradio widget missing" );
				}
				if ( arguments.length === 0 ) {
					return this.checkboxradio( {
						"icon": false
					} );
				}
				return this.checkboxradio.apply( this, arguments );
			};
		} )( $.fn.button );
	
		$.fn.buttonset = function() {
			if ( !$.ui.controlgroup ) {
				$.error( "Controlgroup widget missing" );
			}
			if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
				return this.controlgroup.apply( this,
					[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
			}
			if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
				return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
			}
			if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
				arguments[ 0 ].items = {
					button: arguments[ 0 ].items
				};
			}
			return this.controlgroup.apply( this, arguments );
		};
	}
	
	return $.ui.button;
	
	} ) );


/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Controlgroup 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Controlgroup
	//>>group: Widgets
	//>>description: Visually groups form control widgets
	//>>docs: http://api.jqueryui.com/controlgroup/
	//>>demos: http://jqueryui.com/controlgroup/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/controlgroup.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
	
	return $.widget( "ui.controlgroup", {
		version: "1.12.1",
		defaultElement: "<div>",
		options: {
			direction: "horizontal",
			disabled: null,
			onlyVisible: true,
			items: {
				"button": "input[type=button], input[type=submit], input[type=reset], button, a",
				"controlgroupLabel": ".ui-controlgroup-label",
				"checkboxradio": "input[type='checkbox'], input[type='radio']",
				"selectmenu": "select",
				"spinner": ".ui-spinner-input"
			}
		},
	
		_create: function() {
			this._enhance();
		},
	
		// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
		_enhance: function() {
			this.element.attr( "role", "toolbar" );
			this.refresh();
		},
	
		_destroy: function() {
			this._callChildMethod( "destroy" );
			this.childWidgets.removeData( "ui-controlgroup-data" );
			this.element.removeAttr( "role" );
			if ( this.options.items.controlgroupLabel ) {
				this.element
					.find( this.options.items.controlgroupLabel )
					.find( ".ui-controlgroup-label-contents" )
					.contents().unwrap();
			}
		},
	
		_initWidgets: function() {
			var that = this,
				childWidgets = [];
	
			// First we iterate over each of the items options
			$.each( this.options.items, function( widget, selector ) {
				var labels;
				var options = {};
	
				// Make sure the widget has a selector set
				if ( !selector ) {
					return;
				}
	
				if ( widget === "controlgroupLabel" ) {
					labels = that.element.find( selector );
					labels.each( function() {
						var element = $( this );
	
						if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
							return;
						}
						element.contents()
							.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
					} );
					that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
					childWidgets = childWidgets.concat( labels.get() );
					return;
				}
	
				// Make sure the widget actually exists
				if ( !$.fn[ widget ] ) {
					return;
				}
	
				// We assume everything is in the middle to start because we can't determine
				// first / last elements until all enhancments are done.
				if ( that[ "_" + widget + "Options" ] ) {
					options = that[ "_" + widget + "Options" ]( "middle" );
				} else {
					options = { classes: {} };
				}
	
				// Find instances of this widget inside controlgroup and init them
				that.element
					.find( selector )
					.each( function() {
						var element = $( this );
						var instance = element[ widget ]( "instance" );
	
						// We need to clone the default options for this type of widget to avoid
						// polluting the variable options which has a wider scope than a single widget.
						var instanceOptions = $.widget.extend( {}, options );
	
						// If the button is the child of a spinner ignore it
						// TODO: Find a more generic solution
						if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
							return;
						}
	
						// Create the widget if it doesn't exist
						if ( !instance ) {
							instance = element[ widget ]()[ widget ]( "instance" );
						}
						if ( instance ) {
							instanceOptions.classes =
								that._resolveClassesValues( instanceOptions.classes, instance );
						}
						element[ widget ]( instanceOptions );
	
						// Store an instance of the controlgroup to be able to reference
						// from the outermost element for changing options and refresh
						var widgetElement = element[ widget ]( "widget" );
						$.data( widgetElement[ 0 ], "ui-controlgroup-data",
							instance ? instance : element[ widget ]( "instance" ) );
	
						childWidgets.push( widgetElement[ 0 ] );
					} );
			} );
	
			this.childWidgets = $( $.unique( childWidgets ) );
			this._addClass( this.childWidgets, "ui-controlgroup-item" );
		},
	
		_callChildMethod: function( method ) {
			this.childWidgets.each( function() {
				var element = $( this ),
					data = element.data( "ui-controlgroup-data" );
				if ( data && data[ method ] ) {
					data[ method ]();
				}
			} );
		},
	
		_updateCornerClass: function( element, position ) {
			var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
			var add = this._buildSimpleOptions( position, "label" ).classes.label;
	
			this._removeClass( element, null, remove );
			this._addClass( element, null, add );
		},
	
		_buildSimpleOptions: function( position, key ) {
			var direction = this.options.direction === "vertical";
			var result = {
				classes: {}
			};
			result.classes[ key ] = {
				"middle": "",
				"first": "ui-corner-" + ( direction ? "top" : "left" ),
				"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
				"only": "ui-corner-all"
			}[ position ];
	
			return result;
		},
	
		_spinnerOptions: function( position ) {
			var options = this._buildSimpleOptions( position, "ui-spinner" );
	
			options.classes[ "ui-spinner-up" ] = "";
			options.classes[ "ui-spinner-down" ] = "";
	
			return options;
		},
	
		_buttonOptions: function( position ) {
			return this._buildSimpleOptions( position, "ui-button" );
		},
	
		_checkboxradioOptions: function( position ) {
			return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
		},
	
		_selectmenuOptions: function( position ) {
			var direction = this.options.direction === "vertical";
			return {
				width: direction ? "auto" : false,
				classes: {
					middle: {
						"ui-selectmenu-button-open": "",
						"ui-selectmenu-button-closed": ""
					},
					first: {
						"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
						"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
					},
					last: {
						"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
						"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
					},
					only: {
						"ui-selectmenu-button-open": "ui-corner-top",
						"ui-selectmenu-button-closed": "ui-corner-all"
					}
	
				}[ position ]
			};
		},
	
		_resolveClassesValues: function( classes, instance ) {
			var result = {};
			$.each( classes, function( key ) {
				var current = instance.options.classes[ key ] || "";
				current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
				result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
			} );
			return result;
		},
	
		_setOption: function( key, value ) {
			if ( key === "direction" ) {
				this._removeClass( "ui-controlgroup-" + this.options.direction );
			}
	
			this._super( key, value );
			if ( key === "disabled" ) {
				this._callChildMethod( value ? "disable" : "enable" );
				return;
			}
	
			this.refresh();
		},
	
		refresh: function() {
			var children,
				that = this;
	
			this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
	
			if ( this.options.direction === "horizontal" ) {
				this._addClass( null, "ui-helper-clearfix" );
			}
			this._initWidgets();
	
			children = this.childWidgets;
	
			// We filter here because we need to track all childWidgets not just the visible ones
			if ( this.options.onlyVisible ) {
				children = children.filter( ":visible" );
			}
	
			if ( children.length ) {
	
				// We do this last because we need to make sure all enhancment is done
				// before determining first and last
				$.each( [ "first", "last" ], function( index, value ) {
					var instance = children[ value ]().data( "ui-controlgroup-data" );
	
					if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
						var options = that[ "_" + instance.widgetName + "Options" ](
							children.length === 1 ? "only" : value
						);
						options.classes = that._resolveClassesValues( options.classes, instance );
						instance.element[ instance.widgetName ]( options );
					} else {
						that._updateCornerClass( children[ value ](), value );
					}
				} );
	
				// Finally call the refresh method on each of the child widgets.
				this._callChildMethod( "refresh" );
			}
		}
	} );
	} ) );


/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Checkboxradio 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Checkboxradio
	//>>group: Widgets
	//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
	//>>docs: http://api.jqueryui.com/checkboxradio/
	//>>demos: http://jqueryui.com/checkboxradio/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/button.css
	//>>css.structure: ../../themes/base/checkboxradio.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(29),
				__webpack_require__(30),
				__webpack_require__(32),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
		version: "1.12.1",
		options: {
			disabled: null,
			label: null,
			icon: true,
			classes: {
				"ui-checkboxradio-label": "ui-corner-all",
				"ui-checkboxradio-icon": "ui-corner-all"
			}
		},
	
		_getCreateOptions: function() {
			var disabled, labels;
			var that = this;
			var options = this._super() || {};
	
			// We read the type here, because it makes more sense to throw a element type error first,
			// rather then the error for lack of a label. Often if its the wrong type, it
			// won't have a label (e.g. calling on a div, btn, etc)
			this._readType();
	
			labels = this.element.labels();
	
			// If there are multiple labels, use the last one
			this.label = $( labels[ labels.length - 1 ] );
			if ( !this.label.length ) {
				$.error( "No label found for checkboxradio widget" );
			}
	
			this.originalLabel = "";
	
			// We need to get the label text but this may also need to make sure it does not contain the
			// input itself.
			this.label.contents().not( this.element[ 0 ] ).each( function() {
	
				// The label contents could be text, html, or a mix. We concat each element to get a
				// string representation of the label, without the input as part of it.
				that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
			} );
	
			// Set the label option if we found label text
			if ( this.originalLabel ) {
				options.label = this.originalLabel;
			}
	
			disabled = this.element[ 0 ].disabled;
			if ( disabled != null ) {
				options.disabled = disabled;
			}
			return options;
		},
	
		_create: function() {
			var checked = this.element[ 0 ].checked;
	
			this._bindFormResetHandler();
	
			if ( this.options.disabled == null ) {
				this.options.disabled = this.element[ 0 ].disabled;
			}
	
			this._setOption( "disabled", this.options.disabled );
			this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
			this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
	
			if ( this.type === "radio" ) {
				this._addClass( this.label, "ui-checkboxradio-radio-label" );
			}
	
			if ( this.options.label && this.options.label !== this.originalLabel ) {
				this._updateLabel();
			} else if ( this.originalLabel ) {
				this.options.label = this.originalLabel;
			}
	
			this._enhance();
	
			if ( checked ) {
				this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
				if ( this.icon ) {
					this._addClass( this.icon, null, "ui-state-hover" );
				}
			}
	
			this._on( {
				change: "_toggleClasses",
				focus: function() {
					this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
				},
				blur: function() {
					this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
				}
			} );
		},
	
		_readType: function() {
			var nodeName = this.element[ 0 ].nodeName.toLowerCase();
			this.type = this.element[ 0 ].type;
			if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
				$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
					" and element.type=" + this.type );
			}
		},
	
		// Support jQuery Mobile enhanced option
		_enhance: function() {
			this._updateIcon( this.element[ 0 ].checked );
		},
	
		widget: function() {
			return this.label;
		},
	
		_getRadioGroup: function() {
			var group;
			var name = this.element[ 0 ].name;
			var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";
	
			if ( !name ) {
				return $( [] );
			}
	
			if ( this.form.length ) {
				group = $( this.form[ 0 ].elements ).filter( nameSelector );
			} else {
	
				// Not inside a form, check all inputs that also are not inside a form
				group = $( nameSelector ).filter( function() {
					return $( this ).form().length === 0;
				} );
			}
	
			return group.not( this.element );
		},
	
		_toggleClasses: function() {
			var checked = this.element[ 0 ].checked;
			this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
	
			if ( this.options.icon && this.type === "checkbox" ) {
				this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
					._toggleClass( this.icon, null, "ui-icon-blank", !checked );
			}
	
			if ( this.type === "radio" ) {
				this._getRadioGroup()
					.each( function() {
						var instance = $( this ).checkboxradio( "instance" );
	
						if ( instance ) {
							instance._removeClass( instance.label,
								"ui-checkboxradio-checked", "ui-state-active" );
						}
					} );
			}
		},
	
		_destroy: function() {
			this._unbindFormResetHandler();
	
			if ( this.icon ) {
				this.icon.remove();
				this.iconSpace.remove();
			}
		},
	
		_setOption: function( key, value ) {
	
			// We don't allow the value to be set to nothing
			if ( key === "label" && !value ) {
				return;
			}
	
			this._super( key, value );
	
			if ( key === "disabled" ) {
				this._toggleClass( this.label, null, "ui-state-disabled", value );
				this.element[ 0 ].disabled = value;
	
				// Don't refresh when setting disabled
				return;
			}
			this.refresh();
		},
	
		_updateIcon: function( checked ) {
			var toAdd = "ui-icon ui-icon-background ";
	
			if ( this.options.icon ) {
				if ( !this.icon ) {
					this.icon = $( "<span>" );
					this.iconSpace = $( "<span> </span>" );
					this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
				}
	
				if ( this.type === "checkbox" ) {
					toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
					this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
				} else {
					toAdd += "ui-icon-blank";
				}
				this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
				if ( !checked ) {
					this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
				}
				this.icon.prependTo( this.label ).after( this.iconSpace );
			} else if ( this.icon !== undefined ) {
				this.icon.remove();
				this.iconSpace.remove();
				delete this.icon;
			}
		},
	
		_updateLabel: function() {
	
			// Remove the contents of the label ( minus the icon, icon space, and input )
			var contents = this.label.contents().not( this.element[ 0 ] );
			if ( this.icon ) {
				contents = contents.not( this.icon[ 0 ] );
			}
			if ( this.iconSpace ) {
				contents = contents.not( this.iconSpace[ 0 ] );
			}
			contents.remove();
	
			this.label.append( this.options.label );
		},
	
		refresh: function() {
			var checked = this.element[ 0 ].checked,
				isDisabled = this.element[ 0 ].disabled;
	
			this._updateIcon( checked );
			this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
			if ( this.options.label !== null ) {
				this._updateLabel();
			}
	
			if ( isDisabled !== this.options.disabled ) {
				this._setOptions( { "disabled": isDisabled } );
			}
		}
	
	} ] );
	
	return $.ui.checkboxradio;
	
	} ) );


/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	// Internal use only
	return $.ui.escapeSelector = ( function() {
		var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
		return function( selector ) {
			return selector.replace( selectorEscape, "\\$1" );
		};
	} )();
	
	} ) );


/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Form Reset Mixin 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Form Reset Mixin
	//>>group: Core
	//>>description: Refresh input widgets when their form is reset
	//>>docs: http://api.jqueryui.com/form-reset-mixin/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(31),
				__webpack_require__(16)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	return $.ui.formResetMixin = {
		_formResetHandler: function() {
			var form = $( this );
	
			// Wait for the form reset to actually happen before refreshing
			setTimeout( function() {
				var instances = form.data( "ui-form-reset-instances" );
				$.each( instances, function() {
					this.refresh();
				} );
			} );
		},
	
		_bindFormResetHandler: function() {
			this.form = this.element.form();
			if ( !this.form.length ) {
				return;
			}
	
			var instances = this.form.data( "ui-form-reset-instances" ) || [];
			if ( !instances.length ) {
	
				// We don't use _on() here because we use a single event handler per form
				this.form.on( "reset.ui-form-reset", this._formResetHandler );
			}
			instances.push( this );
			this.form.data( "ui-form-reset-instances", instances );
		},
	
		_unbindFormResetHandler: function() {
			if ( !this.form.length ) {
				return;
			}
	
			var instances = this.form.data( "ui-form-reset-instances" );
			instances.splice( $.inArray( this, instances ), 1 );
			if ( instances.length ) {
				this.form.data( "ui-form-reset-instances", instances );
			} else {
				this.form
					.removeData( "ui-form-reset-instances" )
					.off( "reset.ui-form-reset" );
			}
		}
	};
	
	} ) );


/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	// Support: IE8 Only
	// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
	// with a string, so we need to find the proper form.
	return $.fn.form = function() {
		return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
	};
	
	} ) );


/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Labels 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: labels
	//>>group: Core
	//>>description: Find all the labels associated with a given input
	//>>docs: http://api.jqueryui.com/labels/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16), __webpack_require__(29) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	return $.fn.labels = function() {
		var ancestor, selector, id, labels, ancestors;
	
		// Check control.labels first
		if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
			return this.pushStack( this[ 0 ].labels );
		}
	
		// Support: IE <= 11, FF <= 37, Android <= 2.3 only
		// Above browsers do not support control.labels. Everything below is to support them
		// as well as document fragments. control.labels does not work on document fragments
		labels = this.eq( 0 ).parents( "label" );
	
		// Look for the label based on the id
		id = this.attr( "id" );
		if ( id ) {
	
			// We don't search against the document in case the element
			// is disconnected from the DOM
			ancestor = this.eq( 0 ).parents().last();
	
			// Get a full set of top level ancestors
			ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
	
			// Create a selector for the label based on the id
			selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
	
			labels = labels.add( ancestors.find( selector ).addBack( selector ) );
	
		}
	
		// Return whatever we have found for labels
		return this.pushStack( labels );
	};
	
	} ) );


/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Resizable 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: Resizable
	//>>group: Interactions
	//>>description: Enables resize functionality for any element.
	//>>docs: http://api.jqueryui.com/resizable/
	//>>demos: http://jqueryui.com/resizable/
	//>>css.structure: ../../themes/base/core.css
	//>>css.structure: ../../themes/base/resizable.css
	//>>css.theme: ../../themes/base/theme.css
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
				__webpack_require__(11),
				__webpack_require__(14),
				__webpack_require__(34),
				__webpack_require__(19),
				__webpack_require__(16),
				__webpack_require__(17)
			], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	
	$.widget( "ui.resizable", $.ui.mouse, {
		version: "1.12.1",
		widgetEventPrefix: "resize",
		options: {
			alsoResize: false,
			animate: false,
			animateDuration: "slow",
			animateEasing: "swing",
			aspectRatio: false,
			autoHide: false,
			classes: {
				"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
			},
			containment: false,
			ghost: false,
			grid: false,
			handles: "e,s,se",
			helper: false,
			maxHeight: null,
			maxWidth: null,
			minHeight: 10,
			minWidth: 10,
	
			// See #7960
			zIndex: 90,
	
			// Callbacks
			resize: null,
			start: null,
			stop: null
		},
	
		_num: function( value ) {
			return parseFloat( value ) || 0;
		},
	
		_isNumber: function( value ) {
			return !isNaN( parseFloat( value ) );
		},
	
		_hasScroll: function( el, a ) {
	
			if ( $( el ).css( "overflow" ) === "hidden" ) {
				return false;
			}
	
			var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
				has = false;
	
			if ( el[ scroll ] > 0 ) {
				return true;
			}
	
			// TODO: determine which cases actually cause this to happen
			// if the element doesn't have the scroll set, see if it's possible to
			// set the scroll
			el[ scroll ] = 1;
			has = ( el[ scroll ] > 0 );
			el[ scroll ] = 0;
			return has;
		},
	
		_create: function() {
	
			var margins,
				o = this.options,
				that = this;
			this._addClass( "ui-resizable" );
	
			$.extend( this, {
				_aspectRatio: !!( o.aspectRatio ),
				aspectRatio: o.aspectRatio,
				originalElement: this.element,
				_proportionallyResizeElements: [],
				_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
			} );
	
			// Wrap the element if it cannot hold child nodes
			if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
	
				this.element.wrap(
					$( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
						position: this.element.css( "position" ),
						width: this.element.outerWidth(),
						height: this.element.outerHeight(),
						top: this.element.css( "top" ),
						left: this.element.css( "left" )
					} )
				);
	
				this.element = this.element.parent().data(
					"ui-resizable", this.element.resizable( "instance" )
				);
	
				this.elementIsWrapper = true;
	
				margins = {
					marginTop: this.originalElement.css( "marginTop" ),
					marginRight: this.originalElement.css( "marginRight" ),
					marginBottom: this.originalElement.css( "marginBottom" ),
					marginLeft: this.originalElement.css( "marginLeft" )
				};
	
				this.element.css( margins );
				this.originalElement.css( "margin", 0 );
	
				// support: Safari
				// Prevent Safari textarea resize
				this.originalResizeStyle = this.originalElement.css( "resize" );
				this.originalElement.css( "resize", "none" );
	
				this._proportionallyResizeElements.push( this.originalElement.css( {
					position: "static",
					zoom: 1,
					display: "block"
				} ) );
	
				// Support: IE9
				// avoid IE jump (hard set the margin)
				this.originalElement.css( margins );
	
				this._proportionallyResize();
			}
	
			this._setupHandles();
	
			if ( o.autoHide ) {
				$( this.element )
					.on( "mouseenter", function() {
						if ( o.disabled ) {
							return;
						}
						that._removeClass( "ui-resizable-autohide" );
						that._handles.show();
					} )
					.on( "mouseleave", function() {
						if ( o.disabled ) {
							return;
						}
						if ( !that.resizing ) {
							that._addClass( "ui-resizable-autohide" );
							that._handles.hide();
						}
					} );
			}
	
			this._mouseInit();
		},
	
		_destroy: function() {
	
			this._mouseDestroy();
	
			var wrapper,
				_destroy = function( exp ) {
					$( exp )
						.removeData( "resizable" )
						.removeData( "ui-resizable" )
						.off( ".resizable" )
						.find( ".ui-resizable-handle" )
							.remove();
				};
	
			// TODO: Unwrap at same DOM position
			if ( this.elementIsWrapper ) {
				_destroy( this.element );
				wrapper = this.element;
				this.originalElement.css( {
					position: wrapper.css( "position" ),
					width: wrapper.outerWidth(),
					height: wrapper.outerHeight(),
					top: wrapper.css( "top" ),
					left: wrapper.css( "left" )
				} ).insertAfter( wrapper );
				wrapper.remove();
			}
	
			this.originalElement.css( "resize", this.originalResizeStyle );
			_destroy( this.originalElement );
	
			return this;
		},
	
		_setOption: function( key, value ) {
			this._super( key, value );
	
			switch ( key ) {
			case "handles":
				this._removeHandles();
				this._setupHandles();
				break;
			default:
				break;
			}
		},
	
		_setupHandles: function() {
			var o = this.options, handle, i, n, hname, axis, that = this;
			this.handles = o.handles ||
				( !$( ".ui-resizable-handle", this.element ).length ?
					"e,s,se" : {
						n: ".ui-resizable-n",
						e: ".ui-resizable-e",
						s: ".ui-resizable-s",
						w: ".ui-resizable-w",
						se: ".ui-resizable-se",
						sw: ".ui-resizable-sw",
						ne: ".ui-resizable-ne",
						nw: ".ui-resizable-nw"
					} );
	
			this._handles = $();
			if ( this.handles.constructor === String ) {
	
				if ( this.handles === "all" ) {
					this.handles = "n,e,s,w,se,sw,ne,nw";
				}
	
				n = this.handles.split( "," );
				this.handles = {};
	
				for ( i = 0; i < n.length; i++ ) {
	
					handle = $.trim( n[ i ] );
					hname = "ui-resizable-" + handle;
					axis = $( "<div>" );
					this._addClass( axis, "ui-resizable-handle " + hname );
	
					axis.css( { zIndex: o.zIndex } );
	
					this.handles[ handle ] = ".ui-resizable-" + handle;
					this.element.append( axis );
				}
	
			}
	
			this._renderAxis = function( target ) {
	
				var i, axis, padPos, padWrapper;
	
				target = target || this.element;
	
				for ( i in this.handles ) {
	
					if ( this.handles[ i ].constructor === String ) {
						this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
					} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
						this.handles[ i ] = $( this.handles[ i ] );
						this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
					}
	
					if ( this.elementIsWrapper &&
							this.originalElement[ 0 ]
								.nodeName
								.match( /^(textarea|input|select|button)$/i ) ) {
						axis = $( this.handles[ i ], this.element );
	
						padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
							axis.outerHeight() :
							axis.outerWidth();
	
						padPos = [ "padding",
							/ne|nw|n/.test( i ) ? "Top" :
							/se|sw|s/.test( i ) ? "Bottom" :
							/^e$/.test( i ) ? "Right" : "Left" ].join( "" );
	
						target.css( padPos, padWrapper );
	
						this._proportionallyResize();
					}
	
					this._handles = this._handles.add( this.handles[ i ] );
				}
			};
	
			// TODO: make renderAxis a prototype function
			this._renderAxis( this.element );
	
			this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
			this._handles.disableSelection();
	
			this._handles.on( "mouseover", function() {
				if ( !that.resizing ) {
					if ( this.className ) {
						axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
					}
					that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
				}
			} );
	
			if ( o.autoHide ) {
				this._handles.hide();
				this._addClass( "ui-resizable-autohide" );
			}
		},
	
		_removeHandles: function() {
			this._handles.remove();
		},
	
		_mouseCapture: function( event ) {
			var i, handle,
				capture = false;
	
			for ( i in this.handles ) {
				handle = $( this.handles[ i ] )[ 0 ];
				if ( handle === event.target || $.contains( handle, event.target ) ) {
					capture = true;
				}
			}
	
			return !this.options.disabled && capture;
		},
	
		_mouseStart: function( event ) {
	
			var curleft, curtop, cursor,
				o = this.options,
				el = this.element;
	
			this.resizing = true;
	
			this._renderProxy();
	
			curleft = this._num( this.helper.css( "left" ) );
			curtop = this._num( this.helper.css( "top" ) );
	
			if ( o.containment ) {
				curleft += $( o.containment ).scrollLeft() || 0;
				curtop += $( o.containment ).scrollTop() || 0;
			}
	
			this.offset = this.helper.offset();
			this.position = { left: curleft, top: curtop };
	
			this.size = this._helper ? {
					width: this.helper.width(),
					height: this.helper.height()
				} : {
					width: el.width(),
					height: el.height()
				};
	
			this.originalSize = this._helper ? {
					width: el.outerWidth(),
					height: el.outerHeight()
				} : {
					width: el.width(),
					height: el.height()
				};
	
			this.sizeDiff = {
				width: el.outerWidth() - el.width(),
				height: el.outerHeight() - el.height()
			};
	
			this.originalPosition = { left: curleft, top: curtop };
			this.originalMousePosition = { left: event.pageX, top: event.pageY };
	
			this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
				o.aspectRatio :
				( ( this.originalSize.width / this.originalSize.height ) || 1 );
	
			cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
			$( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
	
			this._addClass( "ui-resizable-resizing" );
			this._propagate( "start", event );
			return true;
		},
	
		_mouseDrag: function( event ) {
	
			var data, props,
				smp = this.originalMousePosition,
				a = this.axis,
				dx = ( event.pageX - smp.left ) || 0,
				dy = ( event.pageY - smp.top ) || 0,
				trigger = this._change[ a ];
	
			this._updatePrevProperties();
	
			if ( !trigger ) {
				return false;
			}
	
			data = trigger.apply( this, [ event, dx, dy ] );
	
			this._updateVirtualBoundaries( event.shiftKey );
			if ( this._aspectRatio || event.shiftKey ) {
				data = this._updateRatio( data, event );
			}
	
			data = this._respectSize( data, event );
	
			this._updateCache( data );
	
			this._propagate( "resize", event );
	
			props = this._applyChanges();
	
			if ( !this._helper && this._proportionallyResizeElements.length ) {
				this._proportionallyResize();
			}
	
			if ( !$.isEmptyObject( props ) ) {
				this._updatePrevProperties();
				this._trigger( "resize", event, this.ui() );
				this._applyChanges();
			}
	
			return false;
		},
	
		_mouseStop: function( event ) {
	
			this.resizing = false;
			var pr, ista, soffseth, soffsetw, s, left, top,
				o = this.options, that = this;
	
			if ( this._helper ) {
	
				pr = this._proportionallyResizeElements;
				ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
				soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
				soffsetw = ista ? 0 : that.sizeDiff.width;
	
				s = {
					width: ( that.helper.width()  - soffsetw ),
					height: ( that.helper.height() - soffseth )
				};
				left = ( parseFloat( that.element.css( "left" ) ) +
					( that.position.left - that.originalPosition.left ) ) || null;
				top = ( parseFloat( that.element.css( "top" ) ) +
					( that.position.top - that.originalPosition.top ) ) || null;
	
				if ( !o.animate ) {
					this.element.css( $.extend( s, { top: top, left: left } ) );
				}
	
				that.helper.height( that.size.height );
				that.helper.width( that.size.width );
	
				if ( this._helper && !o.animate ) {
					this._proportionallyResize();
				}
			}
	
			$( "body" ).css( "cursor", "auto" );
	
			this._removeClass( "ui-resizable-resizing" );
	
			this._propagate( "stop", event );
	
			if ( this._helper ) {
				this.helper.remove();
			}
	
			return false;
	
		},
	
		_updatePrevProperties: function() {
			this.prevPosition = {
				top: this.position.top,
				left: this.position.left
			};
			this.prevSize = {
				width: this.size.width,
				height: this.size.height
			};
		},
	
		_applyChanges: function() {
			var props = {};
	
			if ( this.position.top !== this.prevPosition.top ) {
				props.top = this.position.top + "px";
			}
			if ( this.position.left !== this.prevPosition.left ) {
				props.left = this.position.left + "px";
			}
			if ( this.size.width !== this.prevSize.width ) {
				props.width = this.size.width + "px";
			}
			if ( this.size.height !== this.prevSize.height ) {
				props.height = this.size.height + "px";
			}
	
			this.helper.css( props );
	
			return props;
		},
	
		_updateVirtualBoundaries: function( forceAspectRatio ) {
			var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
				o = this.options;
	
			b = {
				minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
				maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
				minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
				maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
			};
	
			if ( this._aspectRatio || forceAspectRatio ) {
				pMinWidth = b.minHeight * this.aspectRatio;
				pMinHeight = b.minWidth / this.aspectRatio;
				pMaxWidth = b.maxHeight * this.aspectRatio;
				pMaxHeight = b.maxWidth / this.aspectRatio;
	
				if ( pMinWidth > b.minWidth ) {
					b.minWidth = pMinWidth;
				}
				if ( pMinHeight > b.minHeight ) {
					b.minHeight = pMinHeight;
				}
				if ( pMaxWidth < b.maxWidth ) {
					b.maxWidth = pMaxWidth;
				}
				if ( pMaxHeight < b.maxHeight ) {
					b.maxHeight = pMaxHeight;
				}
			}
			this._vBoundaries = b;
		},
	
		_updateCache: function( data ) {
			this.offset = this.helper.offset();
			if ( this._isNumber( data.left ) ) {
				this.position.left = data.left;
			}
			if ( this._isNumber( data.top ) ) {
				this.position.top = data.top;
			}
			if ( this._isNumber( data.height ) ) {
				this.size.height = data.height;
			}
			if ( this._isNumber( data.width ) ) {
				this.size.width = data.width;
			}
		},
	
		_updateRatio: function( data ) {
	
			var cpos = this.position,
				csize = this.size,
				a = this.axis;
	
			if ( this._isNumber( data.height ) ) {
				data.width = ( data.height * this.aspectRatio );
			} else if ( this._isNumber( data.width ) ) {
				data.height = ( data.width / this.aspectRatio );
			}
	
			if ( a === "sw" ) {
				data.left = cpos.left + ( csize.width - data.width );
				data.top = null;
			}
			if ( a === "nw" ) {
				data.top = cpos.top + ( csize.height - data.height );
				data.left = cpos.left + ( csize.width - data.width );
			}
	
			return data;
		},
	
		_respectSize: function( data ) {
	
			var o = this._vBoundaries,
				a = this.axis,
				ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
				ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
				isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
				isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
				dw = this.originalPosition.left + this.originalSize.width,
				dh = this.originalPosition.top + this.originalSize.height,
				cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
			if ( isminw ) {
				data.width = o.minWidth;
			}
			if ( isminh ) {
				data.height = o.minHeight;
			}
			if ( ismaxw ) {
				data.width = o.maxWidth;
			}
			if ( ismaxh ) {
				data.height = o.maxHeight;
			}
	
			if ( isminw && cw ) {
				data.left = dw - o.minWidth;
			}
			if ( ismaxw && cw ) {
				data.left = dw - o.maxWidth;
			}
			if ( isminh && ch ) {
				data.top = dh - o.minHeight;
			}
			if ( ismaxh && ch ) {
				data.top = dh - o.maxHeight;
			}
	
			// Fixing jump error on top/left - bug #2330
			if ( !data.width && !data.height && !data.left && data.top ) {
				data.top = null;
			} else if ( !data.width && !data.height && !data.top && data.left ) {
				data.left = null;
			}
	
			return data;
		},
	
		_getPaddingPlusBorderDimensions: function( element ) {
			var i = 0,
				widths = [],
				borders = [
					element.css( "borderTopWidth" ),
					element.css( "borderRightWidth" ),
					element.css( "borderBottomWidth" ),
					element.css( "borderLeftWidth" )
				],
				paddings = [
					element.css( "paddingTop" ),
					element.css( "paddingRight" ),
					element.css( "paddingBottom" ),
					element.css( "paddingLeft" )
				];
	
			for ( ; i < 4; i++ ) {
				widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
				widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
			}
	
			return {
				height: widths[ 0 ] + widths[ 2 ],
				width: widths[ 1 ] + widths[ 3 ]
			};
		},
	
		_proportionallyResize: function() {
	
			if ( !this._proportionallyResizeElements.length ) {
				return;
			}
	
			var prel,
				i = 0,
				element = this.helper || this.element;
	
			for ( ; i < this._proportionallyResizeElements.length; i++ ) {
	
				prel = this._proportionallyResizeElements[ i ];
	
				// TODO: Seems like a bug to cache this.outerDimensions
				// considering that we are in a loop.
				if ( !this.outerDimensions ) {
					this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
				}
	
				prel.css( {
					height: ( element.height() - this.outerDimensions.height ) || 0,
					width: ( element.width() - this.outerDimensions.width ) || 0
				} );
	
			}
	
		},
	
		_renderProxy: function() {
	
			var el = this.element, o = this.options;
			this.elementOffset = el.offset();
	
			if ( this._helper ) {
	
				this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );
	
				this._addClass( this.helper, this._helper );
				this.helper.css( {
					width: this.element.outerWidth(),
					height: this.element.outerHeight(),
					position: "absolute",
					left: this.elementOffset.left + "px",
					top: this.elementOffset.top + "px",
					zIndex: ++o.zIndex //TODO: Don't modify option
				} );
	
				this.helper
					.appendTo( "body" )
					.disableSelection();
	
			} else {
				this.helper = this.element;
			}
	
		},
	
		_change: {
			e: function( event, dx ) {
				return { width: this.originalSize.width + dx };
			},
			w: function( event, dx ) {
				var cs = this.originalSize, sp = this.originalPosition;
				return { left: sp.left + dx, width: cs.width - dx };
			},
			n: function( event, dx, dy ) {
				var cs = this.originalSize, sp = this.originalPosition;
				return { top: sp.top + dy, height: cs.height - dy };
			},
			s: function( event, dx, dy ) {
				return { height: this.originalSize.height + dy };
			},
			se: function( event, dx, dy ) {
				return $.extend( this._change.s.apply( this, arguments ),
					this._change.e.apply( this, [ event, dx, dy ] ) );
			},
			sw: function( event, dx, dy ) {
				return $.extend( this._change.s.apply( this, arguments ),
					this._change.w.apply( this, [ event, dx, dy ] ) );
			},
			ne: function( event, dx, dy ) {
				return $.extend( this._change.n.apply( this, arguments ),
					this._change.e.apply( this, [ event, dx, dy ] ) );
			},
			nw: function( event, dx, dy ) {
				return $.extend( this._change.n.apply( this, arguments ),
					this._change.w.apply( this, [ event, dx, dy ] ) );
			}
		},
	
		_propagate: function( n, event ) {
			$.ui.plugin.call( this, n, [ event, this.ui() ] );
			( n !== "resize" && this._trigger( n, event, this.ui() ) );
		},
	
		plugins: {},
	
		ui: function() {
			return {
				originalElement: this.originalElement,
				element: this.element,
				helper: this.helper,
				position: this.position,
				size: this.size,
				originalSize: this.originalSize,
				originalPosition: this.originalPosition
			};
		}
	
	} );
	
	/*
	 * Resizable Extensions
	 */
	
	$.ui.plugin.add( "resizable", "animate", {
	
		stop: function( event ) {
			var that = $( this ).resizable( "instance" ),
				o = that.options,
				pr = that._proportionallyResizeElements,
				ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
				soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
				soffsetw = ista ? 0 : that.sizeDiff.width,
				style = {
					width: ( that.size.width - soffsetw ),
					height: ( that.size.height - soffseth )
				},
				left = ( parseFloat( that.element.css( "left" ) ) +
					( that.position.left - that.originalPosition.left ) ) || null,
				top = ( parseFloat( that.element.css( "top" ) ) +
					( that.position.top - that.originalPosition.top ) ) || null;
	
			that.element.animate(
				$.extend( style, top && left ? { top: top, left: left } : {} ), {
					duration: o.animateDuration,
					easing: o.animateEasing,
					step: function() {
	
						var data = {
							width: parseFloat( that.element.css( "width" ) ),
							height: parseFloat( that.element.css( "height" ) ),
							top: parseFloat( that.element.css( "top" ) ),
							left: parseFloat( that.element.css( "left" ) )
						};
	
						if ( pr && pr.length ) {
							$( pr[ 0 ] ).css( { width: data.width, height: data.height } );
						}
	
						// Propagating resize, and updating values for each animation step
						that._updateCache( data );
						that._propagate( "resize", event );
	
					}
				}
			);
		}
	
	} );
	
	$.ui.plugin.add( "resizable", "containment", {
	
		start: function() {
			var element, p, co, ch, cw, width, height,
				that = $( this ).resizable( "instance" ),
				o = that.options,
				el = that.element,
				oc = o.containment,
				ce = ( oc instanceof $ ) ?
					oc.get( 0 ) :
					( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
	
			if ( !ce ) {
				return;
			}
	
			that.containerElement = $( ce );
	
			if ( /document/.test( oc ) || oc === document ) {
				that.containerOffset = {
					left: 0,
					top: 0
				};
				that.containerPosition = {
					left: 0,
					top: 0
				};
	
				that.parentData = {
					element: $( document ),
					left: 0,
					top: 0,
					width: $( document ).width(),
					height: $( document ).height() || document.body.parentNode.scrollHeight
				};
			} else {
				element = $( ce );
				p = [];
				$( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
					p[ i ] = that._num( element.css( "padding" + name ) );
				} );
	
				that.containerOffset = element.offset();
				that.containerPosition = element.position();
				that.containerSize = {
					height: ( element.innerHeight() - p[ 3 ] ),
					width: ( element.innerWidth() - p[ 1 ] )
				};
	
				co = that.containerOffset;
				ch = that.containerSize.height;
				cw = that.containerSize.width;
				width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
				height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
	
				that.parentData = {
					element: ce,
					left: co.left,
					top: co.top,
					width: width,
					height: height
				};
			}
		},
	
		resize: function( event ) {
			var woset, hoset, isParent, isOffsetRelative,
				that = $( this ).resizable( "instance" ),
				o = that.options,
				co = that.containerOffset,
				cp = that.position,
				pRatio = that._aspectRatio || event.shiftKey,
				cop = {
					top: 0,
					left: 0
				},
				ce = that.containerElement,
				continueResize = true;
	
			if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
				cop = co;
			}
	
			if ( cp.left < ( that._helper ? co.left : 0 ) ) {
				that.size.width = that.size.width +
					( that._helper ?
						( that.position.left - co.left ) :
						( that.position.left - cop.left ) );
	
				if ( pRatio ) {
					that.size.height = that.size.width / that.aspectRatio;
					continueResize = false;
				}
				that.position.left = o.helper ? co.left : 0;
			}
	
			if ( cp.top < ( that._helper ? co.top : 0 ) ) {
				that.size.height = that.size.height +
					( that._helper ?
						( that.position.top - co.top ) :
						that.position.top );
	
				if ( pRatio ) {
					that.size.width = that.size.height * that.aspectRatio;
					continueResize = false;
				}
				that.position.top = that._helper ? co.top : 0;
			}
	
			isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
			isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
	
			if ( isParent && isOffsetRelative ) {
				that.offset.left = that.parentData.left + that.position.left;
				that.offset.top = that.parentData.top + that.position.top;
			} else {
				that.offset.left = that.element.offset().left;
				that.offset.top = that.element.offset().top;
			}
	
			woset = Math.abs( that.sizeDiff.width +
				( that._helper ?
					that.offset.left - cop.left :
					( that.offset.left - co.left ) ) );
	
			hoset = Math.abs( that.sizeDiff.height +
				( that._helper ?
					that.offset.top - cop.top :
					( that.offset.top - co.top ) ) );
	
			if ( woset + that.size.width >= that.parentData.width ) {
				that.size.width = that.parentData.width - woset;
				if ( pRatio ) {
					that.size.height = that.size.width / that.aspectRatio;
					continueResize = false;
				}
			}
	
			if ( hoset + that.size.height >= that.parentData.height ) {
				that.size.height = that.parentData.height - hoset;
				if ( pRatio ) {
					that.size.width = that.size.height * that.aspectRatio;
					continueResize = false;
				}
			}
	
			if ( !continueResize ) {
				that.position.left = that.prevPosition.left;
				that.position.top = that.prevPosition.top;
				that.size.width = that.prevSize.width;
				that.size.height = that.prevSize.height;
			}
		},
	
		stop: function() {
			var that = $( this ).resizable( "instance" ),
				o = that.options,
				co = that.containerOffset,
				cop = that.containerPosition,
				ce = that.containerElement,
				helper = $( that.helper ),
				ho = helper.offset(),
				w = helper.outerWidth() - that.sizeDiff.width,
				h = helper.outerHeight() - that.sizeDiff.height;
	
			if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
				$( this ).css( {
					left: ho.left - cop.left - co.left,
					width: w,
					height: h
				} );
			}
	
			if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
				$( this ).css( {
					left: ho.left - cop.left - co.left,
					width: w,
					height: h
				} );
			}
		}
	} );
	
	$.ui.plugin.add( "resizable", "alsoResize", {
	
		start: function() {
			var that = $( this ).resizable( "instance" ),
				o = that.options;
	
			$( o.alsoResize ).each( function() {
				var el = $( this );
				el.data( "ui-resizable-alsoresize", {
					width: parseFloat( el.width() ), height: parseFloat( el.height() ),
					left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
				} );
			} );
		},
	
		resize: function( event, ui ) {
			var that = $( this ).resizable( "instance" ),
				o = that.options,
				os = that.originalSize,
				op = that.originalPosition,
				delta = {
					height: ( that.size.height - os.height ) || 0,
					width: ( that.size.width - os.width ) || 0,
					top: ( that.position.top - op.top ) || 0,
					left: ( that.position.left - op.left ) || 0
				};
	
				$( o.alsoResize ).each( function() {
					var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
						css = el.parents( ui.originalElement[ 0 ] ).length ?
								[ "width", "height" ] :
								[ "width", "height", "top", "left" ];
	
					$.each( css, function( i, prop ) {
						var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
						if ( sum && sum >= 0 ) {
							style[ prop ] = sum || null;
						}
					} );
	
					el.css( style );
				} );
		},
	
		stop: function() {
			$( this ).removeData( "ui-resizable-alsoresize" );
		}
	} );
	
	$.ui.plugin.add( "resizable", "ghost", {
	
		start: function() {
	
			var that = $( this ).resizable( "instance" ), cs = that.size;
	
			that.ghost = that.originalElement.clone();
			that.ghost.css( {
				opacity: 0.25,
				display: "block",
				position: "relative",
				height: cs.height,
				width: cs.width,
				margin: 0,
				left: 0,
				top: 0
			} );
	
			that._addClass( that.ghost, "ui-resizable-ghost" );
	
			// DEPRECATED
			// TODO: remove after 1.12
			if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
	
				// Ghost option
				that.ghost.addClass( this.options.ghost );
			}
	
			that.ghost.appendTo( that.helper );
	
		},
	
		resize: function() {
			var that = $( this ).resizable( "instance" );
			if ( that.ghost ) {
				that.ghost.css( {
					position: "relative",
					height: that.size.height,
					width: that.size.width
				} );
			}
		},
	
		stop: function() {
			var that = $( this ).resizable( "instance" );
			if ( that.ghost && that.helper ) {
				that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
			}
		}
	
	} );
	
	$.ui.plugin.add( "resizable", "grid", {
	
		resize: function() {
			var outerDimensions,
				that = $( this ).resizable( "instance" ),
				o = that.options,
				cs = that.size,
				os = that.originalSize,
				op = that.originalPosition,
				a = that.axis,
				grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
				gridX = ( grid[ 0 ] || 1 ),
				gridY = ( grid[ 1 ] || 1 ),
				ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
				oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
				newWidth = os.width + ox,
				newHeight = os.height + oy,
				isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
				isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
				isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
				isMinHeight = o.minHeight && ( o.minHeight > newHeight );
	
			o.grid = grid;
	
			if ( isMinWidth ) {
				newWidth += gridX;
			}
			if ( isMinHeight ) {
				newHeight += gridY;
			}
			if ( isMaxWidth ) {
				newWidth -= gridX;
			}
			if ( isMaxHeight ) {
				newHeight -= gridY;
			}
	
			if ( /^(se|s|e)$/.test( a ) ) {
				that.size.width = newWidth;
				that.size.height = newHeight;
			} else if ( /^(ne)$/.test( a ) ) {
				that.size.width = newWidth;
				that.size.height = newHeight;
				that.position.top = op.top - oy;
			} else if ( /^(sw)$/.test( a ) ) {
				that.size.width = newWidth;
				that.size.height = newHeight;
				that.position.left = op.left - ox;
			} else {
				if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
					outerDimensions = that._getPaddingPlusBorderDimensions( this );
				}
	
				if ( newHeight - gridY > 0 ) {
					that.size.height = newHeight;
					that.position.top = op.top - oy;
				} else {
					newHeight = gridY - outerDimensions.height;
					that.size.height = newHeight;
					that.position.top = op.top + os.height - newHeight;
				}
				if ( newWidth - gridX > 0 ) {
					that.size.width = newWidth;
					that.position.left = op.left - ox;
				} else {
					newWidth = gridX - outerDimensions.width;
					that.size.width = newWidth;
					that.position.left = op.left + os.width - newWidth;
				}
			}
		}
	
	} );
	
	return $.ui.resizable;
	
	} ) );


/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Disable Selection 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: disableSelection
	//>>group: Core
	//>>description: Disable selection of text content within the set of matched elements.
	//>>docs: http://api.jqueryui.com/disableSelection/
	
	// This file is deprecated
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	return $.fn.extend( {
		disableSelection: ( function() {
			var eventType = "onselectstart" in document.createElement( "div" ) ?
				"selectstart" :
				"mousedown";
	
			return function() {
				return this.on( eventType + ".ui-disableSelection", function( event ) {
					event.preventDefault();
				} );
			};
		} )(),
	
		enableSelection: function() {
			return this.off( ".ui-disableSelection" );
		}
	} );
	
	} ) );


/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Focusable 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: :focusable Selector
	//>>group: Core
	//>>description: Selects elements which can be focused.
	//>>docs: http://api.jqueryui.com/focusable-selector/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	// Selectors
	$.ui.focusable = function( element, hasTabindex ) {
		var map, mapName, img, focusableIfVisible, fieldset,
			nodeName = element.nodeName.toLowerCase();
	
		if ( "area" === nodeName ) {
			map = element.parentNode;
			mapName = map.name;
			if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
				return false;
			}
			img = $( "img[usemap='#" + mapName + "']" );
			return img.length > 0 && img.is( ":visible" );
		}
	
		if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
			focusableIfVisible = !element.disabled;
	
			if ( focusableIfVisible ) {
	
				// Form controls within a disabled fieldset are disabled.
				// However, controls within the fieldset's legend do not get disabled.
				// Since controls generally aren't placed inside legends, we skip
				// this portion of the check.
				fieldset = $( element ).closest( "fieldset" )[ 0 ];
				if ( fieldset ) {
					focusableIfVisible = !fieldset.disabled;
				}
			}
		} else if ( "a" === nodeName ) {
			focusableIfVisible = element.href || hasTabindex;
		} else {
			focusableIfVisible = hasTabindex;
		}
	
		return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
	};
	
	// Support: IE 8 only
	// IE 8 doesn't resolve inherit to visible/hidden for computed values
	function visible( element ) {
		var visibility = element.css( "visibility" );
		while ( visibility === "inherit" ) {
			element = element.parent();
			visibility = element.css( "visibility" );
		}
		return visibility !== "hidden";
	}
	
	$.extend( $.expr[ ":" ], {
		focusable: function( element ) {
			return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
		}
	} );
	
	return $.ui.focusable;
	
	} ) );


/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Tabbable 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: :tabbable Selector
	//>>group: Core
	//>>description: Selects elements which can be tabbed to.
	//>>docs: http://api.jqueryui.com/tabbable-selector/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16), __webpack_require__(35) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	return $.extend( $.expr[ ":" ], {
		tabbable: function( element ) {
			var tabIndex = $.attr( element, "tabindex" ),
				hasTabindex = tabIndex != null;
			return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
		}
	} );
	
	} ) );


/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Unique ID 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 */
	
	//>>label: uniqueId
	//>>group: Core
	//>>description: Functions to generate and remove uniqueId's
	//>>docs: http://api.jqueryui.com/uniqueId/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	} ( function( $ ) {
	
	return $.fn.extend( {
		uniqueId: ( function() {
			var uuid = 0;
	
			return function() {
				return this.each( function() {
					if ( !this.id ) {
						this.id = "ui-id-" + ( ++uuid );
					}
				} );
			};
		} )(),
	
		removeUniqueId: function() {
			return this.each( function() {
				if ( /^ui-id-\d+$/.test( this.id ) ) {
					$( this ).removeAttr( "id" );
				}
			} );
		}
	} );
	
	} ) );


/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {

	var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	 * jQuery UI Position 1.12.1
	 * http://jqueryui.com
	 *
	 * Copyright jQuery Foundation and other contributors
	 * Released under the MIT license.
	 * http://jquery.org/license
	 *
	 * http://api.jqueryui.com/position/
	 */
	
	//>>label: Position
	//>>group: Core
	//>>description: Positions elements relative to other elements.
	//>>docs: http://api.jqueryui.com/position/
	//>>demos: http://jqueryui.com/position/
	
	( function( factory ) {
		if ( true ) {
	
			// AMD. Register as an anonymous module.
			!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(11), __webpack_require__(16) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
		} else {
	
			// Browser globals
			factory( jQuery );
		}
	}( function( $ ) {
	( function() {
	var cachedScrollbarWidth,
		max = Math.max,
		abs = Math.abs,
		rhorizontal = /left|center|right/,
		rvertical = /top|center|bottom/,
		roffset = /[\+\-]\d+(\.[\d]+)?%?/,
		rposition = /^\w+/,
		rpercent = /%$/,
		_position = $.fn.position;
	
	function getOffsets( offsets, width, height ) {
		return [
			parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
			parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
		];
	}
	
	function parseCss( element, property ) {
		return parseInt( $.css( element, property ), 10 ) || 0;
	}
	
	function getDimensions( elem ) {
		var raw = elem[ 0 ];
		if ( raw.nodeType === 9 ) {
			return {
				width: elem.width(),
				height: elem.height(),
				offset: { top: 0, left: 0 }
			};
		}
		if ( $.isWindow( raw ) ) {
			return {
				width: elem.width(),
				height: elem.height(),
				offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
			};
		}
		if ( raw.preventDefault ) {
			return {
				width: 0,
				height: 0,
				offset: { top: raw.pageY, left: raw.pageX }
			};
		}
		return {
			width: elem.outerWidth(),
			height: elem.outerHeight(),
			offset: elem.offset()
		};
	}
	
	$.position = {
		scrollbarWidth: function() {
			if ( cachedScrollbarWidth !== undefined ) {
				return cachedScrollbarWidth;
			}
			var w1, w2,
				div = $( "<div " +
					"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
					"<div style='height:100px;width:auto;'></div></div>" ),
				innerDiv = div.children()[ 0 ];
	
			$( "body" ).append( div );
			w1 = innerDiv.offsetWidth;
			div.css( "overflow", "scroll" );
	
			w2 = innerDiv.offsetWidth;
	
			if ( w1 === w2 ) {
				w2 = div[ 0 ].clientWidth;
			}
	
			div.remove();
	
			return ( cachedScrollbarWidth = w1 - w2 );
		},
		getScrollInfo: function( within ) {
			var overflowX = within.isWindow || within.isDocument ? "" :
					within.element.css( "overflow-x" ),
				overflowY = within.isWindow || within.isDocument ? "" :
					within.element.css( "overflow-y" ),
				hasOverflowX = overflowX === "scroll" ||
					( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
				hasOverflowY = overflowY === "scroll" ||
					( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
			return {
				width: hasOverflowY ? $.position.scrollbarWidth() : 0,
				height: hasOverflowX ? $.position.scrollbarWidth() : 0
			};
		},
		getWithinInfo: function( element ) {
			var withinElement = $( element || window ),
				isWindow = $.isWindow( withinElement[ 0 ] ),
				isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
				hasOffset = !isWindow && !isDocument;
			return {
				element: withinElement,
				isWindow: isWindow,
				isDocument: isDocument,
				offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
				scrollLeft: withinElement.scrollLeft(),
				scrollTop: withinElement.scrollTop(),
				width: withinElement.outerWidth(),
				height: withinElement.outerHeight()
			};
		}
	};
	
	$.fn.position = function( options ) {
		if ( !options || !options.of ) {
			return _position.apply( this, arguments );
		}
	
		// Make a copy, we don't want to modify arguments
		options = $.extend( {}, options );
	
		var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
			target = $( options.of ),
			within = $.position.getWithinInfo( options.within ),
			scrollInfo = $.position.getScrollInfo( within ),
			collision = ( options.collision || "flip" ).split( " " ),
			offsets = {};
	
		dimensions = getDimensions( target );
		if ( target[ 0 ].preventDefault ) {
	
			// Force left top to allow flipping
			options.at = "left top";
		}
		targetWidth = dimensions.width;
		targetHeight = dimensions.height;
		targetOffset = dimensions.offset;
	
		// Clone to reuse original targetOffset later
		basePosition = $.extend( {}, targetOffset );
	
		// Force my and at to have valid horizontal and vertical positions
		// if a value is missing or invalid, it will be converted to center
		$.each( [ "my", "at" ], function() {
			var pos = ( options[ this ] || "" ).split( " " ),
				horizontalOffset,
				verticalOffset;
	
			if ( pos.length === 1 ) {
				pos = rhorizontal.test( pos[ 0 ] ) ?
					pos.concat( [ "center" ] ) :
					rvertical.test( pos[ 0 ] ) ?
						[ "center" ].concat( pos ) :
						[ "center", "center" ];
			}
			pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
			pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
	
			// Calculate offsets
			horizontalOffset = roffset.exec( pos[ 0 ] );
			verticalOffset = roffset.exec( pos[ 1 ] );
			offsets[ this ] = [
				horizontalOffset ? horizontalOffset[ 0 ] : 0,
				verticalOffset ? verticalOffset[ 0 ] : 0
			];
	
			// Reduce to just the positions without the offsets
			options[ this ] = [
				rposition.exec( pos[ 0 ] )[ 0 ],
				rposition.exec( pos[ 1 ] )[ 0 ]
			];
		} );
	
		// Normalize collision option
		if ( collision.length === 1 ) {
			collision[ 1 ] = collision[ 0 ];
		}
	
		if ( options.at[ 0 ] === "right" ) {
			basePosition.left += targetWidth;
		} else if ( options.at[ 0 ] === "center" ) {
			basePosition.left += targetWidth / 2;
		}
	
		if ( options.at[ 1 ] === "bottom" ) {
			basePosition.top += targetHeight;
		} else if ( options.at[ 1 ] === "center" ) {
			basePosition.top += targetHeight / 2;
		}
	
		atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
		basePosition.left += atOffset[ 0 ];
		basePosition.top += atOffset[ 1 ];
	
		return this.each( function() {
			var collisionPosition, using,
				elem = $( this ),
				elemWidth = elem.outerWidth(),
				elemHeight = elem.outerHeight(),
				marginLeft = parseCss( this, "marginLeft" ),
				marginTop = parseCss( this, "marginTop" ),
				collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
					scrollInfo.width,
				collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
					scrollInfo.height,
				position = $.extend( {}, basePosition ),
				myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
	
			if ( options.my[ 0 ] === "right" ) {
				position.left -= elemWidth;
			} else if ( options.my[ 0 ] === "center" ) {
				position.left -= elemWidth / 2;
			}
	
			if ( options.my[ 1 ] === "bottom" ) {
				position.top -= elemHeight;
			} else if ( options.my[ 1 ] === "center" ) {
				position.top -= elemHeight / 2;
			}
	
			position.left += myOffset[ 0 ];
			position.top += myOffset[ 1 ];
	
			collisionPosition = {
				marginLeft: marginLeft,
				marginTop: marginTop
			};
	
			$.each( [ "left", "top" ], function( i, dir ) {
				if ( $.ui.position[ collision[ i ] ] ) {
					$.ui.position[ collision[ i ] ][ dir ]( position, {
						targetWidth: targetWidth,
						targetHeight: targetHeight,
						elemWidth: elemWidth,
						elemHeight: elemHeight,
						collisionPosition: collisionPosition,
						collisionWidth: collisionWidth,
						collisionHeight: collisionHeight,
						offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
						my: options.my,
						at: options.at,
						within: within,
						elem: elem
					} );
				}
			} );
	
			if ( options.using ) {
	
				// Adds feedback as second argument to using callback, if present
				using = function( props ) {
					var left = targetOffset.left - position.left,
						right = left + targetWidth - elemWidth,
						top = targetOffset.top - position.top,
						bottom = top + targetHeight - elemHeight,
						feedback = {
							target: {
								element: target,
								left: targetOffset.left,
								top: targetOffset.top,
								width: targetWidth,
								height: targetHeight
							},
							element: {
								element: elem,
								left: position.left,
								top: position.top,
								width: elemWidth,
								height: elemHeight
							},
							horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
							vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
						};
					if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
						feedback.horizontal = "center";
					}
					if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
						feedback.vertical = "middle";
					}
					if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
						feedback.important = "horizontal";
					} else {
						feedback.important = "vertical";
					}
					options.using.call( this, props, feedback );
				};
			}
	
			elem.offset( $.extend( position, { using: using } ) );
		} );
	};
	
	$.ui.position = {
		fit: {
			left: function( position, data ) {
				var within = data.within,
					withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
					outerWidth = within.width,
					collisionPosLeft = position.left - data.collisionPosition.marginLeft,
					overLeft = withinOffset - collisionPosLeft,
					overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
					newOverRight;
	
				// Element is wider than within
				if ( data.collisionWidth > outerWidth ) {
	
					// Element is initially over the left side of within
					if ( overLeft > 0 && overRight <= 0 ) {
						newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
							withinOffset;
						position.left += overLeft - newOverRight;
	
					// Element is initially over right side of within
					} else if ( overRight > 0 && overLeft <= 0 ) {
						position.left = withinOffset;
	
					// Element is initially over both left and right sides of within
					} else {
						if ( overLeft > overRight ) {
							position.left = withinOffset + outerWidth - data.collisionWidth;
						} else {
							position.left = withinOffset;
						}
					}
	
				// Too far left -> align with left edge
				} else if ( overLeft > 0 ) {
					position.left += overLeft;
	
				// Too far right -> align with right edge
				} else if ( overRight > 0 ) {
					position.left -= overRight;
	
				// Adjust based on position and margin
				} else {
					position.left = max( position.left - collisionPosLeft, position.left );
				}
			},
			top: function( position, data ) {
				var within = data.within,
					withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
					outerHeight = data.within.height,
					collisionPosTop = position.top - data.collisionPosition.marginTop,
					overTop = withinOffset - collisionPosTop,
					overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
					newOverBottom;
	
				// Element is taller than within
				if ( data.collisionHeight > outerHeight ) {
	
					// Element is initially over the top of within
					if ( overTop > 0 && overBottom <= 0 ) {
						newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
							withinOffset;
						position.top += overTop - newOverBottom;
	
					// Element is initially over bottom of within
					} else if ( overBottom > 0 && overTop <= 0 ) {
						position.top = withinOffset;
	
					// Element is initially over both top and bottom of within
					} else {
						if ( overTop > overBottom ) {
							position.top = withinOffset + outerHeight - data.collisionHeight;
						} else {
							position.top = withinOffset;
						}
					}
	
				// Too far up -> align with top
				} else if ( overTop > 0 ) {
					position.top += overTop;
	
				// Too far down -> align with bottom edge
				} else if ( overBottom > 0 ) {
					position.top -= overBottom;
	
				// Adjust based on position and margin
				} else {
					position.top = max( position.top - collisionPosTop, position.top );
				}
			}
		},
		flip: {
			left: function( position, data ) {
				var within = data.within,
					withinOffset = within.offset.left + within.scrollLeft,
					outerWidth = within.width,
					offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
					collisionPosLeft = position.left - data.collisionPosition.marginLeft,
					overLeft = collisionPosLeft - offsetLeft,
					overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
					myOffset = data.my[ 0 ] === "left" ?
						-data.elemWidth :
						data.my[ 0 ] === "right" ?
							data.elemWidth :
							0,
					atOffset = data.at[ 0 ] === "left" ?
						data.targetWidth :
						data.at[ 0 ] === "right" ?
							-data.targetWidth :
							0,
					offset = -2 * data.offset[ 0 ],
					newOverRight,
					newOverLeft;
	
				if ( overLeft < 0 ) {
					newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
						outerWidth - withinOffset;
					if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
						position.left += myOffset + atOffset + offset;
					}
				} else if ( overRight > 0 ) {
					newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
						atOffset + offset - offsetLeft;
					if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
						position.left += myOffset + atOffset + offset;
					}
				}
			},
			top: function( position, data ) {
				var within = data.within,
					withinOffset = within.offset.top + within.scrollTop,
					outerHeight = within.height,
					offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
					collisionPosTop = position.top - data.collisionPosition.marginTop,
					overTop = collisionPosTop - offsetTop,
					overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
					top = data.my[ 1 ] === "top",
					myOffset = top ?
						-data.elemHeight :
						data.my[ 1 ] === "bottom" ?
							data.elemHeight :
							0,
					atOffset = data.at[ 1 ] === "top" ?
						data.targetHeight :
						data.at[ 1 ] === "bottom" ?
							-data.targetHeight :
							0,
					offset = -2 * data.offset[ 1 ],
					newOverTop,
					newOverBottom;
				if ( overTop < 0 ) {
					newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
						outerHeight - withinOffset;
					if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
						position.top += myOffset + atOffset + offset;
					}
				} else if ( overBottom > 0 ) {
					newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
						offset - offsetTop;
					if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
						position.top += myOffset + atOffset + offset;
					}
				}
			}
		},
		flipfit: {
			left: function() {
				$.ui.position.flip.left.apply( this, arguments );
				$.ui.position.fit.left.apply( this, arguments );
			},
			top: function() {
				$.ui.position.flip.top.apply( this, arguments );
				$.ui.position.fit.top.apply( this, arguments );
			}
		}
	};
	
	} )();
	
	return $.ui.position;
	
	} ) );


/***/ }),
/* 39 */
/***/ (function(module, exports) {

	module.exports = {"name":"nglview-js-widgets","version":"0.5.4-dev.8","description":"nglview-js-widgets","author":"Hai Nguyen <hainm.comp@gmail.com>, Alexander Rose <alexander.rose@weirdbyte.de>","license":"MIT","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/arose/nglview.git"},"bugs":{"url":"https://github.com/arose/nglview/issues"},"files":["dist"],"keywords":["molecular graphics","molecular structure","jupyter","widgets","ipython","ipywidgets","science"],"scripts":{"lint":"eslint src test","prepublish":"webpack","test":"mocha"},"devDependencies":{"@jupyterlab/extension-builder":"^0.10.0","babel-eslint":"^7.0.0","babel-register":"^6.11.6","eslint":"^3.2.2","eslint-config-google":"^0.7.1","json-loader":"^0.5.4","ngl":"0.10.5-15","webpack":"^1.12.14"},"dependencies":{"jquery":"^2.1.4","jquery-ui":"^1.12.1","underscore":"^1.8.3","@jupyter-widgets/base":"^0.5.2","@jupyterlab/nbwidgets":"^0.6.15","ngl":"0.10.5-15"},"homepage":"https://github.com/arose/nglview#readme","directories":{"test":"test"}}

/***/ })
/******/ ])});;
//# sourceMappingURL=index.js.map