module.exports =
/******/ (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] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = 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;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),

/***/ "00ee":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};

test[TO_STRING_TAG] = 'z';

module.exports = String(test) === '[object z]';


/***/ }),

/***/ "00fd":
/***/ (function(module, exports, __webpack_require__) {

var Symbol = __webpack_require__("9e69");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString = objectProto.toString;

/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;

/**
 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the raw `toStringTag`.
 */
function getRawTag(value) {
  var isOwn = hasOwnProperty.call(value, symToStringTag),
      tag = value[symToStringTag];

  try {
    value[symToStringTag] = undefined;
    var unmasked = true;
  } catch (e) {}

  var result = nativeObjectToString.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag] = tag;
    } else {
      delete value[symToStringTag];
    }
  }
  return result;
}

module.exports = getRawTag;


/***/ }),

/***/ "0366":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");

// optional / simple context binding
module.exports = function (fn, that, length) {
  aCallable(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 0: return function () {
      return fn.call(that);
    };
    case 1: return function (a) {
      return fn.call(that, a);
    };
    case 2: return function (a, b) {
      return fn.call(that, a, b);
    };
    case 3: return function (a, b, c) {
      return fn.call(that, a, b, c);
    };
  }
  return function (/* ...args */) {
    return fn.apply(that, arguments);
  };
};


/***/ }),

/***/ "03dd":
/***/ (function(module, exports, __webpack_require__) {

var isPrototype = __webpack_require__("eac5"),
    nativeKeys = __webpack_require__("57a5");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */
function baseKeys(object) {
  if (!isPrototype(object)) {
    return nativeKeys(object);
  }
  var result = [];
  for (var key in Object(object)) {
    if (hasOwnProperty.call(object, key) && key != 'constructor') {
      result.push(key);
    }
  }
  return result;
}

module.exports = baseKeys;


/***/ }),

/***/ "06cf":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
var toIndexedObject = __webpack_require__("fc6a");
var toPropertyKey = __webpack_require__("a04b");
var hasOwn = __webpack_require__("1a2d");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");

// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  O = toIndexedObject(O);
  P = toPropertyKey(P);
  if (IE8_DOM_DEFINE) try {
    return $getOwnPropertyDescriptor(O, P);
  } catch (error) { /* empty */ }
  if (hasOwn(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};


/***/ }),

/***/ "07c7":
/***/ (function(module, exports) {

/**
 * This method returns `false`.
 *
 * @static
 * @memberOf _
 * @since 4.13.0
 * @category Util
 * @returns {boolean} Returns `false`.
 * @example
 *
 * _.times(2, _.stubFalse);
 * // => [false, false]
 */
function stubFalse() {
  return false;
}

module.exports = stubFalse;


/***/ }),

/***/ "07fa":
/***/ (function(module, exports, __webpack_require__) {

var toLength = __webpack_require__("50c4");

// `LengthOfArrayLike` abstract operation
// https://tc39.es/ecma262/#sec-lengthofarraylike
module.exports = function (obj) {
  return toLength(obj.length);
};


/***/ }),

/***/ "087d":
/***/ (function(module, exports) {

/**
 * Appends the elements of `values` to `array`.
 *
 * @private
 * @param {Array} array The array to modify.
 * @param {Array} values The values to append.
 * @returns {Array} Returns `array`.
 */
function arrayPush(array, values) {
  var index = -1,
      length = values.length,
      offset = array.length;

  while (++index < length) {
    array[offset + index] = values[index];
  }
  return array;
}

module.exports = arrayPush;


/***/ }),

/***/ "0b07":
/***/ (function(module, exports, __webpack_require__) {

var baseIsNative = __webpack_require__("34ac"),
    getValue = __webpack_require__("3698");

/**
 * Gets the native function at `key` of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {string} key The key of the method to get.
 * @returns {*} Returns the function if it's native, else `undefined`.
 */
function getNative(object, key) {
  var value = getValue(object, key);
  return baseIsNative(value) ? value : undefined;
}

module.exports = getNative;


/***/ }),

/***/ "0b42":
/***/ (function(module, exports, __webpack_require__) {

var isArray = __webpack_require__("e8b5");
var isConstructor = __webpack_require__("68ee");
var isObject = __webpack_require__("861d");
var wellKnownSymbol = __webpack_require__("b622");

var SPECIES = wellKnownSymbol('species');

// a part of `ArraySpeciesCreate` abstract operation
// https://tc39.es/ecma262/#sec-arrayspeciescreate
module.exports = function (originalArray) {
  var C;
  if (isArray(originalArray)) {
    C = originalArray.constructor;
    // cross-realm fallback
    if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;
    else if (isObject(C)) {
      C = C[SPECIES];
      if (C === null) C = undefined;
    }
  } return C === undefined ? Array : C;
};


/***/ }),

/***/ "0cfb":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var createElement = __webpack_require__("cc12");

// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  return Object.defineProperty(createElement('div'), 'a', {
    get: function () { return 7; }
  }).a != 7;
});


/***/ }),

/***/ "0d24":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__("2b3e"),
    stubFalse = __webpack_require__("07c7");

/** Detect free variable `exports`. */
var freeExports =  true && exports && !exports.nodeType && exports;

/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;

/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;

/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;

/**
 * Checks if `value` is a buffer.
 *
 * @static
 * @memberOf _
 * @since 4.3.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
 * @example
 *
 * _.isBuffer(new Buffer(2));
 * // => true
 *
 * _.isBuffer(new Uint8Array(2));
 * // => false
 */
var isBuffer = nativeIsBuffer || stubFalse;

module.exports = isBuffer;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("62e4")(module)))

/***/ }),

/***/ "0d51":
/***/ (function(module, exports) {

module.exports = function (argument) {
  try {
    return String(argument);
  } catch (error) {
    return 'Object';
  }
};


/***/ }),

/***/ "1157":
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
 * jQuery JavaScript Library v3.6.0
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2021-03-02T17:08Z
 */
( function( global, factory ) {

	"use strict";

	if (  true && 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 ) {

// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";

var arr = [];

var getProto = Object.getPrototypeOf;

var slice = arr.slice;

var flat = arr.flat ? function( array ) {
	return arr.flat.call( array );
} : function( array ) {
	return arr.concat.apply( [], array );
};


var push = arr.push;

var indexOf = arr.indexOf;

var class2type = {};

var toString = class2type.toString;

var hasOwn = class2type.hasOwnProperty;

var fnToString = hasOwn.toString;

var ObjectFunctionString = fnToString.call( Object );

var support = {};

var isFunction = function isFunction( obj ) {

		// Support: Chrome <=57, Firefox <=52
		// In some browsers, typeof returns "function" for HTML <object> elements
		// (i.e., `typeof document.createElement( "object" ) === "function"`).
		// We don't want to classify *any* DOM node as a function.
		// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
		// Plus for old WebKit, typeof returns "function" for HTML collections
		// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
		return typeof obj === "function" && typeof obj.nodeType !== "number" &&
			typeof obj.item !== "function";
	};


var isWindow = function isWindow( obj ) {
		return obj != null && obj === obj.window;
	};


var document = window.document;



	var preservedScriptAttributes = {
		type: true,
		src: true,
		nonce: true,
		noModule: true
	};

	function DOMEval( code, node, doc ) {
		doc = doc || document;

		var i, val,
			script = doc.createElement( "script" );

		script.text = code;
		if ( node ) {
			for ( i in preservedScriptAttributes ) {

				// Support: Firefox 64+, Edge 18+
				// Some browsers don't support the "nonce" property on scripts.
				// On the other hand, just using `getAttribute` is not enough as
				// the `nonce` attribute is reset to an empty string whenever it
				// becomes browsing-context connected.
				// See https://github.com/whatwg/html/issues/2369
				// See https://html.spec.whatwg.org/#nonce-attributes
				// The `node.getAttribute` check was added for the sake of
				// `jQuery.globalEval` so that it can fake a nonce-containing node
				// via an object.
				val = node[ i ] || node.getAttribute && node.getAttribute( i );
				if ( val ) {
					script.setAttribute( i, val );
				}
			}
		}
		doc.head.appendChild( script ).parentNode.removeChild( script );
	}


function toType( obj ) {
	if ( obj == null ) {
		return obj + "";
	}

	// Support: Android <=2.3 only (functionish RegExp)
	return typeof obj === "object" || typeof obj === "function" ?
		class2type[ toString.call( obj ) ] || "object" :
		typeof obj;
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module



var
	version = "3.6.0",

	// 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 );
	};

jQuery.fn = jQuery.prototype = {

	// The current version of jQuery being used
	jquery: version,

	constructor: jQuery,

	// 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 all the elements in a clean array
		if ( num == null ) {
			return slice.call( this );
		}

		// Return just the one element from the set
		return num < 0 ? this[ num + this.length ] : this[ num ];
	},

	// 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;

		// 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 );
	},

	even: function() {
		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
			return ( i + 1 ) % 2;
		} ) );
	},

	odd: function() {
		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
			return i % 2;
		} ) );
	},

	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" && !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 ) {
				copy = options[ name ];

				// Prevent Object.prototype pollution
				// Prevent never-ending loop
				if ( name === "__proto__" || target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
					( copyIsArray = Array.isArray( copy ) ) ) ) {
					src = target[ name ];

					// Ensure proper type for the source value
					if ( copyIsArray && !Array.isArray( src ) ) {
						clone = [];
					} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
						clone = {};
					} else {
						clone = src;
					}
					copyIsArray = false;

					// 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() {},

	isPlainObject: function( obj ) {
		var proto, Ctor;

		// Detect obvious negatives
		// Use toString instead of jQuery.type to catch host objects
		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
			return false;
		}

		proto = getProto( obj );

		// Objects with no prototype (e.g., `Object.create( null )`) are plain
		if ( !proto ) {
			return true;
		}

		// Objects with prototype are plain iff they were constructed by a global Object function
		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
	},

	isEmptyObject: function( obj ) {
		var name;

		for ( name in obj ) {
			return false;
		}
		return true;
	},

	// Evaluates a script in a provided context; falls back to the global one
	// if not specified.
	globalEval: function( code, options, doc ) {
		DOMEval( code, { nonce: options && options.nonce }, doc );
	},

	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;
	},

	// 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 );
	},

	// Support: Android <=4.0 only, PhantomJS 1 only
	// push.apply(_, arraylike) throws on ancient WebKit
	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 flat( ret );
	},

	// A global GUID counter for objects
	guid: 1,

	// jQuery.support is not used in Core but other projects attach their
	// properties to it so it needs to exist.
	support: support
} );

if ( typeof Symbol === "function" ) {
	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
}

// 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: real iOS 8.2 only (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 = toType( obj );

	if ( isFunction( obj ) || 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.3.6
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://js.foundation/
 *
 * Date: 2021-02-16
 */
( 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(),
	nonnativeSelectorCache = createCache(),
	sortOrder = function( a, b ) {
		if ( a === b ) {
			hasDuplicate = true;
		}
		return 0;
	},

	// Instance methods
	hasOwn = ( {} ).hasOwnProperty,
	arr = [],
	pop = arr.pop,
	pushNative = arr.push,
	push = arr.push,
	slice = arr.slice,

	// Use a stripped-down indexOf as it's faster than native
	// https://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]",

	// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
	identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
		"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",

	// 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 +
		"*" ),
	rdescend = new RegExp( whitespace + "|>" ),

	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" )
	},

	rhtml = /HTML$/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 = /[+~]/,

	// CSS escapes
	// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
	runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
	funescape = function( escape, nonHex ) {
		var high = "0x" + escape.slice( 1 ) - 0x10000;

		return nonHex ?

			// Strip the backslash prefix from a non-hex escape sequence
			nonHex :

			// Replace a hexadecimal escape sequence with the encoded Unicode code point
			// Support: IE <=11+
			// For values outside the Basic Multilingual Plane (BMP), manually construct a
			// surrogate pair
			high < 0 ?
				String.fromCharCode( high + 0x10000 ) :
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
	},

	// CSS string/identifier serialization
	// https://drafts.csswg.org/cssom/#common-serializing-idioms
	rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
	fcssescape = function( ch, asCodePoint ) {
		if ( asCodePoint ) {

			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
			if ( ch === "\0" ) {
				return "\uFFFD";
			}

			// Control characters and (dependent upon position) numbers get escaped as code points
			return ch.slice( 0, -1 ) + "\\" +
				ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
		}

		// Other potentially-special ASCII characters get backslash-escaped
		return "\\" + ch;
	},

	// Used for iframes
	// See setDocument()
	// Removing the function wrapper causes a "Permission Denied"
	// error in IE
	unloadHandler = function() {
		setDocument();
	},

	inDisabledFieldset = addCombinator(
		function( elem ) {
			return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
		},
		{ dir: "parentNode", next: "legend" }
	);

// Optimize for push.apply( _, NodeList )
try {
	push.apply(
		( arr = slice.call( preferredDoc.childNodes ) ),
		preferredDoc.childNodes
	);

	// Support: Android<4.0
	// Detect silently failing push.apply
	// eslint-disable-next-line no-unused-expressions
	arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
	push = { apply: arr.length ?

		// Leverage slice if possible
		function( target, els ) {
			pushNative.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, 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 ) {
		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 &&
				!nonnativeSelectorCache[ selector + " " ] &&
				( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&

				// Support: IE 8 only
				// Exclude object elements
				( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {

				newSelector = selector;
				newContext = context;

				// qSA considers elements outside a scoping root when evaluating child or
				// descendant combinators, which is not what we want.
				// In such cases, we work around the behavior by prefixing every selector in the
				// list with an ID selector referencing the scope context.
				// The technique has to be used as well when a leading combinator is used
				// as such selectors are not recognized by querySelectorAll.
				// Thanks to Andrew Dupont for this technique.
				if ( nodeType === 1 &&
					( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {

					// Expand context for sibling selectors
					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
						context;

					// We can use :scope instead of the ID hack if the browser
					// supports it & if we're not changing the context.
					if ( newContext !== context || !support.scope ) {

						// Capture the context ID, setting it first if necessary
						if ( ( nid = context.getAttribute( "id" ) ) ) {
							nid = nid.replace( rcssescape, fcssescape );
						} else {
							context.setAttribute( "id", ( nid = expando ) );
						}
					}

					// Prefix every selector in the list
					groups = tokenize( selector );
					i = groups.length;
					while ( i-- ) {
						groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
							toSelector( groups[ i ] );
					}
					newSelector = groups.join( "," );
				}

				try {
					push.apply( results,
						newContext.querySelectorAll( newSelector )
					);
					return results;
				} catch ( qsaError ) {
					nonnativeSelectorCache( selector, true );
				} 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 element and returns a boolean result
 */
function assert( fn ) {
	var el = document.createElement( "fieldset" );

	try {
		return !!fn( el );
	} catch ( e ) {
		return false;
	} finally {

		// Remove from its parent by default
		if ( el.parentNode ) {
			el.parentNode.removeChild( el );
		}

		// release memory in IE
		el = 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 &&
			a.sourceIndex - b.sourceIndex;

	// 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 :enabled/:disabled
 * @param {Boolean} disabled true for :disabled; false for :enabled
 */
function createDisabledPseudo( disabled ) {

	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
	return function( elem ) {

		// Only certain elements can match :enabled or :disabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
		if ( "form" in elem ) {

			// Check for inherited disabledness on relevant non-disabled elements:
			// * listed form-associated elements in a disabled fieldset
			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
			// * option elements in a disabled optgroup
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
			// All such elements have a "form" property.
			if ( elem.parentNode && elem.disabled === false ) {

				// Option elements defer to a parent optgroup if present
				if ( "label" in elem ) {
					if ( "label" in elem.parentNode ) {
						return elem.parentNode.disabled === disabled;
					} else {
						return elem.disabled === disabled;
					}
				}

				// Support: IE 6 - 11
				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
				return elem.isDisabled === disabled ||

					// Where there is no isDisabled, check manually
					/* jshint -W018 */
					elem.isDisabled !== !disabled &&
					inDisabledFieldset( elem ) === disabled;
			}

			return elem.disabled === disabled;

		// Try to winnow out elements that can't be disabled before trusting the disabled property.
		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
		// even exist on them, let alone have a boolean value.
		} else if ( "label" in elem ) {
			return elem.disabled === disabled;
		}

		// Remaining elements are neither :enabled nor :disabled
		return false;
	};
}

/**
 * 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 ) {
	var namespace = elem && elem.namespaceURI,
		docElem = elem && ( elem.ownerDocument || elem ).documentElement;

	// Support: IE <=8
	// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
	// https://bugs.jquery.com/ticket/4833
	return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
};

/**
 * 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, subWindow,
		doc = node ? node.ownerDocument || node : preferredDoc;

	// Return early if doc is invalid or already selected
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	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 12 - 18+
	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( preferredDoc != document &&
		( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {

		// Support: IE 11, Edge
		if ( subWindow.addEventListener ) {
			subWindow.addEventListener( "unload", unloadHandler, false );

		// Support: IE 9 - 10 only
		} else if ( subWindow.attachEvent ) {
			subWindow.attachEvent( "onunload", unloadHandler );
		}
	}

	// Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
	// Safari 4 - 5 only, Opera <=11.6 - 12.x only
	// IE/Edge & older browsers don't support the :scope pseudo-class.
	// Support: Safari 6.0 only
	// Safari 6.0 supports :scope but it's an alias of :root there.
	support.scope = assert( function( el ) {
		docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
		return typeof el.querySelectorAll !== "undefined" &&
			!el.querySelectorAll( ":scope fieldset div" ).length;
	} );

	/* Attributes
	---------------------------------------------------------------------- */

	// Support: IE<8
	// Verify that getAttribute really returns attributes and not properties
	// (excepting IE8 booleans)
	support.attributes = assert( function( el ) {
		el.className = "i";
		return !el.getAttribute( "className" );
	} );

	/* getElement(s)By*
	---------------------------------------------------------------------- */

	// Check if getElementsByTagName("*") returns only elements
	support.getElementsByTagName = assert( function( el ) {
		el.appendChild( document.createComment( "" ) );
		return !el.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 programmatically-set names,
	// so use a roundabout getElementsByName test
	support.getById = assert( function( el ) {
		docElem.appendChild( el ).id = expando;
		return !document.getElementsByName || !document.getElementsByName( expando ).length;
	} );

	// ID filter and find
	if ( support.getById ) {
		Expr.filter[ "ID" ] = function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				return elem.getAttribute( "id" ) === attrId;
			};
		};
		Expr.find[ "ID" ] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var elem = context.getElementById( id );
				return elem ? [ elem ] : [];
			}
		};
	} else {
		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;
			};
		};

		// Support: IE 6 - 7 only
		// getElementById is not reliable as a find shortcut
		Expr.find[ "ID" ] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var node, i, elems,
					elem = context.getElementById( id );

				if ( elem ) {

					// Verify the id attribute
					node = elem.getAttributeNode( "id" );
					if ( node && node.value === id ) {
						return [ elem ];
					}

					// Fall back on getElementsByName
					elems = context.getElementsByName( id );
					i = 0;
					while ( ( elem = elems[ i++ ] ) ) {
						node = elem.getAttributeNode( "id" );
						if ( node && node.value === id ) {
							return [ elem ];
						}
					}
				}

				return [];
			}
		};
	}

	// 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 https://bugs.jquery.com/ticket/13378
	rbuggyQSA = [];

	if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {

		// Build QSA regex
		// Regex strategy adopted from Diego Perini
		assert( function( el ) {

			var input;

			// 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
			// https://bugs.jquery.com/ticket/12359
			docElem.appendChild( el ).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
			// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
			if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
			}

			// Support: IE8
			// Boolean attributes and "value" are not treated correctly
			if ( !el.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 ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
				rbuggyQSA.push( "~=" );
			}

			// Support: IE 11+, Edge 15 - 18+
			// IE 11/Edge don't find elements on a `[name='']` query in some cases.
			// Adding a temporary attribute to the document before the selection works
			// around the issue.
			// Interestingly, IE 10 & older don't seem to have the issue.
			input = document.createElement( "input" );
			input.setAttribute( "name", "" );
			el.appendChild( input );
			if ( !el.querySelectorAll( "[name='']" ).length ) {
				rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
					whitespace + "*(?:''|\"\")" );
			}

			// 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 ( !el.querySelectorAll( ":checked" ).length ) {
				rbuggyQSA.push( ":checked" );
			}

			// Support: Safari 8+, iOS 8+
			// https://bugs.webkit.org/show_bug.cgi?id=136851
			// In-page `selector#id sibling-combinator selector` fails
			if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
				rbuggyQSA.push( ".#.+[+~]" );
			}

			// Support: Firefox <=3.6 - 5 only
			// Old Firefox doesn't throw on a badly-escaped identifier.
			el.querySelectorAll( "\\\f" );
			rbuggyQSA.push( "[\\r\\n\\f]" );
		} );

		assert( function( el ) {
			el.innerHTML = "<a href='' disabled='disabled'></a>" +
				"<select disabled='disabled'><option/></select>";

			// Support: Windows 8 Native Apps
			// The type and name attributes are restricted during .innerHTML assignment
			var input = document.createElement( "input" );
			input.setAttribute( "type", "hidden" );
			el.appendChild( input ).setAttribute( "name", "D" );

			// Support: IE8
			// Enforce case-sensitivity of name attribute
			if ( el.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 ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Support: IE9-11+
			// IE's :disabled selector does not pick up the children of disabled fieldsets
			docElem.appendChild( el ).disabled = true;
			if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Support: Opera 10 - 11 only
			// Opera 10-11 does not throw on post-comma invalid pseudos
			el.querySelectorAll( "*,:x" );
			rbuggyQSA.push( ",.*:" );
		} );
	}

	if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
		docElem.webkitMatchesSelector ||
		docElem.mozMatchesSelector ||
		docElem.oMatchesSelector ||
		docElem.msMatchesSelector ) ) ) ) {

		assert( function( el ) {

			// Check to see if it's possible to do matchesSelector
			// on a disconnected node (IE 9)
			support.disconnectedMatch = matches.call( el, "*" );

			// This should fail with an exception
			// Gecko does not error, returns false instead
			matches.call( el, "[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
		// Support: IE 11+, Edge 17 - 18+
		// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
		// two documents; shallow comparisons work.
		// eslint-disable-next-line eqeqeq
		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
			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			// eslint-disable-next-line eqeqeq
			if ( a == document || a.ownerDocument == preferredDoc &&
				contains( preferredDoc, a ) ) {
				return -1;
			}

			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			// eslint-disable-next-line eqeqeq
			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 ) {

			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			/* eslint-disable eqeqeq */
			return a == document ? -1 :
				b == document ? 1 :
				/* eslint-enable eqeqeq */
				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
			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			/* eslint-disable eqeqeq */
			ap[ i ] == preferredDoc ? -1 :
			bp[ i ] == preferredDoc ? 1 :
			/* eslint-enable eqeqeq */
			0;
	};

	return document;
};

Sizzle.matches = function( expr, elements ) {
	return Sizzle( expr, null, null, elements );
};

Sizzle.matchesSelector = function( elem, expr ) {
	setDocument( elem );

	if ( support.matchesSelector && documentIsHTML &&
		!nonnativeSelectorCache[ 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 ) {
			nonnativeSelectorCache( expr, true );
		}
	}

	return Sizzle( expr, document, null, [ elem ] ).length > 0;
};

Sizzle.contains = function( context, elem ) {

	// Set document vars if needed
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( ( context.ownerDocument || context ) != document ) {
		setDocument( context );
	}
	return contains( context, elem );
};

Sizzle.attr = function( elem, name ) {

	// Set document vars if needed
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	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.escape = function( sel ) {
	return ( sel + "" ).replace( rcssescape, fcssescape );
};

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 += "";

				/* eslint-disable max-len */

				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;
				/* eslint-enable max-len */

			};
		},

		"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 || 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": createDisabledPseudo( false ),
		"disabled": createDisabledPseudo( 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 ) {
				// eslint-disable-next-line no-unused-expressions
				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 > length ?
					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,
		skip = combinator.next,
		key = skip || dir,
		checkNonElements = base && key === "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 );
				}
			}
			return false;
		} :

		// 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 ( skip && skip === elem.nodeName.toLowerCase() ) {
							elem = elem[ dir ] || elem;
						} else if ( ( oldCache = uniqueCache[ key ] ) &&
							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[ key ] = newCache;

							// A match means we're done; a fail means we have to keep checking
							if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
								return true;
							}
						}
					}
				}
			}
			return false;
		};
}

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 ) {

				// Support: IE 11+, Edge 17 - 18+
				// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
				// two documents; shallow comparisons work.
				// eslint-disable-next-line eqeqeq
				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;

					// Support: IE 11+, Edge 17 - 18+
					// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
					// two documents; shallow comparisons work.
					// eslint-disable-next-line eqeqeq
					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" &&
			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( el ) {

	// Should return 1, but returns 4 (following)
	return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
} );

// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert( function( el ) {
	el.innerHTML = "<a href='#'></a>";
	return el.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( el ) {
	el.innerHTML = "<input/>";
	el.firstChild.setAttribute( "value", "" );
	return el.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( el ) {
	return el.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;

// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;




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;



function nodeName( elem, name ) {

	return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();

}
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );



// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
	if ( isFunction( qualifier ) ) {
		return jQuery.grep( elements, function( elem, i ) {
			return !!qualifier.call( elem, i, elem ) !== not;
		} );
	}

	// Single element
	if ( qualifier.nodeType ) {
		return jQuery.grep( elements, function( elem ) {
			return ( elem === qualifier ) !== not;
		} );
	}

	// Arraylike of elements (jQuery, arguments, Array)
	if ( typeof qualifier !== "string" ) {
		return jQuery.grep( elements, function( elem ) {
			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
		} );
	}

	// Filtered directly for both simple and complex selectors
	return jQuery.filter( qualifier, elements, not );
}

jQuery.filter = function( expr, elems, not ) {
	var elem = elems[ 0 ];

	if ( not ) {
		expr = ":not(" + expr + ")";
	}

	if ( elems.length === 1 && elem.nodeType === 1 ) {
		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
	}

	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
		return elem.nodeType === 1;
	} ) );
};

jQuery.fn.extend( {
	find: function( selector ) {
		var i, ret,
			len = this.length,
			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;
					}
				}
			} ) );
		}

		ret = this.pushStack( [] );

		for ( i = 0; i < len; i++ ) {
			jQuery.find( selector, self[ i ], ret );
		}

		return len > 1 ? jQuery.uniqueSort( ret ) : 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 <)
	// Shortcut simple #id case for speed
	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 ( 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 ] );

					if ( elem ) {

						// Inject the element directly into the jQuery object
						this[ 0 ] = elem;
						this.length = 1;
					}
					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[ 0 ] = selector;
			this.length = 1;
			return this;

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( isFunction( selector ) ) {
			return root.ready !== undefined ?
				root.ready( selector ) :

				// Execute immediately if ready is not present
				selector( jQuery );
		}

		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 = [],
			targets = typeof selectors !== "string" && jQuery( selectors );

		// Positional selectors never match, since there's no _selection_ context
		if ( !rneedsContext.test( selectors ) ) {
			for ( ; i < l; i++ ) {
				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {

					// Always skip document fragments
					if ( cur.nodeType < 11 && ( targets ?
						targets.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 ) {
		if ( elem.contentDocument != null &&

			// Support: IE 11+
			// <object> elements with no `data` attribute has an object
			// `contentDocument` with a `null` prototype.
			getProto( elem.contentDocument ) ) {

			return elem.contentDocument;
		}

		// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
		// Treat the template element as a regular one in browsers that
		// don't support it.
		if ( nodeName( elem, "template" ) ) {
			elem = elem.content || elem;
		}

		return 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 rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );



// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
	var object = {};
	jQuery.each( options.match( rnothtmlwhite ) || [], 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 = 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 ( isFunction( arg ) ) {
								if ( !options.unique || !self.has( arg ) ) {
									list.push( arg );
								}
							} else if ( arg && arg.length && toType( 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 && !firing ) {
					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;
};


function Identity( v ) {
	return v;
}
function Thrower( ex ) {
	throw ex;
}

function adoptValue( value, resolve, reject, noValue ) {
	var method;

	try {

		// Check for promise aspect first to privilege synchronous behavior
		if ( value && isFunction( ( method = value.promise ) ) ) {
			method.call( value ).done( resolve ).fail( reject );

		// Other thenables
		} else if ( value && isFunction( ( method = value.then ) ) ) {
			method.call( value, resolve, reject );

		// Other non-thenables
		} else {

			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
			// * false: [ value ].slice( 0 ) => resolve( value )
			// * true: [ value ].slice( 1 ) => resolve()
			resolve.apply( undefined, [ value ].slice( noValue ) );
		}

	// For Promises/A+, convert exceptions into rejections
	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
	// Deferred#then to conditionally suppress rejection.
	} catch ( value ) {

		// Support: Android 4.0 only
		// Strict mode functions invoked without .call/.apply get global-object context
		reject.apply( undefined, [ value ] );
	}
}

jQuery.extend( {

	Deferred: function( func ) {
		var tuples = [

				// action, add listener, callbacks,
				// ... .then handlers, argument index, [final state]
				[ "notify", "progress", jQuery.Callbacks( "memory" ),
					jQuery.Callbacks( "memory" ), 2 ],
				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
			],
			state = "pending",
			promise = {
				state: function() {
					return state;
				},
				always: function() {
					deferred.done( arguments ).fail( arguments );
					return this;
				},
				"catch": function( fn ) {
					return promise.then( null, fn );
				},

				// Keep pipe for back-compat
				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
					var fns = arguments;

					return jQuery.Deferred( function( newDefer ) {
						jQuery.each( tuples, function( _i, tuple ) {

							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];

							// deferred.progress(function() { bind to newDefer or newDefer.notify })
							// deferred.done(function() { bind to newDefer or newDefer.resolve })
							// deferred.fail(function() { bind to newDefer or newDefer.reject })
							deferred[ tuple[ 1 ] ]( function() {
								var returned = fn && fn.apply( this, arguments );
								if ( returned && isFunction( returned.promise ) ) {
									returned.promise()
										.progress( newDefer.notify )
										.done( newDefer.resolve )
										.fail( newDefer.reject );
								} else {
									newDefer[ tuple[ 0 ] + "With" ](
										this,
										fn ? [ returned ] : arguments
									);
								}
							} );
						} );
						fns = null;
					} ).promise();
				},
				then: function( onFulfilled, onRejected, onProgress ) {
					var maxDepth = 0;
					function resolve( depth, deferred, handler, special ) {
						return function() {
							var that = this,
								args = arguments,
								mightThrow = function() {
									var returned, then;

									// Support: Promises/A+ section 2.3.3.3.3
									// https://promisesaplus.com/#point-59
									// Ignore double-resolution attempts
									if ( depth < maxDepth ) {
										return;
									}

									returned = handler.apply( that, args );

									// Support: Promises/A+ section 2.3.1
									// https://promisesaplus.com/#point-48
									if ( returned === deferred.promise() ) {
										throw new TypeError( "Thenable self-resolution" );
									}

									// Support: Promises/A+ sections 2.3.3.1, 3.5
									// https://promisesaplus.com/#point-54
									// https://promisesaplus.com/#point-75
									// Retrieve `then` only once
									then = returned &&

										// Support: Promises/A+ section 2.3.4
										// https://promisesaplus.com/#point-64
										// Only check objects and functions for thenability
										( typeof returned === "object" ||
											typeof returned === "function" ) &&
										returned.then;

									// Handle a returned thenable
									if ( isFunction( then ) ) {

										// Special processors (notify) just wait for resolution
										if ( special ) {
											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special )
											);

										// Normal processors (resolve) also hook into progress
										} else {

											// ...and disregard older resolution values
											maxDepth++;

											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special ),
												resolve( maxDepth, deferred, Identity,
													deferred.notifyWith )
											);
										}

									// Handle all other returned values
									} else {

										// Only substitute handlers pass on context
										// and multiple values (non-spec behavior)
										if ( handler !== Identity ) {
											that = undefined;
											args = [ returned ];
										}

										// Process the value(s)
										// Default process is resolve
										( special || deferred.resolveWith )( that, args );
									}
								},

								// Only normal processors (resolve) catch and reject exceptions
								process = special ?
									mightThrow :
									function() {
										try {
											mightThrow();
										} catch ( e ) {

											if ( jQuery.Deferred.exceptionHook ) {
												jQuery.Deferred.exceptionHook( e,
													process.stackTrace );
											}

											// Support: Promises/A+ section 2.3.3.3.4.1
											// https://promisesaplus.com/#point-61
											// Ignore post-resolution exceptions
											if ( depth + 1 >= maxDepth ) {

												// Only substitute handlers pass on context
												// and multiple values (non-spec behavior)
												if ( handler !== Thrower ) {
													that = undefined;
													args = [ e ];
												}

												deferred.rejectWith( that, args );
											}
										}
									};

							// Support: Promises/A+ section 2.3.3.3.1
							// https://promisesaplus.com/#point-57
							// Re-resolve promises immediately to dodge false rejection from
							// subsequent errors
							if ( depth ) {
								process();
							} else {

								// Call an optional hook to record the stack, in case of exception
								// since it's otherwise lost when execution goes async
								if ( jQuery.Deferred.getStackHook ) {
									process.stackTrace = jQuery.Deferred.getStackHook();
								}
								window.setTimeout( process );
							}
						};
					}

					return jQuery.Deferred( function( newDefer ) {

						// progress_handlers.add( ... )
						tuples[ 0 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onProgress ) ?
									onProgress :
									Identity,
								newDefer.notifyWith
							)
						);

						// fulfilled_handlers.add( ... )
						tuples[ 1 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onFulfilled ) ?
									onFulfilled :
									Identity
							)
						);

						// rejected_handlers.add( ... )
						tuples[ 2 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onRejected ) ?
									onRejected :
									Thrower
							)
						);
					} ).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 = {};

		// Add list-specific methods
		jQuery.each( tuples, function( i, tuple ) {
			var list = tuple[ 2 ],
				stateString = tuple[ 5 ];

			// promise.progress = list.add
			// promise.done = list.add
			// promise.fail = list.add
			promise[ tuple[ 1 ] ] = list.add;

			// Handle state
			if ( stateString ) {
				list.add(
					function() {

						// state = "resolved" (i.e., fulfilled)
						// state = "rejected"
						state = stateString;
					},

					// rejected_callbacks.disable
					// fulfilled_callbacks.disable
					tuples[ 3 - i ][ 2 ].disable,

					// rejected_handlers.disable
					// fulfilled_handlers.disable
					tuples[ 3 - i ][ 3 ].disable,

					// progress_callbacks.lock
					tuples[ 0 ][ 2 ].lock,

					// progress_handlers.lock
					tuples[ 0 ][ 3 ].lock
				);
			}

			// progress_handlers.fire
			// fulfilled_handlers.fire
			// rejected_handlers.fire
			list.add( tuple[ 3 ].fire );

			// deferred.notify = function() { deferred.notifyWith(...) }
			// deferred.resolve = function() { deferred.resolveWith(...) }
			// deferred.reject = function() { deferred.rejectWith(...) }
			deferred[ tuple[ 0 ] ] = function() {
				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
				return this;
			};

			// deferred.notifyWith = list.fireWith
			// deferred.resolveWith = list.fireWith
			// deferred.rejectWith = list.fireWith
			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( singleValue ) {
		var

			// count of uncompleted subordinates
			remaining = arguments.length,

			// count of unprocessed arguments
			i = remaining,

			// subordinate fulfillment data
			resolveContexts = Array( i ),
			resolveValues = slice.call( arguments ),

			// the primary Deferred
			primary = jQuery.Deferred(),

			// subordinate callback factory
			updateFunc = function( i ) {
				return function( value ) {
					resolveContexts[ i ] = this;
					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
					if ( !( --remaining ) ) {
						primary.resolveWith( resolveContexts, resolveValues );
					}
				};
			};

		// Single- and empty arguments are adopted like Promise.resolve
		if ( remaining <= 1 ) {
			adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
				!remaining );

			// Use .then() to unwrap secondary thenables (cf. gh-3000)
			if ( primary.state() === "pending" ||
				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {

				return primary.then();
			}
		}

		// Multiple arguments are aggregated like Promise.all array elements
		while ( i-- ) {
			adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
		}

		return primary.promise();
	}
} );


// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;

jQuery.Deferred.exceptionHook = function( error, stack ) {

	// Support: IE 8 - 9 only
	// Console exists when dev tools are open, which can happen at any time
	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
		window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
	}
};




jQuery.readyException = function( error ) {
	window.setTimeout( function() {
		throw error;
	} );
};




// The deferred used on DOM ready
var readyList = jQuery.Deferred();

jQuery.fn.ready = function( fn ) {

	readyList
		.then( fn )

		// Wrap jQuery.readyException in a function so that the lookup
		// happens at the time of error handling instead of callback
		// registration.
		.catch( function( error ) {
			jQuery.readyException( error );
		} );

	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,

	// 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 ] );
	}
} );

jQuery.ready.then = readyList.then;

// The ready event handler and self cleanup method
function completed() {
	document.removeEventListener( "DOMContentLoaded", completed );
	window.removeEventListener( "load", completed );
	jQuery.ready();
}

// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 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 );
}




// 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 ( toType( 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 ( !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 ) )
				);
			}
		}
	}

	if ( chainable ) {
		return elems;
	}

	// Gets
	if ( bulk ) {
		return fn.call( elems );
	}

	return len ? fn( elems[ 0 ], key ) : emptyGet;
};


// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
	rdashAlpha = /-([a-z])/g;

// Used by camelCase as callback to replace()
function fcamelCase( _all, letter ) {
	return letter.toUpperCase();
}

// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (#9572)
function camelCase( string ) {
	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
var acceptData = function( owner ) {

	// Accepts only:
	//  - Node
	//    - Node.ELEMENT_NODE
	//    - Node.DOCUMENT_NODE
	//  - Object
	//    - Any
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};




function Data() {
	this.expando = jQuery.expando + Data.uid++;
}

Data.uid = 1;

Data.prototype = {

	cache: function( owner ) {

		// 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
		// Always use camelCase key (gh-2257)
		if ( typeof data === "string" ) {
			cache[ camelCase( data ) ] = value;

		// Handle: [ owner, { properties } ] args
		} else {

			// Copy the properties one-by-one to the cache object
			for ( prop in data ) {
				cache[ camelCase( prop ) ] = data[ prop ];
			}
		}
		return cache;
	},
	get: function( owner, key ) {
		return key === undefined ?
			this.cache( owner ) :

			// Always use camelCase key (gh-2257)
			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
	},
	access: function( owner, key, value ) {

		// 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 ) ) {

			return this.get( owner, 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,
			cache = owner[ this.expando ];

		if ( cache === undefined ) {
			return;
		}

		if ( key !== undefined ) {

			// Support array or space separated string of keys
			if ( Array.isArray( key ) ) {

				// If key is an array of keys...
				// We always set camelCase keys, so remove that.
				key = key.map( camelCase );
			} else {
				key = camelCase( key );

				// If a key with the spaces exists, use it.
				// Otherwise, create an array by matching non-whitespace
				key = key in cache ?
					[ key ] :
					( key.match( rnothtmlwhite ) || [] );
			}

			i = key.length;

			while ( i-- ) {
				delete cache[ key[ 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://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
			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 getData( data ) {
	if ( data === "true" ) {
		return true;
	}

	if ( data === "false" ) {
		return false;
	}

	if ( data === "null" ) {
		return null;
	}

	// Only convert to a number if it doesn't change the string
	if ( data === +data + "" ) {
		return +data;
	}

	if ( rbrace.test( data ) ) {
		return JSON.parse( data );
	}

	return data;
}

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 = getData( 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: IE 11 only
						// The attrs elements can be null (#14894)
						if ( attrs[ i ] ) {
							name = attrs[ i ].name;
							if ( name.indexOf( "data-" ) === 0 ) {
								name = 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;

			// 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
				// The key will always be camelCased in Data
				data = dataUser.get( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// Attempt to "discover" the data in
				// HTML5 custom data-* attrs
				data = dataAttr( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// We tried really hard, but the data doesn't exist.
				return;
			}

			// Set the data...
			this.each( function() {

				// We always store the camelCased key
				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 || Array.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 documentElement = document.documentElement;



	var isAttached = function( elem ) {
			return jQuery.contains( elem.ownerDocument, elem );
		},
		composed = { composed: true };

	// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
	// Check attachment across shadow DOM boundaries when possible (gh-3504)
	// Support: iOS 10.0-10.2 only
	// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
	// leading to errors. We need to check for `getRootNode`.
	if ( documentElement.getRootNode ) {
		isAttached = function( elem ) {
			return jQuery.contains( elem.ownerDocument, elem ) ||
				elem.getRootNode( composed ) === elem.ownerDocument;
		};
	}
var isHiddenWithinTree = function( elem, el ) {

		// isHiddenWithinTree might be called from jQuery#filter function;
		// in that case, element will be second argument
		elem = el || elem;

		// Inline style trumps all
		return elem.style.display === "none" ||
			elem.style.display === "" &&

			// Otherwise, check computed style
			// Support: Firefox <=43 - 45
			// Disconnected elements can have computed display: none, so first confirm that elem is
			// in the document.
			isAttached( elem ) &&

			jQuery.css( elem, "display" ) === "none";
	};



function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted, scale,
		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 = elem.nodeType &&
			( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

		// Support: Firefox <=54
		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
		initial = initial / 2;

		// Trust units reported by jQuery.css
		unit = unit || initialInUnit[ 3 ];

		// Iteratively approximate from a nonzero starting point
		initialInUnit = +initial || 1;

		while ( maxIterations-- ) {

			// Evaluate and update our best guess (doubling guesses that zero out).
			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
			jQuery.style( elem, prop, initialInUnit + unit );
			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
				maxIterations = 0;
			}
			initialInUnit = initialInUnit / scale;

		}

		initialInUnit = initialInUnit * 2;
		jQuery.style( elem, prop, initialInUnit + unit );

		// Make sure we update the tween properties later on
		valueParts = valueParts || [];
	}

	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 defaultDisplayMap = {};

function getDefaultDisplay( elem ) {
	var temp,
		doc = elem.ownerDocument,
		nodeName = elem.nodeName,
		display = defaultDisplayMap[ nodeName ];

	if ( display ) {
		return display;
	}

	temp = doc.body.appendChild( doc.createElement( nodeName ) );
	display = jQuery.css( temp, "display" );

	temp.parentNode.removeChild( temp );

	if ( display === "none" ) {
		display = "block";
	}
	defaultDisplayMap[ nodeName ] = display;

	return display;
}

function showHide( elements, show ) {
	var display, elem,
		values = [],
		index = 0,
		length = elements.length;

	// Determine new display value for elements that need to change
	for ( ; index < length; index++ ) {
		elem = elements[ index ];
		if ( !elem.style ) {
			continue;
		}

		display = elem.style.display;
		if ( show ) {

			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
			// check is required in this first loop unless we have a nonempty display value (either
			// inline or about-to-be-restored)
			if ( display === "none" ) {
				values[ index ] = dataPriv.get( elem, "display" ) || null;
				if ( !values[ index ] ) {
					elem.style.display = "";
				}
			}
			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
				values[ index ] = getDefaultDisplay( elem );
			}
		} else {
			if ( display !== "none" ) {
				values[ index ] = "none";

				// Remember what we're overwriting
				dataPriv.set( elem, "display", display );
			}
		}
	}

	// Set the display of the elements in a second loop to avoid constant reflow
	for ( index = 0; index < length; index++ ) {
		if ( values[ index ] != null ) {
			elements[ index ].style.display = values[ index ];
		}
	}

	return elements;
}

jQuery.fn.extend( {
	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 ( isHiddenWithinTree( this ) ) {
				jQuery( this ).show();
			} else {
				jQuery( this ).hide();
			}
		} );
	}
} );
var rcheckableType = ( /^(?:checkbox|radio)$/i );

var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );

var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );



( function() {
	var fragment = document.createDocumentFragment(),
		div = fragment.appendChild( document.createElement( "div" ) ),
		input = document.createElement( "input" );

	// Support: Android 4.0 - 4.3 only
	// 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: Android <=4.1 only
	// Older WebKit doesn't clone checked state correctly in fragments
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

	// Support: IE <=11 only
	// Make sure textarea (and checkbox) defaultValue is properly cloned
	div.innerHTML = "<textarea>x</textarea>";
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;

	// Support: IE <=9 only
	// IE <=9 replaces <option> tags with their contents when inserted outside of
	// the select element.
	div.innerHTML = "<option></option>";
	support.option = !!div.lastChild;
} )();


// We have to close these tags to support XHTML (#13200)
var wrapMap = {

	// 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, "", "" ]
};

wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;

// Support: IE <=9 only
if ( !support.option ) {
	wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
}


function getAll( context, tag ) {

	// Support: IE <=9 - 11 only
	// Use typeof to avoid zero-argument method invocation on host objects (#15151)
	var ret;

	if ( typeof context.getElementsByTagName !== "undefined" ) {
		ret = context.getElementsByTagName( tag || "*" );

	} else if ( typeof context.querySelectorAll !== "undefined" ) {
		ret = context.querySelectorAll( tag || "*" );

	} else {
		ret = [];
	}

	if ( tag === undefined || tag && nodeName( context, tag ) ) {
		return jQuery.merge( [ context ], ret );
	}

	return 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, attached, 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 ( toType( elem ) === "object" ) {

				// Support: Android <=4.0 only, PhantomJS 1 only
				// 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.0 only, PhantomJS 1 only
				// 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;
		}

		attached = isAttached( elem );

		// Append to fragment
		tmp = getAll( fragment.appendChild( elem ), "script" );

		// Preserve script evaluation history
		if ( attached ) {
			setGlobalEval( tmp );
		}

		// Capture executables
		if ( scripts ) {
			j = 0;
			while ( ( elem = tmp[ j++ ] ) ) {
				if ( rscriptType.test( elem.type || "" ) ) {
					scripts.push( elem );
				}
			}
		}
	}

	return fragment;
}


var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;

function returnTrue() {
	return true;
}

function returnFalse() {
	return false;
}

// Support: IE <=9 - 11+
// focus() and blur() are asynchronous, except when they are no-op.
// So expect focus to be synchronous when the element is already active,
// and blur to be synchronous when the element is not already active.
// (focus and blur are always synchronous in other supported browsers,
// this just defines when we can count on it).
function expectSync( elem, type ) {
	return ( elem === safeActiveElement() ) === ( type === "focus" );
}

// Support: IE <=9 only
// Accessing document.activeElement can throw unexpectedly
// https://bugs.jquery.com/ticket/13393
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 );

		// Only attach events to objects that accept data
		if ( !acceptData( elem ) ) {
			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;
		}

		// Ensure that invalid selectors throw exceptions at attach time
		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
		if ( selector ) {
			jQuery.find.matchesSelector( documentElement, 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 = Object.create( null );
		}
		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( rnothtmlwhite ) || [ "" ];
		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( rnothtmlwhite ) || [ "" ];
		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( nativeEvent ) {

		var i, j, ret, matched, handleObj, handlerQueue,
			args = new Array( arguments.length ),

			// Make a writable jQuery.Event from the native event object
			event = jQuery.event.fix( nativeEvent ),

			handlers = (
				dataPriv.get( this, "events" ) || Object.create( null )
			)[ event.type ] || [],
			special = jQuery.event.special[ event.type ] || {};

		// Use the fix-ed jQuery.Event rather than the (read-only) native event
		args[ 0 ] = event;

		for ( i = 1; i < arguments.length; i++ ) {
			args[ i ] = arguments[ i ];
		}

		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() ) {

				// If the event is namespaced, then each handler is only invoked if it is
				// specially universal or its namespaces are a superset of the event's.
				if ( !event.rnamespace || handleObj.namespace === false ||
					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, handleObj, sel, matchedHandlers, matchedSelectors,
			handlerQueue = [],
			delegateCount = handlers.delegateCount,
			cur = event.target;

		// Find delegate handlers
		if ( delegateCount &&

			// Support: IE <=9
			// Black-hole SVG <use> instance trees (trac-13180)
			cur.nodeType &&

			// Support: Firefox <=42
			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
			// Support: IE 11 only
			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
			!( event.type === "click" && 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 && !( event.type === "click" && cur.disabled === true ) ) {
					matchedHandlers = [];
					matchedSelectors = {};
					for ( i = 0; i < delegateCount; i++ ) {
						handleObj = handlers[ i ];

						// Don't conflict with Object.prototype properties (#13203)
						sel = handleObj.selector + " ";

						if ( matchedSelectors[ sel ] === undefined ) {
							matchedSelectors[ sel ] = handleObj.needsContext ?
								jQuery( sel, this ).index( cur ) > -1 :
								jQuery.find( sel, this, null, [ cur ] ).length;
						}
						if ( matchedSelectors[ sel ] ) {
							matchedHandlers.push( handleObj );
						}
					}
					if ( matchedHandlers.length ) {
						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
					}
				}
			}
		}

		// Add the remaining (directly-bound) handlers
		cur = this;
		if ( delegateCount < handlers.length ) {
			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
		}

		return handlerQueue;
	},

	addProp: function( name, hook ) {
		Object.defineProperty( jQuery.Event.prototype, name, {
			enumerable: true,
			configurable: true,

			get: isFunction( hook ) ?
				function() {
					if ( this.originalEvent ) {
						return hook( this.originalEvent );
					}
				} :
				function() {
					if ( this.originalEvent ) {
						return this.originalEvent[ name ];
					}
				},

			set: function( value ) {
				Object.defineProperty( this, name, {
					enumerable: true,
					configurable: true,
					writable: true,
					value: value
				} );
			}
		} );
	},

	fix: function( originalEvent ) {
		return originalEvent[ jQuery.expando ] ?
			originalEvent :
			new jQuery.Event( originalEvent );
	},

	special: {
		load: {

			// Prevent triggered image.load events from bubbling to window.load
			noBubble: true
		},
		click: {

			// Utilize native event to ensure correct state for checkable inputs
			setup: function( data ) {

				// For mutual compressibility with _default, replace `this` access with a local var.
				// `|| data` is dead code meant only to preserve the variable through minification.
				var el = this || data;

				// Claim the first handler
				if ( rcheckableType.test( el.type ) &&
					el.click && nodeName( el, "input" ) ) {

					// dataPriv.set( el, "click", ... )
					leverageNative( el, "click", returnTrue );
				}

				// Return false to allow normal processing in the caller
				return false;
			},
			trigger: function( data ) {

				// For mutual compressibility with _default, replace `this` access with a local var.
				// `|| data` is dead code meant only to preserve the variable through minification.
				var el = this || data;

				// Force setup before triggering a click
				if ( rcheckableType.test( el.type ) &&
					el.click && nodeName( el, "input" ) ) {

					leverageNative( el, "click" );
				}

				// Return non-false to allow normal event-path propagation
				return true;
			},

			// For cross-browser consistency, suppress native .click() on links
			// Also prevent it if we're currently inside a leveraged native-event stack
			_default: function( event ) {
				var target = event.target;
				return rcheckableType.test( target.type ) &&
					target.click && nodeName( target, "input" ) &&
					dataPriv.get( target, "click" ) ||
					nodeName( 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;
				}
			}
		}
	}
};

// Ensure the presence of an event listener that handles manually-triggered
// synthetic events by interrupting progress until reinvoked in response to
// *native* events that it fires directly, ensuring that state changes have
// already occurred before other listeners are invoked.
function leverageNative( el, type, expectSync ) {

	// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
	if ( !expectSync ) {
		if ( dataPriv.get( el, type ) === undefined ) {
			jQuery.event.add( el, type, returnTrue );
		}
		return;
	}

	// Register the controller as a special universal handler for all event namespaces
	dataPriv.set( el, type, false );
	jQuery.event.add( el, type, {
		namespace: false,
		handler: function( event ) {
			var notAsync, result,
				saved = dataPriv.get( this, type );

			if ( ( event.isTrigger & 1 ) && this[ type ] ) {

				// Interrupt processing of the outer synthetic .trigger()ed event
				// Saved data should be false in such cases, but might be a leftover capture object
				// from an async native handler (gh-4350)
				if ( !saved.length ) {

					// Store arguments for use when handling the inner native event
					// There will always be at least one argument (an event object), so this array
					// will not be confused with a leftover capture object.
					saved = slice.call( arguments );
					dataPriv.set( this, type, saved );

					// Trigger the native event and capture its result
					// Support: IE <=9 - 11+
					// focus() and blur() are asynchronous
					notAsync = expectSync( this, type );
					this[ type ]();
					result = dataPriv.get( this, type );
					if ( saved !== result || notAsync ) {
						dataPriv.set( this, type, false );
					} else {
						result = {};
					}
					if ( saved !== result ) {

						// Cancel the outer synthetic event
						event.stopImmediatePropagation();
						event.preventDefault();

						// Support: Chrome 86+
						// In Chrome, if an element having a focusout handler is blurred by
						// clicking outside of it, it invokes the handler synchronously. If
						// that handler calls `.remove()` on the element, the data is cleared,
						// leaving `result` undefined. We need to guard against this.
						return result && result.value;
					}

				// If this is an inner synthetic event for an event with a bubbling surrogate
				// (focus or blur), assume that the surrogate already propagated from triggering the
				// native event and prevent that from happening again here.
				// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
				// bubbling surrogate propagates *after* the non-bubbling base), but that seems
				// less bad than duplication.
				} else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
					event.stopPropagation();
				}

			// If this is a native event triggered above, everything is now in order
			// Fire an inner synthetic event with the original arguments
			} else if ( saved.length ) {

				// ...and capture the result
				dataPriv.set( this, type, {
					value: jQuery.event.trigger(

						// Support: IE <=9 - 11+
						// Extend with the prototype to reset the above stopImmediatePropagation()
						jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
						saved.slice( 1 ),
						this
					)
				} );

				// Abort handling of the native event
				event.stopImmediatePropagation();
			}
		}
	} );
}

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 <=2.3 only
				src.returnValue === false ?
			returnTrue :
			returnFalse;

		// Create target properties
		// Support: Safari <=6 - 7 only
		// Target should not be a text node (#504, #13143)
		this.target = ( src.target && src.target.nodeType === 3 ) ?
			src.target.parentNode :
			src.target;

		this.currentTarget = src.currentTarget;
		this.relatedTarget = src.relatedTarget;

	// 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 || Date.now();

	// Mark it as fixed
	this[ jQuery.expando ] = true;
};

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://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();
	}
};

// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each( {
	altKey: true,
	bubbles: true,
	cancelable: true,
	changedTouches: true,
	ctrlKey: true,
	detail: true,
	eventPhase: true,
	metaKey: true,
	pageX: true,
	pageY: true,
	shiftKey: true,
	view: true,
	"char": true,
	code: true,
	charCode: true,
	key: true,
	keyCode: true,
	button: true,
	buttons: true,
	clientX: true,
	clientY: true,
	offsetX: true,
	offsetY: true,
	pointerId: true,
	pointerType: true,
	screenX: true,
	screenY: true,
	targetTouches: true,
	toElement: true,
	touches: true,
	which: true
}, jQuery.event.addProp );

jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
	jQuery.event.special[ type ] = {

		// Utilize native event if possible so blur/focus sequence is correct
		setup: function() {

			// Claim the first handler
			// dataPriv.set( this, "focus", ... )
			// dataPriv.set( this, "blur", ... )
			leverageNative( this, type, expectSync );

			// Return false to allow normal processing in the caller
			return false;
		},
		trigger: function() {

			// Force setup before trigger
			leverageNative( this, type );

			// Return non-false to allow normal event-path propagation
			return true;
		},

		// Suppress native focus or blur as it's already being fired
		// in leverageNative.
		_default: function() {
			return true;
		},

		delegateType: delegateType
	};
} );

// 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://bugs.chromium.org/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

	// Support: IE <=10 - 11, Edge 12 - 13 only
	// 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,
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
	if ( nodeName( elem, "table" ) &&
		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {

		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
	}

	return 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 ) {
	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
		elem.type = elem.type.slice( 5 );
	} else {
		elem.removeAttribute( "type" );
	}

	return elem;
}

function cloneCopyEvent( src, dest ) {
	var i, l, type, pdataOld, udataOld, udataCur, events;

	if ( dest.nodeType !== 1 ) {
		return;
	}

	// 1. Copy private data: events, handlers, etc.
	if ( dataPriv.hasData( src ) ) {
		pdataOld = dataPriv.get( src );
		events = pdataOld.events;

		if ( events ) {
			dataPriv.remove( dest, "handle 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 = flat( args );

	var fragment, first, scripts, hasScripts, node, doc,
		i = 0,
		l = collection.length,
		iNoClone = l - 1,
		value = args[ 0 ],
		valueIsFunction = isFunction( value );

	// We can't cloneNode fragments that contain checked, in WebKit
	if ( valueIsFunction ||
			( l > 1 && typeof value === "string" &&
				!support.checkClone && rchecked.test( value ) ) ) {
		return collection.each( function( index ) {
			var self = collection.eq( index );
			if ( valueIsFunction ) {
				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.0 only, PhantomJS 1 only
						// 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 && ( node.type || "" ).toLowerCase()  !== "module" ) {

							// Optional AJAX dependency, but won't run scripts if not present
							if ( jQuery._evalUrl && !node.noModule ) {
								jQuery._evalUrl( node.src, {
									nonce: node.nonce || node.getAttribute( "nonce" )
								}, doc );
							}
						} else {
							DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
						}
					}
				}
			}
		}
	}

	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 && isAttached( node ) ) {
				setGlobalEval( getAll( node, "script" ) );
			}
			node.parentNode.removeChild( node );
		}
	}

	return elem;
}

jQuery.extend( {
	htmlPrefilter: function( html ) {
		return html;
	},

	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
		var i, l, srcElements, destElements,
			clone = elem.cloneNode( true ),
			inPage = isAttached( elem );

		// Fix IE cloning issues
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
				!jQuery.isXMLDoc( elem ) ) {

			// We eschew Sizzle here for performance reasons: https://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( {
	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: Android <=4.0 only, PhantomJS 1 only
			// .get() because push.apply(_, arraylike) throws on ancient WebKit
			push.apply( ret, elems.get() );
		}

		return this.pushStack( ret );
	};
} );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );

var getStyles = function( elem ) {

		// Support: IE <=11 only, 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 ) {
	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.call( elem );

	// Revert the old values
	for ( name in options ) {
		elem.style[ name ] = old[ name ];
	}

	return ret;
};


var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );



( function() {

	// Executing both pixelPosition & boxSizingReliable tests require only one layout
	// so they're executed at the same time to save the second computation.
	function computeStyleTests() {

		// This is a singleton, we need to execute it only once
		if ( !div ) {
			return;
		}

		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
			"margin-top:1px;padding:0;border:0";
		div.style.cssText =
			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
			"margin:auto;border:1px;padding:1px;" +
			"width:60%;top:1%";
		documentElement.appendChild( container ).appendChild( div );

		var divStyle = window.getComputedStyle( div );
		pixelPositionVal = divStyle.top !== "1%";

		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;

		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
		// Some styles come back with percentage values, even though they shouldn't
		div.style.right = "60%";
		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;

		// Support: IE 9 - 11 only
		// Detect misreporting of content dimensions for box-sizing:border-box elements
		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;

		// Support: IE 9 only
		// Detect overflow:scroll screwiness (gh-3699)
		// Support: Chrome <=64
		// Don't get tricked when zoom affects offsetWidth (gh-4029)
		div.style.position = "absolute";
		scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;

		documentElement.removeChild( container );

		// Nullify the div so it wouldn't be stored in the memory and
		// it will also be a sign that checks already performed
		div = null;
	}

	function roundPixelMeasures( measure ) {
		return Math.round( parseFloat( measure ) );
	}

	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
		reliableTrDimensionsVal, reliableMarginLeftVal,
		container = document.createElement( "div" ),
		div = document.createElement( "div" );

	// Finish early in limited (non-browser) environments
	if ( !div.style ) {
		return;
	}

	// Support: IE <=9 - 11 only
	// 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";

	jQuery.extend( support, {
		boxSizingReliable: function() {
			computeStyleTests();
			return boxSizingReliableVal;
		},
		pixelBoxStyles: function() {
			computeStyleTests();
			return pixelBoxStylesVal;
		},
		pixelPosition: function() {
			computeStyleTests();
			return pixelPositionVal;
		},
		reliableMarginLeft: function() {
			computeStyleTests();
			return reliableMarginLeftVal;
		},
		scrollboxSize: function() {
			computeStyleTests();
			return scrollboxSizeVal;
		},

		// Support: IE 9 - 11+, Edge 15 - 18+
		// IE/Edge misreport `getComputedStyle` of table rows with width/height
		// set in CSS while `offset*` properties report correct values.
		// Behavior in IE 9 is more subtle than in newer versions & it passes
		// some versions of this test; make sure not to make it pass there!
		//
		// Support: Firefox 70+
		// Only Firefox includes border widths
		// in computed dimensions. (gh-4529)
		reliableTrDimensions: function() {
			var table, tr, trChild, trStyle;
			if ( reliableTrDimensionsVal == null ) {
				table = document.createElement( "table" );
				tr = document.createElement( "tr" );
				trChild = document.createElement( "div" );

				table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
				tr.style.cssText = "border:1px solid";

				// Support: Chrome 86+
				// Height set through cssText does not get applied.
				// Computed height then comes back as 0.
				tr.style.height = "1px";
				trChild.style.height = "9px";

				// Support: Android 8 Chrome 86+
				// In our bodyBackground.html iframe,
				// display for all div elements is set to "inline",
				// which causes a problem only in Android 8 Chrome 86.
				// Ensuring the div is display: block
				// gets around this issue.
				trChild.style.display = "block";

				documentElement
					.appendChild( table )
					.appendChild( tr )
					.appendChild( trChild );

				trStyle = window.getComputedStyle( tr );
				reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
					parseInt( trStyle.borderTopWidth, 10 ) +
					parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;

				documentElement.removeChild( table );
			}
			return reliableTrDimensionsVal;
		}
	} );
} )();


function curCSS( elem, name, computed ) {
	var width, minWidth, maxWidth, ret,

		// Support: Firefox 51+
		// Retrieving style before computed somehow
		// fixes an issue with getting wrong values
		// on detached elements
		style = elem.style;

	computed = computed || getStyles( elem );

	// getPropertyValue is needed for:
	//   .css('filter') (IE 9 only, #12537)
	//   .css('--customProperty) (#3144)
	if ( computed ) {
		ret = computed.getPropertyValue( name ) || computed[ name ];

		if ( ret === "" && !isAttached( elem ) ) {
			ret = jQuery.style( elem, name );
		}

		// 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:
		// https://drafts.csswg.org/cssom/#resolved-values
		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.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: IE <=9 - 11 only
		// 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 cssPrefixes = [ "Webkit", "Moz", "ms" ],
	emptyStyle = document.createElement( "div" ).style,
	vendorProps = {};

// Return a vendor-prefixed property or undefined
function vendorPropName( 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;
		}
	}
}

// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
function finalPropName( name ) {
	var final = jQuery.cssProps[ name ] || vendorProps[ name ];

	if ( final ) {
		return final;
	}
	if ( name in emptyStyle ) {
		return name;
	}
	return vendorProps[ name ] = vendorPropName( name ) || name;
}


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]).+)/,
	rcustomProp = /^--/,
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	};

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 boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
	var i = dimension === "width" ? 1 : 0,
		extra = 0,
		delta = 0;

	// Adjustment may not be necessary
	if ( box === ( isBorderBox ? "border" : "content" ) ) {
		return 0;
	}

	for ( ; i < 4; i += 2 ) {

		// Both box models exclude margin
		if ( box === "margin" ) {
			delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
		}

		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
		if ( !isBorderBox ) {

			// Add padding
			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );

			// For "border" or "margin", add border
			if ( box !== "padding" ) {
				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );

			// But still keep track of it otherwise
			} else {
				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}

		// If we get here with a border-box (content + padding + border), we're seeking "content" or
		// "padding" or "margin"
		} else {

			// For "content", subtract padding
			if ( box === "content" ) {
				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
			}

			// For "content" or "padding", subtract border
			if ( box !== "margin" ) {
				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		}
	}

	// Account for positive content-box scroll gutter when requested by providing computedVal
	if ( !isBorderBox && computedVal >= 0 ) {

		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
		// Assuming integer scroll gutter, subtract the rest and round down
		delta += Math.max( 0, Math.ceil(
			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
			computedVal -
			delta -
			extra -
			0.5

		// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
		// Use an explicit zero to avoid NaN (gh-3964)
		) ) || 0;
	}

	return delta;
}

function getWidthOrHeight( elem, dimension, extra ) {

	// Start with computed style
	var styles = getStyles( elem ),

		// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
		// Fake content-box until we know it's needed to know the true value.
		boxSizingNeeded = !support.boxSizingReliable() || extra,
		isBorderBox = boxSizingNeeded &&
			jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
		valueIsBorderBox = isBorderBox,

		val = curCSS( elem, dimension, styles ),
		offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );

	// Support: Firefox <=54
	// Return a confounding non-pixel value or feign ignorance, as appropriate.
	if ( rnumnonpx.test( val ) ) {
		if ( !extra ) {
			return val;
		}
		val = "auto";
	}


	// Support: IE 9 - 11 only
	// Use offsetWidth/offsetHeight for when box sizing is unreliable.
	// In those cases, the computed value can be trusted to be border-box.
	if ( ( !support.boxSizingReliable() && isBorderBox ||

		// Support: IE 10 - 11+, Edge 15 - 18+
		// IE/Edge misreport `getComputedStyle` of table rows with width/height
		// set in CSS while `offset*` properties report correct values.
		// Interestingly, in some cases IE 9 doesn't suffer from this issue.
		!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||

		// Fall back to offsetWidth/offsetHeight when value is "auto"
		// This happens for inline elements with no explicit setting (gh-3571)
		val === "auto" ||

		// Support: Android <=4.1 - 4.3 only
		// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&

		// Make sure the element is visible & connected
		elem.getClientRects().length ) {

		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

		// Where available, offsetWidth/offsetHeight approximate border box dimensions.
		// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
		// retrieved value as a content box dimension.
		valueIsBorderBox = offsetProp in elem;
		if ( valueIsBorderBox ) {
			val = elem[ offsetProp ];
		}
	}

	// Normalize "" and auto
	val = parseFloat( val ) || 0;

	// Adjust for the element's box model
	return ( val +
		boxModelAdjustment(
			elem,
			dimension,
			extra || ( isBorderBox ? "border" : "content" ),
			valueIsBorderBox,
			styles,

			// Provide the current computed size to request scroll gutter calculation (gh-3589)
			val
		)
	) + "px";
}

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,
		"gridArea": true,
		"gridColumn": true,
		"gridColumnEnd": true,
		"gridColumnStart": true,
		"gridRow": true,
		"gridRowEnd": true,
		"gridRowStart": 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: {},

	// 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 = camelCase( name ),
			isCustomProp = rcustomProp.test( name ),
			style = elem.style;

		// Make sure that we're working with the right name. We don't
		// want to query the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( 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)
			// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
			// "px" to a few hardcoded values.
			if ( type === "number" && !isCustomProp ) {
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
			}

			// 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 ) {

				if ( isCustomProp ) {
					style.setProperty( name, value );
				} else {
					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 = camelCase( name ),
			isCustomProp = rcustomProp.test( name );

		// Make sure that we're working with the right name. We don't
		// want to modify the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( 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, dimension ) {
	jQuery.cssHooks[ dimension ] = {
		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" ) ) &&

					// Support: Safari 8+
					// Table columns in Safari have non-zero offsetWidth & zero
					// getBoundingClientRect().width unless display is changed.
					// Support: IE <=11 only
					// Running getBoundingClientRect on a disconnected node
					// in IE throws an error.
					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
					swap( elem, cssShow, function() {
						return getWidthOrHeight( elem, dimension, extra );
					} ) :
					getWidthOrHeight( elem, dimension, extra );
			}
		},

		set: function( elem, value, extra ) {
			var matches,
				styles = getStyles( elem ),

				// Only read styles.position if the test has a chance to fail
				// to avoid forcing a reflow.
				scrollboxSizeBuggy = !support.scrollboxSize() &&
					styles.position === "absolute",

				// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
				boxSizingNeeded = scrollboxSizeBuggy || extra,
				isBorderBox = boxSizingNeeded &&
					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
				subtract = extra ?
					boxModelAdjustment(
						elem,
						dimension,
						extra,
						isBorderBox,
						styles
					) :
					0;

			// Account for unreliable border-box dimensions by comparing offset* to computed and
			// faking a content-box to get border and padding (gh-3699)
			if ( isBorderBox && scrollboxSizeBuggy ) {
				subtract -= Math.ceil(
					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
					parseFloat( styles[ dimension ] ) -
					boxModelAdjustment( elem, dimension, "border", false, styles ) -
					0.5
				);
			}

			// Convert to pixels if value adjustment is needed
			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
				( matches[ 3 ] || "px" ) !== "px" ) {

				elem.style[ dimension ] = value;
				value = jQuery.css( elem, dimension );
			}

			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";
		}
	}
);

// 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 ( prefix !== "margin" ) {
		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 ( Array.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 );
	}
} );


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 && (
				jQuery.cssHooks[ tween.prop ] ||
					tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
			} else {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	}
};

// Support: IE <=9 only
// 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, inProgress,
	rfxtypes = /^(?:toggle|show|hide)$/,
	rrun = /queueHooks$/;

function schedule() {
	if ( inProgress ) {
		if ( document.hidden === false && window.requestAnimationFrame ) {
			window.requestAnimationFrame( schedule );
		} else {
			window.setTimeout( schedule, jQuery.fx.interval );
		}

		jQuery.fx.tick();
	}
}

// Animations created synchronously will run synchronously
function createFxNow() {
	window.setTimeout( function() {
		fxNow = undefined;
	} );
	return ( fxNow = Date.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 ) {
	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
		isBox = "width" in props || "height" in props,
		anim = this,
		orig = {},
		style = elem.style,
		hidden = elem.nodeType && isHiddenWithinTree( elem ),
		dataShow = dataPriv.get( elem, "fxshow" );

	// Queue-skipping animations hijack the fx hooks
	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();
				}
			} );
		} );
	}

	// Detect show/hide animations
	for ( prop in props ) {
		value = props[ prop ];
		if ( rfxtypes.test( value ) ) {
			delete props[ prop ];
			toggle = toggle || value === "toggle";
			if ( value === ( hidden ? "hide" : "show" ) ) {

				// Pretend to be hidden if this is a "show" and
				// there is still data from a stopped show/hide
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
					hidden = true;

				// Ignore all other no-op show/hide data
				} else {
					continue;
				}
			}
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
		}
	}

	// Bail out if this is a no-op like .hide().hide()
	propTween = !jQuery.isEmptyObject( props );
	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
		return;
	}

	// Restrict "overflow" and "display" styles during box animations
	if ( isBox && elem.nodeType === 1 ) {

		// Support: IE <=9 - 11, Edge 12 - 15
		// Record all 3 overflow attributes because IE does not infer the shorthand
		// from identically-valued overflowX and overflowY and Edge just mirrors
		// the overflowX value there.
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];

		// Identify a display type, preferring old show/hide data over the CSS cascade
		restoreDisplay = dataShow && dataShow.display;
		if ( restoreDisplay == null ) {
			restoreDisplay = dataPriv.get( elem, "display" );
		}
		display = jQuery.css( elem, "display" );
		if ( display === "none" ) {
			if ( restoreDisplay ) {
				display = restoreDisplay;
			} else {

				// Get nonempty value(s) by temporarily forcing visibility
				showHide( [ elem ], true );
				restoreDisplay = elem.style.display || restoreDisplay;
				display = jQuery.css( elem, "display" );
				showHide( [ elem ] );
			}
		}

		// Animate inline elements as inline-block
		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
			if ( jQuery.css( elem, "float" ) === "none" ) {

				// Restore the original display value at the end of pure show/hide animations
				if ( !propTween ) {
					anim.done( function() {
						style.display = restoreDisplay;
					} );
					if ( restoreDisplay == null ) {
						display = style.display;
						restoreDisplay = display === "none" ? "" : display;
					}
				}
				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 ];
		} );
	}

	// Implement show/hide animations
	propTween = false;
	for ( prop in orig ) {

		// General show/hide setup for this element animation
		if ( !propTween ) {
			if ( dataShow ) {
				if ( "hidden" in dataShow ) {
					hidden = dataShow.hidden;
				}
			} else {
				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
			}

			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
			if ( toggle ) {
				dataShow.hidden = !hidden;
			}

			// Show elements before animating them
			if ( hidden ) {
				showHide( [ elem ], true );
			}

			/* eslint-disable no-loop-func */

			anim.done( function() {

				/* eslint-enable no-loop-func */

				// The final step of a "hide" animation is actually hiding the element
				if ( !hidden ) {
					showHide( [ elem ] );
				}
				dataPriv.remove( elem, "fxshow" );
				for ( prop in orig ) {
					jQuery.style( elem, prop, orig[ prop ] );
				}
			} );
		}

		// Per-property setup
		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
		if ( !( prop in dataShow ) ) {
			dataShow[ prop ] = propTween.start;
			if ( hidden ) {
				propTween.end = propTween.start;
				propTween.start = 0;
			}
		}
	}
}

function propFilter( props, specialEasing ) {
	var index, name, easing, value, hooks;

	// camelCase, specialEasing and expand cssHook pass
	for ( index in props ) {
		name = camelCase( index );
		easing = specialEasing[ name ];
		value = props[ index ];
		if ( Array.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 only
				// 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 there's more to do, yield
			if ( percent < 1 && length ) {
				return remaining;
			}

			// If this was an empty animation, synthesize a final progress notification
			if ( !length ) {
				deferred.notifyWith( elem, [ animation, 1, 0 ] );
			}

			// Resolve the animation and report its conclusion
			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 ( isFunction( result.stop ) ) {
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
					result.stop.bind( result );
			}
			return result;
		}
	}

	jQuery.map( props, createTween, animation );

	if ( isFunction( animation.opts.start ) ) {
		animation.opts.start.call( elem, animation );
	}

	// Attach callbacks from options
	animation
		.progress( animation.opts.progress )
		.done( animation.opts.done, animation.opts.complete )
		.fail( animation.opts.fail )
		.always( animation.opts.always );

	jQuery.fx.timer(
		jQuery.extend( tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		} )
	);

	return animation;
}

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 ( isFunction( props ) ) {
			callback = props;
			props = [ "*" ];
		} else {
			props = props.match( rnothtmlwhite );
		}

		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 ||
			isFunction( speed ) && speed,
		duration: speed,
		easing: fn && easing || easing && !isFunction( easing ) && easing
	};

	// Go to the end state if fx are off
	if ( jQuery.fx.off ) {
		opt.duration = 0;

	} else {
		if ( typeof opt.duration !== "number" ) {
			if ( opt.duration in jQuery.fx.speeds ) {
				opt.duration = jQuery.fx.speeds[ opt.duration ];

			} else {
				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 ( 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( isHiddenWithinTree ).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 ) {
			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 = Date.now();

	for ( ; i < timers.length; i++ ) {
		timer = timers[ i ];

		// Run the timer and safely remove it when done (allowing for external removal)
		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 );
	jQuery.fx.start();
};

jQuery.fx.interval = 13;
jQuery.fx.start = function() {
	if ( inProgress ) {
		return;
	}

	inProgress = true;
	schedule();
};

jQuery.fx.stop = function() {
	inProgress = null;
};

jQuery.fx.speeds = {
	slow: 600,
	fast: 200,

	// Default speed
	_default: 400
};


// Based off of the plugin by Clint Helfers, with permission.
// https://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: Android <=4.3 only
	// Default value for a checkbox should be "on"
	support.checkOn = input.value !== "";

	// Support: IE <=11 only
	// Must access selectedIndex to make default options select
	support.optSelected = opt.selected;

	// Support: IE <=11 only
	// 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 );
		}

		// Attribute hooks are determined by the lowercase version
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
				( 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" &&
					nodeName( elem, "input" ) ) {
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name,
			i = 0,

			// Attribute names can contain non-HTML whitespace characters
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
			attrNames = value && value.match( rnothtmlwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				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,
			lowercaseName = name.toLowerCase();

		if ( !isXML ) {

			// Avoid an infinite loop by temporarily removing this function from the getter
			handle = attrHandle[ lowercaseName ];
			attrHandle[ lowercaseName ] = ret;
			ret = getter( elem, name, isXML ) != null ?
				lowercaseName :
				null;
			attrHandle[ lowercaseName ] = 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 ) {

				// Support: IE <=9 - 11 only
				// elem.tabIndex doesn't always return the
				// correct value when it hasn't been explicitly set
				// https://web.archive.org/web/20141116233347/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" );

				if ( tabindex ) {
					return parseInt( tabindex, 10 );
				}

				if (
					rfocusable.test( elem.nodeName ) ||
					rclickable.test( elem.nodeName ) &&
					elem.href
				) {
					return 0;
				}

				return -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
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
	jQuery.propHooks.selected = {
		get: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent && parent.parentNode ) {
				parent.parentNode.selectedIndex;
			}
			return null;
		},
		set: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			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;
} );




	// Strip and collapse whitespace according to HTML spec
	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
	function stripAndCollapse( value ) {
		var tokens = value.match( rnothtmlwhite ) || [];
		return tokens.join( " " );
	}


function getClass( elem ) {
	return elem.getAttribute && elem.getAttribute( "class" ) || "";
}

function classesToArray( value ) {
	if ( Array.isArray( value ) ) {
		return value;
	}
	if ( typeof value === "string" ) {
		return value.match( rnothtmlwhite ) || [];
	}
	return [];
}

jQuery.fn.extend( {
	addClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
							cur += clazz + " ";
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( !arguments.length ) {
			return this.attr( "class", "" );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );

				// This expression is here for better compressibility (see addClass)
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				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 = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value,
			isValidValue = type === "string" || Array.isArray( value );

		if ( typeof stateVal === "boolean" && isValidValue ) {
			return stateVal ? this.addClass( value ) : this.removeClass( value );
		}

		if ( 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 ( isValidValue ) {

				// Toggle individual class names
				i = 0;
				self = jQuery( this );
				classNames = classesToArray( value );

				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 &&
				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
				return true;
			}
		}

		return false;
	}
} );




var rreturn = /\r/g;

jQuery.fn.extend( {
	val: function( value ) {
		var hooks, ret, valueIsFunction,
			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;

				// Handle most common string cases
				if ( typeof ret === "string" ) {
					return ret.replace( rreturn, "" );
				}

				// Handle cases where value is null/undef or number
				return ret == null ? "" : ret;
			}

			return;
		}

		valueIsFunction = isFunction( value );

		return this.each( function( i ) {
			var val;

			if ( this.nodeType !== 1 ) {
				return;
			}

			if ( valueIsFunction ) {
				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 ( Array.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: IE <=10 - 11 only
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					stripAndCollapse( jQuery.text( elem ) );
			}
		},
		select: {
			get: function( elem ) {
				var value, option, i,
					options = elem.options,
					index = elem.selectedIndex,
					one = elem.type === "select-one",
					values = one ? null : [],
					max = one ? index + 1 : options.length;

				if ( index < 0 ) {
					i = max;

				} else {
					i = one ? index : 0;
				}

				// Loop through all the selected options
				for ( ; i < max; i++ ) {
					option = options[ i ];

					// Support: IE <=9 only
					// 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
							!option.disabled &&
							( !option.parentNode.disabled ||
								!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 ];

					/* eslint-disable no-cond-assign */

					if ( option.selected =
						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
					) {
						optionSet = true;
					}

					/* eslint-enable no-cond-assign */
				}

				// 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 ( Array.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


support.focusin = "onfocusin" in window;


var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
	stopPropagationCallback = function( e ) {
		e.stopPropagation();
	};

jQuery.extend( jQuery.event, {

	trigger: function( event, data, elem, onlyHandlers ) {

		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
			eventPath = [ elem || document ],
			type = hasOwn.call( event, "type" ) ? event.type : event,
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];

		cur = lastElement = 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 && !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() ) {
			lastElement = cur;
			event.type = i > 1 ?
				bubbleType :
				special.bindType || type;

			// jQuery handler
			handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ 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 as the event.
				// Don't do default actions on window, that's where global variables be (#6170)
				if ( ontype && isFunction( elem[ type ] ) && !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;

					if ( event.isPropagationStopped() ) {
						lastElement.addEventListener( type, stopPropagationCallback );
					}

					elem[ type ]();

					if ( event.isPropagationStopped() ) {
						lastElement.removeEventListener( type, stopPropagationCallback );
					}

					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 );
		}
	}
} );


// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// 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://bugs.chromium.org/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() {

				// Handle: regular nodes (via `this.ownerDocument`), window
				// (via `this.document`) & document (via `this`).
				var doc = this.ownerDocument || this.document || 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.document || 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 = { guid: Date.now() };

var rquery = ( /\?/ );



// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
	var xml, parserErrorElem;
	if ( !data || typeof data !== "string" ) {
		return null;
	}

	// Support: IE 9 - 11 only
	// IE throws on parseFromString with invalid input.
	try {
		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
	} catch ( e ) {}

	parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
	if ( !xml || parserErrorElem ) {
		jQuery.error( "Invalid XML: " + (
			parserErrorElem ?
				jQuery.map( parserErrorElem.childNodes, function( el ) {
					return el.textContent;
				} ).join( "\n" ) :
				data
		) );
	}
	return xml;
};


var
	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 ( Array.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 && toType( 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, valueOrFunction ) {

			// If value is a function, invoke it and use its return value
			var value = isFunction( valueOrFunction ) ?
				valueOrFunction() :
				valueOrFunction;

			s[ s.length ] = encodeURIComponent( key ) + "=" +
				encodeURIComponent( value == null ? "" : value );
		};

	if ( a == null ) {
		return "";
	}

	// If an array was passed in, assume that it is an array of form elements.
	if ( Array.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( "&" );
};

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();

			if ( val == null ) {
				return null;
			}

			if ( Array.isArray( val ) ) {
				return jQuery.map( val, function( val ) {
					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
				} );
			}

			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
		} ).get();
	}
} );


var
	r20 = /%20/g,
	rhash = /#.*$/,
	rantiCache = /([?&])_=[^&]*/,
	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( rnothtmlwhite ) || [];

		if ( 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": JSON.parse,

			// 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,

			// Request state (becomes false upon send and true upon completion)
			completed,

			// To know if global events are to be dispatched
			fireGlobals,

			// Loop variable
			i,

			// uncached part of the url
			uncached,

			// 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 = {},

			// Default abort message
			strAbort = "canceled",

			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function( key ) {
					var match;
					if ( completed ) {
						if ( !responseHeaders ) {
							responseHeaders = {};
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
								responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
									( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
										.concat( match[ 2 ] );
							}
						}
						match = responseHeaders[ key.toLowerCase() + " " ];
					}
					return match == null ? null : match.join( ", " );
				},

				// Raw string
				getAllResponseHeaders: function() {
					return completed ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function( name, value ) {
					if ( completed == null ) {
						name = requestHeadersNames[ name.toLowerCase() ] =
							requestHeadersNames[ name.toLowerCase() ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function( type ) {
					if ( completed == null ) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function( map ) {
					var code;
					if ( map ) {
						if ( completed ) {

							// Execute the appropriate callbacks
							jqXHR.always( map[ jqXHR.status ] );
						} else {

							// Lazy-add the new callbacks in a way that preserves old ones
							for ( code in map ) {
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
							}
						}
					}
					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 );

		// 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( 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 = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];

		// 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: IE <=8 - 11, Edge 12 - 15
			// IE throws exception on accessing the href property if url is malformed,
			// e.g. http://example.com:80x/
			try {
				urlAnchor.href = s.url;

				// Support: IE <=8 - 11 only
				// 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 ( completed ) {
			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
		// Remove hash to simplify url manipulation
		cacheURL = s.url.replace( rhash, "" );

		// More options handling for requests with no content
		if ( !s.hasContent ) {

			// Remember the hash so we can put it back
			uncached = s.url.slice( cacheURL.length );

			// If data is available and should be processed, append data to url
			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;

				// #9682: remove data so that it's not used in an eventual retry
				delete s.data;
			}

			// Add or update anti-cache param if needed
			if ( s.cache === false ) {
				cacheURL = cacheURL.replace( rantiCache, "$1" );
				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
					uncached;
			}

			// Put hash and anti-cache on the URL that will be requested (gh-1732)
			s.url = cacheURL + uncached;

		// Change '%20' to '+' if this is encoded form body content (gh-2658)
		} else if ( s.data && s.processData &&
			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
			s.data = s.data.replace( r20, "+" );
		}

		// 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 || completed ) ) {

			// Abort if not done already and return
			return jqXHR.abort();
		}

		// Aborting is no longer a cancellation
		strAbort = "abort";

		// Install callbacks on deferreds
		completeDeferred.add( s.complete );
		jqXHR.done( s.success );
		jqXHR.fail( s.error );

		// 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 ( completed ) {
				return jqXHR;
			}

			// Timeout
			if ( s.async && s.timeout > 0 ) {
				timeoutTimer = window.setTimeout( function() {
					jqXHR.abort( "timeout" );
				}, s.timeout );
			}

			try {
				completed = false;
				transport.send( requestHeaders, done );
			} catch ( e ) {

				// Rethrow post-completion exceptions
				if ( completed ) {
					throw e;
				}

				// Propagate others as results
				done( -1, e );
			}
		}

		// Callback for when everything is done
		function done( status, nativeStatusText, responses, headers ) {
			var isSuccess, success, error, response, modified,
				statusText = nativeStatusText;

			// Ignore repeat invocations
			if ( completed ) {
				return;
			}

			completed = true;

			// 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 );
			}

			// Use a noop converter for missing script but not if jsonp
			if ( !isSuccess &&
				jQuery.inArray( "script", s.dataTypes ) > -1 &&
				jQuery.inArray( "json", s.dataTypes ) < 0 ) {
				s.converters[ "text script" ] = function() {};
			}

			// 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 ( 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.ajaxPrefilter( function( s ) {
	var i;
	for ( i in s.headers ) {
		if ( i.toLowerCase() === "content-type" ) {
			s.contentType = s.headers[ i ] || "";
		}
	}
} );


jQuery._evalUrl = function( url, options, doc ) {
	return jQuery.ajax( {
		url: url,

		// Make this explicit, since user can override this through ajaxSetup (#11264)
		type: "GET",
		dataType: "script",
		cache: true,
		async: false,
		global: false,

		// Only evaluate the response if it is successful (gh-4126)
		// dataFilter is not invoked for failure responses, so using it instead
		// of the default converter is kludgy but it works.
		converters: {
			"text script": function() {}
		},
		dataFilter: function( response ) {
			jQuery.globalEval( response, options, doc );
		}
	} );
};


jQuery.fn.extend( {
	wrapAll: function( html ) {
		var wrap;

		if ( this[ 0 ] ) {
			if ( isFunction( html ) ) {
				html = html.call( 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 ( 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 htmlIsFunction = isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function( selector ) {
		this.parent( selector ).not( "body" ).each( function() {
			jQuery( this ).replaceWith( this.childNodes );
		} );
		return this;
	}
} );


jQuery.expr.pseudos.hidden = function( elem ) {
	return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};




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: IE <=9 only
		// #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.ontimeout =
									xhr.onreadystatechange = null;

							if ( type === "abort" ) {
								xhr.abort();
							} else if ( type === "error" ) {

								// Support: IE <=9 only
								// 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: IE <=9 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 = xhr.ontimeout = callback( "error" );

				// Support: IE 9 only
				// 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();
				}
			}
		};
	}
} );




// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
	if ( s.crossDomain ) {
		s.contents.script = false;
	}
} );

// 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 or forced-by-attrs requests
	if ( s.crossDomain || s.scriptAttrs ) {
		var script, callback;
		return {
			send: function( _, complete ) {
				script = jQuery( "<script>" )
					.attr( s.scriptAttrs || {} )
					.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.guid++ ) );
		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 = 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 && isFunction( overwritten ) ) {
				overwritten( responseContainer[ 0 ] );
			}

			responseContainer = overwritten = undefined;
		} );

		// Delegate to script
		return "script";
	}
} );




// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
	var body = document.implementation.createHTMLDocument( "" ).body;
	body.innerHTML = "<form></form><form></form>";
	return body.childNodes.length === 2;
} )();


// 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 ( typeof data !== "string" ) {
		return [];
	}
	if ( typeof context === "boolean" ) {
		keepScripts = context;
		context = false;
	}

	var base, parsed, scripts;

	if ( !context ) {

		// Stop scripts or inline event handlers from being executed immediately
		// by using document.implementation
		if ( support.createHTMLDocument ) {
			context = document.implementation.createHTMLDocument( "" );

			// Set the base href for the created document
			// so any parsed elements with URLs
			// are based on the document's URL (gh-2965)
			base = context.createElement( "base" );
			base.href = document.location.href;
			context.head.appendChild( base );
		} else {
			context = document;
		}
	}

	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 );
};


/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = stripAndCollapse( url.slice( off ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( 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;
};




jQuery.expr.pseudos.animated = function( elem ) {
	return jQuery.grep( jQuery.timers, function( fn ) {
		return elem === fn.elem;
	} ).length;
};




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 ( 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() relates an element's border box to the document origin
	offset: function( options ) {

		// Preserve chaining for setter
		if ( arguments.length ) {
			return options === undefined ?
				this :
				this.each( function( i ) {
					jQuery.offset.setOffset( this, options, i );
				} );
		}

		var rect, win,
			elem = this[ 0 ];

		if ( !elem ) {
			return;
		}

		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
		// Support: IE <=11 only
		// Running getBoundingClientRect on a
		// disconnected node in IE throws an error
		if ( !elem.getClientRects().length ) {
			return { top: 0, left: 0 };
		}

		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
		rect = elem.getBoundingClientRect();
		win = elem.ownerDocument.defaultView;
		return {
			top: rect.top + win.pageYOffset,
			left: rect.left + win.pageXOffset
		};
	},

	// position() relates an element's margin box to its offset parent's padding box
	// This corresponds to the behavior of CSS absolute positioning
	position: function() {
		if ( !this[ 0 ] ) {
			return;
		}

		var offsetParent, offset, doc,
			elem = this[ 0 ],
			parentOffset = { top: 0, left: 0 };

		// position:fixed elements are offset from the viewport, which itself always has zero offset
		if ( jQuery.css( elem, "position" ) === "fixed" ) {

			// Assume position:fixed implies availability of getBoundingClientRect
			offset = elem.getBoundingClientRect();

		} else {
			offset = this.offset();

			// Account for the *real* offset parent, which can be the document or its root element
			// when a statically positioned element is identified
			doc = elem.ownerDocument;
			offsetParent = elem.offsetParent || doc.documentElement;
			while ( offsetParent &&
				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
				jQuery.css( offsetParent, "position" ) === "static" ) {

				offsetParent = offsetParent.parentNode;
			}
			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {

				// Incorporate borders into its offset, since they are outside its content origin
				parentOffset = jQuery( offsetParent ).offset();
				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
				parentOffset.left += jQuery.css( offsetParent, "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 ) {

			// Coalesce documents and windows
			var win;
			if ( isWindow( elem ) ) {
				win = elem;
			} else if ( elem.nodeType === 9 ) {
				win = elem.defaultView;
			}

			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 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// 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 ( isWindow( elem ) ) {

					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
					return funcName.indexOf( "outer" ) === 0 ?
						elem[ "inner" + name ] :
						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 );
		};
	} );
} );


jQuery.each( [
	"ajaxStart",
	"ajaxStop",
	"ajaxComplete",
	"ajaxError",
	"ajaxSuccess",
	"ajaxSend"
], function( _i, type ) {
	jQuery.fn[ type ] = function( fn ) {
		return this.on( type, fn );
	};
} );




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 );
	},

	hover: function( fnOver, fnOut ) {
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
	}
} );

jQuery.each(
	( "blur focus focusin focusout resize scroll click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup 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 );
		};
	}
);




// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;

// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
// However, it is not slated for removal any time soon
jQuery.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 ( !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;
};

jQuery.holdReady = function( hold ) {
	if ( hold ) {
		jQuery.readyWait++;
	} else {
		jQuery.ready( true );
	}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;

jQuery.now = Date.now;

jQuery.isNumeric = function( obj ) {

	// As of jQuery 3.0, isNumeric is limited to
	// strings and numbers (primitives or objects)
	// that can be coerced to finite numbers (gh-2662)
	var type = jQuery.type( obj );
	return ( type === "number" || type === "string" ) &&

		// parseFloat NaNs numeric-cast false positives ("")
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
		// subtraction forces infinities to NaN
		!isNaN( obj - parseFloat( obj ) );
};

jQuery.trim = function( text ) {
	return text == null ?
		"" :
		( text + "" ).replace( rtrim, "" );
};



// 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 ( typeof noGlobal === "undefined" ) {
	window.jQuery = window.$ = jQuery;
}




return jQuery;
} );


/***/ }),

/***/ "1290":
/***/ (function(module, exports) {

/**
 * Checks if `value` is suitable for use as unique object key.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
 */
function isKeyable(value) {
  var type = typeof value;
  return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
    ? (value !== '__proto__')
    : (value === null);
}

module.exports = isKeyable;


/***/ }),

/***/ "1310":
/***/ (function(module, exports) {

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike(value) {
  return value != null && typeof value == 'object';
}

module.exports = isObjectLike;


/***/ }),

/***/ "1368":
/***/ (function(module, exports, __webpack_require__) {

var coreJsData = __webpack_require__("da03");

/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  return uid ? ('Symbol(src)_1.' + uid) : '';
}());

/**
 * Checks if `func` has its source masked.
 *
 * @private
 * @param {Function} func The function to check.
 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
 */
function isMasked(func) {
  return !!maskSrcKey && (maskSrcKey in func);
}

module.exports = isMasked;


/***/ }),

/***/ "159b":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var DOMIterables = __webpack_require__("fdbc");
var DOMTokenListPrototype = __webpack_require__("785a");
var forEach = __webpack_require__("17c2");
var createNonEnumerableProperty = __webpack_require__("9112");

var handlePrototype = function (CollectionPrototype) {
  // some Chrome versions have non-configurable methods on DOMTokenList
  if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
    createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
  } catch (error) {
    CollectionPrototype.forEach = forEach;
  }
};

for (var COLLECTION_NAME in DOMIterables) {
  if (DOMIterables[COLLECTION_NAME]) {
    handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
  }
}

handlePrototype(DOMTokenListPrototype);


/***/ }),

/***/ "1626":
/***/ (function(module, exports) {

// `IsCallable` abstract operation
// https://tc39.es/ecma262/#sec-iscallable
module.exports = function (argument) {
  return typeof argument === 'function';
};


/***/ }),

/***/ "17c2":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $forEach = __webpack_require__("b727").forEach;
var arrayMethodIsStrict = __webpack_require__("a640");

var STRICT_METHOD = arrayMethodIsStrict('forEach');

// `Array.prototype.forEach` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.foreach
module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
} : [].forEach;


/***/ }),

/***/ "19aa":
/***/ (function(module, exports) {

module.exports = function (it, Constructor, name) {
  if (it instanceof Constructor) return it;
  throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
};


/***/ }),

/***/ "1a2d":
/***/ (function(module, exports, __webpack_require__) {

var toObject = __webpack_require__("7b0b");

var hasOwnProperty = {}.hasOwnProperty;

// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
module.exports = Object.hasOwn || function hasOwn(it, key) {
  return hasOwnProperty.call(toObject(it), key);
};


/***/ }),

/***/ "1a8c":
/***/ (function(module, exports) {

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject(value) {
  var type = typeof value;
  return value != null && (type == 'object' || type == 'function');
}

module.exports = isObject;


/***/ }),

/***/ "1be4":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");

module.exports = getBuiltIn('document', 'documentElement');


/***/ }),

/***/ "1c3c":
/***/ (function(module, exports, __webpack_require__) {

var Symbol = __webpack_require__("9e69"),
    Uint8Array = __webpack_require__("2474"),
    eq = __webpack_require__("9638"),
    equalArrays = __webpack_require__("a2be"),
    mapToArray = __webpack_require__("edfa"),
    setToArray = __webpack_require__("ac41");

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
    COMPARE_UNORDERED_FLAG = 2;

/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
    dateTag = '[object Date]',
    errorTag = '[object Error]',
    mapTag = '[object Map]',
    numberTag = '[object Number]',
    regexpTag = '[object RegExp]',
    setTag = '[object Set]',
    stringTag = '[object String]',
    symbolTag = '[object Symbol]';

var arrayBufferTag = '[object ArrayBuffer]',
    dataViewTag = '[object DataView]';

/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
    symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;

/**
 * A specialized version of `baseIsEqualDeep` for comparing objects of
 * the same `toStringTag`.
 *
 * **Note:** This function only supports comparing values with tags of
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {string} tag The `toStringTag` of the objects to compare.
 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
 * @param {Function} customizer The function to customize comparisons.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Object} stack Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag:
      if ((object.byteLength != other.byteLength) ||
          (object.byteOffset != other.byteOffset)) {
        return false;
      }
      object = object.buffer;
      other = other.buffer;

    case arrayBufferTag:
      if ((object.byteLength != other.byteLength) ||
          !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
        return false;
      }
      return true;

    case boolTag:
    case dateTag:
    case numberTag:
      // Coerce booleans to `1` or `0` and dates to milliseconds.
      // Invalid dates are coerced to `NaN`.
      return eq(+object, +other);

    case errorTag:
      return object.name == other.name && object.message == other.message;

    case regexpTag:
    case stringTag:
      // Coerce regexes to strings and treat strings, primitives and objects,
      // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
      // for more details.
      return object == (other + '');

    case mapTag:
      var convert = mapToArray;

    case setTag:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
      convert || (convert = setToArray);

      if (object.size != other.size && !isPartial) {
        return false;
      }
      // Assume cyclic values are equal.
      var stacked = stack.get(object);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG;

      // Recursively compare objects (susceptible to call stack limits).
      stack.set(object, other);
      var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
      stack['delete'](object);
      return result;

    case symbolTag:
      if (symbolValueOf) {
        return symbolValueOf.call(object) == symbolValueOf.call(other);
      }
  }
  return false;
}

module.exports = equalByTag;


/***/ }),

/***/ "1c7e":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;

try {
  var called = 0;
  var iteratorWithReturn = {
    next: function () {
      return { done: !!called++ };
    },
    'return': function () {
      SAFE_CLOSING = true;
    }
  };
  iteratorWithReturn[ITERATOR] = function () {
    return this;
  };
  // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
  Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }

module.exports = function (exec, SKIP_CLOSING) {
  if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  var ITERATION_SUPPORT = false;
  try {
    var object = {};
    object[ITERATOR] = function () {
      return {
        next: function () {
          return { done: ITERATION_SUPPORT = true };
        }
      };
    };
    exec(object);
  } catch (error) { /* empty */ }
  return ITERATION_SUPPORT;
};


/***/ }),

/***/ "1cdc":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);


/***/ }),

/***/ "1cec":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07"),
    root = __webpack_require__("2b3e");

/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');

module.exports = Promise;


/***/ }),

/***/ "1d80":
/***/ (function(module, exports) {

// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
  if (it == undefined) throw TypeError("Can't call method on " + it);
  return it;
};


/***/ }),

/***/ "1efc":
/***/ (function(module, exports) {

/**
 * Removes `key` and its value from the hash.
 *
 * @private
 * @name delete
 * @memberOf Hash
 * @param {Object} hash The hash to modify.
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function hashDelete(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}

module.exports = hashDelete;


/***/ }),

/***/ "1fb5":
/***/ (function(module, exports, __webpack_require__) {

"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
}

// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63

function getLens (b64) {
  var len = b64.length

  if (len % 4 > 0) {
    throw new Error('Invalid string. Length must be a multiple of 4')
  }

  // Trim off extra bytes after placeholder bytes are found
  // See: https://github.com/beatgammit/base64-js/issues/42
  var validLen = b64.indexOf('=')
  if (validLen === -1) validLen = len

  var placeHoldersLen = validLen === len
    ? 0
    : 4 - (validLen % 4)

  return [validLen, placeHoldersLen]
}

// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function _byteLength (b64, validLen, placeHoldersLen) {
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function toByteArray (b64) {
  var tmp
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]

  var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))

  var curByte = 0

  // if there are placeholders, only get up to the last complete 4 chars
  var len = placeHoldersLen > 0
    ? validLen - 4
    : validLen

  var i
  for (i = 0; i < len; i += 4) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 18) |
      (revLookup[b64.charCodeAt(i + 1)] << 12) |
      (revLookup[b64.charCodeAt(i + 2)] << 6) |
      revLookup[b64.charCodeAt(i + 3)]
    arr[curByte++] = (tmp >> 16) & 0xFF
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 2) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 2) |
      (revLookup[b64.charCodeAt(i + 1)] >> 4)
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 1) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 10) |
      (revLookup[b64.charCodeAt(i + 1)] << 4) |
      (revLookup[b64.charCodeAt(i + 2)] >> 2)
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = 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) & 0xFF0000) +
      ((uint8[i + 1] << 8) & 0xFF00) +
      (uint8[i + 2] & 0xFF)
    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 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]
    parts.push(
      lookup[tmp >> 2] +
      lookup[(tmp << 4) & 0x3F] +
      '=='
    )
  } else if (extraBytes === 2) {
    tmp = (uint8[len - 2] << 8) + uint8[len - 1]
    parts.push(
      lookup[tmp >> 10] +
      lookup[(tmp >> 4) & 0x3F] +
      lookup[(tmp << 2) & 0x3F] +
      '='
    )
  }

  return parts.join('')
}


/***/ }),

/***/ "1fc8":
/***/ (function(module, exports, __webpack_require__) {

var getMapData = __webpack_require__("4245");

/**
 * Sets the map `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf MapCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the map cache instance.
 */
function mapCacheSet(key, value) {
  var data = getMapData(this, key),
      size = data.size;

  data.set(key, value);
  this.size += data.size == size ? 0 : 1;
  return this;
}

module.exports = mapCacheSet;


/***/ }),

/***/ "2266":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var isArrayIteratorMethod = __webpack_require__("e95a");
var lengthOfArrayLike = __webpack_require__("07fa");
var bind = __webpack_require__("0366");
var getIterator = __webpack_require__("9a1f");
var getIteratorMethod = __webpack_require__("35a1");
var iteratorClose = __webpack_require__("2a62");

var Result = function (stopped, result) {
  this.stopped = stopped;
  this.result = result;
};

module.exports = function (iterable, unboundFunction, options) {
  var that = options && options.that;
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  var INTERRUPTED = !!(options && options.INTERRUPTED);
  var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  var iterator, iterFn, index, length, result, next, step;

  var stop = function (condition) {
    if (iterator) iteratorClose(iterator, 'normal', condition);
    return new Result(true, condition);
  };

  var callFn = function (value) {
    if (AS_ENTRIES) {
      anObject(value);
      return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
    } return INTERRUPTED ? fn(value, stop) : fn(value);
  };

  if (IS_ITERATOR) {
    iterator = iterable;
  } else {
    iterFn = getIteratorMethod(iterable);
    if (!iterFn) throw TypeError(String(iterable) + ' is not iterable');
    // optimisation for array iterators
    if (isArrayIteratorMethod(iterFn)) {
      for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
        result = callFn(iterable[index]);
        if (result && result instanceof Result) return result;
      } return new Result(false);
    }
    iterator = getIterator(iterable, iterFn);
  }

  next = iterator.next;
  while (!(step = next.call(iterator)).done) {
    try {
      result = callFn(step.value);
    } catch (error) {
      iteratorClose(iterator, 'throw', error);
    }
    if (typeof result == 'object' && result && result instanceof Result) return result;
  } return new Result(false);
};


/***/ }),

/***/ "23cb":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");

var max = Math.max;
var min = Math.min;

// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
module.exports = function (index, length) {
  var integer = toIntegerOrInfinity(index);
  return integer < 0 ? max(integer + length, 0) : min(integer, length);
};


/***/ }),

/***/ "23e7":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var createNonEnumerableProperty = __webpack_require__("9112");
var redefine = __webpack_require__("6eeb");
var setGlobal = __webpack_require__("ce4e");
var copyConstructorProperties = __webpack_require__("e893");
var isForced = __webpack_require__("94ca");

/*
  options.target      - name of the target object
  options.global      - target is the global object
  options.stat        - export as static methods of target
  options.proto       - export as prototype methods of target
  options.real        - real prototype method for the `pure` version
  options.forced      - export even if the native feature is available
  options.bind        - bind methods to the target, required for the `pure` version
  options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
  options.unsafe      - use the simple assignment of property instead of delete + defineProperty
  options.sham        - add a flag to not completely full polyfills
  options.enumerable  - export as enumerable property
  options.noTargetGet - prevent calling a getter on target
  options.name        - the .name of the function if it does not match the key
*/
module.exports = function (options, source) {
  var TARGET = options.target;
  var GLOBAL = options.global;
  var STATIC = options.stat;
  var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  if (GLOBAL) {
    target = global;
  } else if (STATIC) {
    target = global[TARGET] || setGlobal(TARGET, {});
  } else {
    target = (global[TARGET] || {}).prototype;
  }
  if (target) for (key in source) {
    sourceProperty = source[key];
    if (options.noTargetGet) {
      descriptor = getOwnPropertyDescriptor(target, key);
      targetProperty = descriptor && descriptor.value;
    } else targetProperty = target[key];
    FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
    // contained in target
    if (!FORCED && targetProperty !== undefined) {
      if (typeof sourceProperty === typeof targetProperty) continue;
      copyConstructorProperties(sourceProperty, targetProperty);
    }
    // add a flag to not completely full polyfills
    if (options.sham || (targetProperty && targetProperty.sham)) {
      createNonEnumerableProperty(sourceProperty, 'sham', true);
    }
    // extend global
    redefine(target, key, sourceProperty, options);
  }
};


/***/ }),

/***/ "241c":
/***/ (function(module, exports, __webpack_require__) {

var internalObjectKeys = __webpack_require__("ca84");
var enumBugKeys = __webpack_require__("7839");

var hiddenKeys = enumBugKeys.concat('length', 'prototype');

// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return internalObjectKeys(O, hiddenKeys);
};


/***/ }),

/***/ "2474":
/***/ (function(module, exports, __webpack_require__) {

var root = __webpack_require__("2b3e");

/** Built-in value references. */
var Uint8Array = root.Uint8Array;

module.exports = Uint8Array;


/***/ }),

/***/ "2478":
/***/ (function(module, exports, __webpack_require__) {

var getMapData = __webpack_require__("4245");

/**
 * Gets the map value for `key`.
 *
 * @private
 * @name get
 * @memberOf MapCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function mapCacheGet(key) {
  return getMapData(this, key).get(key);
}

module.exports = mapCacheGet;


/***/ }),

/***/ "2524":
/***/ (function(module, exports, __webpack_require__) {

var nativeCreate = __webpack_require__("6044");

/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';

/**
 * Sets the hash `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Hash
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the hash instance.
 */
function hashSet(key, value) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  return this;
}

module.exports = hashSet;


/***/ }),

/***/ "253c":
/***/ (function(module, exports, __webpack_require__) {

var baseGetTag = __webpack_require__("3729"),
    isObjectLike = __webpack_require__("1310");

/** `Object#toString` result references. */
var argsTag = '[object Arguments]';

/**
 * The base implementation of `_.isArguments`.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
 */
function baseIsArguments(value) {
  return isObjectLike(value) && baseGetTag(value) == argsTag;
}

module.exports = baseIsArguments;


/***/ }),

/***/ "2626":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var getBuiltIn = __webpack_require__("d066");
var definePropertyModule = __webpack_require__("9bf2");
var wellKnownSymbol = __webpack_require__("b622");
var DESCRIPTORS = __webpack_require__("83ab");

var SPECIES = wellKnownSymbol('species');

module.exports = function (CONSTRUCTOR_NAME) {
  var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  var defineProperty = definePropertyModule.f;

  if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
    defineProperty(Constructor, SPECIES, {
      configurable: true,
      get: function () { return this; }
    });
  }
};


/***/ }),

/***/ "28c9":
/***/ (function(module, exports) {

/**
 * Removes all key-value entries from the list cache.
 *
 * @private
 * @name clear
 * @memberOf ListCache
 */
function listCacheClear() {
  this.__data__ = [];
  this.size = 0;
}

module.exports = listCacheClear;


/***/ }),

/***/ "29f3":
/***/ (function(module, exports) {

/** Used for built-in method references. */
var objectProto = Object.prototype;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString = objectProto.toString;

/**
 * Converts `value` to a string using `Object.prototype.toString`.
 *
 * @private
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 */
function objectToString(value) {
  return nativeObjectToString.call(value);
}

module.exports = objectToString;


/***/ }),

/***/ "2a62":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var getMethod = __webpack_require__("dc4a");

module.exports = function (iterator, kind, value) {
  var innerResult, innerError;
  anObject(iterator);
  try {
    innerResult = getMethod(iterator, 'return');
    if (!innerResult) {
      if (kind === 'throw') throw value;
      return value;
    }
    innerResult = innerResult.call(iterator);
  } catch (error) {
    innerError = true;
    innerResult = error;
  }
  if (kind === 'throw') throw value;
  if (innerError) throw innerResult;
  anObject(innerResult);
  return value;
};


/***/ }),

/***/ "2b3e":
/***/ (function(module, exports, __webpack_require__) {

var freeGlobal = __webpack_require__("585a");

/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;

/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();

module.exports = root;


/***/ }),

/***/ "2cf4":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var fails = __webpack_require__("d039");
var bind = __webpack_require__("0366");
var html = __webpack_require__("1be4");
var createElement = __webpack_require__("cc12");
var IS_IOS = __webpack_require__("1cdc");
var IS_NODE = __webpack_require__("605d");

var set = global.setImmediate;
var clear = global.clearImmediate;
var process = global.process;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var location, defer, channel, port;

try {
  // Deno throws a ReferenceError on `location` access without `--location` flag
  location = global.location;
} catch (error) { /* empty */ }

var run = function (id) {
  // eslint-disable-next-line no-prototype-builtins -- safe
  if (queue.hasOwnProperty(id)) {
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};

var runner = function (id) {
  return function () {
    run(id);
  };
};

var listener = function (event) {
  run(event.data);
};

var post = function (id) {
  // old engines have not location.origin
  global.postMessage(String(id), location.protocol + '//' + location.host);
};

// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set || !clear) {
  set = function setImmediate(fn) {
    var args = [];
    var argumentsLength = arguments.length;
    var i = 1;
    while (argumentsLength > i) args.push(arguments[i++]);
    queue[++counter] = function () {
      // eslint-disable-next-line no-new-func -- spec requirement
      (isCallable(fn) ? fn : Function(fn)).apply(undefined, args);
    };
    defer(counter);
    return counter;
  };
  clear = function clearImmediate(id) {
    delete queue[id];
  };
  // Node.js 0.8-
  if (IS_NODE) {
    defer = function (id) {
      process.nextTick(runner(id));
    };
  // Sphere (JS game engine) Dispatch API
  } else if (Dispatch && Dispatch.now) {
    defer = function (id) {
      Dispatch.now(runner(id));
    };
  // Browsers with MessageChannel, includes WebWorkers
  // except iOS - https://github.com/zloirock/core-js/issues/624
  } else if (MessageChannel && !IS_IOS) {
    channel = new MessageChannel();
    port = channel.port2;
    channel.port1.onmessage = listener;
    defer = bind(port.postMessage, port, 1);
  // Browsers with postMessage, skip WebWorkers
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if (
    global.addEventListener &&
    isCallable(global.postMessage) &&
    !global.importScripts &&
    location && location.protocol !== 'file:' &&
    !fails(post)
  ) {
    defer = post;
    global.addEventListener('message', listener, false);
  // IE8-
  } else if (ONREADYSTATECHANGE in createElement('script')) {
    defer = function (id) {
      html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
        html.removeChild(this);
        run(id);
      };
    };
  // Rest old browsers
  } else {
    defer = function (id) {
      setTimeout(runner(id), 0);
    };
  }
}

module.exports = {
  set: set,
  clear: clear
};


/***/ }),

/***/ "2d00":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var userAgent = __webpack_require__("342f");

var process = global.process;
var Deno = global.Deno;
var versions = process && process.versions || Deno && Deno.version;
var v8 = versions && versions.v8;
var match, version;

if (v8) {
  match = v8.split('.');
  version = match[0] < 4 ? 1 : match[0] + match[1];
} else if (userAgent) {
  match = userAgent.match(/Edge\/(\d+)/);
  if (!match || match[1] >= 74) {
    match = userAgent.match(/Chrome\/(\d+)/);
    if (match) version = match[1];
  }
}

module.exports = version && +version;


/***/ }),

/***/ "2d7c":
/***/ (function(module, exports) {

/**
 * A specialized version of `_.filter` for arrays without support for
 * iteratee shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} predicate The function invoked per iteration.
 * @returns {Array} Returns the new filtered array.
 */
function arrayFilter(array, predicate) {
  var index = -1,
      length = array == null ? 0 : array.length,
      resIndex = 0,
      result = [];

  while (++index < length) {
    var value = array[index];
    if (predicate(value, index, array)) {
      result[resIndex++] = value;
    }
  }
  return result;
}

module.exports = arrayFilter;


/***/ }),

/***/ "2dcb":
/***/ (function(module, exports, __webpack_require__) {

var overArg = __webpack_require__("91e9");

/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);

module.exports = getPrototype;


/***/ }),

/***/ "2f47":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
// Current version.
var VERSION = '1.13.1';

// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
// instead of `window` for `WebWorker` support.
var root = typeof self == 'object' && self.self === self && self ||
          typeof global == 'object' && global.global === global && global ||
          Function('return this')() ||
          {};

// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype;
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;

// Create quick reference variables for speed access to core prototypes.
var push = ArrayProto.push,
    slice = ArrayProto.slice,
    toString = ObjProto.toString,
    hasOwnProperty = ObjProto.hasOwnProperty;

// Modern feature detection.
var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
    supportsDataView = typeof DataView !== 'undefined';

// All **ECMAScript 5+** native function implementations that we hope to use
// are declared here.
var nativeIsArray = Array.isArray,
    nativeKeys = Object.keys,
    nativeCreate = Object.create,
    nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;

// Create references to these builtin functions because we override them.
var _isNaN = isNaN,
    _isFinite = isFinite;

// 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'];

// The largest integer that can be represented exactly.
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "2fcc":
/***/ (function(module, exports) {

/**
 * Removes `key` and its value from the stack.
 *
 * @private
 * @name delete
 * @memberOf Stack
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function stackDelete(key) {
  var data = this.__data__,
      result = data['delete'](key);

  this.size = data.size;
  return result;
}

module.exports = stackDelete;


/***/ }),

/***/ "30c9":
/***/ (function(module, exports, __webpack_require__) {

var isFunction = __webpack_require__("9520"),
    isLength = __webpack_require__("b218");

/**
 * Checks if `value` is array-like. A value is considered array-like if it's
 * not a function and has a `value.length` that's an integer greater than or
 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
 * @example
 *
 * _.isArrayLike([1, 2, 3]);
 * // => true
 *
 * _.isArrayLike(document.body.children);
 * // => true
 *
 * _.isArrayLike('abc');
 * // => true
 *
 * _.isArrayLike(_.noop);
 * // => false
 */
function isArrayLike(value) {
  return value != null && isLength(value.length) && !isFunction(value);
}

module.exports = isArrayLike;


/***/ }),

/***/ "32f4":
/***/ (function(module, exports, __webpack_require__) {

var arrayFilter = __webpack_require__("2d7c"),
    stubArray = __webpack_require__("d327");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;

/**
 * Creates an array of the own enumerable symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of symbols.
 */
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  if (object == null) {
    return [];
  }
  object = Object(object);
  return arrayFilter(nativeGetSymbols(object), function(symbol) {
    return propertyIsEnumerable.call(object, symbol);
  });
};

module.exports = getSymbols;


/***/ }),

/***/ "342f":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");

module.exports = getBuiltIn('navigator', 'userAgent') || '';


/***/ }),

/***/ "34ac":
/***/ (function(module, exports, __webpack_require__) {

var isFunction = __webpack_require__("9520"),
    isMasked = __webpack_require__("1368"),
    isObject = __webpack_require__("1a8c"),
    toSource = __webpack_require__("dc57");

/**
 * Used to match `RegExp`
 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
 */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;

/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;

/** Used for built-in method references. */
var funcProto = Function.prototype,
    objectProto = Object.prototype;

/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
  funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);

/**
 * The base implementation of `_.isNative` without bad shim checks.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a native function,
 *  else `false`.
 */
function baseIsNative(value) {
  if (!isObject(value) || isMasked(value)) {
    return false;
  }
  var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  return pattern.test(toSource(value));
}

module.exports = baseIsNative;


/***/ }),

/***/ "35a1":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("f5df");
var getMethod = __webpack_require__("dc4a");
var Iterators = __webpack_require__("3f8c");
var wellKnownSymbol = __webpack_require__("b622");

var ITERATOR = wellKnownSymbol('iterator');

module.exports = function (it) {
  if (it != undefined) return getMethod(it, ITERATOR)
    || getMethod(it, '@@iterator')
    || Iterators[classof(it)];
};


/***/ }),

/***/ "3698":
/***/ (function(module, exports) {

/**
 * Gets the value at `key` of `object`.
 *
 * @private
 * @param {Object} [object] The object to query.
 * @param {string} key The key of the property to get.
 * @returns {*} Returns the property value.
 */
function getValue(object, key) {
  return object == null ? undefined : object[key];
}

module.exports = getValue;


/***/ }),

/***/ "3729":
/***/ (function(module, exports, __webpack_require__) {

var Symbol = __webpack_require__("9e69"),
    getRawTag = __webpack_require__("00fd"),
    objectToString = __webpack_require__("29f3");

/** `Object#toString` result references. */
var nullTag = '[object Null]',
    undefinedTag = '[object Undefined]';

/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;

/**
 * The base implementation of `getTag` without fallbacks for buggy environments.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
function baseGetTag(value) {
  if (value == null) {
    return value === undefined ? undefinedTag : nullTag;
  }
  return (symToStringTag && symToStringTag in Object(value))
    ? getRawTag(value)
    : objectToString(value);
}

module.exports = baseGetTag;


/***/ }),

/***/ "39ff":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07"),
    root = __webpack_require__("2b3e");

/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');

module.exports = WeakMap;


/***/ }),

/***/ "3bbe":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");

module.exports = function (argument) {
  if (typeof argument === 'object' || isCallable(argument)) return argument;
  throw TypeError("Can't set " + String(argument) + ' as a prototype');
};


/***/ }),

/***/ "3f8c":
/***/ (function(module, exports) {

module.exports = {};


/***/ }),

/***/ "4160":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var forEach = __webpack_require__("17c2");

// `Array.prototype.forEach` method
// https://tc39.es/ecma262/#sec-array.prototype.foreach
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
  forEach: forEach
});


/***/ }),

/***/ "4245":
/***/ (function(module, exports, __webpack_require__) {

var isKeyable = __webpack_require__("1290");

/**
 * Gets the data for `map`.
 *
 * @private
 * @param {Object} map The map to query.
 * @param {string} key The reference key.
 * @returns {*} Returns the map data.
 */
function getMapData(map, key) {
  var data = map.__data__;
  return isKeyable(key)
    ? data[typeof key == 'string' ? 'string' : 'hash']
    : data.map;
}

module.exports = getMapData;


/***/ }),

/***/ "4284":
/***/ (function(module, exports) {

/**
 * A specialized version of `_.some` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} predicate The function invoked per iteration.
 * @returns {boolean} Returns `true` if any element passes the predicate check,
 *  else `false`.
 */
function arraySome(array, predicate) {
  var index = -1,
      length = array == null ? 0 : array.length;

  while (++index < length) {
    if (predicate(array[index], index, array)) {
      return true;
    }
  }
  return false;
}

module.exports = arraySome;


/***/ }),

/***/ "42a2":
/***/ (function(module, exports, __webpack_require__) {

var DataView = __webpack_require__("b5a7"),
    Map = __webpack_require__("79bc"),
    Promise = __webpack_require__("1cec"),
    Set = __webpack_require__("c869"),
    WeakMap = __webpack_require__("39ff"),
    baseGetTag = __webpack_require__("3729"),
    toSource = __webpack_require__("dc57");

/** `Object#toString` result references. */
var mapTag = '[object Map]',
    objectTag = '[object Object]',
    promiseTag = '[object Promise]',
    setTag = '[object Set]',
    weakMapTag = '[object WeakMap]';

var dataViewTag = '[object DataView]';

/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
    mapCtorString = toSource(Map),
    promiseCtorString = toSource(Promise),
    setCtorString = toSource(Set),
    weakMapCtorString = toSource(WeakMap);

/**
 * Gets the `toStringTag` of `value`.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
var getTag = baseGetTag;

// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
    (Map && getTag(new Map) != mapTag) ||
    (Promise && getTag(Promise.resolve()) != promiseTag) ||
    (Set && getTag(new Set) != setTag) ||
    (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  getTag = function(value) {
    var result = baseGetTag(value),
        Ctor = result == objectTag ? value.constructor : undefined,
        ctorString = Ctor ? toSource(Ctor) : '';

    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString: return dataViewTag;
        case mapCtorString: return mapTag;
        case promiseCtorString: return promiseTag;
        case setCtorString: return setTag;
        case weakMapCtorString: return weakMapTag;
      }
    }
    return result;
  };
}

module.exports = getTag;


/***/ }),

/***/ "44ad":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var classof = __webpack_require__("c6b6");

var split = ''.split;

// fallback for non-array-like ES3 and non-enumerable old V8 strings
module.exports = fails(function () {
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  // eslint-disable-next-line no-prototype-builtins -- safe
  return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
  return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;


/***/ }),

/***/ "44de":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = function (a, b) {
  var console = global.console;
  if (console && console.error) {
    arguments.length === 1 ? console.error(a) : console.error(a, b);
  }
};


/***/ }),

/***/ "46d9":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, "ManagerBase", function() { return /* reexport */ manager_base_ManagerBase; });
__webpack_require__.d(__webpack_exports__, "serialize_state", function() { return /* reexport */ serialize_state; });
__webpack_require__.d(__webpack_exports__, "unpack_models", function() { return /* reexport */ unpack_models; });
__webpack_require__.d(__webpack_exports__, "WidgetModel", function() { return /* reexport */ widget_WidgetModel; });
__webpack_require__.d(__webpack_exports__, "DOMWidgetModel", function() { return /* reexport */ widget_DOMWidgetModel; });
__webpack_require__.d(__webpack_exports__, "WidgetView", function() { return /* reexport */ widget_WidgetView; });
__webpack_require__.d(__webpack_exports__, "JupyterPhosphorWidget", function() { return /* reexport */ JupyterPhosphorWidget; });
__webpack_require__.d(__webpack_exports__, "JupyterPhosphorPanelWidget", function() { return /* reexport */ JupyterPhosphorPanelWidget; });
__webpack_require__.d(__webpack_exports__, "DOMWidgetView", function() { return /* reexport */ widget_DOMWidgetView; });
__webpack_require__.d(__webpack_exports__, "LayoutModel", function() { return /* reexport */ widget_layout_LayoutModel; });
__webpack_require__.d(__webpack_exports__, "LayoutView", function() { return /* reexport */ LayoutView; });
__webpack_require__.d(__webpack_exports__, "StyleModel", function() { return /* reexport */ widget_style_StyleModel; });
__webpack_require__.d(__webpack_exports__, "StyleView", function() { return /* reexport */ StyleView; });
__webpack_require__.d(__webpack_exports__, "shims", function() { return /* reexport */ shims; });
__webpack_require__.d(__webpack_exports__, "ViewList", function() { return /* reexport */ ViewList; });
__webpack_require__.d(__webpack_exports__, "JUPYTER_WIDGETS_VERSION", function() { return /* reexport */ JUPYTER_WIDGETS_VERSION; });
__webpack_require__.d(__webpack_exports__, "PROTOCOL_VERSION", function() { return /* reexport */ PROTOCOL_VERSION; });
__webpack_require__.d(__webpack_exports__, "difference", function() { return /* reexport */ difference; });
__webpack_require__.d(__webpack_exports__, "isEqual", function() { return /* reexport */ utils_isEqual; });
__webpack_require__.d(__webpack_exports__, "assign", function() { return /* reexport */ utils_assign; });
__webpack_require__.d(__webpack_exports__, "uuid", function() { return /* reexport */ uuid; });
__webpack_require__.d(__webpack_exports__, "WrappedError", function() { return /* reexport */ WrappedError; });
__webpack_require__.d(__webpack_exports__, "resolvePromisesDict", function() { return /* reexport */ resolvePromisesDict; });
__webpack_require__.d(__webpack_exports__, "reject", function() { return /* reexport */ reject; });
__webpack_require__.d(__webpack_exports__, "put_buffers", function() { return /* reexport */ put_buffers; });
__webpack_require__.d(__webpack_exports__, "remove_buffers", function() { return /* reexport */ remove_buffers; });
__webpack_require__.d(__webpack_exports__, "bufferToHex", function() { return /* reexport */ bufferToHex; });
__webpack_require__.d(__webpack_exports__, "hexToBuffer", function() { return /* reexport */ hexToBuffer; });
__webpack_require__.d(__webpack_exports__, "bufferToBase64", function() { return /* reexport */ bufferToBase64; });
__webpack_require__.d(__webpack_exports__, "base64ToBuffer", function() { return /* reexport */ base64ToBuffer; });
__webpack_require__.d(__webpack_exports__, "IJupyterWidgetRegistry", function() { return /* reexport */ IJupyterWidgetRegistry; });

// EXTERNAL MODULE: ./node_modules/base64-js/index.js
var base64_js = __webpack_require__("1fb5");

// CONCATENATED MODULE: ./node_modules/@lumino/coreutils/dist/index.es6.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for JSON-specific functions.
 */
var JSONExt;
(function (JSONExt) {
    /**
     * A shared frozen empty JSONObject
     */
    JSONExt.emptyObject = Object.freeze({});
    /**
     * A shared frozen empty JSONArray
     */
    JSONExt.emptyArray = Object.freeze([]);
    /**
     * Test whether a JSON value is a primitive.
     *
     * @param value - The JSON value of interest.
     *
     * @returns `true` if the value is a primitive,`false` otherwise.
     */
    function isPrimitive(value) {
        return (value === null ||
            typeof value === 'boolean' ||
            typeof value === 'number' ||
            typeof value === 'string');
    }
    JSONExt.isPrimitive = isPrimitive;
    function isArray(value) {
        return Array.isArray(value);
    }
    JSONExt.isArray = isArray;
    function isObject(value) {
        return !isPrimitive(value) && !isArray(value);
    }
    JSONExt.isObject = isObject;
    /**
     * Compare two JSON values for deep equality.
     *
     * @param first - The first JSON value of interest.
     *
     * @param second - The second JSON value of interest.
     *
     * @returns `true` if the values are equivalent, `false` otherwise.
     */
    function deepEqual(first, second) {
        // Check referential and primitive equality first.
        if (first === second) {
            return true;
        }
        // If one is a primitive, the `===` check ruled out the other.
        if (isPrimitive(first) || isPrimitive(second)) {
            return false;
        }
        // Test whether they are arrays.
        var a1 = isArray(first);
        var a2 = isArray(second);
        // Bail if the types are different.
        if (a1 !== a2) {
            return false;
        }
        // If they are both arrays, compare them.
        if (a1 && a2) {
            return deepArrayEqual(first, second);
        }
        // At this point, they must both be objects.
        return deepObjectEqual(first, second);
    }
    JSONExt.deepEqual = deepEqual;
    /**
     * Create a deep copy of a JSON value.
     *
     * @param value - The JSON value to copy.
     *
     * @returns A deep copy of the given JSON value.
     */
    function deepCopy(value) {
        // Do nothing for primitive values.
        if (isPrimitive(value)) {
            return value;
        }
        // Deep copy an array.
        if (isArray(value)) {
            return deepArrayCopy(value);
        }
        // Deep copy an object.
        return deepObjectCopy(value);
    }
    JSONExt.deepCopy = deepCopy;
    /**
     * Compare two JSON arrays for deep equality.
     */
    function deepArrayEqual(first, second) {
        // Check referential equality first.
        if (first === second) {
            return true;
        }
        // Test the arrays for equal length.
        if (first.length !== second.length) {
            return false;
        }
        // Compare the values for equality.
        for (var i = 0, n = first.length; i < n; ++i) {
            if (!deepEqual(first[i], second[i])) {
                return false;
            }
        }
        // At this point, the arrays are equal.
        return true;
    }
    /**
     * Compare two JSON objects for deep equality.
     */
    function deepObjectEqual(first, second) {
        // Check referential equality first.
        if (first === second) {
            return true;
        }
        // Check for the first object's keys in the second object.
        for (var key in first) {
            if (first[key] !== undefined && !(key in second)) {
                return false;
            }
        }
        // Check for the second object's keys in the first object.
        for (var key in second) {
            if (second[key] !== undefined && !(key in first)) {
                return false;
            }
        }
        // Compare the values for equality.
        for (var key in first) {
            // Get the values.
            var firstValue = first[key];
            var secondValue = second[key];
            // If both are undefined, ignore the key.
            if (firstValue === undefined && secondValue === undefined) {
                continue;
            }
            // If only one value is undefined, the objects are not equal.
            if (firstValue === undefined || secondValue === undefined) {
                return false;
            }
            // Compare the values.
            if (!deepEqual(firstValue, secondValue)) {
                return false;
            }
        }
        // At this point, the objects are equal.
        return true;
    }
    /**
     * Create a deep copy of a JSON array.
     */
    function deepArrayCopy(value) {
        var result = new Array(value.length);
        for (var i = 0, n = value.length; i < n; ++i) {
            result[i] = deepCopy(value[i]);
        }
        return result;
    }
    /**
     * Create a deep copy of a JSON object.
     */
    function deepObjectCopy(value) {
        var result = {};
        for (var key in value) {
            // Ignore undefined values.
            var subvalue = value[key];
            if (subvalue === undefined) {
                continue;
            }
            result[key] = deepCopy(subvalue);
        }
        return result;
    }
})(JSONExt || (JSONExt = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * An object which stores MIME data for general application use.
 *
 * #### Notes
 * This class does not attempt to enforce "correctness" of MIME types
 * and their associated data. Since this class is designed to transfer
 * arbitrary data and objects within the same application, it assumes
 * that the user provides correct and accurate data.
 */
var MimeData = /** @class */ (function () {
    function MimeData() {
        this._types = [];
        this._values = [];
    }
    /**
     * Get an array of the MIME types contained within the dataset.
     *
     * @returns A new array of the MIME types, in order of insertion.
     */
    MimeData.prototype.types = function () {
        return this._types.slice();
    };
    /**
     * Test whether the dataset has an entry for the given type.
     *
     * @param mime - The MIME type of interest.
     *
     * @returns `true` if the dataset contains a value for the given
     *   MIME type, `false` otherwise.
     */
    MimeData.prototype.hasData = function (mime) {
        return this._types.indexOf(mime) !== -1;
    };
    /**
     * Get the data value for the given MIME type.
     *
     * @param mime - The MIME type of interest.
     *
     * @returns The value for the given MIME type, or `undefined` if
     *   the dataset does not contain a value for the type.
     */
    MimeData.prototype.getData = function (mime) {
        var i = this._types.indexOf(mime);
        return i !== -1 ? this._values[i] : undefined;
    };
    /**
     * Set the data value for the given MIME type.
     *
     * @param mime - The MIME type of interest.
     *
     * @param data - The data value for the given MIME type.
     *
     * #### Notes
     * This will overwrite any previous entry for the MIME type.
     */
    MimeData.prototype.setData = function (mime, data) {
        this.clearData(mime);
        this._types.push(mime);
        this._values.push(data);
    };
    /**
     * Remove the data entry for the given MIME type.
     *
     * @param mime - The MIME type of interest.
     *
     * #### Notes
     * This is a no-op if there is no entry for the given MIME type.
     */
    MimeData.prototype.clearData = function (mime) {
        var i = this._types.indexOf(mime);
        if (i !== -1) {
            this._types.splice(i, 1);
            this._values.splice(i, 1);
        }
    };
    /**
     * Remove all data entries from the dataset.
     */
    MimeData.prototype.clear = function () {
        this._types.length = 0;
        this._values.length = 0;
    };
    return MimeData;
}());

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * A class which wraps a promise into a delegate object.
 *
 * #### Notes
 * This class is useful when the logic to resolve or reject a promise
 * cannot be defined at the point where the promise is created.
 */
var PromiseDelegate = /** @class */ (function () {
    /**
     * Construct a new promise delegate.
     */
    function PromiseDelegate() {
        var _this = this;
        this.promise = new Promise(function (resolve, reject) {
            _this._resolve = resolve;
            _this._reject = reject;
        });
    }
    /**
     * Resolve the wrapped promise with the given value.
     *
     * @param value - The value to use for resolving the promise.
     */
    PromiseDelegate.prototype.resolve = function (value) {
        var resolve = this._resolve;
        resolve(value);
    };
    /**
     * Reject the wrapped promise with the given value.
     *
     * @reason - The reason for rejecting the promise.
     */
    PromiseDelegate.prototype.reject = function (reason) {
        var reject = this._reject;
        reject(reason);
    };
    return PromiseDelegate;
}());

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for random number related functionality.
 */
var Random;
(function (Random) {
    /**
     * A function which generates random bytes.
     *
     * @param buffer - The `Uint8Array` to fill with random bytes.
     *
     * #### Notes
     * A cryptographically strong random number generator will be used if
     * available. Otherwise, `Math.random` will be used as a fallback for
     * randomness.
     *
     * The following RNGs are supported, listed in order of precedence:
     *   - `window.crypto.getRandomValues`
     *   - `window.msCrypto.getRandomValues`
     *   - `require('crypto').randomFillSync
     *   - `require('crypto').randomBytes
     *   - `Math.random`
     */
    Random.getRandomValues = (function () {
        // Look up the crypto module if available.
        var crypto = (typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||
            ( true && __webpack_require__(0)) ||
            null;
        // Modern browsers and IE 11
        if (crypto && typeof crypto.getRandomValues === 'function') {
            return function getRandomValues(buffer) {
                return crypto.getRandomValues(buffer);
            };
        }
        // Node 7+
        if (crypto && typeof crypto.randomFillSync === 'function') {
            return function getRandomValues(buffer) {
                return crypto.randomFillSync(buffer);
            };
        }
        // Node 0.10+
        if (crypto && typeof crypto.randomBytes === 'function') {
            return function getRandomValues(buffer) {
                var bytes = crypto.randomBytes(buffer.length);
                for (var i = 0, n = bytes.length; i < n; ++i) {
                    buffer[i] = bytes[i];
                }
            };
        }
        // Fallback
        return function getRandomValues(buffer) {
            var value = 0;
            for (var i = 0, n = buffer.length; i < n; ++i) {
                if (i % 4 === 0) {
                    value = (Math.random() * 0xffffffff) >>> 0;
                }
                buffer[i] = value & 0xff;
                value >>>= 8;
            }
        };
    })();
})(Random || (Random = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * A runtime object which captures compile-time type information.
 *
 * #### Notes
 * A token captures the compile-time type of an interface or class in
 * an object which can be used at runtime in a type-safe fashion.
 */
var Token = /** @class */ (function () {
    /**
     * Construct a new token.
     *
     * @param name - A human readable name for the token.
     */
    function Token(name) {
        this.name = name;
        this._tokenStructuralPropertyT = null;
    }
    return Token;
}());

// Copyright (c) Jupyter Development Team.
/**
 * The namespace for UUID related functionality.
 */
var UUID;
(function (UUID) {
    /**
     * A function which generates UUID v4 identifiers.
     *
     * @returns A new UUID v4 string.
     *
     * #### Notes
     * This implementation complies with RFC 4122.
     *
     * This uses `Random.getRandomValues()` for random bytes, which in
     * turn will use the underlying `crypto` module of the platform if
     * it is available. The fallback for randomness is `Math.random`.
     */
    UUID.uuid4 = (function () {
        // Create a 16 byte array to hold the random values.
        var bytes = new Uint8Array(16);
        // Create a look up table from bytes to hex strings.
        var lut = new Array(256);
        // Pad the single character hex digits with a leading zero.
        for (var i = 0; i < 16; ++i) {
            lut[i] = '0' + i.toString(16);
        }
        // Populate the rest of the hex digits.
        for (var i = 16; i < 256; ++i) {
            lut[i] = i.toString(16);
        }
        // Return a function which generates the UUID.
        return function uuid4() {
            // Get a new batch of random values.
            Random.getRandomValues(bytes);
            // Set the UUID version number to 4.
            bytes[6] = 0x40 | (bytes[6] & 0x0f);
            // Set the clock sequence bit to the RFC spec.
            bytes[8] = 0x80 | (bytes[8] & 0x3f);
            // Assemble the UUID string.
            return (lut[bytes[0]] +
                lut[bytes[1]] +
                lut[bytes[2]] +
                lut[bytes[3]] +
                '-' +
                lut[bytes[4]] +
                lut[bytes[5]] +
                '-' +
                lut[bytes[6]] +
                lut[bytes[7]] +
                '-' +
                lut[bytes[8]] +
                lut[bytes[9]] +
                '-' +
                lut[bytes[10]] +
                lut[bytes[11]] +
                lut[bytes[12]] +
                lut[bytes[13]] +
                lut[bytes[14]] +
                lut[bytes[15]]);
        };
    })();
})(UUID || (UUID = {}));


//# sourceMappingURL=index.es6.js.map

// EXTERNAL MODULE: ./node_modules/lodash/isEqual.js
var isEqual = __webpack_require__("63ea");
var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual);

// EXTERNAL MODULE: ./node_modules/lodash/isPlainObject.js
var isPlainObject = __webpack_require__("60ed");
var isPlainObject_default = /*#__PURE__*/__webpack_require__.n(isPlainObject);

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/utils.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (undefined && undefined.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};




/**
 * Find all strings in the first argument that are not in the second.
 */
function difference(a, b) {
    return a.filter(function (v) { return b.indexOf(v) === -1; });
}
/**
 * Compare two objects deeply to see if they are equal.
 */
function utils_isEqual(a, b) {
    return isEqual_default()(a, b);
}
/**
 * A polyfill for Object.assign
 *
 * This is from code that Typescript 2.4 generates for a polyfill.
 */
var utils_assign = Object.assign || function (t) {
    for (var i = 1; i < arguments.length; i++) {
        var s = arguments[i];
        for (var p in s) {
            if (Object.prototype.hasOwnProperty.call(s, p)) {
                t[p] = s[p];
            }
        }
    }
    return t;
};
/**
 * Generate a UUID
 *
 * http://www.ietf.org/rfc/rfc4122.txt
 */
function uuid() {
    return UUID.uuid4();
}
/**
 * Wrappable Error class
 *
 * The Error class doesn't actually act on `this`.  Instead it always
 * returns a new instance of Error.  Here we capture that instance so we
 * can apply it's properties to `this`.
 */
var WrappedError = /** @class */ (function (_super) {
    __extends(WrappedError, _super);
    function WrappedError(message, error) {
        var _this = _super.call(this, message) || this;
        console.warn('WrappedError has been deprecated!');
        // Keep a stack of the original error messages.
        if (error instanceof WrappedError) {
            _this.error_stack = error.error_stack;
        }
        else {
            _this.error_stack = [error];
        }
        _this.error_stack.push(_this);
        return _this;
    }
    return WrappedError;
}(Error));

/**
 * Resolve a promiseful dictionary.
 * Returns a single Promise.
 */
function resolvePromisesDict(d) {
    var keys = Object.keys(d);
    var values = [];
    keys.forEach(function (key) {
        values.push(d[key]);
    });
    return Promise.all(values).then(function (v) {
        var d = {};
        for (var i = 0; i < keys.length; i++) {
            d[keys[i]] = v[i];
        }
        return d;
    });
}
/**
 * Creates a wrappable Promise rejection function.
 *
 * Creates a function that logs an error message before rethrowing
 * the original error that caused the promise to reject.
 */
function reject(message, log) {
    return function promiseRejection(error) {
        if (log) {
            console.error(new Error(message));
        }
        throw error;
    };
}
/**
 * Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i]
 * where buffer_paths[i] is a list indicating where in the object buffer[i] should
 * be placed
 * Example: state = {a: 1, b: {}, c: [0, null]}
 * buffers = [array1, array2]
 * buffer_paths = [['b', 'data'], ['c', 1]]
 * Will lead to {a: 1, b: {data: array1}, c: [0, array2]}
 */
function put_buffers(state, buffer_paths, buffers) {
    for (var i = 0; i < buffer_paths.length; i++) {
        var buffer_path = buffer_paths[i];
        // say we want to set state[x][y][z] = buffers[i]
        var obj = state;
        // we first get obj = state[x][y]
        for (var j = 0; j < buffer_path.length - 1; j++) {
            obj = obj[buffer_path[j]];
        }
        // and then set: obj[z] = buffers[i]
        obj[buffer_path[buffer_path.length - 1]] = buffers[i];
    }
}
/**
 * The inverse of put_buffers, return an objects with the new state where all buffers(ArrayBuffer)
 * are removed. If a buffer is a member of an object, that object is cloned, and the key removed. If a buffer
 * is an element of an array, that array is cloned, and the element is set to null.
 * See put_buffers for the meaning of buffer_paths
 * Returns an object with the new state (.state) an array with paths to the buffers (.buffer_paths),
 * and the buffers associated to those paths (.buffers).
 */
function remove_buffers(state) {
    var buffers = [];
    var buffer_paths = [];
    // if we need to remove an object from a list, we need to clone that list, otherwise we may modify
    // the internal state of the widget model
    // however, we do not want to clone everything, for performance
    function remove(obj, path) {
        if (obj.toJSON) {
            // We need to get the JSON form of the object before recursing.
            // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior
            obj = obj.toJSON();
        }
        if (Array.isArray(obj)) {
            var is_cloned = false;
            for (var i = 0; i < obj.length; i++) {
                var value = obj[i];
                if (value) {
                    if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {
                        if (!is_cloned) {
                            obj = obj.slice();
                            is_cloned = true;
                        }
                        buffers.push(ArrayBuffer.isView(value) ? value.buffer : value);
                        buffer_paths.push(path.concat([i]));
                        // easier to just keep the array, but clear the entry, otherwise we have to think
                        // about array length, much easier this way
                        obj[i] = null;
                    }
                    else {
                        var new_value = remove(value, path.concat([i]));
                        // only assigned when the value changes, we may serialize objects that don't support assignment
                        if (new_value !== value) {
                            if (!is_cloned) {
                                obj = obj.slice();
                                is_cloned = true;
                            }
                            obj[i] = new_value;
                        }
                    }
                }
            }
        }
        else if (isPlainObject_default()(obj)) {
            for (var key in obj) {
                var is_cloned = false;
                if (obj.hasOwnProperty(key)) {
                    var value = obj[key];
                    if (value) {
                        if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {
                            if (!is_cloned) {
                                obj = __assign({}, obj);
                                is_cloned = true;
                            }
                            buffers.push(ArrayBuffer.isView(value) ? value.buffer : value);
                            buffer_paths.push(path.concat([key]));
                            delete obj[key]; // for objects/dicts we just delete them
                        }
                        else {
                            var new_value = remove(value, path.concat([key]));
                            // only assigned when the value changes, we may serialize objects that don't support assignment
                            if (new_value !== value) {
                                if (!is_cloned) {
                                    obj = __assign({}, obj);
                                    is_cloned = true;
                                }
                                obj[key] = new_value;
                            }
                        }
                    }
                }
            }
        }
        return obj;
    }
    var new_state = remove(state, []);
    return { state: new_state, buffers: buffers, buffer_paths: buffer_paths };
}
var hexTable = [
    '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0A', '0B', '0C', '0D', '0E', '0F',
    '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1A', '1B', '1C', '1D', '1E', '1F',
    '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2A', '2B', '2C', '2D', '2E', '2F',
    '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3A', '3B', '3C', '3D', '3E', '3F',
    '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4A', '4B', '4C', '4D', '4E', '4F',
    '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5A', '5B', '5C', '5D', '5E', '5F',
    '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6A', '6B', '6C', '6D', '6E', '6F',
    '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7A', '7B', '7C', '7D', '7E', '7F',
    '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8A', '8B', '8C', '8D', '8E', '8F',
    '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9A', '9B', '9C', '9D', '9E', '9F',
    'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF',
    'B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF',
    'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'CA', 'CB', 'CC', 'CD', 'CE', 'CF',
    'D0', 'D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'DA', 'DB', 'DC', 'DD', 'DE', 'DF',
    'E0', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8', 'E9', 'EA', 'EB', 'EC', 'ED', 'EE', 'EF',
    'F0', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'FA', 'FB', 'FC', 'FD', 'FE', 'FF'
];
/**
 * Convert an ArrayBuffer to a hex string.
 */
function bufferToHex(buffer) {
    var x = new Uint8Array(buffer);
    var s = [];
    for (var i = 0; i < x.length; i++) {
        s.push(hexTable[x[i]]);
    }
    return s.join('');
}
/**
 * Convert a hex string to an ArrayBuffer.
 */
function hexToBuffer(hex) {
    var x = new Uint8Array(hex.length / 2);
    for (var i = 0; i < hex.length; i += 2) {
        x[i / 2] = parseInt(hex.slice(i, i + 2), 16);
    }
    return x.buffer;
}
/**
 * Convert an ArrayBuffer to a base64 string.
 */
function bufferToBase64(buffer) {
    return Object(base64_js["fromByteArray"])(new Uint8Array(buffer));
}
/**
 * Convert a base64 string to an ArrayBuffer.
 */
function base64ToBuffer(base64) {
    return Object(base64_js["toByteArray"])(base64).buffer;
}

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/version.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var JUPYTER_WIDGETS_VERSION = '1.2.0';
var PROTOCOL_VERSION = '2.0.0';

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/manager-base.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var manager_base_assign = (undefined && undefined.__assign) || function () {
    manager_base_assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return manager_base_assign.apply(this, arguments);
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};


var PROTOCOL_MAJOR_VERSION = PROTOCOL_VERSION.split('.', 1)[0];
/**
 * Manager abstract base class
 */
var manager_base_ManagerBase = /** @class */ (function () {
    function ManagerBase() {
        /**
         * The comm target name to register
         */
        this.comm_target_name = 'jupyter.widget';
        /**
         * Dictionary of model ids and model instance promises
         */
        this._models = Object.create(null);
    }
    /**
     * Display a DOMWidgetView for a particular model.
     */
    ManagerBase.prototype.display_model = function (msg, model, options) {
        var _this = this;
        if (options === void 0) { options = {}; }
        return this.create_view(model, options).then(function (view) { return _this.display_view(msg, view, options); }).catch(reject('Could not create view', true));
    };
    /**
     * Modifies view options. Generally overloaded in custom widget manager
     * implementations.
     */
    ManagerBase.prototype.setViewOptions = function (options) {
        if (options === void 0) { options = {}; }
        return options;
    };
    ManagerBase.prototype.create_view = function (model, options) {
        var _this = this;
        if (options === void 0) { options = {}; }
        var viewPromise = model.state_change = model.state_change.then(function () {
            return _this.loadClass(model.get('_view_name'), model.get('_view_module'), model.get('_view_module_version')).then(function (ViewType) {
                var view = new ViewType({
                    model: model,
                    options: _this.setViewOptions(options)
                });
                view.listenTo(model, 'destroy', view.remove);
                return Promise.resolve(view.render()).then(function () { return view; });
            }).catch(reject('Could not create a view for model id ' + model.model_id, true));
        });
        var id = uuid();
        model.views[id] = viewPromise;
        viewPromise.then(function (view) {
            view.once('remove', function () { delete view.model.views[id]; }, _this);
        });
        return model.state_change;
    };
    /**
     * callback handlers specific to a view
     */
    ManagerBase.prototype.callbacks = function (view) {
        return {};
    };
    /**
     * Get a promise for a model by model id.
     *
     * #### Notes
     * If a model is not found, undefined is returned (NOT a promise). However,
     * the calling code should also deal with the case where a rejected promise
     * is returned, and should treat that also as a model not found.
     */
    ManagerBase.prototype.get_model = function (model_id) {
        // TODO: Perhaps we should return a Promise.reject if the model is not
        // found. Right now this isn't a true async function because it doesn't
        // always return a promise.
        return this._models[model_id];
    };
    /**
     * Handle when a comm is opened.
     */
    ManagerBase.prototype.handle_comm_open = function (comm, msg) {
        var protocolVersion = (msg.metadata || {}).version || '';
        if (protocolVersion.split('.', 1)[0] !== PROTOCOL_MAJOR_VERSION) {
            var error = "Wrong widget protocol version: received protocol version '" + protocolVersion + "', but was expecting major version '" + PROTOCOL_MAJOR_VERSION + "'";
            console.error(error);
            return Promise.reject(error);
        }
        var data = msg.content.data;
        var buffer_paths = data.buffer_paths || [];
        // Make sure the buffers are DataViews
        var buffers = (msg.buffers || []).map(function (b) {
            if (b instanceof DataView) {
                return b;
            }
            else {
                return new DataView(b instanceof ArrayBuffer ? b : b.buffer);
            }
        });
        put_buffers(data.state, buffer_paths, buffers);
        return this.new_model({
            model_name: data.state['_model_name'],
            model_module: data.state['_model_module'],
            model_module_version: data.state['_model_module_version'],
            comm: comm
        }, data.state).catch(reject('Could not create a model.', true));
    };
    /**
     * Create a comm and new widget model.
     * @param  options - same options as new_model but comm is not
     *                          required and additional options are available.
     * @param  serialized_state - serialized model attributes.
     */
    ManagerBase.prototype.new_widget = function (options, serialized_state) {
        var _this = this;
        if (serialized_state === void 0) { serialized_state = {}; }
        var commPromise;
        // we check to make sure the view information is provided, to help catch
        // backwards incompatibility errors.
        if (options.view_name === undefined
            || options.view_module === undefined
            || options.view_module_version === undefined) {
            return Promise.reject('new_widget(...) must be given view information in the options.');
        }
        // If no comm is provided, a new comm is opened for the jupyter.widget
        // target.
        if (options.comm) {
            commPromise = Promise.resolve(options.comm);
        }
        else {
            commPromise = this._create_comm(this.comm_target_name, options.model_id, {
                state: {
                    _model_module: options.model_module,
                    _model_module_version: options.model_module_version,
                    _model_name: options.model_name,
                    _view_module: options.view_module,
                    _view_module_version: options.view_module_version,
                    _view_name: options.view_name
                },
            }, { version: PROTOCOL_VERSION });
        }
        // The options dictionary is copied since data will be added to it.
        var options_clone = manager_base_assign({}, options);
        // Create the model. In the case where the comm promise is rejected a
        // comm-less model is still created with the required model id.
        return commPromise.then(function (comm) {
            // Comm Promise Resolved.
            options_clone.comm = comm;
            var widget_model = _this.new_model(options_clone, serialized_state);
            return widget_model.then(function (model) {
                model.sync('create', model);
                return model;
            });
        }, function () {
            // Comm Promise Rejected.
            if (!options_clone.model_id) {
                options_clone.model_id = uuid();
            }
            return _this.new_model(options_clone, serialized_state);
        });
    };
    ManagerBase.prototype.register_model = function (model_id, modelPromise) {
        var _this = this;
        this._models[model_id] = modelPromise;
        modelPromise.then(function (model) {
            model.once('comm:close', function () {
                delete _this._models[model_id];
            });
        });
    };
    /**
     * Create and return a promise for a new widget model
     *
     * @param options - the options for creating the model.
     * @param serialized_state - attribute values for the model.
     *
     * @example
     * widget_manager.new_model({
     *      model_name: 'IntSlider',
     *      model_module: '@jupyter-widgets/controls',
     *      model_module_version: '1.0.0',
     *      model_id: 'u-u-i-d'
     * }).then((model) => { console.log('Create success!', model); },
     *  (err) => {console.error(err)});
     *
     */
    ManagerBase.prototype.new_model = function (options, serialized_state) {
        if (serialized_state === void 0) { serialized_state = {}; }
        return __awaiter(this, void 0, void 0, function () {
            var model_id, modelPromise;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        if (options.model_id) {
                            model_id = options.model_id;
                        }
                        else if (options.comm) {
                            model_id = options.model_id = options.comm.comm_id;
                        }
                        else {
                            throw new Error('Neither comm nor model_id provided in options object. At least one must exist.');
                        }
                        modelPromise = this._make_model(options, serialized_state);
                        // this call needs to happen before the first `await`, see note in `set_state`:
                        this.register_model(model_id, modelPromise);
                        return [4 /*yield*/, modelPromise];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    ManagerBase.prototype._make_model = function (options, serialized_state) {
        if (serialized_state === void 0) { serialized_state = {}; }
        return __awaiter(this, void 0, void 0, function () {
            var model_id, model_promise, ModelType, error_1, attributes, modelOptions, widget_model;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        model_id = options.model_id;
                        model_promise = this.loadClass(options.model_name, options.model_module, options.model_module_version);
                        _a.label = 1;
                    case 1:
                        _a.trys.push([1, 3, , 4]);
                        return [4 /*yield*/, model_promise];
                    case 2:
                        ModelType = _a.sent();
                        return [3 /*break*/, 4];
                    case 3:
                        error_1 = _a.sent();
                        console.error('Could not instantiate widget');
                        throw error_1;
                    case 4:
                        if (!ModelType) {
                            throw new Error("Cannot find model module " + options.model_module + "@" + options.model_module_version + ", " + options.model_name);
                        }
                        return [4 /*yield*/, ModelType._deserialize_state(serialized_state, this)];
                    case 5:
                        attributes = _a.sent();
                        modelOptions = {
                            widget_manager: this,
                            model_id: model_id,
                            comm: options.comm,
                        };
                        widget_model = new ModelType(attributes, modelOptions);
                        widget_model.name = options.model_name;
                        widget_model.module = options.model_module;
                        return [2 /*return*/, widget_model];
                }
            });
        });
    };
    /**
     * Close all widgets and empty the widget state.
     * @return Promise that resolves when the widget state is cleared.
     */
    ManagerBase.prototype.clear_state = function () {
        var _this = this;
        return resolvePromisesDict(this._models).then(function (models) {
            Object.keys(models).forEach(function (id) { return models[id].close(); });
            _this._models = Object.create(null);
        });
    };
    /**
     * Asynchronously get the state of the widget manager.
     *
     * This includes all of the widget models, and follows the format given in
     * the @jupyter-widgets/schema package.
     *
     * @param options - The options for what state to return.
     * @returns Promise for a state dictionary
     */
    ManagerBase.prototype.get_state = function (options) {
        var _this = this;
        if (options === void 0) { options = {}; }
        var modelPromises = Object.keys(this._models).map(function (id) { return _this._models[id]; });
        return Promise.all(modelPromises).then(function (models) {
            return serialize_state(models, options);
        });
    };
    /**
     * Set the widget manager state.
     *
     * @param state - a Javascript object conforming to the application/vnd.jupyter.widget-state+json spec.
     *
     * Reconstructs all of the widget models in the state, merges that with the
     * current manager state, and then attempts to redisplay the widgets in the
     * state.
     */
    ManagerBase.prototype.set_state = function (state) {
        var _this = this;
        // Check to make sure that it's the same version we are parsing.
        if (!(state.version_major && state.version_major <= 2)) {
            throw 'Unsupported widget state format';
        }
        var models = state.state;
        // Recreate all the widget models for the given widget manager state.
        var all_models = this._get_comm_info().then(function (live_comms) {
            /* Note: It is currently safe to just loop over the models in any order,
               given that the following holds (does at the time of writing):
               1: any call to `new_model` with state registers the model promise (e.g. with `register_model`)
                  synchronously (before it's first `await` statement).
               2: any calls to a model constructor or the `set_state` method on a model,
                  happens asynchronously (in a `then` clause, or after an `await` statement).

              Without these assumptions, one risks trying to set model state with a reference
              to another model that doesn't exist yet!
            */
            return Promise.all(Object.keys(models).map(function (model_id) {
                // First put back the binary buffers
                var decode = { 'base64': base64ToBuffer, 'hex': hexToBuffer };
                var model = models[model_id];
                var modelState = model.state;
                if (model.buffers) {
                    var bufferPaths = model.buffers.map(function (b) { return b.path; });
                    // put_buffers expects buffers to be DataViews
                    var buffers = model.buffers.map(function (b) { return new DataView(decode[b.encoding](b.data)); });
                    put_buffers(model.state, bufferPaths, buffers);
                }
                // If the model has already been created, set its state and then
                // return it.
                if (_this._models[model_id]) {
                    return _this._models[model_id].then(function (model) {
                        // deserialize state
                        return model.constructor._deserialize_state(modelState || {}, _this).then(function (attributes) {
                            model.set_state(attributes); // case 2
                            return model;
                        });
                    });
                }
                var modelCreate = {
                    model_id: model_id,
                    model_name: model.model_name,
                    model_module: model.model_module,
                    model_module_version: model.model_module_version
                };
                if (live_comms.hasOwnProperty(model_id)) { // live comm
                    // This connects to an existing comm if it exists, and
                    // should *not* send a comm open message.
                    return _this._create_comm(_this.comm_target_name, model_id).then(function (comm) {
                        modelCreate.comm = comm;
                        return _this.new_model(modelCreate); // No state, so safe wrt. case 1
                    });
                }
                else {
                    return _this.new_model(modelCreate, modelState); // case 1
                }
            }));
        });
        return all_models;
    };
    /**
     * Disconnect the widget manager from the kernel, setting each model's comm
     * as dead.
     */
    ManagerBase.prototype.disconnect = function () {
        var _this = this;
        Object.keys(this._models).forEach(function (i) {
            _this._models[i].then(function (model) { model.comm_live = false; });
        });
    };
    /**
     * Resolve a URL relative to the current notebook location.
     *
     * The default implementation just returns the original url.
     */
    ManagerBase.prototype.resolveUrl = function (url) {
        return Promise.resolve(url);
    };
    /**
     * Filter serialized widget state to remove any ID's already present in manager.
     *
     * @param {*} state Serialized state to filter
     *
     * @returns {*} A copy of the state, with its 'state' attribute filtered
     */
    ManagerBase.prototype.filterExistingModelState = function (serialized_state) {
        var _this = this;
        var models = serialized_state.state;
        models = Object.keys(models)
            .filter(function (model_id) {
            return !_this._models[model_id];
        })
            .reduce(function (res, model_id) {
            res[model_id] = models[model_id];
            return res;
        }, {});
        return manager_base_assign(manager_base_assign({}, serialized_state), { state: models });
    };
    return ManagerBase;
}());

/**
 * Serialize an array of widget models
 *
 * #### Notes
 * The return value follows the format given in the
 * @jupyter-widgets/schema package.
 */
function serialize_state(models, options) {
    if (options === void 0) { options = {}; }
    var state = {};
    models.forEach(function (model) {
        var model_id = model.model_id;
        var split = remove_buffers(model.serialize(model.get_state(options.drop_defaults)));
        var buffers = split.buffers.map(function (buffer, index) {
            return {
                data: bufferToBase64(buffer),
                path: split.buffer_paths[index],
                encoding: 'base64'
            };
        });
        state[model_id] = {
            model_name: model.name,
            model_module: model.module,
            model_module_version: model.get('_model_module_version'),
            state: split.state
        };
        // To save space, only include the buffers key if we have buffers
        if (buffers.length > 0) {
            state[model_id].buffers = buffers;
        }
    });
    return { version_major: 2, version_minor: 0, state: state };
}

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/backbone-patch.js
// This file contains a modified version of the set function from the Backbone
// (see
// https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/backbone.js#L460,
// with changes below marked with an EDIT comment). This file in Backbone has the following license.
var backbone_patch_assign = (undefined && undefined.__assign) || function () {
    backbone_patch_assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return backbone_patch_assign.apply(this, arguments);
};
//     (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org
// Backbone's full license is below (from https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/LICENSE)
/*
Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

// Set a hash of model attributes on the object, firing `"change"`. This is
// the core primitive operation of a model, updating the data and notifying
// anyone who needs to know about the change in state. The heart of the beast.
// This *MUST* be called with the model as the `this` context.
function backbone_patch_set(key, val, options) {
    /* tslint:disable:no-invalid-this */
    if (key == null) {
        return this;
    }
    // Handle both `"key", value` and `{key: value}` -style arguments.
    var attrs;
    if (typeof key === 'object') {
        attrs = key;
        options = val;
    }
    else {
        (attrs = {})[key] = val;
    }
    options || (options = {});
    // Run validation.
    if (!this._validate(attrs, options)) {
        return false;
    }
    // Extract attributes and options.
    var unset = options.unset;
    var silent = options.silent;
    var changes = [];
    var changing = this._changing;
    this._changing = true;
    if (!changing) {
        // EDIT: changed to use object spread instead of _.clone
        this._previousAttributes = backbone_patch_assign({}, this.attributes);
        this.changed = {};
    }
    var current = this.attributes;
    var changed = this.changed;
    var prev = this._previousAttributes;
    // For each `set` attribute, update or delete the current value.
    for (var attr in attrs) {
        val = attrs[attr];
        // EDIT: the following two lines use our isEqual instead of _.isEqual
        if (!utils_isEqual(current[attr], val)) {
            changes.push(attr);
        }
        if (!utils_isEqual(prev[attr], val)) {
            changed[attr] = val;
        }
        else {
            delete changed[attr];
        }
        unset ? delete current[attr] : current[attr] = val;
    }
    // Update the `id`.
    this.id = this.get(this.idAttribute);
    // Trigger all relevant attribute changes.
    if (!silent) {
        if (changes.length) {
            this._pending = options;
        }
        for (var i = 0; i < changes.length; i++) {
            this.trigger('change:' + changes[i], this, current[changes[i]], options);
        }
    }
    // You might be wondering why there's a `while` loop here. Changes can
    // be recursively nested within `"change"` events.
    if (changing) {
        return this;
    }
    if (!silent) {
        while (this._pending) {
            options = this._pending;
            this._pending = false;
            this.trigger('change', this, options);
        }
    }
    this._pending = false;
    this._changing = false;
    return this;
    /* tslint:enable:no-invalid-this */
}

// EXTERNAL MODULE: ./node_modules/backbone/backbone.js
var backbone = __webpack_require__("ab5c");

// EXTERNAL MODULE: ./node_modules/jquery/dist/jquery.js
var jquery = __webpack_require__("1157");
var jquery_default = /*#__PURE__*/__webpack_require__.n(jquery);

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/nativeview.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var nativeview_extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/*
 This file contains substantial portions of https://github.com/akre54/Backbone.NativeView/blob/521188d9554b53d95d70ed34f878d8ac9fc10df2/backbone.nativeview.js, which has the following license:

(c) 2015 Adam Krebs, Jimmy Yuen Ho Wong
Backbone.NativeView may be freely distributed under the MIT license.

Copyright (c) 2014 Adam Krebs

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

*/

// Caches a local reference to `Element.prototype` for faster access.
var ElementProto = Element.prototype; // : typeof Element = (typeof Element !== 'undefined' && Element.prototype) || {};
// Find the right `Element#matches` for IE>=9 and modern browsers.
var matchesSelector = ElementProto.matches ||
    ElementProto['webkitMatchesSelector'] ||
    ElementProto['mozMatchesSelector'] ||
    ElementProto['msMatchesSelector'] ||
    ElementProto['oMatchesSelector'] ||
    function matches(selector) {
        /* tslint:disable:no-invalid-this */
        var matches = (this.document || this.ownerDocument).querySelectorAll(selector);
        var i = matches.length;
        while (--i >= 0 && matches.item(i) !== this) {
            continue;
        }
        return i > -1;
        /* tslint:enable:no-invalid-this */
    };
var NativeView = /** @class */ (function (_super) {
    nativeview_extends(NativeView, _super);
    function NativeView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    NativeView.prototype._removeElement = function () {
        this.undelegateEvents();
        if (this.el.parentNode) {
            this.el.parentNode.removeChild(this.el);
        }
    };
    // Apply the `element` to the view.
    NativeView.prototype._setElement = function (element) {
        this.el = element;
    };
    // Set a hash of attributes to the view's `el`. We use the "prop" version
    // if available, falling back to `setAttribute` for the catch-all.
    NativeView.prototype._setAttributes = function (attrs) {
        for (var attr in attrs) {
            attr in this.el ? this.el[attr] = attrs[attr] : this.el.setAttribute(attr, attrs[attr]);
        }
    };
    /**
     * Make an event delegation handler for the given `eventName` and `selector`
     * and attach it to `this.el`.
     * If selector is empty, the listener will be bound to `this.el`. If not, a
     * new handler that will recursively traverse up the event target's DOM
     * hierarchy looking for a node that matches the selector. If one is found,
     * the event's `delegateTarget` property is set to it and the return the
     * result of calling bound `listener` with the parameters given to the
     * handler.
     *
     * This does not properly handle selectors for things like focus and blur (see
     * https://github.com/jquery/jquery/blob/7d21f02b9ec9f655583e898350badf89165ed4d5/src/event.js#L442
     * for some similar exceptional cases).
     */
    NativeView.prototype.delegate = function (eventName, selector, listener) {
        if (typeof selector !== 'string') {
            listener = selector;
            selector = null;
        }
        // We have to initialize this here, instead of in the constructor, because the
        // super constructor eventually calls this method before we get a chance to initialize
        // this._domEvents to an empty list.
        if (this._domEvents === void 0) {
            this._domEvents = [];
        }
        var root = this.el;
        var handler = selector ? function (e) {
            var node = e.target || e.srcElement;
            for (; node && node !== root; node = node.parentNode) {
                if (matchesSelector.call(node, selector)) {
                    e.delegateTarget = node;
                    if (listener.handleEvent) {
                        return listener.handleEvent(e);
                    }
                    else {
                        return listener(e);
                    }
                }
            }
        } : listener;
        this.el.addEventListener(eventName, handler, false);
        this._domEvents.push({ eventName: eventName, handler: handler, listener: listener, selector: selector });
        return handler;
    };
    // Remove a single delegated event. Either `eventName` or `selector` must
    // be included, `selector` and `listener` are optional.
    NativeView.prototype.undelegate = function (eventName, selector, listener) {
        if (typeof selector === 'function') {
            listener = selector;
            selector = null;
        }
        if (this.el && this._domEvents) {
            var handlers = this._domEvents.slice();
            var i = handlers.length;
            while (i--) {
                var item = handlers[i];
                var match = item.eventName === eventName &&
                    (listener ? item.listener === listener : true) &&
                    (selector ? item.selector === selector : true);
                if (!match) {
                    continue;
                }
                this.el.removeEventListener(item.eventName, item.handler, false);
                this._domEvents.splice(i, 1);
            }
        }
        return this;
    };
    // Remove all events created with `delegate` from `el`
    NativeView.prototype.undelegateEvents = function () {
        if (this.el && this._domEvents) {
            var len = this._domEvents.length;
            for (var i = 0; i < len; i++) {
                var item = this._domEvents[i];
                this.el.removeEventListener(item.eventName, item.handler, false);
            }
            this._domEvents.length = 0;
        }
        return this;
    };
    return NativeView;
}(backbone["View"]));


// CONCATENATED MODULE: ./node_modules/@lumino/algorithm/dist/index.es6.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for array-specific algorithms.
 */
var ArrayExt;
(function (ArrayExt) {
    /**
     * Find the index of the first occurrence of a value in an array.
     *
     * @param array - The array-like object to search.
     *
     * @param value - The value to locate in the array. Values are
     *   compared using strict `===` equality.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the first occurrence of the value, or `-1`
     *   if the value is not found.
     *
     * #### Notes
     * If `stop < start` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = ['one', 'two', 'three', 'four', 'one'];
     * ArrayExt.firstIndexOf(data, 'red');        // -1
     * ArrayExt.firstIndexOf(data, 'one');        // 0
     * ArrayExt.firstIndexOf(data, 'one', 1);     // 4
     * ArrayExt.firstIndexOf(data, 'two', 2);     // -1
     * ArrayExt.firstIndexOf(data, 'two', 2, 1);  // 1
     * ```
     */
    function firstIndexOf(array, value, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return -1;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var span;
        if (stop < start) {
            span = stop + 1 + (n - start);
        }
        else {
            span = stop - start + 1;
        }
        for (var i = 0; i < span; ++i) {
            var j = (start + i) % n;
            if (array[j] === value) {
                return j;
            }
        }
        return -1;
    }
    ArrayExt.firstIndexOf = firstIndexOf;
    /**
     * Find the index of the last occurrence of a value in an array.
     *
     * @param array - The array-like object to search.
     *
     * @param value - The value to locate in the array. Values are
     *   compared using strict `===` equality.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the last occurrence of the value, or `-1`
     *   if the value is not found.
     *
     * #### Notes
     * If `start < stop` the search will wrap at the front of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = ['one', 'two', 'three', 'four', 'one'];
     * ArrayExt.lastIndexOf(data, 'red');        // -1
     * ArrayExt.lastIndexOf(data, 'one');        // 4
     * ArrayExt.lastIndexOf(data, 'one', 1);     // 0
     * ArrayExt.lastIndexOf(data, 'two', 0);     // -1
     * ArrayExt.lastIndexOf(data, 'two', 0, 1);  // 1
     * ```
     */
    function lastIndexOf(array, value, start, stop) {
        if (start === void 0) { start = -1; }
        if (stop === void 0) { stop = 0; }
        var n = array.length;
        if (n === 0) {
            return -1;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var span;
        if (start < stop) {
            span = start + 1 + (n - stop);
        }
        else {
            span = start - stop + 1;
        }
        for (var i = 0; i < span; ++i) {
            var j = (start - i + n) % n;
            if (array[j] === value) {
                return j;
            }
        }
        return -1;
    }
    ArrayExt.lastIndexOf = lastIndexOf;
    /**
     * Find the index of the first value which matches a predicate.
     *
     * @param array - The array-like object to search.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the first matching value, or `-1` if no
     *   matching value is found.
     *
     * #### Notes
     * If `stop < start` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [1, 2, 3, 4, 3, 2, 1];
     * ArrayExt.findFirstIndex(data, isEven);       // 1
     * ArrayExt.findFirstIndex(data, isEven, 4);    // 5
     * ArrayExt.findFirstIndex(data, isEven, 6);    // -1
     * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1
     * ```
     */
    function findFirstIndex(array, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return -1;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var span;
        if (stop < start) {
            span = stop + 1 + (n - start);
        }
        else {
            span = stop - start + 1;
        }
        for (var i = 0; i < span; ++i) {
            var j = (start + i) % n;
            if (fn(array[j], j)) {
                return j;
            }
        }
        return -1;
    }
    ArrayExt.findFirstIndex = findFirstIndex;
    /**
     * Find the index of the last value which matches a predicate.
     *
     * @param object - The array-like object to search.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the last matching value, or `-1` if no
     *   matching value is found.
     *
     * #### Notes
     * If `start < stop` the search will wrap at the front of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [1, 2, 3, 4, 3, 2, 1];
     * ArrayExt.findLastIndex(data, isEven);        // 5
     * ArrayExt.findLastIndex(data, isEven, 4);     // 3
     * ArrayExt.findLastIndex(data, isEven, 0);     // -1
     * ArrayExt.findLastIndex(data, isEven, 0, 1);  // 5
     * ```
     */
    function findLastIndex(array, fn, start, stop) {
        if (start === void 0) { start = -1; }
        if (stop === void 0) { stop = 0; }
        var n = array.length;
        if (n === 0) {
            return -1;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var d;
        if (start < stop) {
            d = start + 1 + (n - stop);
        }
        else {
            d = start - stop + 1;
        }
        for (var i = 0; i < d; ++i) {
            var j = (start - i + n) % n;
            if (fn(array[j], j)) {
                return j;
            }
        }
        return -1;
    }
    ArrayExt.findLastIndex = findLastIndex;
    /**
     * Find the first value which matches a predicate.
     *
     * @param array - The array-like object to search.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The first matching value, or `undefined` if no matching
     *   value is found.
     *
     * #### Notes
     * If `stop < start` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [1, 2, 3, 4, 3, 2, 1];
     * ArrayExt.findFirstValue(data, isEven);       // 2
     * ArrayExt.findFirstValue(data, isEven, 2);    // 4
     * ArrayExt.findFirstValue(data, isEven, 6);    // undefined
     * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2
     * ```
     */
    function findFirstValue(array, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var index = findFirstIndex(array, fn, start, stop);
        return index !== -1 ? array[index] : undefined;
    }
    ArrayExt.findFirstValue = findFirstValue;
    /**
     * Find the last value which matches a predicate.
     *
     * @param object - The array-like object to search.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The last matching value, or `undefined` if no matching
     *   value is found.
     *
     * #### Notes
     * If `start < stop` the search will wrap at the front of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [1, 2, 3, 4, 3, 2, 1];
     * ArrayExt.findLastValue(data, isEven);        // 2
     * ArrayExt.findLastValue(data, isEven, 4);     // 4
     * ArrayExt.findLastValue(data, isEven, 0);     // undefined
     * ArrayExt.findLastValue(data, isEven, 0, 1);  // 2
     * ```
     */
    function findLastValue(array, fn, start, stop) {
        if (start === void 0) { start = -1; }
        if (stop === void 0) { stop = 0; }
        var index = findLastIndex(array, fn, start, stop);
        return index !== -1 ? array[index] : undefined;
    }
    ArrayExt.findLastValue = findLastValue;
    /**
     * Find the index of the first element which compares `>=` to a value.
     *
     * @param array - The sorted array-like object to search.
     *
     * @param value - The value to locate in the array.
     *
     * @param fn - The 3-way comparison function to apply to the values.
     *   It should return `< 0` if an element is less than a value, `0` if
     *   an element is equal to a value, or `> 0` if an element is greater
     *   than a value.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the first element which compares `>=` to the
     *   value, or `length` if there is no such element. If the computed
     *   index for `stop` is less than `start`, then the computed index
     *   for `start` is returned.
     *
     * #### Notes
     * The array must already be sorted in ascending order according to
     * the comparison function.
     *
     * #### Complexity
     * Logarithmic.
     *
     * #### Undefined Behavior
     * Searching a range which is not sorted in ascending order.
     *
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function numberCmp(a: number, b: number): number {
     *   return a - b;
     * }
     *
     * let data = [0, 3, 4, 7, 7, 9];
     * ArrayExt.lowerBound(data, 0, numberCmp);   // 0
     * ArrayExt.lowerBound(data, 6, numberCmp);   // 3
     * ArrayExt.lowerBound(data, 7, numberCmp);   // 3
     * ArrayExt.lowerBound(data, -1, numberCmp);  // 0
     * ArrayExt.lowerBound(data, 10, numberCmp);  // 6
     * ```
     */
    function lowerBound(array, value, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return 0;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var begin = start;
        var span = stop - start + 1;
        while (span > 0) {
            var half = span >> 1;
            var middle = begin + half;
            if (fn(array[middle], value) < 0) {
                begin = middle + 1;
                span -= half + 1;
            }
            else {
                span = half;
            }
        }
        return begin;
    }
    ArrayExt.lowerBound = lowerBound;
    /**
     * Find the index of the first element which compares `>` than a value.
     *
     * @param array - The sorted array-like object to search.
     *
     * @param value - The value to locate in the array.
     *
     * @param fn - The 3-way comparison function to apply to the values.
     *   It should return `< 0` if an element is less than a value, `0` if
     *   an element is equal to a value, or `> 0` if an element is greater
     *   than a value.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the first element which compares `>` than the
     *   value, or `length` if there is no such element. If the computed
     *   index for `stop` is less than `start`, then the computed index
     *   for `start` is returned.
     *
     * #### Notes
     * The array must already be sorted in ascending order according to
     * the comparison function.
     *
     * #### Complexity
     * Logarithmic.
     *
     * #### Undefined Behavior
     * Searching a range which is not sorted in ascending order.
     *
     * A `start` or `stop` which is non-integral.
     *
     * Modifying the length of the array while searching.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function numberCmp(a: number, b: number): number {
     *   return a - b;
     * }
     *
     * let data = [0, 3, 4, 7, 7, 9];
     * ArrayExt.upperBound(data, 0, numberCmp);   // 1
     * ArrayExt.upperBound(data, 6, numberCmp);   // 3
     * ArrayExt.upperBound(data, 7, numberCmp);   // 5
     * ArrayExt.upperBound(data, -1, numberCmp);  // 0
     * ArrayExt.upperBound(data, 10, numberCmp);  // 6
     * ```
     */
    function upperBound(array, value, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return 0;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var begin = start;
        var span = stop - start + 1;
        while (span > 0) {
            var half = span >> 1;
            var middle = begin + half;
            if (fn(array[middle], value) > 0) {
                span = half;
            }
            else {
                begin = middle + 1;
                span -= half + 1;
            }
        }
        return begin;
    }
    ArrayExt.upperBound = upperBound;
    /**
     * Test whether two arrays are shallowly equal.
     *
     * @param a - The first array-like object to compare.
     *
     * @param b - The second array-like object to compare.
     *
     * @param fn - The comparison function to apply to the elements. It
     *   should return `true` if the elements are "equal". The default
     *   compares elements using strict `===` equality.
     *
     * @returns Whether the two arrays are shallowly equal.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * Modifying the length of the arrays while comparing.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let d1 = [0, 3, 4, 7, 7, 9];
     * let d2 = [0, 3, 4, 7, 7, 9];
     * let d3 = [42];
     * ArrayExt.shallowEqual(d1, d2);  // true
     * ArrayExt.shallowEqual(d2, d3);  // false
     * ```
     */
    function shallowEqual(a, b, fn) {
        // Check for object identity first.
        if (a === b) {
            return true;
        }
        // Bail early if the lengths are different.
        if (a.length !== b.length) {
            return false;
        }
        // Compare each element for equality.
        for (var i = 0, n = a.length; i < n; ++i) {
            if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {
                return false;
            }
        }
        // The array are shallowly equal.
        return true;
    }
    ArrayExt.shallowEqual = shallowEqual;
    /**
     * Create a slice of an array subject to an optional step.
     *
     * @param array - The array-like object of interest.
     *
     * @param options - The options for configuring the slice.
     *
     * @returns A new array with the specified values.
     *
     * @throws An exception if the slice `step` is `0`.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start`, `stop`, or `step` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 3, 4, 7, 7, 9];
     * ArrayExt.slice(data);                         // [0, 3, 4, 7, 7, 9]
     * ArrayExt.slice(data, { start: 2 });           // [4, 7, 7, 9]
     * ArrayExt.slice(data, { start: 0, stop: 4 });  // [0, 3, 4, 7]
     * ArrayExt.slice(data, { step: 2 });            // [0, 4, 7]
     * ArrayExt.slice(data, { step: -1 });           // [9, 7, 7, 4, 3, 0]
     * ```
     */
    function slice(array, options) {
        if (options === void 0) { options = {}; }
        // Extract the options.
        var start = options.start, stop = options.stop, step = options.step;
        // Set up the `step` value.
        if (step === undefined) {
            step = 1;
        }
        // Validate the step size.
        if (step === 0) {
            throw new Error('Slice `step` cannot be zero.');
        }
        // Look up the length of the array.
        var n = array.length;
        // Set up the `start` value.
        if (start === undefined) {
            start = step < 0 ? n - 1 : 0;
        }
        else if (start < 0) {
            start = Math.max(start + n, step < 0 ? -1 : 0);
        }
        else if (start >= n) {
            start = step < 0 ? n - 1 : n;
        }
        // Set up the `stop` value.
        if (stop === undefined) {
            stop = step < 0 ? -1 : n;
        }
        else if (stop < 0) {
            stop = Math.max(stop + n, step < 0 ? -1 : 0);
        }
        else if (stop >= n) {
            stop = step < 0 ? n - 1 : n;
        }
        // Compute the slice length.
        var length;
        if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {
            length = 0;
        }
        else if (step < 0) {
            length = Math.floor((stop - start + 1) / step + 1);
        }
        else {
            length = Math.floor((stop - start - 1) / step + 1);
        }
        // Compute the sliced result.
        var result = [];
        for (var i = 0; i < length; ++i) {
            result[i] = array[start + i * step];
        }
        // Return the result.
        return result;
    }
    ArrayExt.slice = slice;
    /**
     * Move an element in an array from one index to another.
     *
     * @param array - The mutable array-like object of interest.
     *
     * @param fromIndex - The index of the element to move. Negative
     *   values are taken as an offset from the end of the array.
     *
     * @param toIndex - The target index of the element. Negative
     *   values are taken as an offset from the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `fromIndex` or `toIndex` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from from '@lumino/algorithm';
     *
     * let data = [0, 1, 2, 3, 4];
     * ArrayExt.move(data, 1, 2);  // [0, 2, 1, 3, 4]
     * ArrayExt.move(data, 4, 2);  // [0, 2, 4, 1, 3]
     * ```
     */
    function move(array, fromIndex, toIndex) {
        var n = array.length;
        if (n <= 1) {
            return;
        }
        if (fromIndex < 0) {
            fromIndex = Math.max(0, fromIndex + n);
        }
        else {
            fromIndex = Math.min(fromIndex, n - 1);
        }
        if (toIndex < 0) {
            toIndex = Math.max(0, toIndex + n);
        }
        else {
            toIndex = Math.min(toIndex, n - 1);
        }
        if (fromIndex === toIndex) {
            return;
        }
        var value = array[fromIndex];
        var d = fromIndex < toIndex ? 1 : -1;
        for (var i = fromIndex; i !== toIndex; i += d) {
            array[i] = array[i + d];
        }
        array[toIndex] = value;
    }
    ArrayExt.move = move;
    /**
     * Reverse an array in-place.
     *
     * @param array - The mutable array-like object of interest.
     *
     * @param start - The index of the first element in the range to be
     *   reversed, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   reversed, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or  `stop` index which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 1, 2, 3, 4];
     * ArrayExt.reverse(data, 1, 3);  // [0, 3, 2, 1, 4]
     * ArrayExt.reverse(data, 3);     // [0, 3, 2, 4, 1]
     * ArrayExt.reverse(data);        // [1, 4, 2, 3, 0]
     * ```
     */
    function reverse(array, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n <= 1) {
            return;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        while (start < stop) {
            var a = array[start];
            var b = array[stop];
            array[start++] = b;
            array[stop--] = a;
        }
    }
    ArrayExt.reverse = reverse;
    /**
     * Rotate the elements of an array in-place.
     *
     * @param array - The mutable array-like object of interest.
     *
     * @param delta - The amount of rotation to apply to the elements. A
     *   positive value will rotate the elements to the left. A negative
     *   value will rotate the elements to the right.
     *
     * @param start - The index of the first element in the range to be
     *   rotated, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   rotated, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `delta`, `start`, or `stop` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 1, 2, 3, 4];
     * ArrayExt.rotate(data, 2);        // [2, 3, 4, 0, 1]
     * ArrayExt.rotate(data, -2);       // [0, 1, 2, 3, 4]
     * ArrayExt.rotate(data, 10);       // [0, 1, 2, 3, 4]
     * ArrayExt.rotate(data, 9);        // [4, 0, 1, 2, 3]
     * ArrayExt.rotate(data, 2, 1, 3);  // [4, 2, 0, 1, 3]
     * ```
     */
    function rotate(array, delta, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n <= 1) {
            return;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        if (start >= stop) {
            return;
        }
        var length = stop - start + 1;
        if (delta > 0) {
            delta = delta % length;
        }
        else if (delta < 0) {
            delta = ((delta % length) + length) % length;
        }
        if (delta === 0) {
            return;
        }
        var pivot = start + delta;
        reverse(array, start, pivot - 1);
        reverse(array, pivot, stop);
        reverse(array, start, stop);
    }
    ArrayExt.rotate = rotate;
    /**
     * Fill an array with a static value.
     *
     * @param array - The mutable array-like object to fill.
     *
     * @param value - The static value to use to fill the array.
     *
     * @param start - The index of the first element in the range to be
     *   filled, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   filled, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * #### Notes
     * If `stop < start` the fill will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * A `start` or `stop` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = ['one', 'two', 'three', 'four'];
     * ArrayExt.fill(data, 'r');        // ['r', 'r', 'r', 'r']
     * ArrayExt.fill(data, 'g', 1);     // ['r', 'g', 'g', 'g']
     * ArrayExt.fill(data, 'b', 2, 3);  // ['r', 'g', 'b', 'b']
     * ArrayExt.fill(data, 'z', 3, 1);  // ['z', 'z', 'b', 'z']
     * ```
     */
    function fill(array, value, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var span;
        if (stop < start) {
            span = stop + 1 + (n - start);
        }
        else {
            span = stop - start + 1;
        }
        for (var i = 0; i < span; ++i) {
            array[(start + i) % n] = value;
        }
    }
    ArrayExt.fill = fill;
    /**
     * Insert a value into an array at a specific index.
     *
     * @param array - The array of interest.
     *
     * @param index - The index at which to insert the value. Negative
     *   values are taken as an offset from the end of the array.
     *
     * @param value - The value to set at the specified index.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * An `index` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 1, 2];
     * ArrayExt.insert(data, 0, -1);  // [-1, 0, 1, 2]
     * ArrayExt.insert(data, 2, 12);  // [-1, 0, 12, 1, 2]
     * ArrayExt.insert(data, -1, 7);  // [-1, 0, 12, 1, 7, 2]
     * ArrayExt.insert(data, 6, 19);  // [-1, 0, 12, 1, 7, 2, 19]
     * ```
     */
    function insert(array, index, value) {
        var n = array.length;
        if (index < 0) {
            index = Math.max(0, index + n);
        }
        else {
            index = Math.min(index, n);
        }
        for (var i = n; i > index; --i) {
            array[i] = array[i - 1];
        }
        array[index] = value;
    }
    ArrayExt.insert = insert;
    /**
     * Remove and return a value at a specific index in an array.
     *
     * @param array - The array of interest.
     *
     * @param index - The index of the value to remove. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The value at the specified index, or `undefined` if the
     *   index is out of range.
     *
     * #### Complexity
     * Linear.
     *
     * #### Undefined Behavior
     * An `index` which is non-integral.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 12, 23, 39, 14, 12, 75];
     * ArrayExt.removeAt(data, 2);   // 23
     * ArrayExt.removeAt(data, -2);  // 12
     * ArrayExt.removeAt(data, 10);  // undefined;
     * ```
     */
    function removeAt(array, index) {
        var n = array.length;
        if (index < 0) {
            index += n;
        }
        if (index < 0 || index >= n) {
            return undefined;
        }
        var value = array[index];
        for (var i = index + 1; i < n; ++i) {
            array[i - 1] = array[i];
        }
        array.length = n - 1;
        return value;
    }
    ArrayExt.removeAt = removeAt;
    /**
     * Remove the first occurrence of a value from an array.
     *
     * @param array - The array of interest.
     *
     * @param value - The value to remove from the array. Values are
     *   compared using strict `===` equality.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the removed value, or `-1` if the value
     *   is not contained in the array.
     *
     * #### Notes
     * If `stop < start` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 12, 23, 39, 14, 12, 75];
     * ArrayExt.removeFirstOf(data, 12);        // 1
     * ArrayExt.removeFirstOf(data, 17);        // -1
     * ArrayExt.removeFirstOf(data, 39, 3);     // -1
     * ArrayExt.removeFirstOf(data, 39, 3, 2);  // 2
     * ```
     */
    function removeFirstOf(array, value, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var index = firstIndexOf(array, value, start, stop);
        if (index !== -1) {
            removeAt(array, index);
        }
        return index;
    }
    ArrayExt.removeFirstOf = removeFirstOf;
    /**
     * Remove the last occurrence of a value from an array.
     *
     * @param array - The array of interest.
     *
     * @param value - The value to remove from the array. Values are
     *   compared using strict `===` equality.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The index of the removed value, or `-1` if the value
     *   is not contained in the array.
     *
     * #### Notes
     * If `start < stop` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [0, 12, 23, 39, 14, 12, 75];
     * ArrayExt.removeLastOf(data, 12);        // 5
     * ArrayExt.removeLastOf(data, 17);        // -1
     * ArrayExt.removeLastOf(data, 39, 2);     // -1
     * ArrayExt.removeLastOf(data, 39, 2, 3);  // 3
     * ```
     */
    function removeLastOf(array, value, start, stop) {
        if (start === void 0) { start = -1; }
        if (stop === void 0) { stop = 0; }
        var index = lastIndexOf(array, value, start, stop);
        if (index !== -1) {
            removeAt(array, index);
        }
        return index;
    }
    ArrayExt.removeLastOf = removeLastOf;
    /**
     * Remove all occurrences of a value from an array.
     *
     * @param array - The array of interest.
     *
     * @param value - The value to remove from the array. Values are
     *   compared using strict `===` equality.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The number of elements removed from the array.
     *
     * #### Notes
     * If `stop < start` the search will conceptually wrap at the end of
     * the array, however the array will be traversed front-to-back.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * let data = [14, 12, 23, 39, 14, 12, 19, 14];
     * ArrayExt.removeAllOf(data, 12);        // 2
     * ArrayExt.removeAllOf(data, 17);        // 0
     * ArrayExt.removeAllOf(data, 14, 1, 4);  // 1
     * ```
     */
    function removeAllOf(array, value, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return 0;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var count = 0;
        for (var i = 0; i < n; ++i) {
            if (start <= stop && i >= start && i <= stop && array[i] === value) {
                count++;
            }
            else if (stop < start &&
                (i <= stop || i >= start) &&
                array[i] === value) {
                count++;
            }
            else if (count > 0) {
                array[i - count] = array[i];
            }
        }
        if (count > 0) {
            array.length = n - count;
        }
        return count;
    }
    ArrayExt.removeAllOf = removeAllOf;
    /**
     * Remove the first occurrence of a value which matches a predicate.
     *
     * @param array - The array of interest.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The removed `{ index, value }`, which will be `-1` and
     *   `undefined` if the value is not contained in the array.
     *
     * #### Notes
     * If `stop < start` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [0, 12, 23, 39, 14, 12, 75];
     * ArrayExt.removeFirstWhere(data, isEven);     // { index: 0, value: 0 }
     * ArrayExt.removeFirstWhere(data, isEven, 2);  // { index: 3, value: 14 }
     * ArrayExt.removeFirstWhere(data, isEven, 4);  // { index: -1, value: undefined }
     * ```
     */
    function removeFirstWhere(array, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var value;
        var index = findFirstIndex(array, fn, start, stop);
        if (index !== -1) {
            value = removeAt(array, index);
        }
        return { index: index, value: value };
    }
    ArrayExt.removeFirstWhere = removeFirstWhere;
    /**
     * Remove the last occurrence of a value which matches a predicate.
     *
     * @param array - The array of interest.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The removed `{ index, value }`, which will be `-1` and
     *   `undefined` if the value is not contained in the array.
     *
     * #### Notes
     * If `start < stop` the search will wrap at the end of the array.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * let data = [0, 12, 23, 39, 14, 12, 75];
     * ArrayExt.removeLastWhere(data, isEven);        // { index: 5, value: 12 }
     * ArrayExt.removeLastWhere(data, isEven, 2);     // { index: 1, value: 12 }
     * ArrayExt.removeLastWhere(data, isEven, 2, 1);  // { index: -1, value: undefined }
     * ```
     */
    function removeLastWhere(array, fn, start, stop) {
        if (start === void 0) { start = -1; }
        if (stop === void 0) { stop = 0; }
        var value;
        var index = findLastIndex(array, fn, start, stop);
        if (index !== -1) {
            value = removeAt(array, index);
        }
        return { index: index, value: value };
    }
    ArrayExt.removeLastWhere = removeLastWhere;
    /**
     * Remove all occurrences of values which match a predicate.
     *
     * @param array - The array of interest.
     *
     * @param fn - The predicate function to apply to the values.
     *
     * @param start - The index of the first element in the range to be
     *   searched, inclusive. The default value is `0`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @param stop - The index of the last element in the range to be
     *   searched, inclusive. The default value is `-1`. Negative values
     *   are taken as an offset from the end of the array.
     *
     * @returns The number of elements removed from the array.
     *
     * #### Notes
     * If `stop < start` the search will conceptually wrap at the end of
     * the array, however the array will be traversed front-to-back.
     *
     * #### Complexity
     * Linear.
     *
     * #### Example
     * ```typescript
     * import { ArrayExt } from '@lumino/algorithm';
     *
     * function isEven(value: number): boolean {
     *   return value % 2 === 0;
     * }
     *
     * function isNegative(value: number): boolean {
     *   return value < 0;
     * }
     *
     * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];
     * ArrayExt.removeAllWhere(data, isEven);            // 4
     * ArrayExt.removeAllWhere(data, isNegative, 0, 3);  // 2
     * ```
     */
    function removeAllWhere(array, fn, start, stop) {
        if (start === void 0) { start = 0; }
        if (stop === void 0) { stop = -1; }
        var n = array.length;
        if (n === 0) {
            return 0;
        }
        if (start < 0) {
            start = Math.max(0, start + n);
        }
        else {
            start = Math.min(start, n - 1);
        }
        if (stop < 0) {
            stop = Math.max(0, stop + n);
        }
        else {
            stop = Math.min(stop, n - 1);
        }
        var count = 0;
        for (var i = 0; i < n; ++i) {
            if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {
                count++;
            }
            else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {
                count++;
            }
            else if (count > 0) {
                array[i - count] = array[i];
            }
        }
        if (count > 0) {
            array.length = n - count;
        }
        return count;
    }
    ArrayExt.removeAllWhere = removeAllWhere;
})(ArrayExt || (ArrayExt = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * Create an iterator for an iterable object.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @returns A new iterator for the given object.
 *
 * #### Notes
 * This function allows iteration algorithms to operate on user-defined
 * iterable types and builtin array-like objects in a uniform fashion.
 */
function iter(object) {
    var it;
    if (typeof object.iter === 'function') {
        it = object.iter();
    }
    else {
        it = new ArrayIterator(object);
    }
    return it;
}
/**
 * Create an iterator for the keys in an object.
 *
 * @param object - The object of interest.
 *
 * @returns A new iterator for the keys in the given object.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { each, keys } from '@lumino/algorithm';
 *
 * let data = { one: 1, two: 2, three: 3 };
 *
 * each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'
 * ```
 */
function iterKeys(object) {
    return new KeyIterator(object);
}
/**
 * Create an iterator for the values in an object.
 *
 * @param object - The object of interest.
 *
 * @returns A new iterator for the values in the given object.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { each, values } from '@lumino/algorithm';
 *
 * let data = { one: 1, two: 2, three: 3 };
 *
 * each(values(data), value => { console.log(value); }); // 1, 2, 3
 * ```
 */
function iterValues(object) {
    return new ValueIterator(object);
}
/**
 * Create an iterator for the items in an object.
 *
 * @param object - The object of interest.
 *
 * @returns A new iterator for the items in the given object.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { each, items } from '@lumino/algorithm';
 *
 * let data = { one: 1, two: 2, three: 3 };
 *
 * each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]
 * ```
 */
function index_es6_iterItems(object) {
    return new ItemIterator(object);
}
/**
 * Create an iterator for an iterator-like function.
 *
 * @param fn - A function which behaves like an iterator `next` method.
 *
 * @returns A new iterator for the given function.
 *
 * #### Notes
 * The returned iterator **cannot** be cloned.
 *
 * #### Example
 * ```typescript
 * import { each, iterFn } from '@lumino/algorithm';
 *
 * let it = iterFn((() => {
 *   let i = 0;
 *   return () => i > 3 ? undefined : i++;
 * })());
 *
 * each(it, v => { console.log(v); }); // 0, 1, 2, 3
 * ```
 */
function iterFn(fn) {
    return new FnIterator(fn);
}
/**
 * Invoke a function for each value in an iterable.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param fn - The callback function to invoke for each value.
 *
 * #### Notes
 * Iteration can be terminated early by returning `false` from the
 * callback function.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { each } from '@lumino/algorithm';
 *
 * let data = [5, 7, 0, -2, 9];
 *
 * each(data, value => { console.log(value); });
 * ```
 */
function each(object, fn) {
    var index = 0;
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, index++) === false) {
            return;
        }
    }
}
/**
 * Test whether all values in an iterable satisfy a predicate.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param fn - The predicate function to invoke for each value.
 *
 * @returns `true` if all values pass the test, `false` otherwise.
 *
 * #### Notes
 * Iteration terminates on the first `false` predicate result.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { every } from '@lumino/algorithm';
 *
 * let data = [5, 7, 1];
 *
 * every(data, value => value % 2 === 0);  // false
 * every(data, value => value % 2 === 1);  // true
 * ```
 */
function every(object, fn) {
    var index = 0;
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        if (!fn(value, index++)) {
            return false;
        }
    }
    return true;
}
/**
 * Test whether any value in an iterable satisfies a predicate.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param fn - The predicate function to invoke for each value.
 *
 * @returns `true` if any value passes the test, `false` otherwise.
 *
 * #### Notes
 * Iteration terminates on the first `true` predicate result.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { some } from '@lumino/algorithm';
 *
 * let data = [5, 7, 1];
 *
 * some(data, value => value === 7);  // true
 * some(data, value => value === 3);  // false
 * ```
 */
function some(object, fn) {
    var index = 0;
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, index++)) {
            return true;
        }
    }
    return false;
}
/**
 * Create an array from an iterable of values.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @returns A new array of values from the given object.
 *
 * #### Example
 * ```typescript
 * import { iter, toArray } from '@lumino/algorithm';
 *
 * let data = [1, 2, 3, 4, 5, 6];
 *
 * let stream = iter(data);
 *
 * toArray(stream);  // [1, 2, 3, 4, 5, 6];
 * ```
 */
function toArray(object) {
    var index = 0;
    var result = [];
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        result[index++] = value;
    }
    return result;
}
/**
 * Create an object from an iterable of key/value pairs.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @returns A new object mapping keys to values.
 *
 * #### Example
 * ```typescript
 * import { toObject } from '@lumino/algorithm';
 *
 * let data = [['one', 1], ['two', 2], ['three', 3]];
 *
 * toObject(data);  // { one: 1, two: 2, three: 3 }
 * ```
 */
function toObject(object) {
    var it = iter(object);
    var pair;
    var result = {};
    while ((pair = it.next()) !== undefined) {
        result[pair[0]] = pair[1];
    }
    return result;
}
/**
 * An iterator for an array-like object.
 *
 * #### Notes
 * This iterator can be used for any builtin JS array-like object.
 */
var ArrayIterator = /** @class */ (function () {
    /**
     * Construct a new array iterator.
     *
     * @param source - The array-like object of interest.
     */
    function ArrayIterator(source) {
        this._index = 0;
        this._source = source;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    ArrayIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    ArrayIterator.prototype.clone = function () {
        var result = new ArrayIterator(this._source);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    ArrayIterator.prototype.next = function () {
        if (this._index >= this._source.length) {
            return undefined;
        }
        return this._source[this._index++];
    };
    return ArrayIterator;
}());
/**
 * An iterator for the keys in an object.
 *
 * #### Notes
 * This iterator can be used for any JS object.
 */
var KeyIterator = /** @class */ (function () {
    /**
     * Construct a new key iterator.
     *
     * @param source - The object of interest.
     *
     * @param keys - The keys to iterate, if known.
     */
    function KeyIterator(source, keys) {
        if (keys === void 0) { keys = Object.keys(source); }
        this._index = 0;
        this._source = source;
        this._keys = keys;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    KeyIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    KeyIterator.prototype.clone = function () {
        var result = new KeyIterator(this._source, this._keys);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    KeyIterator.prototype.next = function () {
        if (this._index >= this._keys.length) {
            return undefined;
        }
        var key = this._keys[this._index++];
        if (key in this._source) {
            return key;
        }
        return this.next();
    };
    return KeyIterator;
}());
/**
 * An iterator for the values in an object.
 *
 * #### Notes
 * This iterator can be used for any JS object.
 */
var ValueIterator = /** @class */ (function () {
    /**
     * Construct a new value iterator.
     *
     * @param source - The object of interest.
     *
     * @param keys - The keys to iterate, if known.
     */
    function ValueIterator(source, keys) {
        if (keys === void 0) { keys = Object.keys(source); }
        this._index = 0;
        this._source = source;
        this._keys = keys;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    ValueIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    ValueIterator.prototype.clone = function () {
        var result = new ValueIterator(this._source, this._keys);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    ValueIterator.prototype.next = function () {
        if (this._index >= this._keys.length) {
            return undefined;
        }
        var key = this._keys[this._index++];
        if (key in this._source) {
            return this._source[key];
        }
        return this.next();
    };
    return ValueIterator;
}());
/**
 * An iterator for the items in an object.
 *
 * #### Notes
 * This iterator can be used for any JS object.
 */
var ItemIterator = /** @class */ (function () {
    /**
     * Construct a new item iterator.
     *
     * @param source - The object of interest.
     *
     * @param keys - The keys to iterate, if known.
     */
    function ItemIterator(source, keys) {
        if (keys === void 0) { keys = Object.keys(source); }
        this._index = 0;
        this._source = source;
        this._keys = keys;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    ItemIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    ItemIterator.prototype.clone = function () {
        var result = new ItemIterator(this._source, this._keys);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    ItemIterator.prototype.next = function () {
        if (this._index >= this._keys.length) {
            return undefined;
        }
        var key = this._keys[this._index++];
        if (key in this._source) {
            return [key, this._source[key]];
        }
        return this.next();
    };
    return ItemIterator;
}());
/**
 * An iterator for an iterator-like function.
 */
var FnIterator = /** @class */ (function () {
    /**
     * Construct a new function iterator.
     *
     * @param fn - The iterator-like function of interest.
     */
    function FnIterator(fn) {
        this._fn = fn;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    FnIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    FnIterator.prototype.clone = function () {
        throw new Error('An `FnIterator` cannot be cloned.');
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    FnIterator.prototype.next = function () {
        return this._fn.call(undefined);
    };
    return FnIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Chain together several iterables.
 *
 * @param objects - The iterable or array-like objects of interest.
 *
 * @returns An iterator which yields the values of the iterables
 *   in the order in which they are supplied.
 *
 * #### Example
 * ```typescript
 * import { chain, toArray } from '@lumino/algorithm';
 *
 * let data1 = [1, 2, 3];
 * let data2 = [4, 5, 6];
 *
 * let stream = chain(data1, data2);
 *
 * toArray(stream);  // [1, 2, 3, 4, 5, 6]
 * ```
 */
function chain() {
    var objects = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        objects[_i] = arguments[_i];
    }
    return new ChainIterator(iter(objects.map(iter)));
}
/**
 * An iterator which chains together several iterators.
 */
var ChainIterator = /** @class */ (function () {
    /**
     * Construct a new chain iterator.
     *
     * @param source - The iterator of iterators of interest.
     */
    function ChainIterator(source) {
        this._cloned = false;
        this._source = source;
        this._active = undefined;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    ChainIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    ChainIterator.prototype.clone = function () {
        var result = new ChainIterator(this._source.clone());
        result._active = this._active && this._active.clone();
        result._cloned = true;
        this._cloned = true;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    ChainIterator.prototype.next = function () {
        if (this._active === undefined) {
            var active = this._source.next();
            if (active === undefined) {
                return undefined;
            }
            this._active = this._cloned ? active.clone() : active;
        }
        var value = this._active.next();
        if (value !== undefined) {
            return value;
        }
        this._active = undefined;
        return this.next();
    };
    return ChainIterator;
}());

/**
 * Create an empty iterator.
 *
 * @returns A new iterator which yields nothing.
 *
 * #### Example
 * ```typescript
 * import { empty, toArray } from '@lumino/algorithm';
 *
 * let stream = empty<number>();
 *
 * toArray(stream);  // []
 * ```
 */
function empty() {
    return new EmptyIterator();
}
/**
 * An iterator which is always empty.
 */
var EmptyIterator = /** @class */ (function () {
    function EmptyIterator() {
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    EmptyIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    EmptyIterator.prototype.clone = function () {
        return new EmptyIterator();
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    EmptyIterator.prototype.next = function () {
        return undefined;
    };
    return EmptyIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Enumerate an iterable object.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param start - The starting enum value. The default is `0`.
 *
 * @returns An iterator which yields the enumerated values.
 *
 * #### Example
 * ```typescript
 * import { enumerate, toArray } from '@lumino/algorithm';
 *
 * let data = ['foo', 'bar', 'baz'];
 *
 * let stream = enumerate(data, 1);
 *
 * toArray(stream);  // [[1, 'foo'], [2, 'bar'], [3, 'baz']]
 * ```
 */
function enumerate(object, start) {
    if (start === void 0) { start = 0; }
    return new EnumerateIterator(iter(object), start);
}
/**
 * An iterator which enumerates the source values.
 */
var EnumerateIterator = /** @class */ (function () {
    /**
     * Construct a new enumerate iterator.
     *
     * @param source - The iterator of values of interest.
     *
     * @param start - The starting enum value.
     */
    function EnumerateIterator(source, start) {
        this._source = source;
        this._index = start;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    EnumerateIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    EnumerateIterator.prototype.clone = function () {
        return new EnumerateIterator(this._source.clone(), this._index);
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    EnumerateIterator.prototype.next = function () {
        var value = this._source.next();
        if (value === undefined) {
            return undefined;
        }
        return [this._index++, value];
    };
    return EnumerateIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Filter an iterable for values which pass a test.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param fn - The predicate function to invoke for each value.
 *
 * @returns An iterator which yields the values which pass the test.
 *
 * #### Example
 * ```typescript
 * import { filter, toArray } from '@lumino/algorithm';
 *
 * let data = [1, 2, 3, 4, 5, 6];
 *
 * let stream = filter(data, value => value % 2 === 0);
 *
 * toArray(stream);  // [2, 4, 6]
 * ```
 */
function filter(object, fn) {
    return new FilterIterator(iter(object), fn);
}
/**
 * An iterator which yields values which pass a test.
 */
var FilterIterator = /** @class */ (function () {
    /**
     * Construct a new filter iterator.
     *
     * @param source - The iterator of values of interest.
     *
     * @param fn - The predicate function to invoke for each value.
     */
    function FilterIterator(source, fn) {
        this._index = 0;
        this._source = source;
        this._fn = fn;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    FilterIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    FilterIterator.prototype.clone = function () {
        var result = new FilterIterator(this._source.clone(), this._fn);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    FilterIterator.prototype.next = function () {
        var fn = this._fn;
        var it = this._source;
        var value;
        while ((value = it.next()) !== undefined) {
            if (fn(value, this._index++)) {
                return value;
            }
        }
        return undefined;
    };
    return FilterIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Find the first value in an iterable which matches a predicate.
 *
 * @param object - The iterable or array-like object to search.
 *
 * @param fn - The predicate function to apply to the values.
 *
 * @returns The first matching value, or `undefined` if no matching
 *   value is found.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { find } from '@lumino/algorithm';
 *
 * interface IAnimal { species: string, name: string };
 *
 * function isCat(value: IAnimal): boolean {
 *   return value.species === 'cat';
 * }
 *
 * let data: IAnimal[] = [
 *   { species: 'dog', name: 'spot' },
 *   { species: 'cat', name: 'fluffy' },
 *   { species: 'alligator', name: 'pocho' }
 * ];
 *
 * find(data, isCat).name;  // 'fluffy'
 * ```
 */
function find(object, fn) {
    var index = 0;
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, index++)) {
            return value;
        }
    }
    return undefined;
}
/**
 * Find the index of the first value which matches a predicate.
 *
 * @param object - The iterable or array-like object to search.
 *
 * @param fn - The predicate function to apply to the values.
 *
 * @returns The index of the first matching value, or `-1` if no
 *   matching value is found.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { findIndex } from '@lumino/algorithm';
 *
 * interface IAnimal { species: string, name: string };
 *
 * function isCat(value: IAnimal): boolean {
 *   return value.species === 'cat';
 * }
 *
 * let data: IAnimal[] = [
 *   { species: 'dog', name: 'spot' },
 *   { species: 'cat', name: 'fluffy' },
 *   { species: 'alligator', name: 'pocho' }
 * ];
 *
 * findIndex(data, isCat);  // 1
 * ```
 */
function findIndex(object, fn) {
    var index = 0;
    var it = iter(object);
    var value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, index++)) {
            return index - 1;
        }
    }
    return -1;
}
/**
 * Find the minimum value in an iterable.
 *
 * @param object - The iterable or array-like object to search.
 *
 * @param fn - The 3-way comparison function to apply to the values.
 *   It should return `< 0` if the first value is less than the second.
 *   `0` if the values are equivalent, or `> 0` if the first value is
 *   greater than the second.
 *
 * @returns The minimum value in the iterable. If multiple values are
 *   equivalent to the minimum, the left-most value is returned. If
 *   the iterable is empty, this returns `undefined`.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { min } from '@lumino/algorithm';
 *
 * function numberCmp(a: number, b: number): number {
 *   return a - b;
 * }
 *
 * min([7, 4, 0, 3, 9, 4], numberCmp);  // 0
 * ```
 */
function min(object, fn) {
    var it = iter(object);
    var value = it.next();
    if (value === undefined) {
        return undefined;
    }
    var result = value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, result) < 0) {
            result = value;
        }
    }
    return result;
}
/**
 * Find the maximum value in an iterable.
 *
 * @param object - The iterable or array-like object to search.
 *
 * @param fn - The 3-way comparison function to apply to the values.
 *   It should return `< 0` if the first value is less than the second.
 *   `0` if the values are equivalent, or `> 0` if the first value is
 *   greater than the second.
 *
 * @returns The maximum value in the iterable. If multiple values are
 *   equivalent to the maximum, the left-most value is returned. If
 *   the iterable is empty, this returns `undefined`.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { max } from '@lumino/algorithm';
 *
 * function numberCmp(a: number, b: number): number {
 *   return a - b;
 * }
 *
 * max([7, 4, 0, 3, 9, 4], numberCmp);  // 9
 * ```
 */
function max(object, fn) {
    var it = iter(object);
    var value = it.next();
    if (value === undefined) {
        return undefined;
    }
    var result = value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, result) > 0) {
            result = value;
        }
    }
    return result;
}
/**
 * Find the minimum and maximum values in an iterable.
 *
 * @param object - The iterable or array-like object to search.
 *
 * @param fn - The 3-way comparison function to apply to the values.
 *   It should return `< 0` if the first value is less than the second.
 *   `0` if the values are equivalent, or `> 0` if the first value is
 *   greater than the second.
 *
 * @returns A 2-tuple of the `[min, max]` values in the iterable. If
 *   multiple values are equivalent, the left-most values are returned.
 *   If the iterable is empty, this returns `undefined`.
 *
 * #### Complexity
 * Linear.
 *
 * #### Example
 * ```typescript
 * import { minmax } from '@lumino/algorithm';
 *
 * function numberCmp(a: number, b: number): number {
 *   return a - b;
 * }
 *
 * minmax([7, 4, 0, 3, 9, 4], numberCmp);  // [0, 9]
 * ```
 */
function minmax(object, fn) {
    var it = iter(object);
    var value = it.next();
    if (value === undefined) {
        return undefined;
    }
    var vmin = value;
    var vmax = value;
    while ((value = it.next()) !== undefined) {
        if (fn(value, vmin) < 0) {
            vmin = value;
        }
        else if (fn(value, vmax) > 0) {
            vmax = value;
        }
    }
    return [vmin, vmax];
}

// Copyright (c) Jupyter Development Team.
/**
 * Transform the values of an iterable with a mapping function.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param fn - The mapping function to invoke for each value.
 *
 * @returns An iterator which yields the transformed values.
 *
 * #### Example
 * ```typescript
 * import { map, toArray } from '@lumino/algorithm';
 *
 * let data = [1, 2, 3];
 *
 * let stream = map(data, value => value * 2);
 *
 * toArray(stream);  // [2, 4, 6]
 * ```
 */
function map(object, fn) {
    return new MapIterator(iter(object), fn);
}
/**
 * An iterator which transforms values using a mapping function.
 */
var MapIterator = /** @class */ (function () {
    /**
     * Construct a new map iterator.
     *
     * @param source - The iterator of values of interest.
     *
     * @param fn - The mapping function to invoke for each value.
     */
    function MapIterator(source, fn) {
        this._index = 0;
        this._source = source;
        this._fn = fn;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    MapIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    MapIterator.prototype.clone = function () {
        var result = new MapIterator(this._source.clone(), this._fn);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    MapIterator.prototype.next = function () {
        var value = this._source.next();
        if (value === undefined) {
            return undefined;
        }
        return this._fn.call(undefined, value, this._index++);
    };
    return MapIterator;
}());

/**
 * Create an iterator of evenly spaced values.
 *
 * @param start - The starting value for the range, inclusive.
 *
 * @param stop - The stopping value for the range, exclusive.
 *
 * @param step - The distance between each value.
 *
 * @returns An iterator which produces evenly spaced values.
 *
 * #### Notes
 * In the single argument form of `range(stop)`, `start` defaults to
 * `0` and `step` defaults to `1`.
 *
 * In the two argument form of `range(start, stop)`, `step` defaults
 * to `1`.
 */
function range(start, stop, step) {
    if (stop === undefined) {
        return new RangeIterator(0, start, 1);
    }
    if (step === undefined) {
        return new RangeIterator(start, stop, 1);
    }
    return new RangeIterator(start, stop, step);
}
/**
 * An iterator which produces a range of evenly spaced values.
 */
var RangeIterator = /** @class */ (function () {
    /**
     * Construct a new range iterator.
     *
     * @param start - The starting value for the range, inclusive.
     *
     * @param stop - The stopping value for the range, exclusive.
     *
     * @param step - The distance between each value.
     */
    function RangeIterator(start, stop, step) {
        this._index = 0;
        this._start = start;
        this._stop = stop;
        this._step = step;
        this._length = index_es6_Private.rangeLength(start, stop, step);
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    RangeIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    RangeIterator.prototype.clone = function () {
        var result = new RangeIterator(this._start, this._stop, this._step);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    RangeIterator.prototype.next = function () {
        if (this._index >= this._length) {
            return undefined;
        }
        return this._start + this._step * this._index++;
    };
    return RangeIterator;
}());
/**
 * The namespace for the module implementation details.
 */
var index_es6_Private;
(function (Private) {
    /**
     * Compute the effective length of a range.
     *
     * @param start - The starting value for the range, inclusive.
     *
     * @param stop - The stopping value for the range, exclusive.
     *
     * @param step - The distance between each value.
     *
     * @returns The number of steps need to traverse the range.
     */
    function rangeLength(start, stop, step) {
        if (step === 0) {
            return Infinity;
        }
        if (start > stop && step > 0) {
            return 0;
        }
        if (start < stop && step < 0) {
            return 0;
        }
        return Math.ceil((stop - start) / step);
    }
    Private.rangeLength = rangeLength;
})(index_es6_Private || (index_es6_Private = {}));

// Copyright (c) Jupyter Development Team.
function reduce(object, fn, initial) {
    // Setup the iterator and fetch the first value.
    var index = 0;
    var it = iter(object);
    var first = it.next();
    // An empty iterator and no initial value is an error.
    if (first === undefined && initial === undefined) {
        throw new TypeError('Reduce of empty iterable with no initial value.');
    }
    // If the iterator is empty, return the initial value.
    if (first === undefined) {
        return initial;
    }
    // If the iterator has a single item and no initial value, the
    // reducer is not invoked and the first item is the return value.
    var second = it.next();
    if (second === undefined && initial === undefined) {
        return first;
    }
    // If iterator has a single item and an initial value is provided,
    // the reducer is invoked and that result is the return value.
    if (second === undefined) {
        return fn(initial, first, index++);
    }
    // Setup the initial accumlated value.
    var accumulator;
    if (initial === undefined) {
        accumulator = fn(first, second, index++);
    }
    else {
        accumulator = fn(fn(initial, first, index++), second, index++);
    }
    // Iterate the rest of the values, updating the accumulator.
    var next;
    while ((next = it.next()) !== undefined) {
        accumulator = fn(accumulator, next, index++);
    }
    // Return the final accumulated value.
    return accumulator;
}

/**
 * Create an iterator which repeats a value a number of times.
 *
 * @param value - The value to repeat.
 *
 * @param count - The number of times to repeat the value.
 *
 * @returns A new iterator which repeats the specified value.
 *
 * #### Example
 * ```typescript
 * import { repeat, toArray } from '@lumino/algorithm';
 *
 * let stream = repeat(7, 3);
 *
 * toArray(stream);  // [7, 7, 7]
 * ```
 */
function repeat(value, count) {
    return new RepeatIterator(value, count);
}
/**
 * Create an iterator which yields a value a single time.
 *
 * @param value - The value to wrap in an iterator.
 *
 * @returns A new iterator which yields the value a single time.
 *
 * #### Example
 * ```typescript
 * import { once, toArray } from '@lumino/algorithm';
 *
 * let stream = once(7);
 *
 * toArray(stream);  // [7]
 * ```
 */
function once(value) {
    return new RepeatIterator(value, 1);
}
/**
 * An iterator which repeats a value a specified number of times.
 */
var RepeatIterator = /** @class */ (function () {
    /**
     * Construct a new repeat iterator.
     *
     * @param value - The value to repeat.
     *
     * @param count - The number of times to repeat the value.
     */
    function RepeatIterator(value, count) {
        this._value = value;
        this._count = count;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    RepeatIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    RepeatIterator.prototype.clone = function () {
        return new RepeatIterator(this._value, this._count);
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    RepeatIterator.prototype.next = function () {
        if (this._count <= 0) {
            return undefined;
        }
        this._count--;
        return this._value;
    };
    return RepeatIterator;
}());

/**
 * Create an iterator for a retroable object.
 *
 * @param object - The retroable or array-like object of interest.
 *
 * @returns An iterator which traverses the object's values in reverse.
 *
 * #### Example
 * ```typescript
 * import { retro, toArray } from '@lumino/algorithm';
 *
 * let data = [1, 2, 3, 4, 5, 6];
 *
 * let stream = retro(data);
 *
 * toArray(stream);  // [6, 5, 4, 3, 2, 1]
 * ```
 */
function retro(object) {
    var it;
    if (typeof object.retro === 'function') {
        it = object.retro();
    }
    else {
        it = new RetroArrayIterator(object);
    }
    return it;
}
/**
 * An iterator which traverses an array-like object in reverse.
 *
 * #### Notes
 * This iterator can be used for any builtin JS array-like object.
 */
var RetroArrayIterator = /** @class */ (function () {
    /**
     * Construct a new retro iterator.
     *
     * @param source - The array-like object of interest.
     */
    function RetroArrayIterator(source) {
        this._source = source;
        this._index = source.length - 1;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    RetroArrayIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    RetroArrayIterator.prototype.clone = function () {
        var result = new RetroArrayIterator(this._source);
        result._index = this._index;
        return result;
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    RetroArrayIterator.prototype.next = function () {
        if (this._index < 0 || this._index >= this._source.length) {
            return undefined;
        }
        return this._source[this._index--];
    };
    return RetroArrayIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Topologically sort an iterable of edges.
 *
 * @param edges - The iterable or array-like object of edges to sort.
 *   An edge is represented as a 2-tuple of `[fromNode, toNode]`.
 *
 * @returns The topologically sorted array of nodes.
 *
 * #### Notes
 * If a cycle is present in the graph, the cycle will be ignored and
 * the return value will be only approximately sorted.
 *
 * #### Example
 * ```typescript
 * import { topologicSort } from '@lumino/algorithm';
 *
 * let data = [
 *   ['d', 'e'],
 *   ['c', 'd'],
 *   ['a', 'b'],
 *   ['b', 'c']
 * ];
 *
 * topologicSort(data);  // ['a', 'b', 'c', 'd', 'e']
 * ```
 */
function topologicSort(edges) {
    // Setup the shared sorting state.
    var sorted = [];
    var visited = new Set();
    var graph = new Map();
    // Add the edges to the graph.
    each(edges, addEdge);
    // Visit each node in the graph.
    graph.forEach(function (v, k) {
        visit(k);
    });
    // Return the sorted results.
    return sorted;
    // Add an edge to the graph.
    function addEdge(edge) {
        var fromNode = edge[0], toNode = edge[1];
        var children = graph.get(toNode);
        if (children) {
            children.push(fromNode);
        }
        else {
            graph.set(toNode, [fromNode]);
        }
    }
    // Recursively visit the node.
    function visit(node) {
        if (visited.has(node)) {
            return;
        }
        visited.add(node);
        var children = graph.get(node);
        if (children) {
            children.forEach(visit);
        }
        sorted.push(node);
    }
}

// Copyright (c) Jupyter Development Team.
/**
 * Iterate over an iterable using a stepped increment.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param step - The distance to step on each iteration. A value
 *   of less than `1` will behave the same as a value of `1`.
 *
 * @returns An iterator which traverses the iterable step-wise.
 *
 * #### Example
 * ```typescript
 * import { stride, toArray } from '@lumino/algorithm';
 *
 * let data = [1, 2, 3, 4, 5, 6];
 *
 * let stream = stride(data, 2);
 *
 * toArray(stream);  // [1, 3, 5];
 * ```
 */
function stride(object, step) {
    return new StrideIterator(iter(object), step);
}
/**
 * An iterator which traverses a source iterator step-wise.
 */
var StrideIterator = /** @class */ (function () {
    /**
     * Construct a new stride iterator.
     *
     * @param source - The iterator of values of interest.
     *
     * @param step - The distance to step on each iteration. A value
     *   of less than `1` will behave the same as a value of `1`.
     */
    function StrideIterator(source, step) {
        this._source = source;
        this._step = step;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    StrideIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    StrideIterator.prototype.clone = function () {
        return new StrideIterator(this._source.clone(), this._step);
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    StrideIterator.prototype.next = function () {
        var value = this._source.next();
        for (var n = this._step - 1; n > 0; --n) {
            this._source.next();
        }
        return value;
    };
    return StrideIterator;
}());

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for string-specific algorithms.
 */
var StringExt;
(function (StringExt) {
    /**
     * Find the indices of characters in a source text.
     *
     * @param source - The source text which should be searched.
     *
     * @param query - The characters to locate in the source text.
     *
     * @param start - The index to start the search.
     *
     * @returns The matched indices, or `null` if there is no match.
     *
     * #### Complexity
     * Linear on `sourceText`.
     *
     * #### Notes
     * In order for there to be a match, all of the characters in `query`
     * **must** appear in `source` in the order given by `query`.
     *
     * Characters are matched using strict `===` equality.
     */
    function findIndices(source, query, start) {
        if (start === void 0) { start = 0; }
        var indices = new Array(query.length);
        for (var i = 0, j = start, n = query.length; i < n; ++i, ++j) {
            j = source.indexOf(query[i], j);
            if (j === -1) {
                return null;
            }
            indices[i] = j;
        }
        return indices;
    }
    StringExt.findIndices = findIndices;
    /**
     * A string matcher which uses a sum-of-squares algorithm.
     *
     * @param source - The source text which should be searched.
     *
     * @param query - The characters to locate in the source text.
     *
     * @param start - The index to start the search.
     *
     * @returns The match result, or `null` if there is no match.
     *   A lower `score` represents a stronger match.
     *
     * #### Complexity
     * Linear on `sourceText`.
     *
     * #### Notes
     * This scoring algorithm uses a sum-of-squares approach to determine
     * the score. In order for there to be a match, all of the characters
     * in `query` **must** appear in `source` in order. The index of each
     * matching character is squared and added to the score. This means
     * that early and consecutive character matches are preferred, while
     * late matches are heavily penalized.
     */
    function matchSumOfSquares(source, query, start) {
        if (start === void 0) { start = 0; }
        var indices = findIndices(source, query, start);
        if (!indices) {
            return null;
        }
        var score = 0;
        for (var i = 0, n = indices.length; i < n; ++i) {
            var j = indices[i] - start;
            score += j * j;
        }
        return { score: score, indices: indices };
    }
    StringExt.matchSumOfSquares = matchSumOfSquares;
    /**
     * A string matcher which uses a sum-of-deltas algorithm.
     *
     * @param source - The source text which should be searched.
     *
     * @param query - The characters to locate in the source text.
     *
     * @param start - The index to start the search.
     *
     * @returns The match result, or `null` if there is no match.
     *   A lower `score` represents a stronger match.
     *
     * #### Complexity
     * Linear on `sourceText`.
     *
     * #### Notes
     * This scoring algorithm uses a sum-of-deltas approach to determine
     * the score. In order for there to be a match, all of the characters
     * in `query` **must** appear in `source` in order. The delta between
     * the indices are summed to create the score. This means that groups
     * of matched characters are preferred, while fragmented matches are
     * penalized.
     */
    function matchSumOfDeltas(source, query, start) {
        if (start === void 0) { start = 0; }
        var indices = findIndices(source, query, start);
        if (!indices) {
            return null;
        }
        var score = 0;
        var last = start - 1;
        for (var i = 0, n = indices.length; i < n; ++i) {
            var j = indices[i];
            score += j - last - 1;
            last = j;
        }
        return { score: score, indices: indices };
    }
    StringExt.matchSumOfDeltas = matchSumOfDeltas;
    /**
     * Highlight the matched characters of a source text.
     *
     * @param source - The text which should be highlighted.
     *
     * @param indices - The indices of the matched characters. They must
     *   appear in increasing order and must be in bounds of the source.
     *
     * @param fn - The function to apply to the matched chunks.
     *
     * @returns An array of unmatched and highlighted chunks.
     */
    function highlight(source, indices, fn) {
        // Set up the result array.
        var result = [];
        // Set up the counter variables.
        var k = 0;
        var last = 0;
        var n = indices.length;
        // Iterator over each index.
        while (k < n) {
            // Set up the chunk indices.
            var i = indices[k];
            var j = indices[k];
            // Advance the right chunk index until it's non-contiguous.
            while (++k < n && indices[k] === j + 1) {
                j++;
            }
            // Extract the unmatched text.
            if (last < i) {
                result.push(source.slice(last, i));
            }
            // Extract and highlight the matched text.
            if (i < j + 1) {
                result.push(fn(source.slice(i, j + 1)));
            }
            // Update the last visited index.
            last = j + 1;
        }
        // Extract any remaining unmatched text.
        if (last < source.length) {
            result.push(source.slice(last));
        }
        // Return the highlighted result.
        return result;
    }
    StringExt.highlight = highlight;
    /**
     * A 3-way string comparison function.
     *
     * @param a - The first string of interest.
     *
     * @param b - The second string of interest.
     *
     * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.
     */
    function cmp(a, b) {
        return a < b ? -1 : a > b ? 1 : 0;
    }
    StringExt.cmp = cmp;
})(StringExt || (StringExt = {}));

// Copyright (c) Jupyter Development Team.
/**
 * Take a fixed number of items from an iterable.
 *
 * @param object - The iterable or array-like object of interest.
 *
 * @param count - The number of items to take from the iterable.
 *
 * @returns An iterator which yields the specified number of items
 *   from the source iterable.
 *
 * #### Notes
 * The returned iterator will exhaust early if the source iterable
 * contains an insufficient number of items.
 */
function take(object, count) {
    return new TakeIterator(iter(object), count);
}
/**
 * An iterator which takes a fixed number of items from a source.
 */
var TakeIterator = /** @class */ (function () {
    /**
     * Construct a new take iterator.
     *
     * @param source - The iterator of interest.
     *
     * @param count - The number of items to take from the source.
     */
    function TakeIterator(source, count) {
        this._source = source;
        this._count = count;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    TakeIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    TakeIterator.prototype.clone = function () {
        return new TakeIterator(this._source.clone(), this._count);
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    TakeIterator.prototype.next = function () {
        if (this._count <= 0) {
            return undefined;
        }
        var value = this._source.next();
        if (value === undefined) {
            return undefined;
        }
        this._count--;
        return value;
    };
    return TakeIterator;
}());

// Copyright (c) Jupyter Development Team.
/**
 * Iterate several iterables in lockstep.
 *
 * @param objects - The iterable or array-like objects of interest.
 *
 * @returns An iterator which yields successive tuples of values where
 *   each value is taken in turn from the provided iterables. It will
 *   be as long as the shortest provided iterable.
 *
 * #### Example
 * ```typescript
 * import { zip, toArray } from '@lumino/algorithm';
 *
 * let data1 = [1, 2, 3];
 * let data2 = [4, 5, 6];
 *
 * let stream = zip(data1, data2);
 *
 * toArray(stream);  // [[1, 4], [2, 5], [3, 6]]
 * ```
 */
function zip() {
    var objects = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        objects[_i] = arguments[_i];
    }
    return new ZipIterator(objects.map(iter));
}
/**
 * An iterator which iterates several sources in lockstep.
 */
var ZipIterator = /** @class */ (function () {
    /**
     * Construct a new zip iterator.
     *
     * @param source - The iterators of interest.
     */
    function ZipIterator(source) {
        this._source = source;
    }
    /**
     * Get an iterator over the object's values.
     *
     * @returns An iterator which yields the object's values.
     */
    ZipIterator.prototype.iter = function () {
        return this;
    };
    /**
     * Create an independent clone of the iterator.
     *
     * @returns A new independent clone of the iterator.
     */
    ZipIterator.prototype.clone = function () {
        return new ZipIterator(this._source.map(function (it) { return it.clone(); }));
    };
    /**
     * Get the next value from the iterator.
     *
     * @returns The next value from the iterator, or `undefined`.
     */
    ZipIterator.prototype.next = function () {
        var result = new Array(this._source.length);
        for (var i = 0, n = this._source.length; i < n; ++i) {
            var value = this._source[i].next();
            if (value === undefined) {
                return undefined;
            }
            result[i] = value;
        }
        return result;
    };
    return ZipIterator;
}());


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/domutils/dist/index.es6.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2019, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for clipboard related functionality.
 */
var ClipboardExt;
(function (ClipboardExt) {
    /**
     * Copy text to the system clipboard.
     *
     * @param text - The text to copy to the clipboard.
     */
    function copyText(text) {
        // Fetch the document body.
        var body = document.body;
        // Set up the clipboard event listener.
        var handler = function (event) {
            // Stop the event propagation.
            event.preventDefault();
            event.stopPropagation();
            // Set the clipboard data.
            event.clipboardData.setData('text', text);
            // Remove the event listener.
            body.removeEventListener('copy', handler, true);
        };
        // Add the event listener.
        body.addEventListener('copy', handler, true);
        // Trigger the event.
        document.execCommand('copy');
    }
    ClipboardExt.copyText = copyText;
})(ClipboardExt || (ClipboardExt = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for element related utilities.
 */
var ElementExt;
(function (ElementExt) {
    /**
     * Compute the box sizing for an element.
     *
     * @param element - The element of interest.
     *
     * @returns The box sizing data for the specified element.
     */
    function boxSizing(element) {
        var style = window.getComputedStyle(element);
        var bt = parseFloat(style.borderTopWidth) || 0;
        var bl = parseFloat(style.borderLeftWidth) || 0;
        var br = parseFloat(style.borderRightWidth) || 0;
        var bb = parseFloat(style.borderBottomWidth) || 0;
        var pt = parseFloat(style.paddingTop) || 0;
        var pl = parseFloat(style.paddingLeft) || 0;
        var pr = parseFloat(style.paddingRight) || 0;
        var pb = parseFloat(style.paddingBottom) || 0;
        var hs = bl + pl + pr + br;
        var vs = bt + pt + pb + bb;
        return {
            borderTop: bt,
            borderLeft: bl,
            borderRight: br,
            borderBottom: bb,
            paddingTop: pt,
            paddingLeft: pl,
            paddingRight: pr,
            paddingBottom: pb,
            horizontalSum: hs,
            verticalSum: vs
        };
    }
    ElementExt.boxSizing = boxSizing;
    /**
     * Compute the size limits for an element.
     *
     * @param element - The element of interest.
     *
     * @returns The size limit data for the specified element.
     */
    function sizeLimits(element) {
        var style = window.getComputedStyle(element);
        var minWidth = parseFloat(style.minWidth) || 0;
        var minHeight = parseFloat(style.minHeight) || 0;
        var maxWidth = parseFloat(style.maxWidth) || Infinity;
        var maxHeight = parseFloat(style.maxHeight) || Infinity;
        maxWidth = Math.max(minWidth, maxWidth);
        maxHeight = Math.max(minHeight, maxHeight);
        return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };
    }
    ElementExt.sizeLimits = sizeLimits;
    /**
     * Test whether a client position lies within an element.
     *
     * @param element - The DOM element of interest.
     *
     * @param clientX - The client X coordinate of interest.
     *
     * @param clientY - The client Y coordinate of interest.
     *
     * @returns Whether the point is within the given element.
     */
    function hitTest(element, clientX, clientY) {
        var rect = element.getBoundingClientRect();
        return (clientX >= rect.left &&
            clientX < rect.right &&
            clientY >= rect.top &&
            clientY < rect.bottom);
    }
    ElementExt.hitTest = hitTest;
    /**
     * Vertically scroll an element into view if needed.
     *
     * @param area - The scroll area element.
     *
     * @param element - The element of interest.
     *
     * #### Notes
     * This follows the "nearest" behavior of the native `scrollIntoView`
     * method, which is not supported by all browsers.
     * https://drafts.csswg.org/cssom-view/#element-scrolling-members
     *
     * If the element fully covers the visible area or is fully contained
     * within the visible area, no scrolling will take place. Otherwise,
     * the nearest edges of the area and element are aligned.
     */
    function scrollIntoViewIfNeeded(area, element) {
        var ar = area.getBoundingClientRect();
        var er = element.getBoundingClientRect();
        if (er.top <= ar.top && er.bottom >= ar.bottom) {
            return;
        }
        if (er.top < ar.top && er.height <= ar.height) {
            area.scrollTop -= ar.top - er.top;
            return;
        }
        if (er.bottom > ar.bottom && er.height >= ar.height) {
            area.scrollTop -= ar.top - er.top;
            return;
        }
        if (er.top < ar.top && er.height > ar.height) {
            area.scrollTop -= ar.bottom - er.bottom;
            return;
        }
        if (er.bottom > ar.bottom && er.height < ar.height) {
            area.scrollTop -= ar.bottom - er.bottom;
            return;
        }
    }
    ElementExt.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
})(ElementExt || (ElementExt = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for platform related utilities.
 */
var Platform;
(function (Platform) {
    /**
     * A flag indicating whether the platform is Mac.
     */
    Platform.IS_MAC = !!navigator.platform.match(/Mac/i);
    /**
     * A flag indicating whether the platform is Windows.
     */
    Platform.IS_WIN = !!navigator.platform.match(/Win/i);
    /**
     * A flag indicating whether the browser is IE.
     */
    Platform.IS_IE = /Trident/.test(navigator.userAgent);
    /**
     * A flag indicating whether the browser is Edge.
     */
    Platform.IS_EDGE = /Edge/.test(navigator.userAgent);
    /**
     * Test whether the `accel` key is pressed.
     *
     * @param event - The keyboard or mouse event of interest.
     *
     * @returns Whether the `accel` key is pressed.
     *
     * #### Notes
     * On Mac the `accel` key is the command key. On all other
     * platforms the `accel` key is the control key.
     */
    function accelKey(event) {
        return Platform.IS_MAC ? event.metaKey : event.ctrlKey;
    }
    Platform.accelKey = accelKey;
})(Platform || (Platform = {}));

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * The namespace for selector related utilities.
 */
var Selector;
(function (Selector) {
    /**
     * Calculate the specificity of a single CSS selector.
     *
     * @param selector - The CSS selector of interest.
     *
     * @returns The specificity of the selector.
     *
     * #### Undefined Behavior
     * The selector is invalid.
     *
     * #### Notes
     * This is based on https://www.w3.org/TR/css3-selectors/#specificity
     *
     * A larger number represents a more specific selector.
     *
     * The smallest possible specificity is `0`.
     *
     * The result is represented as a hex number `0x<aa><bb><cc>` where
     * each component is the count of the respective selector clause.
     *
     * If the selector contains commas, only the first clause is used.
     *
     * The computed result is cached, so subsequent calculations for the
     * same selector are extremely fast.
     */
    function calculateSpecificity(selector) {
        if (selector in dist_index_es6_Private.specificityCache) {
            return dist_index_es6_Private.specificityCache[selector];
        }
        var result = dist_index_es6_Private.calculateSingle(selector);
        return (dist_index_es6_Private.specificityCache[selector] = result);
    }
    Selector.calculateSpecificity = calculateSpecificity;
    /**
     * Test whether a selector is a valid CSS selector.
     *
     * @param selector - The CSS selector of interest.
     *
     * @returns `true` if the selector is valid, `false` otherwise.
     *
     * #### Notes
     * The computed result is cached, so subsequent tests for the same
     * selector are extremely fast.
     */
    function isValid(selector) {
        if (selector in dist_index_es6_Private.validityCache) {
            return dist_index_es6_Private.validityCache[selector];
        }
        var result = true;
        try {
            dist_index_es6_Private.testElem.querySelector(selector);
        }
        catch (err) {
            result = false;
        }
        return (dist_index_es6_Private.validityCache[selector] = result);
    }
    Selector.isValid = isValid;
    /**
     * Test whether an element matches a CSS selector.
     *
     * @param element - The element of interest.
     *
     * @param selector - The valid CSS selector of interest.
     *
     * @returns `true` if the element is a match, `false` otherwise.
     *
     * #### Notes
     * This function uses the builtin browser capabilities when possible,
     * falling back onto a document query otherwise.
     */
    function matches(element, selector) {
        return dist_index_es6_Private.protoMatchFunc.call(element, selector);
    }
    Selector.matches = matches;
})(Selector || (Selector = {}));
/**
 * The namespace for the module implementation details.
 */
var dist_index_es6_Private;
(function (Private) {
    /**
     * A cache of computed selector specificity values.
     */
    Private.specificityCache = Object.create(null);
    /**
     * A cache of computed selector validity.
     */
    Private.validityCache = Object.create(null);
    /**
     * An empty element for testing selector validity.
     */
    Private.testElem = document.createElement('div');
    /**
     * A cross-browser CSS selector matching prototype function.
     */
    Private.protoMatchFunc = (function () {
        var proto = Element.prototype;
        return (proto.matches ||
            proto.matchesSelector ||
            proto.mozMatchesSelector ||
            proto.msMatchesSelector ||
            proto.oMatchesSelector ||
            proto.webkitMatchesSelector ||
            function (selector) {
                var elem = this;
                var matches = elem.ownerDocument
                    ? elem.ownerDocument.querySelectorAll(selector)
                    : [];
                return Array.prototype.indexOf.call(matches, elem) !== -1;
            });
    })();
    /**
     * Calculate the specificity of a single selector.
     *
     * The behavior is undefined if the selector is invalid.
     */
    function calculateSingle(selector) {
        // Ignore anything after the first comma.
        selector = selector.split(',', 1)[0];
        // Setup the aggregate counters.
        var a = 0;
        var b = 0;
        var c = 0;
        // Apply a regex to the front of the selector. If it succeeds, that
        // portion of the selector is removed. Returns a success/fail flag.
        function match(re) {
            var match = selector.match(re);
            if (match === null) {
                return false;
            }
            selector = selector.slice(match[0].length);
            return true;
        }
        // Replace the negation pseudo-class (which is ignored),
        // but keep its inner content (which is not ignored).
        selector = selector.replace(NEGATION_RE, ' $1 ');
        // Continue matching until the selector is consumed.
        while (selector.length > 0) {
            // Match an ID selector.
            if (match(ID_RE)) {
                a++;
                continue;
            }
            // Match a class selector.
            if (match(CLASS_RE)) {
                b++;
                continue;
            }
            // Match an attribute selector.
            if (match(ATTR_RE)) {
                b++;
                continue;
            }
            // Match a pseudo-element selector. This is done before matching
            // a pseudo-class since this regex overlaps with that regex.
            if (match(PSEUDO_ELEM_RE)) {
                c++;
                continue;
            }
            // Match a pseudo-class selector.
            if (match(PSEDUO_CLASS_RE)) {
                b++;
                continue;
            }
            // Match a plain type selector.
            if (match(TYPE_RE)) {
                c++;
                continue;
            }
            // Finally, match any ignored characters.
            if (match(IGNORE_RE)) {
                continue;
            }
            // At this point, the selector is assumed to be invalid.
            return 0;
        }
        // Clamp each component to a reasonable base.
        a = Math.min(a, 0xff);
        b = Math.min(b, 0xff);
        c = Math.min(c, 0xff);
        // Combine the components into a single result.
        return (a << 16) | (b << 8) | c;
    }
    Private.calculateSingle = calculateSingle;
    /**
     * A regex which matches an ID selector at string start.
     */
    var ID_RE = /^#[^\s\+>~#\.\[:]+/;
    /**
     * A regex which matches a class selector at string start.
     */
    var CLASS_RE = /^\.[^\s\+>~#\.\[:]+/;
    /**
     * A regex which matches an attribute selector at string start.
     */
    var ATTR_RE = /^\[[^\]]+\]/;
    /**
     * A regex which matches a type selector at string start.
     */
    var TYPE_RE = /^[^\s\+>~#\.\[:]+/;
    /**
     * A regex which matches a pseudo-element selector at string start.
     */
    var PSEUDO_ELEM_RE = /^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/;
    /**
     * A regex which matches a pseudo-class selector at string start.
     */
    var PSEDUO_CLASS_RE = /^:[^\s\+>~#\.\[:]+/;
    /**
     * A regex which matches ignored characters at string start.
     */
    var IGNORE_RE = /^[\s\+>~\*]+/;
    /**
     * A regex which matches the negation pseudo-class globally.
     */
    var NEGATION_RE = /:not\(([^\)]+)\)/g;
})(dist_index_es6_Private || (dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/collections/dist/index.es6.js


// Copyright (c) Jupyter Development Team.
/**
 * A generic B+ tree.
 *
 * #### Notes
 * Most operations have `O(log32 n)` or better complexity.
 */
var index_es6_BPlusTree = /** @class */ (function () {
    /**
     * Construct a new B+ tree.
     *
     * @param cmp - The item comparison function for the tree.
     */
    function BPlusTree(cmp) {
        this._root = new Private$1.LeafNode();
        this.cmp = cmp;
    }
    Object.defineProperty(BPlusTree.prototype, "isEmpty", {
        /**
         * Whether the tree is empty.
         *
         * #### Complexity
         * `O(1)`
         */
        get: function () {
            return this._root.size === 0;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BPlusTree.prototype, "size", {
        /**
         * The size of the tree.
         *
         * #### Complexity
         * `O(1)`
         */
        get: function () {
            return this._root.size;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BPlusTree.prototype, "first", {
        /**
         * The first item in the tree.
         *
         * This is `undefined` if the tree is empty.
         *
         * #### Complexity
         * `O(log32 n)`
         */
        get: function () {
            var node = Private$1.firstLeaf(this._root);
            return node.size > 0 ? node.items[0] : undefined;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BPlusTree.prototype, "last", {
        /**
         * The last item in the tree.
         *
         * This is `undefined` if the tree is empty.
         *
         * #### Complexity
         * `O(log32 n)`
         */
        get: function () {
            var node = Private$1.lastLeaf(this._root);
            return node.size > 0 ? node.items[node.size - 1] : undefined;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the items in the tree.
     *
     * @returns A new iterator starting with the first item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.iter = function () {
        return Private$1.iterItems(this._root);
    };
    /**
     * Create a reverse iterator over the items in the tree.
     *
     * @returns A new iterator starting with the last item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.retro = function () {
        return Private$1.retroItems(this._root);
    };
    /**
     * Create an iterator for a slice of items in the tree.
     *
     * @param start - The index of the first item, inclusive. This
     *   should be `< stop`. Negative values are taken as an offset
     *   from the end of the tree. The default is `0`.
     *
     * @param stop - The index of the last item, exclusive. This
     *   should be `> start`. Negative values are taken as an offset
     *   from the end of the tree. The default is `size`.
     *
     * @returns A new iterator starting with the specified item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.slice = function (start, stop) {
        return Private$1.sliceItems(this._root, start, stop);
    };
    /**
     * Create a reverse iterator for a slice of items in the tree.
     *
     * @param start - The index of the first item, inclusive. This
     *   should be `> stop`. Negative values are taken as an offset
     *   from the end of the tree. The default is `size - 1`.
     *
     * @param stop - The index of the last item, exclusive. This
     *   should be `< start`. Negative values are taken as an offset
     *   from the end of the tree. The default is `-size - 1`.
     *
     * @returns A new reverse iterator starting with the specified item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.retroSlice = function (start, stop) {
        return Private$1.retroSliceItems(this._root, start, stop);
    };
    /**
     * Get the item at a particular index.
     *
     * @param index - The index of the item of interest. Negative
     *   values are taken as an offset from the end of the tree.
     *
     * @returns The item at the specified index, or `undefined` if
     *   the index is out of range.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.at = function (index) {
        return Private$1.itemAt(this._root, index);
    };
    /**
     * Test whether the tree has an item which matches a key.
     *
     * @param key - The key of interest.
     *
     * @param cmp - A function which compares an item against the key.
     *
     * @returns `true` if the tree has an item which matches the given
     *   key, `false` otherwise.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.has = function (key, cmp) {
        return Private$1.hasItem(this._root, key, cmp);
    };
    /**
     * Get the index of an item which matches a key.
     *
     * @param key - The key of interest.
     *
     * @param cmp - A function which compares an item against the key.
     *
     * @returns The index of the item which matches the given key. A
     *   negative value means that a matching item does not exist in
     *   the tree, but if one did it would reside at `-index - 1`.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.indexOf = function (key, cmp) {
        return Private$1.indexOf(this._root, key, cmp);
    };
    /**
     * Get the item which matches a key.
     *
     * @param item - The key of interest.
     *
     * @param cmp - A function which compares an item against the key.
     *
     * @returns The item which matches the given key, or `undefined` if
     *   the tree does not have a matching item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.get = function (key, cmp) {
        return Private$1.getItem(this._root, key, cmp);
    };
    /**
     * Assign new items to the tree, replacing all current items.
     *
     * @param items - The items to assign to the tree.
     *
     * #### Complexity
     * `O(n log32 n)`
     */
    BPlusTree.prototype.assign = function (items) {
        this.clear();
        this.update(items);
    };
    /**
     * Insert an item into the tree.
     *
     * @param item - The item of interest.
     *
     * @returns If the given item matches an existing item in the tree,
     *   the given item will replace it, and the existing item will be
     *   returned. Otherwise, this method returns `undefined`.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.insert = function (item) {
        var existing = Private$1.insertItem(this._root, item, this.cmp);
        this._root = Private$1.maybeSplitRoot(this._root);
        return existing;
    };
    /**
     * Update the tree with multiple items.
     *
     * @param items - The items to insert into the tree.
     *
     * #### Complexity
     * `O(k log32 n)`
     */
    BPlusTree.prototype.update = function (items) {
        var _this = this;
        each(items, function (item) {
            _this.insert(item);
        });
    };
    /**
     * Delete an item which matches a particular key.
     *
     * @param key - The key of interest.
     *
     * @param cmp - A function which compares an item against the key.
     *
     * @returns The item removed from the tree, or `undefined` if no
     *   item matched the given key.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.delete = function (key, cmp) {
        var item = Private$1.deleteItem(this._root, key, cmp);
        this._root = Private$1.maybeExtractRoot(this._root);
        return item;
    };
    /**
     * Remove an item at a particular index.
     *
     * @param index - The index of the item to remove. Negative
     *   values are taken as an offset from the end of the tree.
     *
     * @returns The item removed from the tree, or `undefined` if
     *   the given index is out of range.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    BPlusTree.prototype.remove = function (index) {
        var item = Private$1.removeItem(this._root, index);
        this._root = Private$1.maybeExtractRoot(this._root);
        return item;
    };
    /**
     * Clear the contents of the tree.
     *
     * #### Complexity
     * `O(n)`
     */
    BPlusTree.prototype.clear = function () {
        Private$1.clear(this._root);
        this._root = new Private$1.LeafNode();
    };
    return BPlusTree;
}());
/**
 * The namespace for the `BPlusTree` class statics.
 */
(function (BPlusTree) {
    /**
     * Create a new B+ tree populated with the given items.
     *
     * @param items - The items to add to the tree.
     *
     * @param cmp - The item comparison function for the tree.
     *
     * @returns A new B+ tree populated with the given items.
     *
     * #### Complexity
     * `O(n log32 n)`
     */
    function from(items, cmp) {
        var tree = new BPlusTree(cmp);
        tree.assign(items);
        return tree;
    }
    BPlusTree.from = from;
})(index_es6_BPlusTree || (index_es6_BPlusTree = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$1;
(function (Private) {
    /**
     * A branch node in a B+ tree.
     */
    var BranchNode = /** @class */ (function () {
        function BranchNode() {
            /**
             * The left-most item of each child subtree.
             */
            this.items = [];
            /**
             * The cumulative sizes of each child subtree.
             */
            this.sizes = [];
            /**
             * The child nodes of this branch node.
             */
            this.children = [];
        }
        Object.defineProperty(BranchNode.prototype, "type", {
            /**
             * The discriminated type of the node.
             */
            get: function () {
                return 0 /* Branch */;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(BranchNode.prototype, "size", {
            /**
             * The total number of items in the subtree.
             */
            get: function () {
                return this.sizes[this.sizes.length - 1];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(BranchNode.prototype, "width", {
            /**
             * The tree width of the node.
             */
            get: function () {
                return this.children.length;
            },
            enumerable: true,
            configurable: true
        });
        return BranchNode;
    }());
    Private.BranchNode = BranchNode;
    /**
     * A leaf node in a B+ tree.
     */
    var LeafNode = /** @class */ (function () {
        function LeafNode() {
            /**
             * The next sibling leaf node of this leaf node.
             */
            this.next = null;
            /**
             * The previous sibling leaf node of this leaf node.
             */
            this.prev = null;
            /**
             * The items of the leaf.
             */
            this.items = [];
        }
        Object.defineProperty(LeafNode.prototype, "type", {
            /**
             * The discriminated type of the node.
             */
            get: function () {
                return 1 /* Leaf */;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(LeafNode.prototype, "size", {
            /**
             * The total number of items in the leaf.
             */
            get: function () {
                return this.items.length;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(LeafNode.prototype, "width", {
            /**
             * The tree width of the node.
             */
            get: function () {
                return this.items.length;
            },
            enumerable: true,
            configurable: true
        });
        return LeafNode;
    }());
    Private.LeafNode = LeafNode;
    /**
     * Get the first leaf node in the tree.
     *
     * @param node - The root node of interest.
     *
     * @returns The first leaf node in the tree.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function firstLeaf(node) {
        while (node.type === 0 /* Branch */) {
            node = node.children[0];
        }
        return node;
    }
    Private.firstLeaf = firstLeaf;
    /**
     * Get the last leaf node in the tree.
     *
     * @param node - The root node of interest.
     *
     * @returns The last leaf node in the tree.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function lastLeaf(node) {
        while (node.type === 0 /* Branch */) {
            node = node.children[node.children.length - 1];
        }
        return node;
    }
    Private.lastLeaf = lastLeaf;
    /**
     * Create a forward iterator for the items in the tree.
     *
     * @param node - The root node of interest.
     *
     * @returns A new forward iterator starting with the first item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function iterItems(node) {
        var leaf = firstLeaf(node);
        return new ForwardIterator(leaf, 0, -1);
    }
    Private.iterItems = iterItems;
    /**
     * Create a reverse iterator for the items in the tree.
     *
     * @param node - The root node of interest.
     *
     * @returns A new reverse iterator starting with the last item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function retroItems(node) {
        var leaf = lastLeaf(node);
        return new RetroIterator(leaf, leaf.size - 1, -1);
    }
    Private.retroItems = retroItems;
    /**
     * Create an iterator for a slice of items in the tree.
     *
     * @param node - The root node of interest.
     *
     * @param start - The index of the first item, inclusive. This
     *   should be `< stop`. Negative values are taken as an offset
     *   from the end of the tree. The default is `0`.
     *
     * @param stop - The index of the last item, exclusive. This
     *   should be `> start`. Negative values are taken as an offset
     *   from the end of the tree. The default is `size`.
     *
     * @returns A new iterator starting with the specified item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function sliceItems(node, start, stop) {
        // Normalize the start index.
        if (start === undefined) {
            start = 0;
        }
        else if (start < 0) {
            start = Math.max(0, start + node.size);
        }
        else {
            start = Math.min(start, node.size);
        }
        // Normalize the stop index.
        if (stop === undefined) {
            stop = node.size;
        }
        else if (stop < 0) {
            stop = Math.max(0, stop + node.size);
        }
        else {
            stop = Math.min(stop, node.size);
        }
        // Compute effective count.
        var count = Math.max(0, stop - start);
        // Bail early if there is nothing to iterate.
        if (count === 0) {
            return empty();
        }
        // Find the starting leaf node and local index.
        while (node.type === 0 /* Branch */) {
            var i = findPivotIndexByIndex(node.sizes, start);
            if (i > 0)
                start -= node.sizes[i - 1];
            node = node.children[i];
        }
        // Return the forward iterator for the range.
        return new ForwardIterator(node, start, count);
    }
    Private.sliceItems = sliceItems;
    /**
     * Create a reverse iterator for a slice of items in the tree.
     *
     * @param node - The root node of interest.
     *
     * @param start - The index of the first item, inclusive. This
     *   should be `> stop`. Negative values are taken as an offset
     *   from the end of the tree. The default is `size - 1`.
     *
     * @param stop - The index of the last item, exclusive. This
     *   should be `< start`. Negative values are taken as an offset
     *   from the end of the tree. The default is `-size - 1`.
     *
     * @returns A new reverse iterator starting with the specified item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function retroSliceItems(node, start, stop) {
        // Normalize the start index.
        if (start === undefined) {
            start = node.size - 1;
        }
        else if (start < 0) {
            start = Math.max(-1, start + node.size);
        }
        else {
            start = Math.min(start, node.size - 1);
        }
        // Normalize the stop index.
        if (stop === undefined) {
            stop = -1;
        }
        else if (stop < 0) {
            stop = Math.max(-1, stop + node.size);
        }
        else {
            stop = Math.min(stop, node.size - 1);
        }
        // Compute the effective count.
        var count = Math.max(0, start - stop);
        // Bail early if there is nothing to iterate.
        if (count === 0) {
            return empty();
        }
        // Find the starting leaf node and local index.
        while (node.type === 0 /* Branch */) {
            var i = findPivotIndexByIndex(node.sizes, start);
            if (i > 0)
                start -= node.sizes[i - 1];
            node = node.children[i];
        }
        // Return the retro iterator for the range.
        return new RetroIterator(node, start, count);
    }
    Private.retroSliceItems = retroSliceItems;
    /**
     * Get the item at the specified index.
     *
     * @param node - The root node of interest.
     *
     * @param index - The index of the item of interest. Negative
     *   values are taken as an offset from the end of the tree.
     *
     * @returns The item at the specified index, or `undefined` if
     *   the index is out of range.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function itemAt(node, index) {
        // Wrap negative indices.
        if (index < 0) {
            index += node.size;
        }
        // Bail early if the index is out of range.
        if (index < 0 || index >= node.size) {
            return undefined;
        }
        // Find the containing leaf node and local index.
        while (node.type === 0 /* Branch */) {
            var i = findPivotIndexByIndex(node.sizes, index);
            if (i > 0)
                index -= node.sizes[i - 1];
            node = node.children[i];
        }
        // Return the item at the specified index.
        return node.items[index];
    }
    Private.itemAt = itemAt;
    /**
     * Test whether the tree contains an item which matches a key.
     *
     * @param node - The root node of interest.
     *
     * @param key - The key of interest.
     *
     * @param cmp - The key comparison function.
     *
     * @returns Whether the tree contains a matching item.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function hasItem(node, key, cmp) {
        // Find the containing leaf node.
        while (node.type === 0 /* Branch */) {
            var i_1 = findPivotIndexByKey(node.items, key, cmp);
            node = node.children[i_1];
        }
        // Find the key index.
        var i = findKeyIndex(node.items, key, cmp);
        // Return whether or not the node contains a matching item.
        return i >= 0;
    }
    Private.hasItem = hasItem;
    /**
     * Get the index of the item which matches a key.
     *
     * @param node - The node of interest.
     *
     * @param key - The key of interest.
     *
     * @param cmp - The key comparison function.
     *
     * @returns The index of the item which matches the given key. A
     *   negative value means that a matching item does not exist in
     *   the tree, but if one did it would reside at `-index - 1`.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function indexOf(node, key, cmp) {
        // Set up the global index.
        var index = 0;
        // Find the containing leaf node and global index.
        while (node.type === 0 /* Branch */) {
            var i_2 = findPivotIndexByKey(node.items, key, cmp);
            if (i_2 > 0)
                index += node.sizes[i_2 - 1];
            node = node.children[i_2];
        }
        // Find the key index.
        var i = findKeyIndex(node.items, key, cmp);
        // Return the final computed index.
        return i >= 0 ? index + i : -index + i;
    }
    Private.indexOf = indexOf;
    /**
     * Get the item for a particular key.
     *
     * @param node - The node of interest.
     *
     * @param key - The key of interest.
     *
     * @param cmp - The key comparison function.
     *
     * @returns The item for the specified key, or `undefined` if
     *   the tree does not have a matching item for the key.
     *
     * #### Complexity
     * `O(log32 n)`
     */
    function getItem(node, key, cmp) {
        // Find the containing leaf node.
        while (node.type === 0 /* Branch */) {
            var i_3 = findPivotIndexByKey(node.items, key, cmp);
            node = node.children[i_3];
        }
        // Find the key index.
        var i = findKeyIndex(node.items, key, cmp);
        // Return the item for the given key.
        return i >= 0 ? node.items[i] : undefined;
    }
    Private.getItem = getItem;
    /**
     * Insert an item into the tree.
     *
     * @param node - The root node of interest.
     *
     * @param item - The item of interest.
     *
     * @param cmp - The item comparison function.
     *
     * @returns If the given item matches an existing item in the tree,
     *   the given item will replace it, and the existing item will be
     *   returned. Otherwise, this function returns `undefined`.
     *
     * #### Complexity
     * `O(log32 n)`
     *
     * #### Notes
     * The root may be overfull after calling this function.
     */
    function insertItem(node, item, cmp) {
        // Handle leaf nodes first.
        if (node.type === 1 /* Leaf */) {
            // Find the index for the given item.
            var i_4 = findKeyIndex(node.items, item, cmp);
            // Fetch the existing item and insert the new item.
            var existing_1;
            if (i_4 >= 0) {
                existing_1 = node.items[i_4];
                node.items[i_4] = item;
            }
            else {
                existing_1 = undefined;
                ArrayExt.insert(node.items, -i_4 - 1, item);
            }
            // Return the existing item.
            return existing_1;
        }
        // Find the pivot index for the insert.
        var i = findPivotIndexByKey(node.items, item, cmp);
        // Fetch the pivot child.
        var child = node.children[i];
        // Fetch the current size of the child.
        var prevSize = child.size;
        // Recursively insert the item into the child.
        var existing = insertItem(child, item, cmp);
        // Fetch the updated size of the child.
        var currSize = child.size;
        // Update the item state of the branch.
        node.items[i] = child.items[0];
        // Bail early if the child size did not change.
        if (prevSize === currSize) {
            return existing;
        }
        // Split the child if it's overfull.
        if (child.width > MAX_NODE_WIDTH) {
            var next = splitNode(child);
            ArrayExt.insert(node.children, i + 1, next);
            ArrayExt.insert(node.items, i + 1, next.items[0]);
        }
        // Update the dirty sizes of the branch.
        updateSizes(node, i);
        // Return the existing item.
        return existing;
    }
    Private.insertItem = insertItem;
    /**
     * Delete an item in the tree.
     *
     * @param node - The node of interest.
     *
     * @param key - The key of interest.
     *
     * @param cmp - The key comparison function.
     *
     * @returns The deleted item or `undefined`.
     *
     * #### Complexity
     * `O(log32 n)`
     *
     * #### Notes
     * The root may be underfull after calling this function.
     */
    function deleteItem(node, key, cmp) {
        // Handle leaf nodes first.
        if (node.type === 1 /* Leaf */) {
            // Find the index for the given key.
            var i_5 = findKeyIndex(node.items, key, cmp);
            // Bail early if the item does not exist.
            if (i_5 < 0) {
                return undefined;
            }
            // Remove the item at the computed index.
            return ArrayExt.removeAt(node.items, i_5);
        }
        // Find the pivot index for the delete.
        var i = findPivotIndexByKey(node.items, key, cmp);
        // Fetch the pivot child.
        var child = node.children[i];
        // Fetch the current size of the child.
        var prevSize = child.size;
        // Recursively remove the item from the child.
        var item = deleteItem(child, key, cmp);
        // Fetch the updated size of the child.
        var currSize = child.size;
        // Bail early if the child size did not change.
        if (prevSize === currSize) {
            return item;
        }
        // Update the item state of the branch.
        node.items[i] = child.items[0];
        // Join the child if it's underfull.
        if (child.width < MIN_NODE_WIDTH) {
            i = joinChild(node, i);
        }
        // Update the dirty sizes of the branch.
        updateSizes(node, i);
        // Return the deleted item.
        return item;
    }
    Private.deleteItem = deleteItem;
    /**
     * Remove an item from the tree.
     *
     * @param node - The node of interest.
     *
     * @param index - The index of interest.
     *
     * @returns The removed item or `undefined`.
     *
     * #### Complexity
     * `O(log32 n)`
     *
     * #### Notes
     * The root may be underfull after calling this function.
     */
    function removeItem(node, index) {
        // Wrap negative indices.
        if (index < 0) {
            index += node.size;
        }
        // Bail early if the index is out of range.
        if (index < 0 || index >= node.size) {
            return undefined;
        }
        // Handle leaf nodes first.
        if (node.type === 1 /* Leaf */) {
            return ArrayExt.removeAt(node.items, index);
        }
        // Find the pivot index for the remove.
        var i = findPivotIndexByIndex(node.sizes, index);
        if (i > 0)
            index -= node.sizes[i];
        // Fetch the pivot child.
        var child = node.children[i];
        // Recursively remove the item from the child.
        var item = removeItem(child, index);
        // Update the item state of the branch.
        node.items[i] = child.items[0];
        // Join the child if it's underfull.
        if (child.width < MIN_NODE_WIDTH) {
            i = joinChild(node, i);
        }
        // Update the dirty sizes of the branch.
        updateSizes(node, i);
        // Return the removed item.
        return item;
    }
    Private.removeItem = removeItem;
    /**
     * Recursively clear the contents of a node.
     *
     * @param node - The node of interest.
     *
     * #### Complexity
     * `O(n)`
     */
    function clear(node) {
        if (node.type === 0 /* Branch */) {
            each(node.children, clear);
            node.children.length = 0;
            node.sizes.length = 0;
            node.items.length = 0;
        }
        else {
            node.items.length = 0;
            node.next = null;
            node.prev = null;
        }
    }
    Private.clear = clear;
    /**
     * Split a root node and create a new root, if needed.
     *
     * @param node - The root node of interest.
     *
     * @returns The new root node.
     */
    function maybeSplitRoot(node) {
        // Bail early if the current root is not overfull.
        if (node.width <= MAX_NODE_WIDTH) {
            return node;
        }
        // Create a new root branch node.
        var root = new BranchNode();
        // Split the node to the right and create a new sibling.
        var next = splitNode(node);
        // Add the sizes to the root.
        root.sizes[0] = node.size;
        root.sizes[1] = node.size + next.size;
        // Add the children to the root.
        root.children[0] = node;
        root.children[1] = next;
        // Add the items to the root.
        root.items[0] = node.items[0];
        root.items[1] = next.items[0];
        // Return the new root node.
        return root;
    }
    Private.maybeSplitRoot = maybeSplitRoot;
    /**
     * Extract a single node child as a new root, if needed.
     *
     * @param node - The root node of interest.
     *
     * @returns The new root node.
     */
    function maybeExtractRoot(node) {
        // Bail early if the node it already a leaf.
        if (node.type === 1 /* Leaf */) {
            return node;
        }
        // Bail early if the branch has more than one child.
        if (node.children.length > 1) {
            return node;
        }
        // Extract the sole remaining child as the new root.
        var root = node.children.pop();
        // Clear the rest of the node state.
        clear(node);
        // Return the new root.
        return root;
    }
    Private.maybeExtractRoot = maybeExtractRoot;
    /**
     * The maximum width for a node in the tree.
     */
    var MAX_NODE_WIDTH = 32;
    /**
     * The minimum width for a node in the tree.
     */
    var MIN_NODE_WIDTH = MAX_NODE_WIDTH >> 1;
    /**
     * A forward iterator for a B+ tree.
     */
    var ForwardIterator = /** @class */ (function () {
        /**
         * Construct a new forward iterator.
         *
         * @param node - The first leaf node in the chain.
         *
         * @param index - The local index of the first item.
         *
         * @param count - The number of items to iterate. A value `< 0`
         *   will iterate all available items.
         */
        function ForwardIterator(node, index, count) {
            this._node = node;
            this._index = index;
            this._count = count;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        ForwardIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        ForwardIterator.prototype.clone = function () {
            return new ForwardIterator(this._node, this._index, this._count);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        ForwardIterator.prototype.next = function () {
            if (this._node === null || this._count === 0) {
                return undefined;
            }
            if (this._index >= this._node.size) {
                this._node = this._node.next;
                this._index = 0;
                return this.next();
            }
            if (this._count > 0) {
                this._count--;
            }
            return this._node.items[this._index++];
        };
        return ForwardIterator;
    }());
    /**
     * A reverse iterator for a B+ tree.
     */
    var RetroIterator = /** @class */ (function () {
        /**
         * Construct a new retro iterator.
         *
         * @param node - The last leaf node in the chain.
         *
         * @param index - The local index of the last item.
         *
         * @param count - The number of items to iterate. A value `< 0`
         *   will iterate all available items.
         */
        function RetroIterator(node, index, count) {
            this._node = node;
            this._index = index;
            this._count = count;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        RetroIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        RetroIterator.prototype.clone = function () {
            return new RetroIterator(this._node, this._index, this._count);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        RetroIterator.prototype.next = function () {
            if (this._node === null || this._count === 0) {
                return undefined;
            }
            if (this._index >= this._node.size) {
                this._index = this._node.size - 1;
            }
            if (this._index < 0) {
                this._node = this._node.prev;
                this._index = this._node ? this._node.size - 1 : -1;
                return this.next();
            }
            if (this._count > 0) {
                this._count--;
            }
            return this._node.items[this._index--];
        };
        return RetroIterator;
    }());
    /**
     * Find the pivot index for a particular local index.
     */
    function findPivotIndexByIndex(sizes, index) {
        var n = sizes.length;
        for (var i = 0; i < n; ++i) {
            if (sizes[i] > index) {
                return i;
            }
        }
        return n - 1;
    }
    /**
     * Find the pivot index for a particular key.
     */
    function findPivotIndexByKey(items, key, cmp) {
        var n = items.length;
        for (var i = 1; i < n; ++i) {
            if (cmp(items[i], key) > 0) {
                return i - 1;
            }
        }
        return n - 1;
    }
    /**
     * Find the key index for a particular key.
     */
    function findKeyIndex(items, key, cmp) {
        var n = items.length;
        for (var i = 0; i < n; ++i) {
            var c = cmp(items[i], key);
            if (c === 0) {
                return i;
            }
            if (c > 0) {
                return -i - 1;
            }
        }
        return -n - 1;
    }
    /**
     * Update the sizes of a branch node starting at the given index.
     */
    function updateSizes(node, i) {
        var sizes = node.sizes, children = node.children;
        var last = i > 0 ? sizes[i - 1] : 0;
        for (var n = children.length; i < n; ++i) {
            last = sizes[i] = last + children[i].size;
        }
        sizes.length = children.length;
    }
    /**
     * Split a node and return its new next sibling.
     *
     * @param node - The node of interest.
     *
     * @returns The new next sibling node.
     */
    function splitNode(node) {
        // Handle leaf nodes first.
        if (node.type === 1 /* Leaf */) {
            // Create the new sibling leaf node.
            var next_1 = new LeafNode();
            // Move the items to the new sibling.
            var v1_1 = node.items;
            var v2_1 = next_1.items;
            for (var i = MIN_NODE_WIDTH, n = v1_1.length; i < n; ++i) {
                v2_1.push(v1_1[i]);
            }
            v1_1.length = MIN_NODE_WIDTH;
            // Patch up the sibling links.
            if (node.next)
                node.next.prev = next_1;
            next_1.next = node.next;
            next_1.prev = node;
            node.next = next_1;
            // Return the new next sibling.
            return next_1;
        }
        // Create the new sibling branch node.
        var next = new BranchNode();
        // Move the children to the new sibling.
        var c1 = node.children;
        var c2 = next.children;
        for (var i = MIN_NODE_WIDTH, n = c1.length; i < n; ++i) {
            c2.push(c1[i]);
        }
        c1.length = MIN_NODE_WIDTH;
        // Move the items to the new sibling.
        var v1 = node.items;
        var v2 = next.items;
        for (var i = MIN_NODE_WIDTH, n = v1.length; i < n; ++i) {
            v2.push(v1[i]);
        }
        v1.length = MIN_NODE_WIDTH;
        // Update the dirty sizes of the nodes.
        updateSizes(node, MIN_NODE_WIDTH);
        updateSizes(next, 0);
        // Return the new next sibling.
        return next;
    }
    /**
     * Join a child node of a branch with one of its siblings.
     *
     * @param node - The branch node of interest.
     *
     * @param i - The index of the child node of interest.
     *
     * @returns The first modified index.
     *
     * #### Notes
     * This may cause the branch to become underfull.
     */
    function joinChild(node, i) {
        var _a, _b, _c, _d, _e, _f;
        // Fetch the child to be joined.
        var child = node.children[i];
        // Fetch the relevant sibling.
        var sibling = i === 0 ? node.children[i + 1] : node.children[i - 1];
        // Compute the flags which control the join behavior.
        var hasNext = i === 0;
        var isLeaf = child.type === 1 /* Leaf */;
        var hasExtra = sibling.width > MIN_NODE_WIDTH;
        // Join case #1: steal from next sibling leaf
        if (isLeaf && hasExtra && hasNext) {
            // Cast the children as leaves.
            var c = child;
            var s = sibling;
            // Steal an item.
            c.items.push(s.items.shift());
            // Update the branch items.
            node.items[i + 1] = s.items[0];
            // Return the first modified index.
            return i;
        }
        // Join case #2: steal from previous sibling leaf
        if (isLeaf && hasExtra && !hasNext) {
            // Cast the children as leaves.
            var c = child;
            var s = sibling;
            // Steal an item.
            c.items.unshift(s.items.pop());
            // Update the branch items.
            node.items[i] = c.items[0];
            // Return the first modified index.
            return i - 1;
        }
        // Join case #3: merge with next sibling leaf
        if (isLeaf && !hasExtra && hasNext) {
            // Cast the children as leaves.
            var c = child;
            var s = sibling;
            // Merge items.
            (_a = s.items).unshift.apply(_a, c.items);
            // Remove the old branch child.
            ArrayExt.removeAt(node.children, i);
            // Remove the stale branch item.
            ArrayExt.removeAt(node.items, i + 1);
            // Patch up the sibling links.
            if (c.prev)
                c.prev.next = s;
            s.prev = c.prev;
            // Clear the original child.
            clear(c);
            // Return the first modified index.
            return i;
        }
        // Join case #4: merge with previous sibling leaf
        if (isLeaf && !hasExtra && !hasNext) {
            // Cast the children as leaves.
            var c = child;
            var s = sibling;
            // Merge items.
            (_b = s.items).push.apply(_b, c.items);
            // Remove the old branch child.
            ArrayExt.removeAt(node.children, i);
            // Remove the stale branch item.
            ArrayExt.removeAt(node.items, i);
            // Patch up the sibling links.
            if (c.next)
                c.next.prev = s;
            s.next = c.next;
            // Clear the original child.
            clear(c);
            // Return the first modified index.
            return i - 1;
        }
        // Join case #5: steal from next sibling branch
        if (!isLeaf && hasExtra && hasNext) {
            // Cast the children to branches.
            var c = child;
            var s = sibling;
            // Steal a child from the next sibling.
            c.children.push(s.children.shift());
            // Steal an item from the next sibling.
            c.items.push(s.items.shift());
            // Update the branch items.
            node.items[i + 1] = s.items[0];
            // Update the sibling sizes.
            updateSizes(c, c.width - 1);
            updateSizes(s, 0);
            // Return the first modified index.
            return i;
        }
        // Join case #6: steal from previous sibling branch
        if (!isLeaf && hasExtra && !hasNext) {
            // Cast the children to branches.
            var c = child;
            var s = sibling;
            // Steal a child from the previous sibling.
            c.children.unshift(s.children.pop());
            // Steal an item from the previous sibling.
            c.items.unshift(s.items.pop());
            // Update the branch items.
            node.items[i] = c.items[0];
            // Update the sibling sizes.
            updateSizes(c, 0);
            updateSizes(s, s.width - 1);
            // Return the first modified index.
            return i - 1;
        }
        // Join case #7: merge with next sibling branch
        if (!isLeaf && !hasExtra && hasNext) {
            // Cast the children to branches.
            var c = child;
            var s = sibling;
            // Merge the children with the next sibling.
            (_c = s.children).unshift.apply(_c, c.children);
            // Merge the items with the next sibling.
            (_d = s.items).unshift.apply(_d, c.items);
            // Remove the old branch child.
            ArrayExt.removeAt(node.children, i);
            // Remove the stale branch item.
            ArrayExt.removeAt(node.items, i + 1);
            // Update the sibling sizes.
            updateSizes(s, 0);
            // Clear the original child but, not its children.
            c.children.length = 0;
            clear(c);
            // Return the first modified index.
            return i;
        }
        // Join case #8: merge with previous sibling branch
        if (!isLeaf && !hasExtra && !hasNext) {
            // Cast the children to branches.
            var c = child;
            var s = sibling;
            // Merge the children with the previous sibling.
            (_e = s.children).push.apply(_e, c.children);
            // Merge the items with the previous sibling.
            (_f = s.items).push.apply(_f, c.items);
            // Remove the old branch child.
            ArrayExt.removeAt(node.children, i);
            // Remove the stale branch item.
            ArrayExt.removeAt(node.items, i);
            // Update the sibling sizes.
            updateSizes(s, 0);
            // Clear the original child, but not its children.
            c.children.length = 0;
            clear(c);
            // Return the first modified index.
            return i - 1;
        }
        // One of the above cases must match.
        throw 'unreachable';
    }
})(Private$1 || (Private$1 = {}));

// Copyright (c) Jupyter Development Team.
/**
 * A generic doubly-linked list.
 */
var index_es6_LinkedList = /** @class */ (function () {
    function LinkedList() {
        this._first = null;
        this._last = null;
        this._size = 0;
    }
    Object.defineProperty(LinkedList.prototype, "isEmpty", {
        /**
         * Whether the list is empty.
         *
         * #### Complexity
         * Constant.
         */
        get: function () {
            return this._size === 0;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "size", {
        /**
         * The size of the list.
         *
         * #### Complexity
         * `O(1)`
         *
         * #### Notes
         * This is equivalent to `length`.
         */
        get: function () {
            return this._size;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "length", {
        /**
         * The length of the list.
         *
         * #### Complexity
         * Constant.
         *
         * #### Notes
         * This is equivalent to `size`.
         *
         * This property is deprecated.
         */
        get: function () {
            return this._size;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "first", {
        /**
         * The first value in the list.
         *
         * This is `undefined` if the list is empty.
         *
         * #### Complexity
         * Constant.
         */
        get: function () {
            return this._first ? this._first.value : undefined;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "last", {
        /**
         * The last value in the list.
         *
         * This is `undefined` if the list is empty.
         *
         * #### Complexity
         * Constant.
         */
        get: function () {
            return this._last ? this._last.value : undefined;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "firstNode", {
        /**
         * The first node in the list.
         *
         * This is `null` if the list is empty.
         *
         * #### Complexity
         * Constant.
         */
        get: function () {
            return this._first;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LinkedList.prototype, "lastNode", {
        /**
         * The last node in the list.
         *
         * This is `null` if the list is empty.
         *
         * #### Complexity
         * Constant.
         */
        get: function () {
            return this._last;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the values in the list.
     *
     * @returns A new iterator starting with the first value.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.iter = function () {
        return new LinkedList.ForwardValueIterator(this._first);
    };
    /**
     * Create a reverse iterator over the values in the list.
     *
     * @returns A new iterator starting with the last value.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.retro = function () {
        return new LinkedList.RetroValueIterator(this._last);
    };
    /**
     * Create an iterator over the nodes in the list.
     *
     * @returns A new iterator starting with the first node.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.nodes = function () {
        return new LinkedList.ForwardNodeIterator(this._first);
    };
    /**
     * Create a reverse iterator over the nodes in the list.
     *
     * @returns A new iterator starting with the last node.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.retroNodes = function () {
        return new LinkedList.RetroNodeIterator(this._last);
    };
    /**
     * Assign new values to the list, replacing all current values.
     *
     * @param values - The values to assign to the list.
     *
     * #### Complexity
     * Linear.
     */
    LinkedList.prototype.assign = function (values) {
        var _this = this;
        this.clear();
        each(values, function (value) {
            _this.addLast(value);
        });
    };
    /**
     * Add a value to the end of the list.
     *
     * @param value - The value to add to the end of the list.
     *
     * #### Complexity
     * Constant.
     *
     * #### Notes
     * This is equivalent to `addLast`.
     */
    LinkedList.prototype.push = function (value) {
        this.addLast(value);
    };
    /**
     * Remove and return the value at the end of the list.
     *
     * @returns The removed value, or `undefined` if the list is empty.
     *
     * #### Complexity
     * Constant.
     *
     * #### Notes
     * This is equivalent to `removeLast`.
     */
    LinkedList.prototype.pop = function () {
        return this.removeLast();
    };
    /**
     * Add a value to the beginning of the list.
     *
     * @param value - The value to add to the beginning of the list.
     *
     * #### Complexity
     * Constant.
     *
     * #### Notes
     * This is equivalent to `addFirst`.
     */
    LinkedList.prototype.shift = function (value) {
        this.addFirst(value);
    };
    /**
     * Remove and return the value at the beginning of the list.
     *
     * @returns The removed value, or `undefined` if the list is empty.
     *
     * #### Complexity
     * Constant.
     *
     * #### Notes
     * This is equivalent to `removeFirst`.
     */
    LinkedList.prototype.unshift = function () {
        return this.removeFirst();
    };
    /**
     * Add a value to the beginning of the list.
     *
     * @param value - The value to add to the beginning of the list.
     *
     * @returns The list node which holds the value.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.addFirst = function (value) {
        var node = new collections_dist_index_es6_Private.LinkedListNode(this, value);
        if (!this._first) {
            this._first = node;
            this._last = node;
        }
        else {
            node.next = this._first;
            this._first.prev = node;
            this._first = node;
        }
        this._size++;
        return node;
    };
    /**
     * Add a value to the end of the list.
     *
     * @param value - The value to add to the end of the list.
     *
     * @returns The list node which holds the value.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.addLast = function (value) {
        var node = new collections_dist_index_es6_Private.LinkedListNode(this, value);
        if (!this._last) {
            this._first = node;
            this._last = node;
        }
        else {
            node.prev = this._last;
            this._last.next = node;
            this._last = node;
        }
        this._size++;
        return node;
    };
    /**
     * Insert a value before a specific node in the list.
     *
     * @param value - The value to insert before the reference node.
     *
     * @param ref - The reference node of interest. If this is `null`,
     *   the value will be added to the beginning of the list.
     *
     * @returns The list node which holds the value.
     *
     * #### Notes
     * The reference node must be owned by the list.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.insertBefore = function (value, ref) {
        if (!ref || ref === this._first) {
            return this.addFirst(value);
        }
        if (!(ref instanceof collections_dist_index_es6_Private.LinkedListNode) || ref.list !== this) {
            throw new Error('Reference node is not owned by the list.');
        }
        var node = new collections_dist_index_es6_Private.LinkedListNode(this, value);
        var _ref = ref;
        var prev = _ref.prev;
        node.next = _ref;
        node.prev = prev;
        _ref.prev = node;
        prev.next = node;
        this._size++;
        return node;
    };
    /**
     * Insert a value after a specific node in the list.
     *
     * @param value - The value to insert after the reference node.
     *
     * @param ref - The reference node of interest. If this is `null`,
     *   the value will be added to the end of the list.
     *
     * @returns The list node which holds the value.
     *
     * #### Notes
     * The reference node must be owned by the list.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.insertAfter = function (value, ref) {
        if (!ref || ref === this._last) {
            return this.addLast(value);
        }
        if (!(ref instanceof collections_dist_index_es6_Private.LinkedListNode) || ref.list !== this) {
            throw new Error('Reference node is not owned by the list.');
        }
        var node = new collections_dist_index_es6_Private.LinkedListNode(this, value);
        var _ref = ref;
        var next = _ref.next;
        node.next = next;
        node.prev = _ref;
        _ref.next = node;
        next.prev = node;
        this._size++;
        return node;
    };
    /**
     * Remove and return the value at the beginning of the list.
     *
     * @returns The removed value, or `undefined` if the list is empty.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.removeFirst = function () {
        var node = this._first;
        if (!node) {
            return undefined;
        }
        if (node === this._last) {
            this._first = null;
            this._last = null;
        }
        else {
            this._first = node.next;
            this._first.prev = null;
        }
        node.list = null;
        node.next = null;
        node.prev = null;
        this._size--;
        return node.value;
    };
    /**
     * Remove and return the value at the end of the list.
     *
     * @returns The removed value, or `undefined` if the list is empty.
     *
     * #### Complexity
     * Constant.
     */
    LinkedList.prototype.removeLast = function () {
        var node = this._last;
        if (!node) {
            return undefined;
        }
        if (node === this._first) {
            this._first = null;
            this._last = null;
        }
        else {
            this._last = node.prev;
            this._last.next = null;
        }
        node.list = null;
        node.next = null;
        node.prev = null;
        this._size--;
        return node.value;
    };
    /**
     * Remove a specific node from the list.
     *
     * @param node - The node to remove from the list.
     *
     * #### Complexity
     * Constant.
     *
     * #### Notes
     * The node must be owned by the list.
     */
    LinkedList.prototype.removeNode = function (node) {
        if (!(node instanceof collections_dist_index_es6_Private.LinkedListNode) || node.list !== this) {
            throw new Error('Node is not owned by the list.');
        }
        var _node = node;
        if (_node === this._first && _node === this._last) {
            this._first = null;
            this._last = null;
        }
        else if (_node === this._first) {
            this._first = _node.next;
            this._first.prev = null;
        }
        else if (_node === this._last) {
            this._last = _node.prev;
            this._last.next = null;
        }
        else {
            _node.next.prev = _node.prev;
            _node.prev.next = _node.next;
        }
        _node.list = null;
        _node.next = null;
        _node.prev = null;
        this._size--;
    };
    /**
     * Remove all values from the list.
     *
     * #### Complexity
     * Linear.
     */
    LinkedList.prototype.clear = function () {
        var node = this._first;
        while (node) {
            var next = node.next;
            node.list = null;
            node.prev = null;
            node.next = null;
            node = next;
        }
        this._first = null;
        this._last = null;
        this._size = 0;
    };
    return LinkedList;
}());
/**
 * The namespace for the `LinkedList` class statics.
 */
(function (LinkedList) {
    /**
     * Create a linked list from an iterable of values.
     *
     * @param values - The iterable or array-like object of interest.
     *
     * @returns A new linked list initialized with the given values.
     *
     * #### Complexity
     * Linear.
     */
    function from(values) {
        var list = new LinkedList();
        list.assign(values);
        return list;
    }
    LinkedList.from = from;
    /**
     * A forward iterator for values in a linked list.
     */
    var ForwardValueIterator = /** @class */ (function () {
        /**
         * Construct a forward value iterator.
         *
         * @param node - The first node in the list.
         */
        function ForwardValueIterator(node) {
            this._node = node;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        ForwardValueIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        ForwardValueIterator.prototype.clone = function () {
            return new ForwardValueIterator(this._node);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        ForwardValueIterator.prototype.next = function () {
            if (!this._node) {
                return undefined;
            }
            var node = this._node;
            this._node = node.next;
            return node.value;
        };
        return ForwardValueIterator;
    }());
    LinkedList.ForwardValueIterator = ForwardValueIterator;
    /**
     * A reverse iterator for values in a linked list.
     */
    var RetroValueIterator = /** @class */ (function () {
        /**
         * Construct a retro value iterator.
         *
         * @param node - The last node in the list.
         */
        function RetroValueIterator(node) {
            this._node = node;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        RetroValueIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        RetroValueIterator.prototype.clone = function () {
            return new RetroValueIterator(this._node);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        RetroValueIterator.prototype.next = function () {
            if (!this._node) {
                return undefined;
            }
            var node = this._node;
            this._node = node.prev;
            return node.value;
        };
        return RetroValueIterator;
    }());
    LinkedList.RetroValueIterator = RetroValueIterator;
    /**
     * A forward iterator for nodes in a linked list.
     */
    var ForwardNodeIterator = /** @class */ (function () {
        /**
         * Construct a forward node iterator.
         *
         * @param node - The first node in the list.
         */
        function ForwardNodeIterator(node) {
            this._node = node;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        ForwardNodeIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        ForwardNodeIterator.prototype.clone = function () {
            return new ForwardNodeIterator(this._node);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        ForwardNodeIterator.prototype.next = function () {
            if (!this._node) {
                return undefined;
            }
            var node = this._node;
            this._node = node.next;
            return node;
        };
        return ForwardNodeIterator;
    }());
    LinkedList.ForwardNodeIterator = ForwardNodeIterator;
    /**
     * A reverse iterator for nodes in a linked list.
     */
    var RetroNodeIterator = /** @class */ (function () {
        /**
         * Construct a retro node iterator.
         *
         * @param node - The last node in the list.
         */
        function RetroNodeIterator(node) {
            this._node = node;
        }
        /**
         * Get an iterator over the object's values.
         *
         * @returns An iterator which yields the object's values.
         */
        RetroNodeIterator.prototype.iter = function () {
            return this;
        };
        /**
         * Create an independent clone of the iterator.
         *
         * @returns A new independent clone of the iterator.
         */
        RetroNodeIterator.prototype.clone = function () {
            return new RetroNodeIterator(this._node);
        };
        /**
         * Get the next value from the iterator.
         *
         * @returns The next value from the iterator, or `undefined`.
         */
        RetroNodeIterator.prototype.next = function () {
            if (!this._node) {
                return undefined;
            }
            var node = this._node;
            this._node = node.prev;
            return node;
        };
        return RetroNodeIterator;
    }());
    LinkedList.RetroNodeIterator = RetroNodeIterator;
})(index_es6_LinkedList || (index_es6_LinkedList = {}));
/**
 * The namespace for the module implementation details.
 */
var collections_dist_index_es6_Private;
(function (Private) {
    /**
     * The internal linked list node implementation.
     */
    var LinkedListNode = /** @class */ (function () {
        /**
         * Construct a new linked list node.
         *
         * @param list - The list which owns the node.
         *
         * @param value - The value for the link.
         */
        function LinkedListNode(list, value) {
            /**
             * The linked list which created and owns the node.
             */
            this.list = null;
            /**
             * The next node in the list.
             */
            this.next = null;
            /**
             * The previous node in the list.
             */
            this.prev = null;
            this.list = list;
            this.value = value;
        }
        return LinkedListNode;
    }());
    Private.LinkedListNode = LinkedListNode;
})(collections_dist_index_es6_Private || (collections_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/messaging/dist/index.es6.js



/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return extendStatics(d, b);
};

function index_es6_extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

/**
 * A message which can be delivered to a message handler.
 *
 * #### Notes
 * This class may be subclassed to create complex message types.
 */
var Message = /** @class */ (function () {
    /**
     * Construct a new message.
     *
     * @param type - The type of the message.
     */
    function Message(type) {
        this.type = type;
    }
    Object.defineProperty(Message.prototype, "isConflatable", {
        /**
         * Test whether the message is conflatable.
         *
         * #### Notes
         * Message conflation is an advanced topic. Most message types will
         * not make use of this feature.
         *
         * If a conflatable message is posted to a handler while another
         * conflatable message of the same `type` has already been posted
         * to the handler, the `conflate()` method of the existing message
         * will be invoked. If that method returns `true`, the new message
         * will not be enqueued. This allows messages to be compressed, so
         * that only a single instance of the message type is processed per
         * cycle, no matter how many times messages of that type are posted.
         *
         * Custom message types may reimplement this property.
         *
         * The default implementation is always `false`.
         */
        get: function () {
            return false;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Conflate this message with another message of the same `type`.
     *
     * @param other - A conflatable message of the same `type`.
     *
     * @returns `true` if the message was successfully conflated, or
     *   `false` otherwise.
     *
     * #### Notes
     * Message conflation is an advanced topic. Most message types will
     * not make use of this feature.
     *
     * This method is called automatically by the message loop when the
     * given message is posted to the handler paired with this message.
     * This message will already be enqueued and conflatable, and the
     * given message will have the same `type` and also be conflatable.
     *
     * This method should merge the state of the other message into this
     * message as needed so that when this message is finally delivered
     * to the handler, it receives the most up-to-date information.
     *
     * If this method returns `true`, it signals that the other message
     * was successfully conflated and that message will not be enqueued.
     *
     * If this method returns `false`, the other message will be enqueued
     * for normal delivery.
     *
     * Custom message types may reimplement this method.
     *
     * The default implementation always returns `false`.
     */
    Message.prototype.conflate = function (other) {
        return false;
    };
    return Message;
}());
/**
 * A convenience message class which conflates automatically.
 *
 * #### Notes
 * Message conflation is an advanced topic. Most user code will not
 * make use of this class.
 *
 * This message class is useful for creating message instances which
 * should be conflated, but which have no state other than `type`.
 *
 * If conflation of stateful messages is required, a custom `Message`
 * subclass should be created.
 */
var ConflatableMessage = /** @class */ (function (_super) {
    index_es6_extends(ConflatableMessage, _super);
    function ConflatableMessage() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(ConflatableMessage.prototype, "isConflatable", {
        /**
         * Test whether the message is conflatable.
         *
         * #### Notes
         * This property is always `true`.
         */
        get: function () {
            return true;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Conflate this message with another message of the same `type`.
     *
     * #### Notes
     * This method always returns `true`.
     */
    ConflatableMessage.prototype.conflate = function (other) {
        return true;
    };
    return ConflatableMessage;
}(Message));
/**
 * The namespace for the global singleton message loop.
 */
var index_es6_MessageLoop;
(function (MessageLoop) {
    /**
     * Send a message to a message handler to process immediately.
     *
     * @param handler - The handler which should process the message.
     *
     * @param msg - The message to deliver to the handler.
     *
     * #### Notes
     * The message will first be sent through any installed message hooks
     * for the handler. If the message passes all hooks, it will then be
     * delivered to the `processMessage` method of the handler.
     *
     * The message will not be conflated with pending posted messages.
     *
     * Exceptions in hooks and handlers will be caught and logged.
     */
    function sendMessage(handler, msg) {
        // Lookup the message hooks for the handler.
        var hooks = messageHooks.get(handler);
        // Handle the common case of no installed hooks.
        if (!hooks || hooks.length === 0) {
            invokeHandler(handler, msg);
            return;
        }
        // Invoke the message hooks starting with the newest first.
        var passed = every(retro(hooks), function (hook) {
            return hook ? invokeHook(hook, handler, msg) : true;
        });
        // Invoke the handler if the message passes all hooks.
        if (passed) {
            invokeHandler(handler, msg);
        }
    }
    MessageLoop.sendMessage = sendMessage;
    /**
     * Post a message to a message handler to process in the future.
     *
     * @param handler - The handler which should process the message.
     *
     * @param msg - The message to post to the handler.
     *
     * #### Notes
     * The message will be conflated with the pending posted messages for
     * the handler, if possible. If the message is not conflated, it will
     * be queued for normal delivery on the next cycle of the event loop.
     *
     * Exceptions in hooks and handlers will be caught and logged.
     */
    function postMessage(handler, msg) {
        // Handle the common case of a non-conflatable message.
        if (!msg.isConflatable) {
            enqueueMessage(handler, msg);
            return;
        }
        // Conflate the message with an existing message if possible.
        var conflated = some(messageQueue, function (posted) {
            if (posted.handler !== handler) {
                return false;
            }
            if (!posted.msg) {
                return false;
            }
            if (posted.msg.type !== msg.type) {
                return false;
            }
            if (!posted.msg.isConflatable) {
                return false;
            }
            return posted.msg.conflate(msg);
        });
        // Enqueue the message if it was not conflated.
        if (!conflated) {
            enqueueMessage(handler, msg);
        }
    }
    MessageLoop.postMessage = postMessage;
    /**
     * Install a message hook for a message handler.
     *
     * @param handler - The message handler of interest.
     *
     * @param hook - The message hook to install.
     *
     * #### Notes
     * A message hook is invoked before a message is delivered to the
     * handler. If the hook returns `false`, no other hooks will be
     * invoked and the message will not be delivered to the handler.
     *
     * The most recently installed message hook is executed first.
     *
     * If the hook is already installed, this is a no-op.
     */
    function installMessageHook(handler, hook) {
        // Lookup the hooks for the handler.
        var hooks = messageHooks.get(handler);
        // Bail early if the hook is already installed.
        if (hooks && hooks.indexOf(hook) !== -1) {
            return;
        }
        // Add the hook to the end, so it will be the first to execute.
        if (!hooks) {
            messageHooks.set(handler, [hook]);
        }
        else {
            hooks.push(hook);
        }
    }
    MessageLoop.installMessageHook = installMessageHook;
    /**
     * Remove an installed message hook for a message handler.
     *
     * @param handler - The message handler of interest.
     *
     * @param hook - The message hook to remove.
     *
     * #### Notes
     * It is safe to call this function while the hook is executing.
     *
     * If the hook is not installed, this is a no-op.
     */
    function removeMessageHook(handler, hook) {
        // Lookup the hooks for the handler.
        var hooks = messageHooks.get(handler);
        // Bail early if the hooks do not exist.
        if (!hooks) {
            return;
        }
        // Lookup the index of the hook and bail if not found.
        var i = hooks.indexOf(hook);
        if (i === -1) {
            return;
        }
        // Clear the hook and schedule a cleanup of the array.
        hooks[i] = null;
        scheduleCleanup(hooks);
    }
    MessageLoop.removeMessageHook = removeMessageHook;
    /**
     * Clear all message data associated with a message handler.
     *
     * @param handler - The message handler of interest.
     *
     * #### Notes
     * This will clear all posted messages and hooks for the handler.
     */
    function clearData(handler) {
        // Lookup the hooks for the handler.
        var hooks = messageHooks.get(handler);
        // Clear all messsage hooks for the handler.
        if (hooks && hooks.length > 0) {
            ArrayExt.fill(hooks, null);
            scheduleCleanup(hooks);
        }
        // Clear all posted messages for the handler.
        each(messageQueue, function (posted) {
            if (posted.handler === handler) {
                posted.handler = null;
                posted.msg = null;
            }
        });
    }
    MessageLoop.clearData = clearData;
    /**
     * Process the pending posted messages in the queue immediately.
     *
     * #### Notes
     * This function is useful when posted messages must be processed
     * immediately, instead of on the next animation frame.
     *
     * This function should normally not be needed, but it may be
     * required to work around certain browser idiosyncrasies.
     *
     * Recursing into this function is a no-op.
     */
    function flush() {
        // Bail if recursion is detected or if there is no pending task.
        if (flushGuard || loopTaskID === 0) {
            return;
        }
        // Unschedule the pending loop task.
        unschedule(loopTaskID);
        // Run the message loop within the recursion guard.
        flushGuard = true;
        runMessageLoop();
        flushGuard = false;
    }
    MessageLoop.flush = flush;
    /**
     * Get the message loop exception handler.
     *
     * @returns The current exception handler.
     *
     * #### Notes
     * The default exception handler is `console.error`.
     */
    function getExceptionHandler() {
        return exceptionHandler;
    }
    MessageLoop.getExceptionHandler = getExceptionHandler;
    /**
     * Set the message loop exception handler.
     *
     * @param handler - The function to use as the exception handler.
     *
     * @returns The old exception handler.
     *
     * #### Notes
     * The exception handler is invoked when a message handler or a
     * message hook throws an exception.
     */
    function setExceptionHandler(handler) {
        var old = exceptionHandler;
        exceptionHandler = handler;
        return old;
    }
    MessageLoop.setExceptionHandler = setExceptionHandler;
    /**
     * The queue of posted message pairs.
     */
    var messageQueue = new index_es6_LinkedList();
    /**
     * A mapping of handler to array of installed message hooks.
     */
    var messageHooks = new WeakMap();
    /**
     * A set of message hook arrays which are pending cleanup.
     */
    var dirtySet = new Set();
    /**
     * The message loop exception handler.
     */
    var exceptionHandler = function (err) {
        console.error(err);
    };
    /**
     * The id of the pending loop task animation frame.
     */
    var loopTaskID = 0;
    /**
     * A guard flag to prevent flush recursion.
     */
    var flushGuard = false;
    /**
     * A function to schedule an event loop callback.
     */
    var schedule = (function () {
        var ok = typeof requestAnimationFrame === 'function';
        return ok ? requestAnimationFrame : setImmediate;
    })();
    /**
     * A function to unschedule an event loop callback.
     */
    var unschedule = (function () {
        var ok = typeof cancelAnimationFrame === 'function';
        return ok ? cancelAnimationFrame : clearImmediate;
    })();
    /**
     * Invoke a message hook with the specified handler and message.
     *
     * Returns the result of the hook, or `true` if the hook throws.
     *
     * Exceptions in the hook will be caught and logged.
     */
    function invokeHook(hook, handler, msg) {
        var result = true;
        try {
            if (typeof hook === 'function') {
                result = hook(handler, msg);
            }
            else {
                result = hook.messageHook(handler, msg);
            }
        }
        catch (err) {
            exceptionHandler(err);
        }
        return result;
    }
    /**
     * Invoke a message handler with the specified message.
     *
     * Exceptions in the handler will be caught and logged.
     */
    function invokeHandler(handler, msg) {
        try {
            handler.processMessage(msg);
        }
        catch (err) {
            exceptionHandler(err);
        }
    }
    /**
     * Add a message to the end of the message queue.
     *
     * This will automatically schedule a run of the message loop.
     */
    function enqueueMessage(handler, msg) {
        // Add the posted message to the queue.
        messageQueue.addLast({ handler: handler, msg: msg });
        // Bail if a loop task is already pending.
        if (loopTaskID !== 0) {
            return;
        }
        // Schedule a run of the message loop.
        loopTaskID = schedule(runMessageLoop);
    }
    /**
     * Run an iteration of the message loop.
     *
     * This will process all pending messages in the queue. If a message
     * is added to the queue while the message loop is running, it will
     * be processed on the next cycle of the loop.
     */
    function runMessageLoop() {
        // Clear the task ID so the next loop can be scheduled.
        loopTaskID = 0;
        // If the message queue is empty, there is nothing else to do.
        if (messageQueue.isEmpty) {
            return;
        }
        // Add a sentinel value to the end of the queue. The queue will
        // only be processed up to the sentinel. Messages posted during
        // this cycle will execute on the next cycle.
        var sentinel = { handler: null, msg: null };
        messageQueue.addLast(sentinel);
        // Enter the message loop.
        // eslint-disable-next-line no-constant-condition
        while (true) {
            // Remove the first posted message in the queue.
            var posted = messageQueue.removeFirst();
            // If the value is the sentinel, exit the loop.
            if (posted === sentinel) {
                return;
            }
            // Dispatch the message if it has not been cleared.
            if (posted.handler && posted.msg) {
                sendMessage(posted.handler, posted.msg);
            }
        }
    }
    /**
     * Schedule a cleanup of a message hooks array.
     *
     * This will add the array to the dirty set and schedule a deferred
     * cleanup of the array contents. On cleanup, any `null` hook will
     * be removed from the array.
     */
    function scheduleCleanup(hooks) {
        if (dirtySet.size === 0) {
            schedule(cleanupDirtySet);
        }
        dirtySet.add(hooks);
    }
    /**
     * Cleanup the message hook arrays in the dirty set.
     *
     * This function should only be invoked asynchronously, when the
     * stack frame is guaranteed to not be on the path of user code.
     */
    function cleanupDirtySet() {
        dirtySet.forEach(cleanupHooks);
        dirtySet.clear();
    }
    /**
     * Cleanup the dirty hooks in a message hooks array.
     *
     * This will remove any `null` hook from the array.
     *
     * This function should only be invoked asynchronously, when the
     * stack frame is guaranteed to not be on the path of user code.
     */
    function cleanupHooks(hooks) {
        ArrayExt.removeAllWhere(hooks, isNull);
    }
    /**
     * Test whether a value is `null`.
     */
    function isNull(value) {
        return value === null;
    }
})(index_es6_MessageLoop || (index_es6_MessageLoop = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/properties/dist/index.es6.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * A class which attaches a value to an external object.
 *
 * #### Notes
 * Attached properties are used to extend the state of an object with
 * semantic data from an unrelated class. They also encapsulate value
 * creation, coercion, and notification.
 *
 * Because attached property values are stored in a hash table, which
 * in turn is stored in a WeakMap keyed on the owner object, there is
 * non-trivial storage overhead involved in their use. The pattern is
 * therefore best used for the storage of rare data.
 */
var AttachedProperty = /** @class */ (function () {
    /**
     * Construct a new attached property.
     *
     * @param options - The options for initializing the property.
     */
    function AttachedProperty(options) {
        this._pid = properties_dist_index_es6_Private.nextPID();
        this.name = options.name;
        this._create = options.create;
        this._coerce = options.coerce || null;
        this._compare = options.compare || null;
        this._changed = options.changed || null;
    }
    /**
     * Get the current value of the property for a given owner.
     *
     * @param owner - The property owner of interest.
     *
     * @returns The current value of the property.
     *
     * #### Notes
     * If the value has not yet been set, the default value will be
     * computed and assigned as the current value of the property.
     */
    AttachedProperty.prototype.get = function (owner) {
        var value;
        var map = properties_dist_index_es6_Private.ensureMap(owner);
        if (this._pid in map) {
            value = map[this._pid];
        }
        else {
            value = map[this._pid] = this._createValue(owner);
        }
        return value;
    };
    /**
     * Set the current value of the property for a given owner.
     *
     * @param owner - The property owner of interest.
     *
     * @param value - The value for the property.
     *
     * #### Notes
     * If the value has not yet been set, the default value will be
     * computed and used as the previous value for the comparison.
     */
    AttachedProperty.prototype.set = function (owner, value) {
        var oldValue;
        var map = properties_dist_index_es6_Private.ensureMap(owner);
        if (this._pid in map) {
            oldValue = map[this._pid];
        }
        else {
            oldValue = map[this._pid] = this._createValue(owner);
        }
        var newValue = this._coerceValue(owner, value);
        this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
    };
    /**
     * Explicitly coerce the current property value for a given owner.
     *
     * @param owner - The property owner of interest.
     *
     * #### Notes
     * If the value has not yet been set, the default value will be
     * computed and used as the previous value for the comparison.
     */
    AttachedProperty.prototype.coerce = function (owner) {
        var oldValue;
        var map = properties_dist_index_es6_Private.ensureMap(owner);
        if (this._pid in map) {
            oldValue = map[this._pid];
        }
        else {
            oldValue = map[this._pid] = this._createValue(owner);
        }
        var newValue = this._coerceValue(owner, oldValue);
        this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
    };
    /**
     * Get or create the default value for the given owner.
     */
    AttachedProperty.prototype._createValue = function (owner) {
        var create = this._create;
        return create(owner);
    };
    /**
     * Coerce the value for the given owner.
     */
    AttachedProperty.prototype._coerceValue = function (owner, value) {
        var coerce = this._coerce;
        return coerce ? coerce(owner, value) : value;
    };
    /**
     * Compare the old value and new value for equality.
     */
    AttachedProperty.prototype._compareValue = function (oldValue, newValue) {
        var compare = this._compare;
        return compare ? compare(oldValue, newValue) : oldValue === newValue;
    };
    /**
     * Run the change notification if the given values are different.
     */
    AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {
        var changed = this._changed;
        if (changed && !this._compareValue(oldValue, newValue)) {
            changed(owner, oldValue, newValue);
        }
    };
    return AttachedProperty;
}());
/**
 * The namespace for the `AttachedProperty` class statics.
 */
(function (AttachedProperty) {
    /**
     * Clear the stored property data for the given owner.
     *
     * @param owner - The property owner of interest.
     *
     * #### Notes
     * This will clear all property values for the owner, but it will
     * **not** run the change notification for any of the properties.
     */
    function clearData(owner) {
        properties_dist_index_es6_Private.ownerData.delete(owner);
    }
    AttachedProperty.clearData = clearData;
})(AttachedProperty || (AttachedProperty = {}));
/**
 * The namespace for the module implementation details.
 */
var properties_dist_index_es6_Private;
(function (Private) {
    /**
     * A weak mapping of property owner to property map.
     */
    Private.ownerData = new WeakMap();
    /**
     * A function which computes successive unique property ids.
     */
    Private.nextPID = (function () {
        var id = 0;
        return function () {
            var rand = Math.random();
            var stem = ("" + rand).slice(2);
            return "pid-" + stem + "-" + id++;
        };
    })();
    /**
     * Lookup the data map for the property owner.
     *
     * This will create the map if one does not already exist.
     */
    function ensureMap(owner) {
        var map = Private.ownerData.get(owner);
        if (map) {
            return map;
        }
        map = Object.create(null);
        Private.ownerData.set(owner, map);
        return map;
    }
    Private.ensureMap = ensureMap;
})(properties_dist_index_es6_Private || (properties_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/signaling/dist/index.es6.js


// Copyright (c) Jupyter Development Team.
/**
 * A concrete implementation of `ISignal`.
 *
 * #### Example
 * ```typescript
 * import { ISignal, Signal } from '@lumino/signaling';
 *
 * class SomeClass {
 *
 *   constructor(name: string) {
 *     this.name = name;
 *   }
 *
 *   readonly name: string;
 *
 *   get valueChanged: ISignal<this, number> {
 *     return this._valueChanged;
 *   }
 *
 *   get value(): number {
 *     return this._value;
 *   }
 *
 *   set value(value: number) {
 *     if (value === this._value) {
 *       return;
 *     }
 *     this._value = value;
 *     this._valueChanged.emit(value);
 *   }
 *
 *   private _value = 0;
 *   private _valueChanged = new Signal<this, number>(this);
 * }
 *
 * function logger(sender: SomeClass, value: number): void {
 *   console.log(sender.name, value);
 * }
 *
 * let m1 = new SomeClass('foo');
 * let m2 = new SomeClass('bar');
 *
 * m1.valueChanged.connect(logger);
 * m2.valueChanged.connect(logger);
 *
 * m1.value = 42;  // logs: foo 42
 * m2.value = 17;  // logs: bar 17
 * ```
 */
var Signal = /** @class */ (function () {
    /**
     * Construct a new signal.
     *
     * @param sender - The sender which owns the signal.
     */
    function Signal(sender) {
        this.sender = sender;
    }
    /**
     * Connect a slot to the signal.
     *
     * @param slot - The slot to invoke when the signal is emitted.
     *
     * @param thisArg - The `this` context for the slot. If provided,
     *   this must be a non-primitive object.
     *
     * @returns `true` if the connection succeeds, `false` otherwise.
     */
    Signal.prototype.connect = function (slot, thisArg) {
        return signaling_dist_index_es6_Private.connect(this, slot, thisArg);
    };
    /**
     * Disconnect a slot from the signal.
     *
     * @param slot - The slot to disconnect from the signal.
     *
     * @param thisArg - The `this` context for the slot. If provided,
     *   this must be a non-primitive object.
     *
     * @returns `true` if the connection is removed, `false` otherwise.
     */
    Signal.prototype.disconnect = function (slot, thisArg) {
        return signaling_dist_index_es6_Private.disconnect(this, slot, thisArg);
    };
    /**
     * Emit the signal and invoke the connected slots.
     *
     * @param args - The args to pass to the connected slots.
     *
     * #### Notes
     * Slots are invoked synchronously in connection order.
     *
     * Exceptions thrown by connected slots will be caught and logged.
     */
    Signal.prototype.emit = function (args) {
        signaling_dist_index_es6_Private.emit(this, args);
    };
    return Signal;
}());
/**
 * The namespace for the `Signal` class statics.
 */
(function (Signal) {
    /**
     * Remove all connections between a sender and receiver.
     *
     * @param sender - The sender object of interest.
     *
     * @param receiver - The receiver object of interest.
     *
     * #### Notes
     * If a `thisArg` is provided when connecting a signal, that object
     * is considered the receiver. Otherwise, the `slot` is considered
     * the receiver.
     */
    function disconnectBetween(sender, receiver) {
        signaling_dist_index_es6_Private.disconnectBetween(sender, receiver);
    }
    Signal.disconnectBetween = disconnectBetween;
    /**
     * Remove all connections where the given object is the sender.
     *
     * @param sender - The sender object of interest.
     */
    function disconnectSender(sender) {
        signaling_dist_index_es6_Private.disconnectSender(sender);
    }
    Signal.disconnectSender = disconnectSender;
    /**
     * Remove all connections where the given object is the receiver.
     *
     * @param receiver - The receiver object of interest.
     *
     * #### Notes
     * If a `thisArg` is provided when connecting a signal, that object
     * is considered the receiver. Otherwise, the `slot` is considered
     * the receiver.
     */
    function disconnectReceiver(receiver) {
        signaling_dist_index_es6_Private.disconnectReceiver(receiver);
    }
    Signal.disconnectReceiver = disconnectReceiver;
    /**
     * Remove all connections where an object is the sender or receiver.
     *
     * @param object - The object of interest.
     *
     * #### Notes
     * If a `thisArg` is provided when connecting a signal, that object
     * is considered the receiver. Otherwise, the `slot` is considered
     * the receiver.
     */
    function disconnectAll(object) {
        signaling_dist_index_es6_Private.disconnectAll(object);
    }
    Signal.disconnectAll = disconnectAll;
    /**
     * Clear all signal data associated with the given object.
     *
     * @param object - The object for which the data should be cleared.
     *
     * #### Notes
     * This removes all signal connections and any other signal data
     * associated with the object.
     */
    function clearData(object) {
        signaling_dist_index_es6_Private.disconnectAll(object);
    }
    Signal.clearData = clearData;
    /**
     * Get the signal exception handler.
     *
     * @returns The current exception handler.
     *
     * #### Notes
     * The default exception handler is `console.error`.
     */
    function getExceptionHandler() {
        return signaling_dist_index_es6_Private.exceptionHandler;
    }
    Signal.getExceptionHandler = getExceptionHandler;
    /**
     * Set the signal exception handler.
     *
     * @param handler - The function to use as the exception handler.
     *
     * @returns The old exception handler.
     *
     * #### Notes
     * The exception handler is invoked when a slot throws an exception.
     */
    function setExceptionHandler(handler) {
        var old = signaling_dist_index_es6_Private.exceptionHandler;
        signaling_dist_index_es6_Private.exceptionHandler = handler;
        return old;
    }
    Signal.setExceptionHandler = setExceptionHandler;
})(Signal || (Signal = {}));
/**
 * The namespace for the module implementation details.
 */
var signaling_dist_index_es6_Private;
(function (Private) {
    /**
     * The signal exception handler function.
     */
    Private.exceptionHandler = function (err) {
        console.error(err);
    };
    /**
     * Connect a slot to a signal.
     *
     * @param signal - The signal of interest.
     *
     * @param slot - The slot to invoke when the signal is emitted.
     *
     * @param thisArg - The `this` context for the slot. If provided,
     *   this must be a non-primitive object.
     *
     * @returns `true` if the connection succeeds, `false` otherwise.
     */
    function connect(signal, slot, thisArg) {
        // Coerce a `null` `thisArg` to `undefined`.
        thisArg = thisArg || undefined;
        // Ensure the sender's array of receivers is created.
        var receivers = receiversForSender.get(signal.sender);
        if (!receivers) {
            receivers = [];
            receiversForSender.set(signal.sender, receivers);
        }
        // Bail if a matching connection already exists.
        if (findConnection(receivers, signal, slot, thisArg)) {
            return false;
        }
        // Choose the best object for the receiver.
        var receiver = thisArg || slot;
        // Ensure the receiver's array of senders is created.
        var senders = sendersForReceiver.get(receiver);
        if (!senders) {
            senders = [];
            sendersForReceiver.set(receiver, senders);
        }
        // Create a new connection and add it to the end of each array.
        var connection = { signal: signal, slot: slot, thisArg: thisArg };
        receivers.push(connection);
        senders.push(connection);
        // Indicate a successful connection.
        return true;
    }
    Private.connect = connect;
    /**
     * Disconnect a slot from a signal.
     *
     * @param signal - The signal of interest.
     *
     * @param slot - The slot to disconnect from the signal.
     *
     * @param thisArg - The `this` context for the slot. If provided,
     *   this must be a non-primitive object.
     *
     * @returns `true` if the connection is removed, `false` otherwise.
     */
    function disconnect(signal, slot, thisArg) {
        // Coerce a `null` `thisArg` to `undefined`.
        thisArg = thisArg || undefined;
        // Lookup the list of receivers, and bail if none exist.
        var receivers = receiversForSender.get(signal.sender);
        if (!receivers || receivers.length === 0) {
            return false;
        }
        // Bail if no matching connection exits.
        var connection = findConnection(receivers, signal, slot, thisArg);
        if (!connection) {
            return false;
        }
        // Choose the best object for the receiver.
        var receiver = thisArg || slot;
        // Lookup the array of senders, which is now known to exist.
        var senders = sendersForReceiver.get(receiver);
        // Clear the connection and schedule cleanup of the arrays.
        connection.signal = null;
        scheduleCleanup(receivers);
        scheduleCleanup(senders);
        // Indicate a successful disconnection.
        return true;
    }
    Private.disconnect = disconnect;
    /**
     * Remove all connections between a sender and receiver.
     *
     * @param sender - The sender object of interest.
     *
     * @param receiver - The receiver object of interest.
     */
    function disconnectBetween(sender, receiver) {
        // If there are no receivers, there is nothing to do.
        var receivers = receiversForSender.get(sender);
        if (!receivers || receivers.length === 0) {
            return;
        }
        // If there are no senders, there is nothing to do.
        var senders = sendersForReceiver.get(receiver);
        if (!senders || senders.length === 0) {
            return;
        }
        // Clear each connection between the sender and receiver.
        each(senders, function (connection) {
            // Skip connections which have already been cleared.
            if (!connection.signal) {
                return;
            }
            // Clear the connection if it matches the sender.
            if (connection.signal.sender === sender) {
                connection.signal = null;
            }
        });
        // Schedule a cleanup of the senders and receivers.
        scheduleCleanup(receivers);
        scheduleCleanup(senders);
    }
    Private.disconnectBetween = disconnectBetween;
    /**
     * Remove all connections where the given object is the sender.
     *
     * @param sender - The sender object of interest.
     */
    function disconnectSender(sender) {
        // If there are no receivers, there is nothing to do.
        var receivers = receiversForSender.get(sender);
        if (!receivers || receivers.length === 0) {
            return;
        }
        // Clear each receiver connection.
        each(receivers, function (connection) {
            // Skip connections which have already been cleared.
            if (!connection.signal) {
                return;
            }
            // Choose the best object for the receiver.
            var receiver = connection.thisArg || connection.slot;
            // Clear the connection.
            connection.signal = null;
            // Cleanup the array of senders, which is now known to exist.
            scheduleCleanup(sendersForReceiver.get(receiver));
        });
        // Schedule a cleanup of the receivers.
        scheduleCleanup(receivers);
    }
    Private.disconnectSender = disconnectSender;
    /**
     * Remove all connections where the given object is the receiver.
     *
     * @param receiver - The receiver object of interest.
     */
    function disconnectReceiver(receiver) {
        // If there are no senders, there is nothing to do.
        var senders = sendersForReceiver.get(receiver);
        if (!senders || senders.length === 0) {
            return;
        }
        // Clear each sender connection.
        each(senders, function (connection) {
            // Skip connections which have already been cleared.
            if (!connection.signal) {
                return;
            }
            // Lookup the sender for the connection.
            var sender = connection.signal.sender;
            // Clear the connection.
            connection.signal = null;
            // Cleanup the array of receivers, which is now known to exist.
            scheduleCleanup(receiversForSender.get(sender));
        });
        // Schedule a cleanup of the list of senders.
        scheduleCleanup(senders);
    }
    Private.disconnectReceiver = disconnectReceiver;
    /**
     * Remove all connections where an object is the sender or receiver.
     *
     * @param object - The object of interest.
     */
    function disconnectAll(object) {
        // Remove all connections where the given object is the sender.
        disconnectSender(object);
        // Remove all connections where the given object is the receiver.
        disconnectReceiver(object);
    }
    Private.disconnectAll = disconnectAll;
    /**
     * Emit a signal and invoke its connected slots.
     *
     * @param signal - The signal of interest.
     *
     * @param args - The args to pass to the connected slots.
     *
     * #### Notes
     * Slots are invoked synchronously in connection order.
     *
     * Exceptions thrown by connected slots will be caught and logged.
     */
    function emit(signal, args) {
        // If there are no receivers, there is nothing to do.
        var receivers = receiversForSender.get(signal.sender);
        if (!receivers || receivers.length === 0) {
            return;
        }
        // Invoke the slots for connections with a matching signal.
        // Any connections added during emission are not invoked.
        for (var i = 0, n = receivers.length; i < n; ++i) {
            var connection = receivers[i];
            if (connection.signal === signal) {
                invokeSlot(connection, args);
            }
        }
    }
    Private.emit = emit;
    /**
     * A weak mapping of sender to array of receiver connections.
     */
    var receiversForSender = new WeakMap();
    /**
     * A weak mapping of receiver to array of sender connections.
     */
    var sendersForReceiver = new WeakMap();
    /**
     * A set of connection arrays which are pending cleanup.
     */
    var dirtySet = new Set();
    /**
     * A function to schedule an event loop callback.
     */
    var schedule = (function () {
        var ok = typeof requestAnimationFrame === 'function';
        // @ts-ignore
        return ok ? requestAnimationFrame : setImmediate;
    })();
    /**
     * Find a connection which matches the given parameters.
     */
    function findConnection(connections, signal, slot, thisArg) {
        return find(connections, function (connection) {
            return connection.signal === signal &&
                connection.slot === slot &&
                connection.thisArg === thisArg;
        });
    }
    /**
     * Invoke a slot with the given parameters.
     *
     * The connection is assumed to be valid.
     *
     * Exceptions in the slot will be caught and logged.
     */
    function invokeSlot(connection, args) {
        var signal = connection.signal, slot = connection.slot, thisArg = connection.thisArg;
        try {
            slot.call(thisArg, signal.sender, args);
        }
        catch (err) {
            Private.exceptionHandler(err);
        }
    }
    /**
     * Schedule a cleanup of a connection array.
     *
     * This will add the array to the dirty set and schedule a deferred
     * cleanup of the array contents. On cleanup, any connection with a
     * `null` signal will be removed from the array.
     */
    function scheduleCleanup(array) {
        if (dirtySet.size === 0) {
            schedule(cleanupDirtySet);
        }
        dirtySet.add(array);
    }
    /**
     * Cleanup the connection lists in the dirty set.
     *
     * This function should only be invoked asynchronously, when the
     * stack frame is guaranteed to not be on the path of user code.
     */
    function cleanupDirtySet() {
        dirtySet.forEach(cleanupConnections);
        dirtySet.clear();
    }
    /**
     * Cleanup the dirty connections in a connections array.
     *
     * This will remove any connection with a `null` signal.
     *
     * This function should only be invoked asynchronously, when the
     * stack frame is guaranteed to not be on the path of user code.
     */
    function cleanupConnections(connections) {
        ArrayExt.removeAllWhere(connections, isDeadConnection);
    }
    /**
     * Test whether a connection is dead.
     *
     * A dead connection has a `null` signal.
     */
    function isDeadConnection(connection) {
        return connection.signal === null;
    }
})(signaling_dist_index_es6_Private || (signaling_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/disposable/dist/index.es6.js



/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var index_es6_extendStatics = function(d, b) {
    index_es6_extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return index_es6_extendStatics(d, b);
};

function dist_index_es6_extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    index_es6_extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

/**
 * A disposable object which delegates to a callback function.
 */
var DisposableDelegate = /** @class */ (function () {
    /**
     * Construct a new disposable delegate.
     *
     * @param fn - The callback function to invoke on dispose.
     */
    function DisposableDelegate(fn) {
        this._fn = fn;
    }
    Object.defineProperty(DisposableDelegate.prototype, "isDisposed", {
        /**
         * Test whether the delegate has been disposed.
         */
        get: function () {
            return !this._fn;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Dispose of the delegate and invoke the callback function.
     */
    DisposableDelegate.prototype.dispose = function () {
        if (!this._fn) {
            return;
        }
        var fn = this._fn;
        this._fn = null;
        fn();
    };
    return DisposableDelegate;
}());
/**
 * An observable disposable object which delegates to a callback function.
 */
var index_es6_ObservableDisposableDelegate = /** @class */ (function (_super) {
    dist_index_es6_extends(ObservableDisposableDelegate, _super);
    function ObservableDisposableDelegate() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._disposed = new Signal(_this);
        return _this;
    }
    Object.defineProperty(ObservableDisposableDelegate.prototype, "disposed", {
        /**
         * A signal emitted when the delegate is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Dispose of the delegate and invoke the callback function.
     */
    ObservableDisposableDelegate.prototype.dispose = function () {
        if (this.isDisposed) {
            return;
        }
        _super.prototype.dispose.call(this);
        this._disposed.emit(undefined);
        Signal.clearData(this);
    };
    return ObservableDisposableDelegate;
}(DisposableDelegate));
/**
 * An object which manages a collection of disposable items.
 */
var index_es6_DisposableSet = /** @class */ (function () {
    function DisposableSet() {
        this._isDisposed = false;
        this._items = new Set();
    }
    Object.defineProperty(DisposableSet.prototype, "isDisposed", {
        /**
         * Test whether the set has been disposed.
         */
        get: function () {
            return this._isDisposed;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Dispose of the set and the items it contains.
     *
     * #### Notes
     * Items are disposed in the order they are added to the set.
     */
    DisposableSet.prototype.dispose = function () {
        if (this._isDisposed) {
            return;
        }
        this._isDisposed = true;
        this._items.forEach(function (item) {
            item.dispose();
        });
        this._items.clear();
    };
    /**
     * Test whether the set contains a specific item.
     *
     * @param item - The item of interest.
     *
     * @returns `true` if the set contains the item, `false` otherwise.
     */
    DisposableSet.prototype.contains = function (item) {
        return this._items.has(item);
    };
    /**
     * Add a disposable item to the set.
     *
     * @param item - The item to add to the set.
     *
     * #### Notes
     * If the item is already contained in the set, this is a no-op.
     */
    DisposableSet.prototype.add = function (item) {
        this._items.add(item);
    };
    /**
     * Remove a disposable item from the set.
     *
     * @param item - The item to remove from the set.
     *
     * #### Notes
     * If the item is not contained in the set, this is a no-op.
     */
    DisposableSet.prototype.remove = function (item) {
        this._items.delete(item);
    };
    /**
     * Remove all items from the set.
     */
    DisposableSet.prototype.clear = function () {
        this._items.clear();
    };
    return DisposableSet;
}());
/**
 * The namespace for the `DisposableSet` class statics.
 */
(function (DisposableSet) {
    /**
     * Create a disposable set from an iterable of items.
     *
     * @param items - The iterable or array-like object of interest.
     *
     * @returns A new disposable initialized with the given items.
     */
    function from(items) {
        var set = new DisposableSet();
        each(items, function (item) {
            set.add(item);
        });
        return set;
    }
    DisposableSet.from = from;
})(index_es6_DisposableSet || (index_es6_DisposableSet = {}));
/**
 * An observable object which manages a collection of disposable items.
 */
var index_es6_ObservableDisposableSet = /** @class */ (function (_super) {
    dist_index_es6_extends(ObservableDisposableSet, _super);
    function ObservableDisposableSet() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._disposed = new Signal(_this);
        return _this;
    }
    Object.defineProperty(ObservableDisposableSet.prototype, "disposed", {
        /**
         * A signal emitted when the set is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Dispose of the set and the items it contains.
     *
     * #### Notes
     * Items are disposed in the order they are added to the set.
     */
    ObservableDisposableSet.prototype.dispose = function () {
        if (this.isDisposed) {
            return;
        }
        _super.prototype.dispose.call(this);
        this._disposed.emit(undefined);
        Signal.clearData(this);
    };
    return ObservableDisposableSet;
}(index_es6_DisposableSet));
/**
 * The namespace for the `ObservableDisposableSet` class statics.
 */
(function (ObservableDisposableSet) {
    /**
     * Create an observable disposable set from an iterable of items.
     *
     * @param items - The iterable or array-like object of interest.
     *
     * @returns A new disposable initialized with the given items.
     */
    function from(items) {
        var set = new ObservableDisposableSet();
        each(items, function (item) {
            set.add(item);
        });
        return set;
    }
    ObservableDisposableSet.from = from;
})(index_es6_ObservableDisposableSet || (index_es6_ObservableDisposableSet = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/dragdrop/dist/index.es6.js


/**
 * An object which manages a drag-drop operation.
 *
 * A drag object dispatches four different events to drop targets:
 *
 * - `'lm-dragenter'` - Dispatched when the mouse enters the target
 *   element. This event must be canceled in order to receive any
 *   of the other events.
 *
 * - `'lm-dragover'` - Dispatched when the mouse moves over the drop
 *   target. It must cancel the event and set the `dropAction` to one
 *   of the supported actions in order to receive drop events.
 *
 * - `'lm-dragleave'` - Dispatched when the mouse leaves the target
 *   element. This includes moving the mouse into child elements.
 *
 * - `'lm-drop'`- Dispatched when the mouse is released over the target
 *   element when the target indicates an appropriate drop action. If
 *   the event is canceled, the indicated drop action is returned to
 *   the initiator through the resolved promise.
 *
 * A drag operation can be terminated at any time by pressing `Escape`
 * or by disposing the drag object.
 *
 * A drag object has the ability to automatically scroll a scrollable
 * element when the mouse is hovered near one of its edges. To enable
 * this, add the `data-lm-dragscroll` attribute to any element which
 * the drag object should consider for scrolling.
 *
 * #### Notes
 * This class is designed to be used when dragging and dropping custom
 * data *within* a single application. It is *not* a replacement for
 * the native drag-drop API. Instead, it provides an API which allows
 * drag operations to be initiated programmatically and enables the
 * transfer of arbitrary non-string objects; features which are not
 * possible with the native drag-drop API.
 */
var index_es6_Drag = /** @class */ (function () {
    /**
     * Construct a new drag object.
     *
     * @param options - The options for initializing the drag.
     */
    function Drag(options) {
        var _this = this;
        /**
         * The scroll loop handler function.
         */
        this._onScrollFrame = function () {
            // Bail early if there is no scroll target.
            if (!_this._scrollTarget) {
                return;
            }
            // Unpack the scroll target.
            var _a = _this._scrollTarget, element = _a.element, edge = _a.edge, distance = _a.distance;
            // Calculate the scroll delta using nonlinear acceleration.
            var d = dragdrop_dist_index_es6_Private.SCROLL_EDGE_SIZE - distance;
            var f = Math.pow(d / dragdrop_dist_index_es6_Private.SCROLL_EDGE_SIZE, 2);
            var s = Math.max(1, Math.round(f * dragdrop_dist_index_es6_Private.SCROLL_EDGE_SIZE));
            // Scroll the element in the specified direction.
            switch (edge) {
                case 'top':
                    element.scrollTop -= s;
                    break;
                case 'left':
                    element.scrollLeft -= s;
                    break;
                case 'right':
                    element.scrollLeft += s;
                    break;
                case 'bottom':
                    element.scrollTop += s;
                    break;
            }
            // Request the next cycle of the scroll loop.
            requestAnimationFrame(_this._onScrollFrame);
        };
        this._disposed = false;
        this._dropAction = 'none';
        this._override = null;
        this._currentTarget = null;
        this._currentElement = null;
        this._promise = null;
        this._scrollTarget = null;
        this._resolve = null;
        this.mimeData = options.mimeData;
        this.dragImage = options.dragImage || null;
        this.proposedAction = options.proposedAction || 'copy';
        this.supportedActions = options.supportedActions || 'all';
        this.source = options.source || null;
    }
    /**
     * Dispose of the resources held by the drag object.
     *
     * #### Notes
     * This will cancel the drag operation if it is active.
     */
    Drag.prototype.dispose = function () {
        // Do nothing if the drag object is already disposed.
        if (this._disposed) {
            return;
        }
        this._disposed = true;
        // If there is a current target, dispatch a drag leave event.
        if (this._currentTarget) {
            var event_1 = dragdrop_dist_index_es6_Private.createMouseEvent('pointerup', -1, -1);
            dragdrop_dist_index_es6_Private.dispatchDragLeave(this, this._currentTarget, null, event_1);
        }
        // Finalize the drag object with `'none'`.
        this._finalize('none');
    };
    Object.defineProperty(Drag.prototype, "isDisposed", {
        /**
         * Test whether the drag object is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Start the drag operation at the specified client position.
     *
     * @param clientX - The client X position for the drag start.
     *
     * @param clientY - The client Y position for the drag start.
     *
     * @returns A promise which resolves to the result of the drag.
     *
     * #### Notes
     * If the drag has already been started, the promise created by the
     * first call to `start` is returned.
     *
     * If the drag operation has ended, or if the drag object has been
     * disposed, the returned promise will resolve to `'none'`.
     *
     * The drag object will be automatically disposed when drag operation
     * completes. This means `Drag` objects are for single-use only.
     *
     * This method assumes the left mouse button is already held down.
     */
    Drag.prototype.start = function (clientX, clientY) {
        var _this = this;
        // If the drag object is already disposed, resolve to `None`.
        if (this._disposed) {
            return Promise.resolve('none');
        }
        // If the drag has already been started, return the promise.
        if (this._promise) {
            return this._promise;
        }
        // Install the document listeners for the drag object.
        this._addListeners();
        // Attach the drag image at the specified client position.
        this._attachDragImage(clientX, clientY);
        // Create the promise which will be resolved on completion.
        this._promise = new Promise(function (resolve, reject) {
            _this._resolve = resolve;
        });
        // Trigger a fake move event to kick off the drag operation.
        var event = dragdrop_dist_index_es6_Private.createMouseEvent('pointermove', clientX, clientY);
        document.dispatchEvent(event);
        // Return the pending promise for the drag operation.
        return this._promise;
    };
    /**
     * Handle the DOM events for the drag operation.
     *
     * @param event - The DOM event sent to the drag object.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the document. It should not be
     * called directly by user code.
     */
    Drag.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'mousemove': // <DEPRECATED>
                this._evtMouseMove(event);
                break;
            case 'mouseup': // <DEPRECATED>
                this._evtMouseUp(event);
                break;
            case 'pointermove':
                this._evtMouseMove(event);
                break;
            case 'pointerup':
                this._evtMouseUp(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            default:
                // Stop all other events during drag-drop.
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * Move the drag image element to the specified location.
     *
     * This is a no-op if there is no drag image element.
     */
    Drag.prototype.moveDragImage = function (clientX, clientY) {
        if (!this.dragImage) {
            return;
        }
        var style = this.dragImage.style;
        style.top = clientY + "px";
        style.left = clientX + "px";
    };
    /**
     * Handle the `'mousemove'` event for the drag object.
     */
    Drag.prototype._evtMouseMove = function (event) {
        // Stop all input events during drag-drop.
        event.preventDefault();
        event.stopPropagation();
        // Update the current target node and dispatch enter/leave events.
        this._updateCurrentTarget(event);
        // Update the drag scroll element.
        this._updateDragScroll(event);
        // Move the drag image to the specified client position. This is
        // performed *after* dispatching to prevent unnecessary reflows.
        this.moveDragImage(event.clientX, event.clientY);
    };
    /**
     * Handle the `'mouseup'` event for the drag object.
     */
    Drag.prototype._evtMouseUp = function (event) {
        // Stop all input events during drag-drop.
        event.preventDefault();
        event.stopPropagation();
        // Do nothing if the left button is not released.
        if (event.button !== 0) {
            return;
        }
        // Update the current target node and dispatch enter/leave events.
        // This prevents a subtle issue where the DOM mutates under the
        // cursor after the last move event but before the drop event.
        this._updateCurrentTarget(event);
        // If there is no current target, finalize with `'none'`.
        if (!this._currentTarget) {
            this._finalize('none');
            return;
        }
        // If the last drop action was `'none'`, dispatch a leave event
        // to the current target and finalize the drag with `'none'`.
        if (this._dropAction === 'none') {
            dragdrop_dist_index_es6_Private.dispatchDragLeave(this, this._currentTarget, null, event);
            this._finalize('none');
            return;
        }
        // Dispatch the drop event at the current target and finalize
        // with the resulting drop action.
        var action = dragdrop_dist_index_es6_Private.dispatchDrop(this, this._currentTarget, event);
        this._finalize(action);
    };
    /**
     * Handle the `'keydown'` event for the drag object.
     */
    Drag.prototype._evtKeyDown = function (event) {
        // Stop all input events during drag-drop.
        event.preventDefault();
        event.stopPropagation();
        // Cancel the drag if `Escape` is pressed.
        if (event.keyCode === 27) {
            this.dispose();
        }
    };
    /**
     * Add the document event listeners for the drag object.
     */
    Drag.prototype._addListeners = function () {
        document.addEventListener('mousedown', this, true); // <DEPRECATED>
        document.addEventListener('mousemove', this, true); // <DEPRECATED>
        document.addEventListener('mouseup', this, true); // <DEPRECATED>
        document.addEventListener('mouseenter', this, true); // <DEPRECATED>
        document.addEventListener('mouseleave', this, true); // <DEPRECATED>
        document.addEventListener('mouseover', this, true); // <DEPRECATED>
        document.addEventListener('mouseout', this, true); // <DEPRECATED>
        document.addEventListener('pointerdown', this, true);
        document.addEventListener('pointermove', this, true);
        document.addEventListener('pointerup', this, true);
        document.addEventListener('pointerenter', this, true);
        document.addEventListener('pointerleave', this, true);
        document.addEventListener('pointerover', this, true);
        document.addEventListener('pointerout', this, true);
        document.addEventListener('keydown', this, true);
        document.addEventListener('keyup', this, true);
        document.addEventListener('keypress', this, true);
        document.addEventListener('contextmenu', this, true);
    };
    /**
     * Remove the document event listeners for the drag object.
     */
    Drag.prototype._removeListeners = function () {
        document.removeEventListener('mousedown', this, true); // <DEPRECATED>
        document.removeEventListener('mousemove', this, true); // <DEPRECATED>
        document.removeEventListener('mouseup', this, true); // <DEPRECATED>
        document.removeEventListener('mouseenter', this, true); // <DEPRECATED>
        document.removeEventListener('mouseleave', this, true); // <DEPRECATED>
        document.removeEventListener('mouseover', this, true); // <DEPRECATED>
        document.removeEventListener('mouseout', this, true); // <DEPRECATED>
        document.removeEventListener('pointerdown', this, true);
        document.removeEventListener('pointermove', this, true);
        document.removeEventListener('pointerup', this, true);
        document.removeEventListener('pointerenter', this, true);
        document.removeEventListener('pointerleave', this, true);
        document.removeEventListener('pointerover', this, true);
        document.removeEventListener('pointerout', this, true);
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('keyup', this, true);
        document.removeEventListener('keypress', this, true);
        document.removeEventListener('contextmenu', this, true);
    };
    /**
     * Update the drag scroll element under the mouse.
     */
    Drag.prototype._updateDragScroll = function (event) {
        // Find the scroll target under the mouse.
        var target = dragdrop_dist_index_es6_Private.findScrollTarget(event);
        // Bail if there is nothing to scroll.
        if (!this._scrollTarget && !target) {
            return;
        }
        // Start the scroll loop if needed.
        if (!this._scrollTarget) {
            setTimeout(this._onScrollFrame, 500);
        }
        // Update the scroll target.
        this._scrollTarget = target;
    };
    /**
     * Update the current target node using the given mouse event.
     */
    Drag.prototype._updateCurrentTarget = function (event) {
        // Fetch common local state.
        var prevTarget = this._currentTarget;
        var currTarget = this._currentTarget;
        var prevElem = this._currentElement;
        // Find the current indicated element at the given position.
        var currElem = document.elementFromPoint(event.clientX, event.clientY);
        // Update the current element reference.
        this._currentElement = currElem;
        // If the indicated element changes from the previous iteration,
        // and is different from the current target, dispatch the exit
        // event to the target.
        if (currElem !== prevElem && currElem !== currTarget) {
            dragdrop_dist_index_es6_Private.dispatchDragExit(this, currTarget, currElem, event);
        }
        // If the indicated element changes from the previous iteration,
        // and is different from the current target, dispatch the enter
        // event and compute the new target element.
        if (currElem !== prevElem && currElem !== currTarget) {
            currTarget = dragdrop_dist_index_es6_Private.dispatchDragEnter(this, currElem, currTarget, event);
        }
        // If the current target element has changed, update the current
        // target reference and dispatch the leave event to the old target.
        if (currTarget !== prevTarget) {
            this._currentTarget = currTarget;
            dragdrop_dist_index_es6_Private.dispatchDragLeave(this, prevTarget, currTarget, event);
        }
        // Dispatch the drag over event and update the drop action.
        var action = dragdrop_dist_index_es6_Private.dispatchDragOver(this, currTarget, event);
        this._setDropAction(action);
    };
    /**
     * Attach the drag image element at the specified location.
     *
     * This is a no-op if there is no drag image element.
     */
    Drag.prototype._attachDragImage = function (clientX, clientY) {
        if (!this.dragImage) {
            return;
        }
        this.dragImage.classList.add('lm-mod-drag-image');
        /* <DEPRECATED> */
        this.dragImage.classList.add('p-mod-drag-image');
        /* </DEPRECATED> */
        var style = this.dragImage.style;
        style.pointerEvents = 'none';
        style.position = 'fixed';
        style.top = clientY + "px";
        style.left = clientX + "px";
        document.body.appendChild(this.dragImage);
    };
    /**
     * Detach the drag image element from the DOM.
     *
     * This is a no-op if there is no drag image element.
     */
    Drag.prototype._detachDragImage = function () {
        if (!this.dragImage) {
            return;
        }
        var parent = this.dragImage.parentNode;
        if (!parent) {
            return;
        }
        parent.removeChild(this.dragImage);
    };
    /**
     * Set the internal drop action state and update the drag cursor.
     */
    Drag.prototype._setDropAction = function (action) {
        action = dragdrop_dist_index_es6_Private.validateAction(action, this.supportedActions);
        if (this._override && this._dropAction === action) {
            return;
        }
        switch (action) {
            case 'none':
                this._dropAction = action;
                this._override = Drag.overrideCursor('no-drop');
                break;
            case 'copy':
                this._dropAction = action;
                this._override = Drag.overrideCursor('copy');
                break;
            case 'link':
                this._dropAction = action;
                this._override = Drag.overrideCursor('alias');
                break;
            case 'move':
                this._dropAction = action;
                this._override = Drag.overrideCursor('move');
                break;
        }
    };
    /**
     * Finalize the drag operation and resolve the drag promise.
     */
    Drag.prototype._finalize = function (action) {
        // Store the resolve function as a temp variable.
        var resolve = this._resolve;
        // Remove the document event listeners.
        this._removeListeners();
        // Detach the drag image.
        this._detachDragImage();
        // Dispose of the cursor override.
        if (this._override) {
            this._override.dispose();
            this._override = null;
        }
        // Clear the mime data.
        this.mimeData.clear();
        // Clear the rest of the internal drag state.
        this._disposed = true;
        this._dropAction = 'none';
        this._currentTarget = null;
        this._currentElement = null;
        this._scrollTarget = null;
        this._promise = null;
        this._resolve = null;
        // Finally, resolve the promise to the given drop action.
        if (resolve) {
            resolve(action);
        }
    };
    return Drag;
}());
/**
 * The namespace for the `Drag` class statics.
 */
(function (Drag) {
    /**
     * Override the cursor icon for the entire document.
     *
     * @param cursor - The string representing the cursor style.
     *
     * @returns A disposable which will clear the override when disposed.
     *
     * #### Notes
     * The most recent call to `overrideCursor` takes precedence.
     * Disposing an old override has no effect on the current override.
     *
     * This utility function is used by the `Drag` class to override the
     * mouse cursor during a drag-drop operation, but it can also be used
     * by other classes to fix the cursor icon during normal mouse drags.
     *
     * #### Example
     * ```typescript
     * import { Drag } from '@lumino/dragdrop';
     *
     * // Force the cursor to be 'wait' for the entire document.
     * let override = Drag.overrideCursor('wait');
     *
     * // Clear the override by disposing the return value.
     * override.dispose();
     * ```
     */
    function overrideCursor(cursor) {
        var id = ++overrideCursorID;
        document.body.style.cursor = cursor;
        document.body.classList.add('lm-mod-override-cursor');
        /* <DEPRECATED> */
        document.body.classList.add('p-mod-override-cursor');
        /* </DEPRECATED> */
        return new DisposableDelegate(function () {
            if (id === overrideCursorID) {
                document.body.style.cursor = '';
                document.body.classList.remove('lm-mod-override-cursor');
                /* <DEPRECATED> */
                document.body.classList.remove('p-mod-override-cursor');
                /* </DEPRECATED> */
            }
        });
    }
    Drag.overrideCursor = overrideCursor;
    /**
     * The internal id for the active cursor override.
     */
    var overrideCursorID = 0;
})(index_es6_Drag || (index_es6_Drag = {}));
/**
 * The namespace for the module implementation details.
 */
var dragdrop_dist_index_es6_Private;
(function (Private) {
    /**
     * The size of a drag scroll edge, in pixels.
     */
    Private.SCROLL_EDGE_SIZE = 20;
    /**
     * Validate the given action is one of the supported actions.
     *
     * Returns the given action or `'none'` if the action is unsupported.
     */
    function validateAction(action, supported) {
        return actionTable[action] & supportedTable[supported] ? action : 'none';
    }
    Private.validateAction = validateAction;
    /**
     * Create a left mouse event at the given position.
     *
     * @param type - The event type for the mouse event.
     *
     * @param clientX - The client X position.
     *
     * @param clientY - The client Y position.
     *
     * @returns A newly created and initialized mouse event.
     */
    function createMouseEvent(type, clientX, clientY) {
        var event = document.createEvent('MouseEvent');
        event.initMouseEvent(type, true, true, window, 0, 0, 0, clientX, clientY, false, false, false, false, 0, null);
        return event;
    }
    Private.createMouseEvent = createMouseEvent;
    /**
     * Find the drag scroll target under the mouse, if any.
     */
    function findScrollTarget(event) {
        // Look up the client mouse position.
        var x = event.clientX;
        var y = event.clientY;
        // Get the element under the mouse.
        var element = document.elementFromPoint(x, y);
        // Search for a scrollable target based on the mouse position.
        // The null assert in third clause of for-loop is required due to:
        // https://github.com/Microsoft/TypeScript/issues/14143
        for (; element; element = element.parentElement) {
            // Ignore elements which are not marked as scrollable.
            var scrollable = element.hasAttribute('data-lm-dragscroll');
            /* <DEPRECATED> */
            scrollable = scrollable || element.hasAttribute('data-p-dragscroll');
            /* </DEPRECATED> */
            if (!scrollable) {
                continue;
            }
            // Set up the coordinate offsets for the element.
            var offsetX = 0;
            var offsetY = 0;
            if (element === document.body) {
                offsetX = window.pageXOffset;
                offsetY = window.pageYOffset;
            }
            // Get the element bounds in viewport coordinates.
            var r = element.getBoundingClientRect();
            var top_1 = r.top + offsetY;
            var left = r.left + offsetX;
            var right = left + r.width;
            var bottom = top_1 + r.height;
            // Skip the element if it's not under the mouse.
            if (x < left || x >= right || y < top_1 || y >= bottom) {
                continue;
            }
            // Compute the distance to each edge.
            var dl = x - left + 1;
            var dt = y - top_1 + 1;
            var dr = right - x;
            var db = bottom - y;
            // Find the smallest of the edge distances.
            var distance = Math.min(dl, dt, dr, db);
            // Skip the element if the mouse is not within a scroll edge.
            if (distance > Private.SCROLL_EDGE_SIZE) {
                continue;
            }
            // Set up the edge result variable.
            var edge = void 0;
            // Find the edge for the computed distance.
            switch (distance) {
                case db:
                    edge = 'bottom';
                    break;
                case dt:
                    edge = 'top';
                    break;
                case dr:
                    edge = 'right';
                    break;
                case dl:
                    edge = 'left';
                    break;
                default:
                    throw 'unreachable';
            }
            // Compute how much the element can scroll in width and height.
            var dsw = element.scrollWidth - element.clientWidth;
            var dsh = element.scrollHeight - element.clientHeight;
            // Determine if the element should be scrolled for the edge.
            var shouldScroll = void 0;
            switch (edge) {
                case 'top':
                    shouldScroll = dsh > 0 && element.scrollTop > 0;
                    break;
                case 'left':
                    shouldScroll = dsw > 0 && element.scrollLeft > 0;
                    break;
                case 'right':
                    shouldScroll = dsw > 0 && element.scrollLeft < dsw;
                    break;
                case 'bottom':
                    shouldScroll = dsh > 0 && element.scrollTop < dsh;
                    break;
                default:
                    throw 'unreachable';
            }
            // Skip the element if it should not be scrolled.
            if (!shouldScroll) {
                continue;
            }
            // Return the drag scroll target.
            return { element: element, edge: edge, distance: distance };
        }
        // No drag scroll target was found.
        return null;
    }
    Private.findScrollTarget = findScrollTarget;
    /**
     * Dispatch a drag enter event to the indicated element.
     *
     * @param drag - The drag object associated with the action.
     *
     * @param currElem - The currently indicated element, or `null`. This
     *   is the "immediate user selection" from the whatwg spec.
     *
     * @param currTarget - The current drag target element, or `null`. This
     *   is the "current target element" from the whatwg spec.
     *
     * @param event - The mouse event related to the action.
     *
     * @returns The element to use as the current drag target. This is the
     *   "current target element" from the whatwg spec, and may be `null`.
     *
     * #### Notes
     * This largely implements the drag enter portion of the whatwg spec:
     * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model
     */
    function dispatchDragEnter(drag, currElem, currTarget, event) {
        // If the current element is null, return null as the new target.
        if (!currElem) {
            return null;
        }
        // Dispatch a drag enter event to the current element.
        var dragEvent = createDragEvent('lm-dragenter', drag, event, currTarget);
        var canceled = !currElem.dispatchEvent(dragEvent);
        // If the event was canceled, use the current element as the new target.
        if (canceled) {
            return currElem;
        }
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-dragenter', drag, event, currTarget);
        canceled = !currElem.dispatchEvent(dragEvent);
        if (canceled) {
            return currElem;
        }
        /* </DEPRECATED> */
        // If the current element is the document body, keep the original target.
        if (currElem === document.body) {
            return currTarget;
        }
        // Dispatch a drag enter event on the document body.
        dragEvent = createDragEvent('lm-dragenter', drag, event, currTarget);
        document.body.dispatchEvent(dragEvent);
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-dragenter', drag, event, currTarget);
        document.body.dispatchEvent(dragEvent);
        /* </DEPRECATED> */
        // Ignore the event cancellation, and use the body as the new target.
        return document.body;
    }
    Private.dispatchDragEnter = dispatchDragEnter;
    /**
     * Dispatch a drag exit event to the indicated element.
     *
     * @param drag - The drag object associated with the action.
     *
     * @param prevTarget - The previous target element, or `null`. This
     *   is the previous "current target element" from the whatwg spec.
     *
     * @param currTarget - The current drag target element, or `null`. This
     *   is the "current target element" from the whatwg spec.
     *
     * @param event - The mouse event related to the action.
     *
     * #### Notes
     * This largely implements the drag exit portion of the whatwg spec:
     * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model
     */
    function dispatchDragExit(drag, prevTarget, currTarget, event) {
        // If the previous target is null, do nothing.
        if (!prevTarget) {
            return;
        }
        // Dispatch the drag exit event to the previous target.
        var dragEvent = createDragEvent('lm-dragexit', drag, event, currTarget);
        prevTarget.dispatchEvent(dragEvent);
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-dragexit', drag, event, currTarget);
        prevTarget.dispatchEvent(dragEvent);
        /* </DEPRECATED> */
    }
    Private.dispatchDragExit = dispatchDragExit;
    /**
     * Dispatch a drag leave event to the indicated element.
     *
     * @param drag - The drag object associated with the action.
     *
     * @param prevTarget - The previous target element, or `null`. This
     *   is the previous "current target element" from the whatwg spec.
     *
     * @param currTarget - The current drag target element, or `null`. This
     *   is the "current target element" from the whatwg spec.
     *
     * @param event - The mouse event related to the action.
     *
     * #### Notes
     * This largely implements the drag leave portion of the whatwg spec:
     * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model
     */
    function dispatchDragLeave(drag, prevTarget, currTarget, event) {
        // If the previous target is null, do nothing.
        if (!prevTarget) {
            return;
        }
        // Dispatch the drag leave event to the previous target.
        var dragEvent = createDragEvent('lm-dragleave', drag, event, currTarget);
        prevTarget.dispatchEvent(dragEvent);
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-dragleave', drag, event, currTarget);
        prevTarget.dispatchEvent(dragEvent);
        /* </DEPRECATED> */
    }
    Private.dispatchDragLeave = dispatchDragLeave;
    /**
     * Dispatch a drag over event to the indicated element.
     *
     * @param drag - The drag object associated with the action.
     *
     * @param currTarget - The current drag target element, or `null`. This
     *   is the "current target element" from the whatwg spec.
     *
     * @param event - The mouse event related to the action.
     *
     * @returns The `DropAction` result of the drag over event.
     *
     * #### Notes
     * This largely implements the drag over portion of the whatwg spec:
     * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model
     */
    function dispatchDragOver(drag, currTarget, event) {
        // If there is no current target, the drop action is none.
        if (!currTarget) {
            return 'none';
        }
        // Dispatch the drag over event to the current target.
        var dragEvent = createDragEvent('lm-dragover', drag, event, null);
        var canceled = !currTarget.dispatchEvent(dragEvent);
        // If the event was canceled, return the drop action result.
        if (canceled) {
            return dragEvent.dropAction;
        }
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-dragover', drag, event, null);
        canceled = !currTarget.dispatchEvent(dragEvent);
        if (canceled) {
            return dragEvent.dropAction;
        }
        /* </DEPRECATED> */
        // Otherwise, the effective drop action is none.
        return 'none';
    }
    Private.dispatchDragOver = dispatchDragOver;
    /**
     * Dispatch a drop event to the indicated element.
     *
     * @param drag - The drag object associated with the action.
     *
     * @param currTarget - The current drag target element, or `null`. This
     *   is the "current target element" from the whatwg spec.
     *
     * @param event - The mouse event related to the action.
     *
     * @returns The `DropAction` result of the drop event.
     *
     * #### Notes
     * This largely implements the drag over portion of the whatwg spec:
     * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model
     */
    function dispatchDrop(drag, currTarget, event) {
        // If there is no current target, the drop action is none.
        if (!currTarget) {
            return 'none';
        }
        // Dispatch the drop event to the current target.
        var dragEvent = createDragEvent('lm-drop', drag, event, null);
        var canceled = !currTarget.dispatchEvent(dragEvent);
        // If the event was canceled, return the drop action result.
        if (canceled) {
            return dragEvent.dropAction;
        }
        /* <DEPRECATED> */
        dragEvent = createDragEvent('p-drop', drag, event, null);
        canceled = !currTarget.dispatchEvent(dragEvent);
        if (canceled) {
            return dragEvent.dropAction;
        }
        /* </DEPRECATED> */
        // Otherwise, the effective drop action is none.
        return 'none';
    }
    Private.dispatchDrop = dispatchDrop;
    /**
     * A lookup table from drop action to bit value.
     */
    var actionTable = {
        none: 0x0,
        copy: 0x1,
        link: 0x2,
        move: 0x4
    };
    /**
     * A lookup table from supported action to drop action bit mask.
     */
    var supportedTable = {
        none: actionTable['none'],
        copy: actionTable['copy'],
        link: actionTable['link'],
        move: actionTable['move'],
        'copy-link': actionTable['copy'] | actionTable['link'],
        'copy-move': actionTable['copy'] | actionTable['move'],
        'link-move': actionTable['link'] | actionTable['move'],
        all: actionTable['copy'] | actionTable['link'] | actionTable['move']
    };
    /**
     * Create a new initialized `IDragEvent` from the given data.
     *
     * @param type - The event type for the drag event.
     *
     * @param drag - The drag object to use for seeding the drag data.
     *
     * @param event - The mouse event to use for seeding the mouse data.
     *
     * @param related - The related target for the event, or `null`.
     *
     * @returns A new object which implements `IDragEvent`.
     */
    function createDragEvent(type, drag, event, related) {
        // Create a new mouse event to use as the drag event. Currently,
        // JS engines do now allow user-defined Event subclasses.
        var dragEvent = document.createEvent('MouseEvent');
        // Initialize the mouse event data.
        dragEvent.initMouseEvent(type, true, true, window, 0, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, related);
        // Forcefully add the custom drag event properties.
        dragEvent.dropAction = 'none';
        dragEvent.mimeData = drag.mimeData;
        dragEvent.proposedAction = drag.proposedAction;
        dragEvent.supportedActions = drag.supportedActions;
        dragEvent.source = drag.source;
        // Return the fully initialized drag event.
        return dragEvent;
    }
})(dragdrop_dist_index_es6_Private || (dragdrop_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/keyboard/dist/index.es6.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * Get the global application keyboard layout instance.
 *
 * @returns The keyboard layout for use by the application.
 *
 * #### Notes
 * The default keyboard layout is US-English.
 */
function getKeyboardLayout() {
    return keyboard_dist_index_es6_Private.keyboardLayout;
}
/**
 * Set the global application keyboard layout instance.
 *
 * @param - The keyboard layout for use by the application.
 *
 * #### Notes
 * The keyboard layout should typically be set on application startup
 * to a layout which is appropriate for the user's system.
 */
function setKeyboardLayout(layout) {
    keyboard_dist_index_es6_Private.keyboardLayout = layout;
}
/**
 * A concrete implementation of [[IKeyboardLayout]] based on keycodes.
 *
 * The `keyCode` property of a `'keydown'` event is a browser and OS
 * specific representation of the physical key (not character) which
 * was pressed on a keyboard. While not the most convenient API, it
 * is currently the only one which works reliably on all browsers.
 *
 * This class accepts a user-defined mapping of keycode to key, which
 * allows for reliable shortcuts tailored to the user's system.
 */
var KeycodeLayout = /** @class */ (function () {
    /**
     * Construct a new keycode layout.
     *
     * @param name - The human readable name for the layout.
     *
     * @param codes - A mapping of keycode to key value.
     */
    function KeycodeLayout(name, codes) {
        this.name = name;
        this._codes = codes;
        this._keys = KeycodeLayout.extractKeys(codes);
    }
    /**
     * Get an array of the key values supported by the layout.
     *
     * @returns A new array of the supported key values.
     */
    KeycodeLayout.prototype.keys = function () {
        return Object.keys(this._keys);
    };
    /**
     * Test whether the given key is a valid value for the layout.
     *
     * @param key - The user provided key to test for validity.
     *
     * @returns `true` if the key is valid, `false` otherwise.
     */
    KeycodeLayout.prototype.isValidKey = function (key) {
        return key in this._keys;
    };
    /**
     * Get the key for a `'keydown'` event.
     *
     * @param event - The event object for a `'keydown'` event.
     *
     * @returns The associated key value, or an empty string if
     *   the event does not represent a valid primary key.
     */
    KeycodeLayout.prototype.keyForKeydownEvent = function (event) {
        return this._codes[event.keyCode] || '';
    };
    return KeycodeLayout;
}());
/**
 * The namespace for the `KeycodeLayout` class statics.
 */
(function (KeycodeLayout) {
    /**
     * Extract the set of keys from a code map.
     *
     * @param code - The code map of interest.
     *
     * @returns A set of the keys in the code map.
     */
    function extractKeys(codes) {
        var keys = Object.create(null);
        for (var c in codes) {
            keys[codes[c]] = true;
        }
        return keys;
    }
    KeycodeLayout.extractKeys = extractKeys;
})(KeycodeLayout || (KeycodeLayout = {}));
/**
 * A keycode-based keyboard layout for US English keyboards.
 *
 * This layout is valid for the following OS/Browser combinations.
 *
 * - Windows
 *   - Chrome
 *   - Firefox
 *   - IE
 *
 * - OSX
 *   - Chrome
 *   - Firefox
 *   - Safari
 *
 * - Linux
 *   - Chrome
 *   - Firefox
 *
 * Other combinations may also work, but are untested.
 */
var EN_US = new KeycodeLayout('en-us', {
    8: 'Backspace',
    9: 'Tab',
    13: 'Enter',
    19: 'Pause',
    27: 'Escape',
    32: 'Space',
    33: 'PageUp',
    34: 'PageDown',
    35: 'End',
    36: 'Home',
    37: 'ArrowLeft',
    38: 'ArrowUp',
    39: 'ArrowRight',
    40: 'ArrowDown',
    45: 'Insert',
    46: 'Delete',
    48: '0',
    49: '1',
    50: '2',
    51: '3',
    52: '4',
    53: '5',
    54: '6',
    55: '7',
    56: '8',
    57: '9',
    59: ';',
    61: '=',
    65: 'A',
    66: 'B',
    67: 'C',
    68: 'D',
    69: 'E',
    70: 'F',
    71: 'G',
    72: 'H',
    73: 'I',
    74: 'J',
    75: 'K',
    76: 'L',
    77: 'M',
    78: 'N',
    79: 'O',
    80: 'P',
    81: 'Q',
    82: 'R',
    83: 'S',
    84: 'T',
    85: 'U',
    86: 'V',
    87: 'W',
    88: 'X',
    89: 'Y',
    90: 'Z',
    93: 'ContextMenu',
    96: '0',
    97: '1',
    98: '2',
    99: '3',
    100: '4',
    101: '5',
    102: '6',
    103: '7',
    104: '8',
    105: '9',
    106: '*',
    107: '+',
    109: '-',
    110: '.',
    111: '/',
    112: 'F1',
    113: 'F2',
    114: 'F3',
    115: 'F4',
    116: 'F5',
    117: 'F6',
    118: 'F7',
    119: 'F8',
    120: 'F9',
    121: 'F10',
    122: 'F11',
    123: 'F12',
    173: '-',
    186: ';',
    187: '=',
    188: ',',
    189: '-',
    190: '.',
    191: '/',
    192: '`',
    219: '[',
    220: '\\',
    221: ']',
    222: "'"
});
/**
 * The namespace for the module implementation details.
 */
var keyboard_dist_index_es6_Private;
(function (Private) {
    /**
     * The global keyboard layout instance.
     */
    Private.keyboardLayout = EN_US;
})(keyboard_dist_index_es6_Private || (keyboard_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/commands/dist/index.es6.js







// Copyright (c) Jupyter Development Team.
/**
 * An object which manages a collection of commands.
 *
 * #### Notes
 * A command registry can be used to populate a variety of action-based
 * widgets, such as command palettes, menus, and toolbars.
 */
var index_es6_CommandRegistry = /** @class */ (function () {
    function CommandRegistry() {
        this._timerID = 0;
        this._replaying = false;
        this._keystrokes = [];
        this._keydownEvents = [];
        this._keyBindings = [];
        this._exactKeyMatch = null;
        this._commands = Object.create(null);
        this._commandChanged = new Signal(this);
        this._commandExecuted = new Signal(this);
        this._keyBindingChanged = new Signal(this);
    }
    Object.defineProperty(CommandRegistry.prototype, "commandChanged", {
        /**
         * A signal emitted when a command has changed.
         *
         * #### Notes
         * This signal is useful for visual representations of commands which
         * need to refresh when the state of a relevant command has changed.
         */
        get: function () {
            return this._commandChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandRegistry.prototype, "commandExecuted", {
        /**
         * A signal emitted when a command has executed.
         *
         * #### Notes
         * Care should be taken when consuming this signal. The command system is used
         * by many components for many user actions. Handlers registered with this
         * signal must return quickly to ensure the overall application remains responsive.
         */
        get: function () {
            return this._commandExecuted;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandRegistry.prototype, "keyBindingChanged", {
        /**
         * A signal emitted when a key binding is changed.
         */
        get: function () {
            return this._keyBindingChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandRegistry.prototype, "keyBindings", {
        /**
         * A read-only array of the key bindings in the registry.
         */
        get: function () {
            return this._keyBindings;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * List the ids of the registered commands.
     *
     * @returns A new array of the registered command ids.
     */
    CommandRegistry.prototype.listCommands = function () {
        return Object.keys(this._commands);
    };
    /**
     * Test whether a specific command is registered.
     *
     * @param id - The id of the command of interest.
     *
     * @returns `true` if the command is registered, `false` otherwise.
     */
    CommandRegistry.prototype.hasCommand = function (id) {
        return id in this._commands;
    };
    /**
     * Add a command to the registry.
     *
     * @param id - The unique id of the command.
     *
     * @param options - The options for the command.
     *
     * @returns A disposable which will remove the command.
     *
     * @throws An error if the given `id` is already registered.
     */
    CommandRegistry.prototype.addCommand = function (id, options) {
        var _this = this;
        // Throw an error if the id is already registered.
        if (id in this._commands) {
            throw new Error("Command '" + id + "' already registered.");
        }
        // Add the command to the registry.
        this._commands[id] = commands_dist_index_es6_Private.createCommand(options);
        // Emit the `commandChanged` signal.
        this._commandChanged.emit({ id: id, type: 'added' });
        // Return a disposable which will remove the command.
        return new DisposableDelegate(function () {
            // Remove the command from the registry.
            delete _this._commands[id];
            // Emit the `commandChanged` signal.
            _this._commandChanged.emit({ id: id, type: 'removed' });
        });
    };
    /**
     * Notify listeners that the state of a command has changed.
     *
     * @param id - The id of the command which has changed. If more than
     *   one command has changed, this argument should be omitted.
     *
     * @throws An error if the given `id` is not registered.
     *
     * #### Notes
     * This method should be called by the command author whenever the
     * application state changes such that the results of the command
     * metadata functions may have changed.
     *
     * This will cause the `commandChanged` signal to be emitted.
     */
    CommandRegistry.prototype.notifyCommandChanged = function (id) {
        if (id !== undefined && !(id in this._commands)) {
            throw new Error("Command '" + id + "' is not registered.");
        }
        this._commandChanged.emit({ id: id, type: id ? 'changed' : 'many-changed' });
    };
    /**
     * Get the display label for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The display label for the command, or an empty string
     *   if the command is not registered.
     */
    CommandRegistry.prototype.label = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.label.call(undefined, args) : '';
    };
    /**
     * Get the mnemonic index for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The mnemonic index for the command, or `-1` if the
     *   command is not registered.
     */
    CommandRegistry.prototype.mnemonic = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.mnemonic.call(undefined, args) : -1;
    };
    /**
     * Get the icon renderer for a specific command.
     *
     * DEPRECATED: if set to a string value, the .icon field will
     * function as an alias for the .iconClass field, for backwards
     * compatibility. In the future when this is removed, the default
     * return type will become undefined.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The icon renderer for the command, or
     *   an empty string if the command is not registered.
     */
    CommandRegistry.prototype.icon = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd
            ? cmd.icon.call(undefined, args)
            : /* <DEPRECATED> */ '' /* </DEPRECATED> */ /* <FUTURE> undefined </FUTURE> */;
    };
    /**
     * Get the icon class for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The icon class for the command, or an empty string if
     *   the command is not registered.
     */
    CommandRegistry.prototype.iconClass = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.iconClass.call(undefined, args) : '';
    };
    /**
     * Get the icon label for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The icon label for the command, or an empty string if
     *   the command is not registered.
     */
    CommandRegistry.prototype.iconLabel = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.iconLabel.call(undefined, args) : '';
    };
    /**
     * Get the short form caption for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The caption for the command, or an empty string if the
     *   command is not registered.
     */
    CommandRegistry.prototype.caption = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.caption.call(undefined, args) : '';
    };
    /**
     * Get the usage help text for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The usage text for the command, or an empty string if
     *   the command is not registered.
     */
    CommandRegistry.prototype.usage = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.usage.call(undefined, args) : '';
    };
    /**
     * Get the extra class name for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The class name for the command, or an empty string if
     *   the command is not registered.
     */
    CommandRegistry.prototype.className = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.className.call(undefined, args) : '';
    };
    /**
     * Get the dataset for a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns The dataset for the command, or an empty dataset if
     *   the command is not registered.
     */
    CommandRegistry.prototype.dataset = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.dataset.call(undefined, args) : {};
    };
    /**
     * Test whether a specific command is enabled.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns A boolean indicating whether the command is enabled,
     *   or `false` if the command is not registered.
     */
    CommandRegistry.prototype.isEnabled = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.isEnabled.call(undefined, args) : false;
    };
    /**
     * Test whether a specific command is toggled.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns A boolean indicating whether the command is toggled,
     *   or `false` if the command is not registered.
     */
    CommandRegistry.prototype.isToggled = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.isToggled.call(undefined, args) : false;
    };
    /**
     * Test whether a specific command is toggleable.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns A boolean indicating whether the command is toggleable,
     *   or `false` if the command is not registered.
     */
    CommandRegistry.prototype.isToggleable = function (id, args) {
        var cmd = this._commands[id];
        return cmd ? cmd.isToggleable : false;
    };
    /**
     * Test whether a specific command is visible.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns A boolean indicating whether the command is visible,
     *   or `false` if the command is not registered.
     */
    CommandRegistry.prototype.isVisible = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        var cmd = this._commands[id];
        return cmd ? cmd.isVisible.call(undefined, args) : false;
    };
    /**
     * Execute a specific command.
     *
     * @param id - The id of the command of interest.
     *
     * @param args - The arguments for the command.
     *
     * @returns A promise which resolves with the result of the command.
     *
     * #### Notes
     * The promise will reject if the command throws an exception,
     * or if the command is not registered.
     */
    CommandRegistry.prototype.execute = function (id, args) {
        if (args === void 0) { args = JSONExt.emptyObject; }
        // Reject if the command is not registered.
        var cmd = this._commands[id];
        if (!cmd) {
            return Promise.reject(new Error("Command '" + id + "' not registered."));
        }
        // Execute the command and reject if an exception is thrown.
        var value;
        try {
            value = cmd.execute.call(undefined, args);
        }
        catch (err) {
            value = Promise.reject(err);
        }
        // Create the return promise which resolves the result.
        var result = Promise.resolve(value);
        // Emit the command executed signal.
        this._commandExecuted.emit({ id: id, args: args, result: result });
        // Return the result promise to the caller.
        return result;
    };
    /**
     * Add a key binding to the registry.
     *
     * @param options - The options for creating the key binding.
     *
     * @returns A disposable which removes the added key binding.
     *
     * #### Notes
     * If multiple key bindings are registered for the same sequence, the
     * binding with the highest selector specificity is executed first. A
     * tie is broken by using the most recently added key binding.
     *
     * Ambiguous key bindings are resolved with a timeout. As an example,
     * suppose two key bindings are registered: one with the key sequence
     * `['Ctrl D']`, and another with `['Ctrl D', 'Ctrl W']`. If the user
     * presses `Ctrl D`, the first binding cannot be immediately executed
     * since the user may intend to complete the chord with `Ctrl W`. For
     * such cases, a timer is used to allow the chord to be completed. If
     * the chord is not completed before the timeout, the first binding
     * is executed.
     */
    CommandRegistry.prototype.addKeyBinding = function (options) {
        var _this = this;
        // Create the binding for the given options.
        var binding = commands_dist_index_es6_Private.createKeyBinding(options);
        // Add the key binding to the bindings array.
        this._keyBindings.push(binding);
        // Emit the `bindingChanged` signal.
        this._keyBindingChanged.emit({ binding: binding, type: 'added' });
        // Return a disposable which will remove the binding.
        return new DisposableDelegate(function () {
            // Remove the binding from the array.
            ArrayExt.removeFirstOf(_this._keyBindings, binding);
            // Emit the `bindingChanged` signal.
            _this._keyBindingChanged.emit({ binding: binding, type: 'removed' });
        });
    };
    /**
     * Process a `'keydown'` event and invoke a matching key binding.
     *
     * @param event - The event object for a `'keydown'` event.
     *
     * #### Notes
     * This should be called in response to a `'keydown'` event in order
     * to invoke the command for the best matching key binding.
     *
     * The registry **does not** install its own listener for `'keydown'`
     * events. This allows the application full control over the nodes
     * and phase for which the registry processes `'keydown'` events.
     *
     * When the keydown event is processed, if the event target or any of its
     * ancestor nodes has a `data-lm-suppress-shortcuts` attribute, its keydown
     * events will not invoke commands.
     */
    CommandRegistry.prototype.processKeydownEvent = function (event) {
        // Bail immediately if playing back keystrokes.
        if (this._replaying) {
            return;
        }
        // Get the normalized keystroke for the event.
        var keystroke = CommandRegistry.keystrokeForKeydownEvent(event);
        // If the keystroke is not valid for the keyboard layout, replay
        // any suppressed events and clear the pending state.
        if (!keystroke) {
            this._replayKeydownEvents();
            this._clearPendingState();
            return;
        }
        // Add the keystroke to the current key sequence.
        this._keystrokes.push(keystroke);
        // Find the exact and partial matches for the key sequence.
        var _a = commands_dist_index_es6_Private.matchKeyBinding(this._keyBindings, this._keystrokes, event), exact = _a.exact, partial = _a.partial;
        // If there is no exact match and no partial match, replay
        // any suppressed events and clear the pending state.
        if (!exact && !partial) {
            this._replayKeydownEvents();
            this._clearPendingState();
            return;
        }
        // Stop propagation of the event. If there is only a partial match,
        // the event will be replayed if a final exact match never occurs.
        event.preventDefault();
        event.stopPropagation();
        // If there is an exact match but no partial match, the exact match
        // can be dispatched immediately. The pending state is cleared so
        // the next key press starts from the default state.
        if (exact && !partial) {
            this._executeKeyBinding(exact);
            this._clearPendingState();
            return;
        }
        // If there is both an exact match and a partial match, the exact
        // match is stored for future dispatch in case the timer expires
        // before a more specific match is triggered.
        if (exact) {
            this._exactKeyMatch = exact;
        }
        // Store the event for possible playback in the future.
        this._keydownEvents.push(event);
        // (Re)start the timer to dispatch the most recent exact match
        // in case the partial match fails to result in an exact match.
        this._startTimer();
    };
    /**
     * Start or restart the pending timeout.
     */
    CommandRegistry.prototype._startTimer = function () {
        var _this = this;
        this._clearTimer();
        this._timerID = window.setTimeout(function () {
            _this._onPendingTimeout();
        }, commands_dist_index_es6_Private.CHORD_TIMEOUT);
    };
    /**
     * Clear the pending timeout.
     */
    CommandRegistry.prototype._clearTimer = function () {
        if (this._timerID !== 0) {
            clearTimeout(this._timerID);
            this._timerID = 0;
        }
    };
    /**
     * Replay the keydown events which were suppressed.
     */
    CommandRegistry.prototype._replayKeydownEvents = function () {
        if (this._keydownEvents.length === 0) {
            return;
        }
        this._replaying = true;
        this._keydownEvents.forEach(commands_dist_index_es6_Private.replayKeyEvent);
        this._replaying = false;
    };
    /**
     * Execute the command for the given key binding.
     *
     * If the command is missing or disabled, a warning will be logged.
     */
    CommandRegistry.prototype._executeKeyBinding = function (binding) {
        var command = binding.command, args = binding.args;
        if (!this.hasCommand(command) || !this.isEnabled(command, args)) {
            var word = this.hasCommand(command) ? 'enabled' : 'registered';
            var keys = binding.keys.join(', ');
            var msg1 = "Cannot execute key binding '" + keys + "':";
            var msg2 = "command '" + command + "' is not " + word + ".";
            console.warn(msg1 + " " + msg2);
            return;
        }
        this.execute(command, args);
    };
    /**
     * Clear the internal pending state.
     */
    CommandRegistry.prototype._clearPendingState = function () {
        this._clearTimer();
        this._exactKeyMatch = null;
        this._keystrokes.length = 0;
        this._keydownEvents.length = 0;
    };
    /**
     * Handle the partial match timeout.
     */
    CommandRegistry.prototype._onPendingTimeout = function () {
        this._timerID = 0;
        if (this._exactKeyMatch) {
            this._executeKeyBinding(this._exactKeyMatch);
        }
        else {
            this._replayKeydownEvents();
        }
        this._clearPendingState();
    };
    return CommandRegistry;
}());
/**
 * The namespace for the `CommandRegistry` class statics.
 */
(function (CommandRegistry) {
    /**
     * Parse a keystroke into its constituent components.
     *
     * @param keystroke - The keystroke of interest.
     *
     * @returns The parsed components of the keystroke.
     *
     * #### Notes
     * The keystroke should be of the form:
     *   `[<modifier 1> [<modifier 2> [<modifier N> ]]]<primary key>`
     *
     * The supported modifiers are: `Accel`, `Alt`, `Cmd`, `Ctrl`, and
     * `Shift`. The `Accel` modifier is translated to `Cmd` on Mac and
     * `Ctrl` on all other platforms.
     *
     * The parsing is tolerant and will not throw exceptions. Notably:
     *   - Duplicate modifiers are ignored.
     *   - Extra primary keys are ignored.
     *   - The order of modifiers and primary key is irrelevant.
     *   - The keystroke parts should be separated by whitespace.
     *   - The keystroke is case sensitive.
     */
    function parseKeystroke(keystroke) {
        var key = '';
        var alt = false;
        var cmd = false;
        var ctrl = false;
        var shift = false;
        for (var _i = 0, _a = keystroke.split(/\s+/); _i < _a.length; _i++) {
            var token = _a[_i];
            if (token === 'Accel') {
                if (Platform.IS_MAC) {
                    cmd = true;
                }
                else {
                    ctrl = true;
                }
            }
            else if (token === 'Alt') {
                alt = true;
            }
            else if (token === 'Cmd') {
                cmd = true;
            }
            else if (token === 'Ctrl') {
                ctrl = true;
            }
            else if (token === 'Shift') {
                shift = true;
            }
            else if (token.length > 0) {
                key = token;
            }
        }
        return { cmd: cmd, ctrl: ctrl, alt: alt, shift: shift, key: key };
    }
    CommandRegistry.parseKeystroke = parseKeystroke;
    /**
     * Normalize a keystroke into a canonical representation.
     *
     * @param keystroke - The keystroke of interest.
     *
     * @returns The normalized representation of the keystroke.
     *
     * #### Notes
     * This normalizes the keystroke by removing duplicate modifiers and
     * extra primary keys, and assembling the parts in a canonical order.
     *
     * The `Cmd` modifier is ignored on non-Mac platforms.
     */
    function normalizeKeystroke(keystroke) {
        var mods = '';
        var parts = parseKeystroke(keystroke);
        if (parts.ctrl) {
            mods += 'Ctrl ';
        }
        if (parts.alt) {
            mods += 'Alt ';
        }
        if (parts.shift) {
            mods += 'Shift ';
        }
        if (parts.cmd && Platform.IS_MAC) {
            mods += 'Cmd ';
        }
        return mods + parts.key;
    }
    CommandRegistry.normalizeKeystroke = normalizeKeystroke;
    /**
     * Get the platform-specific normalized keys for an options object.
     *
     * @param options - The options for the key binding.
     *
     * @returns Array of combined, normalized keys.
     */
    function normalizeKeys(options) {
        var keys;
        if (Platform.IS_WIN) {
            keys = options.winKeys || options.keys;
        }
        else if (Platform.IS_MAC) {
            keys = options.macKeys || options.keys;
        }
        else {
            keys = options.linuxKeys || options.keys;
        }
        return keys.map(normalizeKeystroke);
    }
    CommandRegistry.normalizeKeys = normalizeKeys;
    /**
     * Format a keystroke for display on the local system.
     */
    function formatKeystroke(keystroke) {
        var mods = '';
        var parts = parseKeystroke(keystroke);
        if (Platform.IS_MAC) {
            if (parts.ctrl) {
                mods += '\u2303 ';
            }
            if (parts.alt) {
                mods += '\u2325 ';
            }
            if (parts.shift) {
                mods += '\u21E7 ';
            }
            if (parts.cmd) {
                mods += '\u2318 ';
            }
        }
        else {
            if (parts.ctrl) {
                mods += 'Ctrl+';
            }
            if (parts.alt) {
                mods += 'Alt+';
            }
            if (parts.shift) {
                mods += 'Shift+';
            }
        }
        return mods + parts.key;
    }
    CommandRegistry.formatKeystroke = formatKeystroke;
    /**
     * Create a normalized keystroke for a `'keydown'` event.
     *
     * @param event - The event object for a `'keydown'` event.
     *
     * @returns A normalized keystroke, or an empty string if the event
     *   does not represent a valid keystroke for the given layout.
     */
    function keystrokeForKeydownEvent(event) {
        var key = getKeyboardLayout().keyForKeydownEvent(event);
        if (!key) {
            return '';
        }
        var mods = '';
        if (event.ctrlKey) {
            mods += 'Ctrl ';
        }
        if (event.altKey) {
            mods += 'Alt ';
        }
        if (event.shiftKey) {
            mods += 'Shift ';
        }
        if (event.metaKey && Platform.IS_MAC) {
            mods += 'Cmd ';
        }
        return mods + key;
    }
    CommandRegistry.keystrokeForKeydownEvent = keystrokeForKeydownEvent;
})(index_es6_CommandRegistry || (index_es6_CommandRegistry = {}));
/**
 * The namespace for the module implementation details.
 */
var commands_dist_index_es6_Private;
(function (Private) {
    /**
     * The timeout in ms for triggering a key binding chord.
     */
    Private.CHORD_TIMEOUT = 1000;
    /**
     * Create a normalized command from an options object.
     */
    function createCommand(options) {
        var icon;
        var iconClass;
        /* <DEPRECATED> */
        if (!options.icon || typeof options.icon === 'string') {
            // alias icon to iconClass
            iconClass = asFunc(options.iconClass || options.icon, emptyStringFunc);
            icon = iconClass;
        }
        else {
            /* /<DEPRECATED> */
            iconClass = asFunc(options.iconClass, emptyStringFunc);
            icon = asFunc(options.icon, undefinedFunc);
            /* <DEPRECATED> */
        }
        /* </DEPRECATED> */
        return {
            execute: options.execute,
            label: asFunc(options.label, emptyStringFunc),
            mnemonic: asFunc(options.mnemonic, negativeOneFunc),
            icon: icon,
            iconClass: iconClass,
            iconLabel: asFunc(options.iconLabel, emptyStringFunc),
            caption: asFunc(options.caption, emptyStringFunc),
            usage: asFunc(options.usage, emptyStringFunc),
            className: asFunc(options.className, emptyStringFunc),
            dataset: asFunc(options.dataset, emptyDatasetFunc),
            isEnabled: options.isEnabled || trueFunc,
            isToggled: options.isToggled || falseFunc,
            isToggleable: options.isToggleable || !!options.isToggled,
            isVisible: options.isVisible || trueFunc
        };
    }
    Private.createCommand = createCommand;
    /**
     * Create a key binding object from key binding options.
     */
    function createKeyBinding(options) {
        return {
            keys: index_es6_CommandRegistry.normalizeKeys(options),
            selector: validateSelector(options),
            command: options.command,
            args: options.args || JSONExt.emptyObject
        };
    }
    Private.createKeyBinding = createKeyBinding;
    /**
     * Find the key bindings which match a key sequence.
     *
     * This returns a match result which contains the best exact matching
     * binding, and a flag which indicates if there are partial matches.
     */
    function matchKeyBinding(bindings, keys, event) {
        // The current best exact match.
        var exact = null;
        // Whether a partial match has been found.
        var partial = false;
        // The match distance for the exact match.
        var distance = Infinity;
        // The specificity for the exact match.
        var specificity = 0;
        // Iterate over the bindings and search for the best match.
        for (var i = 0, n = bindings.length; i < n; ++i) {
            // Lookup the current binding.
            var binding = bindings[i];
            // Check whether the key binding sequence is a match.
            var sqm = matchSequence(binding.keys, keys);
            // If there is no match, the binding is ignored.
            if (sqm === 0 /* None */) {
                continue;
            }
            // If it is a partial match and no other partial match has been
            // found, ensure the selector matches and set the partial flag.
            if (sqm === 2 /* Partial */) {
                if (!partial && targetDistance(binding.selector, event) !== -1) {
                    partial = true;
                }
                continue;
            }
            // Ignore the match if the selector doesn't match, or if the
            // matched node is farther away than the current best match.
            var td = targetDistance(binding.selector, event);
            if (td === -1 || td > distance) {
                continue;
            }
            // Get the specificity for the selector.
            var sp = Selector.calculateSpecificity(binding.selector);
            // Update the best match if this match is stronger.
            if (!exact || td < distance || sp >= specificity) {
                exact = binding;
                distance = td;
                specificity = sp;
            }
        }
        // Return the match result.
        return { exact: exact, partial: partial };
    }
    Private.matchKeyBinding = matchKeyBinding;
    /**
     * Replay a keyboard event.
     *
     * This synthetically dispatches a clone of the keyboard event.
     */
    function replayKeyEvent(event) {
        event.target.dispatchEvent(cloneKeyboardEvent(event));
    }
    Private.replayKeyEvent = replayKeyEvent;
    /**
     * A singleton empty string function.
     */
    var emptyStringFunc = function () { return ''; };
    /**
     * A singleton `-1` number function
     */
    var negativeOneFunc = function () { return -1; };
    /**
     * A singleton true boolean function.
     */
    var trueFunc = function () { return true; };
    /**
     * A singleton false boolean function.
     */
    var falseFunc = function () { return false; };
    /**
     * A singleton empty dataset function.
     */
    var emptyDatasetFunc = function () { return ({}); };
    /**
     * A singleton undefined function
     */
    var undefinedFunc = function () { return undefined; };
    /**
     * Cast a value or command func to a command func.
     */
    function asFunc(value, dfault) {
        if (value === undefined) {
            return dfault;
        }
        if (typeof value === 'function') {
            return value;
        }
        return function () { return value; };
    }
    /**
     * Validate the selector for an options object.
     *
     * This returns the validated selector, or throws if the selector is
     * invalid or contains commas.
     */
    function validateSelector(options) {
        if (options.selector.indexOf(',') !== -1) {
            throw new Error("Selector cannot contain commas: " + options.selector);
        }
        if (!Selector.isValid(options.selector)) {
            throw new Error("Invalid selector: " + options.selector);
        }
        return options.selector;
    }
    /**
     * Test whether a key binding sequence matches a key sequence.
     *
     * Returns a `SequenceMatch` value indicating the type of match.
     */
    function matchSequence(bindKeys, userKeys) {
        if (bindKeys.length < userKeys.length) {
            return 0 /* None */;
        }
        for (var i = 0, n = userKeys.length; i < n; ++i) {
            if (bindKeys[i] !== userKeys[i]) {
                return 0 /* None */;
            }
        }
        if (bindKeys.length > userKeys.length) {
            return 2 /* Partial */;
        }
        return 1 /* Exact */;
    }
    /**
     * Find the distance from the target node to the first matching node.
     *
     * This traverses the event path from `target` to `currentTarget` and
     * computes the distance from `target` to the first node which matches
     * the CSS selector. If no match is found, `-1` is returned.
     */
    function targetDistance(selector, event) {
        var targ = event.target;
        var curr = event.currentTarget;
        for (var dist = 0; targ !== null; targ = targ.parentElement, ++dist) {
            if (targ.hasAttribute('data-lm-suppress-shortcuts')) {
                return -1;
            }
            /* <DEPRECATED> */
            if (targ.hasAttribute('data-p-suppress-shortcuts')) {
                return -1;
            }
            /* </DEPRECATED> */
            if (Selector.matches(targ, selector)) {
                return dist;
            }
            if (targ === curr) {
                return -1;
            }
        }
        return -1;
    }
    /**
     * Clone a keyboard event.
     */
    function cloneKeyboardEvent(event) {
        // A custom event is required because Chrome nulls out the
        // `keyCode` field in user-generated `KeyboardEvent` types.
        var clone = document.createEvent('Event');
        var bubbles = event.bubbles || true;
        var cancelable = event.cancelable || true;
        clone.initEvent(event.type || 'keydown', bubbles, cancelable);
        clone.key = event.key || '';
        clone.keyCode = event.keyCode || 0;
        clone.which = event.keyCode || 0;
        clone.ctrlKey = event.ctrlKey || false;
        clone.altKey = event.altKey || false;
        clone.shiftKey = event.shiftKey || false;
        clone.metaKey = event.metaKey || false;
        clone.view = event.view || window;
        return clone;
    }
})(commands_dist_index_es6_Private || (commands_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/virtualdom/dist/index.es6.js


/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var dist_index_es6_extendStatics = function(d, b) {
    dist_index_es6_extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return dist_index_es6_extendStatics(d, b);
};

function virtualdom_dist_index_es6_extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    dist_index_es6_extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

/**
 * A virtual node which represents plain text content.
 *
 * #### Notes
 * User code will not typically create a `VirtualText` node directly.
 * Instead, the `h()` function will be used to create an element tree.
 */
var VirtualText = /** @class */ (function () {
    /**
     * Construct a new virtual text node.
     *
     * @param content - The text content for the node.
     */
    function VirtualText(content) {
        /**
         * The type of the node.
         *
         * This value can be used as a type guard for discriminating the
         * `VirtualNode` union type.
         */
        this.type = 'text';
        this.content = content;
    }
    return VirtualText;
}());
/**
 * A virtual node which represents an HTML element.
 *
 * #### Notes
 * User code will not typically create a `VirtualElement` node directly.
 * Instead, the `h()` function will be used to create an element tree.
 */
var VirtualElement = /** @class */ (function () {
    /**
     * Construct a new virtual element node.
     *
     * @param tag - The element tag name.
     *
     * @param attrs - The element attributes.
     *
     * @param children - The element children.
     *
     * @param renderer - An optional custom renderer for the element.
     */
    function VirtualElement(tag, attrs, children, renderer) {
        /**
         * The type of the node.
         *
         * This value can be used as a type guard for discriminating the
         * `VirtualNode` union type.
         */
        this.type = 'element';
        this.tag = tag;
        this.attrs = attrs;
        this.children = children;
        this.renderer = renderer;
    }
    return VirtualElement;
}());
/**
 * DEPRECATED - use VirtualElement with a defined renderer param instead.
 * This class is provided as a backwards compatibility shim
 *
 * A "pass thru" virtual node whose children are managed by a render and an
 * unrender callback. The intent of this flavor of virtual node is to make
 * it easy to blend other kinds of virtualdom (eg React) into Phosphor's
 * virtualdom.
 *
 * #### Notes
 * User code will not typically create a `VirtualElementPass` node directly.
 * Instead, the `hpass()` function will be used to create an element tree.
 */
var VirtualElementPass = /** @class */ (function (_super) {
    virtualdom_dist_index_es6_extends(VirtualElementPass, _super);
    /**
     * DEPRECATED - use VirtualElement with a defined renderer param instead
     *
     * Construct a new virtual element pass thru node.
     *
     * @param tag - the tag of the parent element of this node. Once the parent
     * element is rendered, it will be passed as an argument to
     * renderer.render
     *
     * @param attrs - attributes that will assigned to the
     * parent element
     *
     * @param renderer - an object with render and unrender
     * functions, each of which should take a single argument of type
     * HTMLElement and return nothing. If null, the parent element
     * will be rendered barren without any children.
     */
    function VirtualElementPass(tag, attrs, renderer) {
        return _super.call(this, tag, attrs, [], renderer || undefined) || this;
    }
    return VirtualElementPass;
}(VirtualElement));
function index_es6_h(tag) {
    var attrs = {};
    var renderer;
    var children = [];
    for (var i = 1, n = arguments.length; i < n; ++i) {
        // eslint-disable-next-line prefer-rest-params
        var arg = arguments[i];
        if (typeof arg === 'string') {
            children.push(new VirtualText(arg));
        }
        else if (arg instanceof VirtualText) {
            children.push(arg);
        }
        else if (arg instanceof VirtualElement) {
            children.push(arg);
        }
        else if (arg instanceof Array) {
            extend(children, arg);
        }
        else if ((i === 1 || i === 2) && arg && typeof arg === 'object') {
            if ('render' in arg) {
                renderer = arg;
            }
            else {
                attrs = arg;
            }
        }
    }
    return new VirtualElement(tag, attrs, children, renderer);
    function extend(array, values) {
        for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
            var child = values_1[_i];
            if (typeof child === 'string') {
                array.push(new VirtualText(child));
            }
            else if (child instanceof VirtualText) {
                array.push(child);
            }
            else if (child instanceof VirtualElement) {
                array.push(child);
            }
        }
    }
}
/**
 * The namespace for the `h` function statics.
 */
(function (h) {
    h.a = h.bind(undefined, 'a');
    h.abbr = h.bind(undefined, 'abbr');
    h.address = h.bind(undefined, 'address');
    h.area = h.bind(undefined, 'area');
    h.article = h.bind(undefined, 'article');
    h.aside = h.bind(undefined, 'aside');
    h.audio = h.bind(undefined, 'audio');
    h.b = h.bind(undefined, 'b');
    h.bdi = h.bind(undefined, 'bdi');
    h.bdo = h.bind(undefined, 'bdo');
    h.blockquote = h.bind(undefined, 'blockquote');
    h.br = h.bind(undefined, 'br');
    h.button = h.bind(undefined, 'button');
    h.canvas = h.bind(undefined, 'canvas');
    h.caption = h.bind(undefined, 'caption');
    h.cite = h.bind(undefined, 'cite');
    h.code = h.bind(undefined, 'code');
    h.col = h.bind(undefined, 'col');
    h.colgroup = h.bind(undefined, 'colgroup');
    h.data = h.bind(undefined, 'data');
    h.datalist = h.bind(undefined, 'datalist');
    h.dd = h.bind(undefined, 'dd');
    h.del = h.bind(undefined, 'del');
    h.dfn = h.bind(undefined, 'dfn');
    h.div = h.bind(undefined, 'div');
    h.dl = h.bind(undefined, 'dl');
    h.dt = h.bind(undefined, 'dt');
    h.em = h.bind(undefined, 'em');
    h.embed = h.bind(undefined, 'embed');
    h.fieldset = h.bind(undefined, 'fieldset');
    h.figcaption = h.bind(undefined, 'figcaption');
    h.figure = h.bind(undefined, 'figure');
    h.footer = h.bind(undefined, 'footer');
    h.form = h.bind(undefined, 'form');
    h.h1 = h.bind(undefined, 'h1');
    h.h2 = h.bind(undefined, 'h2');
    h.h3 = h.bind(undefined, 'h3');
    h.h4 = h.bind(undefined, 'h4');
    h.h5 = h.bind(undefined, 'h5');
    h.h6 = h.bind(undefined, 'h6');
    h.header = h.bind(undefined, 'header');
    h.hr = h.bind(undefined, 'hr');
    h.i = h.bind(undefined, 'i');
    h.iframe = h.bind(undefined, 'iframe');
    h.img = h.bind(undefined, 'img');
    h.input = h.bind(undefined, 'input');
    h.ins = h.bind(undefined, 'ins');
    h.kbd = h.bind(undefined, 'kbd');
    h.label = h.bind(undefined, 'label');
    h.legend = h.bind(undefined, 'legend');
    h.li = h.bind(undefined, 'li');
    h.main = h.bind(undefined, 'main');
    h.map = h.bind(undefined, 'map');
    h.mark = h.bind(undefined, 'mark');
    h.meter = h.bind(undefined, 'meter');
    h.nav = h.bind(undefined, 'nav');
    h.noscript = h.bind(undefined, 'noscript');
    h.object = h.bind(undefined, 'object');
    h.ol = h.bind(undefined, 'ol');
    h.optgroup = h.bind(undefined, 'optgroup');
    h.option = h.bind(undefined, 'option');
    h.output = h.bind(undefined, 'output');
    h.p = h.bind(undefined, 'p');
    h.param = h.bind(undefined, 'param');
    h.pre = h.bind(undefined, 'pre');
    h.progress = h.bind(undefined, 'progress');
    h.q = h.bind(undefined, 'q');
    h.rp = h.bind(undefined, 'rp');
    h.rt = h.bind(undefined, 'rt');
    h.ruby = h.bind(undefined, 'ruby');
    h.s = h.bind(undefined, 's');
    h.samp = h.bind(undefined, 'samp');
    h.section = h.bind(undefined, 'section');
    h.select = h.bind(undefined, 'select');
    h.small = h.bind(undefined, 'small');
    h.source = h.bind(undefined, 'source');
    h.span = h.bind(undefined, 'span');
    h.strong = h.bind(undefined, 'strong');
    h.sub = h.bind(undefined, 'sub');
    h.summary = h.bind(undefined, 'summary');
    h.sup = h.bind(undefined, 'sup');
    h.table = h.bind(undefined, 'table');
    h.tbody = h.bind(undefined, 'tbody');
    h.td = h.bind(undefined, 'td');
    h.textarea = h.bind(undefined, 'textarea');
    h.tfoot = h.bind(undefined, 'tfoot');
    h.th = h.bind(undefined, 'th');
    h.thead = h.bind(undefined, 'thead');
    h.time = h.bind(undefined, 'time');
    h.title = h.bind(undefined, 'title');
    h.tr = h.bind(undefined, 'tr');
    h.track = h.bind(undefined, 'track');
    h.u = h.bind(undefined, 'u');
    h.ul = h.bind(undefined, 'ul');
    h.var_ = h.bind(undefined, 'var');
    h.video = h.bind(undefined, 'video');
    h.wbr = h.bind(undefined, 'wbr');
})(index_es6_h || (index_es6_h = {}));
function hpass(tag) {
    var attrs = {};
    var renderer = null;
    if (arguments.length === 2) {
        // eslint-disable-next-line prefer-rest-params
        var arg = arguments[1];
        if ('render' in arg) {
            renderer = arg;
        }
        else {
            attrs = arg;
        }
    }
    else if (arguments.length === 3) {
        // eslint-disable-next-line prefer-rest-params
        attrs = arguments[1];
        // eslint-disable-next-line prefer-rest-params
        renderer = arguments[2];
    }
    else if (arguments.length > 3) {
        throw new Error('hpass() should be called with 1, 2, or 3 arguments');
    }
    return new VirtualElementPass(tag, attrs, renderer);
}
/**
 * The namespace for the virtual DOM rendering functions.
 */
var VirtualDOM;
(function (VirtualDOM) {
    function realize(node) {
        return virtualdom_dist_index_es6_Private.createDOMNode(node);
    }
    VirtualDOM.realize = realize;
    /**
     * Render virtual DOM content into a host element.
     *
     * @param content - The virtual DOM content to render.
     *
     * @param host - The host element for the rendered content.
     *
     * #### Notes
     * This renders the delta from the previous rendering. It assumes that
     * the content of the host element is not manipulated by external code.
     *
     * Providing `null` content will clear the rendering.
     *
     * Externally modifying the provided content or the host element will
     * result in undefined rendering behavior.
     */
    function render(content, host) {
        var oldContent = virtualdom_dist_index_es6_Private.hostMap.get(host) || [];
        var newContent = virtualdom_dist_index_es6_Private.asContentArray(content);
        virtualdom_dist_index_es6_Private.hostMap.set(host, newContent);
        virtualdom_dist_index_es6_Private.updateContent(host, oldContent, newContent);
    }
    VirtualDOM.render = render;
})(VirtualDOM || (VirtualDOM = {}));
/**
 * The namespace for the module implementation details.
 */
var virtualdom_dist_index_es6_Private;
(function (Private) {
    /**
     * A weak mapping of host element to virtual DOM content.
     */
    Private.hostMap = new WeakMap();
    /**
     * Cast a content value to a content array.
     */
    function asContentArray(value) {
        if (!value) {
            return [];
        }
        if (value instanceof Array) {
            return value;
        }
        return [value];
    }
    Private.asContentArray = asContentArray;
    function createDOMNode(node) {
        // eslint-disable-next-line prefer-rest-params
        var host = arguments[1] || null;
        // eslint-disable-next-line prefer-rest-params
        var before = arguments[2] || null;
        if (host) {
            host.insertBefore(createDOMNode(node), before);
        }
        else {
            // Create a text node for a virtual text node.
            if (node.type === 'text') {
                return document.createTextNode(node.content);
            }
            // Create the HTML element with the specified tag.
            host = document.createElement(node.tag);
            // Add the attributes for the new element.
            addAttrs(host, node.attrs);
            if (node.renderer) {
                node.renderer.render(host, {
                    attrs: node.attrs,
                    children: node.children
                });
                return host;
            }
            // Recursively populate the element with child content.
            for (var i = 0, n = node.children.length; i < n; ++i) {
                createDOMNode(node.children[i], host);
            }
        }
        return host;
    }
    Private.createDOMNode = createDOMNode;
    /**
     * Update a host element with the delta of the virtual content.
     *
     * This is the core "diff" algorithm. There is no explicit "patch"
     * phase. The host is patched at each step as the diff progresses.
     */
    function updateContent(host, oldContent, newContent) {
        // Bail early if the content is identical.
        if (oldContent === newContent) {
            return;
        }
        // Collect the old keyed elems into a mapping.
        var oldKeyed = collectKeys(host, oldContent);
        // Create a copy of the old content which can be modified in-place.
        var oldCopy = oldContent.slice();
        // Update the host with the new content. The diff always proceeds
        // forward and never modifies a previously visited index. The old
        // copy array is modified in-place to reflect the changes made to
        // the host children. This causes the stale nodes to be pushed to
        // the end of the host node and removed at the end of the loop.
        var currElem = host.firstChild;
        var newCount = newContent.length;
        for (var i = 0; i < newCount; ++i) {
            // If the old content is exhausted, create a new node.
            if (i >= oldCopy.length) {
                createDOMNode(newContent[i], host);
                continue;
            }
            // Lookup the old and new virtual nodes.
            var oldVNode = oldCopy[i];
            var newVNode = newContent[i];
            // If both elements are identical, there is nothing to do.
            if (oldVNode === newVNode) {
                currElem = currElem.nextSibling;
                continue;
            }
            // Handle the simplest case of in-place text update first.
            if (oldVNode.type === 'text' && newVNode.type === 'text') {
                currElem.textContent = newVNode.content;
                currElem = currElem.nextSibling;
                continue;
            }
            // If the old or new node is a text node, the other node is now
            // known to be an element node, so create and insert a new node.
            if (oldVNode.type === 'text' || newVNode.type === 'text') {
                ArrayExt.insert(oldCopy, i, newVNode);
                createDOMNode(newVNode, host, currElem);
                continue;
            }
            // If the old XOR new node has a custom renderer,
            // create and insert a new node.
            if (!oldVNode.renderer != !newVNode.renderer) {
                ArrayExt.insert(oldCopy, i, newVNode);
                createDOMNode(newVNode, host, currElem);
                continue;
            }
            // At this point, both nodes are known to be element nodes.
            // If the new elem is keyed, move an old keyed elem to the proper
            // location before proceeding with the diff. The search can start
            // at the current index, since the unmatched old keyed elems are
            // pushed forward in the old copy array.
            var newKey = newVNode.attrs.key;
            if (newKey && newKey in oldKeyed) {
                var pair = oldKeyed[newKey];
                if (pair.vNode !== oldVNode) {
                    ArrayExt.move(oldCopy, oldCopy.indexOf(pair.vNode, i + 1), i);
                    host.insertBefore(pair.element, currElem);
                    oldVNode = pair.vNode;
                    currElem = pair.element;
                }
            }
            // If both elements are identical, there is nothing to do.
            if (oldVNode === newVNode) {
                currElem = currElem.nextSibling;
                continue;
            }
            // If the old elem is keyed and does not match the new elem key,
            // create a new node. This is necessary since the old keyed elem
            // may be matched at a later point in the diff.
            var oldKey = oldVNode.attrs.key;
            if (oldKey && oldKey !== newKey) {
                ArrayExt.insert(oldCopy, i, newVNode);
                createDOMNode(newVNode, host, currElem);
                continue;
            }
            // If the tags are different, create a new node.
            if (oldVNode.tag !== newVNode.tag) {
                ArrayExt.insert(oldCopy, i, newVNode);
                createDOMNode(newVNode, host, currElem);
                continue;
            }
            // At this point, the element can be updated in-place.
            // Update the element attributes.
            updateAttrs(currElem, oldVNode.attrs, newVNode.attrs);
            // Update the element content.
            if (newVNode.renderer) {
                newVNode.renderer.render(currElem, {
                    attrs: newVNode.attrs,
                    children: newVNode.children
                });
            }
            else {
                updateContent(currElem, oldVNode.children, newVNode.children);
            }
            // Step to the next sibling element.
            currElem = currElem.nextSibling;
        }
        // Cleanup stale DOM
        removeContent(host, oldCopy, newCount, true);
    }
    Private.updateContent = updateContent;
    /**
     * Handle cleanup of stale vdom and its associated DOM. The host node is
     * traversed recursively (in depth-first order), and any explicit cleanup
     * required by a child node is carried out when it is visited (eg if a node
     * has a custom renderer, the renderer.unrender function will be called).
     * Once the subtree beneath each child of host has been completely visited,
     * that child will be removed via a call to host.removeChild.
     */
    function removeContent(host, oldContent, newCount, _sentinel) {
        // Dispose of the old nodes pushed to the end of the host.
        for (var i = oldContent.length - 1; i >= newCount; --i) {
            var oldNode = oldContent[i];
            var child = (_sentinel
                ? host.lastChild
                : host.childNodes[i]);
            // recursively clean up host children
            if (oldNode.type === 'text') ;
            else if (oldNode.renderer && oldNode.renderer.unrender) {
                oldNode.renderer.unrender(child, {
                    attrs: oldNode.attrs,
                    children: oldNode.children
                });
            }
            else {
                removeContent(child, oldNode.children, 0, false);
            }
            if (_sentinel) {
                host.removeChild(child);
            }
        }
    }
    /**
     * A set of special-cased attribute names.
     */
    var specialAttrs = {
        key: true,
        className: true,
        htmlFor: true,
        dataset: true,
        style: true
    };
    /**
     * Add element attributes to a newly created HTML element.
     */
    function addAttrs(element, attrs) {
        // Add the inline event listeners and node attributes.
        for (var name_1 in attrs) {
            if (name_1 in specialAttrs) {
                continue;
            }
            if (name_1.substr(0, 2) === 'on') {
                element[name_1] = attrs[name_1];
            }
            else {
                element.setAttribute(name_1, attrs[name_1]);
            }
        }
        // Add the element `class` attribute.
        if (attrs.className !== undefined) {
            element.setAttribute('class', attrs.className);
        }
        // Add the element `for` attribute.
        if (attrs.htmlFor !== undefined) {
            element.setAttribute('for', attrs.htmlFor);
        }
        // Add the dataset values.
        if (attrs.dataset) {
            addDataset(element, attrs.dataset);
        }
        // Add the inline styles.
        if (attrs.style) {
            addStyle(element, attrs.style);
        }
    }
    /**
     * Update the element attributes of an HTML element.
     */
    function updateAttrs(element, oldAttrs, newAttrs) {
        // Do nothing if the attrs are the same object.
        if (oldAttrs === newAttrs) {
            return;
        }
        // Setup the strongly typed loop variable.
        var name;
        // Remove attributes and listeners which no longer exist.
        for (name in oldAttrs) {
            if (name in specialAttrs || name in newAttrs) {
                continue;
            }
            if (name.substr(0, 2) === 'on') {
                element[name] = null;
            }
            else {
                element.removeAttribute(name);
            }
        }
        // Add and update new and existing attributes and listeners.
        for (name in newAttrs) {
            if (name in specialAttrs || oldAttrs[name] === newAttrs[name]) {
                continue;
            }
            if (name.substr(0, 2) === 'on') {
                element[name] = newAttrs[name];
            }
            else {
                element.setAttribute(name, newAttrs[name]);
            }
        }
        // Update the element `class` attribute.
        if (oldAttrs.className !== newAttrs.className) {
            if (newAttrs.className !== undefined) {
                element.setAttribute('class', newAttrs.className);
            }
            else {
                element.removeAttribute('class');
            }
        }
        // Add the element `for` attribute.
        if (oldAttrs.htmlFor !== newAttrs.htmlFor) {
            if (newAttrs.htmlFor !== undefined) {
                element.setAttribute('for', newAttrs.htmlFor);
            }
            else {
                element.removeAttribute('for');
            }
        }
        // Update the dataset values.
        if (oldAttrs.dataset !== newAttrs.dataset) {
            updateDataset(element, oldAttrs.dataset || {}, newAttrs.dataset || {});
        }
        // Update the inline styles.
        if (oldAttrs.style !== newAttrs.style) {
            updateStyle(element, oldAttrs.style || {}, newAttrs.style || {});
        }
    }
    /**
     * Add dataset values to a newly created HTML element.
     */
    function addDataset(element, dataset) {
        for (var name_2 in dataset) {
            element.setAttribute("data-" + name_2, dataset[name_2]);
        }
    }
    /**
     * Update the dataset values of an HTML element.
     */
    function updateDataset(element, oldDataset, newDataset) {
        for (var name_3 in oldDataset) {
            if (!(name_3 in newDataset)) {
                element.removeAttribute("data-" + name_3);
            }
        }
        for (var name_4 in newDataset) {
            if (oldDataset[name_4] !== newDataset[name_4]) {
                element.setAttribute("data-" + name_4, newDataset[name_4]);
            }
        }
    }
    /**
     * Add inline style values to a newly created HTML element.
     */
    function addStyle(element, style) {
        var elemStyle = element.style;
        var name;
        for (name in style) {
            elemStyle[name] = style[name];
        }
    }
    /**
     * Update the inline style values of an HTML element.
     */
    function updateStyle(element, oldStyle, newStyle) {
        var elemStyle = element.style;
        var name;
        for (name in oldStyle) {
            if (!(name in newStyle)) {
                elemStyle[name] = '';
            }
        }
        for (name in newStyle) {
            if (oldStyle[name] !== newStyle[name]) {
                elemStyle[name] = newStyle[name];
            }
        }
    }
    /**
     * Collect a mapping of keyed elements for the host content.
     */
    function collectKeys(host, content) {
        var node = host.firstChild;
        var keyMap = Object.create(null);
        for (var _i = 0, content_1 = content; _i < content_1.length; _i++) {
            var vNode = content_1[_i];
            if (vNode.type === 'element' && vNode.attrs.key) {
                keyMap[vNode.attrs.key] = { vNode: vNode, element: node };
            }
            node = node.nextSibling;
        }
        return keyMap;
    }
})(virtualdom_dist_index_es6_Private || (virtualdom_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@lumino/widgets/dist/index.es6.js












/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var widgets_dist_index_es6_extendStatics = function(d, b) {
    widgets_dist_index_es6_extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return widgets_dist_index_es6_extendStatics(d, b);
};

function widgets_dist_index_es6_extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    widgets_dist_index_es6_extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var index_es6_assign = function() {
    index_es6_assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return index_es6_assign.apply(this, arguments);
};

function __rest(s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
}

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2017, PhosphorJS Contributors
|
| Distributed under the terms of the BSD 3-Clause License.
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
/**
 * A sizer object for use with the box engine layout functions.
 *
 * #### Notes
 * A box sizer holds the geometry information for an object along an
 * arbitrary layout orientation.
 *
 * For best performance, this class should be treated as a raw data
 * struct. It should not typically be subclassed.
 */
var BoxSizer = /** @class */ (function () {
    function BoxSizer() {
        /**
         * The preferred size for the sizer.
         *
         * #### Notes
         * The sizer will be given this initial size subject to its size
         * bounds. The sizer will not deviate from this size unless such
         * deviation is required to fit into the available layout space.
         *
         * There is no limit to this value, but it will be clamped to the
         * bounds defined by [[minSize]] and [[maxSize]].
         *
         * The default value is `0`.
         */
        this.sizeHint = 0;
        /**
         * The minimum size of the sizer.
         *
         * #### Notes
         * The sizer will never be sized less than this value, even if
         * it means the sizer will overflow the available layout space.
         *
         * It is assumed that this value lies in the range `[0, Infinity)`
         * and that it is `<=` to [[maxSize]]. Failure to adhere to this
         * constraint will yield undefined results.
         *
         * The default value is `0`.
         */
        this.minSize = 0;
        /**
         * The maximum size of the sizer.
         *
         * #### Notes
         * The sizer will never be sized greater than this value, even if
         * it means the sizer will underflow the available layout space.
         *
         * It is assumed that this value lies in the range `[0, Infinity]`
         * and that it is `>=` to [[minSize]]. Failure to adhere to this
         * constraint will yield undefined results.
         *
         * The default value is `Infinity`.
         */
        this.maxSize = Infinity;
        /**
         * The stretch factor for the sizer.
         *
         * #### Notes
         * This controls how much the sizer stretches relative to its sibling
         * sizers when layout space is distributed. A stretch factor of zero
         * is special and will cause the sizer to only be resized after all
         * other sizers with a stretch factor greater than zero have been
         * resized to their limits.
         *
         * It is assumed that this value is an integer that lies in the range
         * `[0, Infinity)`. Failure to adhere to this constraint will yield
         * undefined results.
         *
         * The default value is `1`.
         */
        this.stretch = 1;
        /**
         * The computed size of the sizer.
         *
         * #### Notes
         * This value is the output of a call to [[boxCalc]]. It represents
         * the computed size for the object along the layout orientation,
         * and will always lie in the range `[minSize, maxSize]`.
         *
         * This value is output only.
         *
         * Changing this value will have no effect.
         */
        this.size = 0;
        /**
         * An internal storage property for the layout algorithm.
         *
         * #### Notes
         * This value is used as temporary storage by the layout algorithm.
         *
         * Changing this value will have no effect.
         */
        this.done = false;
    }
    return BoxSizer;
}());
/**
 * The namespace for the box engine layout functions.
 */
var BoxEngine;
(function (BoxEngine) {
    /**
     * Calculate the optimal layout sizes for a sequence of box sizers.
     *
     * This distributes the available layout space among the box sizers
     * according to the following algorithm:
     *
     * 1. Initialize the sizers's size to its size hint and compute the
     *    sums for each of size hint, min size, and max size.
     *
     * 2. If the total size hint equals the available space, return.
     *
     * 3. If the available space is less than the total min size, set all
     *    sizers to their min size and return.
     *
     * 4. If the available space is greater than the total max size, set
     *    all sizers to their max size and return.
     *
     * 5. If the layout space is less than the total size hint, distribute
     *    the negative delta as follows:
     *
     *    a. Shrink each sizer with a stretch factor greater than zero by
     *       an amount proportional to the negative space and the sum of
     *       stretch factors. If the sizer reaches its min size, remove
     *       it and its stretch factor from the computation.
     *
     *    b. If after adjusting all stretch sizers there remains negative
     *       space, distribute the space equally among the sizers with a
     *       stretch factor of zero. If a sizer reaches its min size,
     *       remove it from the computation.
     *
     * 6. If the layout space is greater than the total size hint,
     *    distribute the positive delta as follows:
     *
     *    a. Expand each sizer with a stretch factor greater than zero by
     *       an amount proportional to the postive space and the sum of
     *       stretch factors. If the sizer reaches its max size, remove
     *       it and its stretch factor from the computation.
     *
     *    b. If after adjusting all stretch sizers there remains positive
     *       space, distribute the space equally among the sizers with a
     *       stretch factor of zero. If a sizer reaches its max size,
     *       remove it from the computation.
     *
     * 7. return
     *
     * @param sizers - The sizers for a particular layout line.
     *
     * @param space - The available layout space for the sizers.
     *
     * @returns The delta between the provided available space and the
     *   actual consumed space. This value will be zero if the sizers
     *   can be adjusted to fit, negative if the available space is too
     *   small, and positive if the available space is too large.
     *
     * #### Notes
     * The [[size]] of each sizer is updated with the computed size.
     *
     * This function can be called at any time to recompute the layout for
     * an existing sequence of sizers. The previously computed results will
     * have no effect on the new output. It is therefore not necessary to
     * create new sizer objects on each resize event.
     */
    function calc(sizers, space) {
        // Bail early if there is nothing to do.
        var count = sizers.length;
        if (count === 0) {
            return space;
        }
        // Setup the size and stretch counters.
        var totalMin = 0;
        var totalMax = 0;
        var totalSize = 0;
        var totalStretch = 0;
        var stretchCount = 0;
        // Setup the sizers and compute the totals.
        for (var i = 0; i < count; ++i) {
            var sizer = sizers[i];
            var min = sizer.minSize;
            var max = sizer.maxSize;
            var hint = sizer.sizeHint;
            sizer.done = false;
            sizer.size = Math.max(min, Math.min(hint, max));
            totalSize += sizer.size;
            totalMin += min;
            totalMax += max;
            if (sizer.stretch > 0) {
                totalStretch += sizer.stretch;
                stretchCount++;
            }
        }
        // If the space is equal to the total size, return early.
        if (space === totalSize) {
            return 0;
        }
        // If the space is less than the total min, minimize each sizer.
        if (space <= totalMin) {
            for (var i = 0; i < count; ++i) {
                var sizer = sizers[i];
                sizer.size = sizer.minSize;
            }
            return space - totalMin;
        }
        // If the space is greater than the total max, maximize each sizer.
        if (space >= totalMax) {
            for (var i = 0; i < count; ++i) {
                var sizer = sizers[i];
                sizer.size = sizer.maxSize;
            }
            return space - totalMax;
        }
        // The loops below perform sub-pixel precision sizing. A near zero
        // value is used for compares instead of zero to ensure that the
        // loop terminates when the subdivided space is reasonably small.
        var nearZero = 0.01;
        // A counter which is decremented each time a sizer is resized to
        // its limit. This ensures the loops terminate even if there is
        // space remaining to distribute.
        var notDoneCount = count;
        // Distribute negative delta space.
        if (space < totalSize) {
            // Shrink each stretchable sizer by an amount proportional to its
            // stretch factor. If a sizer reaches its min size it's marked as
            // done. The loop progresses in phases where each sizer is given
            // a chance to consume its fair share for the pass, regardless of
            // whether a sizer before it reached its limit. This continues
            // until the stretchable sizers or the free space is exhausted.
            var freeSpace = totalSize - space;
            while (stretchCount > 0 && freeSpace > nearZero) {
                var distSpace = freeSpace;
                var distStretch = totalStretch;
                for (var i = 0; i < count; ++i) {
                    var sizer = sizers[i];
                    if (sizer.done || sizer.stretch === 0) {
                        continue;
                    }
                    var amt = (sizer.stretch * distSpace) / distStretch;
                    if (sizer.size - amt <= sizer.minSize) {
                        freeSpace -= sizer.size - sizer.minSize;
                        totalStretch -= sizer.stretch;
                        sizer.size = sizer.minSize;
                        sizer.done = true;
                        notDoneCount--;
                        stretchCount--;
                    }
                    else {
                        freeSpace -= amt;
                        sizer.size -= amt;
                    }
                }
            }
            // Distribute any remaining space evenly among the non-stretchable
            // sizers. This progresses in phases in the same manner as above.
            while (notDoneCount > 0 && freeSpace > nearZero) {
                var amt = freeSpace / notDoneCount;
                for (var i = 0; i < count; ++i) {
                    var sizer = sizers[i];
                    if (sizer.done) {
                        continue;
                    }
                    if (sizer.size - amt <= sizer.minSize) {
                        freeSpace -= sizer.size - sizer.minSize;
                        sizer.size = sizer.minSize;
                        sizer.done = true;
                        notDoneCount--;
                    }
                    else {
                        freeSpace -= amt;
                        sizer.size -= amt;
                    }
                }
            }
        }
        // Distribute positive delta space.
        else {
            // Expand each stretchable sizer by an amount proportional to its
            // stretch factor. If a sizer reaches its max size it's marked as
            // done. The loop progresses in phases where each sizer is given
            // a chance to consume its fair share for the pass, regardless of
            // whether a sizer before it reached its limit. This continues
            // until the stretchable sizers or the free space is exhausted.
            var freeSpace = space - totalSize;
            while (stretchCount > 0 && freeSpace > nearZero) {
                var distSpace = freeSpace;
                var distStretch = totalStretch;
                for (var i = 0; i < count; ++i) {
                    var sizer = sizers[i];
                    if (sizer.done || sizer.stretch === 0) {
                        continue;
                    }
                    var amt = (sizer.stretch * distSpace) / distStretch;
                    if (sizer.size + amt >= sizer.maxSize) {
                        freeSpace -= sizer.maxSize - sizer.size;
                        totalStretch -= sizer.stretch;
                        sizer.size = sizer.maxSize;
                        sizer.done = true;
                        notDoneCount--;
                        stretchCount--;
                    }
                    else {
                        freeSpace -= amt;
                        sizer.size += amt;
                    }
                }
            }
            // Distribute any remaining space evenly among the non-stretchable
            // sizers. This progresses in phases in the same manner as above.
            while (notDoneCount > 0 && freeSpace > nearZero) {
                var amt = freeSpace / notDoneCount;
                for (var i = 0; i < count; ++i) {
                    var sizer = sizers[i];
                    if (sizer.done) {
                        continue;
                    }
                    if (sizer.size + amt >= sizer.maxSize) {
                        freeSpace -= sizer.maxSize - sizer.size;
                        sizer.size = sizer.maxSize;
                        sizer.done = true;
                        notDoneCount--;
                    }
                    else {
                        freeSpace -= amt;
                        sizer.size += amt;
                    }
                }
            }
        }
        // Indicate that the consumed space equals the available space.
        return 0;
    }
    BoxEngine.calc = calc;
    /**
     * Adjust a sizer by a delta and update its neighbors accordingly.
     *
     * @param sizers - The sizers which should be adjusted.
     *
     * @param index - The index of the sizer to grow.
     *
     * @param delta - The amount to adjust the sizer, positive or negative.
     *
     * #### Notes
     * This will adjust the indicated sizer by the specified amount, along
     * with the sizes of the appropriate neighbors, subject to the limits
     * specified by each of the sizers.
     *
     * This is useful when implementing box layouts where the boundaries
     * between the sizers are interactively adjustable by the user.
     */
    function adjust(sizers, index, delta) {
        // Bail early when there is nothing to do.
        if (sizers.length === 0 || delta === 0) {
            return;
        }
        // Dispatch to the proper implementation.
        if (delta > 0) {
            growSizer(sizers, index, delta);
        }
        else {
            shrinkSizer(sizers, index, -delta);
        }
    }
    BoxEngine.adjust = adjust;
    /**
     * Grow a sizer by a positive delta and adjust neighbors.
     */
    function growSizer(sizers, index, delta) {
        // Compute how much the items to the left can expand.
        var growLimit = 0;
        for (var i = 0; i <= index; ++i) {
            var sizer = sizers[i];
            growLimit += sizer.maxSize - sizer.size;
        }
        // Compute how much the items to the right can shrink.
        var shrinkLimit = 0;
        for (var i = index + 1, n = sizers.length; i < n; ++i) {
            var sizer = sizers[i];
            shrinkLimit += sizer.size - sizer.minSize;
        }
        // Clamp the delta adjustment to the limits.
        delta = Math.min(delta, growLimit, shrinkLimit);
        // Grow the sizers to the left by the delta.
        var grow = delta;
        for (var i = index; i >= 0 && grow > 0; --i) {
            var sizer = sizers[i];
            var limit = sizer.maxSize - sizer.size;
            if (limit >= grow) {
                sizer.sizeHint = sizer.size + grow;
                grow = 0;
            }
            else {
                sizer.sizeHint = sizer.size + limit;
                grow -= limit;
            }
        }
        // Shrink the sizers to the right by the delta.
        var shrink = delta;
        for (var i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {
            var sizer = sizers[i];
            var limit = sizer.size - sizer.minSize;
            if (limit >= shrink) {
                sizer.sizeHint = sizer.size - shrink;
                shrink = 0;
            }
            else {
                sizer.sizeHint = sizer.size - limit;
                shrink -= limit;
            }
        }
    }
    /**
     * Shrink a sizer by a positive delta and adjust neighbors.
     */
    function shrinkSizer(sizers, index, delta) {
        // Compute how much the items to the right can expand.
        var growLimit = 0;
        for (var i = index + 1, n = sizers.length; i < n; ++i) {
            var sizer = sizers[i];
            growLimit += sizer.maxSize - sizer.size;
        }
        // Compute how much the items to the left can shrink.
        var shrinkLimit = 0;
        for (var i = 0; i <= index; ++i) {
            var sizer = sizers[i];
            shrinkLimit += sizer.size - sizer.minSize;
        }
        // Clamp the delta adjustment to the limits.
        delta = Math.min(delta, growLimit, shrinkLimit);
        // Grow the sizers to the right by the delta.
        var grow = delta;
        for (var i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {
            var sizer = sizers[i];
            var limit = sizer.maxSize - sizer.size;
            if (limit >= grow) {
                sizer.sizeHint = sizer.size + grow;
                grow = 0;
            }
            else {
                sizer.sizeHint = sizer.size + limit;
                grow -= limit;
            }
        }
        // Shrink the sizers to the left by the delta.
        var shrink = delta;
        for (var i = index; i >= 0 && shrink > 0; --i) {
            var sizer = sizers[i];
            var limit = sizer.size - sizer.minSize;
            if (limit >= shrink) {
                sizer.sizeHint = sizer.size - shrink;
                shrink = 0;
            }
            else {
                sizer.sizeHint = sizer.size - limit;
                shrink -= limit;
            }
        }
    }
})(BoxEngine || (BoxEngine = {}));

// Copyright (c) Jupyter Development Team.
/**
 * An object which holds data related to an object's title.
 *
 * #### Notes
 * A title object is intended to hold the data necessary to display a
 * header for a particular object. A common example is the `TabPanel`,
 * which uses the widget title to populate the tab for a child widget.
 */
var index_es6_Title = /** @class */ (function () {
    /**
     * Construct a new title.
     *
     * @param options - The options for initializing the title.
     */
    function Title(options) {
        this._label = '';
        this._caption = '';
        this._mnemonic = -1;
        this._iconClass = '';
        this._iconLabel = '';
        this._className = '';
        this._closable = false;
        this._changed = new Signal(this);
        this.owner = options.owner;
        if (options.label !== undefined) {
            this._label = options.label;
        }
        if (options.mnemonic !== undefined) {
            this._mnemonic = options.mnemonic;
        }
        if (options.icon !== undefined) {
            /* <DEPRECATED> */
            if (typeof options.icon === 'string') {
                // when ._icon is null, the .icon getter will alias .iconClass
                this._icon = null;
                this._iconClass = options.icon;
            }
            else {
                /* </DEPRECATED> */
                this._icon = options.icon;
                /* <DEPRECATED> */
            }
            /* </DEPRECATED> */
        }
        else {
            /* <DEPRECATED> */
            // if unset, default to aliasing .iconClass
            this._icon = null;
        }
        /* </DEPRECATED> */
        if (options.iconClass !== undefined) {
            this._iconClass = options.iconClass;
        }
        if (options.iconLabel !== undefined) {
            this._iconLabel = options.iconLabel;
        }
        if (options.iconRenderer !== undefined) {
            this._icon = options.iconRenderer;
        }
        if (options.caption !== undefined) {
            this._caption = options.caption;
        }
        if (options.className !== undefined) {
            this._className = options.className;
        }
        if (options.closable !== undefined) {
            this._closable = options.closable;
        }
        this._dataset = options.dataset || {};
    }
    Object.defineProperty(Title.prototype, "changed", {
        /**
         * A signal emitted when the state of the title changes.
         */
        get: function () {
            return this._changed;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "label", {
        /**
         * Get the label for the title.
         *
         * #### Notes
         * The default value is an empty string.
         */
        get: function () {
            return this._label;
        },
        /**
         * Set the label for the title.
         */
        set: function (value) {
            if (this._label === value) {
                return;
            }
            this._label = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "mnemonic", {
        /**
         * Get the mnemonic index for the title.
         *
         * #### Notes
         * The default value is `-1`.
         */
        get: function () {
            return this._mnemonic;
        },
        /**
         * Set the mnemonic index for the title.
         */
        set: function (value) {
            if (this._mnemonic === value) {
                return;
            }
            this._mnemonic = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "icon", {
        /**
         * Get the icon renderer for the title.
         *
         * #### Notes
         * The default value is undefined.
         *
         * DEPRECATED: if set to a string value, the .icon field will function as
         * an alias for the .iconClass field, for backwards compatibility
         */
        get: function () {
            /* <DEPRECATED> */
            if (this._icon === null) {
                // only alias .iconClass if ._icon has been explicitly nulled
                return this.iconClass;
            }
            /* </DEPRECATED> */
            return this._icon;
        },
        /**
         * Set the icon renderer for the title.
         *
         * #### Notes
         * A renderer is an object that supplies a render and unrender function.
         *
         * DEPRECATED: if set to a string value, the .icon field will function as
         * an alias for the .iconClass field, for backwards compatibility
         */
        set: function (value /* </DEPRECATED> */) {
            /* <DEPRECATED> */
            if (typeof value === 'string') {
                // when ._icon is null, the .icon getter will alias .iconClass
                this._icon = null;
                this.iconClass = value;
            }
            else {
                /* </DEPRECATED> */
                if (this._icon === value) {
                    return;
                }
                this._icon = value;
                this._changed.emit(undefined);
                /* <DEPRECATED> */
            }
            /* </DEPRECATED> */
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "iconClass", {
        /**
         * Get the icon class name for the title.
         *
         * #### Notes
         * The default value is an empty string.
         */
        get: function () {
            return this._iconClass;
        },
        /**
         * Set the icon class name for the title.
         *
         * #### Notes
         * Multiple class names can be separated with whitespace.
         */
        set: function (value) {
            if (this._iconClass === value) {
                return;
            }
            this._iconClass = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "iconLabel", {
        /**
         * Get the icon label for the title.
         *
         * #### Notes
         * The default value is an empty string.
         */
        get: function () {
            return this._iconLabel;
        },
        /**
         * Set the icon label for the title.
         *
         * #### Notes
         * Multiple class names can be separated with whitespace.
         */
        set: function (value) {
            if (this._iconLabel === value) {
                return;
            }
            this._iconLabel = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "iconRenderer", {
        /**
         * @deprecated Use `icon` instead.
         */
        get: function () {
            return this._icon || undefined;
        },
        /**
         * @deprecated Use `icon` instead.
         */
        set: function (value) {
            this.icon = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "caption", {
        /**
         * Get the caption for the title.
         *
         * #### Notes
         * The default value is an empty string.
         */
        get: function () {
            return this._caption;
        },
        /**
         * Set the caption for the title.
         */
        set: function (value) {
            if (this._caption === value) {
                return;
            }
            this._caption = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "className", {
        /**
         * Get the extra class name for the title.
         *
         * #### Notes
         * The default value is an empty string.
         */
        get: function () {
            return this._className;
        },
        /**
         * Set the extra class name for the title.
         *
         * #### Notes
         * Multiple class names can be separated with whitespace.
         */
        set: function (value) {
            if (this._className === value) {
                return;
            }
            this._className = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "closable", {
        /**
         * Get the closable state for the title.
         *
         * #### Notes
         * The default value is `false`.
         */
        get: function () {
            return this._closable;
        },
        /**
         * Set the closable state for the title.
         *
         * #### Notes
         * This controls the presence of a close icon when applicable.
         */
        set: function (value) {
            if (this._closable === value) {
                return;
            }
            this._closable = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Title.prototype, "dataset", {
        /**
         * Get the dataset for the title.
         *
         * #### Notes
         * The default value is an empty dataset.
         */
        get: function () {
            return this._dataset;
        },
        /**
         * Set the dataset for the title.
         *
         * #### Notes
         * This controls the data attributes when applicable.
         */
        set: function (value) {
            if (this._dataset === value) {
                return;
            }
            this._dataset = value;
            this._changed.emit(undefined);
        },
        enumerable: true,
        configurable: true
    });
    return Title;
}());

/**
 * The base class of the lumino widget hierarchy.
 *
 * #### Notes
 * This class will typically be subclassed in order to create a useful
 * widget. However, it can be used directly to host externally created
 * content.
 */
var index_es6_Widget = /** @class */ (function () {
    /**
     * Construct a new widget.
     *
     * @param options - The options for initializing the widget.
     */
    function Widget(options) {
        if (options === void 0) { options = {}; }
        this._flags = 0;
        this._layout = null;
        this._parent = null;
        this._disposed = new Signal(this);
        this.node = Private$j.createNode(options);
        this.addClass('lm-Widget');
        /* <DEPRECATED> */
        this.addClass('p-Widget');
        /* </DEPRECATED> */
    }
    /**
     * Dispose of the widget and its descendant widgets.
     *
     * #### Notes
     * It is unsafe to use the widget after it has been disposed.
     *
     * All calls made to this method after the first are a no-op.
     */
    Widget.prototype.dispose = function () {
        // Do nothing if the widget is already disposed.
        if (this.isDisposed) {
            return;
        }
        // Set the disposed flag and emit the disposed signal.
        this.setFlag(Widget.Flag.IsDisposed);
        this._disposed.emit(undefined);
        // Remove or detach the widget if necessary.
        if (this.parent) {
            this.parent = null;
        }
        else if (this.isAttached) {
            Widget.detach(this);
        }
        // Dispose of the widget layout.
        if (this._layout) {
            this._layout.dispose();
            this._layout = null;
        }
        // Clear the extra data associated with the widget.
        Signal.clearData(this);
        index_es6_MessageLoop.clearData(this);
        AttachedProperty.clearData(this);
    };
    Object.defineProperty(Widget.prototype, "disposed", {
        /**
         * A signal emitted when the widget is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "isDisposed", {
        /**
         * Test whether the widget has been disposed.
         */
        get: function () {
            return this.testFlag(Widget.Flag.IsDisposed);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "isAttached", {
        /**
         * Test whether the widget's node is attached to the DOM.
         */
        get: function () {
            return this.testFlag(Widget.Flag.IsAttached);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "isHidden", {
        /**
         * Test whether the widget is explicitly hidden.
         */
        get: function () {
            return this.testFlag(Widget.Flag.IsHidden);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "isVisible", {
        /**
         * Test whether the widget is visible.
         *
         * #### Notes
         * A widget is visible when it is attached to the DOM, is not
         * explicitly hidden, and has no explicitly hidden ancestors.
         */
        get: function () {
            return this.testFlag(Widget.Flag.IsVisible);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "title", {
        /**
         * The title object for the widget.
         *
         * #### Notes
         * The title object is used by some container widgets when displaying
         * the widget alongside some title, such as a tab panel or side bar.
         *
         * Since not all widgets will use the title, it is created on demand.
         *
         * The `owner` property of the title is set to this widget.
         */
        get: function () {
            return Private$j.titleProperty.get(this);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "id", {
        /**
         * Get the id of the widget's DOM node.
         */
        get: function () {
            return this.node.id;
        },
        /**
         * Set the id of the widget's DOM node.
         */
        set: function (value) {
            this.node.id = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "dataset", {
        /**
         * The dataset for the widget's DOM node.
         */
        get: function () {
            return this.node.dataset;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "parent", {
        /**
         * Get the parent of the widget.
         */
        get: function () {
            return this._parent;
        },
        /**
         * Set the parent of the widget.
         *
         * #### Notes
         * Children are typically added to a widget by using a layout, which
         * means user code will not normally set the parent widget directly.
         *
         * The widget will be automatically removed from its old parent.
         *
         * This is a no-op if there is no effective parent change.
         */
        set: function (value) {
            if (this._parent === value) {
                return;
            }
            if (value && this.contains(value)) {
                throw new Error('Invalid parent widget.');
            }
            if (this._parent && !this._parent.isDisposed) {
                var msg = new Widget.ChildMessage('child-removed', this);
                index_es6_MessageLoop.sendMessage(this._parent, msg);
            }
            this._parent = value;
            if (this._parent && !this._parent.isDisposed) {
                var msg = new Widget.ChildMessage('child-added', this);
                index_es6_MessageLoop.sendMessage(this._parent, msg);
            }
            if (!this.isDisposed) {
                index_es6_MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Widget.prototype, "layout", {
        /**
         * Get the layout for the widget.
         */
        get: function () {
            return this._layout;
        },
        /**
         * Set the layout for the widget.
         *
         * #### Notes
         * The layout is single-use only. It cannot be changed after the
         * first assignment.
         *
         * The layout is disposed automatically when the widget is disposed.
         */
        set: function (value) {
            if (this._layout === value) {
                return;
            }
            if (this.testFlag(Widget.Flag.DisallowLayout)) {
                throw new Error('Cannot set widget layout.');
            }
            if (this._layout) {
                throw new Error('Cannot change widget layout.');
            }
            if (value.parent) {
                throw new Error('Cannot change layout parent.');
            }
            this._layout = value;
            value.parent = this;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the widget's children.
     *
     * @returns A new iterator over the children of the widget.
     *
     * #### Notes
     * The widget must have a populated layout in order to have children.
     *
     * If a layout is not installed, the returned iterator will be empty.
     */
    Widget.prototype.children = function () {
        return this._layout ? this._layout.iter() : empty();
    };
    /**
     * Test whether a widget is a descendant of this widget.
     *
     * @param widget - The descendant widget of interest.
     *
     * @returns `true` if the widget is a descendant, `false` otherwise.
     */
    Widget.prototype.contains = function (widget) {
        for (var value = widget; value; value = value._parent) {
            if (value === this) {
                return true;
            }
        }
        return false;
    };
    /**
     * Test whether the widget's DOM node has the given class name.
     *
     * @param name - The class name of interest.
     *
     * @returns `true` if the node has the class, `false` otherwise.
     */
    Widget.prototype.hasClass = function (name) {
        return this.node.classList.contains(name);
    };
    /**
     * Add a class name to the widget's DOM node.
     *
     * @param name - The class name to add to the node.
     *
     * #### Notes
     * If the class name is already added to the node, this is a no-op.
     *
     * The class name must not contain whitespace.
     */
    Widget.prototype.addClass = function (name) {
        this.node.classList.add(name);
    };
    /**
     * Remove a class name from the widget's DOM node.
     *
     * @param name - The class name to remove from the node.
     *
     * #### Notes
     * If the class name is not yet added to the node, this is a no-op.
     *
     * The class name must not contain whitespace.
     */
    Widget.prototype.removeClass = function (name) {
        this.node.classList.remove(name);
    };
    /**
     * Toggle a class name on the widget's DOM node.
     *
     * @param name - The class name to toggle on the node.
     *
     * @param force - Whether to force add the class (`true`) or force
     *   remove the class (`false`). If not provided, the presence of
     *   the class will be toggled from its current state.
     *
     * @returns `true` if the class is now present, `false` otherwise.
     *
     * #### Notes
     * The class name must not contain whitespace.
     */
    Widget.prototype.toggleClass = function (name, force) {
        if (force === true) {
            this.node.classList.add(name);
            return true;
        }
        if (force === false) {
            this.node.classList.remove(name);
            return false;
        }
        return this.node.classList.toggle(name);
    };
    /**
     * Post an `'update-request'` message to the widget.
     *
     * #### Notes
     * This is a simple convenience method for posting the message.
     */
    Widget.prototype.update = function () {
        index_es6_MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);
    };
    /**
     * Post a `'fit-request'` message to the widget.
     *
     * #### Notes
     * This is a simple convenience method for posting the message.
     */
    Widget.prototype.fit = function () {
        index_es6_MessageLoop.postMessage(this, Widget.Msg.FitRequest);
    };
    /**
     * Post an `'activate-request'` message to the widget.
     *
     * #### Notes
     * This is a simple convenience method for posting the message.
     */
    Widget.prototype.activate = function () {
        index_es6_MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);
    };
    /**
     * Send a `'close-request'` message to the widget.
     *
     * #### Notes
     * This is a simple convenience method for sending the message.
     */
    Widget.prototype.close = function () {
        index_es6_MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);
    };
    /**
     * Show the widget and make it visible to its parent widget.
     *
     * #### Notes
     * This causes the [[isHidden]] property to be `false`.
     *
     * If the widget is not explicitly hidden, this is a no-op.
     */
    Widget.prototype.show = function () {
        if (!this.testFlag(Widget.Flag.IsHidden)) {
            return;
        }
        if (this.isAttached && (!this.parent || this.parent.isVisible)) {
            index_es6_MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);
        }
        this.clearFlag(Widget.Flag.IsHidden);
        this.removeClass('lm-mod-hidden');
        /* <DEPRECATED> */
        this.removeClass('p-mod-hidden');
        /* </DEPRECATED> */
        if (this.isAttached && (!this.parent || this.parent.isVisible)) {
            index_es6_MessageLoop.sendMessage(this, Widget.Msg.AfterShow);
        }
        if (this.parent) {
            var msg = new Widget.ChildMessage('child-shown', this);
            index_es6_MessageLoop.sendMessage(this.parent, msg);
        }
    };
    /**
     * Hide the widget and make it hidden to its parent widget.
     *
     * #### Notes
     * This causes the [[isHidden]] property to be `true`.
     *
     * If the widget is explicitly hidden, this is a no-op.
     */
    Widget.prototype.hide = function () {
        if (this.testFlag(Widget.Flag.IsHidden)) {
            return;
        }
        if (this.isAttached && (!this.parent || this.parent.isVisible)) {
            index_es6_MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);
        }
        this.setFlag(Widget.Flag.IsHidden);
        this.addClass('lm-mod-hidden');
        /* <DEPRECATED> */
        this.addClass('p-mod-hidden');
        /* </DEPRECATED> */
        if (this.isAttached && (!this.parent || this.parent.isVisible)) {
            index_es6_MessageLoop.sendMessage(this, Widget.Msg.AfterHide);
        }
        if (this.parent) {
            var msg = new Widget.ChildMessage('child-hidden', this);
            index_es6_MessageLoop.sendMessage(this.parent, msg);
        }
    };
    /**
     * Show or hide the widget according to a boolean value.
     *
     * @param hidden - `true` to hide the widget, or `false` to show it.
     *
     * #### Notes
     * This is a convenience method for `hide()` and `show()`.
     */
    Widget.prototype.setHidden = function (hidden) {
        if (hidden) {
            this.hide();
        }
        else {
            this.show();
        }
    };
    /**
     * Test whether the given widget flag is set.
     *
     * #### Notes
     * This will not typically be called directly by user code.
     */
    Widget.prototype.testFlag = function (flag) {
        return (this._flags & flag) !== 0;
    };
    /**
     * Set the given widget flag.
     *
     * #### Notes
     * This will not typically be called directly by user code.
     */
    Widget.prototype.setFlag = function (flag) {
        this._flags |= flag;
    };
    /**
     * Clear the given widget flag.
     *
     * #### Notes
     * This will not typically be called directly by user code.
     */
    Widget.prototype.clearFlag = function (flag) {
        this._flags &= ~flag;
    };
    /**
     * Process a message sent to the widget.
     *
     * @param msg - The message sent to the widget.
     *
     * #### Notes
     * Subclasses may reimplement this method as needed.
     */
    Widget.prototype.processMessage = function (msg) {
        switch (msg.type) {
            case 'resize':
                this.notifyLayout(msg);
                this.onResize(msg);
                break;
            case 'update-request':
                this.notifyLayout(msg);
                this.onUpdateRequest(msg);
                break;
            case 'fit-request':
                this.notifyLayout(msg);
                this.onFitRequest(msg);
                break;
            case 'before-show':
                this.notifyLayout(msg);
                this.onBeforeShow(msg);
                break;
            case 'after-show':
                this.setFlag(Widget.Flag.IsVisible);
                this.notifyLayout(msg);
                this.onAfterShow(msg);
                break;
            case 'before-hide':
                this.notifyLayout(msg);
                this.onBeforeHide(msg);
                break;
            case 'after-hide':
                this.clearFlag(Widget.Flag.IsVisible);
                this.notifyLayout(msg);
                this.onAfterHide(msg);
                break;
            case 'before-attach':
                this.notifyLayout(msg);
                this.onBeforeAttach(msg);
                break;
            case 'after-attach':
                if (!this.isHidden && (!this.parent || this.parent.isVisible)) {
                    this.setFlag(Widget.Flag.IsVisible);
                }
                this.setFlag(Widget.Flag.IsAttached);
                this.notifyLayout(msg);
                this.onAfterAttach(msg);
                break;
            case 'before-detach':
                this.notifyLayout(msg);
                this.onBeforeDetach(msg);
                break;
            case 'after-detach':
                this.clearFlag(Widget.Flag.IsVisible);
                this.clearFlag(Widget.Flag.IsAttached);
                this.notifyLayout(msg);
                this.onAfterDetach(msg);
                break;
            case 'activate-request':
                this.notifyLayout(msg);
                this.onActivateRequest(msg);
                break;
            case 'close-request':
                this.notifyLayout(msg);
                this.onCloseRequest(msg);
                break;
            case 'child-added':
                this.notifyLayout(msg);
                this.onChildAdded(msg);
                break;
            case 'child-removed':
                this.notifyLayout(msg);
                this.onChildRemoved(msg);
                break;
            default:
                this.notifyLayout(msg);
                break;
        }
    };
    /**
     * Invoke the message processing routine of the widget's layout.
     *
     * @param msg - The message to dispatch to the layout.
     *
     * #### Notes
     * This is a no-op if the widget does not have a layout.
     *
     * This will not typically be called directly by user code.
     */
    Widget.prototype.notifyLayout = function (msg) {
        if (this._layout) {
            this._layout.processParentMessage(msg);
        }
    };
    /**
     * A message handler invoked on a `'close-request'` message.
     *
     * #### Notes
     * The default implementation unparents or detaches the widget.
     */
    Widget.prototype.onCloseRequest = function (msg) {
        if (this.parent) {
            this.parent = null;
        }
        else if (this.isAttached) {
            Widget.detach(this);
        }
    };
    /**
     * A message handler invoked on a `'resize'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onResize = function (msg) { };
    /**
     * A message handler invoked on an `'update-request'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onUpdateRequest = function (msg) { };
    /**
     * A message handler invoked on a `'fit-request'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onFitRequest = function (msg) { };
    /**
     * A message handler invoked on an `'activate-request'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onActivateRequest = function (msg) { };
    /**
     * A message handler invoked on a `'before-show'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onBeforeShow = function (msg) { };
    /**
     * A message handler invoked on an `'after-show'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onAfterShow = function (msg) { };
    /**
     * A message handler invoked on a `'before-hide'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onBeforeHide = function (msg) { };
    /**
     * A message handler invoked on an `'after-hide'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onAfterHide = function (msg) { };
    /**
     * A message handler invoked on a `'before-attach'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onBeforeAttach = function (msg) { };
    /**
     * A message handler invoked on an `'after-attach'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onAfterAttach = function (msg) { };
    /**
     * A message handler invoked on a `'before-detach'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onBeforeDetach = function (msg) { };
    /**
     * A message handler invoked on an `'after-detach'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onAfterDetach = function (msg) { };
    /**
     * A message handler invoked on a `'child-added'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onChildAdded = function (msg) { };
    /**
     * A message handler invoked on a `'child-removed'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Widget.prototype.onChildRemoved = function (msg) { };
    return Widget;
}());
/**
 * The namespace for the `Widget` class statics.
 */
(function (Widget) {
    (function (Flag) {
        /**
         * The widget has been disposed.
         */
        Flag[Flag["IsDisposed"] = 1] = "IsDisposed";
        /**
         * The widget is attached to the DOM.
         */
        Flag[Flag["IsAttached"] = 2] = "IsAttached";
        /**
         * The widget is hidden.
         */
        Flag[Flag["IsHidden"] = 4] = "IsHidden";
        /**
         * The widget is visible.
         */
        Flag[Flag["IsVisible"] = 8] = "IsVisible";
        /**
         * A layout cannot be set on the widget.
         */
        Flag[Flag["DisallowLayout"] = 16] = "DisallowLayout";
    })(Widget.Flag || (Widget.Flag = {}));
    (function (Msg) {
        /**
         * A singleton `'before-show'` message.
         *
         * #### Notes
         * This message is sent to a widget before it becomes visible.
         *
         * This message is **not** sent when the widget is being attached.
         */
        Msg.BeforeShow = new Message('before-show');
        /**
         * A singleton `'after-show'` message.
         *
         * #### Notes
         * This message is sent to a widget after it becomes visible.
         *
         * This message is **not** sent when the widget is being attached.
         */
        Msg.AfterShow = new Message('after-show');
        /**
         * A singleton `'before-hide'` message.
         *
         * #### Notes
         * This message is sent to a widget before it becomes not-visible.
         *
         * This message is **not** sent when the widget is being detached.
         */
        Msg.BeforeHide = new Message('before-hide');
        /**
         * A singleton `'after-hide'` message.
         *
         * #### Notes
         * This message is sent to a widget after it becomes not-visible.
         *
         * This message is **not** sent when the widget is being detached.
         */
        Msg.AfterHide = new Message('after-hide');
        /**
         * A singleton `'before-attach'` message.
         *
         * #### Notes
         * This message is sent to a widget before it is attached.
         */
        Msg.BeforeAttach = new Message('before-attach');
        /**
         * A singleton `'after-attach'` message.
         *
         * #### Notes
         * This message is sent to a widget after it is attached.
         */
        Msg.AfterAttach = new Message('after-attach');
        /**
         * A singleton `'before-detach'` message.
         *
         * #### Notes
         * This message is sent to a widget before it is detached.
         */
        Msg.BeforeDetach = new Message('before-detach');
        /**
         * A singleton `'after-detach'` message.
         *
         * #### Notes
         * This message is sent to a widget after it is detached.
         */
        Msg.AfterDetach = new Message('after-detach');
        /**
         * A singleton `'parent-changed'` message.
         *
         * #### Notes
         * This message is sent to a widget when its parent has changed.
         */
        Msg.ParentChanged = new Message('parent-changed');
        /**
         * A singleton conflatable `'update-request'` message.
         *
         * #### Notes
         * This message can be dispatched to supporting widgets in order to
         * update their content based on the current widget state. Not all
         * widgets will respond to messages of this type.
         *
         * For widgets with a layout, this message will inform the layout to
         * update the position and size of its child widgets.
         */
        Msg.UpdateRequest = new ConflatableMessage('update-request');
        /**
         * A singleton conflatable `'fit-request'` message.
         *
         * #### Notes
         * For widgets with a layout, this message will inform the layout to
         * recalculate its size constraints to fit the space requirements of
         * its child widgets, and to update their position and size. Not all
         * layouts will respond to messages of this type.
         */
        Msg.FitRequest = new ConflatableMessage('fit-request');
        /**
         * A singleton conflatable `'activate-request'` message.
         *
         * #### Notes
         * This message should be dispatched to a widget when it should
         * perform the actions necessary to activate the widget, which
         * may include focusing its node or descendant node.
         */
        Msg.ActivateRequest = new ConflatableMessage('activate-request');
        /**
         * A singleton conflatable `'close-request'` message.
         *
         * #### Notes
         * This message should be dispatched to a widget when it should close
         * and remove itself from the widget hierarchy.
         */
        Msg.CloseRequest = new ConflatableMessage('close-request');
    })(Widget.Msg || (Widget.Msg = {}));
    /**
     * A message class for child related messages.
     */
    var ChildMessage = /** @class */ (function (_super) {
        widgets_dist_index_es6_extends(ChildMessage, _super);
        /**
         * Construct a new child message.
         *
         * @param type - The message type.
         *
         * @param child - The child widget for the message.
         */
        function ChildMessage(type, child) {
            var _this = _super.call(this, type) || this;
            _this.child = child;
            return _this;
        }
        return ChildMessage;
    }(Message));
    Widget.ChildMessage = ChildMessage;
    /**
     * A message class for `'resize'` messages.
     */
    var ResizeMessage = /** @class */ (function (_super) {
        widgets_dist_index_es6_extends(ResizeMessage, _super);
        /**
         * Construct a new resize message.
         *
         * @param width - The **offset width** of the widget, or `-1` if
         *   the width is not known.
         *
         * @param height - The **offset height** of the widget, or `-1` if
         *   the height is not known.
         */
        function ResizeMessage(width, height) {
            var _this = _super.call(this, 'resize') || this;
            _this.width = width;
            _this.height = height;
            return _this;
        }
        return ResizeMessage;
    }(Message));
    Widget.ResizeMessage = ResizeMessage;
    /**
     * The namespace for the `ResizeMessage` class statics.
     */
    (function (ResizeMessage) {
        /**
         * A singleton `'resize'` message with an unknown size.
         */
        ResizeMessage.UnknownSize = new ResizeMessage(-1, -1);
    })(ResizeMessage = Widget.ResizeMessage || (Widget.ResizeMessage = {}));
    /**
     * Attach a widget to a host DOM node.
     *
     * @param widget - The widget of interest.
     *
     * @param host - The DOM node to use as the widget's host.
     *
     * @param ref - The child of `host` to use as the reference element.
     *   If this is provided, the widget will be inserted before this
     *   node in the host. The default is `null`, which will cause the
     *   widget to be added as the last child of the host.
     *
     * #### Notes
     * This will throw an error if the widget is not a root widget, if
     * the widget is already attached, or if the host is not attached
     * to the DOM.
     */
    function attach(widget, host, ref) {
        if (ref === void 0) { ref = null; }
        if (widget.parent) {
            throw new Error('Cannot attach a child widget.');
        }
        if (widget.isAttached || document.body.contains(widget.node)) {
            throw new Error('Widget is already attached.');
        }
        if (!document.body.contains(host)) {
            throw new Error('Host is not attached.');
        }
        index_es6_MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);
        host.insertBefore(widget.node, ref);
        index_es6_MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);
    }
    Widget.attach = attach;
    /**
     * Detach the widget from its host DOM node.
     *
     * @param widget - The widget of interest.
     *
     * #### Notes
     * This will throw an error if the widget is not a root widget,
     * or if the widget is not attached to the DOM.
     */
    function detach(widget) {
        if (widget.parent) {
            throw new Error('Cannot detach a child widget.');
        }
        if (!widget.isAttached || !document.body.contains(widget.node)) {
            throw new Error('Widget is not attached.');
        }
        index_es6_MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);
        widget.node.parentNode.removeChild(widget.node);
        index_es6_MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);
    }
    Widget.detach = detach;
})(index_es6_Widget || (index_es6_Widget = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$j;
(function (Private) {
    /**
     * An attached property for the widget title object.
     */
    Private.titleProperty = new AttachedProperty({
        name: 'title',
        create: function (owner) { return new index_es6_Title({ owner: owner }); }
    });
    /**
     * Create a DOM node for the given widget options.
     */
    function createNode(options) {
        return options.node || document.createElement(options.tag || 'div');
    }
    Private.createNode = createNode;
})(Private$j || (Private$j = {}));

/* eslint-disable @typescript-eslint/no-empty-function */
/**
 * An abstract base class for creating lumino layouts.
 *
 * #### Notes
 * A layout is used to add widgets to a parent and to arrange those
 * widgets within the parent's DOM node.
 *
 * This class implements the base functionality which is required of
 * nearly all layouts. It must be subclassed in order to be useful.
 *
 * Notably, this class does not define a uniform interface for adding
 * widgets to the layout. A subclass should define that API in a way
 * which is meaningful for its intended use.
 */
var index_es6_Layout = /** @class */ (function () {
    /**
     * Construct a new layout.
     *
     * @param options - The options for initializing the layout.
     */
    function Layout(options) {
        if (options === void 0) { options = {}; }
        this._disposed = false;
        this._parent = null;
        this._fitPolicy = options.fitPolicy || 'set-min-size';
    }
    /**
     * Dispose of the resources held by the layout.
     *
     * #### Notes
     * This should be reimplemented to clear and dispose of the widgets.
     *
     * All reimplementations should call the superclass method.
     *
     * This method is called automatically when the parent is disposed.
     */
    Layout.prototype.dispose = function () {
        this._parent = null;
        this._disposed = true;
        Signal.clearData(this);
        AttachedProperty.clearData(this);
    };
    Object.defineProperty(Layout.prototype, "isDisposed", {
        /**
         * Test whether the layout is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Layout.prototype, "parent", {
        /**
         * Get the parent widget of the layout.
         */
        get: function () {
            return this._parent;
        },
        /**
         * Set the parent widget of the layout.
         *
         * #### Notes
         * This is set automatically when installing the layout on the parent
         * widget. The parent widget should not be set directly by user code.
         */
        set: function (value) {
            if (this._parent === value) {
                return;
            }
            if (this._parent) {
                throw new Error('Cannot change parent widget.');
            }
            if (value.layout !== this) {
                throw new Error('Invalid parent widget.');
            }
            this._parent = value;
            this.init();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Layout.prototype, "fitPolicy", {
        /**
         * Get the fit policy for the layout.
         *
         * #### Notes
         * The fit policy controls the computed size constraints which are
         * applied to the parent widget by the layout.
         *
         * Some layout implementations may ignore the fit policy.
         */
        get: function () {
            return this._fitPolicy;
        },
        /**
         * Set the fit policy for the layout.
         *
         * #### Notes
         * The fit policy controls the computed size constraints which are
         * applied to the parent widget by the layout.
         *
         * Some layout implementations may ignore the fit policy.
         *
         * Changing the fit policy will clear the current size constraint
         * for the parent widget and then re-fit the parent.
         */
        set: function (value) {
            // Bail if the policy does not change
            if (this._fitPolicy === value) {
                return;
            }
            // Update the internal policy.
            this._fitPolicy = value;
            // Clear the size constraints and schedule a fit of the parent.
            if (this._parent) {
                var style = this._parent.node.style;
                style.minWidth = '';
                style.minHeight = '';
                style.maxWidth = '';
                style.maxHeight = '';
                this._parent.fit();
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Process a message sent to the parent widget.
     *
     * @param msg - The message sent to the parent widget.
     *
     * #### Notes
     * This method is called by the parent widget to process a message.
     *
     * Subclasses may reimplement this method as needed.
     */
    Layout.prototype.processParentMessage = function (msg) {
        switch (msg.type) {
            case 'resize':
                this.onResize(msg);
                break;
            case 'update-request':
                this.onUpdateRequest(msg);
                break;
            case 'fit-request':
                this.onFitRequest(msg);
                break;
            case 'before-show':
                this.onBeforeShow(msg);
                break;
            case 'after-show':
                this.onAfterShow(msg);
                break;
            case 'before-hide':
                this.onBeforeHide(msg);
                break;
            case 'after-hide':
                this.onAfterHide(msg);
                break;
            case 'before-attach':
                this.onBeforeAttach(msg);
                break;
            case 'after-attach':
                this.onAfterAttach(msg);
                break;
            case 'before-detach':
                this.onBeforeDetach(msg);
                break;
            case 'after-detach':
                this.onAfterDetach(msg);
                break;
            case 'child-removed':
                this.onChildRemoved(msg);
                break;
            case 'child-shown':
                this.onChildShown(msg);
                break;
            case 'child-hidden':
                this.onChildHidden(msg);
                break;
        }
    };
    /**
     * Perform layout initialization which requires the parent widget.
     *
     * #### Notes
     * This method is invoked immediately after the layout is installed
     * on the parent widget.
     *
     * The default implementation reparents all of the widgets to the
     * layout parent widget.
     *
     * Subclasses should reimplement this method and attach the child
     * widget nodes to the parent widget's node.
     */
    Layout.prototype.init = function () {
        var _this = this;
        each(this, function (widget) {
            widget.parent = _this.parent;
        });
    };
    /**
     * A message handler invoked on a `'resize'` message.
     *
     * #### Notes
     * The layout should ensure that its widgets are resized according
     * to the specified layout space, and that they are sent a `'resize'`
     * message if appropriate.
     *
     * The default implementation of this method sends an `UnknownSize`
     * resize message to all widgets.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onResize = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.ResizeMessage.UnknownSize);
        });
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     *
     * #### Notes
     * The layout should ensure that its widgets are resized according
     * to the available layout space, and that they are sent a `'resize'`
     * message if appropriate.
     *
     * The default implementation of this method sends an `UnknownSize`
     * resize message to all widgets.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onUpdateRequest = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.ResizeMessage.UnknownSize);
        });
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message
     * to all widgets. It assumes all widget nodes are attached to the
     * parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onBeforeAttach = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, msg);
        });
    };
    /**
     * A message handler invoked on an `'after-attach'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message
     * to all widgets. It assumes all widget nodes are attached to the
     * parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onAfterAttach = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, msg);
        });
    };
    /**
     * A message handler invoked on a `'before-detach'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message
     * to all widgets. It assumes all widget nodes are attached to the
     * parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onBeforeDetach = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, msg);
        });
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message
     * to all widgets. It assumes all widget nodes are attached to the
     * parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onAfterDetach = function (msg) {
        each(this, function (widget) {
            index_es6_MessageLoop.sendMessage(widget, msg);
        });
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message to
     * all non-hidden widgets. It assumes all widget nodes are attached
     * to the parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onBeforeShow = function (msg) {
        each(this, function (widget) {
            if (!widget.isHidden) {
                index_es6_MessageLoop.sendMessage(widget, msg);
            }
        });
    };
    /**
     * A message handler invoked on an `'after-show'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message to
     * all non-hidden widgets. It assumes all widget nodes are attached
     * to the parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onAfterShow = function (msg) {
        each(this, function (widget) {
            if (!widget.isHidden) {
                index_es6_MessageLoop.sendMessage(widget, msg);
            }
        });
    };
    /**
     * A message handler invoked on a `'before-hide'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message to
     * all non-hidden widgets. It assumes all widget nodes are attached
     * to the parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onBeforeHide = function (msg) {
        each(this, function (widget) {
            if (!widget.isHidden) {
                index_es6_MessageLoop.sendMessage(widget, msg);
            }
        });
    };
    /**
     * A message handler invoked on an `'after-hide'` message.
     *
     * #### Notes
     * The default implementation of this method forwards the message to
     * all non-hidden widgets. It assumes all widget nodes are attached
     * to the parent widget node.
     *
     * This may be reimplemented by subclasses as needed.
     */
    Layout.prototype.onAfterHide = function (msg) {
        each(this, function (widget) {
            if (!widget.isHidden) {
                index_es6_MessageLoop.sendMessage(widget, msg);
            }
        });
    };
    /**
     * A message handler invoked on a `'child-removed'` message.
     *
     * #### Notes
     * This will remove the child widget from the layout.
     *
     * Subclasses should **not** typically reimplement this method.
     */
    Layout.prototype.onChildRemoved = function (msg) {
        this.removeWidget(msg.child);
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Layout.prototype.onFitRequest = function (msg) { };
    /**
     * A message handler invoked on a `'child-shown'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Layout.prototype.onChildShown = function (msg) { };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     *
     * #### Notes
     * The default implementation of this handler is a no-op.
     */
    Layout.prototype.onChildHidden = function (msg) { };
    return Layout;
}());
/**
 * The namespace for the `Layout` class statics.
 */
(function (Layout) {
    /**
     * Get the horizontal alignment for a widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The horizontal alignment for the widget.
     *
     * #### Notes
     * If the layout width allocated to a widget is larger than its max
     * width, the horizontal alignment controls how the widget is placed
     * within the extra horizontal space.
     *
     * If the allocated width is less than the widget's max width, the
     * horizontal alignment has no effect.
     *
     * Some layout implementations may ignore horizontal alignment.
     */
    function getHorizontalAlignment(widget) {
        return Private$i.horizontalAlignmentProperty.get(widget);
    }
    Layout.getHorizontalAlignment = getHorizontalAlignment;
    /**
     * Set the horizontal alignment for a widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the horizontal alignment.
     *
     * #### Notes
     * If the layout width allocated to a widget is larger than its max
     * width, the horizontal alignment controls how the widget is placed
     * within the extra horizontal space.
     *
     * If the allocated width is less than the widget's max width, the
     * horizontal alignment has no effect.
     *
     * Some layout implementations may ignore horizontal alignment.
     *
     * Changing the horizontal alignment will post an `update-request`
     * message to widget's parent, provided the parent has a layout
     * installed.
     */
    function setHorizontalAlignment(widget, value) {
        Private$i.horizontalAlignmentProperty.set(widget, value);
    }
    Layout.setHorizontalAlignment = setHorizontalAlignment;
    /**
     * Get the vertical alignment for a widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The vertical alignment for the widget.
     *
     * #### Notes
     * If the layout height allocated to a widget is larger than its max
     * height, the vertical alignment controls how the widget is placed
     * within the extra vertical space.
     *
     * If the allocated height is less than the widget's max height, the
     * vertical alignment has no effect.
     *
     * Some layout implementations may ignore vertical alignment.
     */
    function getVerticalAlignment(widget) {
        return Private$i.verticalAlignmentProperty.get(widget);
    }
    Layout.getVerticalAlignment = getVerticalAlignment;
    /**
     * Set the vertical alignment for a widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the vertical alignment.
     *
     * #### Notes
     * If the layout height allocated to a widget is larger than its max
     * height, the vertical alignment controls how the widget is placed
     * within the extra vertical space.
     *
     * If the allocated height is less than the widget's max height, the
     * vertical alignment has no effect.
     *
     * Some layout implementations may ignore vertical alignment.
     *
     * Changing the horizontal alignment will post an `update-request`
     * message to widget's parent, provided the parent has a layout
     * installed.
     */
    function setVerticalAlignment(widget, value) {
        Private$i.verticalAlignmentProperty.set(widget, value);
    }
    Layout.setVerticalAlignment = setVerticalAlignment;
})(index_es6_Layout || (index_es6_Layout = {}));
/**
 * An object which assists in the absolute layout of widgets.
 *
 * #### Notes
 * This class is useful when implementing a layout which arranges its
 * widgets using absolute positioning.
 *
 * This class is used by nearly all of the built-in lumino layouts.
 */
var index_es6_LayoutItem = /** @class */ (function () {
    /**
     * Construct a new layout item.
     *
     * @param widget - The widget to be managed by the item.
     *
     * #### Notes
     * The widget will be set to absolute positioning.
     */
    function LayoutItem(widget) {
        this._top = NaN;
        this._left = NaN;
        this._width = NaN;
        this._height = NaN;
        this._minWidth = 0;
        this._minHeight = 0;
        this._maxWidth = Infinity;
        this._maxHeight = Infinity;
        this._disposed = false;
        this.widget = widget;
        this.widget.node.style.position = 'absolute';
    }
    /**
     * Dispose of the the layout item.
     *
     * #### Notes
     * This will reset the positioning of the widget.
     */
    LayoutItem.prototype.dispose = function () {
        // Do nothing if the item is already disposed.
        if (this._disposed) {
            return;
        }
        // Mark the item as disposed.
        this._disposed = true;
        // Reset the widget style.
        var style = this.widget.node.style;
        style.position = '';
        style.top = '';
        style.left = '';
        style.width = '';
        style.height = '';
    };
    Object.defineProperty(LayoutItem.prototype, "minWidth", {
        /**
         * The computed minimum width of the widget.
         *
         * #### Notes
         * This value can be updated by calling the `fit` method.
         */
        get: function () {
            return this._minWidth;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "minHeight", {
        /**
         * The computed minimum height of the widget.
         *
         * #### Notes
         * This value can be updated by calling the `fit` method.
         */
        get: function () {
            return this._minHeight;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "maxWidth", {
        /**
         * The computed maximum width of the widget.
         *
         * #### Notes
         * This value can be updated by calling the `fit` method.
         */
        get: function () {
            return this._maxWidth;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "maxHeight", {
        /**
         * The computed maximum height of the widget.
         *
         * #### Notes
         * This value can be updated by calling the `fit` method.
         */
        get: function () {
            return this._maxHeight;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "isDisposed", {
        /**
         * Whether the layout item is disposed.
         */
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "isHidden", {
        /**
         * Whether the managed widget is hidden.
         */
        get: function () {
            return this.widget.isHidden;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "isVisible", {
        /**
         * Whether the managed widget is visible.
         */
        get: function () {
            return this.widget.isVisible;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(LayoutItem.prototype, "isAttached", {
        /**
         * Whether the managed widget is attached.
         */
        get: function () {
            return this.widget.isAttached;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Update the computed size limits of the managed widget.
     */
    LayoutItem.prototype.fit = function () {
        var limits = ElementExt.sizeLimits(this.widget.node);
        this._minWidth = limits.minWidth;
        this._minHeight = limits.minHeight;
        this._maxWidth = limits.maxWidth;
        this._maxHeight = limits.maxHeight;
    };
    /**
     * Update the position and size of the managed widget.
     *
     * @param left - The left edge position of the layout box.
     *
     * @param top - The top edge position of the layout box.
     *
     * @param width - The width of the layout box.
     *
     * @param height - The height of the layout box.
     */
    LayoutItem.prototype.update = function (left, top, width, height) {
        // Clamp the size to the computed size limits.
        var clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));
        var clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));
        // Adjust the left edge for the horizontal alignment, if needed.
        if (clampW < width) {
            switch (index_es6_Layout.getHorizontalAlignment(this.widget)) {
                case 'left':
                    break;
                case 'center':
                    left += (width - clampW) / 2;
                    break;
                case 'right':
                    left += width - clampW;
                    break;
                default:
                    throw 'unreachable';
            }
        }
        // Adjust the top edge for the vertical alignment, if needed.
        if (clampH < height) {
            switch (index_es6_Layout.getVerticalAlignment(this.widget)) {
                case 'top':
                    break;
                case 'center':
                    top += (height - clampH) / 2;
                    break;
                case 'bottom':
                    top += height - clampH;
                    break;
                default:
                    throw 'unreachable';
            }
        }
        // Set up the resize variables.
        var resized = false;
        var style = this.widget.node.style;
        // Update the top edge of the widget if needed.
        if (this._top !== top) {
            this._top = top;
            style.top = top + "px";
        }
        // Update the left edge of the widget if needed.
        if (this._left !== left) {
            this._left = left;
            style.left = left + "px";
        }
        // Update the width of the widget if needed.
        if (this._width !== clampW) {
            resized = true;
            this._width = clampW;
            style.width = clampW + "px";
        }
        // Update the height of the widget if needed.
        if (this._height !== clampH) {
            resized = true;
            this._height = clampH;
            style.height = clampH + "px";
        }
        // Send a resize message to the widget if needed.
        if (resized) {
            var msg = new index_es6_Widget.ResizeMessage(clampW, clampH);
            index_es6_MessageLoop.sendMessage(this.widget, msg);
        }
    };
    return LayoutItem;
}());
/**
 * The namespace for the module implementation details.
 */
var Private$i;
(function (Private) {
    /**
     * The attached property for a widget horizontal alignment.
     */
    Private.horizontalAlignmentProperty = new AttachedProperty({
        name: 'horizontalAlignment',
        create: function () { return 'center'; },
        changed: onAlignmentChanged
    });
    /**
     * The attached property for a widget vertical alignment.
     */
    Private.verticalAlignmentProperty = new AttachedProperty({
        name: 'verticalAlignment',
        create: function () { return 'top'; },
        changed: onAlignmentChanged
    });
    /**
     * The change handler for the attached alignment properties.
     */
    function onAlignmentChanged(child) {
        if (child.parent && child.parent.layout) {
            child.parent.update();
        }
    }
})(Private$i || (Private$i = {}));

/**
 * A concrete layout implementation suitable for many use cases.
 *
 * #### Notes
 * This class is suitable as a base class for implementing a variety of
 * layouts, but can also be used directly with standard CSS to layout a
 * collection of widgets.
 */
var index_es6_PanelLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(PanelLayout, _super);
    function PanelLayout() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._widgets = [];
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     *
     * #### Notes
     * This will clear and dispose all widgets in the layout.
     *
     * All reimplementations should call the superclass method.
     *
     * This method is called automatically when the parent is disposed.
     */
    PanelLayout.prototype.dispose = function () {
        while (this._widgets.length > 0) {
            this._widgets.pop().dispose();
        }
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(PanelLayout.prototype, "widgets", {
        /**
         * A read-only array of the widgets in the layout.
         */
        get: function () {
            return this._widgets;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the widgets in the layout.
     *
     * @returns A new iterator over the widgets in the layout.
     */
    PanelLayout.prototype.iter = function () {
        return iter(this._widgets);
    };
    /**
     * Add a widget to the end of the layout.
     *
     * @param widget - The widget to add to the layout.
     *
     * #### Notes
     * If the widget is already contained in the layout, it will be moved.
     */
    PanelLayout.prototype.addWidget = function (widget) {
        this.insertWidget(this._widgets.length, widget);
    };
    /**
     * Insert a widget into the layout at the specified index.
     *
     * @param index - The index at which to insert the widget.
     *
     * @param widget - The widget to insert into the layout.
     *
     * #### Notes
     * The index will be clamped to the bounds of the widgets.
     *
     * If the widget is already added to the layout, it will be moved.
     *
     * #### Undefined Behavior
     * An `index` which is non-integral.
     */
    PanelLayout.prototype.insertWidget = function (index, widget) {
        // Remove the widget from its current parent. This is a no-op
        // if the widget's parent is already the layout parent widget.
        widget.parent = this.parent;
        // Look up the current index of the widget.
        var i = this._widgets.indexOf(widget);
        // Clamp the insert index to the array bounds.
        var j = Math.max(0, Math.min(index, this._widgets.length));
        // If the widget is not in the array, insert it.
        if (i === -1) {
            // Insert the widget into the array.
            ArrayExt.insert(this._widgets, j, widget);
            // If the layout is parented, attach the widget to the DOM.
            if (this.parent) {
                this.attachWidget(j, widget);
            }
            // There is nothing more to do.
            return;
        }
        // Otherwise, the widget exists in the array and should be moved.
        // Adjust the index if the location is at the end of the array.
        if (j === this._widgets.length) {
            j--;
        }
        // Bail if there is no effective move.
        if (i === j) {
            return;
        }
        // Move the widget to the new location.
        ArrayExt.move(this._widgets, i, j);
        // If the layout is parented, move the widget in the DOM.
        if (this.parent) {
            this.moveWidget(i, j, widget);
        }
    };
    /**
     * Remove a widget from the layout.
     *
     * @param widget - The widget to remove from the layout.
     *
     * #### Notes
     * A widget is automatically removed from the layout when its `parent`
     * is set to `null`. This method should only be invoked directly when
     * removing a widget from a layout which has yet to be installed on a
     * parent widget.
     *
     * This method does *not* modify the widget's `parent`.
     */
    PanelLayout.prototype.removeWidget = function (widget) {
        this.removeWidgetAt(this._widgets.indexOf(widget));
    };
    /**
     * Remove the widget at a given index from the layout.
     *
     * @param index - The index of the widget to remove.
     *
     * #### Notes
     * A widget is automatically removed from the layout when its `parent`
     * is set to `null`. This method should only be invoked directly when
     * removing a widget from a layout which has yet to be installed on a
     * parent widget.
     *
     * This method does *not* modify the widget's `parent`.
     *
     * #### Undefined Behavior
     * An `index` which is non-integral.
     */
    PanelLayout.prototype.removeWidgetAt = function (index) {
        // Remove the widget from the array.
        var widget = ArrayExt.removeAt(this._widgets, index);
        // If the layout is parented, detach the widget from the DOM.
        if (widget && this.parent) {
            this.detachWidget(index, widget);
        }
    };
    /**
     * Perform layout initialization which requires the parent widget.
     */
    PanelLayout.prototype.init = function () {
        var _this = this;
        _super.prototype.init.call(this);
        each(this, function (widget, index) {
            _this.attachWidget(index, widget);
        });
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This method is called automatically by the panel layout at the
     * appropriate time. It should not be called directly by user code.
     *
     * The default implementation adds the widgets's node to the parent's
     * node at the proper location, and sends the appropriate attach
     * messages to the widget if the parent is attached to the DOM.
     *
     * Subclasses may reimplement this method to control how the widget's
     * node is added to the parent's node.
     */
    PanelLayout.prototype.attachWidget = function (index, widget) {
        // Look up the next sibling reference node.
        var ref = this.parent.node.children[index];
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Insert the widget's node before the sibling.
        this.parent.node.insertBefore(widget.node, ref);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
    };
    /**
     * Move a widget in the parent's DOM node.
     *
     * @param fromIndex - The previous index of the widget in the layout.
     *
     * @param toIndex - The current index of the widget in the layout.
     *
     * @param widget - The widget to move in the parent.
     *
     * #### Notes
     * This method is called automatically by the panel layout at the
     * appropriate time. It should not be called directly by user code.
     *
     * The default implementation moves the widget's node to the proper
     * location in the parent's node and sends the appropriate attach and
     * detach messages to the widget if the parent is attached to the DOM.
     *
     * Subclasses may reimplement this method to control how the widget's
     * node is moved in the parent's node.
     */
    PanelLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` and  message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Look up the next sibling reference node.
        var ref = this.parent.node.children[toIndex];
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Insert the widget's node before the sibling.
        this.parent.node.insertBefore(widget.node, ref);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param index - The previous index of the widget in the layout.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This method is called automatically by the panel layout at the
     * appropriate time. It should not be called directly by user code.
     *
     * The default implementation removes the widget's node from the
     * parent's node, and sends the appropriate detach messages to the
     * widget if the parent is attached to the DOM.
     *
     * Subclasses may reimplement this method to control how the widget's
     * node is removed from the parent's node.
     */
    PanelLayout.prototype.detachWidget = function (index, widget) {
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
    };
    return PanelLayout;
}(index_es6_Layout));

var Utils;
(function (Utils) {
    /**
     * Clamp a dimension value to an integer >= 0.
     */
    function clampDimension(value) {
        return Math.max(0, Math.floor(value));
    }
    Utils.clampDimension = clampDimension;
})(Utils || (Utils = {}));
var Utils$1 = Utils;

/**
 * A layout which arranges its widgets into resizable sections.
 */
var index_es6_SplitLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(SplitLayout, _super);
    /**
     * Construct a new split layout.
     *
     * @param options - The options for initializing the layout.
     */
    function SplitLayout(options) {
        var _this = _super.call(this) || this;
        _this.widgetOffset = 0;
        _this._fixed = 0;
        _this._spacing = 4;
        _this._dirty = false;
        _this._hasNormedSizes = false;
        _this._sizers = [];
        _this._items = [];
        _this._handles = [];
        _this._box = null;
        _this._alignment = 'start';
        _this._orientation = 'horizontal';
        _this.renderer = options.renderer;
        if (options.orientation !== undefined) {
            _this._orientation = options.orientation;
        }
        if (options.alignment !== undefined) {
            _this._alignment = options.alignment;
        }
        if (options.spacing !== undefined) {
            _this._spacing = Utils.clampDimension(options.spacing);
        }
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     */
    SplitLayout.prototype.dispose = function () {
        // Dispose of the layout items.
        each(this._items, function (item) {
            item.dispose();
        });
        // Clear the layout state.
        this._box = null;
        this._items.length = 0;
        this._sizers.length = 0;
        this._handles.length = 0;
        // Dispose of the rest of the layout.
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(SplitLayout.prototype, "orientation", {
        /**
         * Get the layout orientation for the split layout.
         */
        get: function () {
            return this._orientation;
        },
        /**
         * Set the layout orientation for the split layout.
         */
        set: function (value) {
            if (this._orientation === value) {
                return;
            }
            this._orientation = value;
            if (!this.parent) {
                return;
            }
            this.parent.dataset['orientation'] = value;
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitLayout.prototype, "alignment", {
        /**
         * Get the content alignment for the split layout.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand  to fill the
         * entire split layout.
         */
        get: function () {
            return this._alignment;
        },
        /**
         * Set the content alignment for the split layout.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand  to fill the
         * entire split layout.
         */
        set: function (value) {
            if (this._alignment === value) {
                return;
            }
            this._alignment = value;
            if (!this.parent) {
                return;
            }
            this.parent.dataset['alignment'] = value;
            this.parent.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitLayout.prototype, "spacing", {
        /**
         * Get the inter-element spacing for the split layout.
         */
        get: function () {
            return this._spacing;
        },
        /**
         * Set the inter-element spacing for the split layout.
         */
        set: function (value) {
            value = Utils.clampDimension(value);
            if (this._spacing === value) {
                return;
            }
            this._spacing = value;
            if (!this.parent) {
                return;
            }
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitLayout.prototype, "handles", {
        /**
         * A read-only array of the split handles in the layout.
         */
        get: function () {
            return this._handles;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Get the relative sizes of the widgets in the layout.
     *
     * @returns A new array of the relative sizes of the widgets.
     *
     * #### Notes
     * The returned sizes reflect the sizes of the widgets normalized
     * relative to their siblings.
     *
     * This method **does not** measure the DOM nodes.
     */
    SplitLayout.prototype.relativeSizes = function () {
        return Private$h.normalize(this._sizers.map(function (sizer) { return sizer.size; }));
    };
    /**
     * Set the relative sizes for the widgets in the layout.
     *
     * @param sizes - The relative sizes for the widgets in the panel.
     *
     * #### Notes
     * Extra values are ignored, too few will yield an undefined layout.
     *
     * The actual geometry of the DOM nodes is updated asynchronously.
     */
    SplitLayout.prototype.setRelativeSizes = function (sizes) {
        // Copy the sizes and pad with zeros as needed.
        var n = this._sizers.length;
        var temp = sizes.slice(0, n);
        while (temp.length < n) {
            temp.push(0);
        }
        // Normalize the padded sizes.
        var normed = Private$h.normalize(temp);
        // Apply the normalized sizes to the sizers.
        for (var i = 0; i < n; ++i) {
            var sizer = this._sizers[i];
            sizer.sizeHint = normed[i];
            sizer.size = normed[i];
        }
        // Set the flag indicating the sizes are normalized.
        this._hasNormedSizes = true;
        // Trigger an update of the parent widget.
        if (this.parent) {
            this.parent.update();
        }
    };
    /**
     * Move the offset position of a split handle.
     *
     * @param index - The index of the handle of the interest.
     *
     * @param position - The desired offset position of the handle.
     *
     * #### Notes
     * The position is relative to the offset parent.
     *
     * This will move the handle as close as possible to the desired
     * position. The sibling widgets will be adjusted as necessary.
     */
    SplitLayout.prototype.moveHandle = function (index, position) {
        // Bail if the index is invalid or the handle is hidden.
        var handle = this._handles[index];
        if (!handle || handle.classList.contains('lm-mod-hidden')) {
            return;
        }
        // Compute the desired delta movement for the handle.
        var delta;
        if (this._orientation === 'horizontal') {
            delta = position - handle.offsetLeft;
        }
        else {
            delta = position - handle.offsetTop;
        }
        // Bail if there is no handle movement.
        if (delta === 0) {
            return;
        }
        // Prevent widget resizing unless needed.
        for (var _i = 0, _a = this._sizers; _i < _a.length; _i++) {
            var sizer = _a[_i];
            if (sizer.size > 0) {
                sizer.sizeHint = sizer.size;
            }
        }
        // Adjust the sizers to reflect the handle movement.
        BoxEngine.adjust(this._sizers, index, delta);
        // Update the layout of the widgets.
        if (this.parent) {
            this.parent.update();
        }
    };
    /**
     * Perform layout initialization which requires the parent widget.
     */
    SplitLayout.prototype.init = function () {
        this.parent.dataset['orientation'] = this.orientation;
        this.parent.dataset['alignment'] = this.alignment;
        _super.prototype.init.call(this);
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    SplitLayout.prototype.attachWidget = function (index, widget) {
        // Create the item, handle, and sizer for the new widget.
        var item = new index_es6_LayoutItem(widget);
        var handle = Private$h.createHandle(this.renderer);
        var average = Private$h.averageSize(this._sizers);
        var sizer = Private$h.createSizer(average);
        // Insert the item, handle, and sizer into the internal arrays.
        ArrayExt.insert(this._items, index, item);
        ArrayExt.insert(this._sizers, index, sizer);
        ArrayExt.insert(this._handles, index, handle);
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget and handle nodes to the parent.
        this.parent.node.appendChild(widget.node);
        this.parent.node.appendChild(handle);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Move a widget in the parent's DOM node.
     *
     * @param fromIndex - The previous index of the widget in the layout.
     *
     * @param toIndex - The current index of the widget in the layout.
     *
     * @param widget - The widget to move in the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    SplitLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
        // Move the item, sizer, and handle for the widget.
        ArrayExt.move(this._items, fromIndex, toIndex);
        ArrayExt.move(this._sizers, fromIndex, toIndex);
        ArrayExt.move(this._handles, fromIndex, toIndex);
        // Post a fit request to the parent to show/hide last handle.
        this.parent.fit();
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param index - The previous index of the widget in the layout.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    SplitLayout.prototype.detachWidget = function (index, widget) {
        // Remove the item, handle, and sizer for the widget.
        var item = ArrayExt.removeAt(this._items, index);
        var handle = ArrayExt.removeAt(this._handles, index);
        ArrayExt.removeAt(this._sizers, index);
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget and handle nodes from the parent.
        this.parent.node.removeChild(widget.node);
        this.parent.node.removeChild(handle);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Dispose of the layout item.
        item.dispose();
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     */
    SplitLayout.prototype.onBeforeShow = function (msg) {
        _super.prototype.onBeforeShow.call(this, msg);
        this.parent.update();
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    SplitLayout.prototype.onBeforeAttach = function (msg) {
        _super.prototype.onBeforeAttach.call(this, msg);
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-shown'` message.
     */
    SplitLayout.prototype.onChildShown = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     */
    SplitLayout.prototype.onChildHidden = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'resize'` message.
     */
    SplitLayout.prototype.onResize = function (msg) {
        if (this.parent.isVisible) {
            this._update(msg.width, msg.height);
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    SplitLayout.prototype.onUpdateRequest = function (msg) {
        if (this.parent.isVisible) {
            this._update(-1, -1);
        }
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     */
    SplitLayout.prototype.onFitRequest = function (msg) {
        if (this.parent.isAttached) {
            this._fit();
        }
    };
    /**
     * Update the item position.
     *
     * @param i Item index
     * @param isHorizontal Whether the layout is horizontal or not
     * @param left Left position in pixels
     * @param top Top position in pixels
     * @param height Item height
     * @param width Item width
     * @param size Item size
     */
    SplitLayout.prototype.updateItemPosition = function (i, isHorizontal, left, top, height, width, size) {
        var item = this._items[i];
        if (item.isHidden) {
            return;
        }
        // Fetch the style for the handle.
        var handleStyle = this._handles[i].style;
        // Update the widget and handle, and advance the relevant edge.
        if (isHorizontal) {
            left += this.widgetOffset;
            item.update(left, top, size, height);
            left += size;
            handleStyle.top = top + "px";
            handleStyle.left = left + "px";
            handleStyle.width = this._spacing + "px";
            handleStyle.height = height + "px";
        }
        else {
            top += this.widgetOffset;
            item.update(left, top, width, size);
            top += size;
            handleStyle.top = top + "px";
            handleStyle.left = left + "px";
            handleStyle.width = width + "px";
            handleStyle.height = this._spacing + "px";
        }
    };
    /**
     * Fit the layout to the total size required by the widgets.
     */
    SplitLayout.prototype._fit = function () {
        // Update the handles and track the visible widget count.
        var nVisible = 0;
        var lastHandleIndex = -1;
        for (var i = 0, n = this._items.length; i < n; ++i) {
            if (this._items[i].isHidden) {
                this._handles[i].classList.add('lm-mod-hidden');
                /* <DEPRECATED> */
                this._handles[i].classList.add('p-mod-hidden');
                /* </DEPRECATED> */
            }
            else {
                this._handles[i].classList.remove('lm-mod-hidden');
                /* <DEPRECATED> */
                this._handles[i].classList.remove('p-mod-hidden');
                /* </DEPRECATED> */
                lastHandleIndex = i;
                nVisible++;
            }
        }
        // Hide the handle for the last visible widget.
        if (lastHandleIndex !== -1) {
            this._handles[lastHandleIndex].classList.add('lm-mod-hidden');
            /* <DEPRECATED> */
            this._handles[lastHandleIndex].classList.add('p-mod-hidden');
            /* </DEPRECATED> */
        }
        // Update the fixed space for the visible items.
        this._fixed =
            this._spacing * Math.max(0, nVisible - 1) +
                this.widgetOffset * this._items.length;
        // Setup the computed minimum size.
        var horz = this._orientation === 'horizontal';
        var minW = horz ? this._fixed : 0;
        var minH = horz ? 0 : this._fixed;
        // Update the sizers and computed size limits.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item and corresponding box sizer.
            var item = this._items[i];
            var sizer = this._sizers[i];
            // Prevent resizing unless necessary.
            if (sizer.size > 0) {
                sizer.sizeHint = sizer.size;
            }
            // If the item is hidden, it should consume zero size.
            if (item.isHidden) {
                sizer.minSize = 0;
                sizer.maxSize = 0;
                continue;
            }
            // Update the size limits for the item.
            item.fit();
            // Update the stretch factor.
            sizer.stretch = SplitLayout.getStretch(item.widget);
            // Update the sizer limits and computed min size.
            if (horz) {
                sizer.minSize = item.minWidth;
                sizer.maxSize = item.maxWidth;
                minW += item.minWidth;
                minH = Math.max(minH, item.minHeight);
            }
            else {
                sizer.minSize = item.minHeight;
                sizer.maxSize = item.maxHeight;
                minH += item.minHeight;
                minW = Math.max(minW, item.minWidth);
            }
        }
        // Update the box sizing and add it to the computed min size.
        var box = (this._box = ElementExt.boxSizing(this.parent.node));
        minW += box.horizontalSum;
        minH += box.verticalSum;
        // Update the parent's min size constraints.
        var style = this.parent.node.style;
        style.minWidth = minW + "px";
        style.minHeight = minH + "px";
        // Set the dirty flag to ensure only a single update occurs.
        this._dirty = true;
        // Notify the ancestor that it should fit immediately. This may
        // cause a resize of the parent, fulfilling the required update.
        if (this.parent.parent) {
            index_es6_MessageLoop.sendMessage(this.parent.parent, index_es6_Widget.Msg.FitRequest);
        }
        // If the dirty flag is still set, the parent was not resized.
        // Trigger the required update on the parent widget immediately.
        if (this._dirty) {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
        }
    };
    /**
     * Update the layout position and size of the widgets.
     *
     * The parent offset dimensions should be `-1` if unknown.
     */
    SplitLayout.prototype._update = function (offsetWidth, offsetHeight) {
        // Clear the dirty flag to indicate the update occurred.
        this._dirty = false;
        // Compute the visible item count.
        var nVisible = 0;
        for (var i = 0, n = this._items.length; i < n; ++i) {
            nVisible += +!this._items[i].isHidden;
        }
        // Bail early if there are no visible items to layout.
        if (nVisible === 0 && this.widgetOffset === 0) {
            return;
        }
        // Measure the parent if the offset dimensions are unknown.
        if (offsetWidth < 0) {
            offsetWidth = this.parent.node.offsetWidth;
        }
        if (offsetHeight < 0) {
            offsetHeight = this.parent.node.offsetHeight;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Compute the actual layout bounds adjusted for border and padding.
        var top = this._box.paddingTop;
        var left = this._box.paddingLeft;
        var width = offsetWidth - this._box.horizontalSum;
        var height = offsetHeight - this._box.verticalSum;
        // Set up the variables for justification and alignment offset.
        var extra = 0;
        var offset = 0;
        var horz = this._orientation === 'horizontal';
        if (nVisible > 0) {
            // Compute the adjusted layout space.
            var space = void 0;
            if (horz) {
                // left += this.widgetOffset;
                space = Math.max(0, width - this._fixed);
            }
            else {
                // top += this.widgetOffset;
                space = Math.max(0, height - this._fixed);
            }
            // Scale the size hints if they are normalized.
            if (this._hasNormedSizes) {
                for (var _i = 0, _a = this._sizers; _i < _a.length; _i++) {
                    var sizer = _a[_i];
                    sizer.sizeHint *= space;
                }
                this._hasNormedSizes = false;
            }
            // Distribute the layout space to the box sizers.
            var delta = BoxEngine.calc(this._sizers, space);
            // Account for alignment if there is extra layout space.
            if (delta > 0) {
                switch (this._alignment) {
                    case 'start':
                        break;
                    case 'center':
                        extra = 0;
                        offset = delta / 2;
                        break;
                    case 'end':
                        extra = 0;
                        offset = delta;
                        break;
                    case 'justify':
                        extra = delta / nVisible;
                        offset = 0;
                        break;
                    default:
                        throw 'unreachable';
                }
            }
        }
        // Layout the items using the computed box sizes.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item.
            var item = this._items[i];
            // Fetch the computed size for the widget.
            var size = item.isHidden ? 0 : this._sizers[i].size + extra;
            this.updateItemPosition(i, horz, horz ? left + offset : left, horz ? top : top + offset, height, width, size);
            var fullOffset = this.widgetOffset +
                (this._handles[i].classList.contains('lm-mod-hidden')
                    ? 0
                    : this._spacing);
            if (horz) {
                left += size + fullOffset;
            }
            else {
                top += size + fullOffset;
            }
        }
    };
    return SplitLayout;
}(index_es6_PanelLayout));
/**
 * The namespace for the `SplitLayout` class statics.
 */
(function (SplitLayout) {
    /**
     * Get the split layout stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The split layout stretch factor for the widget.
     */
    function getStretch(widget) {
        return Private$h.stretchProperty.get(widget);
    }
    SplitLayout.getStretch = getStretch;
    /**
     * Set the split layout stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the stretch factor.
     */
    function setStretch(widget, value) {
        Private$h.stretchProperty.set(widget, value);
    }
    SplitLayout.setStretch = setStretch;
})(index_es6_SplitLayout || (index_es6_SplitLayout = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$h;
(function (Private) {
    /**
     * The property descriptor for a widget stretch factor.
     */
    Private.stretchProperty = new AttachedProperty({
        name: 'stretch',
        create: function () { return 0; },
        coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },
        changed: onChildSizingChanged
    });
    /**
     * Create a new box sizer with the given size hint.
     */
    function createSizer(size) {
        var sizer = new BoxSizer();
        sizer.sizeHint = Math.floor(size);
        return sizer;
    }
    Private.createSizer = createSizer;
    /**
     * Create a new split handle node using the given renderer.
     */
    function createHandle(renderer) {
        var handle = renderer.createHandle();
        handle.style.position = 'absolute';
        return handle;
    }
    Private.createHandle = createHandle;
    /**
     * Compute the average size of an array of box sizers.
     */
    function averageSize(sizers) {
        return sizers.reduce(function (v, s) { return v + s.size; }, 0) / sizers.length || 0;
    }
    Private.averageSize = averageSize;
    /**
     * Normalize an array of values.
     */
    function normalize(values) {
        var n = values.length;
        if (n === 0) {
            return [];
        }
        var sum = values.reduce(function (a, b) { return a + Math.abs(b); }, 0);
        return sum === 0 ? values.map(function (v) { return 1 / n; }) : values.map(function (v) { return v / sum; });
    }
    Private.normalize = normalize;
    /**
     * The change handler for the attached sizing properties.
     */
    function onChildSizingChanged(child) {
        if (child.parent && child.parent.layout instanceof index_es6_SplitLayout) {
            child.parent.fit();
        }
    }
})(Private$h || (Private$h = {}));

/**
 * A layout which arranges its widgets into collapsible resizable sections.
 */
var index_es6_AccordionLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(AccordionLayout, _super);
    /**
     * Construct a new accordion layout.
     *
     * @param options - The options for initializing the layout.
     *
     * #### Notes
     * The default orientation will be vertical.
     *
     * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css
     */
    function AccordionLayout(options) {
        var _this = _super.call(this, index_es6_assign(index_es6_assign({}, options), { orientation: options.orientation || 'vertical' })) || this;
        _this._titles = [];
        _this.titleSpace = options.titleSpace || 22;
        return _this;
    }
    Object.defineProperty(AccordionLayout.prototype, "titleSpace", {
        /**
         * The section title height or width depending on the orientation.
         */
        get: function () {
            return this.widgetOffset;
        },
        set: function (value) {
            value = Utils$1.clampDimension(value);
            if (this.widgetOffset === value) {
                return;
            }
            this.widgetOffset = value;
            if (!this.parent) {
                return;
            }
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccordionLayout.prototype, "titles", {
        /**
         * A read-only array of the section titles in the panel.
         */
        get: function () {
            return this._titles;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Dispose of the resources held by the layout.
     */
    AccordionLayout.prototype.dispose = function () {
        if (this.isDisposed) {
            return;
        }
        // Clear the layout state.
        this._titles.length = 0;
        // Dispose of the rest of the layout.
        _super.prototype.dispose.call(this);
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     */
    AccordionLayout.prototype.attachWidget = function (index, widget) {
        var title = Private$g.createTitle(this.renderer, widget.title);
        title.style.position = 'absolute';
        title.setAttribute('aria-label', widget.title.label + " Section");
        title.setAttribute('aria-expanded', 'true');
        title.setAttribute('aria-controls', widget.id);
        title.classList.add('lm-mod-expanded');
        ArrayExt.insert(this._titles, index, title);
        // Add the title node to the parent before the widget.
        this.parent.node.appendChild(title);
        widget.node.setAttribute('role', 'region');
        widget.node.setAttribute('aria-labelledby', title.id);
        _super.prototype.attachWidget.call(this, index, widget);
    };
    /**
     * Move a widget in the parent's DOM node.
     *
     * @param fromIndex - The previous index of the widget in the layout.
     *
     * @param toIndex - The current index of the widget in the layout.
     *
     * @param widget - The widget to move in the parent.
     */
    AccordionLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
        ArrayExt.move(this._titles, fromIndex, toIndex);
        _super.prototype.moveWidget.call(this, fromIndex, toIndex, widget);
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param index - The previous index of the widget in the layout.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    AccordionLayout.prototype.detachWidget = function (index, widget) {
        var title = ArrayExt.removeAt(this._titles, index);
        this.parent.node.removeChild(title);
        _super.prototype.detachWidget.call(this, index, widget);
    };
    /**
     * Update the item position.
     *
     * @param i Item index
     * @param isHorizontal Whether the layout is horizontal or not
     * @param left Left position in pixels
     * @param top Top position in pixels
     * @param height Item height
     * @param width Item width
     * @param size Item size
     */
    AccordionLayout.prototype.updateItemPosition = function (i, isHorizontal, left, top, height, width, size) {
        var titleStyle = this._titles[i].style;
        // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css
        titleStyle.top = top + "px";
        titleStyle.left = left + "px";
        titleStyle.height = this.widgetOffset + "px";
        if (isHorizontal) {
            titleStyle.width = height + "px";
        }
        else {
            titleStyle.width = width + "px";
        }
        _super.prototype.updateItemPosition.call(this, i, isHorizontal, left, top, height, width, size);
    };
    return AccordionLayout;
}(index_es6_SplitLayout));
var Private$g;
(function (Private) {
    /**
     * Create the title HTML element.
     *
     * @param renderer Accordion renderer
     * @param data Widget title
     * @returns Title HTML element
     */
    function createTitle(renderer, data) {
        return renderer.createSectionTitle(data);
    }
    Private.createTitle = createTitle;
})(Private$g || (Private$g = {}));

/**
 * A simple and convenient panel widget class.
 *
 * #### Notes
 * This class is suitable as a base class for implementing a variety of
 * convenience panel widgets, but can also be used directly with CSS to
 * arrange a collection of widgets.
 *
 * This class provides a convenience wrapper around a [[PanelLayout]].
 */
var Panel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(Panel, _super);
    /**
     * Construct a new panel.
     *
     * @param options - The options for initializing the panel.
     */
    function Panel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this) || this;
        _this.addClass('lm-Panel');
        /* <DEPRECATED> */
        _this.addClass('p-Panel');
        /* </DEPRECATED> */
        _this.layout = Private$f.createLayout(options);
        return _this;
    }
    Object.defineProperty(Panel.prototype, "widgets", {
        /**
         * A read-only array of the widgets in the panel.
         */
        get: function () {
            return this.layout.widgets;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Add a widget to the end of the panel.
     *
     * @param widget - The widget to add to the panel.
     *
     * #### Notes
     * If the widget is already contained in the panel, it will be moved.
     */
    Panel.prototype.addWidget = function (widget) {
        this.layout.addWidget(widget);
    };
    /**
     * Insert a widget at the specified index.
     *
     * @param index - The index at which to insert the widget.
     *
     * @param widget - The widget to insert into to the panel.
     *
     * #### Notes
     * If the widget is already contained in the panel, it will be moved.
     */
    Panel.prototype.insertWidget = function (index, widget) {
        this.layout.insertWidget(index, widget);
    };
    return Panel;
}(index_es6_Widget));
/**
 * The namespace for the module implementation details.
 */
var Private$f;
(function (Private) {
    /**
     * Create a panel layout for the given panel options.
     */
    function createLayout(options) {
        return options.layout || new index_es6_PanelLayout();
    }
    Private.createLayout = createLayout;
})(Private$f || (Private$f = {}));

/**
 * A panel which arranges its widgets into resizable sections.
 *
 * #### Notes
 * This class provides a convenience wrapper around a [[SplitLayout]].
 */
var index_es6_SplitPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(SplitPanel, _super);
    /**
     * Construct a new split panel.
     *
     * @param options - The options for initializing the split panel.
     */
    function SplitPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { layout: Private$e.createLayout(options) }) || this;
        _this._pressData = null;
        _this.addClass('lm-SplitPanel');
        /* <DEPRECATED> */
        _this.addClass('p-SplitPanel');
        return _this;
        /* </DEPRECATED> */
    }
    /**
     * Dispose of the resources held by the panel.
     */
    SplitPanel.prototype.dispose = function () {
        this._releaseMouse();
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(SplitPanel.prototype, "orientation", {
        /**
         * Get the layout orientation for the split panel.
         */
        get: function () {
            return this.layout.orientation;
        },
        /**
         * Set the layout orientation for the split panel.
         */
        set: function (value) {
            this.layout.orientation = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitPanel.prototype, "alignment", {
        /**
         * Get the content alignment for the split panel.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire split panel.
         */
        get: function () {
            return this.layout.alignment;
        },
        /**
         * Set the content alignment for the split panel.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire split panel.
         */
        set: function (value) {
            this.layout.alignment = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitPanel.prototype, "spacing", {
        /**
         * Get the inter-element spacing for the split panel.
         */
        get: function () {
            return this.layout.spacing;
        },
        /**
         * Set the inter-element spacing for the split panel.
         */
        set: function (value) {
            this.layout.spacing = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitPanel.prototype, "renderer", {
        /**
         * The renderer used by the split panel.
         */
        get: function () {
            return this.layout.renderer;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SplitPanel.prototype, "handles", {
        /**
         * A read-only array of the split handles in the panel.
         */
        get: function () {
            return this.layout.handles;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Get the relative sizes of the widgets in the panel.
     *
     * @returns A new array of the relative sizes of the widgets.
     *
     * #### Notes
     * The returned sizes reflect the sizes of the widgets normalized
     * relative to their siblings.
     *
     * This method **does not** measure the DOM nodes.
     */
    SplitPanel.prototype.relativeSizes = function () {
        return this.layout.relativeSizes();
    };
    /**
     * Set the relative sizes for the widgets in the panel.
     *
     * @param sizes - The relative sizes for the widgets in the panel.
     *
     * #### Notes
     * Extra values are ignored, too few will yield an undefined layout.
     *
     * The actual geometry of the DOM nodes is updated asynchronously.
     */
    SplitPanel.prototype.setRelativeSizes = function (sizes) {
        this.layout.setRelativeSizes(sizes);
    };
    /**
     * Handle the DOM events for the split panel.
     *
     * @param event - The DOM event sent to the panel.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the panel's DOM node. It should
     * not be called directly by user code.
     */
    SplitPanel.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'mousedown':
                this._evtMouseDown(event);
                break;
            case 'mousemove':
                this._evtMouseMove(event);
                break;
            case 'mouseup':
                this._evtMouseUp(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    SplitPanel.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('mousedown', this);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    SplitPanel.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('mousedown', this);
        this._releaseMouse();
    };
    /**
     * A message handler invoked on a `'child-added'` message.
     */
    SplitPanel.prototype.onChildAdded = function (msg) {
        msg.child.addClass('lm-SplitPanel-child');
        /* <DEPRECATED> */
        msg.child.addClass('p-SplitPanel-child');
        /* </DEPRECATED> */
        this._releaseMouse();
    };
    /**
     * A message handler invoked on a `'child-removed'` message.
     */
    SplitPanel.prototype.onChildRemoved = function (msg) {
        msg.child.removeClass('lm-SplitPanel-child');
        /* <DEPRECATED> */
        msg.child.removeClass('p-SplitPanel-child');
        /* </DEPRECATED> */
        this._releaseMouse();
    };
    /**
     * Handle the `'keydown'` event for the split panel.
     */
    SplitPanel.prototype._evtKeyDown = function (event) {
        // Stop input events during drag.
        if (this._pressData) {
            event.preventDefault();
            event.stopPropagation();
        }
        // Release the mouse if `Escape` is pressed.
        if (event.keyCode === 27) {
            this._releaseMouse();
        }
    };
    /**
     * Handle the `'mousedown'` event for the split panel.
     */
    SplitPanel.prototype._evtMouseDown = function (event) {
        // Do nothing if the left mouse button is not pressed.
        if (event.button !== 0) {
            return;
        }
        // Find the handle which contains the mouse target, if any.
        var layout = this.layout;
        var index = ArrayExt.findFirstIndex(layout.handles, function (handle) {
            return handle.contains(event.target);
        });
        // Bail early if the mouse press was not on a handle.
        if (index === -1) {
            return;
        }
        // Stop the event when a split handle is pressed.
        event.preventDefault();
        event.stopPropagation();
        // Add the extra document listeners.
        document.addEventListener('mouseup', this, true);
        document.addEventListener('mousemove', this, true);
        document.addEventListener('keydown', this, true);
        document.addEventListener('contextmenu', this, true);
        // Compute the offset delta for the handle press.
        var delta;
        var handle = layout.handles[index];
        var rect = handle.getBoundingClientRect();
        if (layout.orientation === 'horizontal') {
            delta = event.clientX - rect.left;
        }
        else {
            delta = event.clientY - rect.top;
        }
        // Override the cursor and store the press data.
        var style = window.getComputedStyle(handle);
        var override = index_es6_Drag.overrideCursor(style.cursor);
        this._pressData = { index: index, delta: delta, override: override };
    };
    /**
     * Handle the `'mousemove'` event for the split panel.
     */
    SplitPanel.prototype._evtMouseMove = function (event) {
        // Stop the event when dragging a split handle.
        event.preventDefault();
        event.stopPropagation();
        // Compute the desired offset position for the handle.
        var pos;
        var layout = this.layout;
        var rect = this.node.getBoundingClientRect();
        if (layout.orientation === 'horizontal') {
            pos = event.clientX - rect.left - this._pressData.delta;
        }
        else {
            pos = event.clientY - rect.top - this._pressData.delta;
        }
        // Move the handle as close to the desired position as possible.
        layout.moveHandle(this._pressData.index, pos);
    };
    /**
     * Handle the `'mouseup'` event for the split panel.
     */
    SplitPanel.prototype._evtMouseUp = function (event) {
        // Do nothing if the left mouse button is not released.
        if (event.button !== 0) {
            return;
        }
        // Stop the event when releasing a handle.
        event.preventDefault();
        event.stopPropagation();
        // Finalize the mouse release.
        this._releaseMouse();
    };
    /**
     * Release the mouse grab for the split panel.
     */
    SplitPanel.prototype._releaseMouse = function () {
        // Bail early if no drag is in progress.
        if (!this._pressData) {
            return;
        }
        // Clear the override cursor.
        this._pressData.override.dispose();
        this._pressData = null;
        // Remove the extra document listeners.
        document.removeEventListener('mouseup', this, true);
        document.removeEventListener('mousemove', this, true);
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('contextmenu', this, true);
    };
    return SplitPanel;
}(Panel));
/**
 * The namespace for the `SplitPanel` class statics.
 */
(function (SplitPanel) {
    /**
     * The default implementation of `IRenderer`.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
        }
        /**
         * Create a new handle for use with a split panel.
         *
         * @returns A new handle element for a split panel.
         */
        Renderer.prototype.createHandle = function () {
            var handle = document.createElement('div');
            handle.className = 'lm-SplitPanel-handle';
            /* <DEPRECATED> */
            handle.classList.add('p-SplitPanel-handle');
            /* </DEPRECATED> */
            return handle;
        };
        return Renderer;
    }());
    SplitPanel.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    SplitPanel.defaultRenderer = new Renderer();
    /**
     * Get the split panel stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The split panel stretch factor for the widget.
     */
    function getStretch(widget) {
        return index_es6_SplitLayout.getStretch(widget);
    }
    SplitPanel.getStretch = getStretch;
    /**
     * Set the split panel stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the stretch factor.
     */
    function setStretch(widget, value) {
        index_es6_SplitLayout.setStretch(widget, value);
    }
    SplitPanel.setStretch = setStretch;
})(index_es6_SplitPanel || (index_es6_SplitPanel = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$e;
(function (Private) {
    /**
     * Create a split layout for the given panel options.
     */
    function createLayout(options) {
        return (options.layout ||
            new index_es6_SplitLayout({
                renderer: options.renderer || index_es6_SplitPanel.defaultRenderer,
                orientation: options.orientation,
                alignment: options.alignment,
                spacing: options.spacing
            }));
    }
    Private.createLayout = createLayout;
})(Private$e || (Private$e = {}));

// Copyright (c) Jupyter Development Team.
/**
 * A panel which arranges its widgets into resizable sections separated by a title widget.
 *
 * #### Notes
 * This class provides a convenience wrapper around [[AccordionLayout]].
 */
var index_es6_AccordionPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(AccordionPanel, _super);
    /**
     * Construct a new accordion panel.
     *
     * @param options - The options for initializing the accordion panel.
     */
    function AccordionPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, index_es6_assign(index_es6_assign({}, options), { layout: Private$d.createLayout(options) })) || this;
        _this.addClass('lm-AccordionPanel');
        return _this;
    }
    Object.defineProperty(AccordionPanel.prototype, "renderer", {
        /**
         * The renderer used by the accordion panel.
         */
        get: function () {
            return this.layout.renderer;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccordionPanel.prototype, "titleSpace", {
        /**
         * The section title space.
         *
         * This is the height if the panel is vertical and the width if it is
         * horizontal.
         */
        get: function () {
            return this.layout.titleSpace;
        },
        set: function (value) {
            this.layout.titleSpace = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccordionPanel.prototype, "titles", {
        /**
         * A read-only array of the section titles in the panel.
         */
        get: function () {
            return this.layout.titles;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Handle the DOM events for the accordion panel.
     *
     * @param event - The DOM event sent to the panel.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the panel's DOM node. It should
     * not be called directly by user code.
     */
    AccordionPanel.prototype.handleEvent = function (event) {
        _super.prototype.handleEvent.call(this, event);
        switch (event.type) {
            case 'click':
                this._evtClick(event);
                break;
            case 'keydown':
                this._eventKeyDown(event);
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    AccordionPanel.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('click', this);
        this.node.addEventListener('keydown', this);
        _super.prototype.onBeforeAttach.call(this, msg);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    AccordionPanel.prototype.onAfterDetach = function (msg) {
        _super.prototype.onAfterDetach.call(this, msg);
        this.node.removeEventListener('click', this);
        this.node.removeEventListener('keydown', this);
    };
    /**
     * Handle the `'click'` event for the accordion panel
     */
    AccordionPanel.prototype._evtClick = function (event) {
        var target = event.target;
        if (target) {
            var index = ArrayExt.findFirstIndex(this.titles, function (title) {
                return title.contains(target);
            });
            if (index >= 0) {
                event.preventDefault();
                event.stopPropagation();
                var title = this.titles[index];
                var widget = this.layout.widgets[index];
                if (widget.isHidden) {
                    title.classList.add('lm-mod-expanded');
                    title.setAttribute('aria-expanded', 'true');
                    widget.show();
                }
                else {
                    title.classList.remove('lm-mod-expanded');
                    title.setAttribute('aria-expanded', 'false');
                    widget.hide();
                }
            }
        }
    };
    /**
     * Handle the `'keydown'` event for the accordion panel.
     */
    AccordionPanel.prototype._eventKeyDown = function (event) {
        if (event.defaultPrevented) {
            return;
        }
        var target = event.target;
        var handled = false;
        if (target) {
            var index = ArrayExt.findFirstIndex(this.titles, function (title) {
                return title.contains(target);
            });
            if (index >= 0) {
                var keyCode = event.keyCode.toString();
                // If Space or Enter is pressed on title, emulate click event
                if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {
                    target.click();
                    handled = true;
                }
                else if (this.orientation === 'horizontal'
                    ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)
                    : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)) {
                    // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles
                    var direction = event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)
                        ? -1
                        : 1;
                    var length_1 = this.titles.length;
                    var newIndex = (index + length_1 + direction) % length_1;
                    this.titles[newIndex].focus();
                    handled = true;
                }
                else if (event.key === 'End' || keyCode === '35') {
                    // If End is pressed on title, focus on the last title
                    this.titles[this.titles.length - 1].focus();
                    handled = true;
                }
                else if (event.key === 'Home' || keyCode === '36') {
                    // If Home is pressed on title, focus on the first title
                    this.titles[0].focus();
                    handled = true;
                }
            }
            if (handled) {
                event.preventDefault();
            }
        }
    };
    return AccordionPanel;
}(index_es6_SplitPanel));
/**
 * The namespace for the `AccordionPanel` class statics.
 */
(function (AccordionPanel) {
    /**
     * The default implementation of `IRenderer`.
     */
    var Renderer = /** @class */ (function (_super) {
        widgets_dist_index_es6_extends(Renderer, _super);
        function Renderer() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            /**
             * A selector which matches any title node in the accordion.
             */
            _this.titleClassName = 'lm-AccordionPanel-title';
            _this._titleID = 0;
            _this._titleKeys = new WeakMap();
            return _this;
        }
        /**
         * Render the collapse indicator for a section title.
         *
         * @param data - The data to use for rendering the section title.
         *
         * @returns A element representing the collapse indicator.
         */
        Renderer.prototype.createCollapseIcon = function (data) {
            return document.createElement('span');
        };
        /**
         * Render the element for a section title.
         *
         * @param data - The data to use for rendering the section title.
         *
         * @returns A element representing the section title.
         */
        Renderer.prototype.createSectionTitle = function (data) {
            var handle = document.createElement('h3');
            handle.setAttribute('role', 'button');
            handle.setAttribute('tabindex', '0');
            handle.id = this.createTitleKey(data);
            handle.className = this.titleClassName;
            handle.title = data.caption;
            for (var aData in data.dataset) {
                handle.dataset[aData] = data.dataset[aData];
            }
            var collapser = handle.appendChild(this.createCollapseIcon(data));
            collapser.className = 'lm-AccordionPanel-titleCollapser';
            var label = handle.appendChild(document.createElement('span'));
            label.className = 'lm-AccordionPanel-titleLabel';
            label.textContent = data.label;
            return handle;
        };
        /**
         * Create a unique render key for the title.
         *
         * @param data - The data to use for the title.
         *
         * @returns The unique render key for the title.
         *
         * #### Notes
         * This method caches the key against the section title the first time
         * the key is generated.
         */
        Renderer.prototype.createTitleKey = function (data) {
            var key = this._titleKeys.get(data);
            if (key === undefined) {
                key = "title-key-" + this._titleID++;
                this._titleKeys.set(data, key);
            }
            return key;
        };
        return Renderer;
    }(index_es6_SplitPanel.Renderer));
    AccordionPanel.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    AccordionPanel.defaultRenderer = new Renderer();
})(index_es6_AccordionPanel || (index_es6_AccordionPanel = {}));
var Private$d;
(function (Private) {
    /**
     * Create an accordion layout for the given panel options.
     *
     * @param options Panel options
     * @returns Panel layout
     */
    function createLayout(options) {
        return (options.layout ||
            new index_es6_AccordionLayout({
                renderer: options.renderer || index_es6_AccordionPanel.defaultRenderer,
                orientation: options.orientation,
                alignment: options.alignment,
                spacing: options.spacing,
                titleSpace: options.titleSpace
            }));
    }
    Private.createLayout = createLayout;
})(Private$d || (Private$d = {}));

/**
 * A layout which arranges its widgets in a single row or column.
 */
var index_es6_BoxLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(BoxLayout, _super);
    /**
     * Construct a new box layout.
     *
     * @param options - The options for initializing the layout.
     */
    function BoxLayout(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this) || this;
        _this._fixed = 0;
        _this._spacing = 4;
        _this._dirty = false;
        _this._sizers = [];
        _this._items = [];
        _this._box = null;
        _this._alignment = 'start';
        _this._direction = 'top-to-bottom';
        if (options.direction !== undefined) {
            _this._direction = options.direction;
        }
        if (options.alignment !== undefined) {
            _this._alignment = options.alignment;
        }
        if (options.spacing !== undefined) {
            _this._spacing = Utils$1.clampDimension(options.spacing);
        }
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     */
    BoxLayout.prototype.dispose = function () {
        // Dispose of the layout items.
        each(this._items, function (item) {
            item.dispose();
        });
        // Clear the layout state.
        this._box = null;
        this._items.length = 0;
        this._sizers.length = 0;
        // Dispose of the rest of the layout.
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(BoxLayout.prototype, "direction", {
        /**
         * Get the layout direction for the box layout.
         */
        get: function () {
            return this._direction;
        },
        /**
         * Set the layout direction for the box layout.
         */
        set: function (value) {
            if (this._direction === value) {
                return;
            }
            this._direction = value;
            if (!this.parent) {
                return;
            }
            this.parent.dataset['direction'] = value;
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BoxLayout.prototype, "alignment", {
        /**
         * Get the content alignment for the box layout.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire box layout.
         */
        get: function () {
            return this._alignment;
        },
        /**
         * Set the content alignment for the box layout.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire box layout.
         */
        set: function (value) {
            if (this._alignment === value) {
                return;
            }
            this._alignment = value;
            if (!this.parent) {
                return;
            }
            this.parent.dataset['alignment'] = value;
            this.parent.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BoxLayout.prototype, "spacing", {
        /**
         * Get the inter-element spacing for the box layout.
         */
        get: function () {
            return this._spacing;
        },
        /**
         * Set the inter-element spacing for the box layout.
         */
        set: function (value) {
            value = Utils$1.clampDimension(value);
            if (this._spacing === value) {
                return;
            }
            this._spacing = value;
            if (!this.parent) {
                return;
            }
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Perform layout initialization which requires the parent widget.
     */
    BoxLayout.prototype.init = function () {
        this.parent.dataset['direction'] = this.direction;
        this.parent.dataset['alignment'] = this.alignment;
        _super.prototype.init.call(this);
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    BoxLayout.prototype.attachWidget = function (index, widget) {
        // Create and add a new layout item for the widget.
        ArrayExt.insert(this._items, index, new index_es6_LayoutItem(widget));
        // Create and add a new sizer for the widget.
        ArrayExt.insert(this._sizers, index, new BoxSizer());
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget's node to the parent.
        this.parent.node.appendChild(widget.node);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Move a widget in the parent's DOM node.
     *
     * @param fromIndex - The previous index of the widget in the layout.
     *
     * @param toIndex - The current index of the widget in the layout.
     *
     * @param widget - The widget to move in the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    BoxLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
        // Move the layout item for the widget.
        ArrayExt.move(this._items, fromIndex, toIndex);
        // Move the sizer for the widget.
        ArrayExt.move(this._sizers, fromIndex, toIndex);
        // Post an update request for the parent widget.
        this.parent.update();
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param index - The previous index of the widget in the layout.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    BoxLayout.prototype.detachWidget = function (index, widget) {
        // Remove the layout item for the widget.
        var item = ArrayExt.removeAt(this._items, index);
        // Remove the sizer for the widget.
        ArrayExt.removeAt(this._sizers, index);
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Dispose of the layout item.
        item.dispose();
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     */
    BoxLayout.prototype.onBeforeShow = function (msg) {
        _super.prototype.onBeforeShow.call(this, msg);
        this.parent.update();
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    BoxLayout.prototype.onBeforeAttach = function (msg) {
        _super.prototype.onBeforeAttach.call(this, msg);
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-shown'` message.
     */
    BoxLayout.prototype.onChildShown = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     */
    BoxLayout.prototype.onChildHidden = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'resize'` message.
     */
    BoxLayout.prototype.onResize = function (msg) {
        if (this.parent.isVisible) {
            this._update(msg.width, msg.height);
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    BoxLayout.prototype.onUpdateRequest = function (msg) {
        if (this.parent.isVisible) {
            this._update(-1, -1);
        }
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     */
    BoxLayout.prototype.onFitRequest = function (msg) {
        if (this.parent.isAttached) {
            this._fit();
        }
    };
    /**
     * Fit the layout to the total size required by the widgets.
     */
    BoxLayout.prototype._fit = function () {
        // Compute the visible item count.
        var nVisible = 0;
        for (var i = 0, n = this._items.length; i < n; ++i) {
            nVisible += +!this._items[i].isHidden;
        }
        // Update the fixed space for the visible items.
        this._fixed = this._spacing * Math.max(0, nVisible - 1);
        // Setup the computed minimum size.
        var horz = Private$c.isHorizontal(this._direction);
        var minW = horz ? this._fixed : 0;
        var minH = horz ? 0 : this._fixed;
        // Update the sizers and computed minimum size.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item and corresponding box sizer.
            var item = this._items[i];
            var sizer = this._sizers[i];
            // If the item is hidden, it should consume zero size.
            if (item.isHidden) {
                sizer.minSize = 0;
                sizer.maxSize = 0;
                continue;
            }
            // Update the size limits for the item.
            item.fit();
            // Update the size basis and stretch factor.
            sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);
            sizer.stretch = BoxLayout.getStretch(item.widget);
            // Update the sizer limits and computed min size.
            if (horz) {
                sizer.minSize = item.minWidth;
                sizer.maxSize = item.maxWidth;
                minW += item.minWidth;
                minH = Math.max(minH, item.minHeight);
            }
            else {
                sizer.minSize = item.minHeight;
                sizer.maxSize = item.maxHeight;
                minH += item.minHeight;
                minW = Math.max(minW, item.minWidth);
            }
        }
        // Update the box sizing and add it to the computed min size.
        var box = (this._box = ElementExt.boxSizing(this.parent.node));
        minW += box.horizontalSum;
        minH += box.verticalSum;
        // Update the parent's min size constraints.
        var style = this.parent.node.style;
        style.minWidth = minW + "px";
        style.minHeight = minH + "px";
        // Set the dirty flag to ensure only a single update occurs.
        this._dirty = true;
        // Notify the ancestor that it should fit immediately. This may
        // cause a resize of the parent, fulfilling the required update.
        if (this.parent.parent) {
            index_es6_MessageLoop.sendMessage(this.parent.parent, index_es6_Widget.Msg.FitRequest);
        }
        // If the dirty flag is still set, the parent was not resized.
        // Trigger the required update on the parent widget immediately.
        if (this._dirty) {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
        }
    };
    /**
     * Update the layout position and size of the widgets.
     *
     * The parent offset dimensions should be `-1` if unknown.
     */
    BoxLayout.prototype._update = function (offsetWidth, offsetHeight) {
        // Clear the dirty flag to indicate the update occurred.
        this._dirty = false;
        // Compute the visible item count.
        var nVisible = 0;
        for (var i = 0, n = this._items.length; i < n; ++i) {
            nVisible += +!this._items[i].isHidden;
        }
        // Bail early if there are no visible items to layout.
        if (nVisible === 0) {
            return;
        }
        // Measure the parent if the offset dimensions are unknown.
        if (offsetWidth < 0) {
            offsetWidth = this.parent.node.offsetWidth;
        }
        if (offsetHeight < 0) {
            offsetHeight = this.parent.node.offsetHeight;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Compute the layout area adjusted for border and padding.
        var top = this._box.paddingTop;
        var left = this._box.paddingLeft;
        var width = offsetWidth - this._box.horizontalSum;
        var height = offsetHeight - this._box.verticalSum;
        // Distribute the layout space and adjust the start position.
        var delta;
        switch (this._direction) {
            case 'left-to-right':
                delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));
                break;
            case 'top-to-bottom':
                delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));
                break;
            case 'right-to-left':
                delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));
                left += width;
                break;
            case 'bottom-to-top':
                delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));
                top += height;
                break;
            default:
                throw 'unreachable';
        }
        // Setup the variables for justification and alignment offset.
        var extra = 0;
        var offset = 0;
        // Account for alignment if there is extra layout space.
        if (delta > 0) {
            switch (this._alignment) {
                case 'start':
                    break;
                case 'center':
                    extra = 0;
                    offset = delta / 2;
                    break;
                case 'end':
                    extra = 0;
                    offset = delta;
                    break;
                case 'justify':
                    extra = delta / nVisible;
                    offset = 0;
                    break;
                default:
                    throw 'unreachable';
            }
        }
        // Layout the items using the computed box sizes.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item.
            var item = this._items[i];
            // Ignore hidden items.
            if (item.isHidden) {
                continue;
            }
            // Fetch the computed size for the widget.
            var size = this._sizers[i].size;
            // Update the widget geometry and advance the relevant edge.
            switch (this._direction) {
                case 'left-to-right':
                    item.update(left + offset, top, size + extra, height);
                    left += size + extra + this._spacing;
                    break;
                case 'top-to-bottom':
                    item.update(left, top + offset, width, size + extra);
                    top += size + extra + this._spacing;
                    break;
                case 'right-to-left':
                    item.update(left - offset - size - extra, top, size + extra, height);
                    left -= size + extra + this._spacing;
                    break;
                case 'bottom-to-top':
                    item.update(left, top - offset - size - extra, width, size + extra);
                    top -= size + extra + this._spacing;
                    break;
                default:
                    throw 'unreachable';
            }
        }
    };
    return BoxLayout;
}(index_es6_PanelLayout));
/**
 * The namespace for the `BoxLayout` class statics.
 */
(function (BoxLayout) {
    /**
     * Get the box layout stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The box layout stretch factor for the widget.
     */
    function getStretch(widget) {
        return Private$c.stretchProperty.get(widget);
    }
    BoxLayout.getStretch = getStretch;
    /**
     * Set the box layout stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the stretch factor.
     */
    function setStretch(widget, value) {
        Private$c.stretchProperty.set(widget, value);
    }
    BoxLayout.setStretch = setStretch;
    /**
     * Get the box layout size basis for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The box layout size basis for the widget.
     */
    function getSizeBasis(widget) {
        return Private$c.sizeBasisProperty.get(widget);
    }
    BoxLayout.getSizeBasis = getSizeBasis;
    /**
     * Set the box layout size basis for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the size basis.
     */
    function setSizeBasis(widget, value) {
        Private$c.sizeBasisProperty.set(widget, value);
    }
    BoxLayout.setSizeBasis = setSizeBasis;
})(index_es6_BoxLayout || (index_es6_BoxLayout = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$c;
(function (Private) {
    /**
     * The property descriptor for a widget stretch factor.
     */
    Private.stretchProperty = new AttachedProperty({
        name: 'stretch',
        create: function () { return 0; },
        coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },
        changed: onChildSizingChanged
    });
    /**
     * The property descriptor for a widget size basis.
     */
    Private.sizeBasisProperty = new AttachedProperty({
        name: 'sizeBasis',
        create: function () { return 0; },
        coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },
        changed: onChildSizingChanged
    });
    /**
     * Test whether a direction has horizontal orientation.
     */
    function isHorizontal(dir) {
        return dir === 'left-to-right' || dir === 'right-to-left';
    }
    Private.isHorizontal = isHorizontal;
    /**
     * Clamp a spacing value to an integer >= 0.
     */
    function clampSpacing(value) {
        return Math.max(0, Math.floor(value));
    }
    Private.clampSpacing = clampSpacing;
    /**
     * The change handler for the attached sizing properties.
     */
    function onChildSizingChanged(child) {
        if (child.parent && child.parent.layout instanceof index_es6_BoxLayout) {
            child.parent.fit();
        }
    }
})(Private$c || (Private$c = {}));

/**
 * A panel which arranges its widgets in a single row or column.
 *
 * #### Notes
 * This class provides a convenience wrapper around a [[BoxLayout]].
 */
var BoxPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(BoxPanel, _super);
    /**
     * Construct a new box panel.
     *
     * @param options - The options for initializing the box panel.
     */
    function BoxPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { layout: Private$b.createLayout(options) }) || this;
        _this.addClass('lm-BoxPanel');
        /* <DEPRECATED> */
        _this.addClass('p-BoxPanel');
        return _this;
        /* </DEPRECATED> */
    }
    Object.defineProperty(BoxPanel.prototype, "direction", {
        /**
         * Get the layout direction for the box panel.
         */
        get: function () {
            return this.layout.direction;
        },
        /**
         * Set the layout direction for the box panel.
         */
        set: function (value) {
            this.layout.direction = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BoxPanel.prototype, "alignment", {
        /**
         * Get the content alignment for the box panel.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire box layout.
         */
        get: function () {
            return this.layout.alignment;
        },
        /**
         * Set the content alignment for the box panel.
         *
         * #### Notes
         * This is the alignment of the widgets in the layout direction.
         *
         * The alignment has no effect if the widgets can expand to fill the
         * entire box layout.
         */
        set: function (value) {
            this.layout.alignment = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BoxPanel.prototype, "spacing", {
        /**
         * Get the inter-element spacing for the box panel.
         */
        get: function () {
            return this.layout.spacing;
        },
        /**
         * Set the inter-element spacing for the box panel.
         */
        set: function (value) {
            this.layout.spacing = value;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * A message handler invoked on a `'child-added'` message.
     */
    BoxPanel.prototype.onChildAdded = function (msg) {
        msg.child.addClass('lm-BoxPanel-child');
        /* <DEPRECATED> */
        msg.child.addClass('p-BoxPanel-child');
        /* </DEPRECATED> */
    };
    /**
     * A message handler invoked on a `'child-removed'` message.
     */
    BoxPanel.prototype.onChildRemoved = function (msg) {
        msg.child.removeClass('lm-BoxPanel-child');
        /* <DEPRECATED> */
        msg.child.removeClass('p-BoxPanel-child');
        /* </DEPRECATED> */
    };
    return BoxPanel;
}(Panel));
/**
 * The namespace for the `BoxPanel` class statics.
 */
(function (BoxPanel) {
    /**
     * Get the box panel stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The box panel stretch factor for the widget.
     */
    function getStretch(widget) {
        return index_es6_BoxLayout.getStretch(widget);
    }
    BoxPanel.getStretch = getStretch;
    /**
     * Set the box panel stretch factor for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the stretch factor.
     */
    function setStretch(widget, value) {
        index_es6_BoxLayout.setStretch(widget, value);
    }
    BoxPanel.setStretch = setStretch;
    /**
     * Get the box panel size basis for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The box panel size basis for the widget.
     */
    function getSizeBasis(widget) {
        return index_es6_BoxLayout.getSizeBasis(widget);
    }
    BoxPanel.getSizeBasis = getSizeBasis;
    /**
     * Set the box panel size basis for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the size basis.
     */
    function setSizeBasis(widget, value) {
        index_es6_BoxLayout.setSizeBasis(widget, value);
    }
    BoxPanel.setSizeBasis = setSizeBasis;
})(BoxPanel || (BoxPanel = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$b;
(function (Private) {
    /**
     * Create a box layout for the given panel options.
     */
    function createLayout(options) {
        return options.layout || new index_es6_BoxLayout(options);
    }
    Private.createLayout = createLayout;
})(Private$b || (Private$b = {}));

/**
 * A widget which displays command items as a searchable palette.
 */
var index_es6_CommandPalette = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(CommandPalette, _super);
    /**
     * Construct a new command palette.
     *
     * @param options - The options for initializing the palette.
     */
    function CommandPalette(options) {
        var _this = _super.call(this, { node: Private$a.createNode() }) || this;
        _this._activeIndex = -1;
        _this._items = [];
        _this._results = null;
        _this.addClass('lm-CommandPalette');
        /* <DEPRECATED> */
        _this.addClass('p-CommandPalette');
        /* </DEPRECATED> */
        _this.setFlag(index_es6_Widget.Flag.DisallowLayout);
        _this.commands = options.commands;
        _this.renderer = options.renderer || CommandPalette.defaultRenderer;
        _this.commands.commandChanged.connect(_this._onGenericChange, _this);
        _this.commands.keyBindingChanged.connect(_this._onGenericChange, _this);
        return _this;
    }
    /**
     * Dispose of the resources held by the widget.
     */
    CommandPalette.prototype.dispose = function () {
        this._items.length = 0;
        this._results = null;
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(CommandPalette.prototype, "searchNode", {
        /**
         * The command palette search node.
         *
         * #### Notes
         * This is the node which contains the search-related elements.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-CommandPalette-search')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandPalette.prototype, "inputNode", {
        /**
         * The command palette input node.
         *
         * #### Notes
         * This is the actual input node for the search area.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-CommandPalette-input')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandPalette.prototype, "contentNode", {
        /**
         * The command palette content node.
         *
         * #### Notes
         * This is the node which holds the command item nodes.
         *
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-CommandPalette-content')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommandPalette.prototype, "items", {
        /**
         * A read-only array of the command items in the palette.
         */
        get: function () {
            return this._items;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Add a command item to the command palette.
     *
     * @param options - The options for creating the command item.
     *
     * @returns The command item added to the palette.
     */
    CommandPalette.prototype.addItem = function (options) {
        // Create a new command item for the options.
        var item = Private$a.createItem(this.commands, options);
        // Add the item to the array.
        this._items.push(item);
        // Refresh the search results.
        this.refresh();
        // Return the item added to the palette.
        return item;
    };
    /**
     * Adds command items to the command palette.
     *
     * @param items - An array of options for creating each command item.
     *
     * @returns The command items added to the palette.
     */
    CommandPalette.prototype.addItems = function (items) {
        var _this = this;
        var newItems = items.map(function (item) { return Private$a.createItem(_this.commands, item); });
        newItems.forEach(function (item) { return _this._items.push(item); });
        this.refresh();
        return newItems;
    };
    /**
     * Remove an item from the command palette.
     *
     * @param item - The item to remove from the palette.
     *
     * #### Notes
     * This is a no-op if the item is not in the palette.
     */
    CommandPalette.prototype.removeItem = function (item) {
        this.removeItemAt(this._items.indexOf(item));
    };
    /**
     * Remove the item at a given index from the command palette.
     *
     * @param index - The index of the item to remove.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    CommandPalette.prototype.removeItemAt = function (index) {
        // Remove the item from the array.
        var item = ArrayExt.removeAt(this._items, index);
        // Bail if the index is out of range.
        if (!item) {
            return;
        }
        // Refresh the search results.
        this.refresh();
    };
    /**
     * Remove all items from the command palette.
     */
    CommandPalette.prototype.clearItems = function () {
        // Bail if there is nothing to remove.
        if (this._items.length === 0) {
            return;
        }
        // Clear the array of items.
        this._items.length = 0;
        // Refresh the search results.
        this.refresh();
    };
    /**
     * Clear the search results and schedule an update.
     *
     * #### Notes
     * This should be called whenever the search results of the palette
     * should be updated.
     *
     * This is typically called automatically by the palette as needed,
     * but can be called manually if the input text is programatically
     * changed.
     *
     * The rendered results are updated asynchronously.
     */
    CommandPalette.prototype.refresh = function () {
        this._results = null;
        if (this.inputNode.value !== '') {
            var clear = this.node.getElementsByClassName('lm-close-icon')[0];
            clear.style.display = 'inherit';
        }
        else {
            var clear = this.node.getElementsByClassName('lm-close-icon')[0];
            clear.style.display = 'none';
        }
        this.update();
    };
    /**
     * Handle the DOM events for the command palette.
     *
     * @param event - The DOM event sent to the command palette.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the command palette's DOM node.
     * It should not be called directly by user code.
     */
    CommandPalette.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'click':
                this._evtClick(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'input':
                this.refresh();
                break;
            case 'focus':
            case 'blur':
                this._toggleFocused();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    CommandPalette.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('click', this);
        this.node.addEventListener('keydown', this);
        this.node.addEventListener('input', this);
        this.node.addEventListener('focus', this, true);
        this.node.addEventListener('blur', this, true);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    CommandPalette.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('click', this);
        this.node.removeEventListener('keydown', this);
        this.node.removeEventListener('input', this);
        this.node.removeEventListener('focus', this, true);
        this.node.removeEventListener('blur', this, true);
    };
    /**
     * A message handler invoked on an `'activate-request'` message.
     */
    CommandPalette.prototype.onActivateRequest = function (msg) {
        if (this.isAttached) {
            var input = this.inputNode;
            input.focus();
            input.select();
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    CommandPalette.prototype.onUpdateRequest = function (msg) {
        // Fetch the current query text and content node.
        var query = this.inputNode.value;
        var contentNode = this.contentNode;
        // Ensure the search results are generated.
        var results = this._results;
        if (!results) {
            // Generate and store the new search results.
            results = this._results = Private$a.search(this._items, query);
            // Reset the active index.
            this._activeIndex = query
                ? ArrayExt.findFirstIndex(results, Private$a.canActivate)
                : -1;
        }
        // If there is no query and no results, clear the content.
        if (!query && results.length === 0) {
            VirtualDOM.render(null, contentNode);
            return;
        }
        // If the is a query but no results, render the empty message.
        if (query && results.length === 0) {
            var content_1 = this.renderer.renderEmptyMessage({ query: query });
            VirtualDOM.render(content_1, contentNode);
            return;
        }
        // Create the render content for the search results.
        var renderer = this.renderer;
        var activeIndex = this._activeIndex;
        var content = new Array(results.length);
        for (var i = 0, n = results.length; i < n; ++i) {
            var result = results[i];
            if (result.type === 'header') {
                var indices = result.indices;
                var category = result.category;
                content[i] = renderer.renderHeader({ category: category, indices: indices });
            }
            else {
                var item = result.item;
                var indices = result.indices;
                var active = i === activeIndex;
                content[i] = renderer.renderItem({ item: item, indices: indices, active: active });
            }
        }
        // Render the search result content.
        VirtualDOM.render(content, contentNode);
        // Adjust the scroll position as needed.
        if (activeIndex < 0 || activeIndex >= results.length) {
            contentNode.scrollTop = 0;
        }
        else {
            var element = contentNode.children[activeIndex];
            ElementExt.scrollIntoViewIfNeeded(contentNode, element);
        }
    };
    /**
     * Handle the `'click'` event for the command palette.
     */
    CommandPalette.prototype._evtClick = function (event) {
        // Bail if the click is not the left button.
        if (event.button !== 0) {
            return;
        }
        // Clear input if the target is clear button
        if (event.target.classList.contains('lm-close-icon')) {
            this.inputNode.value = '';
            this.refresh();
            return;
        }
        // Find the index of the item which was clicked.
        var index = ArrayExt.findFirstIndex(this.contentNode.children, function (node) {
            return node.contains(event.target);
        });
        // Bail if the click was not on an item.
        if (index === -1) {
            return;
        }
        // Kill the event when a content item is clicked.
        event.preventDefault();
        event.stopPropagation();
        // Execute the item if possible.
        this._execute(index);
    };
    /**
     * Handle the `'keydown'` event for the command palette.
     */
    CommandPalette.prototype._evtKeyDown = function (event) {
        if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
            return;
        }
        switch (event.keyCode) {
            case 13: // Enter
                event.preventDefault();
                event.stopPropagation();
                this._execute(this._activeIndex);
                break;
            case 38: // Up Arrow
                event.preventDefault();
                event.stopPropagation();
                this._activatePreviousItem();
                break;
            case 40: // Down Arrow
                event.preventDefault();
                event.stopPropagation();
                this._activateNextItem();
                break;
        }
    };
    /**
     * Activate the next enabled command item.
     */
    CommandPalette.prototype._activateNextItem = function () {
        // Bail if there are no search results.
        if (!this._results || this._results.length === 0) {
            return;
        }
        // Find the next enabled item index.
        var ai = this._activeIndex;
        var n = this._results.length;
        var start = ai < n - 1 ? ai + 1 : 0;
        var stop = start === 0 ? n - 1 : start - 1;
        this._activeIndex = ArrayExt.findFirstIndex(this._results, Private$a.canActivate, start, stop);
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Activate the previous enabled command item.
     */
    CommandPalette.prototype._activatePreviousItem = function () {
        // Bail if there are no search results.
        if (!this._results || this._results.length === 0) {
            return;
        }
        // Find the previous enabled item index.
        var ai = this._activeIndex;
        var n = this._results.length;
        var start = ai <= 0 ? n - 1 : ai - 1;
        var stop = start === n - 1 ? 0 : start + 1;
        this._activeIndex = ArrayExt.findLastIndex(this._results, Private$a.canActivate, start, stop);
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Execute the command item at the given index, if possible.
     */
    CommandPalette.prototype._execute = function (index) {
        // Bail if there are no search results.
        if (!this._results) {
            return;
        }
        // Bail if the index is out of range.
        var part = this._results[index];
        if (!part) {
            return;
        }
        // Update the search text if the item is a header.
        if (part.type === 'header') {
            var input = this.inputNode;
            input.value = part.category.toLowerCase() + " ";
            input.focus();
            this.refresh();
            return;
        }
        // Bail if item is not enabled.
        if (!part.item.isEnabled) {
            return;
        }
        // Execute the item.
        this.commands.execute(part.item.command, part.item.args);
        // Clear the query text.
        this.inputNode.value = '';
        // Refresh the search results.
        this.refresh();
    };
    /**
     * Toggle the focused modifier based on the input node focus state.
     */
    CommandPalette.prototype._toggleFocused = function () {
        var focused = document.activeElement === this.inputNode;
        this.toggleClass('lm-mod-focused', focused);
        /* <DEPRECATED> */
        this.toggleClass('p-mod-focused', focused);
        /* </DEPRECATED> */
    };
    /**
     * A signal handler for generic command changes.
     */
    CommandPalette.prototype._onGenericChange = function () {
        this.refresh();
    };
    return CommandPalette;
}(index_es6_Widget));
/**
 * The namespace for the `CommandPalette` class statics.
 */
(function (CommandPalette) {
    /**
     * The default implementation of `IRenderer`.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
        }
        /**
         * Render the virtual element for a command palette header.
         *
         * @param data - The data to use for rendering the header.
         *
         * @returns A virtual element representing the header.
         */
        Renderer.prototype.renderHeader = function (data) {
            var content = this.formatHeader(data);
            return index_es6_h.li({
                className: 'lm-CommandPalette-header' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-header'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the virtual element for a command palette item.
         *
         * @param data - The data to use for rendering the item.
         *
         * @returns A virtual element representing the item.
         */
        Renderer.prototype.renderItem = function (data) {
            var className = this.createItemClass(data);
            var dataset = this.createItemDataset(data);
            if (data.item.isToggleable) {
                return index_es6_h.li({
                    className: className,
                    dataset: dataset,
                    role: 'checkbox',
                    'aria-checked': "" + data.item.isToggled
                }, this.renderItemIcon(data), this.renderItemContent(data), this.renderItemShortcut(data));
            }
            return index_es6_h.li({
                className: className,
                dataset: dataset
            }, this.renderItemIcon(data), this.renderItemContent(data), this.renderItemShortcut(data));
        };
        /**
         * Render the empty results message for a command palette.
         *
         * @param data - The data to use for rendering the message.
         *
         * @returns A virtual element representing the message.
         */
        Renderer.prototype.renderEmptyMessage = function (data) {
            var content = this.formatEmptyMessage(data);
            return index_es6_h.li({
                className: 'lm-CommandPalette-emptyMessage' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-emptyMessage'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the icon for a command palette item.
         *
         * @param data - The data to use for rendering the icon.
         *
         * @returns A virtual element representing the icon.
         */
        Renderer.prototype.renderItemIcon = function (data) {
            var className = this.createIconClass(data);
            /* <DEPRECATED> */
            if (typeof data.item.icon === 'string') {
                return index_es6_h.div({ className: className }, data.item.iconLabel);
            }
            /* </DEPRECATED> */
            // if data.item.icon is undefined, it will be ignored
            return index_es6_h.div({ className: className }, data.item.icon, data.item.iconLabel);
        };
        /**
         * Render the content for a command palette item.
         *
         * @param data - The data to use for rendering the content.
         *
         * @returns A virtual element representing the content.
         */
        Renderer.prototype.renderItemContent = function (data) {
            return index_es6_h.div({
                className: 'lm-CommandPalette-itemContent' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-itemContent'
                /* </DEPRECATED> */
            }, this.renderItemLabel(data), this.renderItemCaption(data));
        };
        /**
         * Render the label for a command palette item.
         *
         * @param data - The data to use for rendering the label.
         *
         * @returns A virtual element representing the label.
         */
        Renderer.prototype.renderItemLabel = function (data) {
            var content = this.formatItemLabel(data);
            return index_es6_h.div({
                className: 'lm-CommandPalette-itemLabel' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-itemLabel'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the caption for a command palette item.
         *
         * @param data - The data to use for rendering the caption.
         *
         * @returns A virtual element representing the caption.
         */
        Renderer.prototype.renderItemCaption = function (data) {
            var content = this.formatItemCaption(data);
            return index_es6_h.div({
                className: 'lm-CommandPalette-itemCaption' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-itemCaption'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the shortcut for a command palette item.
         *
         * @param data - The data to use for rendering the shortcut.
         *
         * @returns A virtual element representing the shortcut.
         */
        Renderer.prototype.renderItemShortcut = function (data) {
            var content = this.formatItemShortcut(data);
            return index_es6_h.div({
                className: 'lm-CommandPalette-itemShortcut' +
                    /* <DEPRECATED> */
                    ' p-CommandPalette-itemShortcut'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Create the class name for the command palette item.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the command palette item.
         */
        Renderer.prototype.createItemClass = function (data) {
            // Set up the initial class name.
            var name = 'lm-CommandPalette-item';
            /* <DEPRECATED> */
            name += ' p-CommandPalette-item';
            /* </DEPRECATED> */
            // Add the boolean state classes.
            if (!data.item.isEnabled) {
                name += ' lm-mod-disabled';
                /* <DEPRECATED> */
                name += ' p-mod-disabled';
                /* </DEPRECATED> */
            }
            if (data.item.isToggled) {
                name += ' lm-mod-toggled';
                /* <DEPRECATED> */
                name += ' p-mod-toggled';
                /* </DEPRECATED> */
            }
            if (data.active) {
                name += ' lm-mod-active';
                /* <DEPRECATED> */
                name += ' p-mod-active';
                /* </DEPRECATED> */
            }
            // Add the extra class.
            var extra = data.item.className;
            if (extra) {
                name += " " + extra;
            }
            // Return the complete class name.
            return name;
        };
        /**
         * Create the dataset for the command palette item.
         *
         * @param data - The data to use for creating the dataset.
         *
         * @returns The dataset for the command palette item.
         */
        Renderer.prototype.createItemDataset = function (data) {
            return index_es6_assign(index_es6_assign({}, data.item.dataset), { command: data.item.command });
        };
        /**
         * Create the class name for the command item icon.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the item icon.
         */
        Renderer.prototype.createIconClass = function (data) {
            var name = 'lm-CommandPalette-itemIcon';
            /* <DEPRECATED> */
            name += ' p-CommandPalette-itemIcon';
            /* </DEPRECATED> */
            var extra = data.item.iconClass;
            return extra ? name + " " + extra : name;
        };
        /**
         * Create the render content for the header node.
         *
         * @param data - The data to use for the header content.
         *
         * @returns The content to add to the header node.
         */
        Renderer.prototype.formatHeader = function (data) {
            if (!data.indices || data.indices.length === 0) {
                return data.category;
            }
            return StringExt.highlight(data.category, data.indices, index_es6_h.mark);
        };
        /**
         * Create the render content for the empty message node.
         *
         * @param data - The data to use for the empty message content.
         *
         * @returns The content to add to the empty message node.
         */
        Renderer.prototype.formatEmptyMessage = function (data) {
            return "No commands found that match '" + data.query + "'";
        };
        /**
         * Create the render content for the item shortcut node.
         *
         * @param data - The data to use for the shortcut content.
         *
         * @returns The content to add to the shortcut node.
         */
        Renderer.prototype.formatItemShortcut = function (data) {
            var kb = data.item.keyBinding;
            return kb
                ? kb.keys.map(index_es6_CommandRegistry.formatKeystroke).join(', ')
                : null;
        };
        /**
         * Create the render content for the item label node.
         *
         * @param data - The data to use for the label content.
         *
         * @returns The content to add to the label node.
         */
        Renderer.prototype.formatItemLabel = function (data) {
            if (!data.indices || data.indices.length === 0) {
                return data.item.label;
            }
            return StringExt.highlight(data.item.label, data.indices, index_es6_h.mark);
        };
        /**
         * Create the render content for the item caption node.
         *
         * @param data - The data to use for the caption content.
         *
         * @returns The content to add to the caption node.
         */
        Renderer.prototype.formatItemCaption = function (data) {
            return data.item.caption;
        };
        return Renderer;
    }());
    CommandPalette.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    CommandPalette.defaultRenderer = new Renderer();
})(index_es6_CommandPalette || (index_es6_CommandPalette = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$a;
(function (Private) {
    /**
     * Create the DOM node for a command palette.
     */
    function createNode() {
        var node = document.createElement('div');
        var search = document.createElement('div');
        var wrapper = document.createElement('div');
        var input = document.createElement('input');
        var content = document.createElement('ul');
        var clear = document.createElement('button');
        search.className = 'lm-CommandPalette-search';
        wrapper.className = 'lm-CommandPalette-wrapper';
        input.className = 'lm-CommandPalette-input';
        clear.className = 'lm-close-icon';
        content.className = 'lm-CommandPalette-content';
        /* <DEPRECATED> */
        search.classList.add('p-CommandPalette-search');
        wrapper.classList.add('p-CommandPalette-wrapper');
        input.classList.add('p-CommandPalette-input');
        content.classList.add('p-CommandPalette-content');
        /* </DEPRECATED> */
        input.spellcheck = false;
        wrapper.appendChild(input);
        wrapper.appendChild(clear);
        search.appendChild(wrapper);
        node.appendChild(search);
        node.appendChild(content);
        return node;
    }
    Private.createNode = createNode;
    /**
     * Create a new command item from a command registry and options.
     */
    function createItem(commands, options) {
        return new CommandItem(commands, options);
    }
    Private.createItem = createItem;
    /**
     * Search an array of command items for fuzzy matches.
     */
    function search(items, query) {
        // Fuzzy match the items for the query.
        var scores = matchItems(items, query);
        // Sort the items based on their score.
        scores.sort(scoreCmp);
        // Create the results for the search.
        return createResults(scores);
    }
    Private.search = search;
    /**
     * Test whether a result item can be activated.
     */
    function canActivate(result) {
        return result.type === 'item' && result.item.isEnabled;
    }
    Private.canActivate = canActivate;
    /**
     * Normalize a category for a command item.
     */
    function normalizeCategory(category) {
        return category.trim().replace(/\s+/g, ' ');
    }
    /**
     * Normalize the query text for a fuzzy search.
     */
    function normalizeQuery(text) {
        return text.replace(/\s+/g, '').toLowerCase();
    }
    /**
     * Perform a fuzzy match on an array of command items.
     */
    function matchItems(items, query) {
        // Normalize the query text to lower case with no whitespace.
        query = normalizeQuery(query);
        // Create the array to hold the scores.
        var scores = [];
        // Iterate over the items and match against the query.
        for (var i = 0, n = items.length; i < n; ++i) {
            // Ignore items which are not visible.
            var item = items[i];
            if (!item.isVisible) {
                continue;
            }
            // If the query is empty, all items are matched by default.
            if (!query) {
                scores.push({
                    matchType: 3 /* Default */,
                    categoryIndices: null,
                    labelIndices: null,
                    score: 0,
                    item: item
                });
                continue;
            }
            // Run the fuzzy search for the item and query.
            var score = fuzzySearch(item, query);
            // Ignore the item if it is not a match.
            if (!score) {
                continue;
            }
            // Penalize disabled items.
            // TODO - push disabled items all the way down in sort cmp?
            if (!item.isEnabled) {
                score.score += 1000;
            }
            // Add the score to the results.
            scores.push(score);
        }
        // Return the final array of scores.
        return scores;
    }
    /**
     * Perform a fuzzy search on a single command item.
     */
    function fuzzySearch(item, query) {
        // Create the source text to be searched.
        var category = item.category.toLowerCase();
        var label = item.label.toLowerCase();
        var source = category + " " + label;
        // Set up the match score and indices array.
        var score = Infinity;
        var indices = null;
        // The regex for search word boundaries
        var rgx = /\b\w/g;
        // Search the source by word boundary.
        // eslint-disable-next-line no-constant-condition
        while (true) {
            // Find the next word boundary in the source.
            var rgxMatch = rgx.exec(source);
            // Break if there is no more source context.
            if (!rgxMatch) {
                break;
            }
            // Run the string match on the relevant substring.
            var match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);
            // Break if there is no match.
            if (!match) {
                break;
            }
            // Update the match if the score is better.
            if (match && match.score <= score) {
                score = match.score;
                indices = match.indices;
            }
        }
        // Bail if there was no match.
        if (!indices || score === Infinity) {
            return null;
        }
        // Compute the pivot index between category and label text.
        var pivot = category.length + 1;
        // Find the slice index to separate matched indices.
        var j = ArrayExt.lowerBound(indices, pivot, function (a, b) { return a - b; });
        // Extract the matched category and label indices.
        var categoryIndices = indices.slice(0, j);
        var labelIndices = indices.slice(j);
        // Adjust the label indices for the pivot offset.
        for (var i = 0, n = labelIndices.length; i < n; ++i) {
            labelIndices[i] -= pivot;
        }
        // Handle a pure label match.
        if (categoryIndices.length === 0) {
            return {
                matchType: 0 /* Label */,
                categoryIndices: null,
                labelIndices: labelIndices,
                score: score,
                item: item
            };
        }
        // Handle a pure category match.
        if (labelIndices.length === 0) {
            return {
                matchType: 1 /* Category */,
                categoryIndices: categoryIndices,
                labelIndices: null,
                score: score,
                item: item
            };
        }
        // Handle a split match.
        return {
            matchType: 2 /* Split */,
            categoryIndices: categoryIndices,
            labelIndices: labelIndices,
            score: score,
            item: item
        };
    }
    /**
     * A sort comparison function for a match score.
     */
    function scoreCmp(a, b) {
        // First compare based on the match type
        var m1 = a.matchType - b.matchType;
        if (m1 !== 0) {
            return m1;
        }
        // Otherwise, compare based on the match score.
        var d1 = a.score - b.score;
        if (d1 !== 0) {
            return d1;
        }
        // Find the match index based on the match type.
        var i1 = 0;
        var i2 = 0;
        switch (a.matchType) {
            case 0 /* Label */:
                i1 = a.labelIndices[0];
                i2 = b.labelIndices[0];
                break;
            case 1 /* Category */:
            case 2 /* Split */:
                i1 = a.categoryIndices[0];
                i2 = b.categoryIndices[0];
                break;
        }
        // Compare based on the match index.
        if (i1 !== i2) {
            return i1 - i2;
        }
        // Otherwise, compare by category.
        var d2 = a.item.category.localeCompare(b.item.category);
        if (d2 !== 0) {
            return d2;
        }
        // Otherwise, compare by rank.
        var r1 = a.item.rank;
        var r2 = b.item.rank;
        if (r1 !== r2) {
            return r1 < r2 ? -1 : 1; // Infinity safe
        }
        // Finally, compare by label.
        return a.item.label.localeCompare(b.item.label);
    }
    /**
     * Create the results from an array of sorted scores.
     */
    function createResults(scores) {
        // Set up an array to track which scores have been visited.
        var visited = new Array(scores.length);
        ArrayExt.fill(visited, false);
        // Set up the search results array.
        var results = [];
        // Iterate over each score in the array.
        for (var i = 0, n = scores.length; i < n; ++i) {
            // Ignore a score which has already been processed.
            if (visited[i]) {
                continue;
            }
            // Extract the current item and indices.
            var _a = scores[i], item = _a.item, categoryIndices = _a.categoryIndices;
            // Extract the category for the current item.
            var category = item.category;
            // Add the header result for the category.
            results.push({ type: 'header', category: category, indices: categoryIndices });
            // Find the rest of the scores with the same category.
            for (var j = i; j < n; ++j) {
                // Ignore a score which has already been processed.
                if (visited[j]) {
                    continue;
                }
                // Extract the data for the current score.
                var _b = scores[j], item_1 = _b.item, labelIndices = _b.labelIndices;
                // Ignore an item with a different category.
                if (item_1.category !== category) {
                    continue;
                }
                // Create the item result for the score.
                results.push({ type: 'item', item: item_1, indices: labelIndices });
                // Mark the score as processed.
                visited[j] = true;
            }
        }
        // Return the final results.
        return results;
    }
    /**
     * A concrete implementation of `CommandPalette.IItem`.
     */
    var CommandItem = /** @class */ (function () {
        /**
         * Construct a new command item.
         */
        function CommandItem(commands, options) {
            this._commands = commands;
            this.category = normalizeCategory(options.category);
            this.command = options.command;
            this.args = options.args || JSONExt.emptyObject;
            this.rank = options.rank !== undefined ? options.rank : Infinity;
        }
        Object.defineProperty(CommandItem.prototype, "label", {
            /**
             * The display label for the command item.
             */
            get: function () {
                return this._commands.label(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "icon", {
            /**
             * The icon renderer for the command item.
             */
            get: function () {
                return this._commands.icon(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "iconClass", {
            /**
             * The icon class for the command item.
             */
            get: function () {
                return this._commands.iconClass(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "iconLabel", {
            /**
             * The icon label for the command item.
             */
            get: function () {
                return this._commands.iconLabel(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "caption", {
            /**
             * The display caption for the command item.
             */
            get: function () {
                return this._commands.caption(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "className", {
            /**
             * The extra class name for the command item.
             */
            get: function () {
                return this._commands.className(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "dataset", {
            /**
             * The dataset for the command item.
             */
            get: function () {
                return this._commands.dataset(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "isEnabled", {
            /**
             * Whether the command item is enabled.
             */
            get: function () {
                return this._commands.isEnabled(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "isToggled", {
            /**
             * Whether the command item is toggled.
             */
            get: function () {
                return this._commands.isToggled(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "isToggleable", {
            /**
             * Whether the command item is toggleable.
             */
            get: function () {
                return this._commands.isToggleable(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "isVisible", {
            /**
             * Whether the command item is visible.
             */
            get: function () {
                return this._commands.isVisible(this.command, this.args);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(CommandItem.prototype, "keyBinding", {
            /**
             * The key binding for the command item.
             */
            get: function () {
                var _a = this, command = _a.command, args = _a.args;
                return (ArrayExt.findLastValue(this._commands.keyBindings, function (kb) {
                    return kb.command === command && JSONExt.deepEqual(kb.args, args);
                }) || null);
            },
            enumerable: true,
            configurable: true
        });
        return CommandItem;
    }());
})(Private$a || (Private$a = {}));

/**
 * A widget which displays items as a canonical menu.
 */
var index_es6_Menu = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(Menu, _super);
    /**
     * Construct a new menu.
     *
     * @param options - The options for initializing the menu.
     */
    function Menu(options) {
        var _this = _super.call(this, { node: Private$9.createNode() }) || this;
        _this._childIndex = -1;
        _this._activeIndex = -1;
        _this._openTimerID = 0;
        _this._closeTimerID = 0;
        _this._items = [];
        _this._childMenu = null;
        _this._parentMenu = null;
        _this._aboutToClose = new Signal(_this);
        _this._menuRequested = new Signal(_this);
        _this.addClass('lm-Menu');
        /* <DEPRECATED> */
        _this.addClass('p-Menu');
        /* </DEPRECATED> */
        _this.setFlag(index_es6_Widget.Flag.DisallowLayout);
        _this.commands = options.commands;
        _this.renderer = options.renderer || Menu.defaultRenderer;
        return _this;
    }
    /**
     * Dispose of the resources held by the menu.
     */
    Menu.prototype.dispose = function () {
        this.close();
        this._items.length = 0;
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(Menu.prototype, "aboutToClose", {
        /**
         * A signal emitted just before the menu is closed.
         *
         * #### Notes
         * This signal is emitted when the menu receives a `'close-request'`
         * message, just before it removes itself from the DOM.
         *
         * This signal is not emitted if the menu is already detached from
         * the DOM when it receives the `'close-request'` message.
         */
        get: function () {
            return this._aboutToClose;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "menuRequested", {
        /**
         * A signal emitted when a new menu is requested by the user.
         *
         * #### Notes
         * This signal is emitted whenever the user presses the right or left
         * arrow keys, and a submenu cannot be opened or closed in response.
         *
         * This signal is useful when implementing menu bars in order to open
         * the next or previous menu in response to a user key press.
         *
         * This signal is only emitted for the root menu in a hierarchy.
         */
        get: function () {
            return this._menuRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "parentMenu", {
        /**
         * The parent menu of the menu.
         *
         * #### Notes
         * This is `null` unless the menu is an open submenu.
         */
        get: function () {
            return this._parentMenu;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "childMenu", {
        /**
         * The child menu of the menu.
         *
         * #### Notes
         * This is `null` unless the menu has an open submenu.
         */
        get: function () {
            return this._childMenu;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "rootMenu", {
        /**
         * The root menu of the menu hierarchy.
         */
        get: function () {
            // eslint-disable-next-line @typescript-eslint/no-this-alias
            var menu = this;
            while (menu._parentMenu) {
                menu = menu._parentMenu;
            }
            return menu;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "leafMenu", {
        /**
         * The leaf menu of the menu hierarchy.
         */
        get: function () {
            // eslint-disable-next-line @typescript-eslint/no-this-alias
            var menu = this;
            while (menu._childMenu) {
                menu = menu._childMenu;
            }
            return menu;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "contentNode", {
        /**
         * The menu content node.
         *
         * #### Notes
         * This is the node which holds the menu item nodes.
         *
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-Menu-content')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "activeItem", {
        /**
         * Get the currently active menu item.
         */
        get: function () {
            return this._items[this._activeIndex] || null;
        },
        /**
         * Set the currently active menu item.
         *
         * #### Notes
         * If the item cannot be activated, the item will be set to `null`.
         */
        set: function (value) {
            this.activeIndex = value ? this._items.indexOf(value) : -1;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "activeIndex", {
        /**
         * Get the index of the currently active menu item.
         *
         * #### Notes
         * This will be `-1` if no menu item is active.
         */
        get: function () {
            return this._activeIndex;
        },
        /**
         * Set the index of the currently active menu item.
         *
         * #### Notes
         * If the item cannot be activated, the index will be set to `-1`.
         */
        set: function (value) {
            // Adjust the value for an out of range index.
            if (value < 0 || value >= this._items.length) {
                value = -1;
            }
            // Ensure the item can be activated.
            if (value !== -1 && !Private$9.canActivate(this._items[value])) {
                value = -1;
            }
            // Bail if the index will not change.
            if (this._activeIndex === value) {
                return;
            }
            // Update the active index.
            this._activeIndex = value;
            // Make active element in focus
            if (this._activeIndex >= 0 &&
                this.contentNode.childNodes[this._activeIndex]) {
                this.contentNode.childNodes[this._activeIndex].focus();
            }
            // schedule an update of the items.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Menu.prototype, "items", {
        /**
         * A read-only array of the menu items in the menu.
         */
        get: function () {
            return this._items;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Activate the next selectable item in the menu.
     *
     * #### Notes
     * If no item is selectable, the index will be set to `-1`.
     */
    Menu.prototype.activateNextItem = function () {
        var n = this._items.length;
        var ai = this._activeIndex;
        var start = ai < n - 1 ? ai + 1 : 0;
        var stop = start === 0 ? n - 1 : start - 1;
        this.activeIndex = ArrayExt.findFirstIndex(this._items, Private$9.canActivate, start, stop);
    };
    /**
     * Activate the previous selectable item in the menu.
     *
     * #### Notes
     * If no item is selectable, the index will be set to `-1`.
     */
    Menu.prototype.activatePreviousItem = function () {
        var n = this._items.length;
        var ai = this._activeIndex;
        var start = ai <= 0 ? n - 1 : ai - 1;
        var stop = start === n - 1 ? 0 : start + 1;
        this.activeIndex = ArrayExt.findLastIndex(this._items, Private$9.canActivate, start, stop);
    };
    /**
     * Trigger the active menu item.
     *
     * #### Notes
     * If the active item is a submenu, it will be opened and the first
     * item will be activated.
     *
     * If the active item is a command, the command will be executed.
     *
     * If the menu is not attached, this is a no-op.
     *
     * If there is no active item, this is a no-op.
     */
    Menu.prototype.triggerActiveItem = function () {
        // Bail if the menu is not attached.
        if (!this.isAttached) {
            return;
        }
        // Bail if there is no active item.
        var item = this.activeItem;
        if (!item) {
            return;
        }
        // Cancel the pending timers.
        this._cancelOpenTimer();
        this._cancelCloseTimer();
        // If the item is a submenu, open it.
        if (item.type === 'submenu') {
            this._openChildMenu(true);
            return;
        }
        // Close the root menu before executing the command.
        this.rootMenu.close();
        // Execute the command for the item.
        var command = item.command, args = item.args;
        if (this.commands.isEnabled(command, args)) {
            this.commands.execute(command, args);
        }
        else {
            console.log("Command '" + command + "' is disabled.");
        }
    };
    /**
     * Add a menu item to the end of the menu.
     *
     * @param options - The options for creating the menu item.
     *
     * @returns The menu item added to the menu.
     */
    Menu.prototype.addItem = function (options) {
        return this.insertItem(this._items.length, options);
    };
    /**
     * Insert a menu item into the menu at the specified index.
     *
     * @param index - The index at which to insert the item.
     *
     * @param options - The options for creating the menu item.
     *
     * @returns The menu item added to the menu.
     *
     * #### Notes
     * The index will be clamped to the bounds of the items.
     */
    Menu.prototype.insertItem = function (index, options) {
        // Close the menu if it's attached.
        if (this.isAttached) {
            this.close();
        }
        // Reset the active index.
        this.activeIndex = -1;
        // Clamp the insert index to the array bounds.
        var i = Math.max(0, Math.min(index, this._items.length));
        // Create the item for the options.
        var item = Private$9.createItem(this, options);
        // Insert the item into the array.
        ArrayExt.insert(this._items, i, item);
        // Schedule an update of the items.
        this.update();
        // Return the item added to the menu.
        return item;
    };
    /**
     * Remove an item from the menu.
     *
     * @param item - The item to remove from the menu.
     *
     * #### Notes
     * This is a no-op if the item is not in the menu.
     */
    Menu.prototype.removeItem = function (item) {
        this.removeItemAt(this._items.indexOf(item));
    };
    /**
     * Remove the item at a given index from the menu.
     *
     * @param index - The index of the item to remove.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    Menu.prototype.removeItemAt = function (index) {
        // Close the menu if it's attached.
        if (this.isAttached) {
            this.close();
        }
        // Reset the active index.
        this.activeIndex = -1;
        // Remove the item from the array.
        var item = ArrayExt.removeAt(this._items, index);
        // Bail if the index is out of range.
        if (!item) {
            return;
        }
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Remove all menu items from the menu.
     */
    Menu.prototype.clearItems = function () {
        // Close the menu if it's attached.
        if (this.isAttached) {
            this.close();
        }
        // Reset the active index.
        this.activeIndex = -1;
        // Bail if there is nothing to remove.
        if (this._items.length === 0) {
            return;
        }
        // Clear the items.
        this._items.length = 0;
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Open the menu at the specified location.
     *
     * @param x - The client X coordinate of the menu location.
     *
     * @param y - The client Y coordinate of the menu location.
     *
     * @param options - The additional options for opening the menu.
     *
     * #### Notes
     * The menu will be opened at the given location unless it will not
     * fully fit on the screen. If it will not fit, it will be adjusted
     * to fit naturally on the screen.
     *
     * This is a no-op if the menu is already attached to the DOM.
     */
    Menu.prototype.open = function (x, y, options) {
        if (options === void 0) { options = {}; }
        // Bail early if the menu is already attached.
        if (this.isAttached) {
            return;
        }
        // Extract the position options.
        var forceX = options.forceX || false;
        var forceY = options.forceY || false;
        // Open the menu as a root menu.
        Private$9.openRootMenu(this, x, y, forceX, forceY);
        // Activate the menu to accept keyboard input.
        this.activate();
    };
    /**
     * Handle the DOM events for the menu.
     *
     * @param event - The DOM event sent to the menu.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the menu's DOM nodes. It should
     * not be called directly by user code.
     */
    Menu.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'mouseup':
                this._evtMouseUp(event);
                break;
            case 'mousemove':
                this._evtMouseMove(event);
                break;
            case 'mouseenter':
                this._evtMouseEnter(event);
                break;
            case 'mouseleave':
                this._evtMouseLeave(event);
                break;
            case 'mousedown':
                this._evtMouseDown(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    Menu.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('keydown', this);
        this.node.addEventListener('mouseup', this);
        this.node.addEventListener('mousemove', this);
        this.node.addEventListener('mouseenter', this);
        this.node.addEventListener('mouseleave', this);
        this.node.addEventListener('contextmenu', this);
        document.addEventListener('mousedown', this, true);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    Menu.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('keydown', this);
        this.node.removeEventListener('mouseup', this);
        this.node.removeEventListener('mousemove', this);
        this.node.removeEventListener('mouseenter', this);
        this.node.removeEventListener('mouseleave', this);
        this.node.removeEventListener('contextmenu', this);
        document.removeEventListener('mousedown', this, true);
    };
    /**
     * A message handler invoked on an `'activate-request'` message.
     */
    Menu.prototype.onActivateRequest = function (msg) {
        if (this.isAttached) {
            this.node.focus();
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    Menu.prototype.onUpdateRequest = function (msg) {
        var _this = this;
        var items = this._items;
        var renderer = this.renderer;
        var activeIndex = this._activeIndex;
        var collapsedFlags = Private$9.computeCollapsed(items);
        var content = new Array(items.length);
        var _loop_1 = function (i, n) {
            var item = items[i];
            var active = i === activeIndex;
            var collapsed = collapsedFlags[i];
            content[i] = renderer.renderItem({
                item: item,
                active: active,
                collapsed: collapsed,
                onfocus: function () {
                    _this.activeIndex = i;
                }
            });
        };
        for (var i = 0, n = items.length; i < n; ++i) {
            _loop_1(i);
        }
        VirtualDOM.render(content, this.contentNode);
    };
    /**
     * A message handler invoked on a `'close-request'` message.
     */
    Menu.prototype.onCloseRequest = function (msg) {
        // Cancel the pending timers.
        this._cancelOpenTimer();
        this._cancelCloseTimer();
        // Reset the active index.
        this.activeIndex = -1;
        // Close any open child menu.
        var childMenu = this._childMenu;
        if (childMenu) {
            this._childIndex = -1;
            this._childMenu = null;
            childMenu._parentMenu = null;
            childMenu.close();
        }
        // Remove this menu from its parent and activate the parent.
        var parentMenu = this._parentMenu;
        if (parentMenu) {
            this._parentMenu = null;
            parentMenu._childIndex = -1;
            parentMenu._childMenu = null;
            parentMenu.activate();
        }
        // Emit the `aboutToClose` signal if the menu is attached.
        if (this.isAttached) {
            this._aboutToClose.emit(undefined);
        }
        // Finish closing the menu.
        _super.prototype.onCloseRequest.call(this, msg);
    };
    /**
     * Handle the `'keydown'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the menu node.
     */
    Menu.prototype._evtKeyDown = function (event) {
        // A menu handles all keydown events.
        event.preventDefault();
        event.stopPropagation();
        // Fetch the key code for the event.
        var kc = event.keyCode;
        // Enter
        if (kc === 13) {
            this.triggerActiveItem();
            return;
        }
        // Escape
        if (kc === 27) {
            this.close();
            return;
        }
        // Left Arrow
        if (kc === 37) {
            if (this._parentMenu) {
                this.close();
            }
            else {
                this._menuRequested.emit('previous');
            }
            return;
        }
        // Up Arrow
        if (kc === 38) {
            this.activatePreviousItem();
            return;
        }
        // Right Arrow
        if (kc === 39) {
            var item = this.activeItem;
            if (item && item.type === 'submenu') {
                this.triggerActiveItem();
            }
            else {
                this.rootMenu._menuRequested.emit('next');
            }
            return;
        }
        // Down Arrow
        if (kc === 40) {
            this.activateNextItem();
            return;
        }
        // Get the pressed key character.
        var key = getKeyboardLayout().keyForKeydownEvent(event);
        // Bail if the key is not valid.
        if (!key) {
            return;
        }
        // Search for the next best matching mnemonic item.
        var start = this._activeIndex + 1;
        var result = Private$9.findMnemonic(this._items, key, start);
        // Handle the requested mnemonic based on the search results.
        // If exactly one mnemonic is matched, that item is triggered.
        // Otherwise, the next mnemonic is activated if available,
        // followed by the auto mnemonic if available.
        if (result.index !== -1 && !result.multiple) {
            this.activeIndex = result.index;
            this.triggerActiveItem();
        }
        else if (result.index !== -1) {
            this.activeIndex = result.index;
        }
        else if (result.auto !== -1) {
            this.activeIndex = result.auto;
        }
    };
    /**
     * Handle the `'mouseup'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the menu node.
     */
    Menu.prototype._evtMouseUp = function (event) {
        if (event.button !== 0) {
            return;
        }
        event.preventDefault();
        event.stopPropagation();
        this.triggerActiveItem();
    };
    /**
     * Handle the `'mousemove'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the menu node.
     */
    Menu.prototype._evtMouseMove = function (event) {
        // Hit test the item nodes for the item under the mouse.
        var index = ArrayExt.findFirstIndex(this.contentNode.children, function (node) {
            return ElementExt.hitTest(node, event.clientX, event.clientY);
        });
        // Bail early if the mouse is already over the active index.
        if (index === this._activeIndex) {
            return;
        }
        // Update and coerce the active index.
        this.activeIndex = index;
        index = this.activeIndex;
        // If the index is the current child index, cancel the timers.
        if (index === this._childIndex) {
            this._cancelOpenTimer();
            this._cancelCloseTimer();
            return;
        }
        // If a child menu is currently open, start the close timer.
        if (this._childIndex !== -1) {
            this._startCloseTimer();
        }
        // Cancel the open timer to give a full delay for opening.
        this._cancelOpenTimer();
        // Bail if the active item is not a valid submenu item.
        var item = this.activeItem;
        if (!item || item.type !== 'submenu' || !item.submenu) {
            return;
        }
        // Start the open timer to open the active item submenu.
        this._startOpenTimer();
    };
    /**
     * Handle the `'mouseenter'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the menu node.
     */
    Menu.prototype._evtMouseEnter = function (event) {
        // Synchronize the active ancestor items.
        for (var menu = this._parentMenu; menu; menu = menu._parentMenu) {
            menu._cancelOpenTimer();
            menu._cancelCloseTimer();
            menu.activeIndex = menu._childIndex;
        }
    };
    /**
     * Handle the `'mouseleave'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the menu node.
     */
    Menu.prototype._evtMouseLeave = function (event) {
        // Cancel any pending submenu opening.
        this._cancelOpenTimer();
        // If there is no open child menu, just reset the active index.
        if (!this._childMenu) {
            this.activeIndex = -1;
            return;
        }
        // If the mouse is over the child menu, cancel the close timer.
        var clientX = event.clientX, clientY = event.clientY;
        if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {
            this._cancelCloseTimer();
            return;
        }
        // Otherwise, reset the active index and start the close timer.
        this.activeIndex = -1;
        this._startCloseTimer();
    };
    /**
     * Handle the `'mousedown'` event for the menu.
     *
     * #### Notes
     * This listener is attached to the document node.
     */
    Menu.prototype._evtMouseDown = function (event) {
        // Bail if the menu is not a root menu.
        if (this._parentMenu) {
            return;
        }
        // The mouse button which is pressed is irrelevant. If the press
        // is not on a menu, the entire hierarchy is closed and the event
        // is allowed to propagate. This allows other code to act on the
        // event, such as focusing the clicked element.
        if (Private$9.hitTestMenus(this, event.clientX, event.clientY)) {
            event.preventDefault();
            event.stopPropagation();
        }
        else {
            this.close();
        }
    };
    /**
     * Open the child menu at the active index immediately.
     *
     * If a different child menu is already open, it will be closed,
     * even if the active item is not a valid submenu.
     */
    Menu.prototype._openChildMenu = function (activateFirst) {
        if (activateFirst === void 0) { activateFirst = false; }
        // If the item is not a valid submenu, close the child menu.
        var item = this.activeItem;
        if (!item || item.type !== 'submenu' || !item.submenu) {
            this._closeChildMenu();
            return;
        }
        // Do nothing if the child menu will not change.
        var submenu = item.submenu;
        if (submenu === this._childMenu) {
            return;
        }
        // Ensure the current child menu is closed.
        this._closeChildMenu();
        // Update the private child state.
        this._childMenu = submenu;
        this._childIndex = this._activeIndex;
        // Set the parent menu reference for the child.
        submenu._parentMenu = this;
        // Ensure the menu is updated and lookup the item node.
        index_es6_MessageLoop.sendMessage(this, index_es6_Widget.Msg.UpdateRequest);
        var itemNode = this.contentNode.children[this._activeIndex];
        // Open the submenu at the active node.
        Private$9.openSubmenu(submenu, itemNode);
        // Activate the first item if desired.
        if (activateFirst) {
            submenu.activeIndex = -1;
            submenu.activateNextItem();
        }
        // Activate the child menu.
        submenu.activate();
    };
    /**
     * Close the child menu immediately.
     *
     * This is a no-op if a child menu is not open.
     */
    Menu.prototype._closeChildMenu = function () {
        if (this._childMenu) {
            this._childMenu.close();
        }
    };
    /**
     * Start the open timer, unless it is already pending.
     */
    Menu.prototype._startOpenTimer = function () {
        var _this = this;
        if (this._openTimerID === 0) {
            this._openTimerID = window.setTimeout(function () {
                _this._openTimerID = 0;
                _this._openChildMenu();
            }, Private$9.TIMER_DELAY);
        }
    };
    /**
     * Start the close timer, unless it is already pending.
     */
    Menu.prototype._startCloseTimer = function () {
        var _this = this;
        if (this._closeTimerID === 0) {
            this._closeTimerID = window.setTimeout(function () {
                _this._closeTimerID = 0;
                _this._closeChildMenu();
            }, Private$9.TIMER_DELAY);
        }
    };
    /**
     * Cancel the open timer, if the timer is pending.
     */
    Menu.prototype._cancelOpenTimer = function () {
        if (this._openTimerID !== 0) {
            clearTimeout(this._openTimerID);
            this._openTimerID = 0;
        }
    };
    /**
     * Cancel the close timer, if the timer is pending.
     */
    Menu.prototype._cancelCloseTimer = function () {
        if (this._closeTimerID !== 0) {
            clearTimeout(this._closeTimerID);
            this._closeTimerID = 0;
        }
    };
    return Menu;
}(index_es6_Widget));
/**
 * The namespace for the `Menu` class statics.
 */
(function (Menu) {
    /**
     * The default implementation of `IRenderer`.
     *
     * #### Notes
     * Subclasses are free to reimplement rendering methods as needed.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
        }
        /**
         * Render the virtual element for a menu item.
         *
         * @param data - The data to use for rendering the item.
         *
         * @returns A virtual element representing the item.
         */
        Renderer.prototype.renderItem = function (data) {
            var className = this.createItemClass(data);
            var dataset = this.createItemDataset(data);
            var aria = this.createItemARIA(data);
            return index_es6_h.li(index_es6_assign({ className: className,
                dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data), this.renderShortcut(data), this.renderSubmenu(data));
        };
        /**
         * Render the icon element for a menu item.
         *
         * @param data - The data to use for rendering the icon.
         *
         * @returns A virtual element representing the item icon.
         */
        Renderer.prototype.renderIcon = function (data) {
            var className = this.createIconClass(data);
            /* <DEPRECATED> */
            if (typeof data.item.icon === 'string') {
                return index_es6_h.div({ className: className }, data.item.iconLabel);
            }
            /* </DEPRECATED> */
            // if data.item.icon is undefined, it will be ignored
            return index_es6_h.div({ className: className }, data.item.icon, data.item.iconLabel);
        };
        /**
         * Render the label element for a menu item.
         *
         * @param data - The data to use for rendering the label.
         *
         * @returns A virtual element representing the item label.
         */
        Renderer.prototype.renderLabel = function (data) {
            var content = this.formatLabel(data);
            return index_es6_h.div({
                className: 'lm-Menu-itemLabel' +
                    /* <DEPRECATED> */
                    ' p-Menu-itemLabel'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the shortcut element for a menu item.
         *
         * @param data - The data to use for rendering the shortcut.
         *
         * @returns A virtual element representing the item shortcut.
         */
        Renderer.prototype.renderShortcut = function (data) {
            var content = this.formatShortcut(data);
            return index_es6_h.div({
                className: 'lm-Menu-itemShortcut' +
                    /* <DEPRECATED> */
                    ' p-Menu-itemShortcut'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Render the submenu icon element for a menu item.
         *
         * @param data - The data to use for rendering the submenu icon.
         *
         * @returns A virtual element representing the submenu icon.
         */
        Renderer.prototype.renderSubmenu = function (data) {
            return index_es6_h.div({
                className: 'lm-Menu-itemSubmenuIcon' +
                    /* <DEPRECATED> */
                    ' p-Menu-itemSubmenuIcon'
                /* </DEPRECATED> */
            });
        };
        /**
         * Create the class name for the menu item.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the menu item.
         */
        Renderer.prototype.createItemClass = function (data) {
            // Setup the initial class name.
            var name = 'lm-Menu-item';
            /* <DEPRECATED> */
            name += ' p-Menu-item';
            /* </DEPRECATED> */
            // Add the boolean state classes.
            if (!data.item.isEnabled) {
                name += ' lm-mod-disabled';
                /* <DEPRECATED> */
                name += ' p-mod-disabled';
                /* </DEPRECATED> */
            }
            if (data.item.isToggled) {
                name += ' lm-mod-toggled';
                /* <DEPRECATED> */
                name += ' p-mod-toggled';
                /* </DEPRECATED> */
            }
            if (!data.item.isVisible) {
                name += ' lm-mod-hidden';
                /* <DEPRECATED> */
                name += ' p-mod-hidden';
                /* </DEPRECATED> */
            }
            if (data.active) {
                name += ' lm-mod-active';
                /* <DEPRECATED> */
                name += ' p-mod-active';
                /* </DEPRECATED> */
            }
            if (data.collapsed) {
                name += ' lm-mod-collapsed';
                /* <DEPRECATED> */
                name += ' p-mod-collapsed';
                /* </DEPRECATED> */
            }
            // Add the extra class.
            var extra = data.item.className;
            if (extra) {
                name += " " + extra;
            }
            // Return the complete class name.
            return name;
        };
        /**
         * Create the dataset for the menu item.
         *
         * @param data - The data to use for creating the dataset.
         *
         * @returns The dataset for the menu item.
         */
        Renderer.prototype.createItemDataset = function (data) {
            var result;
            var _a = data.item, type = _a.type, command = _a.command, dataset = _a.dataset;
            if (type === 'command') {
                result = index_es6_assign(index_es6_assign({}, dataset), { type: type, command: command });
            }
            else {
                result = index_es6_assign(index_es6_assign({}, dataset), { type: type });
            }
            return result;
        };
        /**
         * Create the class name for the menu item icon.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the item icon.
         */
        Renderer.prototype.createIconClass = function (data) {
            var name = 'lm-Menu-itemIcon';
            /* <DEPRECATED> */
            name += ' p-Menu-itemIcon';
            /* </DEPRECATED> */
            var extra = data.item.iconClass;
            return extra ? name + " " + extra : name;
        };
        /**
         * Create the aria attributes for menu item.
         *
         * @param data - The data to use for the aria attributes.
         *
         * @returns The aria attributes object for the item.
         */
        Renderer.prototype.createItemARIA = function (data) {
            var aria = {};
            switch (data.item.type) {
                case 'separator':
                    aria.role = 'presentation';
                    break;
                case 'submenu':
                    aria['aria-haspopup'] = 'true';
                    if (!data.item.isEnabled) {
                        aria['aria-disabled'] = 'true';
                    }
                    break;
                default:
                    if (!data.item.isEnabled) {
                        aria['aria-disabled'] = 'true';
                    }
                    aria.role = 'menuitem';
            }
            return aria;
        };
        /**
         * Create the render content for the label node.
         *
         * @param data - The data to use for the label content.
         *
         * @returns The content to add to the label node.
         */
        Renderer.prototype.formatLabel = function (data) {
            // Fetch the label text and mnemonic index.
            var _a = data.item, label = _a.label, mnemonic = _a.mnemonic;
            // If the index is out of range, do not modify the label.
            if (mnemonic < 0 || mnemonic >= label.length) {
                return label;
            }
            // Split the label into parts.
            var prefix = label.slice(0, mnemonic);
            var suffix = label.slice(mnemonic + 1);
            var char = label[mnemonic];
            // Wrap the mnemonic character in a span.
            var span = index_es6_h.span({
                className: 'lm-Menu-itemMnemonic' +
                    /* <DEPRECATED> */
                    ' p-Menu-itemMnemonic'
                /* </DEPRECATED> */
            }, char);
            // Return the content parts.
            return [prefix, span, suffix];
        };
        /**
         * Create the render content for the shortcut node.
         *
         * @param data - The data to use for the shortcut content.
         *
         * @returns The content to add to the shortcut node.
         */
        Renderer.prototype.formatShortcut = function (data) {
            var kb = data.item.keyBinding;
            return kb
                ? kb.keys.map(index_es6_CommandRegistry.formatKeystroke).join(', ')
                : null;
        };
        return Renderer;
    }());
    Menu.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    Menu.defaultRenderer = new Renderer();
})(index_es6_Menu || (index_es6_Menu = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$9;
(function (Private) {
    /**
     * The ms delay for opening and closing a submenu.
     */
    Private.TIMER_DELAY = 300;
    /**
     * The horizontal pixel overlap for an open submenu.
     */
    Private.SUBMENU_OVERLAP = 3;
    /**
     * Create the DOM node for a menu.
     */
    function createNode() {
        var node = document.createElement('div');
        var content = document.createElement('ul');
        content.className = 'lm-Menu-content';
        /* <DEPRECATED> */
        content.classList.add('p-Menu-content');
        /* </DEPRECATED> */
        node.appendChild(content);
        content.setAttribute('role', 'menu');
        node.tabIndex = 0;
        return node;
    }
    Private.createNode = createNode;
    /**
     * Test whether a menu item can be activated.
     */
    function canActivate(item) {
        return item.type !== 'separator' && item.isEnabled && item.isVisible;
    }
    Private.canActivate = canActivate;
    /**
     * Create a new menu item for an owner menu.
     */
    function createItem(owner, options) {
        return new MenuItem(owner.commands, options);
    }
    Private.createItem = createItem;
    /**
     * Hit test a menu hierarchy starting at the given root.
     */
    function hitTestMenus(menu, x, y) {
        for (var temp = menu; temp; temp = temp.childMenu) {
            if (ElementExt.hitTest(temp.node, x, y)) {
                return true;
            }
        }
        return false;
    }
    Private.hitTestMenus = hitTestMenus;
    /**
     * Compute which extra separator items should be collapsed.
     */
    function computeCollapsed(items) {
        // Allocate the return array and fill it with `false`.
        var result = new Array(items.length);
        ArrayExt.fill(result, false);
        // Collapse the leading separators.
        var k1 = 0;
        var n = items.length;
        for (; k1 < n; ++k1) {
            var item = items[k1];
            if (!item.isVisible) {
                continue;
            }
            if (item.type !== 'separator') {
                break;
            }
            result[k1] = true;
        }
        // Hide the trailing separators.
        var k2 = n - 1;
        for (; k2 >= 0; --k2) {
            var item = items[k2];
            if (!item.isVisible) {
                continue;
            }
            if (item.type !== 'separator') {
                break;
            }
            result[k2] = true;
        }
        // Hide the remaining consecutive separators.
        var hide = false;
        while (++k1 < k2) {
            var item = items[k1];
            if (!item.isVisible) {
                continue;
            }
            if (item.type !== 'separator') {
                hide = false;
            }
            else if (hide) {
                result[k1] = true;
            }
            else {
                hide = true;
            }
        }
        // Return the resulting flags.
        return result;
    }
    Private.computeCollapsed = computeCollapsed;
    /**
     * Open a menu as a root menu at the target location.
     */
    function openRootMenu(menu, x, y, forceX, forceY) {
        // Ensure the menu is updated before attaching and measuring.
        index_es6_MessageLoop.sendMessage(menu, index_es6_Widget.Msg.UpdateRequest);
        // Get the current position and size of the main viewport.
        var px = window.pageXOffset;
        var py = window.pageYOffset;
        var cw = document.documentElement.clientWidth;
        var ch = document.documentElement.clientHeight;
        // Compute the maximum allowed height for the menu.
        var maxHeight = ch - (forceY ? y : 0);
        // Fetch common variables.
        var node = menu.node;
        var style = node.style;
        // Clear the menu geometry and prepare it for measuring.
        style.top = '';
        style.left = '';
        style.width = '';
        style.height = '';
        style.visibility = 'hidden';
        style.maxHeight = maxHeight + "px";
        // Attach the menu to the document.
        index_es6_Widget.attach(menu, document.body);
        // Measure the size of the menu.
        var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height;
        // Adjust the X position of the menu to fit on-screen.
        if (!forceX && x + width > px + cw) {
            x = px + cw - width;
        }
        // Adjust the Y position of the menu to fit on-screen.
        if (!forceY && y + height > py + ch) {
            if (y > py + ch) {
                y = py + ch - height;
            }
            else {
                y = y - height;
            }
        }
        // Update the position of the menu to the computed position.
        style.top = Math.max(0, y) + "px";
        style.left = Math.max(0, x) + "px";
        // Finally, make the menu visible on the screen.
        style.visibility = '';
    }
    Private.openRootMenu = openRootMenu;
    /**
     * Open a menu as a submenu using an item node for positioning.
     */
    function openSubmenu(submenu, itemNode) {
        // Ensure the menu is updated before opening.
        index_es6_MessageLoop.sendMessage(submenu, index_es6_Widget.Msg.UpdateRequest);
        // Get the current position and size of the main viewport.
        var px = window.pageXOffset;
        var py = window.pageYOffset;
        var cw = document.documentElement.clientWidth;
        var ch = document.documentElement.clientHeight;
        // Compute the maximum allowed height for the menu.
        var maxHeight = ch;
        // Fetch common variables.
        var node = submenu.node;
        var style = node.style;
        // Clear the menu geometry and prepare it for measuring.
        style.top = '';
        style.left = '';
        style.width = '';
        style.height = '';
        style.visibility = 'hidden';
        style.maxHeight = maxHeight + "px";
        // Attach the menu to the document.
        index_es6_Widget.attach(submenu, document.body);
        // Measure the size of the menu.
        var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height;
        // Compute the box sizing for the menu.
        var box = ElementExt.boxSizing(submenu.node);
        // Get the bounding rect for the target item node.
        var itemRect = itemNode.getBoundingClientRect();
        // Compute the target X position.
        var x = itemRect.right - Private.SUBMENU_OVERLAP;
        // Adjust the X position to fit on the screen.
        if (x + width > px + cw) {
            x = itemRect.left + Private.SUBMENU_OVERLAP - width;
        }
        // Compute the target Y position.
        var y = itemRect.top - box.borderTop - box.paddingTop;
        // Adjust the Y position to fit on the screen.
        if (y + height > py + ch) {
            y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;
        }
        // Update the position of the menu to the computed position.
        style.top = Math.max(0, y) + "px";
        style.left = Math.max(0, x) + "px";
        // Finally, make the menu visible on the screen.
        style.visibility = '';
    }
    Private.openSubmenu = openSubmenu;
    /**
     * Find the best matching mnemonic item.
     *
     * The search starts at the given index and wraps around.
     */
    function findMnemonic(items, key, start) {
        // Setup the result variables.
        var index = -1;
        var auto = -1;
        var multiple = false;
        // Normalize the key to upper case.
        var upperKey = key.toUpperCase();
        // Search the items from the given start index.
        for (var i = 0, n = items.length; i < n; ++i) {
            // Compute the wrapped index.
            var k = (i + start) % n;
            // Lookup the item
            var item = items[k];
            // Ignore items which cannot be activated.
            if (!canActivate(item)) {
                continue;
            }
            // Ignore items with an empty label.
            var label = item.label;
            if (label.length === 0) {
                continue;
            }
            // Lookup the mnemonic index for the label.
            var mn = item.mnemonic;
            // Handle a valid mnemonic index.
            if (mn >= 0 && mn < label.length) {
                if (label[mn].toUpperCase() === upperKey) {
                    if (index === -1) {
                        index = k;
                    }
                    else {
                        multiple = true;
                    }
                }
                continue;
            }
            // Finally, handle the auto index if possible.
            if (auto === -1 && label[0].toUpperCase() === upperKey) {
                auto = k;
            }
        }
        // Return the search results.
        return { index: index, multiple: multiple, auto: auto };
    }
    Private.findMnemonic = findMnemonic;
    /**
     * A concrete implementation of `Menu.IItem`.
     */
    var MenuItem = /** @class */ (function () {
        /**
         * Construct a new menu item.
         */
        function MenuItem(commands, options) {
            this._commands = commands;
            this.type = options.type || 'command';
            this.command = options.command || '';
            this.args = options.args || JSONExt.emptyObject;
            this.submenu = options.submenu || null;
        }
        Object.defineProperty(MenuItem.prototype, "label", {
            /**
             * The display label for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.label(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.label;
                }
                return '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "mnemonic", {
            /**
             * The mnemonic index for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.mnemonic(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.mnemonic;
                }
                return -1;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "icon", {
            /**
             * The icon renderer for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.icon(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.icon;
                }
                /* <DEPRECATED> */
                // alias to icon class if not otherwise defined
                return this.iconClass;
                /* </DEPRECATED> */
                /* <FUTURE>
                return undefined;
                </FUTURE> */
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "iconClass", {
            /**
             * The icon class for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.iconClass(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.iconClass;
                }
                return '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "iconLabel", {
            /**
             * The icon label for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.iconLabel(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.iconLabel;
                }
                return '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "caption", {
            /**
             * The display caption for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.caption(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.caption;
                }
                return '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "className", {
            /**
             * The extra class name for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.className(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.className;
                }
                return '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "dataset", {
            /**
             * The dataset for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.dataset(this.command, this.args);
                }
                if (this.type === 'submenu' && this.submenu) {
                    return this.submenu.title.dataset;
                }
                return {};
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "isEnabled", {
            /**
             * Whether the menu item is enabled.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.isEnabled(this.command, this.args);
                }
                if (this.type === 'submenu') {
                    return this.submenu !== null;
                }
                return true;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "isToggled", {
            /**
             * Whether the menu item is toggled.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.isToggled(this.command, this.args);
                }
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "isVisible", {
            /**
             * Whether the menu item is visible.
             */
            get: function () {
                if (this.type === 'command') {
                    return this._commands.isVisible(this.command, this.args);
                }
                if (this.type === 'submenu') {
                    return this.submenu !== null;
                }
                return true;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MenuItem.prototype, "keyBinding", {
            /**
             * The key binding for the menu item.
             */
            get: function () {
                if (this.type === 'command') {
                    var _a = this, command_1 = _a.command, args_1 = _a.args;
                    return (ArrayExt.findLastValue(this._commands.keyBindings, function (kb) {
                        return kb.command === command_1 && JSONExt.deepEqual(kb.args, args_1);
                    }) || null);
                }
                return null;
            },
            enumerable: true,
            configurable: true
        });
        return MenuItem;
    }());
})(Private$9 || (Private$9 = {}));

/**
 * An object which implements a universal context menu.
 *
 * #### Notes
 * The items shown in the context menu are determined by CSS selector
 * matching against the DOM hierarchy at the site of the mouse click.
 * This is similar in concept to how keyboard shortcuts are matched
 * in the command registry.
 */
var index_es6_ContextMenu = /** @class */ (function () {
    /**
     * Construct a new context menu.
     *
     * @param options - The options for initializing the menu.
     */
    function ContextMenu(options) {
        this._groupByTarget = true;
        this._idTick = 0;
        this._items = [];
        this._sortBySelector = true;
        var groupByTarget = options.groupByTarget, sortBySelector = options.sortBySelector, others = __rest(options, ["groupByTarget", "sortBySelector"]);
        this.menu = new index_es6_Menu(others);
        this._groupByTarget = groupByTarget !== false;
        this._sortBySelector = sortBySelector !== false;
    }
    /**
     * Add an item to the context menu.
     *
     * @param options - The options for creating the item.
     *
     * @returns A disposable which will remove the item from the menu.
     */
    ContextMenu.prototype.addItem = function (options) {
        var _this = this;
        // Create an item from the given options.
        var item = Private$8.createItem(options, this._idTick++);
        // Add the item to the internal array.
        this._items.push(item);
        // Return a disposable which will remove the item.
        return new DisposableDelegate(function () {
            ArrayExt.removeFirstOf(_this._items, item);
        });
    };
    /**
     * Open the context menu in response to a `'contextmenu'` event.
     *
     * @param event - The `'contextmenu'` event of interest.
     *
     * @returns `true` if the menu was opened, or `false` if no items
     *   matched the event and the menu was not opened.
     *
     * #### Notes
     * This method will populate the context menu with items which match
     * the propagation path of the event, then open the menu at the mouse
     * position indicated by the event.
     */
    ContextMenu.prototype.open = function (event) {
        var _this = this;
        // Clear the current contents of the context menu.
        this.menu.clearItems();
        // Bail early if there are no items to match.
        if (this._items.length === 0) {
            return false;
        }
        // Find the matching items for the event.
        var items = Private$8.matchItems(this._items, event, this._groupByTarget, this._sortBySelector);
        // Bail if there are no matching items.
        if (!items || items.length === 0) {
            return false;
        }
        // Add the filtered items to the menu.
        each(items, function (item) {
            _this.menu.addItem(item);
        });
        // Open the context menu at the current mouse position.
        this.menu.open(event.clientX, event.clientY);
        // Indicate success.
        return true;
    };
    return ContextMenu;
}());
/**
 * The namespace for the module implementation details.
 */
var Private$8;
(function (Private) {
    /**
     * Create a normalized context menu item from an options object.
     */
    function createItem(options, id) {
        var selector = validateSelector(options.selector);
        var rank = options.rank !== undefined ? options.rank : Infinity;
        return index_es6_assign(index_es6_assign({}, options), { selector: selector, rank: rank, id: id });
    }
    Private.createItem = createItem;
    /**
     * Find the items which match a context menu event.
     *
     * The results are sorted by DOM level, specificity, and rank.
     */
    function matchItems(items, event, groupByTarget, sortBySelector) {
        // Look up the target of the event.
        var target = event.target;
        // Bail if there is no target.
        if (!target) {
            return null;
        }
        // Look up the current target of the event.
        var currentTarget = event.currentTarget;
        // Bail if there is no current target.
        if (!currentTarget) {
            return null;
        }
        // There are some third party libraries that cause the `target` to
        // be detached from the DOM before lumino can process the event.
        // If that happens, search for a new target node by point. If that
        // node is still dangling, bail.
        if (!currentTarget.contains(target)) {
            target = document.elementFromPoint(event.clientX, event.clientY);
            if (!target || !currentTarget.contains(target)) {
                return null;
            }
        }
        // Set up the result array.
        var result = [];
        // Copy the items array to allow in-place modification.
        var availableItems = items.slice();
        // Walk up the DOM hierarchy searching for matches.
        while (target !== null) {
            // Set up the match array for this DOM level.
            var matches = [];
            // Search the remaining items for matches.
            for (var i = 0, n = availableItems.length; i < n; ++i) {
                // Fetch the item.
                var item = availableItems[i];
                // Skip items which are already consumed.
                if (!item) {
                    continue;
                }
                // Skip items which do not match the element.
                if (!Selector.matches(target, item.selector)) {
                    continue;
                }
                // Add the matched item to the result for this DOM level.
                matches.push(item);
                // Mark the item as consumed.
                availableItems[i] = null;
            }
            // Sort the matches for this level and add them to the results.
            if (matches.length !== 0) {
                if (groupByTarget) {
                    matches.sort(sortBySelector ? itemCmp : itemCmpRank);
                }
                result.push.apply(result, matches);
            }
            // Stop searching at the limits of the DOM range.
            if (target === currentTarget) {
                break;
            }
            // Step to the parent DOM level.
            target = target.parentElement;
        }
        if (!groupByTarget) {
            result.sort(sortBySelector ? itemCmp : itemCmpRank);
        }
        // Return the matched and sorted results.
        return result;
    }
    Private.matchItems = matchItems;
    /**
     * Validate the selector for a menu item.
     *
     * This returns the validated selector, or throws if the selector is
     * invalid or contains commas.
     */
    function validateSelector(selector) {
        if (selector.indexOf(',') !== -1) {
            throw new Error("Selector cannot contain commas: " + selector);
        }
        if (!Selector.isValid(selector)) {
            throw new Error("Invalid selector: " + selector);
        }
        return selector;
    }
    /**
     * A sort comparison function for a context menu item by ranks.
     */
    function itemCmpRank(a, b) {
        // Sort based on rank.
        var r1 = a.rank;
        var r2 = b.rank;
        if (r1 !== r2) {
            return r1 < r2 ? -1 : 1; // Infinity-safe
        }
        // When all else fails, sort by item id.
        return a.id - b.id;
    }
    /**
     * A sort comparison function for a context menu item by selectors and ranks.
     */
    function itemCmp(a, b) {
        // Sort first based on selector specificity.
        var s1 = Selector.calculateSpecificity(a.selector);
        var s2 = Selector.calculateSpecificity(b.selector);
        if (s1 !== s2) {
            return s2 - s1;
        }
        // If specificities are equal
        return itemCmpRank(a, b);
    }
})(Private$8 || (Private$8 = {}));

/**
 * A widget which displays titles as a single row or column of tabs.
 *
 * #### Notes
 * If CSS transforms are used to rotate nodes for vertically oriented
 * text, then tab dragging will not work correctly. The `tabsMovable`
 * property should be set to `false` when rotating nodes from CSS.
 */
var index_es6_TabBar = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(TabBar, _super);
    /**
     * Construct a new tab bar.
     *
     * @param options - The options for initializing the tab bar.
     */
    function TabBar(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { node: Private$7.createNode() }) || this;
        _this._currentIndex = -1;
        _this._titles = [];
        _this._titlesEditable = false;
        _this._previousTitle = null;
        _this._dragData = null;
        _this._addButtonEnabled = false;
        _this._tabMoved = new Signal(_this);
        _this._currentChanged = new Signal(_this);
        _this._addRequested = new Signal(_this);
        _this._tabCloseRequested = new Signal(_this);
        _this._tabDetachRequested = new Signal(_this);
        _this._tabActivateRequested = new Signal(_this);
        _this.addClass('lm-TabBar');
        /* <DEPRECATED> */
        _this.addClass('p-TabBar');
        /* </DEPRECATED> */
        _this.contentNode.setAttribute('role', 'tablist');
        _this.setFlag(index_es6_Widget.Flag.DisallowLayout);
        _this.tabsMovable = options.tabsMovable || false;
        _this.titlesEditable = options.titlesEditable || false;
        _this.allowDeselect = options.allowDeselect || false;
        _this.addButtonEnabled = options.addButtonEnabled || false;
        _this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';
        _this.name = options.name || '';
        _this.orientation = options.orientation || 'horizontal';
        _this.removeBehavior = options.removeBehavior || 'select-tab-after';
        _this.renderer = options.renderer || TabBar.defaultRenderer;
        return _this;
    }
    /**
     * Dispose of the resources held by the widget.
     */
    TabBar.prototype.dispose = function () {
        this._releaseMouse();
        this._titles.length = 0;
        this._previousTitle = null;
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(TabBar.prototype, "currentChanged", {
        /**
         * A signal emitted when the current tab is changed.
         *
         * #### Notes
         * This signal is emitted when the currently selected tab is changed
         * either through user or programmatic interaction.
         *
         * Notably, this signal is not emitted when the index of the current
         * tab changes due to tabs being inserted, removed, or moved. It is
         * only emitted when the actual current tab node is changed.
         */
        get: function () {
            return this._currentChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "tabMoved", {
        /**
         * A signal emitted when a tab is moved by the user.
         *
         * #### Notes
         * This signal is emitted when a tab is moved by user interaction.
         *
         * This signal is not emitted when a tab is moved programmatically.
         */
        get: function () {
            return this._tabMoved;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "tabActivateRequested", {
        /**
         * A signal emitted when a tab is clicked by the user.
         *
         * #### Notes
         * If the clicked tab is not the current tab, the clicked tab will be
         * made current and the `currentChanged` signal will be emitted first.
         *
         * This signal is emitted even if the clicked tab is the current tab.
         */
        get: function () {
            return this._tabActivateRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "addRequested", {
        /**
         * A signal emitted when the tab bar add button is clicked.
         */
        get: function () {
            return this._addRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "tabCloseRequested", {
        /**
         * A signal emitted when a tab close icon is clicked.
         *
         * #### Notes
         * This signal is not emitted unless the tab title is `closable`.
         */
        get: function () {
            return this._tabCloseRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "tabDetachRequested", {
        /**
         * A signal emitted when a tab is dragged beyond the detach threshold.
         *
         * #### Notes
         * This signal is emitted when the user drags a tab with the mouse,
         * and mouse is dragged beyond the detach threshold.
         *
         * The consumer of the signal should call `releaseMouse` and remove
         * the tab in order to complete the detach.
         *
         * This signal is only emitted once per drag cycle.
         */
        get: function () {
            return this._tabDetachRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "titlesEditable", {
        /**
         * Whether the titles can be user-edited.
         *
         */
        get: function () {
            return this._titlesEditable;
        },
        /**
         * Set whether titles can be user edited.
         *
         */
        set: function (value) {
            this._titlesEditable = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "currentTitle", {
        /**
         * Get the currently selected title.
         *
         * #### Notes
         * This will be `null` if no tab is selected.
         */
        get: function () {
            return this._titles[this._currentIndex] || null;
        },
        /**
         * Set the currently selected title.
         *
         * #### Notes
         * If the title does not exist, the title will be set to `null`.
         */
        set: function (value) {
            this.currentIndex = value ? this._titles.indexOf(value) : -1;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "currentIndex", {
        /**
         * Get the index of the currently selected tab.
         *
         * #### Notes
         * This will be `-1` if no tab is selected.
         */
        get: function () {
            return this._currentIndex;
        },
        /**
         * Set the index of the currently selected tab.
         *
         * #### Notes
         * If the value is out of range, the index will be set to `-1`.
         */
        set: function (value) {
            // Adjust for an out of range index.
            if (value < 0 || value >= this._titles.length) {
                value = -1;
            }
            // Bail early if the index will not change.
            if (this._currentIndex === value) {
                return;
            }
            // Look up the previous index and title.
            var pi = this._currentIndex;
            var pt = this._titles[pi] || null;
            // Look up the current index and title.
            var ci = value;
            var ct = this._titles[ci] || null;
            // Update the current index and previous title.
            this._currentIndex = ci;
            this._previousTitle = pt;
            // Schedule an update of the tabs.
            this.update();
            // Emit the current changed signal.
            this._currentChanged.emit({
                previousIndex: pi,
                previousTitle: pt,
                currentIndex: ci,
                currentTitle: ct
            });
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "name", {
        /**
         * Get the name of the tab bar.
         */
        get: function () {
            return this._name;
        },
        /**
         * Set the name of the tab bar.
         */
        set: function (value) {
            this._name = value;
            if (value) {
                this.contentNode.setAttribute('aria-label', value);
            }
            else {
                this.contentNode.removeAttribute('aria-label');
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "orientation", {
        /**
         * Get the orientation of the tab bar.
         *
         * #### Notes
         * This controls whether the tabs are arranged in a row or column.
         */
        get: function () {
            return this._orientation;
        },
        /**
         * Set the orientation of the tab bar.
         *
         * #### Notes
         * This controls whether the tabs are arranged in a row or column.
         */
        set: function (value) {
            // Do nothing if the orientation does not change.
            if (this._orientation === value) {
                return;
            }
            // Release the mouse before making any changes.
            this._releaseMouse();
            // Toggle the orientation values.
            this._orientation = value;
            this.dataset['orientation'] = value;
            this.contentNode.setAttribute('aria-orientation', value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "addButtonEnabled", {
        /**
         * Whether the add button is enabled.
         */
        get: function () {
            return this._addButtonEnabled;
        },
        /**
         * Set whether the add button is enabled.
         */
        set: function (value) {
            // Do nothing if the value does not change.
            if (this._addButtonEnabled === value) {
                return;
            }
            this._addButtonEnabled = value;
            if (value) {
                this.addButtonNode.classList.remove('lm-mod-hidden');
            }
            else {
                this.addButtonNode.classList.add('lm-mod-hidden');
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "titles", {
        /**
         * A read-only array of the titles in the tab bar.
         */
        get: function () {
            return this._titles;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "contentNode", {
        /**
         * The tab bar content node.
         *
         * #### Notes
         * This is the node which holds the tab nodes.
         *
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-TabBar-content')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabBar.prototype, "addButtonNode", {
        /**
         * The tab bar add button node.
         *
         * #### Notes
         * This is the node which holds the add button.
         *
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-TabBar-addButton')[0];
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Add a tab to the end of the tab bar.
     *
     * @param value - The title which holds the data for the tab,
     *   or an options object to convert to a title.
     *
     * @returns The title object added to the tab bar.
     *
     * #### Notes
     * If the title is already added to the tab bar, it will be moved.
     */
    TabBar.prototype.addTab = function (value) {
        return this.insertTab(this._titles.length, value);
    };
    /**
     * Insert a tab into the tab bar at the specified index.
     *
     * @param index - The index at which to insert the tab.
     *
     * @param value - The title which holds the data for the tab,
     *   or an options object to convert to a title.
     *
     * @returns The title object added to the tab bar.
     *
     * #### Notes
     * The index will be clamped to the bounds of the tabs.
     *
     * If the title is already added to the tab bar, it will be moved.
     */
    TabBar.prototype.insertTab = function (index, value) {
        // Release the mouse before making any changes.
        this._releaseMouse();
        // Coerce the value to a title.
        var title = Private$7.asTitle(value);
        // Look up the index of the title.
        var i = this._titles.indexOf(title);
        // Clamp the insert index to the array bounds.
        var j = Math.max(0, Math.min(index, this._titles.length));
        // If the title is not in the array, insert it.
        if (i === -1) {
            // Insert the title into the array.
            ArrayExt.insert(this._titles, j, title);
            // Connect to the title changed signal.
            title.changed.connect(this._onTitleChanged, this);
            // Schedule an update of the tabs.
            this.update();
            // Adjust the current index for the insert.
            this._adjustCurrentForInsert(j, title);
            // Return the title added to the tab bar.
            return title;
        }
        // Otherwise, the title exists in the array and should be moved.
        // Adjust the index if the location is at the end of the array.
        if (j === this._titles.length) {
            j--;
        }
        // Bail if there is no effective move.
        if (i === j) {
            return title;
        }
        // Move the title to the new location.
        ArrayExt.move(this._titles, i, j);
        // Schedule an update of the tabs.
        this.update();
        // Adjust the current index for the move.
        this._adjustCurrentForMove(i, j);
        // Return the title added to the tab bar.
        return title;
    };
    /**
     * Remove a tab from the tab bar.
     *
     * @param title - The title for the tab to remove.
     *
     * #### Notes
     * This is a no-op if the title is not in the tab bar.
     */
    TabBar.prototype.removeTab = function (title) {
        this.removeTabAt(this._titles.indexOf(title));
    };
    /**
     * Remove the tab at a given index from the tab bar.
     *
     * @param index - The index of the tab to remove.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    TabBar.prototype.removeTabAt = function (index) {
        // Release the mouse before making any changes.
        this._releaseMouse();
        // Remove the title from the array.
        var title = ArrayExt.removeAt(this._titles, index);
        // Bail if the index is out of range.
        if (!title) {
            return;
        }
        // Disconnect from the title changed signal.
        title.changed.disconnect(this._onTitleChanged, this);
        // Clear the previous title if it's being removed.
        if (title === this._previousTitle) {
            this._previousTitle = null;
        }
        // Schedule an update of the tabs.
        this.update();
        // Adjust the current index for the remove.
        this._adjustCurrentForRemove(index, title);
    };
    /**
     * Remove all tabs from the tab bar.
     */
    TabBar.prototype.clearTabs = function () {
        // Bail if there is nothing to remove.
        if (this._titles.length === 0) {
            return;
        }
        // Release the mouse before making any changes.
        this._releaseMouse();
        // Disconnect from the title changed signals.
        for (var _i = 0, _a = this._titles; _i < _a.length; _i++) {
            var title = _a[_i];
            title.changed.disconnect(this._onTitleChanged, this);
        }
        // Get the current index and title.
        var pi = this.currentIndex;
        var pt = this.currentTitle;
        // Reset the current index and previous title.
        this._currentIndex = -1;
        this._previousTitle = null;
        // Clear the title array.
        this._titles.length = 0;
        // Schedule an update of the tabs.
        this.update();
        // If no tab was selected, there's nothing else to do.
        if (pi === -1) {
            return;
        }
        // Emit the current changed signal.
        this._currentChanged.emit({
            previousIndex: pi,
            previousTitle: pt,
            currentIndex: -1,
            currentTitle: null
        });
    };
    /**
     * Release the mouse and restore the non-dragged tab positions.
     *
     * #### Notes
     * This will cause the tab bar to stop handling mouse events and to
     * restore the tabs to their non-dragged positions.
     */
    TabBar.prototype.releaseMouse = function () {
        this._releaseMouse();
    };
    /**
     * Handle the DOM events for the tab bar.
     *
     * @param event - The DOM event sent to the tab bar.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the tab bar's DOM node.
     *
     * This should not be called directly by user code.
     */
    TabBar.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'mousedown': // <DEPRECATED>
                this._evtMouseDown(event);
                break;
            case 'mousemove': // <DEPRECATED>
                this._evtMouseMove(event);
                break;
            case 'mouseup': // <DEPRECATED>
                this._evtMouseUp(event);
                break;
            case 'pointerdown':
                this._evtMouseDown(event);
                break;
            case 'pointermove':
                this._evtMouseMove(event);
                break;
            case 'pointerup':
                this._evtMouseUp(event);
                break;
            case 'dblclick':
                this._evtDblClick(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    TabBar.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('mousedown', this); // <DEPRECATED>
        this.node.addEventListener('pointerdown', this);
        this.node.addEventListener('dblclick', this);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    TabBar.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('mousedown', this); // <DEPRECATED>
        this.node.removeEventListener('pointerdown', this);
        this.node.removeEventListener('dblclick', this);
        this._releaseMouse();
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    TabBar.prototype.onUpdateRequest = function (msg) {
        var titles = this._titles;
        var renderer = this.renderer;
        var currentTitle = this.currentTitle;
        var content = new Array(titles.length);
        for (var i = 0, n = titles.length; i < n; ++i) {
            var title = titles[i];
            var current = title === currentTitle;
            var zIndex = current ? n : n - i - 1;
            content[i] = renderer.renderTab({ title: title, current: current, zIndex: zIndex });
        }
        VirtualDOM.render(content, this.contentNode);
    };
    /**
     * Handle the `'dblclick'` event for the tab bar.
     */
    TabBar.prototype._evtDblClick = function (event) {
        // Do nothing if titles are not editable
        if (!this.titlesEditable) {
            return;
        }
        var tabs = this.contentNode.children;
        // Find the index of the released tab.
        var index = ArrayExt.findFirstIndex(tabs, function (tab) {
            return ElementExt.hitTest(tab, event.clientX, event.clientY);
        });
        // Do nothing if the press is not on a tab.
        if (index === -1) {
            return;
        }
        var title = this.titles[index];
        var label = tabs[index].querySelector('.lm-TabBar-tabLabel');
        if (label && label.contains(event.target)) {
            var value = title.label || '';
            // Clear the label element
            var oldValue_1 = label.innerHTML;
            label.innerHTML = '';
            var input_1 = document.createElement('input');
            input_1.classList.add('lm-TabBar-tabInput');
            input_1.value = value;
            label.appendChild(input_1);
            var onblur_1 = function () {
                input_1.removeEventListener('blur', onblur_1);
                label.innerHTML = oldValue_1;
            };
            input_1.addEventListener('dblclick', function (event) {
                return event.stopPropagation();
            });
            input_1.addEventListener('blur', onblur_1);
            input_1.addEventListener('keydown', function (event) {
                if (event.key === 'Enter') {
                    if (input_1.value !== '') {
                        title.label = title.caption = input_1.value;
                    }
                    onblur_1();
                }
                else if (event.key === 'Escape') {
                    onblur_1();
                }
            });
            input_1.select();
            input_1.focus();
            if (label.children.length > 0) {
                label.children[0].focus();
            }
        }
    };
    /**
     * Handle the `'keydown'` event for the tab bar.
     */
    TabBar.prototype._evtKeyDown = function (event) {
        // Stop all input events during drag.
        event.preventDefault();
        event.stopPropagation();
        // Release the mouse if `Escape` is pressed.
        if (event.keyCode === 27) {
            this._releaseMouse();
        }
    };
    /**
     * Handle the `'mousedown'` event for the tab bar.
     */
    TabBar.prototype._evtMouseDown = function (event) {
        // Do nothing if it's not a left or middle mouse press.
        if (event.button !== 0 && event.button !== 1) {
            return;
        }
        // Do nothing if a drag is in progress.
        if (this._dragData) {
            return;
        }
        // Check if the add button was clicked.
        var addButtonClicked = this.addButtonEnabled &&
            this.addButtonNode.contains(event.target);
        // Lookup the tab nodes.
        var tabs = this.contentNode.children;
        // Find the index of the pressed tab.
        var index = ArrayExt.findFirstIndex(tabs, function (tab) {
            return ElementExt.hitTest(tab, event.clientX, event.clientY);
        });
        // Do nothing if the press is not on a tab or the add button.
        if (index === -1 && !addButtonClicked) {
            return;
        }
        // Pressing on a tab stops the event propagation.
        event.preventDefault();
        event.stopPropagation();
        // Initialize the non-measured parts of the drag data.
        this._dragData = {
            tab: tabs[index],
            index: index,
            pressX: event.clientX,
            pressY: event.clientY,
            tabPos: -1,
            tabSize: -1,
            tabPressPos: -1,
            targetIndex: -1,
            tabLayout: null,
            contentRect: null,
            override: null,
            dragActive: false,
            dragAborted: false,
            detachRequested: false
        };
        // Add the document mouse up listener.
        document.addEventListener('mouseup', this, true); // <DEPRECATED>
        document.addEventListener('pointerup', this, true);
        // Do nothing else if the middle button or add button is clicked.
        if (event.button === 1 || addButtonClicked) {
            return;
        }
        // Do nothing else if the close icon is clicked.
        var icon = tabs[index].querySelector(this.renderer.closeIconSelector);
        if (icon && icon.contains(event.target)) {
            return;
        }
        // Add the extra listeners if the tabs are movable.
        if (this.tabsMovable) {
            document.addEventListener('mousemove', this, true); // <DEPRECATED>
            document.addEventListener('pointermove', this, true);
            document.addEventListener('keydown', this, true);
            document.addEventListener('contextmenu', this, true);
        }
        // Update the current index as appropriate.
        if (this.allowDeselect && this.currentIndex === index) {
            this.currentIndex = -1;
        }
        else {
            this.currentIndex = index;
        }
        // Do nothing else if there is no current tab.
        if (this.currentIndex === -1) {
            return;
        }
        // Emit the tab activate request signal.
        this._tabActivateRequested.emit({
            index: this.currentIndex,
            title: this.currentTitle
        });
    };
    /**
     * Handle the `'mousemove'` event for the tab bar.
     */
    TabBar.prototype._evtMouseMove = function (event) {
        // Do nothing if no drag is in progress.
        var data = this._dragData;
        if (!data) {
            return;
        }
        // Suppress the event during a drag.
        event.preventDefault();
        event.stopPropagation();
        // Lookup the tab nodes.
        var tabs = this.contentNode.children;
        // Bail early if the drag threshold has not been met.
        if (!data.dragActive && !Private$7.dragExceeded(data, event)) {
            return;
        }
        // Activate the drag if necessary.
        if (!data.dragActive) {
            // Fill in the rest of the drag data measurements.
            var tabRect = data.tab.getBoundingClientRect();
            if (this._orientation === 'horizontal') {
                data.tabPos = data.tab.offsetLeft;
                data.tabSize = tabRect.width;
                data.tabPressPos = data.pressX - tabRect.left;
            }
            else {
                data.tabPos = data.tab.offsetTop;
                data.tabSize = tabRect.height;
                data.tabPressPos = data.pressY - tabRect.top;
            }
            data.tabLayout = Private$7.snapTabLayout(tabs, this._orientation);
            data.contentRect = this.contentNode.getBoundingClientRect();
            data.override = index_es6_Drag.overrideCursor('default');
            // Add the dragging style classes.
            data.tab.classList.add('lm-mod-dragging');
            this.addClass('lm-mod-dragging');
            /* <DEPRECATED> */
            data.tab.classList.add('p-mod-dragging');
            this.addClass('p-mod-dragging');
            /* </DEPRECATED> */
            // Mark the drag as active.
            data.dragActive = true;
        }
        // Emit the detach requested signal if the threshold is exceeded.
        if (!data.detachRequested && Private$7.detachExceeded(data, event)) {
            // Only emit the signal once per drag cycle.
            data.detachRequested = true;
            // Setup the arguments for the signal.
            var index = data.index;
            var clientX = event.clientX;
            var clientY = event.clientY;
            var tab = tabs[index];
            var title = this._titles[index];
            // Emit the tab detach requested signal.
            this._tabDetachRequested.emit({ index: index, title: title, tab: tab, clientX: clientX, clientY: clientY });
            // Bail if the signal handler aborted the drag.
            if (data.dragAborted) {
                return;
            }
        }
        // Update the positions of the tabs.
        Private$7.layoutTabs(tabs, data, event, this._orientation);
    };
    /**
     * Handle the `'mouseup'` event for the document.
     */
    TabBar.prototype._evtMouseUp = function (event) {
        var _this = this;
        // Do nothing if it's not a left or middle mouse release.
        if (event.button !== 0 && event.button !== 1) {
            return;
        }
        // Do nothing if no drag is in progress.
        var data = this._dragData;
        if (!data) {
            return;
        }
        // Stop the event propagation.
        event.preventDefault();
        event.stopPropagation();
        // Remove the extra mouse event listeners.
        document.removeEventListener('mousemove', this, true); // <DEPRECATED>
        document.removeEventListener('mouseup', this, true); // <DEPRECATED>
        document.removeEventListener('pointermove', this, true);
        document.removeEventListener('pointerup', this, true);
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('contextmenu', this, true);
        // Handle a release when the drag is not active.
        if (!data.dragActive) {
            // Clear the drag data.
            this._dragData = null;
            // Handle clicking the add button.
            var addButtonClicked = this.addButtonEnabled &&
                this.addButtonNode.contains(event.target);
            if (addButtonClicked) {
                this._addRequested.emit(undefined);
                return;
            }
            // Lookup the tab nodes.
            var tabs = this.contentNode.children;
            // Find the index of the released tab.
            var index = ArrayExt.findFirstIndex(tabs, function (tab) {
                return ElementExt.hitTest(tab, event.clientX, event.clientY);
            });
            // Do nothing if the release is not on the original pressed tab.
            if (index !== data.index) {
                return;
            }
            // Ignore the release if the title is not closable.
            var title = this._titles[index];
            if (!title.closable) {
                return;
            }
            // Emit the close requested signal if the middle button is released.
            if (event.button === 1) {
                this._tabCloseRequested.emit({ index: index, title: title });
                return;
            }
            // Emit the close requested signal if the close icon was released.
            var icon = tabs[index].querySelector(this.renderer.closeIconSelector);
            if (icon && icon.contains(event.target)) {
                this._tabCloseRequested.emit({ index: index, title: title });
                return;
            }
            // Otherwise, there is nothing left to do.
            return;
        }
        // Do nothing if the left button is not released.
        if (event.button !== 0) {
            return;
        }
        // Position the tab at its final resting position.
        Private$7.finalizeTabPosition(data, this._orientation);
        // Remove the dragging class from the tab so it can be transitioned.
        data.tab.classList.remove('lm-mod-dragging');
        /* <DEPRECATED> */
        data.tab.classList.remove('p-mod-dragging');
        /* </DEPRECATED> */
        // Parse the transition duration for releasing the tab.
        var duration = Private$7.parseTransitionDuration(data.tab);
        // Complete the release on a timer to allow the tab to transition.
        setTimeout(function () {
            // Do nothing if the drag has been aborted.
            if (data.dragAborted) {
                return;
            }
            // Clear the drag data reference.
            _this._dragData = null;
            // Reset the positions of the tabs.
            Private$7.resetTabPositions(_this.contentNode.children, _this._orientation);
            // Clear the cursor grab.
            data.override.dispose();
            // Remove the remaining dragging style.
            _this.removeClass('lm-mod-dragging');
            /* <DEPRECATED> */
            _this.removeClass('p-mod-dragging');
            /* </DEPRECATED> */
            // If the tab was not moved, there is nothing else to do.
            var i = data.index;
            var j = data.targetIndex;
            if (j === -1 || i === j) {
                return;
            }
            // Move the title to the new locations.
            ArrayExt.move(_this._titles, i, j);
            // Adjust the current index for the move.
            _this._adjustCurrentForMove(i, j);
            // Emit the tab moved signal.
            _this._tabMoved.emit({
                fromIndex: i,
                toIndex: j,
                title: _this._titles[j]
            });
            // Update the tabs immediately to prevent flicker.
            index_es6_MessageLoop.sendMessage(_this, index_es6_Widget.Msg.UpdateRequest);
        }, duration);
    };
    /**
     * Release the mouse and restore the non-dragged tab positions.
     */
    TabBar.prototype._releaseMouse = function () {
        // Do nothing if no drag is in progress.
        var data = this._dragData;
        if (!data) {
            return;
        }
        // Clear the drag data reference.
        this._dragData = null;
        // Remove the extra mouse listeners.
        document.removeEventListener('mousemove', this, true); // <DEPRECATED>
        document.removeEventListener('mouseup', this, true); // <DEPRECATED>
        document.removeEventListener('pointermove', this, true);
        document.removeEventListener('pointerup', this, true);
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('contextmenu', this, true);
        // Indicate the drag has been aborted. This allows the mouse
        // event handlers to return early when the drag is canceled.
        data.dragAborted = true;
        // If the drag is not active, there's nothing more to do.
        if (!data.dragActive) {
            return;
        }
        // Reset the tabs to their non-dragged positions.
        Private$7.resetTabPositions(this.contentNode.children, this._orientation);
        // Clear the cursor override.
        data.override.dispose();
        // Clear the dragging style classes.
        data.tab.classList.remove('lm-mod-dragging');
        this.removeClass('lm-mod-dragging');
        /* <DEPRECATED> */
        data.tab.classList.remove('p-mod-dragging');
        this.removeClass('p-mod-dragging');
        /* </DEPRECATED> */
    };
    /**
     * Adjust the current index for a tab insert operation.
     *
     * This method accounts for the tab bar's insertion behavior when
     * adjusting the current index and emitting the changed signal.
     */
    TabBar.prototype._adjustCurrentForInsert = function (i, title) {
        // Lookup commonly used variables.
        var ct = this.currentTitle;
        var ci = this._currentIndex;
        var bh = this.insertBehavior;
        // TODO: do we need to do an update to update the aria-selected attribute?
        // Handle the behavior where the new tab is always selected,
        // or the behavior where the new tab is selected if needed.
        if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {
            this._currentIndex = i;
            this._previousTitle = ct;
            this._currentChanged.emit({
                previousIndex: ci,
                previousTitle: ct,
                currentIndex: i,
                currentTitle: title
            });
            return;
        }
        // Otherwise, silently adjust the current index if needed.
        if (ci >= i) {
            this._currentIndex++;
        }
    };
    /**
     * Adjust the current index for a tab move operation.
     *
     * This method will not cause the actual current tab to change.
     * It silently adjusts the index to account for the given move.
     */
    TabBar.prototype._adjustCurrentForMove = function (i, j) {
        if (this._currentIndex === i) {
            this._currentIndex = j;
        }
        else if (this._currentIndex < i && this._currentIndex >= j) {
            this._currentIndex++;
        }
        else if (this._currentIndex > i && this._currentIndex <= j) {
            this._currentIndex--;
        }
    };
    /**
     * Adjust the current index for a tab remove operation.
     *
     * This method accounts for the tab bar's remove behavior when
     * adjusting the current index and emitting the changed signal.
     */
    TabBar.prototype._adjustCurrentForRemove = function (i, title) {
        // Lookup commonly used variables.
        var ci = this._currentIndex;
        var bh = this.removeBehavior;
        // Silently adjust the index if the current tab is not removed.
        if (ci !== i) {
            if (ci > i) {
                this._currentIndex--;
            }
            return;
        }
        // TODO: do we need to do an update to adjust the aria-selected value?
        // No tab gets selected if the tab bar is empty.
        if (this._titles.length === 0) {
            this._currentIndex = -1;
            this._currentChanged.emit({
                previousIndex: i,
                previousTitle: title,
                currentIndex: -1,
                currentTitle: null
            });
            return;
        }
        // Handle behavior where the next sibling tab is selected.
        if (bh === 'select-tab-after') {
            this._currentIndex = Math.min(i, this._titles.length - 1);
            this._currentChanged.emit({
                previousIndex: i,
                previousTitle: title,
                currentIndex: this._currentIndex,
                currentTitle: this.currentTitle
            });
            return;
        }
        // Handle behavior where the previous sibling tab is selected.
        if (bh === 'select-tab-before') {
            this._currentIndex = Math.max(0, i - 1);
            this._currentChanged.emit({
                previousIndex: i,
                previousTitle: title,
                currentIndex: this._currentIndex,
                currentTitle: this.currentTitle
            });
            return;
        }
        // Handle behavior where the previous history tab is selected.
        if (bh === 'select-previous-tab') {
            if (this._previousTitle) {
                this._currentIndex = this._titles.indexOf(this._previousTitle);
                this._previousTitle = null;
            }
            else {
                this._currentIndex = Math.min(i, this._titles.length - 1);
            }
            this._currentChanged.emit({
                previousIndex: i,
                previousTitle: title,
                currentIndex: this._currentIndex,
                currentTitle: this.currentTitle
            });
            return;
        }
        // Otherwise, no tab gets selected.
        this._currentIndex = -1;
        this._currentChanged.emit({
            previousIndex: i,
            previousTitle: title,
            currentIndex: -1,
            currentTitle: null
        });
    };
    /**
     * Handle the `changed` signal of a title object.
     */
    TabBar.prototype._onTitleChanged = function (sender) {
        this.update();
    };
    return TabBar;
}(index_es6_Widget));
/**
 * The namespace for the `TabBar` class statics.
 */
(function (TabBar) {
    /**
     * The default implementation of `IRenderer`.
     *
     * #### Notes
     * Subclasses are free to reimplement rendering methods as needed.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
            /**
             * A selector which matches the close icon node in a tab.
             */
            this.closeIconSelector = '.lm-TabBar-tabCloseIcon';
            this._tabID = 0;
            this._tabKeys = new WeakMap();
        }
        /**
         * Render the virtual element for a tab.
         *
         * @param data - The data to use for rendering the tab.
         *
         * @returns A virtual element representing the tab.
         */
        Renderer.prototype.renderTab = function (data) {
            var title = data.title.caption;
            var key = this.createTabKey(data);
            var id = key;
            var style = this.createTabStyle(data);
            var className = this.createTabClass(data);
            var dataset = this.createTabDataset(data);
            var aria = this.createTabARIA(data);
            if (data.title.closable) {
                return index_es6_h.li(index_es6_assign({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data), this.renderCloseIcon(data));
            }
            else {
                return index_es6_h.li(index_es6_assign({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data));
            }
        };
        /**
         * Render the icon element for a tab.
         *
         * @param data - The data to use for rendering the tab.
         *
         * @returns A virtual element representing the tab icon.
         */
        Renderer.prototype.renderIcon = function (data) {
            var title = data.title;
            var className = this.createIconClass(data);
            /* <DEPRECATED> */
            if (typeof title.icon === 'string') {
                return index_es6_h.div({ className: className }, title.iconLabel);
            }
            /* </DEPRECATED> */
            // if title.icon is undefined, it will be ignored
            return index_es6_h.div({ className: className }, title.icon, title.iconLabel);
        };
        /**
         * Render the label element for a tab.
         *
         * @param data - The data to use for rendering the tab.
         *
         * @returns A virtual element representing the tab label.
         */
        Renderer.prototype.renderLabel = function (data) {
            return index_es6_h.div({
                className: 'lm-TabBar-tabLabel' +
                    /* <DEPRECATED> */
                    ' p-TabBar-tabLabel'
                /* </DEPRECATED> */
            }, data.title.label);
        };
        /**
         * Render the close icon element for a tab.
         *
         * @param data - The data to use for rendering the tab.
         *
         * @returns A virtual element representing the tab close icon.
         */
        Renderer.prototype.renderCloseIcon = function (data) {
            return index_es6_h.div({
                className: 'lm-TabBar-tabCloseIcon' +
                    /* <DEPRECATED> */
                    ' p-TabBar-tabCloseIcon'
                /* </DEPRECATED> */
            });
        };
        /**
         * Create a unique render key for the tab.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The unique render key for the tab.
         *
         * #### Notes
         * This method caches the key against the tab title the first time
         * the key is generated. This enables efficient rendering of moved
         * tabs and avoids subtle hover style artifacts.
         */
        Renderer.prototype.createTabKey = function (data) {
            var key = this._tabKeys.get(data.title);
            if (key === undefined) {
                key = "tab-key-" + this._tabID++;
                this._tabKeys.set(data.title, key);
            }
            return key;
        };
        /**
         * Create the inline style object for a tab.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The inline style data for the tab.
         */
        Renderer.prototype.createTabStyle = function (data) {
            return { zIndex: "" + data.zIndex };
        };
        /**
         * Create the class name for the tab.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The full class name for the tab.
         */
        Renderer.prototype.createTabClass = function (data) {
            var name = 'lm-TabBar-tab';
            /* <DEPRECATED> */
            name += ' p-TabBar-tab';
            /* </DEPRECATED> */
            if (data.title.className) {
                name += " " + data.title.className;
            }
            if (data.title.closable) {
                name += ' lm-mod-closable';
                /* <DEPRECATED> */
                name += ' p-mod-closable';
                /* </DEPRECATED> */
            }
            if (data.current) {
                name += ' lm-mod-current';
                /* <DEPRECATED> */
                name += ' p-mod-current';
                /* </DEPRECATED> */
            }
            return name;
        };
        /**
         * Create the dataset for a tab.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The dataset for the tab.
         */
        Renderer.prototype.createTabDataset = function (data) {
            return data.title.dataset;
        };
        /**
         * Create the ARIA attributes for a tab.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The ARIA attributes for the tab.
         */
        Renderer.prototype.createTabARIA = function (data) {
            return { role: 'tab', 'aria-selected': data.current.toString() };
        };
        /**
         * Create the class name for the tab icon.
         *
         * @param data - The data to use for the tab.
         *
         * @returns The full class name for the tab icon.
         */
        Renderer.prototype.createIconClass = function (data) {
            var name = 'lm-TabBar-tabIcon';
            /* <DEPRECATED> */
            name += ' p-TabBar-tabIcon';
            /* </DEPRECATED> */
            var extra = data.title.iconClass;
            return extra ? name + " " + extra : name;
        };
        return Renderer;
    }());
    TabBar.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    TabBar.defaultRenderer = new Renderer();
    /**
     * A selector which matches the add button node in the tab bar.
     */
    TabBar.addButtonSelector = '.lm-TabBar-addButton';
})(index_es6_TabBar || (index_es6_TabBar = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$7;
(function (Private) {
    /**
     * The start drag distance threshold.
     */
    Private.DRAG_THRESHOLD = 5;
    /**
     * The detach distance threshold.
     */
    Private.DETACH_THRESHOLD = 20;
    /**
     * Create the DOM node for a tab bar.
     */
    function createNode() {
        var node = document.createElement('div');
        var content = document.createElement('ul');
        content.setAttribute('role', 'tablist');
        content.className = 'lm-TabBar-content';
        /* <DEPRECATED> */
        content.classList.add('p-TabBar-content');
        /* </DEPRECATED> */
        node.appendChild(content);
        var add = document.createElement('div');
        add.className = 'lm-TabBar-addButton lm-mod-hidden';
        node.appendChild(add);
        return node;
    }
    Private.createNode = createNode;
    /**
     * Coerce a title or options into a real title.
     */
    function asTitle(value) {
        return value instanceof index_es6_Title ? value : new index_es6_Title(value);
    }
    Private.asTitle = asTitle;
    /**
     * Parse the transition duration for a tab node.
     */
    function parseTransitionDuration(tab) {
        var style = window.getComputedStyle(tab);
        return 1000 * (parseFloat(style.transitionDuration) || 0);
    }
    Private.parseTransitionDuration = parseTransitionDuration;
    /**
     * Get a snapshot of the current tab layout values.
     */
    function snapTabLayout(tabs, orientation) {
        var layout = new Array(tabs.length);
        for (var i = 0, n = tabs.length; i < n; ++i) {
            var node = tabs[i];
            var style = window.getComputedStyle(node);
            if (orientation === 'horizontal') {
                layout[i] = {
                    pos: node.offsetLeft,
                    size: node.offsetWidth,
                    margin: parseFloat(style.marginLeft) || 0
                };
            }
            else {
                layout[i] = {
                    pos: node.offsetTop,
                    size: node.offsetHeight,
                    margin: parseFloat(style.marginTop) || 0
                };
            }
        }
        return layout;
    }
    Private.snapTabLayout = snapTabLayout;
    /**
     * Test if the event exceeds the drag threshold.
     */
    function dragExceeded(data, event) {
        var dx = Math.abs(event.clientX - data.pressX);
        var dy = Math.abs(event.clientY - data.pressY);
        return dx >= Private.DRAG_THRESHOLD || dy >= Private.DRAG_THRESHOLD;
    }
    Private.dragExceeded = dragExceeded;
    /**
     * Test if the event exceeds the drag detach threshold.
     */
    function detachExceeded(data, event) {
        var rect = data.contentRect;
        return (event.clientX < rect.left - Private.DETACH_THRESHOLD ||
            event.clientX >= rect.right + Private.DETACH_THRESHOLD ||
            event.clientY < rect.top - Private.DETACH_THRESHOLD ||
            event.clientY >= rect.bottom + Private.DETACH_THRESHOLD);
    }
    Private.detachExceeded = detachExceeded;
    /**
     * Update the relative tab positions and computed target index.
     */
    function layoutTabs(tabs, data, event, orientation) {
        // Compute the orientation-sensitive values.
        var pressPos;
        var localPos;
        var clientPos;
        var clientSize;
        if (orientation === 'horizontal') {
            pressPos = data.pressX;
            localPos = event.clientX - data.contentRect.left;
            clientPos = event.clientX;
            clientSize = data.contentRect.width;
        }
        else {
            pressPos = data.pressY;
            localPos = event.clientY - data.contentRect.top;
            clientPos = event.clientY;
            clientSize = data.contentRect.height;
        }
        // Compute the target data.
        var targetIndex = data.index;
        var targetPos = localPos - data.tabPressPos;
        var targetEnd = targetPos + data.tabSize;
        // Update the relative tab positions.
        for (var i = 0, n = tabs.length; i < n; ++i) {
            var pxPos = void 0;
            var layout = data.tabLayout[i];
            var threshold = layout.pos + (layout.size >> 1);
            if (i < data.index && targetPos < threshold) {
                pxPos = data.tabSize + data.tabLayout[i + 1].margin + "px";
                targetIndex = Math.min(targetIndex, i);
            }
            else if (i > data.index && targetEnd > threshold) {
                pxPos = -data.tabSize - layout.margin + "px";
                targetIndex = Math.max(targetIndex, i);
            }
            else if (i === data.index) {
                var ideal = clientPos - pressPos;
                var limit = clientSize - (data.tabPos + data.tabSize);
                pxPos = Math.max(-data.tabPos, Math.min(ideal, limit)) + "px";
            }
            else {
                pxPos = '';
            }
            if (orientation === 'horizontal') {
                tabs[i].style.left = pxPos;
            }
            else {
                tabs[i].style.top = pxPos;
            }
        }
        // Update the computed target index.
        data.targetIndex = targetIndex;
    }
    Private.layoutTabs = layoutTabs;
    /**
     * Position the drag tab at its final resting relative position.
     */
    function finalizeTabPosition(data, orientation) {
        // Compute the orientation-sensitive client size.
        var clientSize;
        if (orientation === 'horizontal') {
            clientSize = data.contentRect.width;
        }
        else {
            clientSize = data.contentRect.height;
        }
        // Compute the ideal final tab position.
        var ideal;
        if (data.targetIndex === data.index) {
            ideal = 0;
        }
        else if (data.targetIndex > data.index) {
            var tgt = data.tabLayout[data.targetIndex];
            ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;
        }
        else {
            var tgt = data.tabLayout[data.targetIndex];
            ideal = tgt.pos - data.tabPos;
        }
        // Compute the tab position limit.
        var limit = clientSize - (data.tabPos + data.tabSize);
        var final = Math.max(-data.tabPos, Math.min(ideal, limit));
        // Set the final orientation-sensitive position.
        if (orientation === 'horizontal') {
            data.tab.style.left = final + "px";
        }
        else {
            data.tab.style.top = final + "px";
        }
    }
    Private.finalizeTabPosition = finalizeTabPosition;
    /**
     * Reset the relative positions of the given tabs.
     */
    function resetTabPositions(tabs, orientation) {
        each(tabs, function (tab) {
            if (orientation === 'horizontal') {
                tab.style.left = '';
            }
            else {
                tab.style.top = '';
            }
        });
    }
    Private.resetTabPositions = resetTabPositions;
})(Private$7 || (Private$7 = {}));

/**
 * A layout which provides a flexible docking arrangement.
 *
 * #### Notes
 * The consumer of this layout is responsible for handling all signals
 * from the generated tab bars and managing the visibility of widgets
 * and tab bars as needed.
 */
var index_es6_DockLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(DockLayout, _super);
    /**
     * Construct a new dock layout.
     *
     * @param options - The options for initializing the layout.
     */
    function DockLayout(options) {
        var _this = _super.call(this) || this;
        _this._spacing = 4;
        _this._dirty = false;
        _this._root = null;
        _this._box = null;
        _this._items = new Map();
        _this.renderer = options.renderer;
        if (options.spacing !== undefined) {
            _this._spacing = Utils$1.clampDimension(options.spacing);
        }
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     *
     * #### Notes
     * This will clear and dispose all widgets in the layout.
     */
    DockLayout.prototype.dispose = function () {
        // Get an iterator over the widgets in the layout.
        var widgets = this.iter();
        // Dispose of the layout items.
        this._items.forEach(function (item) {
            item.dispose();
        });
        // Clear the layout state before disposing the widgets.
        this._box = null;
        this._root = null;
        this._items.clear();
        // Dispose of the widgets contained in the old layout root.
        each(widgets, function (widget) {
            widget.dispose();
        });
        // Dispose of the base class.
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(DockLayout.prototype, "spacing", {
        /**
         * Get the inter-element spacing for the dock layout.
         */
        get: function () {
            return this._spacing;
        },
        /**
         * Set the inter-element spacing for the dock layout.
         */
        set: function (value) {
            value = Utils$1.clampDimension(value);
            if (this._spacing === value) {
                return;
            }
            this._spacing = value;
            if (!this.parent) {
                return;
            }
            this.parent.fit();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockLayout.prototype, "isEmpty", {
        /**
         * Whether the dock layout is empty.
         */
        get: function () {
            return this._root === null;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over all widgets in the layout.
     *
     * @returns A new iterator over the widgets in the layout.
     *
     * #### Notes
     * This iterator includes the generated tab bars.
     */
    DockLayout.prototype.iter = function () {
        return this._root ? this._root.iterAllWidgets() : empty();
    };
    /**
     * Create an iterator over the user widgets in the layout.
     *
     * @returns A new iterator over the user widgets in the layout.
     *
     * #### Notes
     * This iterator does not include the generated tab bars.
     */
    DockLayout.prototype.widgets = function () {
        return this._root ? this._root.iterUserWidgets() : empty();
    };
    /**
     * Create an iterator over the selected widgets in the layout.
     *
     * @returns A new iterator over the selected user widgets.
     *
     * #### Notes
     * This iterator yields the widgets corresponding to the current tab
     * of each tab bar in the layout.
     */
    DockLayout.prototype.selectedWidgets = function () {
        return this._root ? this._root.iterSelectedWidgets() : empty();
    };
    /**
     * Create an iterator over the tab bars in the layout.
     *
     * @returns A new iterator over the tab bars in the layout.
     *
     * #### Notes
     * This iterator does not include the user widgets.
     */
    DockLayout.prototype.tabBars = function () {
        return this._root ? this._root.iterTabBars() : empty();
    };
    /**
     * Create an iterator over the handles in the layout.
     *
     * @returns A new iterator over the handles in the layout.
     */
    DockLayout.prototype.handles = function () {
        return this._root ? this._root.iterHandles() : empty();
    };
    /**
     * Move a handle to the given offset position.
     *
     * @param handle - The handle to move.
     *
     * @param offsetX - The desired offset X position of the handle.
     *
     * @param offsetY - The desired offset Y position of the handle.
     *
     * #### Notes
     * If the given handle is not contained in the layout, this is no-op.
     *
     * The handle will be moved as close as possible to the desired
     * position without violating any of the layout constraints.
     *
     * Only one of the coordinates is used depending on the orientation
     * of the handle. This method accepts both coordinates to make it
     * easy to invoke from a mouse move event without needing to know
     * the handle orientation.
     */
    DockLayout.prototype.moveHandle = function (handle, offsetX, offsetY) {
        // Bail early if there is no root or if the handle is hidden.
        var hidden = handle.classList.contains('lm-mod-hidden');
        /* <DEPRECATED> */
        hidden = hidden || handle.classList.contains('p-mod-hidden');
        /* </DEPRECATED> */
        if (!this._root || hidden) {
            return;
        }
        // Lookup the split node for the handle.
        var data = this._root.findSplitNode(handle);
        if (!data) {
            return;
        }
        // Compute the desired delta movement for the handle.
        var delta;
        if (data.node.orientation === 'horizontal') {
            delta = offsetX - handle.offsetLeft;
        }
        else {
            delta = offsetY - handle.offsetTop;
        }
        // Bail if there is no handle movement.
        if (delta === 0) {
            return;
        }
        // Prevent sibling resizing unless needed.
        data.node.holdSizes();
        // Adjust the sizers to reflect the handle movement.
        BoxEngine.adjust(data.node.sizers, data.index, delta);
        // Update the layout of the widgets.
        if (this.parent) {
            this.parent.update();
        }
    };
    /**
     * Save the current configuration of the dock layout.
     *
     * @returns A new config object for the current layout state.
     *
     * #### Notes
     * The return value can be provided to the `restoreLayout` method
     * in order to restore the layout to its current configuration.
     */
    DockLayout.prototype.saveLayout = function () {
        // Bail early if there is no root.
        if (!this._root) {
            return { main: null };
        }
        // Hold the current sizes in the layout tree.
        this._root.holdAllSizes();
        // Return the layout config.
        return { main: this._root.createConfig() };
    };
    /**
     * Restore the layout to a previously saved configuration.
     *
     * @param config - The layout configuration to restore.
     *
     * #### Notes
     * Widgets which currently belong to the layout but which are not
     * contained in the config will be unparented.
     */
    DockLayout.prototype.restoreLayout = function (config) {
        var _this = this;
        // Create the widget set for validating the config.
        var widgetSet = new Set();
        // Normalize the main area config and collect the widgets.
        var mainConfig;
        if (config.main) {
            mainConfig = Private$6.normalizeAreaConfig(config.main, widgetSet);
        }
        else {
            mainConfig = null;
        }
        // Create iterators over the old content.
        var oldWidgets = this.widgets();
        var oldTabBars = this.tabBars();
        var oldHandles = this.handles();
        // Clear the root before removing the old content.
        this._root = null;
        // Unparent the old widgets which are not in the new config.
        each(oldWidgets, function (widget) {
            if (!widgetSet.has(widget)) {
                widget.parent = null;
            }
        });
        // Dispose of the old tab bars.
        each(oldTabBars, function (tabBar) {
            tabBar.dispose();
        });
        // Remove the old handles.
        each(oldHandles, function (handle) {
            if (handle.parentNode) {
                handle.parentNode.removeChild(handle);
            }
        });
        // Reparent the new widgets to the current parent.
        widgetSet.forEach(function (widget) {
            widget.parent = _this.parent;
        });
        // Create the root node for the new config.
        if (mainConfig) {
            this._root = Private$6.realizeAreaConfig(mainConfig, {
                createTabBar: function () { return _this._createTabBar(); },
                createHandle: function () { return _this._createHandle(); }
            });
        }
        else {
            this._root = null;
        }
        // If there is no parent, there is nothing more to do.
        if (!this.parent) {
            return;
        }
        // Attach the new widgets to the parent.
        widgetSet.forEach(function (widget) {
            _this.attachWidget(widget);
        });
        // Post a fit request to the parent.
        this.parent.fit();
    };
    /**
     * Add a widget to the dock layout.
     *
     * @param widget - The widget to add to the dock layout.
     *
     * @param options - The additional options for adding the widget.
     *
     * #### Notes
     * The widget will be moved if it is already contained in the layout.
     *
     * An error will be thrown if the reference widget is invalid.
     */
    DockLayout.prototype.addWidget = function (widget, options) {
        if (options === void 0) { options = {}; }
        // Parse the options.
        var ref = options.ref || null;
        var mode = options.mode || 'tab-after';
        // Find the tab node which holds the reference widget.
        var refNode = null;
        if (this._root && ref) {
            refNode = this._root.findTabNode(ref);
        }
        // Throw an error if the reference widget is invalid.
        if (ref && !refNode) {
            throw new Error('Reference widget is not in the layout.');
        }
        // Reparent the widget to the current layout parent.
        widget.parent = this.parent;
        // Insert the widget according to the insert mode.
        switch (mode) {
            case 'tab-after':
                this._insertTab(widget, ref, refNode, true);
                break;
            case 'tab-before':
                this._insertTab(widget, ref, refNode, false);
                break;
            case 'split-top':
                this._insertSplit(widget, ref, refNode, 'vertical', false);
                break;
            case 'split-left':
                this._insertSplit(widget, ref, refNode, 'horizontal', false);
                break;
            case 'split-right':
                this._insertSplit(widget, ref, refNode, 'horizontal', true);
                break;
            case 'split-bottom':
                this._insertSplit(widget, ref, refNode, 'vertical', true);
                break;
        }
        // Do nothing else if there is no parent widget.
        if (!this.parent) {
            return;
        }
        // Ensure the widget is attached to the parent widget.
        this.attachWidget(widget);
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Remove a widget from the layout.
     *
     * @param widget - The widget to remove from the layout.
     *
     * #### Notes
     * A widget is automatically removed from the layout when its `parent`
     * is set to `null`. This method should only be invoked directly when
     * removing a widget from a layout which has yet to be installed on a
     * parent widget.
     *
     * This method does *not* modify the widget's `parent`.
     */
    DockLayout.prototype.removeWidget = function (widget) {
        // Remove the widget from its current layout location.
        this._removeWidget(widget);
        // Do nothing else if there is no parent widget.
        if (!this.parent) {
            return;
        }
        // Detach the widget from the parent widget.
        this.detachWidget(widget);
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Find the tab area which contains the given client position.
     *
     * @param clientX - The client X position of interest.
     *
     * @param clientY - The client Y position of interest.
     *
     * @returns The geometry of the tab area at the given position, or
     *   `null` if there is no tab area at the given position.
     */
    DockLayout.prototype.hitTestTabAreas = function (clientX, clientY) {
        // Bail early if hit testing cannot produce valid results.
        if (!this._root || !this.parent || !this.parent.isVisible) {
            return null;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Convert from client to local coordinates.
        var rect = this.parent.node.getBoundingClientRect();
        var x = clientX - rect.left - this._box.borderLeft;
        var y = clientY - rect.top - this._box.borderTop;
        // Find the tab layout node at the local position.
        var tabNode = this._root.hitTestTabNodes(x, y);
        // Bail if a tab layout node was not found.
        if (!tabNode) {
            return null;
        }
        // Extract the data from the tab node.
        var tabBar = tabNode.tabBar, top = tabNode.top, left = tabNode.left, width = tabNode.width, height = tabNode.height;
        // Compute the right and bottom edges of the tab area.
        var borderWidth = this._box.borderLeft + this._box.borderRight;
        var borderHeight = this._box.borderTop + this._box.borderBottom;
        var right = rect.width - borderWidth - (left + width);
        var bottom = rect.height - borderHeight - (top + height);
        // Return the hit test results.
        return { tabBar: tabBar, x: x, y: y, top: top, left: left, right: right, bottom: bottom, width: width, height: height };
    };
    /**
     * Perform layout initialization which requires the parent widget.
     */
    DockLayout.prototype.init = function () {
        var _this = this;
        // Perform superclass initialization.
        _super.prototype.init.call(this);
        // Attach each widget to the parent.
        each(this, function (widget) {
            _this.attachWidget(widget);
        });
        // Attach each handle to the parent.
        each(this.handles(), function (handle) {
            _this.parent.node.appendChild(handle);
        });
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Attach the widget to the layout parent widget.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This is a no-op if the widget is already attached.
     */
    DockLayout.prototype.attachWidget = function (widget) {
        // Do nothing if the widget is already attached.
        if (this.parent.node === widget.node.parentNode) {
            return;
        }
        // Create the layout item for the widget.
        this._items.set(widget, new index_es6_LayoutItem(widget));
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget's node to the parent.
        this.parent.node.appendChild(widget.node);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
    };
    /**
     * Detach the widget from the layout parent widget.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This is a no-op if the widget is not attached.
     */
    DockLayout.prototype.detachWidget = function (widget) {
        // Do nothing if the widget is not attached.
        if (this.parent.node !== widget.node.parentNode) {
            return;
        }
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Delete the layout item for the widget.
        var item = this._items.get(widget);
        if (item) {
            this._items.delete(widget);
            item.dispose();
        }
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     */
    DockLayout.prototype.onBeforeShow = function (msg) {
        _super.prototype.onBeforeShow.call(this, msg);
        this.parent.update();
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    DockLayout.prototype.onBeforeAttach = function (msg) {
        _super.prototype.onBeforeAttach.call(this, msg);
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-shown'` message.
     */
    DockLayout.prototype.onChildShown = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     */
    DockLayout.prototype.onChildHidden = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'resize'` message.
     */
    DockLayout.prototype.onResize = function (msg) {
        if (this.parent.isVisible) {
            this._update(msg.width, msg.height);
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    DockLayout.prototype.onUpdateRequest = function (msg) {
        if (this.parent.isVisible) {
            this._update(-1, -1);
        }
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     */
    DockLayout.prototype.onFitRequest = function (msg) {
        if (this.parent.isAttached) {
            this._fit();
        }
    };
    /**
     * Remove the specified widget from the layout structure.
     *
     * #### Notes
     * This is a no-op if the widget is not in the layout tree.
     *
     * This does not detach the widget from the parent node.
     */
    DockLayout.prototype._removeWidget = function (widget) {
        // Bail early if there is no layout root.
        if (!this._root) {
            return;
        }
        // Find the tab node which contains the given widget.
        var tabNode = this._root.findTabNode(widget);
        // Bail early if the tab node is not found.
        if (!tabNode) {
            return;
        }
        Private$6.removeAria(widget);
        // If there are multiple tabs, just remove the widget's tab.
        if (tabNode.tabBar.titles.length > 1) {
            tabNode.tabBar.removeTab(widget.title);
            return;
        }
        // Otherwise, the tab node needs to be removed...
        // Dispose the tab bar.
        tabNode.tabBar.dispose();
        // Handle the case where the tab node is the root.
        if (this._root === tabNode) {
            this._root = null;
            return;
        }
        // Otherwise, remove the tab node from its parent...
        // Prevent widget resizing unless needed.
        this._root.holdAllSizes();
        // Clear the parent reference on the tab node.
        var splitNode = tabNode.parent;
        tabNode.parent = null;
        // Remove the tab node from its parent split node.
        var i = ArrayExt.removeFirstOf(splitNode.children, tabNode);
        var handle = ArrayExt.removeAt(splitNode.handles, i);
        ArrayExt.removeAt(splitNode.sizers, i);
        // Remove the handle from its parent DOM node.
        if (handle.parentNode) {
            handle.parentNode.removeChild(handle);
        }
        // If there are multiple children, just update the handles.
        if (splitNode.children.length > 1) {
            splitNode.syncHandles();
            return;
        }
        // Otherwise, the split node also needs to be removed...
        // Clear the parent reference on the split node.
        var maybeParent = splitNode.parent;
        splitNode.parent = null;
        // Lookup the remaining child node and handle.
        var childNode = splitNode.children[0];
        var childHandle = splitNode.handles[0];
        // Clear the split node data.
        splitNode.children.length = 0;
        splitNode.handles.length = 0;
        splitNode.sizers.length = 0;
        // Remove the child handle from its parent node.
        if (childHandle.parentNode) {
            childHandle.parentNode.removeChild(childHandle);
        }
        // Handle the case where the split node is the root.
        if (this._root === splitNode) {
            childNode.parent = null;
            this._root = childNode;
            return;
        }
        // Otherwise, move the child node to the parent node...
        var parentNode = maybeParent;
        // Lookup the index of the split node.
        var j = parentNode.children.indexOf(splitNode);
        // Handle the case where the child node is a tab node.
        if (childNode instanceof Private$6.TabLayoutNode) {
            childNode.parent = parentNode;
            parentNode.children[j] = childNode;
            return;
        }
        // Remove the split data from the parent.
        var splitHandle = ArrayExt.removeAt(parentNode.handles, j);
        ArrayExt.removeAt(parentNode.children, j);
        ArrayExt.removeAt(parentNode.sizers, j);
        // Remove the handle from its parent node.
        if (splitHandle.parentNode) {
            splitHandle.parentNode.removeChild(splitHandle);
        }
        // The child node and the split parent node will have the same
        // orientation. Merge the grand-children with the parent node.
        for (var i_1 = 0, n = childNode.children.length; i_1 < n; ++i_1) {
            var gChild = childNode.children[i_1];
            var gHandle = childNode.handles[i_1];
            var gSizer = childNode.sizers[i_1];
            ArrayExt.insert(parentNode.children, j + i_1, gChild);
            ArrayExt.insert(parentNode.handles, j + i_1, gHandle);
            ArrayExt.insert(parentNode.sizers, j + i_1, gSizer);
            gChild.parent = parentNode;
        }
        // Clear the child node.
        childNode.children.length = 0;
        childNode.handles.length = 0;
        childNode.sizers.length = 0;
        childNode.parent = null;
        // Sync the handles on the parent node.
        parentNode.syncHandles();
    };
    /**
     * Insert a widget next to an existing tab.
     *
     * #### Notes
     * This does not attach the widget to the parent widget.
     */
    DockLayout.prototype._insertTab = function (widget, ref, refNode, after) {
        // Do nothing if the tab is inserted next to itself.
        if (widget === ref) {
            return;
        }
        // Create the root if it does not exist.
        if (!this._root) {
            var tabNode = new Private$6.TabLayoutNode(this._createTabBar());
            tabNode.tabBar.addTab(widget.title);
            this._root = tabNode;
            Private$6.addAria(widget, tabNode.tabBar);
            return;
        }
        // Use the first tab node as the ref node if needed.
        if (!refNode) {
            refNode = this._root.findFirstTabNode();
        }
        // If the widget is not contained in the ref node, ensure it is
        // removed from the layout and hidden before being added again.
        if (refNode.tabBar.titles.indexOf(widget.title) === -1) {
            this._removeWidget(widget);
            widget.hide();
        }
        // Lookup the target index for inserting the tab.
        var index;
        if (ref) {
            index = refNode.tabBar.titles.indexOf(ref.title);
        }
        else {
            index = refNode.tabBar.currentIndex;
        }
        // Insert the widget's tab relative to the target index.
        refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);
        Private$6.addAria(widget, refNode.tabBar);
    };
    /**
     * Insert a widget as a new split area.
     *
     * #### Notes
     * This does not attach the widget to the parent widget.
     */
    DockLayout.prototype._insertSplit = function (widget, ref, refNode, orientation, after) {
        // Do nothing if there is no effective split.
        if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {
            return;
        }
        // Ensure the widget is removed from the current layout.
        this._removeWidget(widget);
        // Create the tab layout node to hold the widget.
        var tabNode = new Private$6.TabLayoutNode(this._createTabBar());
        tabNode.tabBar.addTab(widget.title);
        Private$6.addAria(widget, tabNode.tabBar);
        // Set the root if it does not exist.
        if (!this._root) {
            this._root = tabNode;
            return;
        }
        // If the ref node parent is null, split the root.
        if (!refNode || !refNode.parent) {
            // Ensure the root is split with the correct orientation.
            var root = this._splitRoot(orientation);
            // Determine the insert index for the new tab node.
            var i_2 = after ? root.children.length : 0;
            // Normalize the split node.
            root.normalizeSizes();
            // Create the sizer for new tab node.
            var sizer = Private$6.createSizer(refNode ? 1 : Private$6.GOLDEN_RATIO);
            // Insert the tab node sized to the golden ratio.
            ArrayExt.insert(root.children, i_2, tabNode);
            ArrayExt.insert(root.sizers, i_2, sizer);
            ArrayExt.insert(root.handles, i_2, this._createHandle());
            tabNode.parent = root;
            // Re-normalize the split node to maintain the ratios.
            root.normalizeSizes();
            // Finally, synchronize the visibility of the handles.
            root.syncHandles();
            return;
        }
        // Lookup the split node for the ref widget.
        var splitNode = refNode.parent;
        // If the split node already had the correct orientation,
        // the widget can be inserted into the split node directly.
        if (splitNode.orientation === orientation) {
            // Find the index of the ref node.
            var i_3 = splitNode.children.indexOf(refNode);
            // Normalize the split node.
            splitNode.normalizeSizes();
            // Consume half the space for the insert location.
            var s = (splitNode.sizers[i_3].sizeHint /= 2);
            // Insert the tab node sized to the other half.
            var j_1 = i_3 + (after ? 1 : 0);
            ArrayExt.insert(splitNode.children, j_1, tabNode);
            ArrayExt.insert(splitNode.sizers, j_1, Private$6.createSizer(s));
            ArrayExt.insert(splitNode.handles, j_1, this._createHandle());
            tabNode.parent = splitNode;
            // Finally, synchronize the visibility of the handles.
            splitNode.syncHandles();
            return;
        }
        // Remove the ref node from the split node.
        var i = ArrayExt.removeFirstOf(splitNode.children, refNode);
        // Create a new normalized split node for the children.
        var childNode = new Private$6.SplitLayoutNode(orientation);
        childNode.normalized = true;
        // Add the ref node sized to half the space.
        childNode.children.push(refNode);
        childNode.sizers.push(Private$6.createSizer(0.5));
        childNode.handles.push(this._createHandle());
        refNode.parent = childNode;
        // Add the tab node sized to the other half.
        var j = after ? 1 : 0;
        ArrayExt.insert(childNode.children, j, tabNode);
        ArrayExt.insert(childNode.sizers, j, Private$6.createSizer(0.5));
        ArrayExt.insert(childNode.handles, j, this._createHandle());
        tabNode.parent = childNode;
        // Synchronize the visibility of the handles.
        childNode.syncHandles();
        // Finally, add the new child node to the original split node.
        ArrayExt.insert(splitNode.children, i, childNode);
        childNode.parent = splitNode;
    };
    /**
     * Ensure the root is a split node with the given orientation.
     */
    DockLayout.prototype._splitRoot = function (orientation) {
        // Bail early if the root already meets the requirements.
        var oldRoot = this._root;
        if (oldRoot instanceof Private$6.SplitLayoutNode) {
            if (oldRoot.orientation === orientation) {
                return oldRoot;
            }
        }
        // Create a new root node with the specified orientation.
        var newRoot = (this._root = new Private$6.SplitLayoutNode(orientation));
        // Add the old root to the new root.
        if (oldRoot) {
            newRoot.children.push(oldRoot);
            newRoot.sizers.push(Private$6.createSizer(0));
            newRoot.handles.push(this._createHandle());
            oldRoot.parent = newRoot;
        }
        // Return the new root as a convenience.
        return newRoot;
    };
    /**
     * Fit the layout to the total size required by the widgets.
     */
    DockLayout.prototype._fit = function () {
        // Set up the computed minimum size.
        var minW = 0;
        var minH = 0;
        // Update the size limits for the layout tree.
        if (this._root) {
            var limits = this._root.fit(this._spacing, this._items);
            minW = limits.minWidth;
            minH = limits.minHeight;
        }
        // Update the box sizing and add it to the computed min size.
        var box = (this._box = ElementExt.boxSizing(this.parent.node));
        minW += box.horizontalSum;
        minH += box.verticalSum;
        // Update the parent's min size constraints.
        var style = this.parent.node.style;
        style.minWidth = minW + "px";
        style.minHeight = minH + "px";
        // Set the dirty flag to ensure only a single update occurs.
        this._dirty = true;
        // Notify the ancestor that it should fit immediately. This may
        // cause a resize of the parent, fulfilling the required update.
        if (this.parent.parent) {
            index_es6_MessageLoop.sendMessage(this.parent.parent, index_es6_Widget.Msg.FitRequest);
        }
        // If the dirty flag is still set, the parent was not resized.
        // Trigger the required update on the parent widget immediately.
        if (this._dirty) {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
        }
    };
    /**
     * Update the layout position and size of the widgets.
     *
     * The parent offset dimensions should be `-1` if unknown.
     */
    DockLayout.prototype._update = function (offsetWidth, offsetHeight) {
        // Clear the dirty flag to indicate the update occurred.
        this._dirty = false;
        // Bail early if there is no root layout node.
        if (!this._root) {
            return;
        }
        // Measure the parent if the offset dimensions are unknown.
        if (offsetWidth < 0) {
            offsetWidth = this.parent.node.offsetWidth;
        }
        if (offsetHeight < 0) {
            offsetHeight = this.parent.node.offsetHeight;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Compute the actual layout bounds adjusted for border and padding.
        var x = this._box.paddingTop;
        var y = this._box.paddingLeft;
        var width = offsetWidth - this._box.horizontalSum;
        var height = offsetHeight - this._box.verticalSum;
        // Update the geometry of the layout tree.
        this._root.update(x, y, width, height, this._spacing, this._items);
    };
    /**
     * Create a new tab bar for use by the dock layout.
     *
     * #### Notes
     * The tab bar will be attached to the parent if it exists.
     */
    DockLayout.prototype._createTabBar = function () {
        // Create the tab bar using the renderer.
        var tabBar = this.renderer.createTabBar();
        // Enforce necessary tab bar behavior.
        tabBar.orientation = 'horizontal';
        // Reparent and attach the tab bar to the parent if possible.
        if (this.parent) {
            tabBar.parent = this.parent;
            this.attachWidget(tabBar);
        }
        // Return the initialized tab bar.
        return tabBar;
    };
    /**
     * Create a new handle for the dock layout.
     *
     * #### Notes
     * The handle will be attached to the parent if it exists.
     */
    DockLayout.prototype._createHandle = function () {
        // Create the handle using the renderer.
        var handle = this.renderer.createHandle();
        // Initialize the handle layout behavior.
        var style = handle.style;
        style.position = 'absolute';
        style.top = '0';
        style.left = '0';
        style.width = '0';
        style.height = '0';
        // Attach the handle to the parent if it exists.
        if (this.parent) {
            this.parent.node.appendChild(handle);
        }
        // Return the initialized handle.
        return handle;
    };
    return DockLayout;
}(index_es6_Layout));
/**
 * The namespace for the module implementation details.
 */
var Private$6;
(function (Private) {
    /**
     * A fraction used for sizing root panels; ~= `1 / golden_ratio`.
     */
    Private.GOLDEN_RATIO = 0.618;
    /**
     * Create a box sizer with an initial size hint.
     */
    function createSizer(hint) {
        var sizer = new BoxSizer();
        sizer.sizeHint = hint;
        sizer.size = hint;
        return sizer;
    }
    Private.createSizer = createSizer;
    /**
     * Normalize an area config object and collect the visited widgets.
     */
    function normalizeAreaConfig(config, widgetSet) {
        var result;
        if (config.type === 'tab-area') {
            result = normalizeTabAreaConfig(config, widgetSet);
        }
        else {
            result = normalizeSplitAreaConfig(config, widgetSet);
        }
        return result;
    }
    Private.normalizeAreaConfig = normalizeAreaConfig;
    /**
     * Convert a normalized area config into a layout tree.
     */
    function realizeAreaConfig(config, renderer) {
        var node;
        if (config.type === 'tab-area') {
            node = realizeTabAreaConfig(config, renderer);
        }
        else {
            node = realizeSplitAreaConfig(config, renderer);
        }
        return node;
    }
    Private.realizeAreaConfig = realizeAreaConfig;
    /**
     * A layout node which holds the data for a tabbed area.
     */
    var TabLayoutNode = /** @class */ (function () {
        /**
         * Construct a new tab layout node.
         *
         * @param tabBar - The tab bar to use for the layout node.
         */
        function TabLayoutNode(tabBar) {
            /**
             * The parent of the layout node.
             */
            this.parent = null;
            this._top = 0;
            this._left = 0;
            this._width = 0;
            this._height = 0;
            var tabSizer = new BoxSizer();
            var widgetSizer = new BoxSizer();
            tabSizer.stretch = 0;
            widgetSizer.stretch = 1;
            this.tabBar = tabBar;
            this.sizers = [tabSizer, widgetSizer];
        }
        Object.defineProperty(TabLayoutNode.prototype, "top", {
            /**
             * The most recent value for the `top` edge of the layout box.
             */
            get: function () {
                return this._top;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TabLayoutNode.prototype, "left", {
            /**
             * The most recent value for the `left` edge of the layout box.
             */
            get: function () {
                return this._left;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TabLayoutNode.prototype, "width", {
            /**
             * The most recent value for the `width` of the layout box.
             */
            get: function () {
                return this._width;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TabLayoutNode.prototype, "height", {
            /**
             * The most recent value for the `height` of the layout box.
             */
            get: function () {
                return this._height;
            },
            enumerable: true,
            configurable: true
        });
        /**
         * Create an iterator for all widgets in the layout tree.
         */
        TabLayoutNode.prototype.iterAllWidgets = function () {
            return chain(once(this.tabBar), this.iterUserWidgets());
        };
        /**
         * Create an iterator for the user widgets in the layout tree.
         */
        TabLayoutNode.prototype.iterUserWidgets = function () {
            return map(this.tabBar.titles, function (title) { return title.owner; });
        };
        /**
         * Create an iterator for the selected widgets in the layout tree.
         */
        TabLayoutNode.prototype.iterSelectedWidgets = function () {
            var title = this.tabBar.currentTitle;
            return title ? once(title.owner) : empty();
        };
        /**
         * Create an iterator for the tab bars in the layout tree.
         */
        TabLayoutNode.prototype.iterTabBars = function () {
            return once(this.tabBar);
        };
        /**
         * Create an iterator for the handles in the layout tree.
         */
        TabLayoutNode.prototype.iterHandles = function () {
            return empty();
        };
        /**
         * Find the tab layout node which contains the given widget.
         */
        TabLayoutNode.prototype.findTabNode = function (widget) {
            return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;
        };
        /**
         * Find the split layout node which contains the given handle.
         */
        TabLayoutNode.prototype.findSplitNode = function (handle) {
            return null;
        };
        /**
         * Find the first tab layout node in a layout tree.
         */
        TabLayoutNode.prototype.findFirstTabNode = function () {
            return this;
        };
        /**
         * Find the tab layout node which contains the local point.
         */
        TabLayoutNode.prototype.hitTestTabNodes = function (x, y) {
            if (x < this._left || x >= this._left + this._width) {
                return null;
            }
            if (y < this._top || y >= this._top + this._height) {
                return null;
            }
            return this;
        };
        /**
         * Create a configuration object for the layout tree.
         */
        TabLayoutNode.prototype.createConfig = function () {
            var widgets = this.tabBar.titles.map(function (title) { return title.owner; });
            var currentIndex = this.tabBar.currentIndex;
            return { type: 'tab-area', widgets: widgets, currentIndex: currentIndex };
        };
        /**
         * Recursively hold all of the sizes in the layout tree.
         *
         * This ignores the sizers of tab layout nodes.
         */
        TabLayoutNode.prototype.holdAllSizes = function () {
            return;
        };
        /**
         * Fit the layout tree.
         */
        TabLayoutNode.prototype.fit = function (spacing, items) {
            // Set up the limit variables.
            var minWidth = 0;
            var minHeight = 0;
            var maxWidth = Infinity;
            var maxHeight = Infinity;
            // Lookup the tab bar layout item.
            var tabBarItem = items.get(this.tabBar);
            // Lookup the widget layout item.
            var current = this.tabBar.currentTitle;
            var widgetItem = current ? items.get(current.owner) : undefined;
            // Lookup the tab bar and widget sizers.
            var _a = this.sizers, tabBarSizer = _a[0], widgetSizer = _a[1];
            // Update the tab bar limits.
            if (tabBarItem) {
                tabBarItem.fit();
            }
            // Update the widget limits.
            if (widgetItem) {
                widgetItem.fit();
            }
            // Update the results and sizer for the tab bar.
            if (tabBarItem && !tabBarItem.isHidden) {
                minWidth = Math.max(minWidth, tabBarItem.minWidth);
                minHeight += tabBarItem.minHeight;
                tabBarSizer.minSize = tabBarItem.minHeight;
                tabBarSizer.maxSize = tabBarItem.maxHeight;
            }
            else {
                tabBarSizer.minSize = 0;
                tabBarSizer.maxSize = 0;
            }
            // Update the results and sizer for the current widget.
            if (widgetItem && !widgetItem.isHidden) {
                minWidth = Math.max(minWidth, widgetItem.minWidth);
                minHeight += widgetItem.minHeight;
                widgetSizer.minSize = widgetItem.minHeight;
                widgetSizer.maxSize = Infinity;
            }
            else {
                widgetSizer.minSize = 0;
                widgetSizer.maxSize = Infinity;
            }
            // Return the computed size limits for the layout node.
            return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };
        };
        /**
         * Update the layout tree.
         */
        TabLayoutNode.prototype.update = function (left, top, width, height, spacing, items) {
            // Update the layout box values.
            this._top = top;
            this._left = left;
            this._width = width;
            this._height = height;
            // Lookup the tab bar layout item.
            var tabBarItem = items.get(this.tabBar);
            // Lookup the widget layout item.
            var current = this.tabBar.currentTitle;
            var widgetItem = current ? items.get(current.owner) : undefined;
            // Distribute the layout space to the sizers.
            BoxEngine.calc(this.sizers, height);
            // Update the tab bar item using the computed size.
            if (tabBarItem && !tabBarItem.isHidden) {
                var size = this.sizers[0].size;
                tabBarItem.update(left, top, width, size);
                top += size;
            }
            // Layout the widget using the computed size.
            if (widgetItem && !widgetItem.isHidden) {
                var size = this.sizers[1].size;
                widgetItem.update(left, top, width, size);
            }
        };
        return TabLayoutNode;
    }());
    Private.TabLayoutNode = TabLayoutNode;
    /**
     * A layout node which holds the data for a split area.
     */
    var SplitLayoutNode = /** @class */ (function () {
        /**
         * Construct a new split layout node.
         *
         * @param orientation - The orientation of the node.
         */
        function SplitLayoutNode(orientation) {
            /**
             * The parent of the layout node.
             */
            this.parent = null;
            /**
             * Whether the sizers have been normalized.
             */
            this.normalized = false;
            /**
             * The child nodes for the split node.
             */
            this.children = [];
            /**
             * The box sizers for the layout children.
             */
            this.sizers = [];
            /**
             * The handles for the layout children.
             */
            this.handles = [];
            this.orientation = orientation;
        }
        /**
         * Create an iterator for all widgets in the layout tree.
         */
        SplitLayoutNode.prototype.iterAllWidgets = function () {
            var children = map(this.children, function (child) { return child.iterAllWidgets(); });
            return new ChainIterator(children);
        };
        /**
         * Create an iterator for the user widgets in the layout tree.
         */
        SplitLayoutNode.prototype.iterUserWidgets = function () {
            var children = map(this.children, function (child) { return child.iterUserWidgets(); });
            return new ChainIterator(children);
        };
        /**
         * Create an iterator for the selected widgets in the layout tree.
         */
        SplitLayoutNode.prototype.iterSelectedWidgets = function () {
            var children = map(this.children, function (child) { return child.iterSelectedWidgets(); });
            return new ChainIterator(children);
        };
        /**
         * Create an iterator for the tab bars in the layout tree.
         */
        SplitLayoutNode.prototype.iterTabBars = function () {
            var children = map(this.children, function (child) { return child.iterTabBars(); });
            return new ChainIterator(children);
        };
        /**
         * Create an iterator for the handles in the layout tree.
         */
        SplitLayoutNode.prototype.iterHandles = function () {
            var children = map(this.children, function (child) { return child.iterHandles(); });
            return chain(this.handles, new ChainIterator(children));
        };
        /**
         * Find the tab layout node which contains the given widget.
         */
        SplitLayoutNode.prototype.findTabNode = function (widget) {
            for (var i = 0, n = this.children.length; i < n; ++i) {
                var result = this.children[i].findTabNode(widget);
                if (result) {
                    return result;
                }
            }
            return null;
        };
        /**
         * Find the split layout node which contains the given handle.
         */
        SplitLayoutNode.prototype.findSplitNode = function (handle) {
            var index = this.handles.indexOf(handle);
            if (index !== -1) {
                return { index: index, node: this };
            }
            for (var i = 0, n = this.children.length; i < n; ++i) {
                var result = this.children[i].findSplitNode(handle);
                if (result) {
                    return result;
                }
            }
            return null;
        };
        /**
         * Find the first tab layout node in a layout tree.
         */
        SplitLayoutNode.prototype.findFirstTabNode = function () {
            if (this.children.length === 0) {
                return null;
            }
            return this.children[0].findFirstTabNode();
        };
        /**
         * Find the tab layout node which contains the local point.
         */
        SplitLayoutNode.prototype.hitTestTabNodes = function (x, y) {
            for (var i = 0, n = this.children.length; i < n; ++i) {
                var result = this.children[i].hitTestTabNodes(x, y);
                if (result) {
                    return result;
                }
            }
            return null;
        };
        /**
         * Create a configuration object for the layout tree.
         */
        SplitLayoutNode.prototype.createConfig = function () {
            var orientation = this.orientation;
            var sizes = this.createNormalizedSizes();
            var children = this.children.map(function (child) { return child.createConfig(); });
            return { type: 'split-area', orientation: orientation, children: children, sizes: sizes };
        };
        /**
         * Sync the visibility and orientation of the handles.
         */
        SplitLayoutNode.prototype.syncHandles = function () {
            var _this = this;
            each(this.handles, function (handle, i) {
                handle.setAttribute('data-orientation', _this.orientation);
                if (i === _this.handles.length - 1) {
                    handle.classList.add('lm-mod-hidden');
                    /* <DEPRECATED> */
                    handle.classList.add('p-mod-hidden');
                    /* </DEPRECATED> */
                }
                else {
                    handle.classList.remove('lm-mod-hidden');
                    /* <DEPRECATED> */
                    handle.classList.remove('p-mod-hidden');
                    /* </DEPRECATED> */
                }
            });
        };
        /**
         * Hold the current sizes of the box sizers.
         *
         * This sets the size hint of each sizer to its current size.
         */
        SplitLayoutNode.prototype.holdSizes = function () {
            each(this.sizers, function (sizer) {
                sizer.sizeHint = sizer.size;
            });
        };
        /**
         * Recursively hold all of the sizes in the layout tree.
         *
         * This ignores the sizers of tab layout nodes.
         */
        SplitLayoutNode.prototype.holdAllSizes = function () {
            each(this.children, function (child) { return child.holdAllSizes(); });
            this.holdSizes();
        };
        /**
         * Normalize the sizes of the split layout node.
         */
        SplitLayoutNode.prototype.normalizeSizes = function () {
            // Bail early if the sizers are empty.
            var n = this.sizers.length;
            if (n === 0) {
                return;
            }
            // Hold the current sizes of the sizers.
            this.holdSizes();
            // Compute the sum of the sizes.
            var sum = reduce(this.sizers, function (v, sizer) { return v + sizer.sizeHint; }, 0);
            // Normalize the sizes based on the sum.
            if (sum === 0) {
                each(this.sizers, function (sizer) {
                    sizer.size = sizer.sizeHint = 1 / n;
                });
            }
            else {
                each(this.sizers, function (sizer) {
                    sizer.size = sizer.sizeHint /= sum;
                });
            }
            // Mark the sizes as normalized.
            this.normalized = true;
        };
        /**
         * Snap the normalized sizes of the split layout node.
         */
        SplitLayoutNode.prototype.createNormalizedSizes = function () {
            // Bail early if the sizers are empty.
            var n = this.sizers.length;
            if (n === 0) {
                return [];
            }
            // Grab the current sizes of the sizers.
            var sizes = this.sizers.map(function (sizer) { return sizer.size; });
            // Compute the sum of the sizes.
            var sum = reduce(sizes, function (v, size) { return v + size; }, 0);
            // Normalize the sizes based on the sum.
            if (sum === 0) {
                each(sizes, function (size, i) {
                    sizes[i] = 1 / n;
                });
            }
            else {
                each(sizes, function (size, i) {
                    sizes[i] = size / sum;
                });
            }
            // Return the normalized sizes.
            return sizes;
        };
        /**
         * Fit the layout tree.
         */
        SplitLayoutNode.prototype.fit = function (spacing, items) {
            // Compute the required fixed space.
            var horizontal = this.orientation === 'horizontal';
            var fixed = Math.max(0, this.children.length - 1) * spacing;
            // Set up the limit variables.
            var minWidth = horizontal ? fixed : 0;
            var minHeight = horizontal ? 0 : fixed;
            var maxWidth = Infinity;
            var maxHeight = Infinity;
            // Fit the children and update the limits.
            for (var i = 0, n = this.children.length; i < n; ++i) {
                var limits = this.children[i].fit(spacing, items);
                if (horizontal) {
                    minHeight = Math.max(minHeight, limits.minHeight);
                    minWidth += limits.minWidth;
                    this.sizers[i].minSize = limits.minWidth;
                }
                else {
                    minWidth = Math.max(minWidth, limits.minWidth);
                    minHeight += limits.minHeight;
                    this.sizers[i].minSize = limits.minHeight;
                }
            }
            // Return the computed limits for the layout node.
            return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };
        };
        /**
         * Update the layout tree.
         */
        SplitLayoutNode.prototype.update = function (left, top, width, height, spacing, items) {
            // Compute the available layout space.
            var horizontal = this.orientation === 'horizontal';
            var fixed = Math.max(0, this.children.length - 1) * spacing;
            var space = Math.max(0, (horizontal ? width : height) - fixed);
            // De-normalize the sizes if needed.
            if (this.normalized) {
                each(this.sizers, function (sizer) {
                    sizer.sizeHint *= space;
                });
                this.normalized = false;
            }
            // Distribute the layout space to the sizers.
            BoxEngine.calc(this.sizers, space);
            // Update the geometry of the child nodes and handles.
            for (var i = 0, n = this.children.length; i < n; ++i) {
                var child = this.children[i];
                var size = this.sizers[i].size;
                var handleStyle = this.handles[i].style;
                if (horizontal) {
                    child.update(left, top, size, height, spacing, items);
                    left += size;
                    handleStyle.top = top + "px";
                    handleStyle.left = left + "px";
                    handleStyle.width = spacing + "px";
                    handleStyle.height = height + "px";
                    left += spacing;
                }
                else {
                    child.update(left, top, width, size, spacing, items);
                    top += size;
                    handleStyle.top = top + "px";
                    handleStyle.left = left + "px";
                    handleStyle.width = width + "px";
                    handleStyle.height = spacing + "px";
                    top += spacing;
                }
            }
        };
        return SplitLayoutNode;
    }());
    Private.SplitLayoutNode = SplitLayoutNode;
    function addAria(widget, tabBar) {
        widget.node.setAttribute('role', 'tabpanel');
        var renderer = tabBar.renderer;
        if (renderer instanceof index_es6_TabBar.Renderer) {
            var tabId = renderer.createTabKey({
                title: widget.title,
                current: false,
                zIndex: 0
            });
            widget.node.setAttribute('aria-labelledby', tabId);
        }
    }
    Private.addAria = addAria;
    function removeAria(widget) {
        widget.node.removeAttribute('role');
        widget.node.removeAttribute('aria-labelledby');
    }
    Private.removeAria = removeAria;
    /**
     * Normalize a tab area config and collect the visited widgets.
     */
    function normalizeTabAreaConfig(config, widgetSet) {
        // Bail early if there is no content.
        if (config.widgets.length === 0) {
            return null;
        }
        // Setup the filtered widgets array.
        var widgets = [];
        // Filter the config for unique widgets.
        each(config.widgets, function (widget) {
            if (!widgetSet.has(widget)) {
                widgetSet.add(widget);
                widgets.push(widget);
            }
        });
        // Bail if there are no effective widgets.
        if (widgets.length === 0) {
            return null;
        }
        // Normalize the current index.
        var index = config.currentIndex;
        if (index !== -1 && (index < 0 || index >= widgets.length)) {
            index = 0;
        }
        // Return a normalized config object.
        return { type: 'tab-area', widgets: widgets, currentIndex: index };
    }
    /**
     * Normalize a split area config and collect the visited widgets.
     */
    function normalizeSplitAreaConfig(config, widgetSet) {
        // Set up the result variables.
        var orientation = config.orientation;
        var children = [];
        var sizes = [];
        // Normalize the config children.
        for (var i = 0, n = config.children.length; i < n; ++i) {
            // Normalize the child config.
            var child = normalizeAreaConfig(config.children[i], widgetSet);
            // Ignore an empty child.
            if (!child) {
                continue;
            }
            // Add the child or hoist its content as appropriate.
            if (child.type === 'tab-area' || child.orientation !== orientation) {
                children.push(child);
                sizes.push(Math.abs(config.sizes[i] || 0));
            }
            else {
                children.push.apply(children, child.children);
                sizes.push.apply(sizes, child.sizes);
            }
        }
        // Bail if there are no effective children.
        if (children.length === 0) {
            return null;
        }
        // If there is only one effective child, return that child.
        if (children.length === 1) {
            return children[0];
        }
        // Return a normalized config object.
        return { type: 'split-area', orientation: orientation, children: children, sizes: sizes };
    }
    /**
     * Convert a normalized tab area config into a layout tree.
     */
    function realizeTabAreaConfig(config, renderer) {
        // Create the tab bar for the layout node.
        var tabBar = renderer.createTabBar();
        // Hide each widget and add it to the tab bar.
        each(config.widgets, function (widget) {
            widget.hide();
            tabBar.addTab(widget.title);
            Private.addAria(widget, tabBar);
        });
        // Set the current index of the tab bar.
        tabBar.currentIndex = config.currentIndex;
        // Return the new tab layout node.
        return new TabLayoutNode(tabBar);
    }
    /**
     * Convert a normalized split area config into a layout tree.
     */
    function realizeSplitAreaConfig(config, renderer) {
        // Create the split layout node.
        var node = new SplitLayoutNode(config.orientation);
        // Add each child to the layout node.
        each(config.children, function (child, i) {
            // Create the child data for the layout node.
            var childNode = realizeAreaConfig(child, renderer);
            var sizer = createSizer(config.sizes[i]);
            var handle = renderer.createHandle();
            // Add the child data to the layout node.
            node.children.push(childNode);
            node.handles.push(handle);
            node.sizers.push(sizer);
            // Update the parent for the child node.
            childNode.parent = node;
        });
        // Synchronize the handle state for the layout node.
        node.syncHandles();
        // Normalize the sizes for the layout node.
        node.normalizeSizes();
        // Return the new layout node.
        return node;
    }
})(Private$6 || (Private$6 = {}));

/**
 * A widget which provides a flexible docking area for widgets.
 */
var index_es6_DockPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(DockPanel, _super);
    /**
     * Construct a new dock panel.
     *
     * @param options - The options for initializing the panel.
     */
    function DockPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this) || this;
        _this._drag = null;
        _this._tabsMovable = true;
        _this._tabsConstrained = false;
        _this._addButtonEnabled = false;
        _this._pressData = null;
        _this._layoutModified = new Signal(_this);
        _this._addRequested = new Signal(_this);
        _this.addClass('lm-DockPanel');
        /* <DEPRECATED> */
        _this.addClass('p-DockPanel');
        /* </DEPRECATED> */
        _this._mode = options.mode || 'multiple-document';
        _this._renderer = options.renderer || DockPanel.defaultRenderer;
        _this._edges = options.edges || Private$5.DEFAULT_EDGES;
        if (options.tabsMovable !== undefined) {
            _this._tabsMovable = options.tabsMovable;
        }
        if (options.tabsConstrained !== undefined) {
            _this._tabsConstrained = options.tabsConstrained;
        }
        if (options.addButtonEnabled !== undefined) {
            _this._addButtonEnabled = options.addButtonEnabled;
        }
        // Toggle the CSS mode attribute.
        _this.dataset['mode'] = _this._mode;
        // Create the delegate renderer for the layout.
        var renderer = {
            createTabBar: function () { return _this._createTabBar(); },
            createHandle: function () { return _this._createHandle(); }
        };
        // Set up the dock layout for the panel.
        _this.layout = new index_es6_DockLayout({ renderer: renderer, spacing: options.spacing });
        // Set up the overlay drop indicator.
        _this.overlay = options.overlay || new DockPanel.Overlay();
        _this.node.appendChild(_this.overlay.node);
        return _this;
    }
    /**
     * Dispose of the resources held by the panel.
     */
    DockPanel.prototype.dispose = function () {
        // Ensure the mouse is released.
        this._releaseMouse();
        // Hide the overlay.
        this.overlay.hide(0);
        // Cancel a drag if one is in progress.
        if (this._drag) {
            this._drag.dispose();
        }
        // Dispose of the base class.
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(DockPanel.prototype, "layoutModified", {
        /**
         * A signal emitted when the layout configuration is modified.
         *
         * #### Notes
         * This signal is emitted whenever the current layout configuration
         * may have changed.
         *
         * This signal is emitted asynchronously in a collapsed fashion, so
         * that multiple synchronous modifications results in only a single
         * emit of the signal.
         */
        get: function () {
            return this._layoutModified;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "addRequested", {
        /**
         * A signal emitted when the add button on a tab bar is clicked.
         *
         */
        get: function () {
            return this._addRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "renderer", {
        /**
         * The renderer used by the dock panel.
         */
        get: function () {
            return this.layout.renderer;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "spacing", {
        /**
         * Get the spacing between the widgets.
         */
        get: function () {
            return this.layout.spacing;
        },
        /**
         * Set the spacing between the widgets.
         */
        set: function (value) {
            this.layout.spacing = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "mode", {
        /**
         * Get the mode for the dock panel.
         */
        get: function () {
            return this._mode;
        },
        /**
         * Set the mode for the dock panel.
         *
         * #### Notes
         * Changing the mode is a destructive operation with respect to the
         * panel's layout configuration. If layout state must be preserved,
         * save the current layout config before changing the mode.
         */
        set: function (value) {
            // Bail early if the mode does not change.
            if (this._mode === value) {
                return;
            }
            // Update the internal mode.
            this._mode = value;
            // Toggle the CSS mode attribute.
            this.dataset['mode'] = value;
            // Get the layout for the panel.
            var layout = this.layout;
            // Configure the layout for the specified mode.
            switch (value) {
                case 'multiple-document':
                    each(layout.tabBars(), function (tabBar) {
                        tabBar.show();
                    });
                    break;
                case 'single-document':
                    layout.restoreLayout(Private$5.createSingleDocumentConfig(this));
                    break;
                default:
                    throw 'unreachable';
            }
            // Schedule an emit of the layout modified signal.
            index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "tabsMovable", {
        /**
         * Whether the tabs can be dragged / moved at runtime.
         */
        get: function () {
            return this._tabsMovable;
        },
        /**
         * Enable / Disable draggable / movable tabs.
         */
        set: function (value) {
            this._tabsMovable = value;
            each(this.tabBars(), function (tabbar) {
                tabbar.tabsMovable = value;
            });
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "tabsConstrained", {
        /**
         * Whether the tabs are constrained to their source dock panel
         */
        get: function () {
            return this._tabsConstrained;
        },
        /**
         * Constrain/Allow tabs to be dragged outside of this dock panel
         */
        set: function (value) {
            this._tabsConstrained = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "addButtonEnabled", {
        /**
         * Whether the add buttons for each tab bar are enabled.
         */
        get: function () {
            return this._addButtonEnabled;
        },
        /**
         * Set whether the add buttons for each tab bar are enabled.
         */
        set: function (value) {
            this._addButtonEnabled = value;
            each(this.tabBars(), function (tabbar) {
                tabbar.addButtonEnabled = value;
            });
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DockPanel.prototype, "isEmpty", {
        /**
         * Whether the dock panel is empty.
         */
        get: function () {
            return this.layout.isEmpty;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the user widgets in the panel.
     *
     * @returns A new iterator over the user widgets in the panel.
     *
     * #### Notes
     * This iterator does not include the generated tab bars.
     */
    DockPanel.prototype.widgets = function () {
        return this.layout.widgets();
    };
    /**
     * Create an iterator over the selected widgets in the panel.
     *
     * @returns A new iterator over the selected user widgets.
     *
     * #### Notes
     * This iterator yields the widgets corresponding to the current tab
     * of each tab bar in the panel.
     */
    DockPanel.prototype.selectedWidgets = function () {
        return this.layout.selectedWidgets();
    };
    /**
     * Create an iterator over the tab bars in the panel.
     *
     * @returns A new iterator over the tab bars in the panel.
     *
     * #### Notes
     * This iterator does not include the user widgets.
     */
    DockPanel.prototype.tabBars = function () {
        return this.layout.tabBars();
    };
    /**
     * Create an iterator over the handles in the panel.
     *
     * @returns A new iterator over the handles in the panel.
     */
    DockPanel.prototype.handles = function () {
        return this.layout.handles();
    };
    /**
     * Select a specific widget in the dock panel.
     *
     * @param widget - The widget of interest.
     *
     * #### Notes
     * This will make the widget the current widget in its tab area.
     */
    DockPanel.prototype.selectWidget = function (widget) {
        // Find the tab bar which contains the widget.
        var tabBar = find(this.tabBars(), function (bar) {
            return bar.titles.indexOf(widget.title) !== -1;
        });
        // Throw an error if no tab bar is found.
        if (!tabBar) {
            throw new Error('Widget is not contained in the dock panel.');
        }
        // Ensure the widget is the current widget.
        tabBar.currentTitle = widget.title;
    };
    /**
     * Activate a specified widget in the dock panel.
     *
     * @param widget - The widget of interest.
     *
     * #### Notes
     * This will select and activate the given widget.
     */
    DockPanel.prototype.activateWidget = function (widget) {
        this.selectWidget(widget);
        widget.activate();
    };
    /**
     * Save the current layout configuration of the dock panel.
     *
     * @returns A new config object for the current layout state.
     *
     * #### Notes
     * The return value can be provided to the `restoreLayout` method
     * in order to restore the layout to its current configuration.
     */
    DockPanel.prototype.saveLayout = function () {
        return this.layout.saveLayout();
    };
    /**
     * Restore the layout to a previously saved configuration.
     *
     * @param config - The layout configuration to restore.
     *
     * #### Notes
     * Widgets which currently belong to the layout but which are not
     * contained in the config will be unparented.
     *
     * The dock panel automatically reverts to `'multiple-document'`
     * mode when a layout config is restored.
     */
    DockPanel.prototype.restoreLayout = function (config) {
        // Reset the mode.
        this._mode = 'multiple-document';
        // Restore the layout.
        this.layout.restoreLayout(config);
        // Flush the message loop on IE and Edge to prevent flicker.
        if (Platform.IS_EDGE || Platform.IS_IE) {
            index_es6_MessageLoop.flush();
        }
        // Schedule an emit of the layout modified signal.
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Add a widget to the dock panel.
     *
     * @param widget - The widget to add to the dock panel.
     *
     * @param options - The additional options for adding the widget.
     *
     * #### Notes
     * If the panel is in single document mode, the options are ignored
     * and the widget is always added as tab in the hidden tab bar.
     */
    DockPanel.prototype.addWidget = function (widget, options) {
        if (options === void 0) { options = {}; }
        // Add the widget to the layout.
        if (this._mode === 'single-document') {
            this.layout.addWidget(widget);
        }
        else {
            this.layout.addWidget(widget, options);
        }
        // Schedule an emit of the layout modified signal.
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Process a message sent to the widget.
     *
     * @param msg - The message sent to the widget.
     */
    DockPanel.prototype.processMessage = function (msg) {
        if (msg.type === 'layout-modified') {
            this._layoutModified.emit(undefined);
        }
        else {
            _super.prototype.processMessage.call(this, msg);
        }
    };
    /**
     * Handle the DOM events for the dock panel.
     *
     * @param event - The DOM event sent to the panel.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the panel's DOM node. It should
     * not be called directly by user code.
     */
    DockPanel.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'lm-dragenter':
                this._evtDragEnter(event);
                break;
            case 'lm-dragleave':
                this._evtDragLeave(event);
                break;
            case 'lm-dragover':
                this._evtDragOver(event);
                break;
            case 'lm-drop':
                this._evtDrop(event);
                break;
            case 'mousedown': // <DEPRECATED>
                this._evtMouseDown(event);
                break;
            case 'mousemove': // <DEPRECATED>
                this._evtMouseMove(event);
                break;
            case 'mouseup': // <DEPRECATED>
                this._evtMouseUp(event);
                break;
            case 'pointerdown':
                this._evtMouseDown(event);
                break;
            case 'pointermove':
                this._evtMouseMove(event);
                break;
            case 'pointerup':
                this._evtMouseUp(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    DockPanel.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('lm-dragenter', this);
        this.node.addEventListener('lm-dragleave', this);
        this.node.addEventListener('lm-dragover', this);
        this.node.addEventListener('lm-drop', this);
        this.node.addEventListener('mousedown', this); // <DEPRECATED>
        this.node.addEventListener('pointerdown', this);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    DockPanel.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('lm-dragenter', this);
        this.node.removeEventListener('lm-dragleave', this);
        this.node.removeEventListener('lm-dragover', this);
        this.node.removeEventListener('lm-drop', this);
        this.node.removeEventListener('mousedown', this); // <DEPRECATED>
        this.node.removeEventListener('pointerdown', this);
        this._releaseMouse();
    };
    /**
     * A message handler invoked on a `'child-added'` message.
     */
    DockPanel.prototype.onChildAdded = function (msg) {
        // Ignore the generated tab bars.
        if (Private$5.isGeneratedTabBarProperty.get(msg.child)) {
            return;
        }
        // Add the widget class to the child.
        msg.child.addClass('lm-DockPanel-widget');
        /* <DEPRECATED> */
        msg.child.addClass('p-DockPanel-widget');
        /* </DEPRECATED> */
    };
    /**
     * A message handler invoked on a `'child-removed'` message.
     */
    DockPanel.prototype.onChildRemoved = function (msg) {
        // Ignore the generated tab bars.
        if (Private$5.isGeneratedTabBarProperty.get(msg.child)) {
            return;
        }
        // Remove the widget class from the child.
        msg.child.removeClass('lm-DockPanel-widget');
        /* <DEPRECATED> */
        msg.child.removeClass('p-DockPanel-widget');
        /* </DEPRECATED> */
        // Schedule an emit of the layout modified signal.
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Handle the `'lm-dragenter'` event for the dock panel.
     */
    DockPanel.prototype._evtDragEnter = function (event) {
        // If the factory mime type is present, mark the event as
        // handled in order to get the rest of the drag events.
        if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {
            event.preventDefault();
            event.stopPropagation();
        }
    };
    /**
     * Handle the `'lm-dragleave'` event for the dock panel.
     */
    DockPanel.prototype._evtDragLeave = function (event) {
        // Mark the event as handled.
        event.preventDefault();
        event.stopPropagation();
        // The new target might be a descendant, so we might still handle the drop.
        // Hide asynchronously so that if a lm-dragover event bubbles up to us, the
        // hide is cancelled by the lm-dragover handler's show overlay logic.
        this.overlay.hide(1);
    };
    /**
     * Handle the `'lm-dragover'` event for the dock panel.
     */
    DockPanel.prototype._evtDragOver = function (event) {
        // Mark the event as handled.
        event.preventDefault();
        event.stopPropagation();
        // Show the drop indicator overlay and update the drop
        // action based on the drop target zone under the mouse.
        if ((this._tabsConstrained && event.source !== this) ||
            this._showOverlay(event.clientX, event.clientY) === 'invalid') {
            event.dropAction = 'none';
        }
        else {
            event.dropAction = event.proposedAction;
        }
    };
    /**
     * Handle the `'lm-drop'` event for the dock panel.
     */
    DockPanel.prototype._evtDrop = function (event) {
        // Mark the event as handled.
        event.preventDefault();
        event.stopPropagation();
        // Hide the drop indicator overlay.
        this.overlay.hide(0);
        // Bail if the proposed action is to do nothing.
        if (event.proposedAction === 'none') {
            event.dropAction = 'none';
            return;
        }
        // Find the drop target under the mouse.
        var clientX = event.clientX, clientY = event.clientY;
        var _a = Private$5.findDropTarget(this, clientX, clientY, this._edges), zone = _a.zone, target = _a.target;
        // Bail if the drop zone is invalid.
        if (zone === 'invalid') {
            event.dropAction = 'none';
            return;
        }
        // Bail if the factory mime type has invalid data.
        var mimeData = event.mimeData;
        var factory = mimeData.getData('application/vnd.lumino.widget-factory');
        if (typeof factory !== 'function') {
            event.dropAction = 'none';
            return;
        }
        // Bail if the factory does not produce a widget.
        var widget = factory();
        if (!(widget instanceof index_es6_Widget)) {
            event.dropAction = 'none';
            return;
        }
        // Bail if the widget is an ancestor of the dock panel.
        if (widget.contains(this)) {
            event.dropAction = 'none';
            return;
        }
        // Find the reference widget for the drop target.
        var ref = target ? Private$5.getDropRef(target.tabBar) : null;
        // Add the widget according to the indicated drop zone.
        switch (zone) {
            case 'root-all':
                this.addWidget(widget);
                break;
            case 'root-top':
                this.addWidget(widget, { mode: 'split-top' });
                break;
            case 'root-left':
                this.addWidget(widget, { mode: 'split-left' });
                break;
            case 'root-right':
                this.addWidget(widget, { mode: 'split-right' });
                break;
            case 'root-bottom':
                this.addWidget(widget, { mode: 'split-bottom' });
                break;
            case 'widget-all':
                this.addWidget(widget, { mode: 'tab-after', ref: ref });
                break;
            case 'widget-top':
                this.addWidget(widget, { mode: 'split-top', ref: ref });
                break;
            case 'widget-left':
                this.addWidget(widget, { mode: 'split-left', ref: ref });
                break;
            case 'widget-right':
                this.addWidget(widget, { mode: 'split-right', ref: ref });
                break;
            case 'widget-bottom':
                this.addWidget(widget, { mode: 'split-bottom', ref: ref });
                break;
            case 'widget-tab':
                this.addWidget(widget, { mode: 'tab-after', ref: ref });
                break;
            default:
                throw 'unreachable';
        }
        // Accept the proposed drop action.
        event.dropAction = event.proposedAction;
        // Activate the dropped widget.
        this.activateWidget(widget);
    };
    /**
     * Handle the `'keydown'` event for the dock panel.
     */
    DockPanel.prototype._evtKeyDown = function (event) {
        // Stop input events during drag.
        event.preventDefault();
        event.stopPropagation();
        // Release the mouse if `Escape` is pressed.
        if (event.keyCode === 27) {
            // Finalize the mouse release.
            this._releaseMouse();
            // Schedule an emit of the layout modified signal.
            index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
        }
    };
    /**
     * Handle the `'mousedown'` event for the dock panel.
     */
    DockPanel.prototype._evtMouseDown = function (event) {
        // Do nothing if the left mouse button is not pressed.
        if (event.button !== 0) {
            return;
        }
        // Find the handle which contains the mouse target, if any.
        var layout = this.layout;
        var target = event.target;
        var handle = find(layout.handles(), function (handle) { return handle.contains(target); });
        if (!handle) {
            return;
        }
        // Stop the event when a handle is pressed.
        event.preventDefault();
        event.stopPropagation();
        // Add the extra document listeners.
        document.addEventListener('keydown', this, true);
        document.addEventListener('mouseup', this, true); // <DEPRECATED>
        document.addEventListener('mousemove', this, true); // <DEPRECATED>
        document.addEventListener('pointerup', this, true);
        document.addEventListener('pointermove', this, true);
        document.addEventListener('contextmenu', this, true);
        // Compute the offset deltas for the handle press.
        var rect = handle.getBoundingClientRect();
        var deltaX = event.clientX - rect.left;
        var deltaY = event.clientY - rect.top;
        // Override the cursor and store the press data.
        var style = window.getComputedStyle(handle);
        var override = index_es6_Drag.overrideCursor(style.cursor);
        this._pressData = { handle: handle, deltaX: deltaX, deltaY: deltaY, override: override };
    };
    /**
     * Handle the `'mousemove'` event for the dock panel.
     */
    DockPanel.prototype._evtMouseMove = function (event) {
        // Bail early if no drag is in progress.
        if (!this._pressData) {
            return;
        }
        // Stop the event when dragging a handle.
        event.preventDefault();
        event.stopPropagation();
        // Compute the desired offset position for the handle.
        var rect = this.node.getBoundingClientRect();
        var xPos = event.clientX - rect.left - this._pressData.deltaX;
        var yPos = event.clientY - rect.top - this._pressData.deltaY;
        // Set the handle as close to the desired position as possible.
        var layout = this.layout;
        layout.moveHandle(this._pressData.handle, xPos, yPos);
    };
    /**
     * Handle the `'mouseup'` event for the dock panel.
     */
    DockPanel.prototype._evtMouseUp = function (event) {
        // Do nothing if the left mouse button is not released.
        if (event.button !== 0) {
            return;
        }
        // Stop the event when releasing a handle.
        event.preventDefault();
        event.stopPropagation();
        // Finalize the mouse release.
        this._releaseMouse();
        // Schedule an emit of the layout modified signal.
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Release the mouse grab for the dock panel.
     */
    DockPanel.prototype._releaseMouse = function () {
        // Bail early if no drag is in progress.
        if (!this._pressData) {
            return;
        }
        // Clear the override cursor.
        this._pressData.override.dispose();
        this._pressData = null;
        // Remove the extra document listeners.
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('mouseup', this, true); // <DEPRECATED>
        document.removeEventListener('mousemove', this, true); // <DEPRECATED>
        document.removeEventListener('pointerup', this, true);
        document.removeEventListener('pointermove', this, true);
        document.removeEventListener('contextmenu', this, true);
    };
    /**
     * Show the overlay indicator at the given client position.
     *
     * Returns the drop zone at the specified client position.
     *
     * #### Notes
     * If the position is not over a valid zone, the overlay is hidden.
     */
    DockPanel.prototype._showOverlay = function (clientX, clientY) {
        // Find the dock target for the given client position.
        var _a = Private$5.findDropTarget(this, clientX, clientY, this._edges), zone = _a.zone, target = _a.target;
        // If the drop zone is invalid, hide the overlay and bail.
        if (zone === 'invalid') {
            this.overlay.hide(100);
            return zone;
        }
        // Setup the variables needed to compute the overlay geometry.
        var top;
        var left;
        var right;
        var bottom;
        var box = ElementExt.boxSizing(this.node); // TODO cache this?
        var rect = this.node.getBoundingClientRect();
        // Compute the overlay geometry based on the dock zone.
        switch (zone) {
            case 'root-all':
                top = box.paddingTop;
                left = box.paddingLeft;
                right = box.paddingRight;
                bottom = box.paddingBottom;
                break;
            case 'root-top':
                top = box.paddingTop;
                left = box.paddingLeft;
                right = box.paddingRight;
                bottom = rect.height * Private$5.GOLDEN_RATIO;
                break;
            case 'root-left':
                top = box.paddingTop;
                left = box.paddingLeft;
                right = rect.width * Private$5.GOLDEN_RATIO;
                bottom = box.paddingBottom;
                break;
            case 'root-right':
                top = box.paddingTop;
                left = rect.width * Private$5.GOLDEN_RATIO;
                right = box.paddingRight;
                bottom = box.paddingBottom;
                break;
            case 'root-bottom':
                top = rect.height * Private$5.GOLDEN_RATIO;
                left = box.paddingLeft;
                right = box.paddingRight;
                bottom = box.paddingBottom;
                break;
            case 'widget-all':
                top = target.top;
                left = target.left;
                right = target.right;
                bottom = target.bottom;
                break;
            case 'widget-top':
                top = target.top;
                left = target.left;
                right = target.right;
                bottom = target.bottom + target.height / 2;
                break;
            case 'widget-left':
                top = target.top;
                left = target.left;
                right = target.right + target.width / 2;
                bottom = target.bottom;
                break;
            case 'widget-right':
                top = target.top;
                left = target.left + target.width / 2;
                right = target.right;
                bottom = target.bottom;
                break;
            case 'widget-bottom':
                top = target.top + target.height / 2;
                left = target.left;
                right = target.right;
                bottom = target.bottom;
                break;
            case 'widget-tab':
                var tabHeight = target.tabBar.node.getBoundingClientRect().height;
                top = target.top;
                left = target.left;
                right = target.right;
                bottom = target.bottom + target.height - tabHeight;
                break;
            default:
                throw 'unreachable';
        }
        // Show the overlay with the computed geometry.
        this.overlay.show({ top: top, left: left, right: right, bottom: bottom });
        // Finally, return the computed drop zone.
        return zone;
    };
    /**
     * Create a new tab bar for use by the panel.
     */
    DockPanel.prototype._createTabBar = function () {
        // Create the tab bar.
        var tabBar = this._renderer.createTabBar();
        // Set the generated tab bar property for the tab bar.
        Private$5.isGeneratedTabBarProperty.set(tabBar, true);
        // Hide the tab bar when in single document mode.
        if (this._mode === 'single-document') {
            tabBar.hide();
        }
        // Enforce necessary tab bar behavior.
        // TODO do we really want to enforce *all* of these?
        tabBar.tabsMovable = this._tabsMovable;
        tabBar.allowDeselect = false;
        tabBar.addButtonEnabled = this._addButtonEnabled;
        tabBar.removeBehavior = 'select-previous-tab';
        tabBar.insertBehavior = 'select-tab-if-needed';
        // Connect the signal handlers for the tab bar.
        tabBar.tabMoved.connect(this._onTabMoved, this);
        tabBar.currentChanged.connect(this._onCurrentChanged, this);
        tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);
        tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);
        tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);
        tabBar.addRequested.connect(this._onTabAddRequested, this);
        // Return the initialized tab bar.
        return tabBar;
    };
    /**
     * Create a new handle for use by the panel.
     */
    DockPanel.prototype._createHandle = function () {
        return this._renderer.createHandle();
    };
    /**
     * Handle the `tabMoved` signal from a tab bar.
     */
    DockPanel.prototype._onTabMoved = function () {
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Handle the `currentChanged` signal from a tab bar.
     */
    DockPanel.prototype._onCurrentChanged = function (sender, args) {
        // Extract the previous and current title from the args.
        var previousTitle = args.previousTitle, currentTitle = args.currentTitle;
        // Hide the previous widget.
        if (previousTitle) {
            previousTitle.owner.hide();
        }
        // Show the current widget.
        if (currentTitle) {
            currentTitle.owner.show();
        }
        // Flush the message loop on IE and Edge to prevent flicker.
        if (Platform.IS_EDGE || Platform.IS_IE) {
            index_es6_MessageLoop.flush();
        }
        // Schedule an emit of the layout modified signal.
        index_es6_MessageLoop.postMessage(this, Private$5.LayoutModified);
    };
    /**
     * Handle the `addRequested` signal from a tab bar.
     */
    DockPanel.prototype._onTabAddRequested = function (sender) {
        this._addRequested.emit(sender);
    };
    /**
     * Handle the `tabActivateRequested` signal from a tab bar.
     */
    DockPanel.prototype._onTabActivateRequested = function (sender, args) {
        args.title.owner.activate();
    };
    /**
     * Handle the `tabCloseRequested` signal from a tab bar.
     */
    DockPanel.prototype._onTabCloseRequested = function (sender, args) {
        args.title.owner.close();
    };
    /**
     * Handle the `tabDetachRequested` signal from a tab bar.
     */
    DockPanel.prototype._onTabDetachRequested = function (sender, args) {
        var _this = this;
        // Do nothing if a drag is already in progress.
        if (this._drag) {
            return;
        }
        // Release the tab bar's hold on the mouse.
        sender.releaseMouse();
        // Extract the data from the args.
        var title = args.title, tab = args.tab, clientX = args.clientX, clientY = args.clientY;
        // Setup the mime data for the drag operation.
        var mimeData = new MimeData();
        var factory = function () { return title.owner; };
        mimeData.setData('application/vnd.lumino.widget-factory', factory);
        // Create the drag image for the drag operation.
        var dragImage = tab.cloneNode(true);
        // Create the drag object to manage the drag-drop operation.
        this._drag = new index_es6_Drag({
            mimeData: mimeData,
            dragImage: dragImage,
            proposedAction: 'move',
            supportedActions: 'move',
            source: this
        });
        // Hide the tab node in the original tab.
        tab.classList.add('lm-mod-hidden');
        /* <DEPRECATED> */
        tab.classList.add('p-mod-hidden'); // Create the cleanup callback.
        /* </DEPRECATED> */ var cleanup = function () {
            _this._drag = null;
            tab.classList.remove('lm-mod-hidden');
            /* <DEPRECATED> */
            tab.classList.remove('p-mod-hidden');
            /* </DEPRECATED> */
        };
        // Start the drag operation and cleanup when done.
        this._drag.start(clientX, clientY).then(cleanup);
    };
    return DockPanel;
}(index_es6_Widget));
/**
 * The namespace for the `DockPanel` class statics.
 */
(function (DockPanel) {
    /**
     * A concrete implementation of `IOverlay`.
     *
     * This is the default overlay implementation for a dock panel.
     */
    var Overlay = /** @class */ (function () {
        /**
         * Construct a new overlay.
         */
        function Overlay() {
            this._timer = -1;
            this._hidden = true;
            this.node = document.createElement('div');
            this.node.classList.add('lm-DockPanel-overlay');
            this.node.classList.add('lm-mod-hidden');
            /* <DEPRECATED> */
            this.node.classList.add('p-DockPanel-overlay');
            this.node.classList.add('p-mod-hidden');
            /* </DEPRECATED> */ this.node.style.position = 'absolute';
        }
        /**
         * Show the overlay using the given overlay geometry.
         *
         * @param geo - The desired geometry for the overlay.
         */
        Overlay.prototype.show = function (geo) {
            // Update the position of the overlay.
            var style = this.node.style;
            style.top = geo.top + "px";
            style.left = geo.left + "px";
            style.right = geo.right + "px";
            style.bottom = geo.bottom + "px";
            // Clear any pending hide timer.
            clearTimeout(this._timer);
            this._timer = -1;
            // If the overlay is already visible, we're done.
            if (!this._hidden) {
                return;
            }
            // Clear the hidden flag.
            this._hidden = false;
            // Finally, show the overlay.
            this.node.classList.remove('lm-mod-hidden');
            /* <DEPRECATED> */
            this.node.classList.remove('p-mod-hidden');
            /* </DEPRECATED> */
        };
        /**
         * Hide the overlay node.
         *
         * @param delay - The delay (in ms) before hiding the overlay.
         *   A delay value <= 0 will hide the overlay immediately.
         */
        Overlay.prototype.hide = function (delay) {
            var _this = this;
            // Do nothing if the overlay is already hidden.
            if (this._hidden) {
                return;
            }
            // Hide immediately if the delay is <= 0.
            if (delay <= 0) {
                clearTimeout(this._timer);
                this._timer = -1;
                this._hidden = true;
                this.node.classList.add('lm-mod-hidden');
                /* <DEPRECATED> */
                this.node.classList.add('p-mod-hidden');
                /* </DEPRECATED> */ return;
            }
            // Do nothing if a hide is already pending.
            if (this._timer !== -1) {
                return;
            }
            // Otherwise setup the hide timer.
            this._timer = window.setTimeout(function () {
                _this._timer = -1;
                _this._hidden = true;
                _this.node.classList.add('lm-mod-hidden');
                /* <DEPRECATED> */
                _this.node.classList.add('p-mod-hidden');
                /* </DEPRECATED> */
            }, delay);
        };
        return Overlay;
    }());
    DockPanel.Overlay = Overlay;
    /**
     * The default implementation of `IRenderer`.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
        }
        /**
         * Create a new tab bar for use with a dock panel.
         *
         * @returns A new tab bar for a dock panel.
         */
        Renderer.prototype.createTabBar = function () {
            var bar = new index_es6_TabBar();
            bar.addClass('lm-DockPanel-tabBar');
            /* <DEPRECATED> */
            bar.addClass('p-DockPanel-tabBar');
            /* </DEPRECATED> */
            return bar;
        };
        /**
         * Create a new handle node for use with a dock panel.
         *
         * @returns A new handle node for a dock panel.
         */
        Renderer.prototype.createHandle = function () {
            var handle = document.createElement('div');
            handle.className = 'lm-DockPanel-handle';
            /* <DEPRECATED> */
            handle.classList.add('p-DockPanel-handle');
            /* </DEPRECATED> */ return handle;
        };
        return Renderer;
    }());
    DockPanel.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    DockPanel.defaultRenderer = new Renderer();
})(index_es6_DockPanel || (index_es6_DockPanel = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$5;
(function (Private) {
    /**
     * A fraction used for sizing root panels; ~= `1 / golden_ratio`.
     */
    Private.GOLDEN_RATIO = 0.618;
    /**
     * The default sizes for the edge drop zones, in pixels.
     */
    Private.DEFAULT_EDGES = {
        /**
         * The size of the top edge dock zone for the root panel, in pixels.
         * This is different from the others to distinguish between the top
         * tab bar and the top root zone.
         */
        top: 12,
        /**
         * The size of the edge dock zone for the root panel, in pixels.
         */
        right: 40,
        /**
         * The size of the edge dock zone for the root panel, in pixels.
         */
        bottom: 40,
        /**
         * The size of the edge dock zone for the root panel, in pixels.
         */
        left: 40
    };
    /**
     * A singleton `'layout-modified'` conflatable message.
     */
    Private.LayoutModified = new ConflatableMessage('layout-modified');
    /**
     * An attached property used to track generated tab bars.
     */
    Private.isGeneratedTabBarProperty = new AttachedProperty({
        name: 'isGeneratedTabBar',
        create: function () { return false; }
    });
    /**
     * Create a single document config for the widgets in a dock panel.
     */
    function createSingleDocumentConfig(panel) {
        // Return an empty config if the panel is empty.
        if (panel.isEmpty) {
            return { main: null };
        }
        // Get a flat array of the widgets in the panel.
        var widgets = toArray(panel.widgets());
        // Get the first selected widget in the panel.
        var selected = panel.selectedWidgets().next();
        // Compute the current index for the new config.
        var currentIndex = selected ? widgets.indexOf(selected) : -1;
        // Return the single document config.
        return { main: { type: 'tab-area', widgets: widgets, currentIndex: currentIndex } };
    }
    Private.createSingleDocumentConfig = createSingleDocumentConfig;
    /**
     * Find the drop target at the given client position.
     */
    function findDropTarget(panel, clientX, clientY, edges) {
        // Bail if the mouse is not over the dock panel.
        if (!ElementExt.hitTest(panel.node, clientX, clientY)) {
            return { zone: 'invalid', target: null };
        }
        // Look up the layout for the panel.
        var layout = panel.layout;
        // If the layout is empty, indicate the entire root drop zone.
        if (layout.isEmpty) {
            return { zone: 'root-all', target: null };
        }
        // Test the edge zones when in multiple document mode.
        if (panel.mode === 'multiple-document') {
            // Get the client rect for the dock panel.
            var panelRect = panel.node.getBoundingClientRect();
            // Compute the distance to each edge of the panel.
            var pl = clientX - panelRect.left + 1;
            var pt = clientY - panelRect.top + 1;
            var pr = panelRect.right - clientX;
            var pb = panelRect.bottom - clientY;
            // Find the minimum distance to an edge.
            var pd = Math.min(pt, pr, pb, pl);
            // Return a root zone if the mouse is within an edge.
            switch (pd) {
                case pt:
                    if (pt < edges.top) {
                        return { zone: 'root-top', target: null };
                    }
                    break;
                case pr:
                    if (pr < edges.right) {
                        return { zone: 'root-right', target: null };
                    }
                    break;
                case pb:
                    if (pb < edges.bottom) {
                        return { zone: 'root-bottom', target: null };
                    }
                    break;
                case pl:
                    if (pl < edges.left) {
                        return { zone: 'root-left', target: null };
                    }
                    break;
                default:
                    throw 'unreachable';
            }
        }
        // Hit test the dock layout at the given client position.
        var target = layout.hitTestTabAreas(clientX, clientY);
        // Bail if no target area was found.
        if (!target) {
            return { zone: 'invalid', target: null };
        }
        // Return the whole tab area when in single document mode.
        if (panel.mode === 'single-document') {
            return { zone: 'widget-all', target: target };
        }
        // Compute the distance to each edge of the tab area.
        var al = target.x - target.left + 1;
        var at = target.y - target.top + 1;
        var ar = target.left + target.width - target.x;
        var ab = target.top + target.height - target.y;
        var tabHeight = target.tabBar.node.getBoundingClientRect().height;
        if (at < tabHeight) {
            return { zone: 'widget-tab', target: target };
        }
        // Get the X and Y edge sizes for the area.
        var rx = Math.round(target.width / 3);
        var ry = Math.round(target.height / 3);
        // If the mouse is not within an edge, indicate the entire area.
        if (al > rx && ar > rx && at > ry && ab > ry) {
            return { zone: 'widget-all', target: target };
        }
        // Scale the distances by the slenderness ratio.
        al /= rx;
        at /= ry;
        ar /= rx;
        ab /= ry;
        // Find the minimum distance to the area edge.
        var ad = Math.min(al, at, ar, ab);
        // Find the widget zone for the area edge.
        var zone;
        switch (ad) {
            case al:
                zone = 'widget-left';
                break;
            case at:
                zone = 'widget-top';
                break;
            case ar:
                zone = 'widget-right';
                break;
            case ab:
                zone = 'widget-bottom';
                break;
            default:
                throw 'unreachable';
        }
        // Return the final drop target.
        return { zone: zone, target: target };
    }
    Private.findDropTarget = findDropTarget;
    /**
     * Get the drop reference widget for a tab bar.
     */
    function getDropRef(tabBar) {
        if (tabBar.titles.length === 0) {
            return null;
        }
        if (tabBar.currentTitle) {
            return tabBar.currentTitle.owner;
        }
        return tabBar.titles[tabBar.titles.length - 1].owner;
    }
    Private.getDropRef = getDropRef;
})(Private$5 || (Private$5 = {}));

// Copyright (c) Jupyter Development Team.
/**
 * A class which tracks focus among a set of widgets.
 *
 * This class is useful when code needs to keep track of the most
 * recently focused widget(s) among a set of related widgets.
 */
var index_es6_FocusTracker = /** @class */ (function () {
    function FocusTracker() {
        this._counter = 0;
        this._widgets = [];
        this._activeWidget = null;
        this._currentWidget = null;
        this._numbers = new Map();
        this._nodes = new Map();
        this._activeChanged = new Signal(this);
        this._currentChanged = new Signal(this);
    }
    /**
     * Dispose of the resources held by the tracker.
     */
    FocusTracker.prototype.dispose = function () {
        var _this = this;
        // Do nothing if the tracker is already disposed.
        if (this._counter < 0) {
            return;
        }
        // Mark the tracker as disposed.
        this._counter = -1;
        // Clear the connections for the tracker.
        Signal.clearData(this);
        // Remove all event listeners.
        each(this._widgets, function (w) {
            w.node.removeEventListener('focus', _this, true);
            w.node.removeEventListener('blur', _this, true);
        });
        // Clear the internal data structures.
        this._activeWidget = null;
        this._currentWidget = null;
        this._nodes.clear();
        this._numbers.clear();
        this._widgets.length = 0;
    };
    Object.defineProperty(FocusTracker.prototype, "currentChanged", {
        /**
         * A signal emitted when the current widget has changed.
         */
        get: function () {
            return this._currentChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FocusTracker.prototype, "activeChanged", {
        /**
         * A signal emitted when the active widget has changed.
         */
        get: function () {
            return this._activeChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FocusTracker.prototype, "isDisposed", {
        /**
         * A flag indicating whether the tracker is disposed.
         */
        get: function () {
            return this._counter < 0;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FocusTracker.prototype, "currentWidget", {
        /**
         * The current widget in the tracker.
         *
         * #### Notes
         * The current widget is the widget among the tracked widgets which
         * has the *descendant node* which has most recently been focused.
         *
         * The current widget will not be updated if the node loses focus. It
         * will only be updated when a different tracked widget gains focus.
         *
         * If the current widget is removed from the tracker, the previous
         * current widget will be restored.
         *
         * This behavior is intended to follow a user's conceptual model of
         * a semantically "current" widget, where the "last thing of type X"
         * to be interacted with is the "current instance of X", regardless
         * of whether that instance still has focus.
         */
        get: function () {
            return this._currentWidget;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FocusTracker.prototype, "activeWidget", {
        /**
         * The active widget in the tracker.
         *
         * #### Notes
         * The active widget is the widget among the tracked widgets which
         * has the *descendant node* which is currently focused.
         */
        get: function () {
            return this._activeWidget;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FocusTracker.prototype, "widgets", {
        /**
         * A read only array of the widgets being tracked.
         */
        get: function () {
            return this._widgets;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Get the focus number for a particular widget in the tracker.
     *
     * @param widget - The widget of interest.
     *
     * @returns The focus number for the given widget, or `-1` if the
     *   widget has not had focus since being added to the tracker, or
     *   is not contained by the tracker.
     *
     * #### Notes
     * The focus number indicates the relative order in which the widgets
     * have gained focus. A widget with a larger number has gained focus
     * more recently than a widget with a smaller number.
     *
     * The `currentWidget` will always have the largest focus number.
     *
     * All widgets start with a focus number of `-1`, which indicates that
     * the widget has not been focused since being added to the tracker.
     */
    FocusTracker.prototype.focusNumber = function (widget) {
        var n = this._numbers.get(widget);
        return n === undefined ? -1 : n;
    };
    /**
     * Test whether the focus tracker contains a given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns `true` if the widget is tracked, `false` otherwise.
     */
    FocusTracker.prototype.has = function (widget) {
        return this._numbers.has(widget);
    };
    /**
     * Add a widget to the focus tracker.
     *
     * @param widget - The widget of interest.
     *
     * #### Notes
     * A widget will be automatically removed from the tracker if it
     * is disposed after being added.
     *
     * If the widget is already tracked, this is a no-op.
     */
    FocusTracker.prototype.add = function (widget) {
        // Do nothing if the widget is already tracked.
        if (this._numbers.has(widget)) {
            return;
        }
        // Test whether the widget has focus.
        var focused = widget.node.contains(document.activeElement);
        // Set up the initial focus number.
        var n = focused ? this._counter++ : -1;
        // Add the widget to the internal data structures.
        this._widgets.push(widget);
        this._numbers.set(widget, n);
        this._nodes.set(widget.node, widget);
        // Set up the event listeners. The capturing phase must be used
        // since the 'focus' and 'blur' events don't bubble and Firefox
        // doesn't support the 'focusin' or 'focusout' events.
        widget.node.addEventListener('focus', this, true);
        widget.node.addEventListener('blur', this, true);
        // Connect the disposed signal handler.
        widget.disposed.connect(this._onWidgetDisposed, this);
        // Set the current and active widgets if needed.
        if (focused) {
            this._setWidgets(widget, widget);
        }
    };
    /**
     * Remove a widget from the focus tracker.
     *
     * #### Notes
     * If the widget is the `currentWidget`, the previous current widget
     * will become the new `currentWidget`.
     *
     * A widget will be automatically removed from the tracker if it
     * is disposed after being added.
     *
     * If the widget is not tracked, this is a no-op.
     */
    FocusTracker.prototype.remove = function (widget) {
        var _this = this;
        // Bail early if the widget is not tracked.
        if (!this._numbers.has(widget)) {
            return;
        }
        // Disconnect the disposed signal handler.
        widget.disposed.disconnect(this._onWidgetDisposed, this);
        // Remove the event listeners.
        widget.node.removeEventListener('focus', this, true);
        widget.node.removeEventListener('blur', this, true);
        // Remove the widget from the internal data structures.
        ArrayExt.removeFirstOf(this._widgets, widget);
        this._nodes.delete(widget.node);
        this._numbers.delete(widget);
        // Bail early if the widget is not the current widget.
        if (this._currentWidget !== widget) {
            return;
        }
        // Filter the widgets for those which have had focus.
        var valid = filter(this._widgets, function (w) { return _this._numbers.get(w) !== -1; });
        // Get the valid widget with the max focus number.
        var previous = max(valid, function (first, second) {
            var a = _this._numbers.get(first);
            var b = _this._numbers.get(second);
            return a - b;
        }) || null;
        // Set the current and active widgets.
        this._setWidgets(previous, null);
    };
    /**
     * Handle the DOM events for the focus tracker.
     *
     * @param event - The DOM event sent to the panel.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the tracked nodes. It should
     * not be called directly by user code.
     */
    FocusTracker.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'focus':
                this._evtFocus(event);
                break;
            case 'blur':
                this._evtBlur(event);
                break;
        }
    };
    /**
     * Set the current and active widgets for the tracker.
     */
    FocusTracker.prototype._setWidgets = function (current, active) {
        // Swap the current widget.
        var oldCurrent = this._currentWidget;
        this._currentWidget = current;
        // Swap the active widget.
        var oldActive = this._activeWidget;
        this._activeWidget = active;
        // Emit the `currentChanged` signal if needed.
        if (oldCurrent !== current) {
            this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });
        }
        // Emit the `activeChanged` signal if needed.
        if (oldActive !== active) {
            this._activeChanged.emit({ oldValue: oldActive, newValue: active });
        }
    };
    /**
     * Handle the `'focus'` event for a tracked widget.
     */
    FocusTracker.prototype._evtFocus = function (event) {
        // Find the widget which gained focus, which is known to exist.
        var widget = this._nodes.get(event.currentTarget);
        // Update the focus number if necessary.
        if (widget !== this._currentWidget) {
            this._numbers.set(widget, this._counter++);
        }
        // Set the current and active widgets.
        this._setWidgets(widget, widget);
    };
    /**
     * Handle the `'blur'` event for a tracked widget.
     */
    FocusTracker.prototype._evtBlur = function (event) {
        // Find the widget which lost focus, which is known to exist.
        var widget = this._nodes.get(event.currentTarget);
        // Get the node which being focused after this blur.
        var focusTarget = event.relatedTarget;
        // If no other node is being focused, clear the active widget.
        if (!focusTarget) {
            this._setWidgets(this._currentWidget, null);
            return;
        }
        // Bail if the focus widget is not changing.
        if (widget.node.contains(focusTarget)) {
            return;
        }
        // If no tracked widget is being focused, clear the active widget.
        if (!find(this._widgets, function (w) { return w.node.contains(focusTarget); })) {
            this._setWidgets(this._currentWidget, null);
            return;
        }
    };
    /**
     * Handle the `disposed` signal for a tracked widget.
     */
    FocusTracker.prototype._onWidgetDisposed = function (sender) {
        this.remove(sender);
    };
    return FocusTracker;
}());

/**
 * A layout which arranges its widgets in a grid.
 */
var index_es6_GridLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(GridLayout, _super);
    /**
     * Construct a new grid layout.
     *
     * @param options - The options for initializing the layout.
     */
    function GridLayout(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, options) || this;
        _this._dirty = false;
        _this._rowSpacing = 4;
        _this._columnSpacing = 4;
        _this._items = [];
        _this._rowStarts = [];
        _this._columnStarts = [];
        _this._rowSizers = [new BoxSizer()];
        _this._columnSizers = [new BoxSizer()];
        _this._box = null;
        if (options.rowCount !== undefined) {
            Private$4.reallocSizers(_this._rowSizers, options.rowCount);
        }
        if (options.columnCount !== undefined) {
            Private$4.reallocSizers(_this._columnSizers, options.columnCount);
        }
        if (options.rowSpacing !== undefined) {
            _this._rowSpacing = Private$4.clampValue(options.rowSpacing);
        }
        if (options.columnSpacing !== undefined) {
            _this._columnSpacing = Private$4.clampValue(options.columnSpacing);
        }
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     */
    GridLayout.prototype.dispose = function () {
        // Dispose of the widgets and layout items.
        each(this._items, function (item) {
            var widget = item.widget;
            item.dispose();
            widget.dispose();
        });
        // Clear the layout state.
        this._box = null;
        this._items.length = 0;
        this._rowStarts.length = 0;
        this._rowSizers.length = 0;
        this._columnStarts.length = 0;
        this._columnSizers.length = 0;
        // Dispose of the rest of the layout.
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(GridLayout.prototype, "rowCount", {
        /**
         * Get the number of rows in the layout.
         */
        get: function () {
            return this._rowSizers.length;
        },
        /**
         * Set the number of rows in the layout.
         *
         * #### Notes
         * The minimum row count is `1`.
         */
        set: function (value) {
            // Do nothing if the row count does not change.
            if (value === this.rowCount) {
                return;
            }
            // Reallocate the row sizers.
            Private$4.reallocSizers(this._rowSizers, value);
            // Schedule a fit of the parent.
            if (this.parent) {
                this.parent.fit();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridLayout.prototype, "columnCount", {
        /**
         * Get the number of columns in the layout.
         */
        get: function () {
            return this._columnSizers.length;
        },
        /**
         * Set the number of columns in the layout.
         *
         * #### Notes
         * The minimum column count is `1`.
         */
        set: function (value) {
            // Do nothing if the column count does not change.
            if (value === this.columnCount) {
                return;
            }
            // Reallocate the column sizers.
            Private$4.reallocSizers(this._columnSizers, value);
            // Schedule a fit of the parent.
            if (this.parent) {
                this.parent.fit();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridLayout.prototype, "rowSpacing", {
        /**
         * Get the row spacing for the layout.
         */
        get: function () {
            return this._rowSpacing;
        },
        /**
         * Set the row spacing for the layout.
         */
        set: function (value) {
            // Clamp the spacing to the allowed range.
            value = Private$4.clampValue(value);
            // Bail if the spacing does not change
            if (this._rowSpacing === value) {
                return;
            }
            // Update the internal spacing.
            this._rowSpacing = value;
            // Schedule a fit of the parent.
            if (this.parent) {
                this.parent.fit();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridLayout.prototype, "columnSpacing", {
        /**
         * Get the column spacing for the layout.
         */
        get: function () {
            return this._columnSpacing;
        },
        /**
         * Set the col spacing for the layout.
         */
        set: function (value) {
            // Clamp the spacing to the allowed range.
            value = Private$4.clampValue(value);
            // Bail if the spacing does not change
            if (this._columnSpacing === value) {
                return;
            }
            // Update the internal spacing.
            this._columnSpacing = value;
            // Schedule a fit of the parent.
            if (this.parent) {
                this.parent.fit();
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Get the stretch factor for a specific row.
     *
     * @param index - The row index of interest.
     *
     * @returns The stretch factor for the row.
     *
     * #### Notes
     * This returns `-1` if the index is out of range.
     */
    GridLayout.prototype.rowStretch = function (index) {
        var sizer = this._rowSizers[index];
        return sizer ? sizer.stretch : -1;
    };
    /**
     * Set the stretch factor for a specific row.
     *
     * @param index - The row index of interest.
     *
     * @param value - The stretch factor for the row.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    GridLayout.prototype.setRowStretch = function (index, value) {
        // Look up the row sizer.
        var sizer = this._rowSizers[index];
        // Bail if the index is out of range.
        if (!sizer) {
            return;
        }
        // Clamp the value to the allowed range.
        value = Private$4.clampValue(value);
        // Bail if the stretch does not change.
        if (sizer.stretch === value) {
            return;
        }
        // Update the sizer stretch.
        sizer.stretch = value;
        // Schedule an update of the parent.
        if (this.parent) {
            this.parent.update();
        }
    };
    /**
     * Get the stretch factor for a specific column.
     *
     * @param index - The column index of interest.
     *
     * @returns The stretch factor for the column.
     *
     * #### Notes
     * This returns `-1` if the index is out of range.
     */
    GridLayout.prototype.columnStretch = function (index) {
        var sizer = this._columnSizers[index];
        return sizer ? sizer.stretch : -1;
    };
    /**
     * Set the stretch factor for a specific column.
     *
     * @param index - The column index of interest.
     *
     * @param value - The stretch factor for the column.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    GridLayout.prototype.setColumnStretch = function (index, value) {
        // Look up the column sizer.
        var sizer = this._columnSizers[index];
        // Bail if the index is out of range.
        if (!sizer) {
            return;
        }
        // Clamp the value to the allowed range.
        value = Private$4.clampValue(value);
        // Bail if the stretch does not change.
        if (sizer.stretch === value) {
            return;
        }
        // Update the sizer stretch.
        sizer.stretch = value;
        // Schedule an update of the parent.
        if (this.parent) {
            this.parent.update();
        }
    };
    /**
     * Create an iterator over the widgets in the layout.
     *
     * @returns A new iterator over the widgets in the layout.
     */
    GridLayout.prototype.iter = function () {
        return map(this._items, function (item) { return item.widget; });
    };
    /**
     * Add a widget to the grid layout.
     *
     * @param widget - The widget to add to the layout.
     *
     * #### Notes
     * If the widget is already contained in the layout, this is no-op.
     */
    GridLayout.prototype.addWidget = function (widget) {
        // Look up the index for the widget.
        var i = ArrayExt.findFirstIndex(this._items, function (it) { return it.widget === widget; });
        // Bail if the widget is already in the layout.
        if (i !== -1) {
            return;
        }
        // Add the widget to the layout.
        this._items.push(new index_es6_LayoutItem(widget));
        // Attach the widget to the parent.
        if (this.parent) {
            this.attachWidget(widget);
        }
    };
    /**
     * Remove a widget from the grid layout.
     *
     * @param widget - The widget to remove from the layout.
     *
     * #### Notes
     * A widget is automatically removed from the layout when its `parent`
     * is set to `null`. This method should only be invoked directly when
     * removing a widget from a layout which has yet to be installed on a
     * parent widget.
     *
     * This method does *not* modify the widget's `parent`.
     */
    GridLayout.prototype.removeWidget = function (widget) {
        // Look up the index for the widget.
        var i = ArrayExt.findFirstIndex(this._items, function (it) { return it.widget === widget; });
        // Bail if the widget is not in the layout.
        if (i === -1) {
            return;
        }
        // Remove the widget from the layout.
        var item = ArrayExt.removeAt(this._items, i);
        // Detach the widget from the parent.
        if (this.parent) {
            this.detachWidget(widget);
        }
        // Dispose the layout item.
        item.dispose();
    };
    /**
     * Perform layout initialization which requires the parent widget.
     */
    GridLayout.prototype.init = function () {
        var _this = this;
        _super.prototype.init.call(this);
        each(this, function (widget) {
            _this.attachWidget(widget);
        });
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param widget - The widget to attach to the parent.
     */
    GridLayout.prototype.attachWidget = function (widget) {
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget's node to the parent.
        this.parent.node.appendChild(widget.node);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param widget - The widget to detach from the parent.
     */
    GridLayout.prototype.detachWidget = function (widget) {
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     */
    GridLayout.prototype.onBeforeShow = function (msg) {
        _super.prototype.onBeforeShow.call(this, msg);
        this.parent.update();
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    GridLayout.prototype.onBeforeAttach = function (msg) {
        _super.prototype.onBeforeAttach.call(this, msg);
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-shown'` message.
     */
    GridLayout.prototype.onChildShown = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     */
    GridLayout.prototype.onChildHidden = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'resize'` message.
     */
    GridLayout.prototype.onResize = function (msg) {
        if (this.parent.isVisible) {
            this._update(msg.width, msg.height);
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    GridLayout.prototype.onUpdateRequest = function (msg) {
        if (this.parent.isVisible) {
            this._update(-1, -1);
        }
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     */
    GridLayout.prototype.onFitRequest = function (msg) {
        if (this.parent.isAttached) {
            this._fit();
        }
    };
    /**
     * Fit the layout to the total size required by the widgets.
     */
    GridLayout.prototype._fit = function () {
        // Reset the min sizes of the sizers.
        for (var i = 0, n = this.rowCount; i < n; ++i) {
            this._rowSizers[i].minSize = 0;
        }
        for (var i = 0, n = this.columnCount; i < n; ++i) {
            this._columnSizers[i].minSize = 0;
        }
        // Filter for the visible layout items.
        var items = this._items.filter(function (it) { return !it.isHidden; });
        // Fit the layout items.
        for (var i = 0, n = items.length; i < n; ++i) {
            items[i].fit();
        }
        // Get the max row and column index.
        var maxRow = this.rowCount - 1;
        var maxCol = this.columnCount - 1;
        // Sort the items by row span.
        items.sort(Private$4.rowSpanCmp);
        // Update the min sizes of the row sizers.
        for (var i = 0, n = items.length; i < n; ++i) {
            // Fetch the item.
            var item = items[i];
            // Get the row bounds for the item.
            var config = GridLayout.getCellConfig(item.widget);
            var r1 = Math.min(config.row, maxRow);
            var r2 = Math.min(config.row + config.rowSpan - 1, maxRow);
            // Distribute the minimum height to the sizers as needed.
            Private$4.distributeMin(this._rowSizers, r1, r2, item.minHeight);
        }
        // Sort the items by column span.
        items.sort(Private$4.columnSpanCmp);
        // Update the min sizes of the column sizers.
        for (var i = 0, n = items.length; i < n; ++i) {
            // Fetch the item.
            var item = items[i];
            // Get the column bounds for the item.
            var config = GridLayout.getCellConfig(item.widget);
            var c1 = Math.min(config.column, maxCol);
            var c2 = Math.min(config.column + config.columnSpan - 1, maxCol);
            // Distribute the minimum width to the sizers as needed.
            Private$4.distributeMin(this._columnSizers, c1, c2, item.minWidth);
        }
        // If no size constraint is needed, just update the parent.
        if (this.fitPolicy === 'set-no-constraint') {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
            return;
        }
        // Set up the computed min size.
        var minH = maxRow * this._rowSpacing;
        var minW = maxCol * this._columnSpacing;
        // Add the sizer minimums to the computed min size.
        for (var i = 0, n = this.rowCount; i < n; ++i) {
            minH += this._rowSizers[i].minSize;
        }
        for (var i = 0, n = this.columnCount; i < n; ++i) {
            minW += this._columnSizers[i].minSize;
        }
        // Update the box sizing and add it to the computed min size.
        var box = (this._box = ElementExt.boxSizing(this.parent.node));
        minW += box.horizontalSum;
        minH += box.verticalSum;
        // Update the parent's min size constraints.
        var style = this.parent.node.style;
        style.minWidth = minW + "px";
        style.minHeight = minH + "px";
        // Set the dirty flag to ensure only a single update occurs.
        this._dirty = true;
        // Notify the ancestor that it should fit immediately. This may
        // cause a resize of the parent, fulfilling the required update.
        if (this.parent.parent) {
            index_es6_MessageLoop.sendMessage(this.parent.parent, index_es6_Widget.Msg.FitRequest);
        }
        // If the dirty flag is still set, the parent was not resized.
        // Trigger the required update on the parent widget immediately.
        if (this._dirty) {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
        }
    };
    /**
     * Update the layout position and size of the widgets.
     *
     * The parent offset dimensions should be `-1` if unknown.
     */
    GridLayout.prototype._update = function (offsetWidth, offsetHeight) {
        // Clear the dirty flag to indicate the update occurred.
        this._dirty = false;
        // Measure the parent if the offset dimensions are unknown.
        if (offsetWidth < 0) {
            offsetWidth = this.parent.node.offsetWidth;
        }
        if (offsetHeight < 0) {
            offsetHeight = this.parent.node.offsetHeight;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Compute the layout area adjusted for border and padding.
        var top = this._box.paddingTop;
        var left = this._box.paddingLeft;
        var width = offsetWidth - this._box.horizontalSum;
        var height = offsetHeight - this._box.verticalSum;
        // Get the max row and column index.
        var maxRow = this.rowCount - 1;
        var maxCol = this.columnCount - 1;
        // Compute the total fixed row and column space.
        var fixedRowSpace = maxRow * this._rowSpacing;
        var fixedColSpace = maxCol * this._columnSpacing;
        // Distribute the available space to the box sizers.
        BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));
        BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));
        // Update the row start positions.
        for (var i = 0, pos = top, n = this.rowCount; i < n; ++i) {
            this._rowStarts[i] = pos;
            pos += this._rowSizers[i].size + this._rowSpacing;
        }
        // Update the column start positions.
        for (var i = 0, pos = left, n = this.columnCount; i < n; ++i) {
            this._columnStarts[i] = pos;
            pos += this._columnSizers[i].size + this._columnSpacing;
        }
        // Update the geometry of the layout items.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item.
            var item = this._items[i];
            // Ignore hidden items.
            if (item.isHidden) {
                continue;
            }
            // Fetch the cell bounds for the widget.
            var config = GridLayout.getCellConfig(item.widget);
            var r1 = Math.min(config.row, maxRow);
            var c1 = Math.min(config.column, maxCol);
            var r2 = Math.min(config.row + config.rowSpan - 1, maxRow);
            var c2 = Math.min(config.column + config.columnSpan - 1, maxCol);
            // Compute the cell geometry.
            var x = this._columnStarts[c1];
            var y = this._rowStarts[r1];
            var w = this._columnStarts[c2] + this._columnSizers[c2].size - x;
            var h = this._rowStarts[r2] + this._rowSizers[r2].size - y;
            // Update the geometry of the layout item.
            item.update(x, y, w, h);
        }
    };
    return GridLayout;
}(index_es6_Layout));
/**
 * The namespace for the `GridLayout` class statics.
 */
(function (GridLayout) {
    /**
     * Get the cell config for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @returns The cell config for the widget.
     */
    function getCellConfig(widget) {
        return Private$4.cellConfigProperty.get(widget);
    }
    GridLayout.getCellConfig = getCellConfig;
    /**
     * Set the cell config for the given widget.
     *
     * @param widget - The widget of interest.
     *
     * @param value - The value for the cell config.
     */
    function setCellConfig(widget, value) {
        Private$4.cellConfigProperty.set(widget, Private$4.normalizeConfig(value));
    }
    GridLayout.setCellConfig = setCellConfig;
})(index_es6_GridLayout || (index_es6_GridLayout = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$4;
(function (Private) {
    /**
     * The property descriptor for the widget cell config.
     */
    Private.cellConfigProperty = new AttachedProperty({
        name: 'cellConfig',
        create: function () { return ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }); },
        changed: onChildCellConfigChanged
    });
    /**
     * Normalize a partial cell config object.
     */
    function normalizeConfig(config) {
        var row = Math.max(0, Math.floor(config.row || 0));
        var column = Math.max(0, Math.floor(config.column || 0));
        var rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));
        var columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));
        return { row: row, column: column, rowSpan: rowSpan, columnSpan: columnSpan };
    }
    Private.normalizeConfig = normalizeConfig;
    /**
     * Clamp a value to an integer >= 0.
     */
    function clampValue(value) {
        return Math.max(0, Math.floor(value));
    }
    Private.clampValue = clampValue;
    /**
     * A sort comparison function for row spans.
     */
    function rowSpanCmp(a, b) {
        var c1 = Private.cellConfigProperty.get(a.widget);
        var c2 = Private.cellConfigProperty.get(b.widget);
        return c1.rowSpan - c2.rowSpan;
    }
    Private.rowSpanCmp = rowSpanCmp;
    /**
     * A sort comparison function for column spans.
     */
    function columnSpanCmp(a, b) {
        var c1 = Private.cellConfigProperty.get(a.widget);
        var c2 = Private.cellConfigProperty.get(b.widget);
        return c1.columnSpan - c2.columnSpan;
    }
    Private.columnSpanCmp = columnSpanCmp;
    /**
     * Reallocate the box sizers for the given grid dimensions.
     */
    function reallocSizers(sizers, count) {
        // Coerce the count to the valid range.
        count = Math.max(1, Math.floor(count));
        // Add the missing sizers.
        while (sizers.length < count) {
            sizers.push(new BoxSizer());
        }
        // Remove the extra sizers.
        if (sizers.length > count) {
            sizers.length = count;
        }
    }
    Private.reallocSizers = reallocSizers;
    /**
     * Distribute a min size constraint across a range of sizers.
     */
    function distributeMin(sizers, i1, i2, minSize) {
        // Sanity check the indices.
        if (i2 < i1) {
            return;
        }
        // Handle the simple case of no cell span.
        if (i1 === i2) {
            var sizer = sizers[i1];
            sizer.minSize = Math.max(sizer.minSize, minSize);
            return;
        }
        // Compute the total current min size of the span.
        var totalMin = 0;
        for (var i = i1; i <= i2; ++i) {
            totalMin += sizers[i].minSize;
        }
        // Do nothing if the total is greater than the required.
        if (totalMin >= minSize) {
            return;
        }
        // Compute the portion of the space to allocate to each sizer.
        var portion = (minSize - totalMin) / (i2 - i1 + 1);
        // Add the portion to each sizer.
        for (var i = i1; i <= i2; ++i) {
            sizers[i].minSize += portion;
        }
    }
    Private.distributeMin = distributeMin;
    /**
     * The change handler for the child cell config property.
     */
    function onChildCellConfigChanged(child) {
        if (child.parent && child.parent.layout instanceof index_es6_GridLayout) {
            child.parent.fit();
        }
    }
})(Private$4 || (Private$4 = {}));

/**
 * A widget which displays menus as a canonical menu bar.
 */
var index_es6_MenuBar = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(MenuBar, _super);
    /**
     * Construct a new menu bar.
     *
     * @param options - The options for initializing the menu bar.
     */
    function MenuBar(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { node: Private$3.createNode() }) || this;
        _this._activeIndex = -1;
        _this._menus = [];
        _this._childMenu = null;
        _this.addClass('lm-MenuBar');
        /* <DEPRECATED> */
        _this.addClass('p-MenuBar');
        /* </DEPRECATED> */
        _this.setFlag(index_es6_Widget.Flag.DisallowLayout);
        _this.renderer = options.renderer || MenuBar.defaultRenderer;
        _this._forceItemsPosition = options.forceItemsPosition || {
            forceX: true,
            forceY: true
        };
        return _this;
    }
    /**
     * Dispose of the resources held by the widget.
     */
    MenuBar.prototype.dispose = function () {
        this._closeChildMenu();
        this._menus.length = 0;
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(MenuBar.prototype, "childMenu", {
        /**
         * The child menu of the menu bar.
         *
         * #### Notes
         * This will be `null` if the menu bar does not have an open menu.
         */
        get: function () {
            return this._childMenu;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MenuBar.prototype, "contentNode", {
        /**
         * Get the menu bar content node.
         *
         * #### Notes
         * This is the node which holds the menu title nodes.
         *
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-MenuBar-content')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MenuBar.prototype, "activeMenu", {
        /**
         * Get the currently active menu.
         */
        get: function () {
            return this._menus[this._activeIndex] || null;
        },
        /**
         * Set the currently active menu.
         *
         * #### Notes
         * If the menu does not exist, the menu will be set to `null`.
         */
        set: function (value) {
            this.activeIndex = value ? this._menus.indexOf(value) : -1;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MenuBar.prototype, "activeIndex", {
        /**
         * Get the index of the currently active menu.
         *
         * #### Notes
         * This will be `-1` if no menu is active.
         */
        get: function () {
            return this._activeIndex;
        },
        /**
         * Set the index of the currently active menu.
         *
         * #### Notes
         * If the menu cannot be activated, the index will be set to `-1`.
         */
        set: function (value) {
            // Adjust the value for an out of range index.
            if (value < 0 || value >= this._menus.length) {
                value = -1;
            }
            // Bail early if the index will not change.
            if (this._activeIndex === value) {
                return;
            }
            // Update the active index.
            this._activeIndex = value;
            // Update focus to new active index
            if (this._activeIndex >= 0 &&
                this.contentNode.childNodes[this._activeIndex]) {
                this.contentNode.childNodes[this._activeIndex].focus();
            }
            // Schedule an update of the items.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MenuBar.prototype, "menus", {
        /**
         * A read-only array of the menus in the menu bar.
         */
        get: function () {
            return this._menus;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Open the active menu and activate its first menu item.
     *
     * #### Notes
     * If there is no active menu, this is a no-op.
     */
    MenuBar.prototype.openActiveMenu = function () {
        // Bail early if there is no active item.
        if (this._activeIndex === -1) {
            return;
        }
        // Open the child menu.
        this._openChildMenu();
        // Activate the first item in the child menu.
        if (this._childMenu) {
            this._childMenu.activeIndex = -1;
            this._childMenu.activateNextItem();
        }
    };
    /**
     * Add a menu to the end of the menu bar.
     *
     * @param menu - The menu to add to the menu bar.
     *
     * #### Notes
     * If the menu is already added to the menu bar, it will be moved.
     */
    MenuBar.prototype.addMenu = function (menu) {
        this.insertMenu(this._menus.length, menu);
    };
    /**
     * Insert a menu into the menu bar at the specified index.
     *
     * @param index - The index at which to insert the menu.
     *
     * @param menu - The menu to insert into the menu bar.
     *
     * #### Notes
     * The index will be clamped to the bounds of the menus.
     *
     * If the menu is already added to the menu bar, it will be moved.
     */
    MenuBar.prototype.insertMenu = function (index, menu) {
        // Close the child menu before making changes.
        this._closeChildMenu();
        // Look up the index of the menu.
        var i = this._menus.indexOf(menu);
        // Clamp the insert index to the array bounds.
        var j = Math.max(0, Math.min(index, this._menus.length));
        // If the menu is not in the array, insert it.
        if (i === -1) {
            // Insert the menu into the array.
            ArrayExt.insert(this._menus, j, menu);
            // Add the styling class to the menu.
            menu.addClass('lm-MenuBar-menu');
            /* <DEPRECATED> */
            menu.addClass('p-MenuBar-menu');
            /* </DEPRECATED> */
            // Connect to the menu signals.
            menu.aboutToClose.connect(this._onMenuAboutToClose, this);
            menu.menuRequested.connect(this._onMenuMenuRequested, this);
            menu.title.changed.connect(this._onTitleChanged, this);
            // Schedule an update of the items.
            this.update();
            // There is nothing more to do.
            return;
        }
        // Otherwise, the menu exists in the array and should be moved.
        // Adjust the index if the location is at the end of the array.
        if (j === this._menus.length) {
            j--;
        }
        // Bail if there is no effective move.
        if (i === j) {
            return;
        }
        // Move the menu to the new locations.
        ArrayExt.move(this._menus, i, j);
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Remove a menu from the menu bar.
     *
     * @param menu - The menu to remove from the menu bar.
     *
     * #### Notes
     * This is a no-op if the menu is not in the menu bar.
     */
    MenuBar.prototype.removeMenu = function (menu) {
        this.removeMenuAt(this._menus.indexOf(menu));
    };
    /**
     * Remove the menu at a given index from the menu bar.
     *
     * @param index - The index of the menu to remove.
     *
     * #### Notes
     * This is a no-op if the index is out of range.
     */
    MenuBar.prototype.removeMenuAt = function (index) {
        // Close the child menu before making changes.
        this._closeChildMenu();
        // Remove the menu from the array.
        var menu = ArrayExt.removeAt(this._menus, index);
        // Bail if the index is out of range.
        if (!menu) {
            return;
        }
        // Disconnect from the menu signals.
        menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);
        menu.menuRequested.disconnect(this._onMenuMenuRequested, this);
        menu.title.changed.disconnect(this._onTitleChanged, this);
        // Remove the styling class from the menu.
        menu.removeClass('lm-MenuBar-menu');
        /* <DEPRECATED> */
        menu.removeClass('p-MenuBar-menu');
        /* </DEPRECATED> */
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Remove all menus from the menu bar.
     */
    MenuBar.prototype.clearMenus = function () {
        // Bail if there is nothing to remove.
        if (this._menus.length === 0) {
            return;
        }
        // Close the child menu before making changes.
        this._closeChildMenu();
        // Disconnect from the menu signals and remove the styling class.
        for (var _i = 0, _a = this._menus; _i < _a.length; _i++) {
            var menu = _a[_i];
            menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);
            menu.menuRequested.disconnect(this._onMenuMenuRequested, this);
            menu.title.changed.disconnect(this._onTitleChanged, this);
            menu.removeClass('lm-MenuBar-menu');
            /* <DEPRECATED> */
            menu.removeClass('p-MenuBar-menu');
            /* </DEPRECATED> */
        }
        // Clear the menus array.
        this._menus.length = 0;
        // Schedule an update of the items.
        this.update();
    };
    /**
     * Handle the DOM events for the menu bar.
     *
     * @param event - The DOM event sent to the menu bar.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the menu bar's DOM nodes. It
     * should not be called directly by user code.
     */
    MenuBar.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'mousedown':
                this._evtMouseDown(event);
                break;
            case 'mousemove':
                this._evtMouseMove(event);
                break;
            case 'mouseleave':
                this._evtMouseLeave(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    MenuBar.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('keydown', this);
        this.node.addEventListener('mousedown', this);
        this.node.addEventListener('mousemove', this);
        this.node.addEventListener('mouseleave', this);
        this.node.addEventListener('contextmenu', this);
    };
    /**
     * A message handler invoked on an `'after-detach'` message.
     */
    MenuBar.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('keydown', this);
        this.node.removeEventListener('mousedown', this);
        this.node.removeEventListener('mousemove', this);
        this.node.removeEventListener('mouseleave', this);
        this.node.removeEventListener('contextmenu', this);
        this._closeChildMenu();
    };
    /**
     * A message handler invoked on an `'activate-request'` message.
     */
    MenuBar.prototype.onActivateRequest = function (msg) {
        if (this.isAttached) {
            this.node.focus();
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    MenuBar.prototype.onUpdateRequest = function (msg) {
        var _this = this;
        var menus = this._menus;
        var renderer = this.renderer;
        var activeIndex = this._activeIndex;
        var content = new Array(menus.length);
        var _loop_1 = function (i, n) {
            var title = menus[i].title;
            var active = i === activeIndex;
            content[i] = renderer.renderItem({
                title: title,
                active: active,
                onfocus: function () {
                    _this.activeIndex = i;
                }
            });
        };
        for (var i = 0, n = menus.length; i < n; ++i) {
            _loop_1(i);
        }
        VirtualDOM.render(content, this.contentNode);
    };
    /**
     * Handle the `'keydown'` event for the menu bar.
     */
    MenuBar.prototype._evtKeyDown = function (event) {
        // A menu bar handles all keydown events.
        event.preventDefault();
        event.stopPropagation();
        // Fetch the key code for the event.
        var kc = event.keyCode;
        // Enter, Up Arrow, Down Arrow
        if (kc === 13 || kc === 38 || kc === 40) {
            this.openActiveMenu();
            return;
        }
        // Escape
        if (kc === 27) {
            this._closeChildMenu();
            this.activeIndex = -1;
            this.node.blur();
            return;
        }
        // Left Arrow
        if (kc === 37) {
            var i = this._activeIndex;
            var n = this._menus.length;
            this.activeIndex = i === 0 ? n - 1 : i - 1;
            return;
        }
        // Right Arrow
        if (kc === 39) {
            var i = this._activeIndex;
            var n = this._menus.length;
            this.activeIndex = i === n - 1 ? 0 : i + 1;
            return;
        }
        // Get the pressed key character.
        var key = getKeyboardLayout().keyForKeydownEvent(event);
        // Bail if the key is not valid.
        if (!key) {
            return;
        }
        // Search for the next best matching mnemonic item.
        var start = this._activeIndex + 1;
        var result = Private$3.findMnemonic(this._menus, key, start);
        // Handle the requested mnemonic based on the search results.
        // If exactly one mnemonic is matched, that menu is opened.
        // Otherwise, the next mnemonic is activated if available,
        // followed by the auto mnemonic if available.
        if (result.index !== -1 && !result.multiple) {
            this.activeIndex = result.index;
            this.openActiveMenu();
        }
        else if (result.index !== -1) {
            this.activeIndex = result.index;
        }
        else if (result.auto !== -1) {
            this.activeIndex = result.auto;
        }
    };
    /**
     * Handle the `'mousedown'` event for the menu bar.
     */
    MenuBar.prototype._evtMouseDown = function (event) {
        // Bail if the mouse press was not on the menu bar. This can occur
        // when the document listener is installed for an active menu bar.
        if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {
            return;
        }
        // Stop the propagation of the event. Immediate propagation is
        // also stopped so that an open menu does not handle the event.
        event.preventDefault();
        event.stopPropagation();
        event.stopImmediatePropagation();
        // Check if the mouse is over one of the menu items.
        var index = ArrayExt.findFirstIndex(this.contentNode.children, function (node) {
            return ElementExt.hitTest(node, event.clientX, event.clientY);
        });
        // If the press was not on an item, close the child menu.
        if (index === -1) {
            this._closeChildMenu();
            return;
        }
        // If the press was not the left mouse button, do nothing further.
        if (event.button !== 0) {
            return;
        }
        // Otherwise, toggle the open state of the child menu.
        if (this._childMenu) {
            this._closeChildMenu();
            this.activeIndex = index;
        }
        else {
            this.activeIndex = index;
            this._openChildMenu();
        }
    };
    /**
     * Handle the `'mousemove'` event for the menu bar.
     */
    MenuBar.prototype._evtMouseMove = function (event) {
        // Check if the mouse is over one of the menu items.
        var index = ArrayExt.findFirstIndex(this.contentNode.children, function (node) {
            return ElementExt.hitTest(node, event.clientX, event.clientY);
        });
        // Bail early if the active index will not change.
        if (index === this._activeIndex) {
            return;
        }
        // Bail early if a child menu is open and the mouse is not over
        // an item. This allows the child menu to be kept open when the
        // mouse is over the empty part of the menu bar.
        if (index === -1 && this._childMenu) {
            return;
        }
        // Update the active index to the hovered item.
        this.activeIndex = index;
        // Open the new menu if a menu is already open.
        if (this._childMenu) {
            this._openChildMenu();
        }
    };
    /**
     * Handle the `'mouseleave'` event for the menu bar.
     */
    MenuBar.prototype._evtMouseLeave = function (event) {
        // Reset the active index if there is no open menu.
        if (!this._childMenu) {
            this.activeIndex = -1;
        }
    };
    /**
     * Open the child menu at the active index immediately.
     *
     * If a different child menu is already open, it will be closed,
     * even if there is no active menu.
     */
    MenuBar.prototype._openChildMenu = function () {
        // If there is no active menu, close the current menu.
        var newMenu = this.activeMenu;
        if (!newMenu) {
            this._closeChildMenu();
            return;
        }
        // Bail if there is no effective menu change.
        var oldMenu = this._childMenu;
        if (oldMenu === newMenu) {
            return;
        }
        // Swap the internal menu reference.
        this._childMenu = newMenu;
        // Close the current menu, or setup for the new menu.
        if (oldMenu) {
            oldMenu.close();
        }
        else {
            this.addClass('lm-mod-active');
            /* <DEPRECATED> */
            this.addClass('p-mod-active');
            /* </DEPRECATED> */
            document.addEventListener('mousedown', this, true);
        }
        // Ensure the menu bar is updated and look up the item node.
        index_es6_MessageLoop.sendMessage(this, index_es6_Widget.Msg.UpdateRequest);
        var itemNode = this.contentNode.children[this._activeIndex];
        // Get the positioning data for the new menu.
        var _a = itemNode.getBoundingClientRect(), left = _a.left, bottom = _a.bottom;
        // Open the new menu at the computed location.
        newMenu.open(left, bottom, this._forceItemsPosition);
    };
    /**
     * Close the child menu immediately.
     *
     * This is a no-op if a child menu is not open.
     */
    MenuBar.prototype._closeChildMenu = function () {
        // Bail if no child menu is open.
        if (!this._childMenu) {
            return;
        }
        // Remove the active class from the menu bar.
        this.removeClass('lm-mod-active');
        /* <DEPRECATED> */
        this.removeClass('p-mod-active');
        /* </DEPRECATED> */
        // Remove the document listeners.
        document.removeEventListener('mousedown', this, true);
        // Clear the internal menu reference.
        var menu = this._childMenu;
        this._childMenu = null;
        // Close the menu.
        menu.close();
        // Reset the active index.
        this.activeIndex = -1;
    };
    /**
     * Handle the `aboutToClose` signal of a menu.
     */
    MenuBar.prototype._onMenuAboutToClose = function (sender) {
        // Bail if the sender is not the child menu.
        if (sender !== this._childMenu) {
            return;
        }
        // Remove the active class from the menu bar.
        this.removeClass('lm-mod-active');
        /* <DEPRECATED> */
        this.removeClass('p-mod-active');
        /* </DEPRECATED> */
        // Remove the document listeners.
        document.removeEventListener('mousedown', this, true);
        // Clear the internal menu reference.
        this._childMenu = null;
        // Reset the active index.
        this.activeIndex = -1;
    };
    /**
     * Handle the `menuRequested` signal of a child menu.
     */
    MenuBar.prototype._onMenuMenuRequested = function (sender, args) {
        // Bail if the sender is not the child menu.
        if (sender !== this._childMenu) {
            return;
        }
        // Look up the active index and menu count.
        var i = this._activeIndex;
        var n = this._menus.length;
        // Active the next requested index.
        switch (args) {
            case 'next':
                this.activeIndex = i === n - 1 ? 0 : i + 1;
                break;
            case 'previous':
                this.activeIndex = i === 0 ? n - 1 : i - 1;
                break;
        }
        // Open the active menu.
        this.openActiveMenu();
    };
    /**
     * Handle the `changed` signal of a title object.
     */
    MenuBar.prototype._onTitleChanged = function () {
        this.update();
    };
    return MenuBar;
}(index_es6_Widget));
/**
 * The namespace for the `MenuBar` class statics.
 */
(function (MenuBar) {
    /**
     * The default implementation of `IRenderer`.
     *
     * #### Notes
     * Subclasses are free to reimplement rendering methods as needed.
     */
    var Renderer = /** @class */ (function () {
        function Renderer() {
        }
        /**
         * Render the virtual element for a menu bar item.
         *
         * @param data - The data to use for rendering the item.
         *
         * @returns A virtual element representing the item.
         */
        Renderer.prototype.renderItem = function (data) {
            var className = this.createItemClass(data);
            var dataset = this.createItemDataset(data);
            var aria = this.createItemARIA(data);
            return index_es6_h.li(index_es6_assign({ className: className, dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data));
        };
        /**
         * Render the icon element for a menu bar item.
         *
         * @param data - The data to use for rendering the icon.
         *
         * @returns A virtual element representing the item icon.
         */
        Renderer.prototype.renderIcon = function (data) {
            var className = this.createIconClass(data);
            /* <DEPRECATED> */
            if (typeof data.title.icon === 'string') {
                return index_es6_h.div({ className: className }, data.title.iconLabel);
            }
            /* </DEPRECATED> */
            // if data.title.icon is undefined, it will be ignored
            return index_es6_h.div({ className: className }, data.title.icon, data.title.iconLabel);
        };
        /**
         * Render the label element for a menu item.
         *
         * @param data - The data to use for rendering the label.
         *
         * @returns A virtual element representing the item label.
         */
        Renderer.prototype.renderLabel = function (data) {
            var content = this.formatLabel(data);
            return index_es6_h.div({
                className: 'lm-MenuBar-itemLabel' +
                    /* <DEPRECATED> */
                    ' p-MenuBar-itemLabel'
                /* </DEPRECATED> */
            }, content);
        };
        /**
         * Create the class name for the menu bar item.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the menu item.
         */
        Renderer.prototype.createItemClass = function (data) {
            var name = 'lm-MenuBar-item';
            /* <DEPRECATED> */
            name += ' p-MenuBar-item';
            /* </DEPRECATED> */
            if (data.title.className) {
                name += " " + data.title.className;
            }
            if (data.active) {
                name += ' lm-mod-active';
                /* <DEPRECATED> */
                name += ' p-mod-active';
                /* </DEPRECATED> */
            }
            return name;
        };
        /**
         * Create the dataset for a menu bar item.
         *
         * @param data - The data to use for the item.
         *
         * @returns The dataset for the menu bar item.
         */
        Renderer.prototype.createItemDataset = function (data) {
            return data.title.dataset;
        };
        /**
         * Create the aria attributes for menu bar item.
         *
         * @param data - The data to use for the aria attributes.
         *
         * @returns The aria attributes object for the item.
         */
        Renderer.prototype.createItemARIA = function (data) {
            return { role: 'menuitem', 'aria-haspopup': 'true' };
        };
        /**
         * Create the class name for the menu bar item icon.
         *
         * @param data - The data to use for the class name.
         *
         * @returns The full class name for the item icon.
         */
        Renderer.prototype.createIconClass = function (data) {
            var name = 'lm-MenuBar-itemIcon';
            /* <DEPRECATED> */
            name += ' p-MenuBar-itemIcon';
            /* </DEPRECATED> */
            var extra = data.title.iconClass;
            return extra ? name + " " + extra : name;
        };
        /**
         * Create the render content for the label node.
         *
         * @param data - The data to use for the label content.
         *
         * @returns The content to add to the label node.
         */
        Renderer.prototype.formatLabel = function (data) {
            // Fetch the label text and mnemonic index.
            var _a = data.title, label = _a.label, mnemonic = _a.mnemonic;
            // If the index is out of range, do not modify the label.
            if (mnemonic < 0 || mnemonic >= label.length) {
                return label;
            }
            // Split the label into parts.
            var prefix = label.slice(0, mnemonic);
            var suffix = label.slice(mnemonic + 1);
            var char = label[mnemonic];
            // Wrap the mnemonic character in a span.
            var span = index_es6_h.span({
                className: 'lm-MenuBar-itemMnemonic' +
                    /* <DEPRECATED> */
                    ' p-MenuBar-itemMnemonic'
                /* </DEPRECATED> */
            }, char);
            // Return the content parts.
            return [prefix, span, suffix];
        };
        return Renderer;
    }());
    MenuBar.Renderer = Renderer;
    /**
     * The default `Renderer` instance.
     */
    MenuBar.defaultRenderer = new Renderer();
})(index_es6_MenuBar || (index_es6_MenuBar = {}));
/**
 * The namespace for the module implementation details.
 */
var Private$3;
(function (Private) {
    /**
     * Create the DOM node for a menu bar.
     */
    function createNode() {
        var node = document.createElement('div');
        var content = document.createElement('ul');
        content.className = 'lm-MenuBar-content';
        /* <DEPRECATED> */
        content.classList.add('p-MenuBar-content');
        /* </DEPRECATED> */
        node.appendChild(content);
        content.setAttribute('role', 'menubar');
        node.tabIndex = 0;
        content.tabIndex = 0;
        return node;
    }
    Private.createNode = createNode;
    /**
     * Find the best matching mnemonic item.
     *
     * The search starts at the given index and wraps around.
     */
    function findMnemonic(menus, key, start) {
        // Setup the result variables.
        var index = -1;
        var auto = -1;
        var multiple = false;
        // Normalize the key to upper case.
        var upperKey = key.toUpperCase();
        // Search the items from the given start index.
        for (var i = 0, n = menus.length; i < n; ++i) {
            // Compute the wrapped index.
            var k = (i + start) % n;
            // Look up the menu title.
            var title = menus[k].title;
            // Ignore titles with an empty label.
            if (title.label.length === 0) {
                continue;
            }
            // Look up the mnemonic index for the label.
            var mn = title.mnemonic;
            // Handle a valid mnemonic index.
            if (mn >= 0 && mn < title.label.length) {
                if (title.label[mn].toUpperCase() === upperKey) {
                    if (index === -1) {
                        index = k;
                    }
                    else {
                        multiple = true;
                    }
                }
                continue;
            }
            // Finally, handle the auto index if possible.
            if (auto === -1 && title.label[0].toUpperCase() === upperKey) {
                auto = k;
            }
        }
        // Return the search results.
        return { index: index, multiple: multiple, auto: auto };
    }
    Private.findMnemonic = findMnemonic;
})(Private$3 || (Private$3 = {}));

/**
 * A widget which implements a canonical scroll bar.
 */
var index_es6_ScrollBar = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(ScrollBar, _super);
    /**
     * Construct a new scroll bar.
     *
     * @param options - The options for initializing the scroll bar.
     */
    function ScrollBar(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { node: Private$2.createNode() }) || this;
        /**
         * A timeout callback for repeating the mouse press.
         */
        _this._onRepeat = function () {
            // Clear the repeat timer id.
            _this._repeatTimer = -1;
            // Bail if the mouse has been released.
            if (!_this._pressData) {
                return;
            }
            // Look up the part that was pressed.
            var part = _this._pressData.part;
            // Bail if the thumb was pressed.
            if (part === 'thumb') {
                return;
            }
            // Schedule the timer for another repeat.
            _this._repeatTimer = window.setTimeout(_this._onRepeat, 20);
            // Get the current mouse position.
            var mouseX = _this._pressData.mouseX;
            var mouseY = _this._pressData.mouseY;
            // Handle a decrement button repeat.
            if (part === 'decrement') {
                // Bail if the mouse is not over the button.
                if (!ElementExt.hitTest(_this.decrementNode, mouseX, mouseY)) {
                    return;
                }
                // Emit the step requested signal.
                _this._stepRequested.emit('decrement');
                // Finished.
                return;
            }
            // Handle an increment button repeat.
            if (part === 'increment') {
                // Bail if the mouse is not over the button.
                if (!ElementExt.hitTest(_this.incrementNode, mouseX, mouseY)) {
                    return;
                }
                // Emit the step requested signal.
                _this._stepRequested.emit('increment');
                // Finished.
                return;
            }
            // Handle a track repeat.
            if (part === 'track') {
                // Bail if the mouse is not over the track.
                if (!ElementExt.hitTest(_this.trackNode, mouseX, mouseY)) {
                    return;
                }
                // Fetch the thumb node.
                var thumbNode = _this.thumbNode;
                // Bail if the mouse is over the thumb.
                if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {
                    return;
                }
                // Fetch the client rect for the thumb.
                var thumbRect = thumbNode.getBoundingClientRect();
                // Determine the direction for the page request.
                var dir = void 0;
                if (_this._orientation === 'horizontal') {
                    dir = mouseX < thumbRect.left ? 'decrement' : 'increment';
                }
                else {
                    dir = mouseY < thumbRect.top ? 'decrement' : 'increment';
                }
                // Emit the page requested signal.
                _this._pageRequested.emit(dir);
                // Finished.
                return;
            }
        };
        _this._value = 0;
        _this._page = 10;
        _this._maximum = 100;
        _this._repeatTimer = -1;
        _this._pressData = null;
        _this._thumbMoved = new Signal(_this);
        _this._stepRequested = new Signal(_this);
        _this._pageRequested = new Signal(_this);
        _this.addClass('lm-ScrollBar');
        /* <DEPRECATED> */
        _this.addClass('p-ScrollBar');
        /* </DEPRECATED> */
        _this.setFlag(index_es6_Widget.Flag.DisallowLayout);
        // Set the orientation.
        _this._orientation = options.orientation || 'vertical';
        _this.dataset['orientation'] = _this._orientation;
        // Parse the rest of the options.
        if (options.maximum !== undefined) {
            _this._maximum = Math.max(0, options.maximum);
        }
        if (options.page !== undefined) {
            _this._page = Math.max(0, options.page);
        }
        if (options.value !== undefined) {
            _this._value = Math.max(0, Math.min(options.value, _this._maximum));
        }
        return _this;
    }
    Object.defineProperty(ScrollBar.prototype, "thumbMoved", {
        /**
         * A signal emitted when the user moves the scroll thumb.
         *
         * #### Notes
         * The payload is the current value of the scroll bar.
         */
        get: function () {
            return this._thumbMoved;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "stepRequested", {
        /**
         * A signal emitted when the user clicks a step button.
         *
         * #### Notes
         * The payload is whether a decrease or increase is requested.
         */
        get: function () {
            return this._stepRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "pageRequested", {
        /**
         * A signal emitted when the user clicks the scroll track.
         *
         * #### Notes
         * The payload is whether a decrease or increase is requested.
         */
        get: function () {
            return this._pageRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "orientation", {
        /**
         * Get the orientation of the scroll bar.
         */
        get: function () {
            return this._orientation;
        },
        /**
         * Set the orientation of the scroll bar.
         */
        set: function (value) {
            // Do nothing if the orientation does not change.
            if (this._orientation === value) {
                return;
            }
            // Release the mouse before making changes.
            this._releaseMouse();
            // Update the internal orientation.
            this._orientation = value;
            this.dataset['orientation'] = value;
            // Schedule an update the scroll bar.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "value", {
        /**
         * Get the current value of the scroll bar.
         */
        get: function () {
            return this._value;
        },
        /**
         * Set the current value of the scroll bar.
         *
         * #### Notes
         * The value will be clamped to the range `[0, maximum]`.
         */
        set: function (value) {
            // Clamp the value to the allowable range.
            value = Math.max(0, Math.min(value, this._maximum));
            // Do nothing if the value does not change.
            if (this._value === value) {
                return;
            }
            // Update the internal value.
            this._value = value;
            // Schedule an update the scroll bar.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "page", {
        /**
         * Get the page size of the scroll bar.
         *
         * #### Notes
         * The page size is the amount of visible content in the scrolled
         * region, expressed in data units. It determines the size of the
         * scroll bar thumb.
         */
        get: function () {
            return this._page;
        },
        /**
         * Set the page size of the scroll bar.
         *
         * #### Notes
         * The page size will be clamped to the range `[0, Infinity]`.
         */
        set: function (value) {
            // Clamp the page size to the allowable range.
            value = Math.max(0, value);
            // Do nothing if the value does not change.
            if (this._page === value) {
                return;
            }
            // Update the internal page size.
            this._page = value;
            // Schedule an update the scroll bar.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "maximum", {
        /**
         * Get the maximum value of the scroll bar.
         */
        get: function () {
            return this._maximum;
        },
        /**
         * Set the maximum value of the scroll bar.
         *
         * #### Notes
         * The max size will be clamped to the range `[0, Infinity]`.
         */
        set: function (value) {
            // Clamp the value to the allowable range.
            value = Math.max(0, value);
            // Do nothing if the value does not change.
            if (this._maximum === value) {
                return;
            }
            // Update the internal values.
            this._maximum = value;
            // Clamp the current value to the new range.
            this._value = Math.min(this._value, value);
            // Schedule an update the scroll bar.
            this.update();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "decrementNode", {
        /**
         * The scroll bar decrement button node.
         *
         * #### Notes
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-ScrollBar-button')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "incrementNode", {
        /**
         * The scroll bar increment button node.
         *
         * #### Notes
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-ScrollBar-button')[1];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "trackNode", {
        /**
         * The scroll bar track node.
         *
         * #### Notes
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-ScrollBar-track')[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScrollBar.prototype, "thumbNode", {
        /**
         * The scroll bar thumb node.
         *
         * #### Notes
         * Modifying this node directly can lead to undefined behavior.
         */
        get: function () {
            return this.node.getElementsByClassName('lm-ScrollBar-thumb')[0];
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Handle the DOM events for the scroll bar.
     *
     * @param event - The DOM event sent to the scroll bar.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the scroll bar's DOM node.
     *
     * This should not be called directly by user code.
     */
    ScrollBar.prototype.handleEvent = function (event) {
        switch (event.type) {
            case 'mousedown':
                this._evtMouseDown(event);
                break;
            case 'mousemove':
                this._evtMouseMove(event);
                break;
            case 'mouseup':
                this._evtMouseUp(event);
                break;
            case 'keydown':
                this._evtKeyDown(event);
                break;
            case 'contextmenu':
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    };
    /**
     * A method invoked on a 'before-attach' message.
     */
    ScrollBar.prototype.onBeforeAttach = function (msg) {
        this.node.addEventListener('mousedown', this);
        this.update();
    };
    /**
     * A method invoked on an 'after-detach' message.
     */
    ScrollBar.prototype.onAfterDetach = function (msg) {
        this.node.removeEventListener('mousedown', this);
        this._releaseMouse();
    };
    /**
     * A method invoked on an 'update-request' message.
     */
    ScrollBar.prototype.onUpdateRequest = function (msg) {
        // Convert the value and page into percentages.
        var value = (this._value * 100) / this._maximum;
        var page = (this._page * 100) / (this._page + this._maximum);
        // Clamp the value and page to the relevant range.
        value = Math.max(0, Math.min(value, 100));
        page = Math.max(0, Math.min(page, 100));
        // Fetch the thumb style.
        var thumbStyle = this.thumbNode.style;
        // Update the thumb style for the current orientation.
        if (this._orientation === 'horizontal') {
            thumbStyle.top = '';
            thumbStyle.height = '';
            thumbStyle.left = value + "%";
            thumbStyle.width = page + "%";
            thumbStyle.transform = "translate(" + -value + "%, 0%)";
        }
        else {
            thumbStyle.left = '';
            thumbStyle.width = '';
            thumbStyle.top = value + "%";
            thumbStyle.height = page + "%";
            thumbStyle.transform = "translate(0%, " + -value + "%)";
        }
    };
    /**
     * Handle the `'keydown'` event for the scroll bar.
     */
    ScrollBar.prototype._evtKeyDown = function (event) {
        // Stop all input events during drag.
        event.preventDefault();
        event.stopPropagation();
        // Ignore anything except the `Escape` key.
        if (event.keyCode !== 27) {
            return;
        }
        // Fetch the previous scroll value.
        var value = this._pressData ? this._pressData.value : -1;
        // Release the mouse.
        this._releaseMouse();
        // Restore the old scroll value if possible.
        if (value !== -1) {
            this._moveThumb(value);
        }
    };
    /**
     * Handle the `'mousedown'` event for the scroll bar.
     */
    ScrollBar.prototype._evtMouseDown = function (event) {
        // Do nothing if it's not a left mouse press.
        if (event.button !== 0) {
            return;
        }
        // Send an activate request to the scroll bar. This can be
        // used by message hooks to activate something relevant.
        this.activate();
        // Do nothing if the mouse is already captured.
        if (this._pressData) {
            return;
        }
        // Find the pressed scroll bar part.
        var part = Private$2.findPart(this, event.target);
        // Do nothing if the part is not of interest.
        if (!part) {
            return;
        }
        // Stop the event propagation.
        event.preventDefault();
        event.stopPropagation();
        // Override the mouse cursor.
        var override = index_es6_Drag.overrideCursor('default');
        // Set up the press data.
        this._pressData = {
            part: part,
            override: override,
            delta: -1,
            value: -1,
            mouseX: event.clientX,
            mouseY: event.clientY
        };
        // Add the extra event listeners.
        document.addEventListener('mousemove', this, true);
        document.addEventListener('mouseup', this, true);
        document.addEventListener('keydown', this, true);
        document.addEventListener('contextmenu', this, true);
        // Handle a thumb press.
        if (part === 'thumb') {
            // Fetch the thumb node.
            var thumbNode = this.thumbNode;
            // Fetch the client rect for the thumb.
            var thumbRect = thumbNode.getBoundingClientRect();
            // Update the press data delta for the current orientation.
            if (this._orientation === 'horizontal') {
                this._pressData.delta = event.clientX - thumbRect.left;
            }
            else {
                this._pressData.delta = event.clientY - thumbRect.top;
            }
            // Add the active class to the thumb node.
            thumbNode.classList.add('lm-mod-active');
            /* <DEPRECATED> */
            thumbNode.classList.add('p-mod-active');
            /* </DEPRECATED> */
            // Store the current value in the press data.
            this._pressData.value = this._value;
            // Finished.
            return;
        }
        // Handle a track press.
        if (part === 'track') {
            // Fetch the client rect for the thumb.
            var thumbRect = this.thumbNode.getBoundingClientRect();
            // Determine the direction for the page request.
            var dir = void 0;
            if (this._orientation === 'horizontal') {
                dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';
            }
            else {
                dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';
            }
            // Start the repeat timer.
            this._repeatTimer = window.setTimeout(this._onRepeat, 350);
            // Emit the page requested signal.
            this._pageRequested.emit(dir);
            // Finished.
            return;
        }
        // Handle a decrement button press.
        if (part === 'decrement') {
            // Add the active class to the decrement node.
            this.decrementNode.classList.add('lm-mod-active');
            /* <DEPRECATED> */
            this.decrementNode.classList.add('p-mod-active');
            /* </DEPRECATED> */
            // Start the repeat timer.
            this._repeatTimer = window.setTimeout(this._onRepeat, 350);
            // Emit the step requested signal.
            this._stepRequested.emit('decrement');
            // Finished.
            return;
        }
        // Handle an increment button press.
        if (part === 'increment') {
            // Add the active class to the increment node.
            this.incrementNode.classList.add('lm-mod-active');
            /* <DEPRECATED> */
            this.incrementNode.classList.add('p-mod-active');
            /* </DEPRECATED> */
            // Start the repeat timer.
            this._repeatTimer = window.setTimeout(this._onRepeat, 350);
            // Emit the step requested signal.
            this._stepRequested.emit('increment');
            // Finished.
            return;
        }
    };
    /**
     * Handle the `'mousemove'` event for the scroll bar.
     */
    ScrollBar.prototype._evtMouseMove = function (event) {
        // Do nothing if no drag is in progress.
        if (!this._pressData) {
            return;
        }
        // Stop the event propagation.
        event.preventDefault();
        event.stopPropagation();
        // Update the mouse position.
        this._pressData.mouseX = event.clientX;
        this._pressData.mouseY = event.clientY;
        // Bail if the thumb is not being dragged.
        if (this._pressData.part !== 'thumb') {
            return;
        }
        // Get the client rect for the thumb and track.
        var thumbRect = this.thumbNode.getBoundingClientRect();
        var trackRect = this.trackNode.getBoundingClientRect();
        // Fetch the scroll geometry based on the orientation.
        var trackPos;
        var trackSpan;
        if (this._orientation === 'horizontal') {
            trackPos = event.clientX - trackRect.left - this._pressData.delta;
            trackSpan = trackRect.width - thumbRect.width;
        }
        else {
            trackPos = event.clientY - trackRect.top - this._pressData.delta;
            trackSpan = trackRect.height - thumbRect.height;
        }
        // Compute the desired value from the scroll geometry.
        var value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;
        // Move the thumb to the computed value.
        this._moveThumb(value);
    };
    /**
     * Handle the `'mouseup'` event for the scroll bar.
     */
    ScrollBar.prototype._evtMouseUp = function (event) {
        // Do nothing if it's not a left mouse release.
        if (event.button !== 0) {
            return;
        }
        // Stop the event propagation.
        event.preventDefault();
        event.stopPropagation();
        // Release the mouse.
        this._releaseMouse();
    };
    /**
     * Release the mouse and restore the node states.
     */
    ScrollBar.prototype._releaseMouse = function () {
        // Bail if there is no press data.
        if (!this._pressData) {
            return;
        }
        // Clear the repeat timer.
        clearTimeout(this._repeatTimer);
        this._repeatTimer = -1;
        // Clear the press data.
        this._pressData.override.dispose();
        this._pressData = null;
        // Remove the extra event listeners.
        document.removeEventListener('mousemove', this, true);
        document.removeEventListener('mouseup', this, true);
        document.removeEventListener('keydown', this, true);
        document.removeEventListener('contextmenu', this, true);
        // Remove the active classes from the nodes.
        this.thumbNode.classList.remove('lm-mod-active');
        this.decrementNode.classList.remove('lm-mod-active');
        this.incrementNode.classList.remove('lm-mod-active');
        /* <DEPRECATED> */
        this.thumbNode.classList.remove('p-mod-active');
        this.decrementNode.classList.remove('p-mod-active');
        this.incrementNode.classList.remove('p-mod-active');
        /* </DEPRECATED> */
    };
    /**
     * Move the thumb to the specified position.
     */
    ScrollBar.prototype._moveThumb = function (value) {
        // Clamp the value to the allowed range.
        value = Math.max(0, Math.min(value, this._maximum));
        // Bail if the value does not change.
        if (this._value === value) {
            return;
        }
        // Update the internal value.
        this._value = value;
        // Schedule an update of the scroll bar.
        this.update();
        // Emit the thumb moved signal.
        this._thumbMoved.emit(value);
    };
    return ScrollBar;
}(index_es6_Widget));
/**
 * The namespace for the module implementation details.
 */
var Private$2;
(function (Private) {
    /**
     * Create the DOM node for a scroll bar.
     */
    function createNode() {
        var node = document.createElement('div');
        var decrement = document.createElement('div');
        var increment = document.createElement('div');
        var track = document.createElement('div');
        var thumb = document.createElement('div');
        decrement.className = 'lm-ScrollBar-button';
        increment.className = 'lm-ScrollBar-button';
        decrement.dataset['action'] = 'decrement';
        increment.dataset['action'] = 'increment';
        track.className = 'lm-ScrollBar-track';
        thumb.className = 'lm-ScrollBar-thumb';
        /* <DEPRECATED> */
        decrement.classList.add('p-ScrollBar-button');
        increment.classList.add('p-ScrollBar-button');
        track.classList.add('p-ScrollBar-track');
        thumb.classList.add('p-ScrollBar-thumb');
        /* </DEPRECATED> */
        track.appendChild(thumb);
        node.appendChild(decrement);
        node.appendChild(track);
        node.appendChild(increment);
        return node;
    }
    Private.createNode = createNode;
    /**
     * Find the scroll bar part which contains the given target.
     */
    function findPart(scrollBar, target) {
        // Test the thumb.
        if (scrollBar.thumbNode.contains(target)) {
            return 'thumb';
        }
        // Test the track.
        if (scrollBar.trackNode.contains(target)) {
            return 'track';
        }
        // Test the decrement button.
        if (scrollBar.decrementNode.contains(target)) {
            return 'decrement';
        }
        // Test the increment button.
        if (scrollBar.incrementNode.contains(target)) {
            return 'increment';
        }
        // Indicate no match.
        return null;
    }
    Private.findPart = findPart;
})(Private$2 || (Private$2 = {}));

/**
 * A concrete layout implementation which holds a single widget.
 *
 * #### Notes
 * This class is useful for creating simple container widgets which
 * hold a single child. The child should be positioned with CSS.
 */
var index_es6_SingletonLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(SingletonLayout, _super);
    function SingletonLayout() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._widget = null;
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     */
    SingletonLayout.prototype.dispose = function () {
        if (this._widget) {
            var widget = this._widget;
            this._widget = null;
            widget.dispose();
        }
        _super.prototype.dispose.call(this);
    };
    Object.defineProperty(SingletonLayout.prototype, "widget", {
        /**
         * Get the child widget for the layout.
         */
        get: function () {
            return this._widget;
        },
        /**
         * Set the child widget for the layout.
         *
         * #### Notes
         * Setting the child widget will cause the old child widget to be
         * automatically disposed. If that is not desired, set the parent
         * of the old child to `null` before assigning a new child.
         */
        set: function (widget) {
            // Remove the widget from its current parent. This is a no-op
            // if the widget's parent is already the layout parent widget.
            if (widget) {
                widget.parent = this.parent;
            }
            // Bail early if the widget does not change.
            if (this._widget === widget) {
                return;
            }
            // Dispose of the old child widget.
            if (this._widget) {
                this._widget.dispose();
            }
            // Update the internal widget.
            this._widget = widget;
            // Attach the new child widget if needed.
            if (this.parent && widget) {
                this.attachWidget(widget);
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Create an iterator over the widgets in the layout.
     *
     * @returns A new iterator over the widgets in the layout.
     */
    SingletonLayout.prototype.iter = function () {
        return this._widget ? once(this._widget) : empty();
    };
    /**
     * Remove a widget from the layout.
     *
     * @param widget - The widget to remove from the layout.
     *
     * #### Notes
     * A widget is automatically removed from the layout when its `parent`
     * is set to `null`. This method should only be invoked directly when
     * removing a widget from a layout which has yet to be installed on a
     * parent widget.
     *
     * This method does *not* modify the widget's `parent`.
     */
    SingletonLayout.prototype.removeWidget = function (widget) {
        // Bail early if the widget does not exist in the layout.
        if (this._widget !== widget) {
            return;
        }
        // Clear the internal widget.
        this._widget = null;
        // If the layout is parented, detach the widget from the DOM.
        if (this.parent) {
            this.detachWidget(widget);
        }
    };
    /**
     * Perform layout initialization which requires the parent widget.
     */
    SingletonLayout.prototype.init = function () {
        var _this = this;
        _super.prototype.init.call(this);
        each(this, function (widget) {
            _this.attachWidget(widget);
        });
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This method is called automatically by the single layout at the
     * appropriate time. It should not be called directly by user code.
     *
     * The default implementation adds the widgets's node to the parent's
     * node at the proper location, and sends the appropriate attach
     * messages to the widget if the parent is attached to the DOM.
     *
     * Subclasses may reimplement this method to control how the widget's
     * node is added to the parent's node.
     */
    SingletonLayout.prototype.attachWidget = function (widget) {
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget's node to the parent.
        this.parent.node.appendChild(widget.node);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This method is called automatically by the single layout at the
     * appropriate time. It should not be called directly by user code.
     *
     * The default implementation removes the widget's node from the
     * parent's node, and sends the appropriate detach messages to the
     * widget if the parent is attached to the DOM.
     *
     * Subclasses may reimplement this method to control how the widget's
     * node is removed from the parent's node.
     */
    SingletonLayout.prototype.detachWidget = function (widget) {
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
    };
    return SingletonLayout;
}(index_es6_Layout));

/**
 * A layout where visible widgets are stacked atop one another.
 *
 * #### Notes
 * The Z-order of the visible widgets follows their layout order.
 */
var index_es6_StackedLayout = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(StackedLayout, _super);
    function StackedLayout() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._dirty = false;
        _this._items = [];
        _this._box = null;
        return _this;
    }
    /**
     * Dispose of the resources held by the layout.
     */
    StackedLayout.prototype.dispose = function () {
        // Dispose of the layout items.
        each(this._items, function (item) {
            item.dispose();
        });
        // Clear the layout state.
        this._box = null;
        this._items.length = 0;
        // Dispose of the rest of the layout.
        _super.prototype.dispose.call(this);
    };
    /**
     * Attach a widget to the parent's DOM node.
     *
     * @param index - The current index of the widget in the layout.
     *
     * @param widget - The widget to attach to the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    StackedLayout.prototype.attachWidget = function (index, widget) {
        // Create and add a new layout item for the widget.
        ArrayExt.insert(this._items, index, new index_es6_LayoutItem(widget));
        // Send a `'before-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeAttach);
        }
        // Add the widget's node to the parent.
        this.parent.node.appendChild(widget.node);
        // Send an `'after-attach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterAttach);
        }
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * Move a widget in the parent's DOM node.
     *
     * @param fromIndex - The previous index of the widget in the layout.
     *
     * @param toIndex - The current index of the widget in the layout.
     *
     * @param widget - The widget to move in the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    StackedLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {
        // Move the layout item for the widget.
        ArrayExt.move(this._items, fromIndex, toIndex);
        // Post an update request for the parent widget.
        this.parent.update();
    };
    /**
     * Detach a widget from the parent's DOM node.
     *
     * @param index - The previous index of the widget in the layout.
     *
     * @param widget - The widget to detach from the parent.
     *
     * #### Notes
     * This is a reimplementation of the superclass method.
     */
    StackedLayout.prototype.detachWidget = function (index, widget) {
        // Remove the layout item for the widget.
        var item = ArrayExt.removeAt(this._items, index);
        // Send a `'before-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.BeforeDetach);
        }
        // Remove the widget's node from the parent.
        this.parent.node.removeChild(widget.node);
        // Send an `'after-detach'` message if the parent is attached.
        if (this.parent.isAttached) {
            index_es6_MessageLoop.sendMessage(widget, index_es6_Widget.Msg.AfterDetach);
        }
        // Reset the z-index for the widget.
        item.widget.node.style.zIndex = '';
        // Dispose of the layout item.
        item.dispose();
        // Post a fit request for the parent widget.
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'before-show'` message.
     */
    StackedLayout.prototype.onBeforeShow = function (msg) {
        _super.prototype.onBeforeShow.call(this, msg);
        this.parent.update();
    };
    /**
     * A message handler invoked on a `'before-attach'` message.
     */
    StackedLayout.prototype.onBeforeAttach = function (msg) {
        _super.prototype.onBeforeAttach.call(this, msg);
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-shown'` message.
     */
    StackedLayout.prototype.onChildShown = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'child-hidden'` message.
     */
    StackedLayout.prototype.onChildHidden = function (msg) {
        this.parent.fit();
    };
    /**
     * A message handler invoked on a `'resize'` message.
     */
    StackedLayout.prototype.onResize = function (msg) {
        if (this.parent.isVisible) {
            this._update(msg.width, msg.height);
        }
    };
    /**
     * A message handler invoked on an `'update-request'` message.
     */
    StackedLayout.prototype.onUpdateRequest = function (msg) {
        if (this.parent.isVisible) {
            this._update(-1, -1);
        }
    };
    /**
     * A message handler invoked on a `'fit-request'` message.
     */
    StackedLayout.prototype.onFitRequest = function (msg) {
        if (this.parent.isAttached) {
            this._fit();
        }
    };
    /**
     * Fit the layout to the total size required by the widgets.
     */
    StackedLayout.prototype._fit = function () {
        // Set up the computed minimum size.
        var minW = 0;
        var minH = 0;
        // Update the computed minimum size.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item.
            var item = this._items[i];
            // Ignore hidden items.
            if (item.isHidden) {
                continue;
            }
            // Update the size limits for the item.
            item.fit();
            // Update the computed minimum size.
            minW = Math.max(minW, item.minWidth);
            minH = Math.max(minH, item.minHeight);
        }
        // Update the box sizing and add it to the computed min size.
        var box = (this._box = ElementExt.boxSizing(this.parent.node));
        minW += box.horizontalSum;
        minH += box.verticalSum;
        // Update the parent's min size constraints.
        var style = this.parent.node.style;
        style.minWidth = minW + "px";
        style.minHeight = minH + "px";
        // Set the dirty flag to ensure only a single update occurs.
        this._dirty = true;
        // Notify the ancestor that it should fit immediately. This may
        // cause a resize of the parent, fulfilling the required update.
        if (this.parent.parent) {
            index_es6_MessageLoop.sendMessage(this.parent.parent, index_es6_Widget.Msg.FitRequest);
        }
        // If the dirty flag is still set, the parent was not resized.
        // Trigger the required update on the parent widget immediately.
        if (this._dirty) {
            index_es6_MessageLoop.sendMessage(this.parent, index_es6_Widget.Msg.UpdateRequest);
        }
    };
    /**
     * Update the layout position and size of the widgets.
     *
     * The parent offset dimensions should be `-1` if unknown.
     */
    StackedLayout.prototype._update = function (offsetWidth, offsetHeight) {
        // Clear the dirty flag to indicate the update occurred.
        this._dirty = false;
        // Compute the visible item count.
        var nVisible = 0;
        for (var i = 0, n = this._items.length; i < n; ++i) {
            nVisible += +!this._items[i].isHidden;
        }
        // Bail early if there are no visible items to layout.
        if (nVisible === 0) {
            return;
        }
        // Measure the parent if the offset dimensions are unknown.
        if (offsetWidth < 0) {
            offsetWidth = this.parent.node.offsetWidth;
        }
        if (offsetHeight < 0) {
            offsetHeight = this.parent.node.offsetHeight;
        }
        // Ensure the parent box sizing data is computed.
        if (!this._box) {
            this._box = ElementExt.boxSizing(this.parent.node);
        }
        // Compute the actual layout bounds adjusted for border and padding.
        var top = this._box.paddingTop;
        var left = this._box.paddingLeft;
        var width = offsetWidth - this._box.horizontalSum;
        var height = offsetHeight - this._box.verticalSum;
        // Update the widget stacking order and layout geometry.
        for (var i = 0, n = this._items.length; i < n; ++i) {
            // Fetch the item.
            var item = this._items[i];
            // Ignore hidden items.
            if (item.isHidden) {
                continue;
            }
            // Set the z-index for the widget.
            item.widget.node.style.zIndex = "" + i;
            // Update the item geometry.
            item.update(left, top, width, height);
        }
    };
    return StackedLayout;
}(index_es6_PanelLayout));

/**
 * A panel where visible widgets are stacked atop one another.
 *
 * #### Notes
 * This class provides a convenience wrapper around a [[StackedLayout]].
 */
var index_es6_StackedPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(StackedPanel, _super);
    /**
     * Construct a new stacked panel.
     *
     * @param options - The options for initializing the panel.
     */
    function StackedPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this, { layout: index_es6_Private$1.createLayout(options) }) || this;
        _this._widgetRemoved = new Signal(_this);
        _this.addClass('lm-StackedPanel');
        /* <DEPRECATED> */
        _this.addClass('p-StackedPanel');
        return _this;
        /* </DEPRECATED> */
    }
    Object.defineProperty(StackedPanel.prototype, "widgetRemoved", {
        /**
         * A signal emitted when a widget is removed from a stacked panel.
         */
        get: function () {
            return this._widgetRemoved;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * A message handler invoked on a `'child-added'` message.
     */
    StackedPanel.prototype.onChildAdded = function (msg) {
        msg.child.addClass('lm-StackedPanel-child');
        /* <DEPRECATED> */
        msg.child.addClass('p-StackedPanel-child');
        /* </DEPRECATED> */
    };
    /**
     * A message handler invoked on a `'child-removed'` message.
     */
    StackedPanel.prototype.onChildRemoved = function (msg) {
        msg.child.removeClass('lm-StackedPanel-child');
        /* <DEPRECATED> */
        msg.child.removeClass('p-StackedPanel-child');
        /* </DEPRECATED> */
        this._widgetRemoved.emit(msg.child);
    };
    return StackedPanel;
}(Panel));
/**
 * The namespace for the module implementation details.
 */
var index_es6_Private$1;
(function (Private) {
    /**
     * Create a stacked layout for the given panel options.
     */
    function createLayout(options) {
        return options.layout || new index_es6_StackedLayout();
    }
    Private.createLayout = createLayout;
})(index_es6_Private$1 || (index_es6_Private$1 = {}));

/**
 * A widget which combines a `TabBar` and a `StackedPanel`.
 *
 * #### Notes
 * This is a simple panel which handles the common case of a tab bar
 * placed next to a content area. The selected tab controls the widget
 * which is shown in the content area.
 *
 * For use cases which require more control than is provided by this
 * panel, the `TabBar` widget may be used independently.
 */
var index_es6_TabPanel = /** @class */ (function (_super) {
    widgets_dist_index_es6_extends(TabPanel, _super);
    /**
     * Construct a new tab panel.
     *
     * @param options - The options for initializing the tab panel.
     */
    function TabPanel(options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this) || this;
        _this._currentChanged = new Signal(_this);
        _this._addRequested = new Signal(_this);
        _this.addClass('lm-TabPanel');
        /* <DEPRECATED> */
        _this.addClass('p-TabPanel');
        /* </DEPRECATED> */
        // Create the tab bar and stacked panel.
        _this.tabBar = new index_es6_TabBar(options);
        _this.tabBar.addClass('lm-TabPanel-tabBar');
        _this.stackedPanel = new index_es6_StackedPanel();
        _this.stackedPanel.addClass('lm-TabPanel-stackedPanel');
        /* <DEPRECATED> */
        _this.tabBar.addClass('p-TabPanel-tabBar');
        _this.stackedPanel.addClass('p-TabPanel-stackedPanel');
        /* </DEPRECATED> */
        // Connect the tab bar signal handlers.
        _this.tabBar.tabMoved.connect(_this._onTabMoved, _this);
        _this.tabBar.currentChanged.connect(_this._onCurrentChanged, _this);
        _this.tabBar.tabCloseRequested.connect(_this._onTabCloseRequested, _this);
        _this.tabBar.tabActivateRequested.connect(_this._onTabActivateRequested, _this);
        _this.tabBar.addRequested.connect(_this._onTabAddRequested, _this);
        // Connect the stacked panel signal handlers.
        _this.stackedPanel.widgetRemoved.connect(_this._onWidgetRemoved, _this);
        // Get the data related to the placement.
        _this._tabPlacement = options.tabPlacement || 'top';
        var direction = widgets_dist_index_es6_Private.directionFromPlacement(_this._tabPlacement);
        var orientation = widgets_dist_index_es6_Private.orientationFromPlacement(_this._tabPlacement);
        // Configure the tab bar for the placement.
        _this.tabBar.orientation = orientation;
        _this.tabBar.dataset['placement'] = _this._tabPlacement;
        // Create the box layout.
        var layout = new index_es6_BoxLayout({ direction: direction, spacing: 0 });
        // Set the stretch factors for the child widgets.
        index_es6_BoxLayout.setStretch(_this.tabBar, 0);
        index_es6_BoxLayout.setStretch(_this.stackedPanel, 1);
        // Add the child widgets to the layout.
        layout.addWidget(_this.tabBar);
        layout.addWidget(_this.stackedPanel);
        // Install the layout on the tab panel.
        _this.layout = layout;
        return _this;
    }
    Object.defineProperty(TabPanel.prototype, "currentChanged", {
        /**
         * A signal emitted when the current tab is changed.
         *
         * #### Notes
         * This signal is emitted when the currently selected tab is changed
         * either through user or programmatic interaction.
         *
         * Notably, this signal is not emitted when the index of the current
         * tab changes due to tabs being inserted, removed, or moved. It is
         * only emitted when the actual current tab node is changed.
         */
        get: function () {
            return this._currentChanged;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "currentIndex", {
        /**
         * Get the index of the currently selected tab.
         *
         * #### Notes
         * This will be `-1` if no tab is selected.
         */
        get: function () {
            return this.tabBar.currentIndex;
        },
        /**
         * Set the index of the currently selected tab.
         *
         * #### Notes
         * If the index is out of range, it will be set to `-1`.
         */
        set: function (value) {
            this.tabBar.currentIndex = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "currentWidget", {
        /**
         * Get the currently selected widget.
         *
         * #### Notes
         * This will be `null` if there is no selected tab.
         */
        get: function () {
            var title = this.tabBar.currentTitle;
            return title ? title.owner : null;
        },
        /**
         * Set the currently selected widget.
         *
         * #### Notes
         * If the widget is not in the panel, it will be set to `null`.
         */
        set: function (value) {
            this.tabBar.currentTitle = value ? value.title : null;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "tabsMovable", {
        /**
         * Get the whether the tabs are movable by the user.
         *
         * #### Notes
         * Tabs can always be moved programmatically.
         */
        get: function () {
            return this.tabBar.tabsMovable;
        },
        /**
         * Set the whether the tabs are movable by the user.
         *
         * #### Notes
         * Tabs can always be moved programmatically.
         */
        set: function (value) {
            this.tabBar.tabsMovable = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "addButtonEnabled", {
        /**
         * Get the whether the add button is enabled.
         *
         */
        get: function () {
            return this.tabBar.addButtonEnabled;
        },
        /**
         * Set the whether the add button is enabled.
         *
         */
        set: function (value) {
            this.tabBar.addButtonEnabled = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "tabPlacement", {
        /**
         * Get the tab placement for the tab panel.
         *
         * #### Notes
         * This controls the position of the tab bar relative to the content.
         */
        get: function () {
            return this._tabPlacement;
        },
        /**
         * Set the tab placement for the tab panel.
         *
         * #### Notes
         * This controls the position of the tab bar relative to the content.
         */
        set: function (value) {
            // Bail if the placement does not change.
            if (this._tabPlacement === value) {
                return;
            }
            // Update the internal value.
            this._tabPlacement = value;
            // Get the values related to the placement.
            var direction = widgets_dist_index_es6_Private.directionFromPlacement(value);
            var orientation = widgets_dist_index_es6_Private.orientationFromPlacement(value);
            // Configure the tab bar for the placement.
            this.tabBar.orientation = orientation;
            this.tabBar.dataset['placement'] = value;
            // Update the layout direction.
            this.layout.direction = direction;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "addRequested", {
        /**
         * A signal emitted when the add button on a tab bar is clicked.
         *
         */
        get: function () {
            return this._addRequested;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TabPanel.prototype, "widgets", {
        /**
         * A read-only array of the widgets in the panel.
         */
        get: function () {
            return this.stackedPanel.widgets;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Add a widget to the end of the tab panel.
     *
     * @param widget - The widget to add to the tab panel.
     *
     * #### Notes
     * If the widget is already contained in the panel, it will be moved.
     *
     * The widget's `title` is used to populate the tab.
     */
    TabPanel.prototype.addWidget = function (widget) {
        this.insertWidget(this.widgets.length, widget);
    };
    /**
     * Insert a widget into the tab panel at a specified index.
     *
     * @param index - The index at which to insert the widget.
     *
     * @param widget - The widget to insert into to the tab panel.
     *
     * #### Notes
     * If the widget is already contained in the panel, it will be moved.
     *
     * The widget's `title` is used to populate the tab.
     */
    TabPanel.prototype.insertWidget = function (index, widget) {
        if (widget !== this.currentWidget) {
            widget.hide();
        }
        this.stackedPanel.insertWidget(index, widget);
        this.tabBar.insertTab(index, widget.title);
        widget.node.setAttribute('role', 'tabpanel');
        var renderer = this.tabBar.renderer;
        if (renderer instanceof index_es6_TabBar.Renderer) {
            var tabId = renderer.createTabKey({
                title: widget.title,
                current: false,
                zIndex: 0
            });
            widget.node.setAttribute('aria-labelledby', tabId);
        }
    };
    /**
     * Handle the `currentChanged` signal from the tab bar.
     */
    TabPanel.prototype._onCurrentChanged = function (sender, args) {
        // Extract the previous and current title from the args.
        var previousIndex = args.previousIndex, previousTitle = args.previousTitle, currentIndex = args.currentIndex, currentTitle = args.currentTitle;
        // Extract the widgets from the titles.
        var previousWidget = previousTitle ? previousTitle.owner : null;
        var currentWidget = currentTitle ? currentTitle.owner : null;
        // Hide the previous widget.
        if (previousWidget) {
            previousWidget.hide();
        }
        // Show the current widget.
        if (currentWidget) {
            currentWidget.show();
        }
        // Emit the `currentChanged` signal for the tab panel.
        this._currentChanged.emit({
            previousIndex: previousIndex,
            previousWidget: previousWidget,
            currentIndex: currentIndex,
            currentWidget: currentWidget
        });
        // Flush the message loop on IE and Edge to prevent flicker.
        if (Platform.IS_EDGE || Platform.IS_IE) {
            index_es6_MessageLoop.flush();
        }
    };
    /**
     * Handle the `tabAddRequested` signal from the tab bar.
     */
    TabPanel.prototype._onTabAddRequested = function (sender, args) {
        this._addRequested.emit(sender);
    };
    /**
     * Handle the `tabActivateRequested` signal from the tab bar.
     */
    TabPanel.prototype._onTabActivateRequested = function (sender, args) {
        args.title.owner.activate();
    };
    /**
     * Handle the `tabCloseRequested` signal from the tab bar.
     */
    TabPanel.prototype._onTabCloseRequested = function (sender, args) {
        args.title.owner.close();
    };
    /**
     * Handle the `tabMoved` signal from the tab bar.
     */
    TabPanel.prototype._onTabMoved = function (sender, args) {
        this.stackedPanel.insertWidget(args.toIndex, args.title.owner);
    };
    /**
     * Handle the `widgetRemoved` signal from the stacked panel.
     */
    TabPanel.prototype._onWidgetRemoved = function (sender, widget) {
        widget.node.removeAttribute('role');
        widget.node.removeAttribute('aria-labelledby');
        this.tabBar.removeTab(widget.title);
    };
    return TabPanel;
}(index_es6_Widget));
/**
 * The namespace for the module implementation details.
 */
var widgets_dist_index_es6_Private;
(function (Private) {
    /**
     * Convert a tab placement to tab bar orientation.
     */
    function orientationFromPlacement(plc) {
        return placementToOrientationMap[plc];
    }
    Private.orientationFromPlacement = orientationFromPlacement;
    /**
     * Convert a tab placement to a box layout direction.
     */
    function directionFromPlacement(plc) {
        return placementToDirectionMap[plc];
    }
    Private.directionFromPlacement = directionFromPlacement;
    /**
     * A mapping of tab placement to tab bar orientation.
     */
    var placementToOrientationMap = {
        top: 'horizontal',
        left: 'vertical',
        right: 'vertical',
        bottom: 'horizontal'
    };
    /**
     * A mapping of tab placement to box layout direction.
     */
    var placementToDirectionMap = {
        top: 'top-to-bottom',
        left: 'left-to-right',
        right: 'right-to-left',
        bottom: 'bottom-to-top'
    };
})(widgets_dist_index_es6_Private || (widgets_dist_index_es6_Private = {}));


//# sourceMappingURL=index.es6.js.map

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/widget.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var widget_extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var widget_assign = (undefined && undefined.__assign) || function () {
    widget_assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return widget_assign.apply(this, arguments);
};








/**
 * Replace model ids with models recursively.
 */
function unpack_models(value, manager) {
    if (Array.isArray(value)) {
        var unpacked_1 = [];
        value.forEach(function (sub_value, key) {
            unpacked_1.push(unpack_models(sub_value, manager));
        });
        return Promise.all(unpacked_1);
    }
    else if (value instanceof Object) {
        var unpacked_2 = {};
        Object.keys(value).forEach(function (key) {
            unpacked_2[key] = unpack_models(value[key], manager);
        });
        return resolvePromisesDict(unpacked_2);
    }
    else if (typeof value === 'string' && value.slice(0, 10) === 'IPY_MODEL_') {
        // get_model returns a promise already
        return manager.get_model(value.slice(10, value.length));
    }
    else {
        return Promise.resolve(value);
    }
}
var widget_WidgetModel = /** @class */ (function (_super) {
    widget_extends(WidgetModel, _super);
    function WidgetModel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * The default attributes.
     */
    WidgetModel.prototype.defaults = function () {
        return {
            _model_module: '@jupyter-widgets/base',
            _model_name: 'WidgetModel',
            _model_module_version: JUPYTER_WIDGETS_VERSION,
            _view_module: '@jupyter-widgets/base',
            _view_name: null,
            _view_module_version: JUPYTER_WIDGETS_VERSION,
            _view_count: null,
        };
    };
    /**
     * Test to see if the model has been synced with the server.
     *
     * #### Notes
     * As of backbone 1.1, backbone ignores `patch` if it thinks the
     * model has never been pushed.
     */
    WidgetModel.prototype.isNew = function () {
        return false;
    };
    /**
     * Constructor
     *
     * Initializes a WidgetModel instance. Called by the Backbone constructor.
     *
     * Parameters
     * ----------
     * widget_manager : WidgetManager instance
     * model_id : string
     *      An ID unique to this model.
     * comm : Comm instance (optional)
     */
    WidgetModel.prototype.initialize = function (attributes, options) {
        _super.prototype.initialize.call(this, attributes, options);
        // Attributes should be initialized here, since user initialization may depend on it
        this.widget_manager = options.widget_manager;
        this.model_id = options.model_id;
        var comm = options.comm;
        this.views = Object.create(null);
        this.state_change = Promise.resolve();
        this._closed = false;
        this._state_lock = null;
        this._msg_buffer = null;
        this._msg_buffer_callbacks = null;
        this._pending_msgs = 0;
        // _buffered_state_diff must be created *after* the super.initialize
        // call above. See the note in the set() method below.
        this._buffered_state_diff = {};
        if (comm) {
            // Remember comm associated with the model.
            this.comm = comm;
            // Hook comm messages up to model.
            comm.on_close(this._handle_comm_closed.bind(this));
            comm.on_msg(this._handle_comm_msg.bind(this));
            this.comm_live = true;
        }
        else {
            this.comm_live = false;
        }
    };
    Object.defineProperty(WidgetModel.prototype, "comm_live", {
        get: function () {
            return this._comm_live;
        },
        set: function (x) {
            this._comm_live = x;
            this.trigger('comm_live_update');
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Send a custom msg over the comm.
     */
    WidgetModel.prototype.send = function (content, callbacks, buffers) {
        if (this.comm !== undefined) {
            var data = { method: 'custom', content: content };
            this.comm.send(data, callbacks, {}, buffers);
        }
    };
    /**
     * Close model
     *
     * @param comm_closed - true if the comm is already being closed. If false, the comm will be closed.
     *
     * @returns - a promise that is fulfilled when all the associated views have been removed.
     */
    WidgetModel.prototype.close = function (comm_closed) {
        var _this = this;
        if (comm_closed === void 0) { comm_closed = false; }
        // can only be closed once.
        if (this._closed) {
            return;
        }
        this._closed = true;
        if (this.comm && !comm_closed) {
            this.comm.close();
        }
        this.stopListening();
        this.trigger('destroy', this);
        if (this.comm) {
            delete this.comm;
        }
        // Delete all views of this model
        var views = Object.keys(this.views).map(function (id) {
            return _this.views[id].then(function (view) { return view.remove(); });
        });
        delete this.views;
        return Promise.all(views).then(function () { return; });
    };
    /**
     * Handle when a widget comm is closed.
     */
    WidgetModel.prototype._handle_comm_closed = function (msg) {
        this.trigger('comm:close');
        this.close(true);
    };
    /**
     * Handle incoming comm msg.
     */
    WidgetModel.prototype._handle_comm_msg = function (msg) {
        var _this = this;
        var data = msg.content.data;
        var method = data.method;
        // tslint:disable-next-line:switch-default
        switch (method) {
            case 'update':
                this.state_change = this.state_change
                    .then(function () {
                    var state = data.state;
                    var buffer_paths = data.buffer_paths || [];
                    // Make sure the buffers are DataViews
                    var buffers = (msg.buffers || []).map(function (b) {
                        if (b instanceof DataView) {
                            return b;
                        }
                        else {
                            return new DataView(b instanceof ArrayBuffer ? b : b.buffer);
                        }
                    });
                    put_buffers(state, buffer_paths, buffers);
                    return _this.constructor._deserialize_state(state, _this.widget_manager);
                }).then(function (state) {
                    _this.set_state(state);
                }).catch(reject("Could not process update msg for model id: " + this.model_id, true));
                return this.state_change;
            case 'custom':
                this.trigger('msg:custom', data.content, msg.buffers);
                return Promise.resolve();
        }
    };
    /**
     * Handle when a widget is updated from the backend.
     *
     * This function is meant for internal use only. Values set here will not be propagated on a sync.
     */
    WidgetModel.prototype.set_state = function (state) {
        this._state_lock = state;
        try {
            this.set(state);
        }
        catch (e) {
            console.error("Error setting state: " + e.message);
        }
        finally {
            this._state_lock = null;
        }
    };
    /**
     * Get the serializable state of the model.
     *
     * If drop_default is truthy, attributes that are equal to their default
     * values are dropped.
     */
    WidgetModel.prototype.get_state = function (drop_defaults) {
        var fullState = this.attributes;
        if (drop_defaults) {
            // if defaults is a function, call it
            var d = this.defaults;
            var defaults_1 = (typeof d === 'function') ? d.call(this) : d;
            var state_1 = {};
            Object.keys(fullState).forEach(function (key) {
                if (!(utils_isEqual(fullState[key], defaults_1[key]))) {
                    state_1[key] = fullState[key];
                }
            });
            return state_1;
        }
        else {
            return widget_assign({}, fullState);
        }
    };
    /**
     * Handle status msgs.
     *
     * execution_state : ('busy', 'idle', 'starting')
     */
    WidgetModel.prototype._handle_status = function (msg) {
        if (this.comm !== void 0) {
            if (msg.content.execution_state === 'idle') {
                this._pending_msgs--;
                // Send buffer if one is waiting and we are below the throttle.
                if (this._msg_buffer !== null
                    && this._pending_msgs < 1) {
                    this.send_sync_message(this._msg_buffer, this._msg_buffer_callbacks);
                    this._msg_buffer = null;
                    this._msg_buffer_callbacks = null;
                }
            }
        }
    };
    /**
     * Create msg callbacks for a comm msg.
     */
    WidgetModel.prototype.callbacks = function (view) {
        return this.widget_manager.callbacks(view);
    };
    /**
     * Set one or more values.
     *
     * We just call the super method, in which val and options are optional.
     * Handles both "key", value and {key: value} -style arguments.
     */
    WidgetModel.prototype.set = function (key, val, options) {
        // Call our patched backbone set. See #1642 and #1643.
        var return_value = backbone_patch_set.call(this, key, val, options);
        // Backbone only remembers the diff of the most recent set()
        // operation.  Calling set multiple times in a row results in a
        // loss of change information.  Here we keep our own running diff.
        //
        // We don't buffer the state set in the constructor (including
        // defaults), so we first check to see if we've initialized _buffered_state_diff.
        // which happens after the constructor sets attributes at creation.
        if (this._buffered_state_diff !== void 0) {
            var attrs = this.changedAttributes() || {};
            // The state_lock lists attributes that are currently being changed
            // right now from a kernel message. We don't want to send these
            // non-changes back to the kernel, so we delete them out of attrs if
            // they haven't changed from their state_lock value.
            // The state lock could be null or undefined (if set is being called from
            // the initializer).
            if (this._state_lock) {
                for (var _i = 0, _a = Object.keys(this._state_lock); _i < _a.length; _i++) {
                    var key_1 = _a[_i];
                    if (attrs[key_1] === this._state_lock[key_1]) {
                        delete attrs[key_1];
                    }
                }
            }
            this._buffered_state_diff = utils_assign(this._buffered_state_diff, attrs);
        }
        return return_value;
    };
    /**
     * Handle sync to the back-end.  Called when a model.save() is called.
     *
     * Make sure a comm exists.
     *
     * Parameters
     * ----------
     * method : create, update, patch, delete, read
     *   create/update always send the full attribute set
     *   patch - only send attributes listed in options.attrs, and if we
     *   are queuing up messages, combine with previous messages that have
     *   not been sent yet
     * model : the model we are syncing
     *   will normally be the same as `this`
     * options : dict
     *   the `attrs` key, if it exists, gives an {attr: value} dict that
     *   should be synced, otherwise, sync all attributes.
     *
     */
    WidgetModel.prototype.sync = function (method, model, options) {
        if (options === void 0) { options = {}; }
        // the typing is to return `any` since the super.sync method returns a JqXHR, but we just return false if there is an error.
        if (this.comm === undefined) {
            throw 'Syncing error: no comm channel defined';
        }
        var attrs = (method === 'patch') ? options.attrs : model.get_state(options.drop_defaults);
        // The state_lock lists attributes that are currently being changed
        // right now from a kernel message. We don't want to send these
        // non-changes back to the kernel, so we delete them out of attrs if
        // they haven't changed from their state_lock value.
        // The state lock could be null or undefined (if this is triggered
        // from the initializer).
        if (this._state_lock) {
            for (var _i = 0, _a = Object.keys(this._state_lock); _i < _a.length; _i++) {
                var key = _a[_i];
                if (attrs[key] === this._state_lock[key]) {
                    delete attrs[key];
                }
            }
        }
        var msgState = this.serialize(attrs);
        if (Object.keys(msgState).length > 0) {
            // If this message was sent via backbone itself, it will not
            // have any callbacks.  It's important that we create callbacks
            // so we can listen for status messages, etc...
            var callbacks = options.callbacks || this.callbacks();
            // Check throttle.
            if (this._pending_msgs >= 1) {
                // The throttle has been exceeded, buffer the current msg so
                // it can be sent once the kernel has finished processing
                // some of the existing messages.
                // Combine updates if it is a 'patch' sync, otherwise replace updates
                switch (method) {
                    case 'patch':
                        this._msg_buffer = utils_assign(this._msg_buffer || {}, msgState);
                        break;
                    case 'update':
                    case 'create':
                        this._msg_buffer = msgState;
                        break;
                    default:
                        throw 'unrecognized syncing method';
                }
                this._msg_buffer_callbacks = callbacks;
            }
            else {
                // We haven't exceeded the throttle, send the message like
                // normal.
                this.send_sync_message(attrs, callbacks);
                // Since the comm is a one-way communication, assume the message
                // arrived and was processed successfully.
                // Don't call options.success since we don't have a model back from
                // the server. Note that this means we don't have the Backbone
                // 'sync' event.
            }
        }
    };
    /**
     * Serialize widget state.
     *
     * A serializer is a function which takes in a state attribute and a widget,
     * and synchronously returns a JSONable object. The returned object will
     * have toJSON called if possible, and the final result should be a
     * primitive object that is a snapshot of the widget state that may have
     * binary array buffers.
     */
    WidgetModel.prototype.serialize = function (state) {
        var serializers = this.constructor.serializers || {};
        for (var _i = 0, _a = Object.keys(state); _i < _a.length; _i++) {
            var k = _a[_i];
            try {
                if (serializers[k] && serializers[k].serialize) {
                    state[k] = (serializers[k].serialize)(state[k], this);
                }
                else {
                    // the default serializer just deep-copies the object
                    state[k] = JSON.parse(JSON.stringify(state[k]));
                }
                if (state[k] && state[k].toJSON) {
                    state[k] = state[k].toJSON();
                }
            }
            catch (e) {
                console.error('Error serializing widget state attribute: ', k);
                throw e;
            }
        }
        return state;
    };
    /**
     * Send a sync message to the kernel.
     */
    WidgetModel.prototype.send_sync_message = function (state, callbacks) {
        var _this = this;
        if (callbacks === void 0) { callbacks = {}; }
        try {
            callbacks.iopub = callbacks.iopub || {};
            var statuscb_1 = callbacks.iopub.status;
            callbacks.iopub.status = function (msg) {
                _this._handle_status(msg);
                if (statuscb_1) {
                    statuscb_1(msg);
                }
            };
            // split out the binary buffers
            var split = remove_buffers(state);
            this.comm.send({
                method: 'update',
                state: split.state,
                buffer_paths: split.buffer_paths
            }, callbacks, {}, split.buffers);
            this._pending_msgs++;
        }
        catch (e) {
            console.error('Could not send widget sync message', e);
        }
    };
    /**
     * Push this model's state to the back-end
     *
     * This invokes a Backbone.Sync.
     */
    WidgetModel.prototype.save_changes = function (callbacks) {
        if (this.comm_live) {
            var options = { patch: true };
            if (callbacks) {
                options.callbacks = callbacks;
            }
            this.save(this._buffered_state_diff, options);
            this._buffered_state_diff = {};
        }
    };
    /**
     * on_some_change(['key1', 'key2'], foo, context) differs from
     * on('change:key1 change:key2', foo, context).
     * If the widget attributes key1 and key2 are both modified,
     * the second form will result in foo being called twice
     * while the first will call foo only once.
     */
    WidgetModel.prototype.on_some_change = function (keys, callback, context) {
        var scope = this;
        this.on('change', function () {
            if (keys.some(scope.hasChanged, scope)) {
                callback.apply(context, arguments);
            }
        }, this);
    };
    /**
     * Serialize the model.  See the deserialization function at the top of this file
     * and the kernel-side serializer/deserializer.
     */
    WidgetModel.prototype.toJSON = function (options) {
        return "IPY_MODEL_" + this.model_id;
    };
    /**
     * Returns a promise for the deserialized state. The second argument
     * is an instance of widget manager, which is required for the
     * deserialization of widget models.
     */
    WidgetModel._deserialize_state = function (state, manager) {
        var serializers = this.serializers;
        var deserialized;
        if (serializers) {
            deserialized = {};
            for (var k in state) {
                if (serializers[k] && serializers[k].deserialize) {
                    deserialized[k] = (serializers[k].deserialize)(state[k], manager);
                }
                else {
                    deserialized[k] = state[k];
                }
            }
        }
        else {
            deserialized = state;
        }
        return resolvePromisesDict(deserialized);
    };
    return WidgetModel;
}(backbone["Model"]));

var widget_DOMWidgetModel = /** @class */ (function (_super) {
    widget_extends(DOMWidgetModel, _super);
    function DOMWidgetModel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DOMWidgetModel.prototype.defaults = function () {
        return utils_assign(_super.prototype.defaults.call(this), {
            _dom_classes: []
            // We do not declare defaults for the layout and style attributes.
            // Those defaults are constructed on the kernel side and synced here
            // as needed, and our code here copes with those attributes being
            // undefined. See
            // https://github.com/jupyter-widgets/ipywidgets/issues/1620 and
            // https://github.com/jupyter-widgets/ipywidgets/pull/1621
        });
    };
    DOMWidgetModel.serializers = widget_assign(widget_assign({}, widget_WidgetModel.serializers), { layout: { deserialize: unpack_models }, style: { deserialize: unpack_models } });
    return DOMWidgetModel;
}(widget_WidgetModel));

var widget_WidgetView = /** @class */ (function (_super) {
    widget_extends(WidgetView, _super);
    /**
     * Public constructor.
     */
    function WidgetView(options) {
        return _super.call(this, options) || this;
    }
    /**
     * Initializer, called at the end of the constructor.
     */
    WidgetView.prototype.initialize = function (parameters) {
        var _this = this;
        this.listenTo(this.model, 'change', function () {
            var changed = Object.keys(_this.model.changedAttributes() || {});
            if (changed[0] === '_view_count' && changed.length === 1) {
                // Just the view count was updated
                return;
            }
            _this.update();
        });
        this.options = parameters.options;
        this.once('remove', function () {
            if (typeof (_this.model.get('_view_count')) === 'number') {
                _this.model.set('_view_count', _this.model.get('_view_count') - 1);
                _this.model.save_changes();
            }
        });
        this.once('displayed', function () {
            if (typeof (_this.model.get('_view_count')) === 'number') {
                _this.model.set('_view_count', _this.model.get('_view_count') + 1);
                _this.model.save_changes();
            }
        });
        this.displayed = new Promise(function (resolve, reject) {
            _this.once('displayed', resolve);
        });
    };
    /**
     * Triggered on model change.
     *
     * Update view to be consistent with this.model
     */
    WidgetView.prototype.update = function (options) {
        return;
    };
    /**
     * Render a view
     *
     * @returns the view or a promise to the view.
     */
    WidgetView.prototype.render = function () {
        return;
    };
    /**
     * Create and promise that resolves to a child view of a given model
     */
    WidgetView.prototype.create_child_view = function (child_model, options) {
        if (options === void 0) { options = {}; }
        options = widget_assign({ parent: this }, options);
        return this.model.widget_manager.create_view(child_model, options)
            .catch(reject('Could not create child view', true));
    };
    /**
     * Create msg callbacks for a comm msg.
     */
    WidgetView.prototype.callbacks = function () {
        return this.model.callbacks(this);
    };
    /**
     * Send a custom msg associated with this view.
     */
    WidgetView.prototype.send = function (content, buffers) {
        this.model.send(content, this.callbacks(), buffers);
    };
    WidgetView.prototype.touch = function () {
        this.model.save_changes(this.callbacks());
    };
    WidgetView.prototype.remove = function () {
        // Raise a remove event when the view is removed.
        _super.prototype.remove.call(this);
        this.trigger('remove');
        return this;
    };
    return WidgetView;
}(NativeView));

var JupyterPhosphorWidget = /** @class */ (function (_super) {
    widget_extends(JupyterPhosphorWidget, _super);
    function JupyterPhosphorWidget(options) {
        var _this = this;
        var view = options.view;
        delete options.view;
        _this = _super.call(this, options) || this;
        _this._view = view;
        return _this;
    }
    /**
     * Dispose the widget.
     *
     * This causes the view to be destroyed as well with 'remove'
     */
    JupyterPhosphorWidget.prototype.dispose = function () {
        if (this.isDisposed) {
            return;
        }
        _super.prototype.dispose.call(this);
        if (this._view) {
            this._view.remove();
        }
        this._view = null;
    };
    /**
     * Process the phosphor message.
     *
     * Any custom phosphor widget used inside a Jupyter widget should override
     * the processMessage function like this.
     */
    JupyterPhosphorWidget.prototype.processMessage = function (msg) {
        _super.prototype.processMessage.call(this, msg);
        this._view.processPhosphorMessage(msg);
    };
    return JupyterPhosphorWidget;
}(index_es6_Widget));

var JupyterPhosphorPanelWidget = /** @class */ (function (_super) {
    widget_extends(JupyterPhosphorPanelWidget, _super);
    function JupyterPhosphorPanelWidget(options) {
        var _this = this;
        var view = options.view;
        delete options.view;
        _this = _super.call(this, options) || this;
        _this._view = view;
        return _this;
    }
    /**
     * Process the phosphor message.
     *
     * Any custom phosphor widget used inside a Jupyter widget should override
     * the processMessage function like this.
     */
    JupyterPhosphorPanelWidget.prototype.processMessage = function (msg) {
        _super.prototype.processMessage.call(this, msg);
        this._view.processPhosphorMessage(msg);
    };
    /**
     * Dispose the widget.
     *
     * This causes the view to be destroyed as well with 'remove'
     */
    JupyterPhosphorPanelWidget.prototype.dispose = function () {
        if (this.isDisposed) {
            return;
        }
        _super.prototype.dispose.call(this);
        if (this._view) {
            this._view.remove();
        }
        this._view = null;
    };
    return JupyterPhosphorPanelWidget;
}(Panel));

var widget_DOMWidgetView = /** @class */ (function (_super) {
    widget_extends(DOMWidgetView, _super);
    function DOMWidgetView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Public constructor
     */
    DOMWidgetView.prototype.initialize = function (parameters) {
        var _this = this;
        _super.prototype.initialize.call(this, parameters);
        this.listenTo(this.model, 'change:_dom_classes', function (model, new_classes) {
            var old_classes = model.previous('_dom_classes');
            _this.update_classes(old_classes, new_classes);
        });
        this.layoutPromise = Promise.resolve();
        this.listenTo(this.model, 'change:layout', function (model, value) {
            _this.setLayout(value, model.previous('layout'));
        });
        this.stylePromise = Promise.resolve();
        this.listenTo(this.model, 'change:style', function (model, value) {
            _this.setStyle(value, model.previous('style'));
        });
        this.displayed.then(function () {
            _this.update_classes([], _this.model.get('_dom_classes'));
            _this.setLayout(_this.model.get('layout'));
            _this.setStyle(_this.model.get('style'));
        });
        this._comm_live_update();
        this.listenTo(this.model, 'comm_live_update', function () {
            _this._comm_live_update();
        });
    };
    DOMWidgetView.prototype.setLayout = function (layout, oldLayout) {
        var _this = this;
        if (layout) {
            this.layoutPromise = this.layoutPromise.then(function (oldLayoutView) {
                if (oldLayoutView) {
                    oldLayoutView.unlayout();
                    _this.stopListening(oldLayoutView.model);
                    oldLayoutView.remove();
                }
                return _this.create_child_view(layout).then(function (view) {
                    // Trigger the displayed event of the child view.
                    return _this.displayed.then(function () {
                        view.trigger('displayed');
                        _this.listenTo(view.model, 'change', function () {
                            // Post (asynchronous) so layout changes can take
                            // effect first.
                            index_es6_MessageLoop.postMessage(_this.pWidget, index_es6_Widget.ResizeMessage.UnknownSize);
                        });
                        index_es6_MessageLoop.postMessage(_this.pWidget, index_es6_Widget.ResizeMessage.UnknownSize);
                        return view;
                    });
                }).catch(reject('Could not add LayoutView to DOMWidgetView', true));
            });
        }
    };
    DOMWidgetView.prototype.setStyle = function (style, oldStyle) {
        var _this = this;
        if (style) {
            this.stylePromise = this.stylePromise.then(function (oldStyleView) {
                if (oldStyleView) {
                    oldStyleView.unstyle();
                    _this.stopListening(oldStyleView.model);
                    oldStyleView.remove();
                }
                return _this.create_child_view(style).then(function (view) {
                    // Trigger the displayed event of the child view.
                    return _this.displayed.then(function () {
                        view.trigger('displayed');
                        // Unlike for the layout attribute, style changes don't
                        // trigger phosphor resize messages.
                        return view;
                    });
                }).catch(reject('Could not add styleView to DOMWidgetView', true));
            });
        }
    };
    /**
     * Update the DOM classes applied to an element, default to this.el.
     */
    DOMWidgetView.prototype.update_classes = function (old_classes, new_classes, el) {
        if (el === undefined) {
            el = this.el;
        }
        difference(old_classes, new_classes).map(function (c) {
            if (el.classList) { // classList is not supported by IE for svg elements
                el.classList.remove(c);
            }
            else {
                el.setAttribute('class', el.getAttribute('class').replace(c, ''));
            }
        });
        difference(new_classes, old_classes).map(function (c) {
            if (el.classList) { // classList is not supported by IE for svg elements
                el.classList.add(c);
            }
            else {
                el.setAttribute('class', el.getAttribute('class').concat(' ', c));
            }
        });
    };
    /**
     * Update the DOM classes applied to the widget based on a single
     * trait's value.
     *
     * Given a trait value classes map, this function automatically
     * handles applying the appropriate classes to the widget element
     * and removing classes that are no longer valid.
     *
     * Parameters
     * ----------
     * class_map: dictionary
     *  Dictionary of trait values to class lists.
     *  Example:
     *      {
     *          success: ['alert', 'alert-success'],
     *          info: ['alert', 'alert-info'],
     *          warning: ['alert', 'alert-warning'],
     *          danger: ['alert', 'alert-danger']
     *      };
     * trait_name: string
     *  Name of the trait to check the value of.
     * el: optional DOM element handle, defaults to this.el
     *  Element that the classes are applied to.
     */
    DOMWidgetView.prototype.update_mapped_classes = function (class_map, trait_name, el) {
        var key = this.model.previous(trait_name);
        var old_classes = class_map[key] ? class_map[key] : [];
        key = this.model.get(trait_name);
        var new_classes = class_map[key] ? class_map[key] : [];
        this.update_classes(old_classes, new_classes, el || this.el);
    };
    DOMWidgetView.prototype.set_mapped_classes = function (class_map, trait_name, el) {
        var key = this.model.get(trait_name);
        var new_classes = class_map[key] ? class_map[key] : [];
        this.update_classes([], new_classes, el || this.el);
    };
    DOMWidgetView.prototype._setElement = function (el) {
        if (this.pWidget) {
            this.pWidget.dispose();
        }
        this.$el = el instanceof jquery_default.a ? el : jquery_default()(el);
        this.el = this.$el[0];
        this.pWidget = new JupyterPhosphorWidget({
            node: el,
            view: this
        });
    };
    DOMWidgetView.prototype.remove = function () {
        if (this.pWidget) {
            this.pWidget.dispose();
        }
        return _super.prototype.remove.call(this);
    };
    DOMWidgetView.prototype.processPhosphorMessage = function (msg) {
        // tslint:disable-next-line:switch-default
        switch (msg.type) {
            case 'after-attach':
                this.trigger('displayed');
                break;
        }
    };
    DOMWidgetView.prototype._comm_live_update = function () {
        if (this.model.comm_live) {
            this.pWidget.removeClass('jupyter-widgets-disconnected');
        }
        else {
            this.pWidget.addClass('jupyter-widgets-disconnected');
        }
    };
    return DOMWidgetView;
}(widget_WidgetView));


// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/widget_layout.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var widget_layout_extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


/**
 * css properties exposed by the layout widget with their default values.
 */
var css_properties = {
    align_content: null,
    align_items: null,
    align_self: null,
    border: null,
    bottom: null,
    display: null,
    flex: null,
    flex_flow: null,
    height: null,
    justify_content: null,
    justify_items: null,
    left: null,
    margin: null,
    max_height: null,
    max_width: null,
    min_height: null,
    min_width: null,
    overflow: null,
    overflow_x: null,
    overflow_y: null,
    order: null,
    padding: null,
    right: null,
    top: null,
    visibility: null,
    width: null,
    // image-specific
    object_fit: null,
    object_position: null,
    // container
    grid_auto_columns: null,
    grid_auto_flow: null,
    grid_auto_rows: null,
    grid_gap: null,
    grid_template_rows: null,
    grid_template_columns: null,
    grid_template_areas: null,
    // items
    grid_row: null,
    grid_column: null,
    grid_area: null
};
var widget_layout_LayoutModel = /** @class */ (function (_super) {
    widget_layout_extends(LayoutModel, _super);
    function LayoutModel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LayoutModel.prototype.defaults = function () {
        return utils_assign(_super.prototype.defaults.call(this), {
            _model_name: 'LayoutModel',
            _view_name: 'LayoutView'
        }, css_properties);
    };
    return LayoutModel;
}(widget_WidgetModel));

var LayoutView = /** @class */ (function (_super) {
    widget_layout_extends(LayoutView, _super);
    function LayoutView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Public constructor
     */
    LayoutView.prototype.initialize = function (parameters) {
        this._traitNames = [];
        _super.prototype.initialize.call(this, parameters);
        // Register the traits that live on the Python side
        for (var _i = 0, _a = Object.keys(css_properties); _i < _a.length; _i++) {
            var key = _a[_i];
            this.registerTrait(key);
        }
    };
    /**
     * Register a CSS trait that is known by the model
     * @param trait
     */
    LayoutView.prototype.registerTrait = function (trait) {
        var _this = this;
        this._traitNames.push(trait);
        // Treat overflow_x and overflow_y as a special case since they are deprecated
        // and interact in special ways with the overflow attribute.
        if (trait === 'overflow_x' || trait === 'overflow_y') {
            // Listen to changes, and set the value on change.
            this.listenTo(this.model, 'change:' + trait, function (model, value) {
                _this.handleOverflowChange(trait, value);
            });
            // Set the initial value on display.
            this.handleOverflowChange(trait, this.model.get(trait));
            return;
        }
        // Listen to changes, and set the value on change.
        this.listenTo(this.model, 'change:' + trait, function (model, value) {
            _this.handleChange(trait, value);
        });
        // Set the initial value on display.
        this.handleChange(trait, this.model.get(trait));
    };
    /**
     * Get the the name of the css property from the trait name
     * @param  model attribute name
     * @return css property name
     */
    LayoutView.prototype.css_name = function (trait) {
        return trait.replace(/_/g, '-');
    };
    /**
     * Handles when a trait value changes
     */
    LayoutView.prototype.handleChange = function (trait, value) {
        // should be synchronous so that we can measure later.
        var parent = this.options.parent;
        if (parent) {
            if (value === null) {
                parent.el.style.removeProperty(this.css_name(trait));
            }
            else {
                parent.el.style[this.css_name(trait)] = value;
            }
        }
        else {
            console.warn('Style not applied because a parent view does not exist');
        }
    };
    /**
     * Handles when the value of overflow_x or overflow_y changes
     */
    LayoutView.prototype.handleOverflowChange = function (trait, value) {
        // This differs from the default handleChange method
        // in that setting `overflow_x` or `overflow_y` to null
        // when `overflow` is null removes the attribute.
        var parent = this.options.parent;
        if (parent) {
            if (value === null) {
                if (this.model.get('overflow') === null) {
                    parent.el.style.removeProperty(this.css_name(trait));
                }
            }
            else {
                parent.el.style[this.css_name(trait)] = value;
            }
        }
        else {
            console.warn('Style not applied because a parent view does not exist');
        }
    };
    /**
     * Remove the styling from the parent view.
     */
    LayoutView.prototype.unlayout = function () {
        var _this = this;
        var parent = this.options.parent;
        this._traitNames.forEach(function (trait) {
            if (parent) {
                parent.el.style.removeProperty(_this.css_name(trait));
            }
            else {
                console.warn('Style not removed because a parent view does not exist');
            }
        }, this);
    };
    return LayoutView;
}(widget_WidgetView));


// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/widget_style.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var widget_style_extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


var widget_style_StyleModel = /** @class */ (function (_super) {
    widget_style_extends(StyleModel, _super);
    function StyleModel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StyleModel.prototype.defaults = function () {
        var Derived = this.constructor;
        return utils_assign(_super.prototype.defaults.call(this), {
            _model_name: 'StyleModel',
            _view_name: 'StyleView',
        }, Object.keys(Derived.styleProperties).reduce(function (obj, key) {
            obj[key] = Derived.styleProperties[key].default;
            return obj;
        }, {}));
    };
    StyleModel.styleProperties = {};
    return StyleModel;
}(widget_WidgetModel));

var StyleView = /** @class */ (function (_super) {
    widget_style_extends(StyleView, _super);
    function StyleView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Public constructor
     */
    StyleView.prototype.initialize = function (parameters) {
        this._traitNames = [];
        _super.prototype.initialize.call(this, parameters);
        // Register the traits that live on the Python side
        var ModelType = this.model.constructor;
        for (var _i = 0, _a = Object.keys(ModelType.styleProperties); _i < _a.length; _i++) {
            var key = _a[_i];
            this.registerTrait(key);
        }
        // Set the initial styles
        this.style();
    };
    /**
     * Register a CSS trait that is known by the model
     * @param trait
     */
    StyleView.prototype.registerTrait = function (trait) {
        var _this = this;
        this._traitNames.push(trait);
        // Listen to changes, and set the value on change.
        this.listenTo(this.model, 'change:' + trait, function (model, value) {
            _this.handleChange(trait, value);
        });
    };
    /**
     * Handles when a trait value changes
     */
    StyleView.prototype.handleChange = function (trait, value) {
        // should be synchronous so that we can measure later.
        var parent = this.options.parent;
        if (parent) {
            var ModelType = this.model.constructor;
            var styleProperties = ModelType.styleProperties;
            var attribute = styleProperties[trait].attribute;
            var selector = styleProperties[trait].selector;
            var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el];
            if (value === null) {
                for (var i = 0; i !== elements.length; ++i) {
                    elements[i].style.removeProperty(attribute);
                }
            }
            else {
                for (var i = 0; i !== elements.length; ++i) {
                    elements[i].style[attribute] = value;
                }
            }
        }
        else {
            console.warn('Style not applied because a parent view does not exist');
        }
    };
    /**
     * Apply styles for all registered traits
     */
    StyleView.prototype.style = function () {
        for (var _i = 0, _a = this._traitNames; _i < _a.length; _i++) {
            var trait = _a[_i];
            this.handleChange(trait, this.model.get(trait));
        }
    };
    /**
     * Remove the styling from the parent view.
     */
    StyleView.prototype.unstyle = function () {
        var parent = this.options.parent;
        var ModelType = this.model.constructor;
        var styleProperties = ModelType.styleProperties;
        this._traitNames.forEach(function (trait) {
            if (parent) {
                var attribute = styleProperties[trait].attribute;
                var selector = styleProperties[trait].selector;
                var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el];
                for (var i = 0; i !== elements.length; ++i) {
                    elements[i].style.removeProperty(attribute);
                }
            }
            else {
                console.warn('Style not removed because a parent view does not exist');
            }
        }, this);
    };
    return StyleView;
}(widget_WidgetView));


// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/services-shim.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var services_shim_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var services_shim_generator = (undefined && undefined.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var shims;
(function (shims) {
    var services;
    (function (services) {
        /**
         * Public constructor
         * @param jsServicesKernel - @jupyterlab/services Kernel.IKernel instance
         */
        var CommManager = /** @class */ (function () {
            function CommManager(jsServicesKernel) {
                this.targets = Object.create(null);
                this.comms = Object.create(null);
                this.kernel = null;
                this.jsServicesKernel = null;
                this.init_kernel(jsServicesKernel);
            }
            /**
             * Hookup kernel events.
             * @param  {Kernel.IKernel} jsServicesKernel - @jupyterlab/services Kernel.IKernel instance
             */
            CommManager.prototype.init_kernel = function (jsServicesKernel) {
                this.kernel = jsServicesKernel; // These aren't really the same.
                this.jsServicesKernel = jsServicesKernel;
            };
            /**
             * Creates a new connected comm
             */
            CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id, buffers) {
                return services_shim_awaiter(this, void 0, void 0, function () {
                    var c, comm;
                    return services_shim_generator(this, function (_a) {
                        c = this.jsServicesKernel.createComm(target_name, comm_id);
                        comm = new Comm(c);
                        this.register_comm(comm);
                        comm.open(data, callbacks, metadata, buffers);
                        return [2 /*return*/, comm];
                    });
                });
            };
            /**
             * Register a comm target
             * @param  {string} target_name
             * @param  {(Comm, object) => void} f - callback that is called when the
             *                         comm is made.  Signature of f(comm, msg).
             */
            CommManager.prototype.register_target = function (target_name, f) {
                var _this = this;
                var handle = this.jsServicesKernel.registerCommTarget(target_name, function (jsServicesComm, msg) {
                    // Create the comm.
                    var comm = new Comm(jsServicesComm);
                    _this.register_comm(comm);
                    // Call the callback for the comm.
                    try {
                        return f(comm, msg);
                    }
                    catch (e) {
                        comm.close();
                        console.error(e);
                        console.error(new Error('Exception opening new comm'));
                    }
                });
                this.targets[target_name] = handle;
            };
            /**
             * Unregisters a comm target
             * @param  {string} target_name
             */
            CommManager.prototype.unregister_target = function (target_name, f) {
                var handle = this.targets[target_name];
                handle.dispose();
                delete this.targets[target_name];
            };
            /**
             * Register a comm in the mapping
             */
            CommManager.prototype.register_comm = function (comm) {
                this.comms[comm.comm_id] = Promise.resolve(comm);
                comm.kernel = this.kernel;
                return comm.comm_id;
            };
            return CommManager;
        }());
        services.CommManager = CommManager;
        /**
         * Public constructor
         * @param  {IComm} jsServicesComm - @jupyterlab/services IComm instance
         */
        var Comm = /** @class */ (function () {
            function Comm(jsServicesComm) {
                this.jsServicesComm = null;
                this.kernel = null;
                this.jsServicesComm = jsServicesComm;
            }
            Object.defineProperty(Comm.prototype, "comm_id", {
                /**
                 * Comm id
                 * @return {string}
                 */
                get: function () {
                    return this.jsServicesComm.commId;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(Comm.prototype, "target_name", {
                /**
                 * Target name
                 * @return {string}
                 */
                get: function () {
                    return this.jsServicesComm.targetName;
                },
                enumerable: true,
                configurable: true
            });
            /**
             * Opens a sibling comm in the backend
             * @param  data
             * @param  callbacks
             * @param  metadata
             * @return msg id
             */
            Comm.prototype.open = function (data, callbacks, metadata, buffers) {
                var future = this.jsServicesComm.open(data, metadata, buffers);
                this._hookupCallbacks(future, callbacks);
                return future.msg.header.msg_id;
            };
            /**
             * Sends a message to the sibling comm in the backend
             * @param  data
             * @param  callbacks
             * @param  metadata
             * @param  buffers
             * @return message id
             */
            Comm.prototype.send = function (data, callbacks, metadata, buffers) {
                var future = this.jsServicesComm.send(data, metadata, buffers);
                this._hookupCallbacks(future, callbacks);
                return future.msg.header.msg_id;
            };
            /**
             * Closes the sibling comm in the backend
             * @param  data
             * @param  callbacks
             * @param  metadata
             * @return msg id
             */
            Comm.prototype.close = function (data, callbacks, metadata, buffers) {
                var future = this.jsServicesComm.close(data, metadata, buffers);
                this._hookupCallbacks(future, callbacks);
                return future.msg.header.msg_id;
            };
            /**
             * Register a message handler
             * @param  callback, which is given a message
             */
            Comm.prototype.on_msg = function (callback) {
                this.jsServicesComm.onMsg = callback.bind(this);
            };
            /**
             * Register a handler for when the comm is closed by the backend
             * @param  callback, which is given a message
             */
            Comm.prototype.on_close = function (callback) {
                this.jsServicesComm.onClose = callback.bind(this);
            };
            /**
             * Hooks callback object up with @jupyterlab/services IKernelFuture
             * @param  @jupyterlab/services IKernelFuture instance
             * @param  callbacks
             */
            Comm.prototype._hookupCallbacks = function (future, callbacks) {
                if (callbacks) {
                    future.onReply = function (msg) {
                        if (callbacks.shell && callbacks.shell.reply) {
                            callbacks.shell.reply(msg);
                        }
                        // TODO: Handle payloads.  See https://github.com/jupyter/notebook/blob/master/notebook/static/services/kernels/kernel.js#L923-L947
                    };
                    future.onStdin = function (msg) {
                        if (callbacks.input) {
                            callbacks.input(msg);
                        }
                    };
                    future.onIOPub = function (msg) {
                        if (callbacks.iopub) {
                            if (callbacks.iopub.status && msg.header.msg_type === 'status') {
                                callbacks.iopub.status(msg);
                            }
                            else if (callbacks.iopub.clear_output && msg.header.msg_type === 'clear_output') {
                                callbacks.iopub.clear_output(msg);
                            }
                            else if (callbacks.iopub.output) {
                                switch (msg.header.msg_type) {
                                    case 'display_data':
                                    case 'execute_result':
                                    case 'stream':
                                    case 'error':
                                        callbacks.iopub.output(msg);
                                        break;
                                    default: break;
                                }
                            }
                        }
                    };
                }
            };
            return Comm;
        }());
        services.Comm = Comm;
    })(services = shims.services || (shims.services = {}));
})(shims || (shims = {}));

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/viewlist.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/**
 * - create_view and remove_view are default functions called when adding or removing views
 * - create_view takes a model and an index and returns a view or a promise for a view for that model
 * - remove_view takes a view and destroys it (including calling `view.remove()`)
 * - each time the update() function is called with a new list, the create and remove
 *   callbacks will be called in an order so that if you append the views created in the
 *   create callback and remove the views in the remove callback, you will duplicate
 *   the order of the list.
 * - the remove callback defaults to just removing the view (e.g., pass in null for the second parameter)
 * - the context defaults to the created ViewList.  If you pass another context, the create and remove
 *   will be called in that context.
 */
var ViewList = /** @class */ (function () {
    function ViewList(create_view, remove_view, context) {
        this.initialize(create_view, remove_view, context);
    }
    ViewList.prototype.initialize = function (create_view, remove_view, context) {
        this._handler_context = context || this;
        this._models = [];
        this.views = []; // list of promises for views
        this._create_view = create_view;
        this._remove_view = remove_view || function (view) { view.remove(); };
    };
    /**
     * the create_view, remove_view, and context arguments override the defaults
     * specified when the list is created.
     * after this function, the .views attribute is a list of promises for views
     * if you want to perform some action on the list of views, do something like
     * `Promise.all(myviewlist.views).then(function(views) {...});`
     */
    ViewList.prototype.update = function (new_models, create_view, remove_view, context) {
        var remove = remove_view || this._remove_view;
        var create = create_view || this._create_view;
        context = context || this._handler_context;
        var i = 0;
        // first, skip past the beginning of the lists if they are identical
        for (; i < new_models.length; i++) {
            if (i >= this._models.length || new_models[i] !== this._models[i]) {
                break;
            }
        }
        var first_removed = i;
        // Remove the non-matching items from the old list.
        var removed = this.views.splice(first_removed, this.views.length - first_removed);
        for (var j = 0; j < removed.length; j++) {
            removed[j].then(function (view) {
                remove.call(context, view);
            });
        }
        // Add the rest of the new list items.
        for (; i < new_models.length; i++) {
            this.views.push(Promise.resolve(create.call(context, new_models[i], i)));
        }
        // make a copy of the input array
        this._models = new_models.slice();
        // return a promise that resolves to all of the resolved views
        return Promise.all(this.views);
    };
    /**
     * removes every view in the list; convenience function for `.update([])`
     * that should be faster
     * returns a promise that resolves after this removal is done
     */
    ViewList.prototype.remove = function () {
        var _this = this;
        return Promise.all(this.views).then(function (views) {
            views.forEach(function (value) { return _this._remove_view.call(_this._handler_context, value); });
            _this.views = [];
            _this._models = [];
        });
    };
    /**
     * Dispose this viewlist.
     *
     * A synchronous function which just deletes references to child views. This
     * function does not call .remove() on child views because that is
     * asynchronous. Use this in cases where child views will be removed in
     * another way.
     */
    ViewList.prototype.dispose = function () {
        this.views = null;
        this._models = null;
    };
    return ViewList;
}());


// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/registry.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

/**
 * A runtime interface token for a widget registry.
 */
var IJupyterWidgetRegistry = new Token('jupyter.extensions.jupyterWidgetRegistry');

// CONCATENATED MODULE: ./node_modules/@jupyter-widgets/base/lib/index.js
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.











/***/ }),

/***/ "4840":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var aConstructor = __webpack_require__("5087");
var wellKnownSymbol = __webpack_require__("b622");

var SPECIES = wellKnownSymbol('species');

// `SpeciesConstructor` abstract operation
// https://tc39.es/ecma262/#sec-speciesconstructor
module.exports = function (O, defaultConstructor) {
  var C = anObject(O).constructor;
  var S;
  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
};


/***/ }),

/***/ "485a":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");

// `OrdinaryToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
module.exports = function (input, pref) {
  var fn, val;
  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val;
  if (isCallable(fn = input.valueOf) && !isObject(val = fn.call(input))) return val;
  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val;
  throw TypeError("Can't convert object to primitive value");
};


/***/ }),

/***/ "4930":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable es/no-symbol -- required for testing */
var V8_VERSION = __webpack_require__("2d00");
var fails = __webpack_require__("d039");

// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  var symbol = Symbol();
  // Chrome 38 Symbol has incorrect toString conversion
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
    // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
    !Symbol.sham && V8_VERSION && V8_VERSION < 41;
});


/***/ }),

/***/ "49f4":
/***/ (function(module, exports, __webpack_require__) {

var nativeCreate = __webpack_require__("6044");

/**
 * Removes all key-value entries from the hash.
 *
 * @private
 * @name clear
 * @memberOf Hash
 */
function hashClear() {
  this.__data__ = nativeCreate ? nativeCreate(null) : {};
  this.size = 0;
}

module.exports = hashClear;


/***/ }),

/***/ "4d64":
/***/ (function(module, exports, __webpack_require__) {

var toIndexedObject = __webpack_require__("fc6a");
var toAbsoluteIndex = __webpack_require__("23cb");
var lengthOfArrayLike = __webpack_require__("07fa");

// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIndexedObject($this);
    var length = lengthOfArrayLike(O);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare -- NaN check
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare -- NaN check
      if (value != value) return true;
    // Array#indexOf ignores holes, Array#includes - not
    } else for (;length > index; index++) {
      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};

module.exports = {
  // `Array.prototype.includes` method
  // https://tc39.es/ecma262/#sec-array.prototype.includes
  includes: createMethod(true),
  // `Array.prototype.indexOf` method
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
  indexOf: createMethod(false)
};


/***/ }),

/***/ "5087":
/***/ (function(module, exports, __webpack_require__) {

var isConstructor = __webpack_require__("68ee");
var tryToString = __webpack_require__("0d51");

// `Assert: IsConstructor(argument) is true`
module.exports = function (argument) {
  if (isConstructor(argument)) return argument;
  throw TypeError(tryToString(argument) + ' is not a constructor');
};


/***/ }),

/***/ "50c4":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");

var min = Math.min;

// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
module.exports = function (argument) {
  return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};


/***/ }),

/***/ "50d8":
/***/ (function(module, exports) {

/**
 * The base implementation of `_.times` without support for iteratee shorthands
 * or max array length checks.
 *
 * @private
 * @param {number} n The number of times to invoke `iteratee`.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the array of results.
 */
function baseTimes(n, iteratee) {
  var index = -1,
      result = Array(n);

  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}

module.exports = baseTimes;


/***/ }),

/***/ "55a3":
/***/ (function(module, exports) {

/**
 * Checks if a stack value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Stack
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function stackHas(key) {
  return this.__data__.has(key);
}

module.exports = stackHas;


/***/ }),

/***/ "5692":
/***/ (function(module, exports, __webpack_require__) {

var IS_PURE = __webpack_require__("c430");
var store = __webpack_require__("c6cd");

(module.exports = function (key, value) {
  return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
  version: '3.18.3',
  mode: IS_PURE ? 'pure' : 'global',
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});


/***/ }),

/***/ "56ef":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");
var getOwnPropertyNamesModule = __webpack_require__("241c");
var getOwnPropertySymbolsModule = __webpack_require__("7418");
var anObject = __webpack_require__("825a");

// all object keys, includes non-enumerable and symbols
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  var keys = getOwnPropertyNamesModule.f(anObject(it));
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};


/***/ }),

/***/ "57a5":
/***/ (function(module, exports, __webpack_require__) {

var overArg = __webpack_require__("91e9");

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);

module.exports = nativeKeys;


/***/ }),

/***/ "585a":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;

module.exports = freeGlobal;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "590b":
/***/ (function(module, exports, __webpack_require__) {

!function(t,e){if(true)module.exports=e(__webpack_require__("46d9"));else { var n, r; }}(window,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=247)}([function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"a",(function(){return n}))},function(t,e,r){var n=r(248);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e,r){var n=r(24),i=r(189);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},function(t,e,r){"use strict";const n=new(r(276).a)({id:"luma.gl"});var i=r(31),o=(r(202),r(84)),a=r(70),s=r(26),u=r(36);function c(t){const{luma:e}=t;if(t.canvas&&e){const{clientWidth:r}=e.canvasSizeInfo;return r?t.drawingBufferWidth/r:1}return 1}function l(t,e,r=!0){return function(t,e,r,n,i){const o=h(t[0],e,r);let a=f(t[1],e,n,i),s=h(t[0]+1,e,r);const u=s===r-1?s:s-1;let c;s=f(t[1]+1,e,n,i),i?(s=0===s?s:s+1,c=a,a=s):c=s===n-1?s:s-1;return{x:o,y:a,width:Math.max(u-o+1,1),height:Math.max(c-a+1,1)}}(e,c(t),t.drawingBufferWidth,t.drawingBufferHeight,r)}function h(t,e,r){return Math.min(Math.round(t*e),r-1)}function f(t,e,r,n){return n?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}const p=Object(s.isBrowser)(),d=p&&"undefined"!=typeof document,A={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function g(t={}){Object(u.a)(p,"createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils"),t=Object.assign({},A,t);const{width:e,height:r}=t;function o(e){if(t.throwOnError)throw new Error(e);return console.error(e),null}let a;t.onError=o;const{canvas:s}=t;return a=function(t,e){const{onError:r}=e;let n=null;const i=t=>n=t.statusMessage||n;t.addEventListener("webglcontextcreationerror",i,!1);const{webgl1:o=!0,webgl2:a=!0}=e;let s=null;a&&(s=s||t.getContext("webgl2",e),s=s||t.getContext("experimental-webgl2",e));o&&(s=s||t.getContext("webgl",e),s=s||t.getContext("experimental-webgl",e));if(t.removeEventListener("webglcontextcreationerror",i,!1),!s)return r(`Failed to create ${a&&!o?"WebGL2":"WebGL"} context: ${n||"Unknown error"}`);e.onContextLost&&t.addEventListener("webglcontextlost",e.onContextLost,!1);e.onContextRestored&&t.addEventListener("webglcontextrestored",e.onContextRestored,!1);return s}(function({canvas:t,width:e=800,height:r=600,onError:n}){let i;if("string"==typeof t){d&&"complete"===document.readyState||n(`createGLContext called on canvas '${t}' before page was loaded`),i=document.getElementById(t)}else t?i=t:(i=document.createElement("canvas"),i.id="lumagl-canvas",i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",document.body.insertBefore(i,document.body.firstChild));return i}({canvas:s,width:e,height:r,onError:o}),t),a?(a=m(a,t),function(t){const e=Object(i.e)(t)?"WebGL2":"WebGL1",r=function(t){const e=t.getParameter(7936),r=t.getParameter(7937),n=t.getExtension("WEBGL_debug_renderer_info"),i=n&&t.getParameter(n.UNMASKED_VENDOR_WEBGL||7936),o=n&&t.getParameter(n.UNMASKED_RENDERER_WEBGL||7937);return{vendor:i||e,renderer:o||r,vendorMasked:e,rendererMasked:r,version:t.getParameter(7938),shadingLanguageVersion:t.getParameter(35724)}}(t),o=r?`(${r.vendor},${r.renderer})`:"",a=t.debug?" debug":"";n.info(1,`${e}${a} context ${o}`)()}(a),a):null}function m(t,e={}){if(!t||t._instrumented)return t;t._version=t._version||function(t){if("undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext)return 2;return 1}(t),t.luma=t.luma||{},t.luma.canvasSizeInfo=t.luma.canvasSizeInfo||{},e=Object.assign({},A,e);const{manageState:r,debug:i}=e;return r&&Object(a.c)(t,{copyState:!1,log:(...t)=>n.log(1,...t)()}),p&&i&&(s.global.makeDebugContext?(t=s.global.makeDebugContext(t,e),n.level=Math.max(n.level,1)):n.warn('WebGL debug mode not activated. import "@luma.gl/debug" to enable.')()),t._instrumented=!0,t}function y(t,e={}){if(t.canvas){return void function(t,e,r){let i="width"in r?r.width:t.canvas.clientWidth,o="height"in r?r.height:t.canvas.clientHeight;i&&o||(n.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=t.canvas.width||1,o=t.canvas.height||1);t.luma=t.luma||{},t.luma.canvasSizeInfo=t.luma.canvasSizeInfo||{};const a=t.luma.canvasSizeInfo;if(a.clientWidth!==i||a.clientHeight!==o||a.devicePixelRatio!==e){let r=e;const a=Math.floor(i*r),s=Math.floor(o*r);t.canvas.width=a,t.canvas.height=s,t.drawingBufferWidth===a&&t.drawingBufferHeight===s||(n.warn("Device pixel ratio clamped")(),r=Math.min(t.drawingBufferWidth/i,t.drawingBufferHeight/o),t.canvas.width=Math.floor(i*r),t.canvas.height=Math.floor(o*r)),Object.assign(t.luma.canvasSizeInfo,{clientWidth:i,clientHeight:o,devicePixelRatio:e})}}(t,function(t){const e="undefined"==typeof window?1:window.devicePixelRatio||1;return Number.isFinite(t)?t<=0?1:t:t?e:1}(e.useDevicePixels),e)}const r=t.getExtension("STACKGL_resize_drawingbuffer");r&&"width"in e&&"height"in e&&r.resize(e.width,e.height)}r.d(e,"k",(function(){return n})),r.d(e,"i",(function(){return i.d})),r.d(e,"j",(function(){return i.e})),r.d(e,"g",(function(){return i.c})),r.d(e,"b",(function(){return i.b})),r.d(e,"a",(function(){return i.a})),r.d(e,"f",(function(){return o.a})),r.d(e,"n",(function(){return o.c})),r.d(e,"l",(function(){return o.b})),r.d(e,"o",(function(){return o.d})),r.d(e,"c",(function(){return g})),r.d(e,"m",(function(){return y})),r.d(e,"h",(function(){return m})),r.d(e,"e",(function(){return c})),r.d(e,"d",(function(){return l}))},function(t,e,r){var n=r(249);function i(e,r,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,r){var i=n(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(r):o.value}},i(e,r,o||e)}t.exports=i},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){var n=r(258),i=r(259),o=r(260);t.exports=function(t,e){return n(t)||i(t,e)||o()}},function(t,e,r){"use strict";var n=r(25);r.d(e,"a",(function(){return n.a})),r.d(e,"b",(function(){return n.b})),r.d(e,"c",(function(){return n.c})),r.d(e,"d",(function(){return n.d})),r.d(e,"e",(function(){return n.e})),r.d(e,"f",(function(){return n.f}))},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i})),r.d(e,"c",(function(){return o}));var n=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array,o=Math.random;Math.PI;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"e",(function(){return a})),r.d(e,"f",(function(){return s})),r.d(e,"j",(function(){return c})),r.d(e,"i",(function(){return l})),r.d(e,"h",(function(){return h})),r.d(e,"c",(function(){return f})),r.d(e,"a",(function(){return p})),r.d(e,"g",(function(){return d})),r.d(e,"d",(function(){return A}));r(42);const n=1/Math.PI*180,i=1/180*Math.PI,o={};function a(t,{precision:e=o.precision||4}={}){return t=function(t){return Math.round(t/o.EPSILON)*o.EPSILON}(t),`${parseFloat(t.toPrecision(e))}`}function s(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function u(t,e,r){if(s(t)){r=r||((n=t).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<t.length;++n)r[n]=e(t[n],n,r);return r}var n;return e(t)}function c(t){return h(t)}function l(t){return f(t)}function h(t,e){return u(t,t=>t*i,e)}function f(t,e){return u(t,t=>t*n,e)}function p(t,e,r){return u(t,t=>Math.max(e,Math.min(r,t)))}function d(t,e,r){return s(t)?t.map((t,n)=>d(t,e[n],r)):r*e+(1-r)*t}function A(t,e,r){const n=o.EPSILON;r&&(o.EPSILON=r);try{if(t===e)return!0;if(s(t)&&s(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!A(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):!(!Number.isFinite(t)||!Number.isFinite(e))&&Math.abs(t-e)<=o.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{o.EPSILON=n}}o.EPSILON=1e-12,o.debug=!1,o.precision=4,o.printTypes=!1,o.printDegrees=!1,o.printRowMajor=!0},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return a})),r.d(e,"b",(function(){return s}));var n=r(18),i={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(i,"IDENTITY",{get:function(){return n.a.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")()||0}});var o={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},a={common:0,meters:1,pixels:2},s={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}}},function(t,e,r){"use strict";r.r(e);var n=r(14),i=r(130),o=r(148),a=r(93),s=r(0),u=r.n(s),c=r(2),l=r.n(c),h=r(3),f=r.n(h),p=r(134);function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var g=[255,255,255],m=[0,0,1],y=[0,0,1],v=0,_=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l()(this,t);var r=e.color,n=void 0===r?g:r,i=e.intensity,o=void 0===i?1:i,a=e.position,s=void 0===a?y:a;this.id=e.id||"point-".concat(v++),this.color=n,this.intensity=o,this.type="point",this.position=s,this.attenuation=b(e),this.projectedLight=A({},this)}return f()(t,[{key:"getProjectedLight",value:function(t){var e=t.layer,r=this.projectedLight,i=e.context.viewport,o=e.props,a=o.coordinateSystem,s=o.coordinateOrigin,u=Object(p.b)(this.position,{viewport:i,coordinateSystem:a,coordinateOrigin:s,fromCoordinateSystem:i.isGeospatial?n.a.LNGLAT:n.a.CARTESIAN,fromCoordinateOrigin:[0,0,0]});return r.color=this.color,r.intensity=this.intensity,r.position=u,r}}]),t}();function b(t){return"attenuation"in t?t.attenuation:"intensity"in t?[0,0,t.intensity]:m}var x=r(5),w=r.n(x),E=r(6),S=r.n(E),O=r(1),T=r.n(O),P=r(113);function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var C=function(t){w()(r,t);var e=M(r);function r(){return l()(this,r),e.apply(this,arguments)}return f()(r,[{key:"getProjectedLight",value:function(t){var e=t.layer,r=this.projectedLight,n=e.context.viewport,i=e.props,o=i.coordinateSystem,a=i.coordinateOrigin,s=i.modelMatrix,u=Object(P.b)({viewport:n,modelMatrix:s,coordinateSystem:o,coordinateOrigin:a}).project_uCameraPosition;return r.color=this.color,r.intensity=this.intensity,r.position=u,r}}]),r}(_),I=r(10),k=r.n(I),R=r(233),L=r.n(R),j=Math.PI/180,D=23.4397*j;function B(t,e,r){var n,i,o,a,s,u,c=j*-r,l=j*e,h=function(t){return function(t){return t/864e5-.5+2440588}(t)-2451545}(t),f=(n=j*(357.5291+.98560028*h),i=j*(1.9148*Math.sin(n)+.02*Math.sin(2*n)+3e-4*Math.sin(3*n)),o=n+i+102.9372*j+Math.PI,{declination:(a=o,s=0,u=a,Math.asin(Math.sin(s)*Math.cos(D)+Math.cos(s)*Math.sin(D)*Math.sin(u))),rightAscension:z(o,0)}),p=function(t,e){return j*(280.147+360.9856235*t)-e}(h,c)-f.rightAscension;return{azimuth:N(p,l,f.declination),altitude:U(p,l,f.declination)}}function F(t,e,r){var n=B(t,e,r),i=n.azimuth,o=n.altitude;return[Math.sin(i)*Math.cos(o),Math.cos(i)*Math.cos(o),-Math.sin(o)]}function z(t,e){var r=t;return Math.atan2(Math.sin(r)*Math.cos(D)-Math.tan(e)*Math.sin(D),Math.cos(r))}function N(t,e,r){var n=t,i=e,o=r;return Math.atan2(Math.sin(n),Math.cos(n)*Math.sin(i)-Math.tan(o)*Math.cos(i))}function U(t,e,r){var n=t,i=e,o=r;return Math.asin(Math.sin(i)*Math.sin(o)+Math.cos(i)*Math.cos(o)*Math.cos(n))}function V(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var G=function(t){w()(r,t);var e=V(r);function r(t){var n,i=t.timestamp,o=L()(t,["timestamp"]);return l()(this,r),(n=e.call(this,o)).timestamp=i,n}return f()(r,[{key:"getProjectedLight",value:function(t){var e=t.layer.context.viewport;if(e.resolution>0){var r=F(this.timestamp,0,0),n=k()(r,3),i=n[0],o=n[1],a=n[2];this.direction=[i,-a,o]}else{var s=e.latitude,u=e.longitude;this.direction=F(this.timestamp,s,u)}return this}}]),r}(a.a),W=r(86),H=r(176),q=r(62);const Z=[-1,-1,1,-1,-1,1,1,1];class X extends H.a{constructor(t,e){const r=Z.map(t=>-1===t?0:t);super(t,Object.assign({},e,{vs:"attribute vec2 aClipSpacePosition;\nattribute vec2 aTexCoord;\nattribute vec2 aCoordinate;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main(void) {\n  gl_Position = vec4(aClipSpacePosition, 0., 1.);\n  position = aClipSpacePosition;\n  coordinate = aCoordinate;\n  uv = aTexCoord;\n}\n",geometry:new q.a({drawMode:5,vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(Z)},aTexCoord:{size:2,value:new Float32Array(r)},aCoordinate:{size:2,value:new Float32Array(r)}}})})),this.setVertexCount(4)}}var Q=r(7),Y=r(178);function K(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var $=function(t){w()(r,t);var e=K(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l()(this,r),n=e.call(this,t,i);var o=i.module,a=i.fs,s=i.id;return n.model=new X(t,{id:s,fs:a,modules:[o]}),n}return f()(r,[{key:"render",value:function(t){var e=this,r=this.gl;Object(Q.n)(r,{viewport:[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}),Object(Q.o)(r,{framebuffer:t.outputBuffer,clearColor:[0,0,0,0]},(function(){return e._renderPass(r,t)}))}},{key:"delete",value:function(){this.model.delete(),this.model=null}},{key:"_renderPass",value:function(t,e){var r=e.inputBuffer;e.outputBuffer;Object(Y.a)(t,{color:!0}),this.model.draw({moduleSettings:this.props.moduleSettings,uniforms:{texture:r,texSize:[r.width,r.height]},parameters:{depthWrite:!1,depthTest:!1}})}}]),r}(r(170).a),J=r(196);function tt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return et(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return et(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function et(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function rt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var nt=function(t){w()(r,t);var e=rt(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l()(this,r),(n=e.call(this,i)).id="".concat(t.name,"-pass"),Object(J.b)(t),n.module=t,n}return f()(r,[{key:"postRender",value:function(t,e){this.passes||(this.passes=function(t,e,r,n){if(e.filter||e.sampler){var i=at(e);return[new $(t,{id:r,module:e,fs:i,moduleSettings:n})]}return(e.passes||[]).map((function(i,o){var a=at(e,i),s="".concat(r,"-").concat(o);return new $(t,{id:s,module:e,fs:a,moduleSettings:n})}))}(t,this.module,this.id,this.props));for(var r=e.target,n=e.inputBuffer,i=e.swapBuffer,o=0;o<this.passes.length;o++){r&&o===this.passes.length-1&&(i=r),this.passes[o].render({inputBuffer:n,outputBuffer:i});var a=i;i=n,n=a}return n}},{key:"cleanup",value:function(){if(this.passes){var t,e=tt(this.passes);try{for(e.s();!(t=e.n()).done;){t.value.delete()}}catch(t){e.e(t)}finally{e.f()}this.passes=null}}}]),r}(W.a);var it=function(t){return"uniform sampler2D texture;\nuniform vec2 texSize;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main() {\n  vec2 texCoord = coordinate;\n\n  gl_FragColor = texture2D(texture, texCoord);\n  gl_FragColor = ".concat(t,"(gl_FragColor, texSize, texCoord);\n}\n")},ot=function(t){return"uniform sampler2D texture;\nuniform vec2 texSize;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main() {\n  vec2 texCoord = coordinate;\n\n  gl_FragColor = ".concat(t,"(texture, texSize, texCoord);\n}\n")};function at(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(e.filter){var r="string"==typeof e.filter?e.filter:"".concat(t.name,"_filterColor");return it(r)}if(e.sampler){var n="string"==typeof e.sampler?e.sampler:"".concat(t.name,"_sampleColor");return ot(n)}return null}var st=r(85),ut=r(191),ct=r(161),lt=r(156),ht=r(155),ft=r(190),pt=r(163),dt=r(40),At=r(105),gt=r(11),mt=r(21),yt=r(28);function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _t(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function bt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var xt=Math.PI/180,wt=180/Math.PI;function Et(){var t=Math.PI/180*256;return{unitsPerMeter:[256/6370972,256/6370972,256/6370972],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[t,t,256/6370972],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,24886.609375]}}var St=function(t){w()(r,t);var e=bt(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l()(this,r);var i=n.latitude,o=void 0===i?0:i,a=n.longitude,s=void 0===a?0:a,u=n.zoom,c=void 0===u?11:u,h=n.nearZMultiplier,f=void 0===h?.1:h,p=n.farZMultiplier,d=void 0===p?2:p,A=n.resolution,g=void 0===A?10:A,m=n.width,y=n.height,v=n.altitude,_=void 0===v?1.5:v;m=m||1,y=y||1,_=Math.max(.75,_);var b=(new gt.a).lookAt({eye:[0,-_,0],up:[0,0,1]}),x=Math.pow(2,c);b.rotateX(o*xt),b.rotateZ(-s*xt),b.scale(x/y);var w=Math.atan(.5/_),E=512*x/y;return(t=e.call(this,_t(_t({},n),{},{width:m,height:y,viewMatrix:b,longitude:s,latitude:o,zoom:c,fovyRadians:2*w,aspect:m/y,focalDistance:_,near:f,far:Math.min(2,1/E+1)*_*d}))).resolution=g,t.distanceScales=Et(),t}return f()(r,[{key:"getDistanceScales",value:function(){return this.distanceScales}},{key:"getBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={targetZ:t.z||0},r=this.unproject([0,this.height/2],e),n=this.unproject([this.width/2,0],e),i=this.unproject([this.width,this.height/2],e),o=this.unproject([this.width/2,this.height],e);return i[0]<this.longitude&&(i[0]+=360),r[0]>this.longitude&&(r[0]-=360),[Math.min(r[0],i[0],n[0],o[0]),Math.min(r[1],i[1],n[1],o[1]),Math.max(r[0],i[0],n[0],o[0]),Math.max(r[1],i[1],n[1],o[1])]}},{key:"unproject",value:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.topLeft,i=void 0===n||n,o=r.targetZ,a=k()(t,3),s=a[0],u=a[1],c=a[2],l=i?u:this.height-u,h=this.pixelUnprojectionMatrix;if(Number.isFinite(c))e=Ot(h,[s,l,c,1]);else{var f=Ot(h,[s,l,-1,1]),p=Ot(h,[s,l,1,1]),d=256*((o||0)/6370972+1),A=mt.p(mt.q([],f,p)),g=mt.p(f),m=mt.p(p),y=(4*g*m-Math.pow(A-g-m,2))/16,v=4*y/A,_=Math.sqrt(g-v),b=Math.sqrt(Math.max(0,d*d-v)),x=(_-b)/Math.sqrt(A);e=mt.i([],f,p,x)}var w=this.unprojectPosition(e),E=k()(w,3),S=E[0],O=E[1],T=E[2];return Number.isFinite(c)?[S,O,T]:Number.isFinite(o)?[S,O,o]:[S,O]}},{key:"projectPosition",value:function(t){var e=k()(t,3),r=e[0],n=e[1],i=e[2],o=void 0===i?0:i,a=r*xt,s=n*xt,u=Math.cos(s),c=256*(o/6370972+1);return[Math.sin(a)*u*c,-Math.cos(a)*u*c,Math.sin(s)*c]}},{key:"unprojectPosition",value:function(t){var e=k()(t,3),r=e[0],n=e[1],i=e[2],o=mt.g(t),a=Math.asin(i/o);return[Math.atan2(r,-n)*wt,a*wt,6370972*(o/256-1)]}},{key:"projectFlat",value:function(t){return t}},{key:"unprojectFlat",value:function(t){return t}},{key:"panByPosition",value:function(t,e){var r=this.unproject(e);return{longitude:t[0]-r[0]+this.longitude,latitude:t[1]-r[1]+this.latitude}}},{key:"projectionMode",get:function(){return n.c.GLOBE}}]),r}(dt.a);function Ot(t,e){var r=yt.n([],e,t);return yt.k(r,r,1/r[3]),r}var Tt=r(226),Pt=r(95),Mt=r(207),Ct=r(227),It=r(112),kt=r(61),Rt=r(149),Lt=r(22),jt=r(60),Dt=r(114),Bt=r(35);function Ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function zt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ft(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ft(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Nt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var Ut={position:[0,0,0],pitch:0,bearing:0,maxPitch:90,minPitch:-90},Vt=function(t){w()(r,t);var e=Nt(r);function r(t){var n,i=t.width,o=t.height,a=t.position,s=void 0===a?Ut.position:a,u=t.bearing,c=void 0===u?Ut.bearing:u,h=t.pitch,f=void 0===h?Ut.pitch:h,p=t.longitude,d=t.latitude,A=t.maxPitch,g=void 0===A?Ut.maxPitch:A,m=t.minPitch,y=void 0===m?Ut.minPitch:m,v=t.startRotatePos,_=t.startBearing,b=t.startPitch,x=t.startZoomPosition,w=t.startZoom;return l()(this,r),(n=e.call(this,{width:i,height:o,position:s,bearing:c,pitch:f,longitude:p,latitude:d,maxPitch:g,minPitch:y}))._state={startRotatePos:v,startBearing:_,startPitch:b,startZoomPosition:x,startZoom:w},n}return f()(r,[{key:"getDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=new gt.c({bearing:this._viewportProps.bearing,pitch:t?90:90+this._viewportProps.pitch}),r=e.toVector3().normalize();return r}},{key:"panStart",value:function(){return this}},{key:"pan",value:function(){return this}},{key:"panEnd",value:function(){return this}},{key:"rotateStart",value:function(t){var e=t.pos;return this._getUpdatedState({startRotatePos:e,startBearing:this._viewportProps.bearing,startPitch:this._viewportProps.pitch})}},{key:"rotate",value:function(t){var e,r=t.pos,n=t.deltaAngleX,i=void 0===n?0:n,o=t.deltaAngleY,a=void 0===o?0:o,s=this._state,u=s.startRotatePos,c=s.startBearing,l=s.startPitch,h=this._viewportProps,f=h.width,p=h.height;if(!u||!Number.isFinite(c)||!Number.isFinite(l))return this;r?e={bearing:c-180*((r[0]-u[0])/f),pitch:l-90*((r[1]-u[1])/p)}:e={bearing:c-i,pitch:l-a};return this._getUpdatedState(e)}},{key:"rotateEnd",value:function(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}},{key:"zoomStart",value:function(){return this._getUpdatedState({startZoomPosition:this._viewportProps.position,startZoom:this._viewportProps.zoom})}},{key:"zoom",value:function(t){var e=t.scale,r=this._state.startZoomPosition;r||(r=this._viewportProps.position);var n=this.getDirection();return this._move(n,20*Math.log2(e),r)}},{key:"zoomEnd",value:function(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}},{key:"moveLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=this.getDirection(!0);return this._move(e.rotateZ({radians:Math.PI/2}),t)}},{key:"moveRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=this.getDirection(!0);return this._move(e.rotateZ({radians:-Math.PI/2}),t)}},{key:"moveUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=this.getDirection(!0);return this._move(e,t)}},{key:"moveDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=this.getDirection(!0);return this._move(e.negate(),t)}},{key:"rotateLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this._viewportProps.bearing-t})}},{key:"rotateRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this._viewportProps.bearing+t})}},{key:"rotateUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this._viewportProps.pitch+t})}},{key:"rotateDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this._viewportProps.pitch-t})}},{key:"zoomIn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this.zoom({scale:t})}},{key:"zoomOut",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this.zoom({scale:1/t})}},{key:"shortestPathFrom",value:function(t){var e=t.getViewportProps(),r=zt({},this._viewportProps),n=r.bearing,i=r.longitude;return Math.abs(n-e.bearing)>180&&(r.bearing=n<0?n+360:n-360),Math.abs(i-e.longitude)>180&&(r.longitude=i<0?i+360:i-360),r}},{key:"_move",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._viewportProps.position,n=t.scale(e);return this._getUpdatedState({position:new gt.b(r).add(n)})}},{key:"_getUpdatedState",value:function(t){return new r(zt(zt(zt({},this._viewportProps),this._state),t))}},{key:"_applyConstraints",value:function(t){var e=t.pitch,r=t.maxPitch,n=t.minPitch,i=t.longitude,o=t.bearing;return t.pitch=Object(gt.d)(e,n,r),(i<-180||i>180)&&(t.longitude=Object(Bt.e)(i+180,360)-180),(o<-180||o>180)&&(t.bearing=Object(Bt.e)(o+180,360)-180),t}}]),r}(Dt.a),Gt=function(t){w()(r,t);var e=Nt(r);function r(t){return l()(this,r),e.call(this,Vt,t)}return f()(r,[{key:"linearTransitionProps",get:function(){return["position","pitch","bearing"]}}]),r}(jt.a);function Wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Wt(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function qt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var Zt=function(t){w()(r,t);var e=qt(r);function r(t){l()(this,r);var n=t.modelMatrix,i=void 0===n?null:n,o=t.bearing,a=void 0===o?0:o,s=t.pitch,u=void 0===s?0:s,c=t.up,h=void 0===c?[0,0,1]:c,f=function(t){var e=t.bearing,r=t.pitch;return new gt.c({bearing:e,pitch:r}).toVector3().normalize()}({bearing:a,pitch:-90===u?1e-4:90+u}),p=i?i.transformDirection(f):f,d=Object(Lt.i)(t),A=Math.pow(2,d),g=(new gt.a).lookAt({eye:[0,0,0],center:p,up:h}).scale(A);return e.call(this,Ht(Ht({},t),{},{zoom:d,viewMatrix:g}))}return r}(dt.a),Xt=function(t){w()(r,t);var e=qt(r);function r(t){return l()(this,r),e.call(this,Ht(Ht({},t),{},{type:Zt}))}return f()(r,[{key:"controller",get:function(){return this._getControllerProps({type:Gt})}}]),r}(kt.a);function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Yt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Qt(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Kt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}Xt.displayName="FirstPersonView";var $t={rotationX:0,rotationOrbit:0,zoom:0,target:[0,0,0],minRotationX:-90,maxRotationX:90,minZoom:-1/0,maxZoom:1/0},Jt=function(t){w()(r,t);var e=Kt(r);function r(t){var n,i=t.makeViewport,o=t.width,a=t.height,s=t.rotationX,u=void 0===s?$t.rotationX:s,c=t.rotationOrbit,h=void 0===c?$t.rotationOrbit:c,f=t.target,p=void 0===f?$t.target:f,d=t.zoom,A=void 0===d?$t.zoom:d,g=t.minRotationX,m=void 0===g?$t.minRotationX:g,y=t.maxRotationX,v=void 0===y?$t.maxRotationX:y,_=t.minZoom,b=void 0===_?$t.minZoom:_,x=t.maxZoom,w=void 0===x?$t.maxZoom:x,E=t.startPanPosition,S=t.startRotatePos,O=t.startRotationX,T=t.startRotationOrbit,P=t.startZoomPosition,M=t.startZoom;return l()(this,r),(n=e.call(this,{width:o,height:a,rotationX:u,rotationOrbit:h,target:p,zoom:A,minRotationX:m,maxRotationX:v,minZoom:b,maxZoom:w}))._state={startPanPosition:E,startRotatePos:S,startRotationX:O,startRotationOrbit:T,startZoomPosition:P,startZoom:M},n.makeViewport=i,n}return f()(r,[{key:"panStart",value:function(t){var e=t.pos;return this._getUpdatedState({startPanPosition:this._unproject(e)})}},{key:"pan",value:function(t){var e=t.pos,r=t.startPosition,n=this._state.startPanPosition||r;if(!n)return this;var i=this.makeViewport(this._viewportProps).panByPosition(n,e);return this._getUpdatedState(i)}},{key:"panEnd",value:function(){return this._getUpdatedState({startPanPosition:null})}},{key:"rotateStart",value:function(t){var e=t.pos;return this._getUpdatedState({startRotatePos:e,startRotationX:this._viewportProps.rotationX,startRotationOrbit:this._viewportProps.rotationOrbit})}},{key:"rotate",value:function(t){var e,r=t.pos,n=t.deltaAngleX,i=void 0===n?0:n,o=t.deltaAngleY,a=void 0===o?0:o,s=this._state,u=s.startRotatePos,c=s.startRotationX,l=s.startRotationOrbit,h=this._viewportProps,f=h.width,p=h.height;if(!u||!Number.isFinite(c)||!Number.isFinite(l))return this;if(r){var d=(r[0]-u[0])/f;(c<-90||c>90)&&(d*=-1),e={rotationX:c+180*((r[1]-u[1])/p),rotationOrbit:l+180*d}}else e={rotationX:c+a,rotationOrbit:l+i};return this._getUpdatedState(e)}},{key:"rotateEnd",value:function(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}},{key:"shortestPathFrom",value:function(t){var e=t.getViewportProps(),r=Yt({},this._viewportProps),n=r.rotationOrbit;return Math.abs(n-e.rotationOrbit)>180&&(r.rotationOrbit=n<0?n+360:n-360),r}},{key:"zoomStart",value:function(t){var e=t.pos;return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this._viewportProps.zoom})}},{key:"zoom",value:function(t){var e=t.pos,r=t.startPos,n=t.scale,i=this._viewportProps.zoom,o=this._state,a=o.startZoom,s=o.startZoomPosition;Number.isFinite(a)||(a=i,s=this._unproject(r)||this._unproject(e));var u=this._calculateNewZoom({scale:n,startZoom:a}),c=this.makeViewport(Yt(Yt({},this._viewportProps),{},{zoom:u}));return this._getUpdatedState(Yt({zoom:u},c.panByPosition(s,e)))}},{key:"zoomEnd",value:function(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}},{key:"zoomIn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._getUpdatedState({zoom:this._calculateNewZoom({scale:t})})}},{key:"zoomOut",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/t})})}},{key:"moveLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return this._panFromCenter([-t,0])}},{key:"moveRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return this._panFromCenter([t,0])}},{key:"moveUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return this._panFromCenter([0,-t])}},{key:"moveDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;return this._panFromCenter([0,t])}},{key:"rotateLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({rotationOrbit:this._viewportProps.rotationOrbit-t})}},{key:"rotateRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({rotationOrbit:this._viewportProps.rotationOrbit+t})}},{key:"rotateUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({rotationX:this._viewportProps.rotationX-t})}},{key:"rotateDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({rotationX:this._viewportProps.rotationX+t})}},{key:"_unproject",value:function(t){var e=this.makeViewport(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,r=t.startZoom,n=this._viewportProps,i=n.maxZoom,o=n.minZoom;Number.isFinite(r)||(r=this._viewportProps.zoom);var a=r+Math.log2(e);return Object(gt.d)(a,o,i)}},{key:"_panFromCenter",value:function(t){var e=this._viewportProps,r=e.width,n=e.height,i=e.target;return this.pan({startPosition:i,pos:[r/2+t[0],n/2+t[1]]})}},{key:"_getUpdatedState",value:function(t){return new this.constructor(Yt(Yt(Yt({},this._viewportProps),this._state),t))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,r=t.minZoom,n=t.zoom,i=t.maxRotationX,o=t.minRotationX,a=t.rotationOrbit;return t.zoom=Object(gt.d)(n,r,e),t.rotationX=Object(gt.d)(t.rotationX,o,i),(a<-180||a>180)&&(t.rotationOrbit=Object(Bt.e)(a+180,360)-180),t}}]),r}(Dt.a),te=function(t){w()(r,t);var e=Kt(r);function r(t){return l()(this,r),e.call(this,Jt,t)}return f()(r,[{key:"linearTransitionProps",get:function(){return["target","zoom","rotationX","rotationOrbit"]}}]),r}(jt.a);function ee(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function re(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ee(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ee(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ne(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var ie=Math.PI/180;function oe(t){var e=t.height,r=t.focalDistance,n=t.orbitAxis,i=t.rotationX,o=t.rotationOrbit,a=t.zoom,s="Z"===n?[0,0,1]:[0,1,0],u="Z"===n?[0,-r,0]:[0,0,r],c=(new gt.a).lookAt({eye:u,up:s});c.rotateX(i*ie),"Z"===n?c.rotateZ(o*ie):c.rotateY(o*ie);var l=Math.pow(2,a)/(e||1);return c.scale(l),c}var ae=function(t){w()(r,t);var e=ne(r);function r(t){var n;l()(this,r);var i=t.height,o=t.projectionMatrix,a=t.fovy,s=void 0===a?50:a,u=t.orbitAxis,c=t.target,h=void 0===c?[0,0,0]:c,f=t.rotationX,p=void 0===f?0:f,d=t.rotationOrbit,A=void 0===d?0:d,g=t.zoom,m=void 0===g?0:g,y=o?o[5]/2:Object(Lt.e)(s);return(n=e.call(this,re(re({},t),{},{longitude:null,viewMatrix:oe({height:i,focalDistance:y,orbitAxis:u,rotationX:p,rotationOrbit:A,zoom:m}),fovy:s,focalDistance:y,position:h,zoom:m}))).projectedCenter=n.project(n.center),n}return f()(r,[{key:"unproject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.topLeft,n=void 0===r||r,i=k()(t,3),o=i[0],a=i[1],s=i[2],u=void 0===s?this.projectedCenter[2]:s,c=n?a:this.height-a,l=Object(Lt.n)([o,c,u],this.pixelUnprojectionMatrix),h=k()(l,3),f=h[0],p=h[1],d=h[2];return[f,p,d]}},{key:"panByPosition",value:function(t,e){var r=this.project(t),n=[this.width/2+r[0]-e[0],this.height/2+r[1]-e[1],this.projectedCenter[2]];return{target:this.unproject(n)}}}]),r}(dt.a),se=function(t){w()(r,t);var e=ne(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l()(this,r);var n=t.orbitAxis,i=void 0===n?"Z":n;return e.call(this,re(re({},t),{},{orbitAxis:i,type:ae}))}return f()(r,[{key:"controller",get:function(){return this._getControllerProps({type:te})}}]),r}(kt.a);se.displayName="OrbitView";var ue=r(27);function ce(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var le=function(t){w()(r,t);var e=ce(r);function r(t){var n;return l()(this,r),(n=e.call(this,t)).zoomAxis=t.zoomAxis||"all",n}return f()(r,[{key:"_applyConstraints",value:function(t){var e=t.maxZoom,r=t.minZoom,n=t.zoom;return t.zoom=Array.isArray(n)?[Object(gt.d)(n[0],r,e),Object(gt.d)(n[1],r,e)]:Object(gt.d)(n,r,e),t}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,r=t.startZoom,n=this._viewportProps,i=n.maxZoom,o=n.minZoom;r||0===r||(r=this._viewportProps.zoom);var a=Math.log2(e);if(Array.isArray(r)){var s=r,u=k()(s,2),c=u[0],l=u[1];switch(this.zoomAxis){case"X":c=Object(gt.d)(c+a,o,i);break;case"Y":l=Object(gt.d)(l+a,o,i);break;default:var h=Math.min(c+a,l+a);h<o&&(a+=o-h),(h=Math.max(c+a,l+a))>i&&(a+=i-h),c+=a,l+=a}return[c,l]}return Object(gt.d)(r+a,o,i)}}]),r}(Jt),he=function(t){w()(r,t);var e=ce(r);function r(t){return l()(this,r),t.dragMode=t.dragMode||"pan",e.call(this,le,t)}return f()(r,[{key:"_onPanRotate",value:function(t){return!1}},{key:"linearTransitionProps",get:function(){return["target","zoom"]}}]),r}(jt.a);function fe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function pe(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?fe(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function de(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var Ae=(new gt.a).lookAt({eye:[0,0,1]});function ge(t){var e=t.width,r=t.height,n=t.near,i=t.far;return e=e||1,r=r||1,(new gt.a).ortho({left:-e/2,right:e/2,bottom:-r/2,top:r/2,near:n,far:i})}var me=function(t){w()(r,t);var e=de(r);function r(t){var n;l()(this,r);var i=t.width,o=t.height,a=t.near,s=void 0===a?.1:a,u=t.far,c=void 0===u?1e3:u,h=t.zoom,f=void 0===h?0:h,p=t.target,d=void 0===p?[0,0,0]:p,A=t.flipY,g=void 0===A||A,m=Array.isArray(f)?f[0]:f,y=Array.isArray(f)?f[1]:f,v=Math.min(m,y),_=Math.pow(2,v);if(n=e.call(this,pe(pe({},t),{},{longitude:null,position:d,viewMatrix:Ae.clone().scale([_,_*(g?-1:1),_]),projectionMatrix:ge({width:i,height:o,near:s,far:c}),zoom:v})),m!==y){var b=Math.pow(2,m),x=Math.pow(2,y);n.distanceScales={unitsPerMeter:[b/_,x/_,1],metersPerUnit:[_/b,_/x,1]}}return n}return f()(r,[{key:"projectFlat",value:function(t){var e=k()(t,2),r=e[0],n=e[1],i=this.distanceScales.unitsPerMeter;return[r*i[0],n*i[1]]}},{key:"unprojectFlat",value:function(t){var e=k()(t,2),r=e[0],n=e[1],i=this.distanceScales.metersPerUnit;return[r*i[0],n*i[1]]}},{key:"panByPosition",value:function(t,e){var r=Object(Lt.n)(e,this.pixelUnprojectionMatrix),n=this.projectFlat(t),i=ue.a([],n,ue.d([],r));return{target:ue.a([],this.center,i)}}}]),r}(dt.a),ye=function(t){w()(r,t);var e=de(r);function r(t){return l()(this,r),e.call(this,pe(pe({},t),{},{type:me}))}return f()(r,[{key:"controller",get:function(){return this._getControllerProps({type:he})}}]),r}(kt.a);ye.displayName="OrthographicView";var ve=r(8),_e=r.n(ve),be=r(106);function xe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var we=function(t){w()(r,t);var e=xe(r);function r(){return l()(this,r),e.apply(this,arguments)}return f()(r,[{key:"_applyConstraints",value:function(t){var e=t.maxZoom,r=t.minZoom,n=t.zoom;t.zoom=Object(gt.d)(n,r,e);var i=t.longitude,o=t.latitude;return(i<-180||i>180)&&(t.longitude=Object(Bt.e)(i+180,360)-180),t.latitude=Object(gt.d)(o,-89,89),t}}]),r}(be.a),Ee=function(t){w()(r,t);var e=xe(r);function r(t){return l()(this,r),t.dragMode=t.dragMode||"pan",e.call(this,we,t)}return f()(r,[{key:"setProps",value:function(t){_e()(T()(r.prototype),"setProps",this).call(this,t),this.dragRotate=!1,this.touchRotate=!1}},{key:"linearTransitionProps",get:function(){return["longitude","latitude","zoom"]}}]),r}(jt.a);function Se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Oe(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Te(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var Pe=function(t){w()(r,t);var e=Te(r);function r(t){return l()(this,r),e.call(this,Oe(Oe({},t),{},{type:St}))}return f()(r,[{key:"controller",get:function(){return this._getControllerProps({type:Ee})}}]),r}(kt.a);Pe.displayName="GlobeView";var Me=r(208),Ce=r(127),Ie=r(107),ke=r(128);function Re(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Le(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Le(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function je(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function De(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?je(Object(r),!0).forEach((function(e){u()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T()(t);if(e){var i=T()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S()(this,r)}}var Fe=["bearing","pitch"],ze={speed:1.2,curve:1.414},Ne=function(t){w()(r,t);var e=Be(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l()(this,r),(t=e.call(this,{compare:["longitude","latitude","zoom","bearing","pitch"],extract:["width","height","longitude","latitude","zoom","bearing","pitch"],required:["width","height","latitude","longitude","zoom"]})).props=De(De({},ze),n),t}return f()(r,[{key:"interpolateProps",value:function(t,e,r){var n,i=Object(Lt.d)(t,e,r,this.props),o=Re(Fe);try{for(o.s();!(n=o.n()).done;){var a=n.value;i[a]=Object(gt.f)(t[a]||0,e[a]||0,r)}}catch(t){o.e(t)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var r=e.transitionDuration;return"auto"===r&&(r=Object(Lt.h)(t,e,this.props)),r}}]),r}(Ie.a),Ue=r(18),Ve=r(53),Ge=r(209),We=r(66),He=r(154),qe=r(80),Ze=r(153),Xe=r(129);r.d(e,"COORDINATE_SYSTEM",(function(){return n.a})),r.d(e,"UNIT",(function(){return n.d})),r.d(e,"LightingEffect",(function(){return i.a})),r.d(e,"AmbientLight",(function(){return o.a})),r.d(e,"DirectionalLight",(function(){return a.a})),r.d(e,"PointLight",(function(){return _})),r.d(e,"_CameraLight",(function(){return C})),r.d(e,"_SunLight",(function(){return G})),r.d(e,"PostProcessEffect",(function(){return nt})),r.d(e,"_LayersPass",(function(){return st.a})),r.d(e,"Deck",(function(){return ut.a})),r.d(e,"LayerManager",(function(){return ct.a})),r.d(e,"AttributeManager",(function(){return lt.a})),r.d(e,"Layer",(function(){return ht.a})),r.d(e,"CompositeLayer",(function(){return ft.a})),r.d(e,"DeckRenderer",(function(){return pt.a})),r.d(e,"Viewport",(function(){return dt.a})),r.d(e,"WebMercatorViewport",(function(){return At.a})),r.d(e,"_GlobeViewport",(function(){return St})),r.d(e,"picking",(function(){return Tt.a})),r.d(e,"project",(function(){return Pt.a})),r.d(e,"project32",(function(){return Mt.a})),r.d(e,"gouraudLighting",(function(){return Ct.a})),r.d(e,"phongLighting",(function(){return Ct.b})),r.d(e,"shadow",(function(){return It.a})),r.d(e,"View",(function(){return kt.a})),r.d(e,"MapView",(function(){return Rt.a})),r.d(e,"FirstPersonView",(function(){return Xt})),r.d(e,"OrbitView",(function(){return se})),r.d(e,"OrthographicView",(function(){return ye})),r.d(e,"_GlobeView",(function(){return Pe})),r.d(e,"Controller",(function(){return jt.a})),r.d(e,"MapController",(function(){return be.b})),r.d(e,"_GlobeController",(function(){return Ee})),r.d(e,"FirstPersonController",(function(){return Gt})),r.d(e,"OrbitController",(function(){return te})),r.d(e,"OrthographicController",(function(){return he})),r.d(e,"Effect",(function(){return W.a})),r.d(e,"LayerExtension",(function(){return Me.a})),r.d(e,"TRANSITION_EVENTS",(function(){return Ce.a})),r.d(e,"TransitionInterpolator",(function(){return Ie.a})),r.d(e,"LinearInterpolator",(function(){return ke.a})),r.d(e,"FlyToInterpolator",(function(){return Ne})),r.d(e,"log",(function(){return Ue.a})),r.d(e,"createIterable",(function(){return Ve.a})),r.d(e,"fp64LowPart",(function(){return Bt.b})),r.d(e,"Tesselator",(function(){return Ge.a})),r.d(e,"_fillArray",(function(){return We.a})),r.d(e,"_flatten",(function(){return We.b})),r.d(e,"_count",(function(){return He.a})),r.d(e,"_memoize",(function(){return qe.a})),r.d(e,"_mergeShaders",(function(){return Ze.a})),r.d(e,"_compareProps",(function(){return Xe.a}))},,function(t,e,r){"use strict";r.d(e,"q",(function(){return i})),r.d(e,"f",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"h",(function(){return s})),r.d(e,"p",(function(){return u})),r.d(e,"o",(function(){return c})),r.d(e,"k",(function(){return l})),r.d(e,"l",(function(){return h})),r.d(e,"m",(function(){return f})),r.d(e,"n",(function(){return p})),r.d(e,"e",(function(){return d})),r.d(e,"c",(function(){return A})),r.d(e,"d",(function(){return g})),r.d(e,"j",(function(){return m})),r.d(e,"i",(function(){return y})),r.d(e,"g",(function(){return v})),r.d(e,"b",(function(){return _}));var n=r(12);function i(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function o(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],f=e[10],p=e[11],d=e[12],A=e[13],g=e[14],m=e[15],y=r*s-n*a,v=r*u-i*a,_=r*c-o*a,b=n*u-i*s,x=n*c-o*s,w=i*c-o*u,E=l*A-h*d,S=l*g-f*d,O=l*m-p*d,T=h*g-f*A,P=h*m-p*A,M=f*m-p*g,C=y*M-v*P+_*T+b*O-x*S+w*E;return C?(C=1/C,t[0]=(s*M-u*P+c*T)*C,t[1]=(i*P-n*M-o*T)*C,t[2]=(A*w-g*x+m*b)*C,t[3]=(f*x-h*w-p*b)*C,t[4]=(u*O-a*M-c*S)*C,t[5]=(r*M-i*O+o*S)*C,t[6]=(g*_-d*w-m*v)*C,t[7]=(l*w-f*_+p*v)*C,t[8]=(a*P-s*O+c*E)*C,t[9]=(n*O-r*P-o*E)*C,t[10]=(d*x-A*_+m*y)*C,t[11]=(h*_-l*x-p*y)*C,t[12]=(s*S-a*T-u*E)*C,t[13]=(r*T-n*S+i*E)*C,t[14]=(A*v-d*b-g*y)*C,t[15]=(l*b-h*v+f*y)*C,t):null}function a(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],h=t[10],f=t[11],p=t[12],d=t[13],A=t[14],g=t[15];return(e*a-r*o)*(h*g-f*A)-(e*s-n*o)*(l*g-f*d)+(e*u-i*o)*(l*A-h*d)+(r*s-n*a)*(c*g-f*p)-(r*u-i*a)*(c*A-h*p)+(n*u-i*s)*(c*d-l*p)}function s(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],p=e[10],d=e[11],A=e[12],g=e[13],m=e[14],y=e[15],v=r[0],_=r[1],b=r[2],x=r[3];return t[0]=v*n+_*s+b*h+x*A,t[1]=v*i+_*u+b*f+x*g,t[2]=v*o+_*c+b*p+x*m,t[3]=v*a+_*l+b*d+x*y,v=r[4],_=r[5],b=r[6],x=r[7],t[4]=v*n+_*s+b*h+x*A,t[5]=v*i+_*u+b*f+x*g,t[6]=v*o+_*c+b*p+x*m,t[7]=v*a+_*l+b*d+x*y,v=r[8],_=r[9],b=r[10],x=r[11],t[8]=v*n+_*s+b*h+x*A,t[9]=v*i+_*u+b*f+x*g,t[10]=v*o+_*c+b*p+x*m,t[11]=v*a+_*l+b*d+x*y,v=r[12],_=r[13],b=r[14],x=r[15],t[12]=v*n+_*s+b*h+x*A,t[13]=v*i+_*u+b*f+x*g,t[14]=v*o+_*c+b*p+x*m,t[15]=v*a+_*l+b*d+x*y,t}function u(t,e,r){var n,i,o,a,s,u,c,l,h,f,p,d,A=r[0],g=r[1],m=r[2];return e===t?(t[12]=e[0]*A+e[4]*g+e[8]*m+e[12],t[13]=e[1]*A+e[5]*g+e[9]*m+e[13],t[14]=e[2]*A+e[6]*g+e[10]*m+e[14],t[15]=e[3]*A+e[7]*g+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=p,t[11]=d,t[12]=n*A+s*g+h*m+e[12],t[13]=i*A+u*g+f*m+e[13],t[14]=o*A+c*g+p*m+e[14],t[15]=a*A+l*g+d*m+e[15]),t}function c(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function l(t,e,r,i){var o,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x,w,E,S,O,T,P,M=i[0],C=i[1],I=i[2],k=Math.hypot(M,C,I);return k<n.b?null:(M*=k=1/k,C*=k,I*=k,o=Math.sin(r),s=1-(a=Math.cos(r)),u=e[0],c=e[1],l=e[2],h=e[3],f=e[4],p=e[5],d=e[6],A=e[7],g=e[8],m=e[9],y=e[10],v=e[11],_=M*M*s+a,b=C*M*s+I*o,x=I*M*s-C*o,w=M*C*s-I*o,E=C*C*s+a,S=I*C*s+M*o,O=M*I*s+C*o,T=C*I*s-M*o,P=I*I*s+a,t[0]=u*_+f*b+g*x,t[1]=c*_+p*b+m*x,t[2]=l*_+d*b+y*x,t[3]=h*_+A*b+v*x,t[4]=u*w+f*E+g*S,t[5]=c*w+p*E+m*S,t[6]=l*w+d*E+y*S,t[7]=h*w+A*E+v*S,t[8]=u*O+f*T+g*P,t[9]=c*O+p*T+m*P,t[10]=l*O+d*T+y*P,t[11]=h*O+A*T+v*P,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function h(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*n,t[5]=a*i+l*n,t[6]=s*i+h*n,t[7]=u*i+f*n,t[8]=c*i-o*n,t[9]=l*i-a*n,t[10]=h*i-s*n,t[11]=f*i-u*n,t}function f(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],c=e[8],l=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*n,t[1]=a*i-l*n,t[2]=s*i-h*n,t[3]=u*i-f*n,t[8]=o*n+c*i,t[9]=a*n+l*i,t[10]=s*n+h*i,t[11]=u*n+f*i,t}function p(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],c=e[4],l=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*n,t[1]=a*i+l*n,t[2]=s*i+h*n,t[3]=u*i+f*n,t[4]=c*i-o*n,t[5]=l*i-a*n,t[6]=h*i-s*n,t[7]=f*i-u*n,t}function d(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],u=e[8],c=e[9],l=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(u,c,l),t}function A(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,u=i+i,c=r*a,l=n*a,h=n*s,f=i*a,p=i*s,d=i*u,A=o*a,g=o*s,m=o*u;return t[0]=1-h-d,t[1]=l+m,t[2]=f-g,t[3]=0,t[4]=l-m,t[5]=1-c-d,t[6]=p+A,t[7]=0,t[8]=f+g,t[9]=p-A,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function g(t,e,r,n,i,o,a){var s=1/(r-e),u=1/(i-n),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*c,t[15]=0,t}function m(t,e,r,n,i){var o,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t}function y(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(a+o)*c,t[15]=1,t}function v(t,e,r,i){var o,a,s,u,c,l,h,f,p,d,A=e[0],g=e[1],m=e[2],y=i[0],v=i[1],_=i[2],b=r[0],x=r[1],w=r[2];return Math.abs(A-b)<n.b&&Math.abs(g-x)<n.b&&Math.abs(m-w)<n.b?function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}(t):(h=A-b,f=g-x,p=m-w,o=v*(p*=d=1/Math.hypot(h,f,p))-_*(f*=d),a=_*(h*=d)-y*p,s=y*f-v*h,(d=Math.hypot(o,a,s))?(o*=d=1/d,a*=d,s*=d):(o=0,a=0,s=0),u=f*s-p*a,c=p*o-h*s,l=h*a-f*o,(d=Math.hypot(u,c,l))?(u*=d=1/d,c*=d,l*=d):(u=0,c=0,l=0),t[0]=o,t[1]=u,t[2]=h,t[3]=0,t[4]=a,t[5]=c,t[6]=f,t[7]=0,t[8]=s,t[9]=l,t[10]=p,t[11]=0,t[12]=-(o*A+a*g+s*m),t[13]=-(u*A+c*g+l*m),t[14]=-(h*A+f*g+p*m),t[15]=1,t)}function _(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],f=t[9],p=t[10],d=t[11],A=t[12],g=t[13],m=t[14],y=t[15],v=e[0],_=e[1],b=e[2],x=e[3],w=e[4],E=e[5],S=e[6],O=e[7],T=e[8],P=e[9],M=e[10],C=e[11],I=e[12],k=e[13],R=e[14],L=e[15];return Math.abs(r-v)<=n.b*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-_)<=n.b*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(o-b)<=n.b*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-x)<=n.b*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(s-w)<=n.b*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(u-E)<=n.b*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-S)<=n.b*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(l-O)<=n.b*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(h-T)<=n.b*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(f-P)<=n.b*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(p-M)<=n.b*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(d-C)<=n.b*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(A-I)<=n.b*Math.max(1,Math.abs(A),Math.abs(I))&&Math.abs(g-k)<=n.b*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(m-R)<=n.b*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(y-L)<=n.b*Math.max(1,Math.abs(y),Math.abs(L))}},function(t,e,r){"use strict";var n=r(276);e.a=new n.a({id:"deck"})},function(t,e,r){"use strict";r.d(e,"f",(function(){return o})),r.d(e,"h",(function(){return a})),r.d(e,"g",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"a",(function(){return c})),r.d(e,"e",(function(){return l})),r.d(e,"j",(function(){return h})),r.d(e,"b",(function(){return f})),r.d(e,"c",(function(){return p})),r.d(e,"i",(function(){return d})),r.d(e,"k",(function(){return A}));const n=t=>"boolean"==typeof t,i=t=>"function"==typeof t,o=t=>null!==t&&"object"==typeof t,a=t=>o(t)&&t.constructor==={}.constructor,s=t=>o(t)&&i(t.then),u=t=>t&&"function"==typeof t[Symbol.iterator],c=t=>t&&"function"==typeof t[Symbol.asyncIterator],l=t=>t&&i(t.next),h=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,f=t=>"undefined"!=typeof Blob&&t instanceof Blob,p=t=>t&&"object"==typeof t&&t.isBuffer,d=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||o(t)&&i(t.tee)&&i(t.cancel)&&i(t.getReader))(t)||(t=>o(t)&&i(t.read)&&i(t.pipe)&&n(t.readable))(t),A=t=>(t=>o(t)&&i(t.abort)&&i(t.getWriter))(t)||(t=>o(t)&&i(t.end)&&i(t.write)&&n(t.writable))(t)},function(t,e,r){"use strict";var n={};function i(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}function o(...t){return(t=t.map((e,r)=>(r&&(e=e.replace(new RegExp("^/"),"")),r!==t.length-1&&(e=e.replace(new RegExp("/$"),"")),e))).join("/")}r.r(n),r.d(n,"dirname",(function(){return i})),r.d(n,"join",(function(){return o}));var a=r(210);r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return a}))},function(t,e,r){"use strict";r.d(e,"c",(function(){return i})),r.d(e,"h",(function(){return o})),r.d(e,"f",(function(){return a})),r.d(e,"a",(function(){return s})),r.d(e,"k",(function(){return u})),r.d(e,"l",(function(){return c})),r.d(e,"e",(function(){return l})),r.d(e,"d",(function(){return h})),r.d(e,"i",(function(){return f})),r.d(e,"s",(function(){return p})),r.d(e,"r",(function(){return d})),r.d(e,"t",(function(){return A})),r.d(e,"m",(function(){return g})),r.d(e,"n",(function(){return m})),r.d(e,"o",(function(){return y})),r.d(e,"b",(function(){return v})),r.d(e,"q",(function(){return b})),r.d(e,"j",(function(){return x})),r.d(e,"g",(function(){return w})),r.d(e,"p",(function(){return E}));var n=r(12);function i(){var t=new n.a(3);return n.a!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function o(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function a(t,e,r){var i=new n.a(3);return i[0]=t,i[1]=e,i[2]=r,i}function s(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function u(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function c(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function l(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function h(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],u=r[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t}function f(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}function p(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t}function d(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}function A(t,e,r){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],u=e[1],c=e[2],l=i*c-o*u,h=o*s-n*c,f=n*u-i*s,p=i*f-o*h,d=o*l-n*f,A=n*h-i*l,g=2*a;return l*=g,h*=g,f*=g,p*=2,d*=2,A*=2,t[0]=s+l+p,t[1]=u+h+d,t[2]=c+f+A,t}function g(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function m(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function y(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function v(t,e){var r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],s=e[2],u=Math.sqrt(r*r+n*n+i*i)*Math.sqrt(o*o+a*a+s*s),c=u&&l(t,e)/u;return Math.acos(Math.min(Math.max(c,-1),1))}var _,b=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},x=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},w=o,E=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n};_=i()},function(t,e,r){"use strict";var n=r(28);function i(t,e){const r=n.n([],e,t);return n.k(r,r,1/r[3]),r}function o(t,e){const r=t%e;return r<0?e+r:r}const a=Math.log2||function(t){return Math.log(t)*Math.LOG2E};var s=r(17),u=r(27),c=r(21);function l(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const h=Math.PI,f=h/4,p=h/180,d=180/h;function A(t){return Math.pow(2,t)}function g(t){return a(t)}function m([t,e]){l(Number.isFinite(t)),l(Number.isFinite(e)&&e>=-90&&e<=90,"invalid latitude");const r=e*p;return[512*(t*p+h)/(2*h),512*(h+Math.log(Math.tan(f+.5*r)))/(2*h)]}function y([t,e]){const r=t/512*(2*h)-h,n=2*(Math.atan(Math.exp(e/512*(2*h)-h))-f);return[r*d,n*d]}function v({latitude:t}){return l(Number.isFinite(t)),g(4003e4*Math.cos(t*p))-9}function _({latitude:t,longitude:e,highPrecision:r=!1}){l(Number.isFinite(t)&&Number.isFinite(e));const n={},i=Math.cos(t*p),o=512/360/i,a=512/4003e4/i;if(n.unitsPerMeter=[a,a,a],n.metersPerUnit=[1/a,1/a,1/a],n.unitsPerDegree=[512/360,o,a],n.degreesPerUnit=[.703125,1/o,1/a],r){const e=p*Math.tan(t*p)/i,r=512/360*e/2,s=512/4003e4*e,u=s/o*a;n.unitsPerDegree2=[0,r,s],n.unitsPerMeter2=[u,0,u]}return n}function b(t,e){const[r,n,i]=t,[o,a,s]=e,{unitsPerMeter:u,unitsPerMeter2:c}=_({longitude:r,latitude:n,highPrecision:!0}),l=m(t);l[0]+=o*(u[0]+c[0]*a),l[1]+=a*(u[1]+c[1]*a);const h=y(l),f=(i||0)+(s||0);return Number.isFinite(i)||Number.isFinite(s)?[h[0],h[1],f]:h}function x({height:t,pitch:e,bearing:r,altitude:n,scale:i,center:o=null}){const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return s.p(a,a,[0,0,-n]),s.l(a,a,-e*p),s.n(a,a,r*p),i/=t,s.o(a,a,[i,i,i]),o&&s.p(a,a,c.k([],o)),a}function w({width:t,height:e,fovy:r=E(1.5),altitude:n,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==n&&(r=E(n));const s=.5*r*p,u=S(r),c=i*p,l=Math.sin(s)*u/Math.sin(Math.min(Math.max(Math.PI/2-c-s,.01),Math.PI-.01));return{fov:2*s,aspect:t/e,focalDistance:u,near:o,far:(Math.sin(c)*l+u)*a}}function E(t){return 2*Math.atan(.5/t)*d}function S(t){return.5/Math.tan(.5*t*p)}function O(t,e){const[r,n,o=0]=t;return l(Number.isFinite(r)&&Number.isFinite(n)&&Number.isFinite(o)),i(e,[r,n,o,1])}function T(t,e,r=0){const[n,o,a]=t;if(l(Number.isFinite(n)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(a)){return i(e,[n,o,a,1])}const s=i(e,[n,o,0,1]),c=i(e,[n,o,1,1]),h=s[2],f=c[2],p=h===f?0:((r||0)-h)/(f-h);return u.c([],s,c,p)}function P({width:t,height:e,bounds:r,minExtent:n=0,maxZoom:i=24,padding:o=0,offset:s=[0,0]}){const[[u,c],[h,f]]=r;if(Number.isFinite(o)){o={top:o,bottom:o,left:o,right:o}}else l(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const p=new k({width:t,height:e,longitude:0,latitude:0,zoom:0}),d=p.project([u,f]),A=p.project([h,c]),g=[Math.max(Math.abs(A[0]-d[0]),n),Math.max(Math.abs(A[1]-d[1]),n)],m=[t-o.left-o.right-2*Math.abs(s[0]),e-o.top-o.bottom-2*Math.abs(s[1])];l(m[0]>0&&m[1]>0);const y=m[0]/g[0],v=m[1]/g[1],_=(o.right-o.left)/2/y,b=(o.bottom-o.top)/2/v,x=[(A[0]+d[0])/2+_,(A[1]+d[1])/2+b],w=p.unproject(x),E=Math.min(i,p.zoom+a(Math.abs(Math.min(y,v))));return l(Number.isFinite(E)),{longitude:w[0],latitude:w[1],zoom:E}}const M=Math.PI/180;function C(t,e=0){const{width:r,height:n,unproject:i}=t,o={targetZ:e},a=i([0,n],o),s=i([r,n],o);let u,c;return(t.fovy?.5*t.fovy*M:Math.atan(.5/t.altitude))>(90-t.pitch)*M-.01?(u=I(t,0,e),c=I(t,r,e)):(u=i([0,0],o),c=i([r,0],o)),[a,s,c,u]}function I(t,e,r){const{pixelUnprojectionMatrix:n}=t,o=i(n,[e,0,1,1]),a=i(n,[e,t.height,1,1]),s=(r*t.distanceScales.unitsPerMeter[2]-o[2])/(a[2]-o[2]),c=y(u.c([],o,a,s));return c[2]=r,c}class k{constructor({width:t,height:e,latitude:r=0,longitude:n=0,zoom:i=0,pitch:o=0,bearing:a=0,altitude:u=null,fovy:l=null,position:h=null,nearZMultiplier:f=.02,farZMultiplier:p=1.01}={width:1,height:1}){t=t||1,e=e||1,null===l&&null===u?l=E(u=1.5):null===l?l=E(u):null===u&&(u=S(l));const d=A(i);u=Math.max(.75,u);const g=_({longitude:n,latitude:r}),y=m([n,r]);y[2]=0,h&&c.a(y,y,c.j([],h,g.unitsPerMeter)),this.projectionMatrix=function({width:t,height:e,pitch:r,altitude:n,fovy:i,nearZMultiplier:o,farZMultiplier:a}){const{fov:u,aspect:c,near:l,far:h}=w({width:t,height:e,altitude:n,fovy:i,pitch:r,nearZMultiplier:o,farZMultiplier:a});return s.j([],u,c,l,h)}({width:t,height:e,pitch:o,fovy:l,nearZMultiplier:f,farZMultiplier:p}),this.viewMatrix=x({height:e,scale:d,center:y,pitch:o,bearing:a,altitude:u}),this.width=t,this.height=e,this.scale=d,this.latitude=r,this.longitude=n,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=u,this.fovy=l,this.center=y,this.meterOffset=h||[0,0,0],this.distanceScales=g,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){const{width:t,height:e,projectionMatrix:r,viewMatrix:n}=this,i=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];s.h(i,i,r),s.h(i,i,n),this.viewProjectionMatrix=i;const o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];s.o(o,o,[t/2,-e/2,1]),s.p(o,o,[1,-1,0]),s.h(o,o,i);const a=s.f([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],o);if(!a)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=o,this.pixelUnprojectionMatrix=a}equals(t){return t instanceof k&&(t.width===this.width&&t.height===this.height&&s.b(t.projectionMatrix,this.projectionMatrix)&&s.b(t.viewMatrix,this.viewMatrix))}project(t,{topLeft:e=!0}={}){const r=O(this.projectPosition(t),this.pixelProjectionMatrix),[n,i]=r,o=e?i:this.height-i;return 2===t.length?[n,o]:[n,o,r[2]]}unproject(t,{topLeft:e=!0,targetZ:r}={}){const[n,i,o]=t,a=e?i:this.height-i,s=r&&r*this.distanceScales.unitsPerMeter[2],u=T([n,a,o],this.pixelUnprojectionMatrix,s),[c,l,h]=this.unprojectPosition(u);return Number.isFinite(o)?[c,l,h]:Number.isFinite(r)?[c,l,r]:[c,l]}projectPosition(t){const[e,r]=m(t);return[e,r,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){const[e,r]=y(t);return[e,r,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){return m(t)}unprojectFlat(t){return y(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){const r=T(e,this.pixelUnprojectionMatrix),n=m(t),i=u.a([],n,u.d([],r));return y(u.a([],this.center,i))}getLocationAtPoint({lngLat:t,pos:e}){return this.getMapCenterByLngLatPosition({lngLat:t,pos:e})}fitBounds(t,e={}){const{width:r,height:n}=this,{longitude:i,latitude:o,zoom:a}=P(Object.assign({width:r,height:n,bounds:t},e));return new k({width:r,height:n,longitude:i,latitude:o,zoom:a})}getBounds(t){const e=this.getBoundingRegion(t),r=Math.min(...e.map(t=>t[0])),n=Math.max(...e.map(t=>t[0]));return[[r,Math.min(...e.map(t=>t[1]))],[n,Math.max(...e.map(t=>t[1]))]]}getBoundingRegion(t={}){return C(this,t.z||0)}}function R({width:t,height:e,longitude:r,latitude:n,zoom:i,pitch:s=0,bearing:u=0}){(r<-180||r>180)&&(r=o(r+180,360)-180),(u<-180||u>180)&&(u=o(u+180,360)-180);let c=new k({width:t,height:e,longitude:r,latitude:n,zoom:i}),l=c.project([r,85.05113])[1],h=c.project([r,-85.05113])[1],f=0;return h-l<e&&(i+=a(e/(h-l)),c=new k({width:t,height:e,longitude:r,latitude:n,zoom:i}),l=c.project([r,85.05113])[1],h=c.project([r,-85.05113])[1]),l>0?f=l:h<e&&(f=h-e),f&&(n=c.unproject([t/2,e/2+f])[1]),{width:t,height:e,longitude:r,latitude:n,zoom:i,pitch:s,bearing:u}}const L=["longitude","latitude","zoom"],j={curve:1.414,speed:1.2};function D(t,e,r,n={}){const i={},{startZoom:o,startCenterXY:a,uDelta:s,w0:c,u1:l,S:h,rho:f,rho2:p,r0:d}=F(t,e,n);if(l<.01){for(const n of L){const o=t[n],a=e[n];i[n]=(A=r)*a+(1-A)*o}return i}var A;const m=r*h,v=Math.cosh(d)/Math.cosh(d+f*m),_=c*((Math.cosh(d)*Math.tanh(d+f*m)-Math.sinh(d))/p)/l,b=o+g(1/v),x=u.e([],s,_);u.a(x,x,a);const w=y(x);return i.longitude=w[0],i.latitude=w[1],i.zoom=b,i}function B(t,e,r={}){r=Object.assign({},j,r);const{screenSpeed:n,speed:i,maxDuration:o}=r,{S:a,rho:s}=F(t,e,r),u=1e3*a;let c;return c=Number.isFinite(n)?u/(n/s):u/i,Number.isFinite(o)&&c>o?0:c}function F(t,e,r){const n=(r=Object.assign({},j,r)).curve,i=t.zoom,o=[t.longitude,t.latitude],a=A(i),s=e.zoom,c=[e.longitude,e.latitude],l=A(s-i),h=m(o),f=m(c),p=u.f([],f,h),d=Math.max(t.width,t.height),g=d/l,y=u.b(p)*a,v=Math.max(y,.01),_=n*n,b=(g*g-d*d+_*_*v*v)/(2*d*_*v),x=(g*g-d*d-_*_*v*v)/(2*g*_*v),w=Math.log(Math.sqrt(b*b+1)-b),E=Math.log(Math.sqrt(x*x+1)-x);return{startZoom:i,startCenterXY:h,uDelta:p,w0:d,u1:y,S:(E-w)/n,rho:n,rho2:_,r0:w,r1:E}}r.d(e,"f",(function(){return C})),r.d(e,"c",(function(){return P})),r.d(e,"m",(function(){return R})),r.d(e,"d",(function(){return D})),r.d(e,"h",(function(){return B})),r.d(e,"l",(function(){return m})),r.d(e,"o",(function(){return y})),r.d(e,"p",(function(){return O})),r.d(e,"n",(function(){return T})),r.d(e,"b",(function(){return E})),r.d(e,"e",(function(){return S})),r.d(e,"i",(function(){return v})),r.d(e,"g",(function(){return _})),r.d(e,"a",(function(){return b})),r.d(e,"k",(function(){return x})),r.d(e,"j",(function(){return w}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return s}));var n=r(13);function i(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${t}`);return t}function o(t,e,r=""){if(n.b.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}const a={};function s(t,e){a[t]||(a[t]=!0,console.warn(`${t} has been removed in version ${e}, see upgrade guide for more information`))}},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r},function(t,e,r){"use strict";(function(t){var n=r(13),i=r(147);r.d(e,"b",(function(){return i.a}));var o=r(205);r.d(e,"a",(function(){return o.a})),r.d(e,"e",(function(){return n.d})),r.d(e,"d",(function(){return n.a})),r.d(e,"f",(function(){return n.g}));var a=r(143);r.d(e,"c",(function(){return a.a}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t};(s.global||s.self||s.window).mathgl={config:n.b}}).call(this,r(65))},function(t,e,r){t.exports=r(253)},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"e",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"d",(function(){return s})),r.d(e,"c",(function(){return u})),r.d(e,"g",(function(){return c})),r.d(e,"h",(function(){return l})),r.d(e,"i",(function(){return h})),r.d(e,"j",(function(){return f})),r.d(e,"f",(function(){return A}));var n=r(12);function i(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function o(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function a(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function s(t,e){return t[0]=-e[0],t[1]=-e[1],t}function u(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t}function c(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t}function l(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t}function h(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function f(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}var p,d,A=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t};p=new n.a(2),n.a!=Float32Array&&(p[0]=0,p[1]=0),d=p},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"g",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"l",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"k",(function(){return c})),r.d(e,"h",(function(){return l})),r.d(e,"m",(function(){return h})),r.d(e,"j",(function(){return f})),r.d(e,"d",(function(){return p})),r.d(e,"i",(function(){return d})),r.d(e,"n",(function(){return A})),r.d(e,"o",(function(){return g})),r.d(e,"f",(function(){return m})),r.d(e,"e",(function(){return y}));var n=r(12);function i(t){var e=new n.a(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function o(t,e,r,i){var o=new n.a(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function s(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function u(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function c(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function l(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function h(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function f(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function p(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function d(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function A(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function g(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*o-u*i,h=c*i+u*n-a*o,f=c*o+a*i-s*n,p=-a*n-s*i-u*o;return t[0]=l*c+p*-a+h*-u-f*-s,t[1]=h*c+p*-s+f*-a-l*-u,t[2]=f*c+p*-u+l*-s-h*-a,t[3]=e[3],t}function m(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function y(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],u=e[1],c=e[2],l=e[3];return Math.abs(r-s)<=n.b*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-u)<=n.b*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(o-c)<=n.b*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(a-l)<=n.b*Math.max(1,Math.abs(a),Math.abs(l))}var v,_;v=new n.a(4),n.a!=Float32Array&&(v[0]=0,v[1]=0,v[2]=0,v[3]=0),_=v},function(t,e,r){t.exports=r(264)()},,function(t,e,r){"use strict";r.d(e,"d",(function(){return i})),r.d(e,"e",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(36);function i(t){return"undefined"!=typeof WebGLRenderingContext&&t instanceof WebGLRenderingContext||("undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&Number.isFinite(t._version)))}function o(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}function a(t){return o(t)?t:null}function s(t){return Object(n.a)(i(t),"Invalid WebGLRenderingContext"),t}function u(t){return Object(n.a)(o(t),"Requires WebGL2"),t}},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));var n=r(18),i={};function o(t){i=t}function a(t){var e;n.a.level>0&&i[t]&&(e=i[t]).call.apply(e,arguments)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},i={COMPONENT:Symbol.for("component"),ASYNC_DEFAULTS:Symbol.for("asyncPropDefaults"),ASYNC_ORIGINAL:Symbol.for("asyncPropOriginal"),ASYNC_RESOLVED:Symbol.for("asyncPropResolved")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(39),i=r(64),o=r(54),a=r(7),s=r(9),u=r(133);const c={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},l={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:c},h={removedProps:c};class f extends n.a{constructor(t,e={}){super(t,e),this.stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),this.target=e.target||(this.gl.webgl2?36662:34962),this.initialize(e),Object.seal(this)}getElementCount(t=this.accessor){return Math.round(this.byteLength/i.a.getBytesPerElement(t))}getVertexCount(t=this.accessor){return Math.round(this.byteLength/i.a.getBytesPerVertex(t))}initialize(t={}){return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=Object(u.a)("Buffer",t,l),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return"accessor"in(t=Object(u.a)("Buffer",t,h))&&this.setAccessor(t.accessor),this}setAccessor(t){return delete(t=Object.assign({},t)).buffer,this.accessor=new i.a(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});const{data:e,offset:r=0,srcOffset:n=0}=t,i=t.byteLength||t.length;Object(s.a)(e);const o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),0!==n||void 0!==i?(Object(a.a)(this.gl),this.gl.bufferSubData(this.target,r,e,n,i)):this.gl.bufferSubData(o,r,e),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(e),this}copyData({sourceBuffer:t,readOffset:e=0,writeOffset:r=0,size:n}){const{gl:i}=this;return Object(a.a)(i),i.bindBuffer(36662,t.handle),i.bindBuffer(36663,this.handle),i.copyBufferSubData(36662,36663,e,r,n),i.bindBuffer(36662,null),i.bindBuffer(36663,null),this.debugData=null,this}getData({dstData:t=null,srcByteOffset:e=0,dstOffset:r=0,length:n=0}={}){Object(a.a)(this.gl);const i=Object(o.c)(this.accessor.type||5126,{clamped:!1}),u=this._getAvailableElementCount(e),c=r;let l,h;t?(h=t.length,l=h-c):(l=Math.min(u,n||u),h=c+l);const f=Math.min(u,l);return n=n||f,Object(s.a)(n<=f),t=t||new i(h),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,t,r,n),this.gl.bindBuffer(36662,null),t}bind({target:t=this.target,index:e=this.accessor&&this.accessor.index,offset:r=0,size:n}={}){return 35345===t||35982===t?void 0!==n?this.gl.bindBufferRange(t,e,this.handle,r,n):(Object(s.a)(0===r),this.gl.bindBufferBase(t,e,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind({target:t=this.target,index:e=this.accessor&&this.accessor.index}={}){return 35345===t||35982===t?this.gl.bindBufferBase(t,e,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(10,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t,e=0,r=t.byteLength+e){Object(s.a)(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();const n=this._getTarget();this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.usage),this.gl.bufferSubData(n,e,t),this.gl.bindBuffer(n,null),this.debugData=t.slice(0,10),this.bytesUsed=r,this._trackAllocatedMemory(r);const a=Object(o.b)(t);return Object(s.a)(a),this.setAccessor(new i.a(this.accessor,{type:a})),this}_setByteLength(t,e=this.usage){Object(s.a)(t>=0),this._trackDeallocatedMemory();let r=t;0===t&&(r=new Float32Array(0));const n=this._getTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,e),this.gl.bindBuffer(n,null),this.usage=e,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){const e=t/Object(o.c)(this.accessor.type||5126,{clamped:!1}).BYTES_PER_ELEMENT;return this.getElementCount()-e}_inferType(t){this.accessor.type||this.setAccessor(new i.a(this.accessor,{type:Object(o.b)(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);const e=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),e}get type(){return a.k.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}get bytes(){return a.k.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}setByteLength(t){return a.k.deprecated("setByteLength","reallocate")(),this.reallocate(t)}updateAccessor(t){return a.k.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new i.a(this.accessor,t),this}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"e",(function(){return a})),r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"b",(function(){return f})),r.d(e,"f",(function(){return p}));var n=r(67),i=r(11);function o(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function a(t,e){var r=t%e;return r<0?e+r:r}function s(t){return[t[12],t[13],t[14]]}function u(t){var e={};return e.left=h(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),e.right=h(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),e.bottom=h(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),e.top=h(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),e.near=h(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),e.far=h(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14]),e}var c,l=new i.b;function h(t,e,r,n){l.set(t,e,r);var o=l.len();return{distance:n/o,normal:new i.b(-t/o,-e/o,-r/o)}}function f(t){return t-Math.fround(t)}function p(t,e){var r=e.size,i=void 0===r?1:r,o=e.startIndex,a=void 0===o?0:o,s=e.endIndex;Number.isFinite(s)||(s=t.length);var u=(s-a)/i;c=n.a.allocate(c,u,{type:Float32Array,size:2*i});for(var l=a,h=0;l<s;){for(var p=0;p<i;p++){var d=t[l++];c[h+p]=d,c[h+p+i]=f(d)}h+=2*i}return c.subarray(0,u*i*2)}},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r(13);const n={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function i(t,e,r={}){return function(t,e={}){return Math.sign(o(t,e))}(t,r)!==e&&(function(t,e){const{start:r=0,end:n=t.length,size:i=2}=e,o=(n-r)/i,a=Math.floor(o/2);for(let e=0;e<a;++e){const n=r+e*i,a=r+(o-1-e)*i;for(let e=0;e<i;++e){const r=t[n+e];t[n+e]=t[a+e],t[a+e]=r}}}(t,r),!0)}function o(t,e={}){const{start:r=0,end:n=t.length}=e,i=e.size||2;let o=0;for(let e=r,a=n-i;e<n;e+=i)o+=(t[e]-t[a])*(t[e+1]+t[a+1]),a=e;return o/2}function a(t,e,r,n){r=r||2;const i=e&&e.length,o=i?e[0]*r:t.length;let a=s(t,0,o,r,!0,n&&n[0]);const l=[];if(!a||a.next===a.prev)return l;let h,f,p,g,m,v,_;if(i&&(a=function(t,e,r,n,i){const o=[];let a,c,l,h,f;for(a=0,c=e.length;a<c;a++)l=e[a]*n,h=a<c-1?e[a+1]*n:t.length,f=s(t,l,h,n,!1,i&&i[a+1]),f===f.next&&(f.steiner=!0),o.push(y(f));for(o.sort(d),a=0;a<o.length;a++)A(o[a],r),r=u(r,r.next);return r}(t,e,a,r,n)),t.length>80*r){g=f=t[0],m=p=t[1];for(let e=r;e<o;e+=r)v=t[e],_=t[e+1],v<g&&(g=v),_<m&&(m=_),v>f&&(f=v),_>p&&(p=_);h=Math.max(f-g,p-m),h=0!==h?1/h:0}return c(a,l,r,g,m,h),l}function s(t,e,r,n,i,a){let s,u;if(void 0===a&&(a=o(t,{start:e,end:r,size:n})),i===a<0)for(s=e;s<r;s+=n)u=P(s,t[s],t[s+1],u);else for(s=r-n;s>=e;s-=n)u=P(s,t[s],t[s+1],u);return u&&x(u,u.next)&&(M(u),u=u.next),u}function u(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!x(n,n.next)&&0!==b(n.prev,n,n.next))n=n.next;else{if(M(n),n=e=n.prev,n===n.next)break;r=!0}}while(r||n!==e);return e}function c(t,e,r,n,i,o,a){if(!t)return;!a&&o&&function(t,e,r,n){let i=t;do{null===i.z&&(i.z=m(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,r,n,i,o,a,s,u,c=1;do{for(i=t,t=null,u=null,n=0;i;){for(n++,a=i,o=0,r=0;r<c&&(o++,a=a.nextZ,a);r++);for(s=c;o>0||s>0&&a;)0!==o&&(0===s||!a||i.z<=a.z)?(e=i,i=i.nextZ,o--):(e=a,a=a.nextZ,s--),u?u.nextZ=e:t=e,e.prevZ=u,u=e;i=a}u.nextZ=null,c*=2}while(n>1)}(i)}(t,n,i,o);let s,d,A=t;for(;t.prev!==t.next;)if(s=t.prev,d=t.next,o?h(t,n,i,o):l(t))e.push(s.i/r),e.push(t.i/r),e.push(d.i/r),M(t),t=d.next,A=d.next;else if((t=d)===A){a?1===a?c(t=f(u(t),e,r),e,r,n,i,o,2):2===a&&p(t,e,r,n,i,o):c(u(t),e,r,n,i,o,1);break}}function l(t){const e=t.prev,r=t,n=t.next;if(b(e,r,n)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(v(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function h(t,e,r,n){const i=t.prev,o=t,a=t.next;if(b(i,o,a)>=0)return!1;const s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=m(s,u,e,r,n),f=m(c,l,e,r,n);let p=t.prevZ,d=t.nextZ;for(;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&v(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&v(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&v(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&v(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function f(t,e,r){let n=t;do{const i=n.prev,o=n.next.next;!x(i,o)&&w(i,n,n.next,o)&&O(i,o)&&O(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),M(n),M(n.next),n=t=o),n=n.next}while(n!==t);return u(n)}function p(t,e,r,n,i,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&_(a,t)){let s=T(a,t);return a=u(a,a.next),s=u(s,s.next),c(a,e,r,n,i,o),void c(s,e,r,n,i,o)}t=t.next}a=a.next}while(a!==t)}function d(t,e){return t.x-e.x}function A(t,e){if(e=function(t,e){let r=e;const n=t.x,i=t.y;let o,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>a){if(a=t,t===n){if(i===r.y)return r;if(i===r.next.y)return r.next}o=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!o)return null;if(n===a)return o;const s=o,u=o.x,c=o.y;let l,h=1/0;r=o;do{n>=r.x&&r.x>=u&&n!==r.x&&v(i<c?n:a,i,u,c,i<c?a:n,i,r.x,r.y)&&(l=Math.abs(i-r.y)/(n-r.x),O(r,t)&&(l<h||l===h&&(r.x>o.x||r.x===o.x&&g(o,r)))&&(o=r,h=l)),r=r.next}while(r!==s);return o}(t,e)){const r=T(e,t);u(e,e.next),u(r,r.next)}}function g(t,e){return b(t.prev,t,e.prev)<0&&b(e.next,t,t.next)<0}function m(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function y(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function v(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&w(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(O(t,e)&&O(e,t)&&function(t,e){let r=t,n=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(b(t.prev,t,e.prev)||b(t,e.prev,e))||x(t,e)&&b(t.prev,t,t.next)>0&&b(e.prev,e,e.next)>0)}function b(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function w(t,e,r,n){const i=S(b(t,e,r)),o=S(b(t,e,n)),a=S(b(r,n,t)),s=S(b(r,n,e));return i!==o&&a!==s||(!(0!==i||!E(t,r,e))||(!(0!==o||!E(t,n,e))||(!(0!==a||!E(r,t,n))||!(0!==s||!E(r,e,n)))))}function E(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function S(t){return t>0?1:t<0?-1:0}function O(t,e){return b(t.prev,t,t.next)<0?b(t,e,t.next)>=0&&b(t,t.prev,e)>=0:b(t,e,t.prev)<0||b(t,t.next,e)<0}function T(t,e){const r=new C(t.i,t.x,t.y),n=new C(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function P(t,e,r,n){const i=new C(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function C(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function I(t,e){const r=e.length,n=t.length;if(n>0){let i=!0;for(let o=0;o<r;o++)if(t[n-r+o]!==e[o]){i=!1;break}if(i)return!1}for(let i=0;i<r;i++)t[n+i]=e[i];return!0}function k(t,e){const r=e.length;for(let n=0;n<r;n++)t[n]=e[n]}function R(t,e,r,n,i=[]){const o=n+e*r;for(let e=0;e<r;e++)i[e]=t[o+e];return i}function L(t,e,r,n,i=[]){let o,a;if(8&r)o=(n[3]-t[1])/(e[1]-t[1]),a=3;else if(4&r)o=(n[1]-t[1])/(e[1]-t[1]),a=1;else if(2&r)o=(n[2]-t[0])/(e[0]-t[0]),a=2;else{if(!(1&r))return null;o=(n[0]-t[0])/(e[0]-t[0]),a=0}for(let r=0;r<t.length;r++)i[r]=(1&a)===r?n[a]:o*(e[r]-t[r])+t[r];return i}function j(t,e){let r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}function D(t,e={}){const{size:r=2,broken:n=!1,gridResolution:i=10,gridOffset:o=[0,0],startIndex:a=0,endIndex:s=t.length}=e,u=(s-a)/r;let c=[];const l=[c],h=R(t,0,r,a);let f,p;const d=N(h,i,o,[]),A=[];I(c,h);for(let e=1;e<u;e++){for(f=R(t,e,r,a,f),p=j(f,d);p;){L(h,f,p,d,A);const t=j(A,d);t&&(L(h,A,t,d,A),p=t),I(c,A),k(h,A),U(d,i,p),n&&c.length>r&&(c=[],l.push(c),I(c,h)),p=j(f,d)}I(c,f),k(h,f)}return n?l:l[0]}function B(t,e){for(let r=0;r<e.length;r++)t.push(e[r]);return t}function F(t,e,r={}){if(!t.length)return[];const{size:n=2,gridResolution:i=10,gridOffset:o=[0,0],edgeTypes:a=!1}=r,s=[],u=[{pos:t,types:a&&new Array(t.length/n).fill(1),holes:e||[]}],c=[[],[]];let l=[];for(;u.length;){const{pos:t,types:e,holes:r}=u.shift();V(t,n,r[0]||t.length,c),l=N(c[0],i,o,l);const h=j(c[1],l);if(h){let i=z(t,e,n,0,r[0]||t.length,l,h);const o={pos:i[0].pos,types:i[0].types,holes:[]},s={pos:i[1].pos,types:i[1].types,holes:[]};u.push(o,s);for(let u=0;u<r.length;u++)i=z(t,e,n,r[u],r[u+1]||t.length,l,h),i[0]&&(o.holes.push(o.pos.length),o.pos=B(o.pos,i[0].pos),a&&(o.types=B(o.types,i[0].types))),i[1]&&(s.holes.push(s.pos.length),s.pos=B(s.pos,i[1].pos),a&&(s.types=B(s.types,i[1].types)))}else{const n={positions:t};a&&(n.edgeTypes=e),r.length&&(n.holeIndices=r),s.push(n)}}return s}function z(t,e,r,n,i,o,a){const s=(i-n)/r,u=[],c=[],l=[],h=[],f=[];let p,d,A;const g=R(t,s-1,r,n);let m=Math.sign(8&a?g[1]-o[3]:g[0]-o[2]),y=e&&e[s-1],v=0,_=0;for(let i=0;i<s;i++)p=R(t,i,r,n,p),d=Math.sign(8&a?p[1]-o[3]:p[0]-o[2]),A=e&&e[n/r+i],d&&m&&m!==d&&(L(g,p,a,o,f),I(u,f)&&l.push(y),I(c,f)&&h.push(y)),d<=0?(I(u,p)&&l.push(A),v-=d):l.length&&(l[l.length-1]=0),d>=0?(I(c,p)&&h.push(A),_+=d):h.length&&(h[h.length-1]=0),k(g,p),m=d,y=A;return[v?{pos:u,types:e&&l}:null,_?{pos:c,types:e&&h}:null]}function N(t,e,r,n){const i=Math.floor((t[0]-r[0])/e)*e+r[0],o=Math.floor((t[1]-r[1])/e)*e+r[1];return n[0]=i,n[1]=o,n[2]=i+e,n[3]=o+e,n}function U(t,e,r){8&r?(t[1]+=e,t[3]+=e):4&r?(t[1]-=e,t[3]-=e):2&r?(t[0]+=e,t[2]+=e):1&r&&(t[0]-=e,t[2]-=e)}function V(t,e,r,n){let i=1/0,o=-1/0,a=1/0,s=-1/0;for(let n=0;n<r;n+=e){const e=t[n],r=t[n+1];i=e<i?e:i,o=e>o?e:o,a=r<a?r:a,s=r>s?r:s}return n[0][0]=i,n[0][1]=a,n[1][0]=o,n[1][1]=s,n}function G(t,e={}){const{size:r=2,startIndex:n=0,endIndex:i=t.length,normalize:o=!0}=e,a=t.slice(n,i);Z(a,r,0,i-n);const s=D(a,{size:r,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(o)for(const t of s)X(t,r);return s}function W(t,e,r={}){const{size:n=2,normalize:i=!0,edgeTypes:o=!1}=r;e=e||[];const a=[],s=[];let u=0,c=0;for(let i=0;i<=e.length;i++){const o=e[i]||t.length,l=c,h=H(t,n,u,o);for(let e=h;e<o;e++)a[c++]=t[e];for(let e=u;e<h;e++)a[c++]=t[e];Z(a,n,l,c),q(a,n,l,c,r.maxLatitude),u=o,s[i]=c}s.pop();const l=F(a,s,{size:n,gridResolution:360,gridOffset:[-180,-180],edgeTypes:o});if(i)for(const t of l)X(t.positions,n);return l}function H(t,e,r,n){let i=-1,o=-1;for(let a=r+1;a<n;a+=e){const e=Math.abs(t[a]);e>i&&(i=e,o=a-1)}return o}function q(t,e,r,n,i=85.051129){const o=t[r],a=t[n-e];if(Math.abs(o-a)>180){const n=R(t,0,e,r);n[0]+=360*Math.round((a-o)/360),I(t,n),n[1]=Math.sign(n[1])*i,I(t,n),n[0]=o,I(t,n)}}function Z(t,e,r,n){let i,o=t[0];for(let a=r;a<n;a+=e){i=t[a];const e=i-o;(e>180||e<-180)&&(i-=360*Math.round(e/360)),t[a]=o=i}}function X(t,e){let r;const n=t.length/e;for(let i=0;i<n&&(r=t[i*e],(r+180)%360==0);i++);const i=360*-Math.round(r/360);if(0!==i)for(let r=0;r<n;r++)t[r*e]+=i}r.d(e,"g",(function(){return o})),r.d(e,"h",(function(){return i})),r.d(e,"a",(function(){return n})),r.d(e,"f",(function(){return a})),r.d(e,"b",(function(){return F})),r.d(e,"d",(function(){return D})),r.d(e,"e",(function(){return G})),r.d(e,"c",(function(){return W}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var n=r(7),i=r(139),o=r(49),a=r(9),s=r(48),u=r(167);const c="Resource subclass must define virtual methods";class l{constructor(t,e={}){Object(n.b)(t);const{id:r,userData:i={}}=e;this.gl=t,this.gl2=t,this.id=r||Object(s.c)(this.constructor.name),this.userData=i,this._bound=!1,this._handle=e.handle,void 0===this._handle&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete({deleteChildren:t=!1}={}){const e=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,e&&t&&e.filter(Boolean).forEach(t=>t.delete()),this}bind(t=this.handle){if("function"!=typeof t)return this._bindHandle(t),this;let e;return this._bound?e=t():(this._bindHandle(this.handle),this._bound=!0,e=t(),this._bound=!1,this._bindHandle(null)),e}unbind(){this.bind(null)}getParameter(t,e={}){t=Object(o.b)(this.gl,t),Object(a.a)(t);const r=(this.constructor.PARAMETERS||{})[t];if(r){const t=Object(n.j)(this.gl);if(!((!("webgl2"in r)||t)&&(!("extension"in r)||this.gl.getExtension(r.extension)))){const e=r.webgl1,n="webgl2"in r?r.webgl2:r.webgl1;return t?n:e}}return this._getParameter(t,e)}getParameters(t={}){const{parameters:e,keys:r}=t,i=this.constructor.PARAMETERS||{},a=Object(n.j)(this.gl),s={},u=e||Object.keys(i);for(const e of u){const n=i[e];if(n&&(!("webgl2"in n)||a)&&(!("extension"in n)||this.gl.getExtension(n.extension))){const i=r?Object(o.a)(this.gl,e):e;s[i]=this.getParameter(e,t),r&&"GLenum"===n.type&&(s[i]=Object(o.a)(this.gl,s[i]))}}return s}setParameter(t,e){t=Object(o.b)(this.gl,t),Object(a.a)(t);const r=(this.constructor.PARAMETERS||{})[t];if(r){const t=Object(n.j)(this.gl);if(!((!("webgl2"in r)||t)&&(!("extension"in r)||this.gl.getExtension(r.extension))))throw new Error("Parameter not available on this platform");"GLenum"===r.type&&(e=Object(o.b)(e))}return this._setParameter(t,e),this}setParameters(t){for(const e in t)this.setParameter(e,t[e]);return this}stubRemovedMethods(t,e,r){return Object(u.a)(this,t,e,r)}initialize(t){}_createHandle(){throw new Error(c)}_deleteHandle(){throw new Error(c)}_bindHandle(t){throw new Error(c)}_getOptsFromHandle(){throw new Error(c)}_getParameter(t,e){throw new Error(c)}_setParameter(t,e){throw new Error(c)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){const t=this.constructor.name,e=i.a.get("Resource Counts");e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}_removeStats(){const t=this.constructor.name;i.a.get("Resource Counts").get(`${t}s Active`).decrementCount()}_trackAllocatedMemory(t,e=this.constructor.name){const r=i.a.get("Memory Usage");r.get("GPU Memory").addCount(t),r.get(`${e} Memory`).addCount(t),this.byteLength=t}_trackDeallocatedMemory(t=this.constructor.name){const e=i.a.get("Memory Usage");e.get("GPU Memory").subtractCount(this.byteLength),e.get(`${t} Memory`).subtractCount(this.byteLength),this.byteLength=0}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return v}));var n=r(10),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(18),l=r(35),h=r(11),f=r(17),p=r(22),d=r(14),A=Math.PI/180,g=Object(l.a)(),m=[0,0,0],y={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]},v=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a()(this,t);var r=e.id,n=void 0===r?null:r,i=e.x,o=void 0===i?0:i,s=e.y,u=void 0===s?0:s,c=e.width,l=void 0===c?1:c,h=e.height,f=void 0===h?1:h;this.id=n||this.constructor.displayName||"viewport",this.x=o,this.y=u,this.width=l||1,this.height=f||1,this._frustumPlanes={},this._initViewMatrix(e),this._initProjectionMatrix(e),this._initPixelMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return u()(t,[{key:"equals",value:function(e){return e instanceof t&&(this===e||e.width===this.width&&e.height===this.height&&e.scale===this.scale&&Object(h.e)(e.projectionMatrix,this.projectionMatrix)&&Object(h.e)(e.viewMatrix,this.viewMatrix))}},{key:"project",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.topLeft,n=void 0===r||r,o=this.projectPosition(t),a=Object(p.p)(o,this.pixelProjectionMatrix),s=i()(a,2),u=s[0],c=s[1],l=n?c:this.height-c;return 2===t.length?[u,l]:[u,l,a[2]]}},{key:"unproject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.topLeft,n=void 0===r||r,o=e.targetZ,a=i()(t,3),s=a[0],u=a[1],c=a[2],l=n?u:this.height-u,h=o&&o*this.distanceScales.unitsPerMeter[2],f=Object(p.n)([s,l,c],this.pixelUnprojectionMatrix,h),d=this.unprojectPosition(f),A=i()(d,3),g=A[0],m=A[1],y=A[2];return Number.isFinite(c)?[g,m,y]:Number.isFinite(o)?[g,m,o]:[g,m]}},{key:"projectPosition",value:function(t){var e=this.projectFlat(t),r=i()(e,2);return[r[0],r[1],(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}},{key:"unprojectPosition",value:function(t){var e=this.unprojectFlat(t),r=i()(e,2);return[r[0],r[1],(t[2]||0)*this.distanceScales.metersPerUnit[2]]}},{key:"projectFlat",value:function(t){return this.isGeospatial?Object(p.l)(t):t}},{key:"unprojectFlat",value:function(t){return this.isGeospatial?Object(p.o)(t):t}},{key:"getBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={targetZ:t.z||0},r=this.unproject([0,0],e),n=this.unproject([this.width,0],e),i=this.unproject([0,this.height],e),o=this.unproject([this.width,this.height],e);return[Math.min(r[0],n[0],i[0],o[0]),Math.min(r[1],n[1],i[1],o[1]),Math.max(r[0],n[0],i[0],o[0]),Math.max(r[1],n[1],i[1],o[1])]}},{key:"getDistanceScales",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t?Object(p.g)({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}},{key:"containsPixel",value:function(t){var e=t.x,r=t.y,n=t.width,i=void 0===n?1:n,o=t.height,a=void 0===o?1:o;return e<this.x+this.width&&this.x<e+i&&r<this.y+this.height&&this.y<r+a}},{key:"getFrustumPlanes",value:function(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,Object(l.d)(this.viewProjectionMatrix)),this._frustumPlanes)}},{key:"panByPosition",value:function(t,e){return null}},{key:"getCameraPosition",value:function(){return this.cameraPosition}},{key:"getCameraDirection",value:function(){return this.cameraDirection}},{key:"getCameraUp",value:function(){return this.cameraUp}},{key:"_createProjectionMatrix",value:function(t){var e=t.orthographic,r=t.fovyRadians,n=t.aspect,i=t.focalDistance,o=t.near,a=t.far;return e?(new h.a).orthographic({fovy:r,aspect:n,focalDistance:i,near:o,far:a}):(new h.a).perspective({fovy:r,aspect:n,near:o,far:a})}},{key:"_initViewMatrix",value:function(t){var e=t.viewMatrix,r=void 0===e?g:e,n=t.longitude,i=void 0===n?null:n,o=t.latitude,a=void 0===o?null:o,s=t.zoom,u=void 0===s?null:s,c=t.position,l=void 0===c?null:c,f=t.modelMatrix,d=void 0===f?null:f,A=t.focalDistance,v=void 0===A?1:A,_=t.distanceScales,b=void 0===_?null:_;this.isGeospatial=Number.isFinite(a)&&Number.isFinite(i),this.zoom=u,Number.isFinite(this.zoom)||(this.zoom=this.isGeospatial?Object(p.i)({latitude:a})+Math.log2(v):0);var x=Math.pow(2,this.zoom);this.scale=x,this.distanceScales=this.isGeospatial?Object(p.g)({latitude:a,longitude:i}):b||y,this.focalDistance=v,this.distanceScales.metersPerUnit=new h.b(this.distanceScales.metersPerUnit),this.distanceScales.unitsPerMeter=new h.b(this.distanceScales.unitsPerMeter),this.position=m,this.meterOffset=m,l&&(this.position=l,this.modelMatrix=d,this.meterOffset=d?d.transformVector(l):l),this.isGeospatial?(this.longitude=i,this.latitude=a,this.center=this._getCenterInWorld({longitude:i,latitude:a})):this.center=l?this.projectPosition(l):[0,0,0],this.viewMatrixUncentered=r,this.viewMatrix=(new h.a).multiplyRight(this.viewMatrixUncentered).translate(new h.b(this.center||m).negate())}},{key:"_getCenterInWorld",value:function(t){var e=t.longitude,r=t.latitude,n=this.meterOffset,i=this.distanceScales,o=new h.b(this.projectPosition([e,r,0]));if(n){var a=new h.b(n).scale(i.unitsPerMeter);o.add(a)}return o}},{key:"_initProjectionMatrix",value:function(t){var e=t.projectionMatrix,r=void 0===e?null:e,n=t.orthographic,i=void 0!==n&&n,o=t.fovyRadians,a=t.fovy,s=void 0===a?75:a,u=t.near,c=void 0===u?.1:u,l=t.far,h=void 0===l?1e3:l,f=t.focalDistance,p=void 0===f?1:f;this.projectionMatrix=r||this._createProjectionMatrix({orthographic:i,fovyRadians:o||s*A,aspect:this.width/this.height,focalDistance:p,near:c,far:h})}},{key:"_initPixelMatrices",value:function(){var t=Object(l.a)();f.h(t,t,this.projectionMatrix),f.h(t,t,this.viewMatrix),this.viewProjectionMatrix=t,this.viewMatrixInverse=f.f([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=Object(l.c)(this.viewMatrixInverse);var e=Object(l.a)(),r=Object(l.a)();f.o(e,e,[this.width/2,-this.height/2,1]),f.p(e,e,[1,-1,0]),f.h(r,e,this.viewProjectionMatrix),this.pixelProjectionMatrix=r,this.viewportMatrix=e,this.pixelUnprojectionMatrix=f.f(Object(l.a)(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||c.a.warn("Pixel project matrix not invertible")()}},{key:"metersPerPixel",get:function(){return this.distanceScales.metersPerUnit[2]/this.scale}},{key:"projectionMode",get:function(){return this.isGeospatial?this.zoom<12?d.c.WEB_MERCATOR:d.c.WEB_MERCATOR_AUTO_OFFSET:d.c.IDENTITY}}]),t}();v.displayName="Viewport"},function(t,e,r){"use strict";var n=r(83),i=r(19),o=r(94),a=r(4);const s=new(r(276).a)({id:"loaders.gl"});class u{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const c={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){Object(a.a)(this,"console",void 0),this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},l={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function h(){n.b.loaders=n.b.loaders||{};const{loaders:t}=n.b;return t._state=t._state||{},t._state}r.d(e,"b",(function(){return h})),r.d(e,"d",(function(){return p})),r.d(e,"c",(function(){return d})),r.d(e,"a",(function(){return A}));const f=()=>{const t=h();return t.globalOptions=t.globalOptions||{...c},t.globalOptions};function p(t){const e=h(),r=f();e.globalOptions=y(r,t)}function d(t,e,r,n){return r=r||[],function(t,e){g(t,null,c,l,e);for(const r of e){const n=t&&t[r.id]||{},i=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};g(n,r.id,i,o,e)}}(t,r=Array.isArray(r)?r:[r]),y(e,t,n)}function A(t,e){const r=f(),n=t||r;return"function"==typeof n.fetch?n.fetch:Object(i.f)(n.fetch)?t=>Object(o.a)(t,n):null!=e&&e.fetch?null==e?void 0:e.fetch:o.a}function g(t,e,r,n,o){const a=e||"Top level",u=e?`${e}.`:"";for(const c in t){const l=!e&&Object(i.f)(t[c]),h="baseUri"===c&&!e,f="workerUrl"===c&&e;if(!(c in r||h||f))if(c in n)s.warn(`${a} loader option '${u}${c}' no longer supported, use '${n[c]}'`)();else if(!l){const t=m(c,o);s.warn(`${a} loader option '${u}${c}' not recognized. ${t}`)()}}}function m(t,e){const r=t.toLowerCase();let n="";for(const i of e)for(const e in i.options){if(t===e)return`Did you mean '${i.id}.${e}'?`;const o=e.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${i.id}.${e}'?`)}return n}function y(t,e,r){const n={...t.options||{}};return function(t,e){!e||"baseUri"in t||(t.baseUri=e)}(n,r),null===n.log&&(n.log=new u),v(n,f()),v(n,e),n}function v(t,e){for(const r in e)if(r in e){const n=e[r];Object(i.h)(n)&&Object(i.h)(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}r.d(e,"a",(function(){return n}))},function(t,e,r){t.exports=r(262)},function(t,e,r){var n=r(255),i=r(256),o=r(257);t.exports=function(t){return n(t)||i(t)||o()}},function(t,e,r){var n=r(251);Object.assign(n,r(58),r(270),r(269),r(146),r(272),r(186)),t.exports=n},function(t,e,r){"use strict";var n=r(0),i=r.n(n);function o(t){var e=t.source,r=t.target,n=t.start,i=void 0===n?0:n,o=t.end,a=t.size,s=t.getData;o=o||r.length;var u=e.length,c=o-i;if(u>c)r.set(e.subarray(0,c),i);else if(r.set(e,i),s)for(var l=u;l<c;)for(var h=s(l,e),f=0;f<a;f++)r[i+l]=h[f]||0,l++}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"e",(function(){return c})),r.d(e,"d",(function(){return l})),r.d(e,"c",(function(){return h})),r.d(e,"a",(function(){return f})),r.d(e,"b",(function(){return p})),r.d(e,"f",(function(){return d}));var u={interpolation:{duration:0,easing:function(t){return t}},spring:{stiffness:.05,damping:.5}};function c(t,e){return t?(Number.isFinite(t)&&(t={duration:t}),t.type=t.type||"interpolation",s(s(s({},u[t.type]),e),t)):null}function l(t,e){return e.getBuffer()?[e.getBuffer(),{divisor:0,size:e.size,normalized:e.settings.normalized}]:e.value}function h(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error('No defined attribute type for size "'.concat(t,'"'))}}function f(t){t.push(t.shift())}function p(t,e){var r=t.doublePrecision,n=t.settings,i=t.value,o=t.size,a=r&&i instanceof Float64Array?2:1;return(n.noAlloc?i.length:e*o)*a}function d(t){var e=t.buffer,r=t.numInstances,n=t.attribute,i=t.fromLength,a=t.fromStartIndices,s=t.getData,u=void 0===s?function(t){return t}:s,c=n.doublePrecision&&n.value instanceof Float64Array?2:1,l=n.size*c,h=n.byteOffset,f=n.startIndices,d=a&&f,A=p(n,r),g=n.state.constant;if(d||!(i>=A)){var m=g?n.value:n.getBuffer().getData({srcByteOffset:h});if(n.settings.normalized&&!g){var y=u;u=function(t,e){return n._normalizeConstant(y(t,e))}}var v=g?function(t,e){return u(m,e)}:function(t,e){return u(m.subarray(t,t+l),e)},_=e.getData({length:i}),b=new Float32Array(A);!function(t){var e=t.source,r=t.target,n=t.size,i=t.getData,a=t.sourceStartIndices,s=t.targetStartIndices;if(!Array.isArray(s))return o({source:e,target:r,size:n,getData:i}),r;for(var u=0,c=0,l=i&&function(t,e){return i(t+c,e)},h=Math.min(a.length,s.length),f=1;f<h;f++){var p=a[f]*n,d=s[f]*n;o({source:e.subarray(u,p),target:r,start:c,end:d,size:n,getData:l}),u=p,c=d}c<r.length&&o({source:[],target:r,start:c,size:n,getData:l})}({source:_,target:b,sourceStartIndices:a,targetStartIndices:f,size:l,getData:v}),e.byteLength<b.byteLength+h&&e.reallocate(b.byteLength+h),e.subData({data:b,offset:h})}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o}));var n=r(97);function i(t){var e;if(!t)return!1;return Array.isArray(t)&&(t=t[0]),Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function o(t){var e,r;let o;return Object(n.a)(t,"null loader"),Object(n.a)(i(t),"invalid loader"),Array.isArray(t)&&(o=t[1],t=t[0],t={...t,options:{...t.options,...o}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(r=t)&&void 0!==r&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return s}));var n=r(9);const i={};function o(t="id"){return i[t]=i[t]||1,`${t}-${i[t]++}`}function a(t){return Object(n.a)("number"==typeof t,"Input must be a number"),t&&0==(t&t-1)}function s(t){let e=!0;for(const r in t){e=!1;break}return e}},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o}));var n=r(9);function i(t,e){if("string"!=typeof e)return e;const r=Number(e);if(!isNaN(r))return r;const i=t[e=e.replace(/^.*\./,"")];return Object(n.a)(void 0!==i,`Accessing undefined constant GL.${e}`),i}function o(t,e){e=Number(e);for(const r in t)if(t[r]===e)return`GL.${r}`;return String(e)}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return s}));var n=[],i=[];function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,o=n,a={index:-1,data:t,target:[]};return t?"function"==typeof t[Symbol.iterator]?o=t:t.length>0&&(i.length=t.length,o=i):o=n,(e>0||Number.isFinite(r))&&(o=(Array.isArray(o)?o:Array.from(o)).slice(e,r),a.index=e-1),{iterable:o,objectInfo:a}}function a(t){return t&&t[Symbol.asyncIterator]}function s(t,e){var r=e.size,n=e.stride,i=e.offset,o=e.startIndices,a=e.nested,s=t.BYTES_PER_ELEMENT,u=n?n/s:r,c=i?i/s:0,l=Math.floor((t.length-c)/u);return function(e,n){var i=n.index,s=n.target;if(!o){for(var h=i*u+c,f=0;f<r;f++)s[f]=t[h+f];return s}var p,d=o[i],A=o[i+1]||l;if(a){p=new Array(A-d);for(var g=d;g<A;g++){var m=g*u+c;s=new Array(r);for(var y=0;y<r;y++)s[y]=t[m+y];p[g-d]=s}}else if(u===r)p=t.subarray(d*r+c,A*r+c);else{p=new t.constructor((A-d)*r);for(var v=0,_=d;_<A;_++)for(var b=_*u+c,x=0;x<r;x++)p[v++]=t[b+x]}return p}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"d",(function(){return a}));function n(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error("Failed to deduce GL constant from typed array")}}function i(t,{clamped:e=!0}={}){switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return e?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function o({data:t,width:e,height:r,bytesPerPixel:n=4,temp:i}){const o=e*n;i=i||new Uint8Array(o);for(let e=0;e<r/2;++e){const n=e*o,a=(r-e-1)*o;i.set(t.subarray(n,n+o)),t.copyWithin(n,a,a+o),t.set(i,a)}}function a({data:t,width:e,height:r}){const n=Math.round(e/2),i=Math.round(r/2),o=new Uint8Array(n*i*4);for(let r=0;r<i;r++)for(let i=0;i<n;i++)for(let a=0;a<4;a++)o[4*(r*n+i)+a]=t[4*(2*r*e+2*i)+a];return{data:o,width:n,height:i}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(7),i=r(26),o=r(39),a=r(34),s=r(82),u=r(9),c=r(48);const l=[9729,9728],h=i.global.WebGLBuffer||function(){};class f extends o.a{static isSupported(t,e={}){const{format:r,linearFiltering:n}=e;let i=!0;return r&&(i=i&&Object(s.d)(t,r),i=i&&(!n||Object(s.e)(t,r))),i}constructor(t,e){const{id:r=Object(c.c)("texture"),handle:n,target:i}=e;super(t,{id:r,handle:n}),this.target=i,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(t={}){let e=t.data;if(e instanceof Promise)return e.then(e=>this.initialize(Object.assign({},t,{pixels:e,data:e}))),this;const r="undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement;if(r&&e.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,e.addEventListener("loadeddata",()=>this.initialize(t)),this;const{pixels:i=null,format:o=6408,border:a=0,recreate:s=!1,parameters:u={},pixelStore:c={},textureUnit:l}=t;e||(e=i);let{width:h,height:f,dataFormat:p,type:d,compressed:A=!1,mipmaps:g=!0}=t;const{depth:m=0}=t;return({width:h,height:f,compressed:A,dataFormat:p,type:d}=this._deduceParameters({format:o,type:d,dataFormat:p,compressed:A,data:e,width:h,height:f})),this.width=h,this.height=f,this.depth=m,this.format=o,this.type=d,this.dataFormat=p,this.border=a,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),g&&this._isNPOT()&&(n.k.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),g=!1,this._updateForNPOT(u)),this.mipmaps=g,this.setImageData({data:e,width:h,height:f,depth:m,format:o,type:d,dataFormat:p,border:a,mipmaps:g,parameters:c,compressed:A}),g&&this.generateMipmap(),this.setParameters(u),s&&(this.data=e),r&&(this._video={video:e,parameters:u,lastTime:e.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?e.currentTime:-1}),this}update(){if(this._video){const{video:t,parameters:e,lastTime:r}=this._video;if(r===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:e}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}resize({height:t,width:e,mipmaps:r=!1}){return e!==this.width||t!==this.height?this.initialize({width:e,height:t,format:this.format,type:this.type,dataFormat:this.dataFormat,border:this.border,mipmaps:r}):this}generateMipmap(t={}){return this._isNPOT()?(n.k.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Object(n.o)(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory("Texture");const{target:e=this.target,pixels:r=null,level:i=0,format:o=this.format,border:a=this.border,offset:c=0,parameters:l={}}=t;let{data:h=null,type:f=this.type,width:p=this.width,height:d=this.height,dataFormat:A=this.dataFormat,compressed:g=!1}=t;h||(h=r),({type:f,dataFormat:A,compressed:g,width:p,height:d}=this._deduceParameters({format:o,type:f,dataFormat:A,compressed:g,data:h,width:p,height:d}));const{gl:m}=this;m.bindTexture(this.target,this.handle);let y,v=null;if(({data:h,dataType:v}=this._getDataType({data:h,compressed:g})),Object(n.o)(this.gl,l,()=>{switch(v){case"null":m.texImage2D(e,i,o,p,d,a,A,f,h);break;case"typed-array":m.texImage2D(e,i,o,p,d,a,A,f,h,c);break;case"buffer":y=Object(n.a)(m),y.bindBuffer(35052,h.handle||h),y.texImage2D(e,i,o,p,d,a,A,f,c),y.bindBuffer(35052,null);break;case"browser-object":Object(n.j)(m)?m.texImage2D(e,i,o,p,d,a,A,f,h):m.texImage2D(e,i,o,A,f,h);break;case"compressed":for(const[t,r]of h.entries())m.compressedTexImage2D(e,t,r.format,r.width,r.height,a,r.data);break;default:Object(u.a)(!1,"Unknown image data type")}}),h&&h.byteLength)this._trackAllocatedMemory(h.byteLength,"Texture");else{const t=s.a[this.dataFormat]||4,e=s.c[this.type]||1;this._trackAllocatedMemory(this.width*this.height*t*e,"Texture")}return this.loaded=!0,this}setSubImageData({target:t=this.target,pixels:e=null,data:r=null,x:i=0,y:o=0,width:s=this.width,height:c=this.height,level:l=0,format:f=this.format,type:p=this.type,dataFormat:d=this.dataFormat,compressed:A=!1,offset:g=0,border:m=this.border,parameters:y={}}){if(({type:p,dataFormat:d,compressed:A,width:s,height:c}=this._deduceParameters({format:f,type:p,dataFormat:d,compressed:A,data:r,width:s,height:c})),Object(u.a)(0===this.depth,"texSubImage not supported for 3D textures"),r||(r=e),r&&r.data){const t=r;r=t.data,s=t.shape[0],c=t.shape[1]}r instanceof a.a&&(r=r.handle),this.gl.bindTexture(this.target,this.handle),Object(n.o)(this.gl,y,()=>{if(A)this.gl.compressedTexSubImage2D(t,l,i,o,s,c,f,r);else if(null===r)this.gl.texSubImage2D(t,l,i,o,s,c,d,p,null);else if(ArrayBuffer.isView(r))this.gl.texSubImage2D(t,l,i,o,s,c,d,p,r,g);else if(r instanceof h){const e=Object(n.a)(this.gl);e.bindBuffer(35052,r),e.texSubImage2D(t,l,i,o,s,c,d,p,g),e.bindBuffer(35052,null)}else if(Object(n.j)(this.gl)){Object(n.a)(this.gl).texSubImage2D(t,l,i,o,s,c,d,p,r)}else this.gl.texSubImage2D(t,l,i,o,d,p,r)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(t={}){return n.k.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(t=this.textureUnit){const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,this.handle),t}unbind(t=this.textureUnit){const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,null),t}_getDataType({data:t,compressed:e=!1}){return e?{data:t,dataType:"compressed"}:null===t?{data:t,dataType:"null"}:ArrayBuffer.isView(t)?{data:t,dataType:"typed-array"}:t instanceof a.a?{data:t.handle,dataType:"buffer"}:t instanceof h?{data:t,dataType:"buffer"}:{data:t,dataType:"browser-object"}}_deduceParameters(t){const{format:e,data:r}=t;let{width:n,height:i,dataFormat:o,type:a,compressed:u}=t;const c=s.b[e];return o=o||c&&c.dataFormat,a=a||c&&c.types[0],u=u||c&&c.compressed,({width:n,height:i}=this._deduceImageSize(r,n,i)),{dataFormat:o,type:a,compressed:u,width:n,height:i,format:e,data:r}}_deduceImageSize(t,e,r){let n;return n="undefined"!=typeof ImageData&&t instanceof ImageData?{width:t.width,height:t.height}:"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement?{width:t.width,height:t.height}:"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?{width:t.width,height:t.height}:"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t?{width:e,height:r}:{width:e>=0?e:1,height:r>=0?r:1},Object(u.a)(n,"Could not deduced texture size"),Object(u.a)(void 0===e||n.width===e,"Deduced texture width does not match supplied width"),Object(u.a)(void 0===r||n.height===r,"Deduced texture height does not match supplied height"),n}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);const e=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),e}}_setParameter(t,e){switch(this.gl.bindTexture(this.target,this.handle),e=this._getNPOTParam(t,e),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,e);break;case 4096:case 4097:Object(u.a)(!1);break;default:this.gl.texParameteri(this.target,t,e)}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return!Object(n.j)(this.gl)&&(!(!this.width||!this.height)&&(!Object(c.b)(this.width)||!Object(c.b)(this.height)))}_updateForNPOT(t){void 0===t[this.gl.TEXTURE_MIN_FILTER]&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),void 0===t[this.gl.TEXTURE_WRAP_S]&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),void 0===t[this.gl.TEXTURE_WRAP_T]&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,e){if(this._isNPOT())switch(t){case 10241:-1===l.indexOf(e)&&(e=9729);break;case 10242:case 10243:33071!==e&&(e=33071)}return e}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"i",(function(){return o})),r.d(e,"d",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"e",(function(){return u})),r.d(e,"h",(function(){return c})),r.d(e,"f",(function(){return l})),r.d(e,"g",(function(){return h})),r.d(e,"c",(function(){return f}));var n=r(12);function i(){var t=new n.a(9);return n.a!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function o(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else 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];return t}function a(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=l*a-s*c,f=-l*o+s*u,p=c*o-a*u,d=r*h+n*f+i*p;return d?(d=1/d,t[0]=h*d,t[1]=(-l*n+i*c)*d,t[2]=(s*n-i*a)*d,t[3]=f*d,t[4]=(l*r-i*u)*d,t[5]=(-s*r+i*o)*d,t[6]=p*d,t[7]=(-c*r+n*u)*d,t[8]=(a*r-n*o)*d,t):null}function s(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return e*(c*o-a*u)+r*(-c*i+a*s)+n*(u*i-o*s)}function u(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=r[0],p=r[1],d=r[2],A=r[3],g=r[4],m=r[5],y=r[6],v=r[7],_=r[8];return t[0]=f*n+p*a+d*c,t[1]=f*i+p*s+d*l,t[2]=f*o+p*u+d*h,t[3]=A*n+g*a+m*c,t[4]=A*i+g*s+m*l,t[5]=A*o+g*u+m*h,t[6]=y*n+v*a+_*c,t[7]=y*i+v*s+_*l,t[8]=y*o+v*u+_*h,t}function c(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=r[0],p=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=f*n+p*a+c,t[7]=f*i+p*s+l,t[8]=f*o+p*u+h,t}function l(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=Math.sin(r),p=Math.cos(r);return t[0]=p*n+f*a,t[1]=p*i+f*s,t[2]=p*o+f*u,t[3]=p*a-f*n,t[4]=p*s-f*i,t[5]=p*u-f*o,t[6]=c,t[7]=l,t[8]=h,t}function h(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function f(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,u=i+i,c=r*a,l=n*a,h=n*s,f=i*a,p=i*s,d=i*u,A=o*a,g=o*s,m=o*u;return t[0]=1-h-d,t[3]=l-m,t[6]=f+g,t[1]=l+m,t[4]=1-c-d,t[7]=p-A,t[2]=f-g,t[5]=p+A,t[8]=1-c-h,t}},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&p())}function p(){if(!l){var t=s(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function A(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new d(t,e)),1!==c.length||l||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=A,i.addListener=A,i.once=A,i.off=A,i.removeListener=A,i.removeAllListeners=A,i.emit=A,i.prependListener=A,i.prependOnceListener=A,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";r.r(e);var n=r(222),i=r(10),o=r.n(i),a=r(0),s=r.n(a),u=r(2),c=r.n(u),l=r(3),h=r.n(l),f=r(8),p=r.n(f),d=r(5),A=r.n(d),g=r(6),m=r.n(g),y=r(1),v=r.n(y),_=r(14),b=r(207),x=r(226),w=r(155),E=r(176),S=r(62),O=r(22),T=r(11),P=new Uint16Array([0,2,1,0,3,2]),M=new Float32Array([0,1,0,0,1,0,1,1]);function C(t,e){if(!e)return function(t){for(var e=new Float64Array(12),r=0;r<t.length;r++)e[3*r+0]=t[r][0],e[3*r+1]=t[r][1],e[3*r+2]=t[r][2]||0;return{vertexCount:6,positions:e,indices:P,texCoords:M}}(t);for(var r=Math.max(Math.abs(t[0][0]-t[3][0]),Math.abs(t[1][0]-t[2][0])),n=Math.max(Math.abs(t[1][1]-t[0][1]),Math.abs(t[2][1]-t[3][1])),i=Math.ceil(r/e)+1,o=Math.ceil(n/e)+1,a=(i-1)*(o-1)*6,s=new Uint32Array(a),u=new Float32Array(i*o*2),c=new Float64Array(i*o*3),l=0,h=0,f=0;f<i;f++)for(var p=f/(i-1),d=0;d<o;d++){var A=d/(o-1),g=I(t,p,A);c[3*l+0]=g[0],c[3*l+1]=g[1],c[3*l+2]=g[2]||0,u[2*l+0]=p,u[2*l+1]=1-A,f>0&&d>0&&(s[h++]=l-o,s[h++]=l-o-1,s[h++]=l-1,s[h++]=l-o,s[h++]=l-1,s[h++]=l),l++}return{vertexCount:a,positions:c,indices:s,texCoords:u}}function I(t,e,r){return Object(T.f)(Object(T.f)(t[0],t[1],r),Object(T.f)(t[3],t[2],r),e)}var k="\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n  float x = lnglat.x;\n  float y = clamp(lnglat.y, -89.9, 89.9);\n  return vec2(\n    radians(x) + PI,\n    PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n  ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n  xy /= WORLD_SCALE;\n  return degrees(vec2(\n    xy.x - PI,\n    atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n  ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n  float luminance = (color.r + color.g + color.b) * 0.333333333;\n  return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n  return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n  return mix(transparentColor, vec4(color, 1.0), alpha);\n}\n\nvec2 getUV(vec2 pos) {\n  return vec2(\n    (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n    (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n  );\n}\n\n".concat("\nvec3 packUVsIntoRGB(vec2 uv) {\n  // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n  vec2 uv8bit = floor(uv * 256.);\n\n  // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n  // Scale and clamp to 0-1 range\n  vec2 uvFraction = fract(uv * 256.);\n  vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n  // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n  float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n  return vec3(uv8bit, fractions) / 255.;\n}\n","\n\nvoid main(void) {\n  vec2 uv = vTexCoord;\n  if (coordinateConversion < -0.5) {\n    vec2 lnglat = mercator_to_lnglat(vTexPos);\n    uv = getUV(lnglat);\n  } else if (coordinateConversion > 0.5) {\n    vec2 commonPos = lnglat_to_mercator(vTexPos);\n    uv = getUV(commonPos);\n  }\n  vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n  gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n  geometry.uv = uv;\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n  if (picking_uActive) {\n    // Since instance information is not used, we can use picking color for pixel index\n    gl_FragColor.rgb = packUVsIntoRGB(uv);\n  }\n}\n");function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?R(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function j(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=v()(t);if(e){var i=v()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m()(this,r)}}var D={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:_.a.DEFAULT,desaturate:{type:"number",min:0,max:1,value:0},transparentColor:{type:"color",value:[0,0,0,0]},tintColor:{type:"color",value:[255,255,255]}},B=function(t){A()(r,t);var e=j(r);function r(){return c()(this,r),e.apply(this,arguments)}return h()(r,[{key:"getShaders",value:function(){return p()(v()(r.prototype),"getShaders",this).call(this,{vs:"\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float coordinateConversion;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n  geometry.worldPosition = positions;\n  geometry.uv = texCoords;\n  geometry.pickingColor = pickingColor;\n\n  gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  vTexCoord = texCoords;\n\n  if (coordinateConversion < -0.5) {\n    vTexPos = geometry.position.xy;\n  } else if (coordinateConversion > 0.5) {\n    vTexPos = geometry.worldPosition.xy;\n  }\n\n  vec4 color = vec4(0.0);\n  DECKGL_FILTER_COLOR(color, geometry);\n}\n",fs:k,modules:[b.a,x.a]})}},{key:"initializeState",value:function(){var t=this,e=this.getAttributeManager();e.remove(["instancePickingColors"]);e.add({indices:{size:1,isIndexed:!0,update:function(e){return e.value=t.state.mesh.indices},noAlloc:!0},positions:{size:3,type:5130,fp64:this.use64bitPositions(),update:function(e){return e.value=t.state.mesh.positions},noAlloc:!0},texCoords:{size:2,update:function(e){return e.value=t.state.mesh.texCoords},noAlloc:!0}})}},{key:"updateState",value:function(t){var e=t.props,r=t.oldProps;if(t.changeFlags.extensionsChanged){var n,i=this.context.gl;null===(n=this.state.model)||void 0===n||n.delete(),this.state.model=this._getModel(i),this.getAttributeManager().invalidateAll()}var o=this.getAttributeManager();if(e.bounds!==r.bounds){var a=this.state.mesh,s=this._createMesh();for(var u in this.state.model.setVertexCount(s.vertexCount),s)a&&a[u]!==s[u]&&o.invalidate(u);this.setState(L({mesh:s},this._getCoordinateUniforms()))}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}},{key:"getPickingInfo",value:function(t){var e=t.info,r=this.props.image;if(!e.color||!r)return e.bitmap=null,e;var n=r.width,i=r.height;e.index=0;var a,s,u,c,l,h=(a=e.color,s=o()(a,3),u=s[0],c=s[1],l=s[2],[(u+(15&l)/16)/256,(c+(240&l)/256)/256]),f=[Math.floor(h[0]*n),Math.floor(h[1]*i)];return e.bitmap={size:{width:n,height:i},uv:h,pixel:f},e}},{key:"disablePickingIndex",value:function(){this.setState({disablePicking:!0})}},{key:"restorePickingColors",value:function(){this.setState({disablePicking:!1})}},{key:"_updateAutoHighlight",value:function(t){p()(v()(r.prototype),"_updateAutoHighlight",this).call(this,L(L({},t),{},{color:this.encodePickingColor(0)}))}},{key:"_createMesh",value:function(){var t=this.props.bounds,e=t;return Number.isFinite(t[0])&&(e=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]]]),C(e,this.context.viewport.resolution)}},{key:"_getModel",value:function(t){return t?new E.a(t,L(L({},this.getShaders()),{},{id:this.props.id,geometry:new S.a({drawMode:4,vertexCount:6}),isInstanced:!1})):null}},{key:"draw",value:function(t){var e=t.uniforms,r=t.moduleParameters,n=this.state,i=n.model,o=n.coordinateConversion,a=n.bounds,s=n.disablePicking,u=this.props,c=u.image,l=u.desaturate,h=u.transparentColor,f=u.tintColor;r.pickingActive&&s||c&&i&&i.setUniforms(e).setUniforms({bitmapTexture:c,desaturate:l,transparentColor:h.map((function(t){return t/255})),tintColor:f.slice(0,3).map((function(t){return t/255})),coordinateConversion:o,bounds:a}).draw()}},{key:"_getCoordinateUniforms",value:function(){var t=_.a.LNGLAT,e=_.a.CARTESIAN,r=_.a.DEFAULT,n=this.props._imageCoordinateSystem;if(n!==r){var i=this.props.bounds;if(!Number.isFinite(i[0]))throw new Error("_imageCoordinateSystem only supports rectangular bounds");var o=this.context.viewport.resolution?t:e;if((n=n===t?t:e)===t&&o===e)return{coordinateConversion:-1,bounds:i};if(n===e&&o===t){var a=Object(O.l)([i[0],i[1]]),s=Object(O.l)([i[2],i[3]]);return{coordinateConversion:1,bounds:[a[0],a[1],s[0],s[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}}]),r}(w.a);B.layerName="BitmapLayer",B.defaultProps=D;var F=r(110),z=r(223),N=r(224),U=r(159),V=r(157),G=r(214),W=r(109),H=r(215),q=r(221),Z=r(158),X=r(108),Q=r(162),Y=r(160);r.d(e,"ArcLayer",(function(){return n.a})),r.d(e,"BitmapLayer",(function(){return B})),r.d(e,"IconLayer",(function(){return F.a})),r.d(e,"LineLayer",(function(){return z.a})),r.d(e,"PointCloudLayer",(function(){return N.a})),r.d(e,"ScatterplotLayer",(function(){return U.a})),r.d(e,"ColumnLayer",(function(){return V.a})),r.d(e,"GridCellLayer",(function(){return G.a})),r.d(e,"PathLayer",(function(){return W.a})),r.d(e,"PolygonLayer",(function(){return H.a})),r.d(e,"GeoJsonLayer",(function(){return q.a})),r.d(e,"TextLayer",(function(){return Z.a})),r.d(e,"SolidPolygonLayer",(function(){return X.a})),r.d(e,"_MultiIconLayer",(function(){return Q.a})),r.d(e,"_TextBackgroundLayer",(function(){return Y.a}))},function(t,e,r){"use strict";(function(t,n){r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"==typeof n&&n},o=i.window||i.self||i.global,a=i.process||{};console}).call(this,r(65),r(57))},function(t,e,r){"use strict";r.d(e,"a",(function(){return x}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(127),l=r(128);function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function f(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var p={transitionDuration:0},d={transitionDuration:300,transitionEasing:function(t){return t},transitionInterruption:c.a.BREAK},A=function(t){return 1-(1-t)*(1-t)},g=["wheel"],m=["panstart","panmove","panend"],y=["pinchstart","pinchmove","pinchend"],v=["tripanstart","tripanmove","tripanend"],_=["doubletap"],b=["keydown"],x=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a()(this,t),this.ControllerState=e,this.controllerState=null,this.controllerStateProps=null,this.eventManager=null,this.transitionManager=new c.b(e,f(f({},r),{},{onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}));var n=this.linearTransitionProps;this._transition=n&&f(f({},d),{},{transitionInterpolator:new l.a({transitionProps:n})}),this._events=null,this._interactionState={isDragging:!1},this._customEvents=[],this.onViewStateChange=null,this.onStateChange=null,this.handleEvent=this.handleEvent.bind(this),this.setProps(r)}return u()(t,[{key:"finalize",value:function(){for(var t in this._events)this._events[t]&&this.eventManager.off(t,this.handleEvent);this.transitionManager.finalize()}},{key:"handleEvent",value:function(t){var e=this.ControllerState;this.controllerState=new e(f(f({makeViewport:this.makeViewport},this.controllerStateProps),this._state));var r=this._eventStartBlocked;switch(t.type){case"panstart":return!r&&this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return!r&&this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"tripanstart":return!r&&this._onTriplePanStart(t);case"tripanmove":return this._onTriplePan(t);case"tripanend":return this._onTriplePanEnd(t);case"doubletap":return this._onDoubleTap(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}},{key:"getCenter",value:function(t){var e=this.controllerStateProps,r=e.x,n=e.y,i=t.offsetCenter;return[i.x-r,i.y-n]}},{key:"isPointInBounds",value:function(t,e){var r=this.controllerStateProps,n=r.width,i=r.height;if(e&&e.handled)return!1;var o=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=i;return o&&e&&e.stopPropagation(),o}},{key:"isFunctionKeyPressed",value:function(t){var e=t.srcEvent;return Boolean(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}},{key:"isDragging",value:function(){return this._interactionState.isDragging}},{key:"blockEvents",value:function(t){var e=this,r=setTimeout((function(){e._eventStartBlocked===r&&(e._eventStartBlocked=null)}),t);this._eventStartBlocked=r}},{key:"setProps",value:function(t){"onViewStateChange"in t&&(this.onViewStateChange=t.onViewStateChange),"onStateChange"in t&&(this.onStateChange=t.onStateChange),"makeViewport"in t&&(this.makeViewport=t.makeViewport),"dragMode"in t&&(this.dragMode=t.dragMode),this.controllerStateProps=t,"eventManager"in t&&this.eventManager!==t.eventManager&&(this.eventManager=t.eventManager,this._events={},this.toggleEvents(this._customEvents,!0)),"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);var e=t.inertia;!0===e&&(e=300),this.inertia=e;var r=t.scrollZoom,n=void 0===r||r,i=t.dragPan,o=void 0===i||i,a=t.dragRotate,s=void 0===a||a,u=t.doubleClickZoom,c=void 0===u||u,l=t.touchZoom,h=void 0===l||l,f=t.touchRotate,p=void 0!==f&&f,d=t.keyboard,A=void 0===d||d,x=Boolean(this.onViewStateChange);this.toggleEvents(g,x&&n),this.toggleEvents(m,x&&(o||s)),this.toggleEvents(y,x&&(h||p)),this.toggleEvents(v,x&&p),this.toggleEvents(_,x&&c),this.toggleEvents(b,x&&A),this.scrollZoom=n,this.dragPan=o,this.dragRotate=s,this.doubleClickZoom=c,this.touchZoom=h,this.touchRotate=p,this.keyboard=A}},{key:"updateTransition",value:function(){this.transitionManager.updateTransition()}},{key:"toggleEvents",value:function(t,e){var r=this;this.eventManager&&t.forEach((function(t){r._events[t]!==e&&(r._events[t]=e,e?r.eventManager.on(t,r.handleEvent):r.eventManager.off(t,r.handleEvent))}))}},{key:"updateViewport",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=f(f({},t.getViewportProps()),e),i=this.controllerState!==t;if(this._state=t.getState(),this._setInteractionState(r),i){var o=this.controllerState?this.controllerState.getViewportProps():null;this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:o})}}},{key:"_onTransition",value:function(t){this.onViewStateChange&&(t.interactionState=this._interactionState,this.onViewStateChange(t))}},{key:"_setInteractionState",value:function(t){Object.assign(this._interactionState,t),this.onStateChange&&this.onStateChange(this._interactionState)}},{key:"_onPanStart",value:function(t){var e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;var r=this.isFunctionKeyPressed(t)||t.rightButton;(this.invertPan||"pan"===this.dragMode)&&(r=!r);var n=this.controllerState[r?"panStart":"rotateStart"]({pos:e});return this._panMove=r,this.updateViewport(n,p,{isDragging:!0}),!0}},{key:"_onPan",value:function(t){return!!this.isDragging()&&(this._panMove?this._onPanMove(t):this._onPanRotate(t))}},{key:"_onPanEnd",value:function(t){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t))}},{key:"_onPanMove",value:function(t){if(!this.dragPan)return!1;var e=this.getCenter(t),r=this.controllerState.pan({pos:e});return this.updateViewport(r,p,{isDragging:!0,isPanning:!0}),!0}},{key:"_onPanMoveEnd",value:function(t){var e=this.inertia;if(this.dragPan&&e&&t.velocity){var r=this.getCenter(t),n=[r[0]+t.velocityX*e/2,r[1]+t.velocityY*e/2],i=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(i,f(f({},this._getTransitionProps()),{},{transitionDuration:e,transitionEasing:A}),{isDragging:!1,isPanning:!0})}else{var o=this.controllerState.panEnd();this.updateViewport(o,null,{isDragging:!1,isPanning:!1})}return!0}},{key:"_onPanRotate",value:function(t){if(!this.dragRotate)return!1;var e=this.getCenter(t),r=this.controllerState.rotate({pos:e});return this.updateViewport(r,p,{isDragging:!0,isRotating:!0}),!0}},{key:"_onPanRotateEnd",value:function(t){var e=this.inertia;if(this.dragRotate&&e&&t.velocity){var r=this.getCenter(t),n=[r[0]+t.velocityX*e/2,r[1]+t.velocityY*e/2],i=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(i,f(f({},this._getTransitionProps()),{},{transitionDuration:e,transitionEasing:A}),{isDragging:!1,isRotating:!0})}else{var o=this.controllerState.rotateEnd();this.updateViewport(o,null,{isDragging:!1,isRotating:!1})}return!0}},{key:"_onWheel",value:function(t){if(!this.scrollZoom)return!1;t.preventDefault();var e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;var r=this.scrollZoom,n=r.speed,i=void 0===n?.01:n,o=r.smooth,a=void 0!==o&&o,s=t.delta,u=2/(1+Math.exp(-Math.abs(s*i)));s<0&&0!==u&&(u=1/u);var c=this.controllerState.zoom({pos:e,scale:u});return this.updateViewport(c,f(f({},this._getTransitionProps({around:e})),{},{transitionDuration:a?250:1}),{isZooming:!0,isPanning:!0}),!0}},{key:"_onTriplePanStart",value:function(t){var e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;var r=this.controllerState.rotateStart({pos:e});return this.updateViewport(r,p,{isDragging:!0}),!0}},{key:"_onTriplePan",value:function(t){if(!this.touchRotate)return!1;if(!this.isDragging())return!1;var e=this.getCenter(t);e[0]-=t.deltaX;var r=this.controllerState.rotate({pos:e});return this.updateViewport(r,p,{isDragging:!0,isRotating:!0}),!0}},{key:"_onTriplePanEnd",value:function(t){if(!this.isDragging())return!1;var e=this.inertia;if(this.touchRotate&&e&&t.velocityY){var r=this.getCenter(t),n=[r[0],r[1]+=t.velocityY*e/2],i=this.controllerState.rotate({pos:n});this.updateViewport(i,f(f({},this._getTransitionProps()),{},{transitionDuration:e,transitionEasing:A}),{isDragging:!1,isRotating:!0}),this.blockEvents(e)}else{var o=this.controllerState.rotateEnd();this.updateViewport(o,null,{isDragging:!1,isRotating:!1})}return!0}},{key:"_onPinchStart",value:function(t){var e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;var r=this.controllerState.zoomStart({pos:e}).rotateStart({pos:e});return this._startPinchRotation=t.rotation,this._lastPinchEvent=t,this.updateViewport(r,p,{isDragging:!0}),!0}},{key:"_onPinch",value:function(t){if(!this.touchZoom&&!this.touchRotate)return!1;if(!this.isDragging())return!1;var e=this.controllerState;if(this.touchZoom){var r=t.scale,n=this.getCenter(t);e=e.zoom({pos:n,scale:r})}if(this.touchRotate){var i=t.rotation;e=e.rotate({deltaAngleX:this._startPinchRotation-i})}return this.updateViewport(e,p,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),this._lastPinchEvent=t,!0}},{key:"_onPinchEnd",value:function(t){if(!this.isDragging())return!1;var e=this.inertia,r=this._lastPinchEvent;if(this.touchZoom&&e&&r&&t.scale!==r.scale){var n=this.getCenter(t),i=this.controllerState.rotateEnd(),o=Math.log2(t.scale),a=(o-Math.log2(r.scale))/(t.deltaTime-r.deltaTime),s=Math.pow(2,o+a*e/2);i=i.zoom({pos:n,scale:s}).zoomEnd(),this.updateViewport(i,f(f({},this._getTransitionProps({around:n})),{},{transitionDuration:e,transitionEasing:A}),{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(e)}else{var u=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(u,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return this._startPinchRotation=null,this._lastPinchEvent=null,!0}},{key:"_onDoubleTap",value:function(t){if(!this.doubleClickZoom)return!1;var e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;var r=this.isFunctionKeyPressed(t),n=this.controllerState.zoom({pos:e,scale:r?.5:2});return this.updateViewport(n,this._getTransitionProps({around:e}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}},{key:"_onKeyDown",value:function(t){if(!this.keyboard)return!1;var e,r=this.isFunctionKeyPressed(t),n=this.keyboard,i=n.zoomSpeed,o=n.moveSpeed,a=n.rotateSpeedX,s=n.rotateSpeedY,u=this.controllerState,c={};switch(t.srcEvent.code){case"Minus":e=r?u.zoomOut(i).zoomOut(i):u.zoomOut(i),c.isZooming=!0;break;case"Equal":e=r?u.zoomIn(i).zoomIn(i):u.zoomIn(i),c.isZooming=!0;break;case"ArrowLeft":r?(e=u.rotateLeft(a),c.isRotating=!0):(e=u.moveLeft(o),c.isPanning=!0);break;case"ArrowRight":r?(e=u.rotateRight(a),c.isRotating=!0):(e=u.moveRight(o),c.isPanning=!0);break;case"ArrowUp":r?(e=u.rotateUp(s),c.isRotating=!0):(e=u.moveUp(o),c.isPanning=!0);break;case"ArrowDown":r?(e=u.rotateDown(s),c.isRotating=!0):(e=u.moveDown(o),c.isPanning=!0);break;default:return!1}return this.updateViewport(e,this._getTransitionProps(),c),!0}},{key:"_getTransitionProps",value:function(t){var e=this._transition;return e?t?f(f({},e),{},{transitionInterpolator:new l.a(f(f({},t),{},{transitionProps:this.linearTransitionProps,makeViewport:this.controllerState.makeViewport}))}):e:p}},{key:"linearTransitionProps",get:function(){return null}},{key:"events",set:function(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.setProps(this.controllerStateProps)}}]),t}()},function(t,e,r){"use strict";var n=r(24),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c),h=r(40),f=/([0-9]+\.?[0-9]*)(%|px)/;function p(t){switch(i()(t)){case"number":return{position:t,relative:!1};case"string":var e=t.match(f);if(e&&e.length>=3){var r="%"===e[2],n=parseFloat(e[1]);return{position:r?n/100:n,relative:r}}default:throw new Error("Could not parse position string ".concat(t))}}function d(t,e){return t.relative?Math.round(t.position*e):t.position}var A=r(72),g=r(37);function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return v}));var v=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u()(this,t);var r=e.id,n=void 0===r?null:r,i=e.x,o=void 0===i?0:i,a=e.y,s=void 0===a?0:a,c=e.width,l=void 0===c?"100%":c,f=e.height,p=void 0===f?"100%":f,d=e.viewportInstance,A=e.type,m=void 0===A?h.a:A;Object(g.a)(!d||d instanceof h.a),this.viewportInstance=d,this.id=n||this.constructor.displayName||"view",this.type=m,this.props=y(y({},e),{},{id:this.id}),this._parseDimensions({x:o,y:s,width:l,height:p}),this.equals=this.equals.bind(this),Object.seal(this)}return l()(t,[{key:"equals",value:function(t){return this===t||(this.viewportInstance?t.viewportInstance&&this.viewportInstance.equals(t.viewportInstance):Object(A.a)(this.props,t.props))}},{key:"makeViewport",value:function(t){var e=t.width,r=t.height,n=t.viewState;if(this.viewportInstance)return this.viewportInstance;n=this.filterViewState(n);var i=this.getDimensions({width:e,height:r});return this._getViewport(n,i)}},{key:"getViewStateId",value:function(){switch(i()(this.props.viewState)){case"string":return this.props.viewState;case"object":return this.props.viewState&&this.props.viewState.id;default:return this.id}}},{key:"filterViewState",value:function(t){if(this.props.viewState&&"object"===i()(this.props.viewState)){if(!this.props.viewState.id)return this.props.viewState;var e=y({},t);for(var r in this.props.viewState)"id"!==r&&(e[r]=this.props.viewState[r]);return e}return t}},{key:"getDimensions",value:function(t){var e=t.width,r=t.height;return{x:d(this._x,e),y:d(this._y,r),width:d(this._width,e),height:d(this._height,r)}}},{key:"_getControllerProps",value:function(t){var e=this.props.controller;return e?!0===e?t:("function"==typeof e&&(e={type:e}),y(y({},t),e)):null}},{key:"_getViewport",value:function(t,e){return new(0,this.type)(y(y(y({},t),this.props),e))}},{key:"_parseDimensions",value:function(t){var e=t.x,r=t.y,n=t.width,i=t.height;this._x=p(e),this._y=p(r),this._width=p(n),this._height=p(i)}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(48),i=r(9);const o={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class a{static get DRAW_MODE(){return o}constructor(t={}){const{id:e=Object(n.c)("geometry"),drawMode:r=o.TRIANGLES,attributes:i={},indices:a=null,vertexCount:s=null}=t;this.id=e,this.drawMode=0|r,this.attributes={},this.userData={},this._setAttributes(i,a),this.vertexCount=s||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,e){e&&(this.indices=ArrayBuffer.isView(e)?{value:e,size:1}:e);for(const e in t){let r=t[e];r=ArrayBuffer.isView(r)?{value:r}:r,Object(i.a)(ArrayBuffer.isView(r.value),`${this._print(e)}: must be typed array or object with value as typed array`),"POSITION"!==e&&"positions"!==e||r.size||(r.size=3),"indices"===e?(Object(i.a)(!this.indices),this.indices=r):this.attributes[e]=r}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,e){if(e)return e.value.length;let r=1/0;for(const e in t){const n=t[e],{value:i,size:o,constant:a}=n;!a&&i&&o>=1&&(r=Math.min(r,i.length/o))}return Object(i.a)(Number.isFinite(r)),r}}},function(t,e,r){"use strict";var n=r(19);const i=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,o=/^([-\w.]+\/[-\w.+]+)/;function a(t){const e=o.exec(t);return e?e[1]:t}function s(t){const e=i.exec(t);return e?e[1]:""}r.d(e,"b",(function(){return c})),r.d(e,"a",(function(){return l}));const u=/\?.*/;function c(t){if(Object(n.j)(t)){const e=h(t.url||"");return{url:e,type:a(t.headers.get("content-type")||"")||s(e)}}return Object(n.b)(t)?{url:h(t.name||""),type:t.type||""}:"string"==typeof t?{url:h(t),type:s(t)}:{url:"",type:""}}function l(t){return Object(n.j)(t)?t.headers["content-length"]||-1:Object(n.b)(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer?t.byteLength:ArrayBuffer.isView(t)?t.byteLength:-1}function h(t){return t.replace(u,"")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(54),i=r(9),o=r(133);const a={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},s={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}};class u{static getBytesPerElement(t){return Object(n.c)(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return Object(i.a)(t.size),Object(n.c)(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(...t){return new u(...[a,...t])}constructor(...t){t.forEach(t=>this._assign(t)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return u.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return u.getBytesPerVertex(this)}_assign(t={}){return void 0!==(t=Object(o.a)("Accessor",t,s)).type&&(this.type=t.type,5124!==t.type&&5125!==t.type||(this.integer=!0)),void 0!==t.size&&(this.size=t.size),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.stride&&(this.stride=t.stride),void 0!==t.normalized&&(this.normalized=t.normalized),void 0!==t.integer&&(this.integer=t.integer),void 0!==t.divisor&&(this.divisor=t.divisor),void 0!==t.buffer&&(this.buffer=t.buffer),void 0!==t.index&&("boolean"==typeof t.index?this.index=t.index?1:0:this.index=t.index),void 0!==t.instanced&&(this.divisor=t.instanced?1:0),void 0!==t.isInstanced&&(this.divisor=t.isInstanced?1:0),this}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};return Array.isArray(t)?i(t,e,[]):e(t)?[t]:[]}function i(t,e,r){for(var n=-1;++n<t.length;){var o=t[n];Array.isArray(o)?i(o,e,r):e(o)&&r.push(o)}return r}function o(t){for(var e=t.target,r=t.source,n=t.start,i=void 0===n?0:n,o=t.count,a=void 0===o?1:o,s=r.length,u=a*s,c=0,l=i;c<s;c++)e[l++]=r[c];for(;c<u;)c<u-c?(e.copyWithin(i+c,i,i+c),c*=2):(e.copyWithin(i+c,i,i+u-c),c=u);return e}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return o}))},function(t,e,r){"use strict";var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=function(){function t(e){i()(this,t),this._pool=[],this.props={overAlloc:2,poolSize:100},this.setProps(e)}return a()(t,[{key:"setProps",value:function(t){Object.assign(this.props,t)}},{key:"allocate",value:function(t,e,r){var n,i=r.size,o=void 0===i?1:i,a=r.type,s=r.padding,u=void 0===s?0:s,c=r.copy,l=void 0!==c&&c,h=r.initialize,f=void 0!==h&&h,p=r.maxCount,d=a||t&&t.constructor||Float32Array,A=e*o+u;if(ArrayBuffer.isView(t)){if(A<=t.length)return t;if(A*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new d(t.buffer,0,A)}p&&(n=p*o+u);var g=this._allocate(d,A,f,n);return t&&l?g.set(t):f||g.fill(0,0,4),this._release(t),g}},{key:"release",value:function(t){this._release(t)}},{key:"_allocate",value:function(t,e,r,n){var i=Math.max(Math.ceil(e*this.props.overAlloc),1);i>n&&(i=n);var o=this._pool,a=t.BYTES_PER_ELEMENT*i,s=o.findIndex((function(t){return t.byteLength>=a}));if(s>=0){var u=new t(o.splice(s,1)[0],0,i);return r&&u.fill(0),u}return new t(i)}},{key:"_release",value:function(t){if(ArrayBuffer.isView(t)){var e=this._pool,r=t.buffer,n=r.byteLength,i=e.findIndex((function(t){return t.byteLength>=n}));i<0?e.push(r):(i>0||e.length<this.props.poolSize)&&e.splice(i,0,r),e.length>this.props.poolSize&&e.shift()}}}]),t}();e.a=new s},function(t,e){function r(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)}))}}},function(t,e,r){"use strict";r.d(e,"c",(function(){return i})),r.d(e,"e",(function(){return c})),r.d(e,"a",(function(){return h})),r.d(e,"b",(function(){return f})),r.d(e,"d",(function(){return d}));var n=r(31);const i={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},o=(t,e,r)=>e?t.enable(r):t.disable(r),a=(t,e,r)=>t.hint(r,e),s=(t,e,r)=>t.pixelStorei(r,e);function u(t){return Array.isArray(t)||ArrayBuffer.isView(t)}const c={3042:o,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:o,2885:(t,e)=>t.cullFace(e),2929:o,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:o,35723:a,36006:(t,e)=>{const r=Object(n.e)(t)?36009:36160;return t.bindFramebuffer(r,e)},2886:(t,e)=>t.frontFace(e),33170:a,2849:(t,e)=>t.lineWidth(e),32823:o,32824:"polygonOffset",10752:"polygonOffset",35977:o,32938:"sampleCoverage",32939:"sampleCoverage",3089:o,3088:(t,e)=>t.scissor(...e),2960:o,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(t,e)=>t.viewport(...e),3333:s,3317:s,37440:s,37441:s,37443:s,3330:s,3332:s,3331:s,36010:(t,e)=>t.bindFramebuffer(36008,e),3314:s,32878:s,3316:s,3315:s,32877:s,framebuffer:(t,e)=>{const r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{e=u(e)?e:[e,e],t.blendEquationSeparate(...e)},blendFunc:(t,e)=>{e=u(e)&&2===e.length?[...e,...e]:e,t.blendFuncSeparate(...e)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=u(e)?e:[e,e];const[r,n]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,n)},stencilFunc:(t,e)=>{e=u(e)&&3===e.length?[...e,...e]:e;const[r,n,i,o,a,s]=e;t.stencilFuncSeparate(1028,r,n,i),t.stencilFuncSeparate(1029,o,a,s)},stencilOp:(t,e)=>{e=u(e)&&3===e.length?[...e,...e]:e;const[r,n,i,o,a,s]=e;t.stencilOpSeparate(1028,r,n,i),t.stencilOpSeparate(1029,o,a,s)},viewport:(t,e)=>t.viewport(...e)};function l(t,e,r){return void 0!==e[t]?e[t]:r[t]}const h={blendEquation:(t,e,r)=>t.blendEquationSeparate(l(32777,e,r),l(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(l(32969,e,r),l(32968,e,r),l(32971,e,r),l(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(l(32824,e,r),l(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(l(32938,e,r),l(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,l(2962,e,r),l(2967,e,r),l(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,l(34816,e,r),l(36003,e,r),l(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,l(2964,e,r),l(2965,e,r),l(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,l(34817,e,r),l(34818,e,r),l(34819,e,r))},f={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({36006:r,36010:r});case 36009:return t({36006:r});case 36008:return t({36010:r});default:return null}},blendColor:(t,e,r,n,i)=>t({32773:new Float32Array([e,r,n,i])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,r)=>t({32777:e,34877:r}),blendFunc:(t,e,r)=>t({32969:e,32968:r,32971:e,32970:r}),blendFuncSeparate:(t,e,r,n,i)=>t({32969:e,32968:r,32971:n,32970:i}),clearColor:(t,e,r,n,i)=>t({3106:new Float32Array([e,r,n,i])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,r,n,i)=>t({3107:[e,r,n,i]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,r)=>t({2928:new Float32Array([e,r])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,r)=>t({32824:e,10752:r}),sampleCoverage:(t,e,r)=>t({32938:e,32939:r}),scissor:(t,e,r,n,i)=>t({3088:new Int32Array([e,r,n,i])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,r)=>t({[1028===e?2968:36005]:r}),stencilFunc:(t,e,r,n)=>t({2962:e,2967:r,2963:n,34816:e,36003:r,36004:n}),stencilFuncSeparate:(t,e,r,n,i)=>t({[1028===e?2962:34816]:r,[1028===e?2967:36003]:n,[1028===e?2963:36004]:i}),stencilOp:(t,e,r,n)=>t({2964:e,2965:r,2966:n,34817:e,34818:r,34819:n}),stencilOpSeparate:(t,e,r,n,i)=>t({[1028===e?2964:34817]:r,[1028===e?2965:34818]:n,[1028===e?2966:34819]:i}),viewport:(t,e,r,n,i)=>t({2978:[e,r,n,i]})},p=(t,e)=>t.isEnabled(e),d={3042:p,2884:p,2929:p,3024:p,32823:p,32926:p,32928:p,3089:p,2960:p,35977:p}},function(t,e,r){"use strict";(function(t){r.d(e,"c",(function(){return l})),r.d(e,"b",(function(){return h})),r.d(e,"a",(function(){return f}));var n=r(69),i=r(84),o=r(36),a=r(132);function s(t,e){const r=t[e].bind(t);t[e]=function(...e){const n=e[0];return n in t.state.cache&&t.state.enable?t.state.cache[n]:r(...e)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function u(t,e,r){const n=t[e].bind(t);t[e]=function(...e){const{valueChanged:i,oldValue:o}=r(t.state._updateCache,...e);return i&&n(...e),o},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}class c{constructor(t,{copyState:e=!1,log:r=(()=>{})}={}){this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=e?Object(i.a)(t):Object.assign({},n.c),this.log=r,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(t={}){this.stateStack.push({})}pop(){Object(o.a)(this.stateStack.length>0);const t=this.stateStack[this.stateStack.length-1];Object(i.c)(this.gl,t),this.stateStack.pop()}_updateCache(t){let e,r=!1;const n=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(const i in t){Object(o.a)(void 0!==i);const s=t[i],u=this.cache[i];Object(a.a)(s,u)||(r=!0,e=u,!n||i in n||(n[i]=u),this.cache[i]=s)}return{valueChanged:r,oldValue:e}}}function l(e,r={}){const{enable:i=!0,copyState:a}=r;if(Object(o.a)(void 0!==a),!e.state){const r=void 0!==t?t:window,{polyfillContext:i}=r;i&&i(e),e.state=new c(e,{copyState:a}),function(t){const e=t.useProgram.bind(t);t.useProgram=function(r){t.state.program!==r&&(e(r),t.state.program=r)}}(e);for(const t in n.b){u(e,t,n.b[t])}s(e,"getParameter"),s(e,"isEnabled")}return e.state.enable=i,e}function h(t){t.state||l(t,{copyState:!1}),t.state.push()}function f(t){Object(o.a)(t.state),t.state.pop()}}).call(this,r(65))},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(7),i=r(39),o=r(98),a=r(100),s=r(178),u=r(197),c=r(240),l=r(49),h=r(9);class f extends i.a{static isSupported(t,e={}){const{colorBufferFloat:r,colorBufferHalfFloat:n}=e;let i=!0;return r&&(i=Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")||t.getExtension("OES_texture_float"))),n&&(i=i&&Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("EXT_color_buffer_half_float"))),i}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new f(t,{id:"default-framebuffer",handle:null,attachments:{}}),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){const t=Object(n.a)(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){const t=Object(n.a)(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t,e={}){super(t,e),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(e),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize({width:t=1,height:e=1,attachments:r=null,color:n=!0,depth:i=!0,stencil:o=!1,check:a=!0,readBuffer:s,drawBuffers:u}){if(Object(h.a)(t>=0&&e>=0,"Width and height need to be integers"),this.width=t,this.height=e,r)for(const n in r){const i=r[n];(Array.isArray(i)?i[0]:i).resize({width:t,height:e})}else r=this._createDefaultAttachments(n,i,o,t,e);this.update({clearAttachments:!0,attachments:r,readBuffer:s,drawBuffers:u}),r&&a&&this.checkStatus()}delete(){for(const t of this.ownResources)t.delete();return super.delete(),this}update({attachments:t={},readBuffer:e,drawBuffers:r,clearAttachments:n=!1,resizeAttachments:i=!0}){this.attach(t,{clearAttachments:n,resizeAttachments:i});const{gl:o}=this,a=o.bindFramebuffer(36160,this.handle);return e&&this._setReadBuffer(e),r&&this._setDrawBuffers(r),o.bindFramebuffer(36160,a||null),this}resize(t={}){let{width:e,height:r}=t;if(null===this.handle)return Object(h.a)(void 0===e&&void 0===r),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;void 0===e&&(e=this.gl.drawingBufferWidth),void 0===r&&(r=this.gl.drawingBufferHeight),e!==this.width&&r!==this.height&&n.k.log(2,`Resizing framebuffer ${this.id} to ${e}x${r}`)();for(const t in this.attachments)this.attachments[t].resize({width:e,height:r});return this.width=e,this.height=r,this}attach(t,{clearAttachments:e=!1,resizeAttachments:r=!0}={}){const n={};e&&Object.keys(this.attachments).forEach(t=>{n[t]=null}),Object.assign(n,t);const i=this.gl.bindFramebuffer(36160,this.handle);for(const t in n){Object(h.a)(void 0!==t,"Misspelled framebuffer binding point?");const e=Number(t),i=n[e];let o=i;if(o)if(o instanceof a.a)this._attachRenderbuffer({attachment:e,renderbuffer:o});else if(Array.isArray(i)){const[t,r=0,n=0]=i;o=t,this._attachTexture({attachment:e,texture:t,layer:r,level:n})}else this._attachTexture({attachment:e,texture:o,layer:0,level:0});else this._unattach(e);r&&o&&o.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,i||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter(t=>!this.attachments[t]).forEach(t=>{delete this.attachments[t]})}checkStatus(){const{gl:t}=this,e=this.getStatus();if(36053!==e)throw new Error(function(t){return(f.STATUS||{})[t]||`Framebuffer error ${t}`}(e));return this}getStatus(){const{gl:t}=this,e=t.bindFramebuffer(36160,this.handle),r=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,e||null),r}clear(t={}){const{color:e,depth:r,stencil:n,drawBuffers:i=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(e||r||n)&&Object(s.a)(this.gl,{color:e,depth:r,stencil:n}),i.forEach((t,e)=>{Object(s.b)(this.gl,{drawBuffer:e,value:t})}),this.gl.bindFramebuffer(36160,o||null),this}readPixels(t={}){return n.k.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}readPixelsToBuffer(t={}){return n.k.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}copyToDataUrl(t={}){return n.k.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}copyToImage(t={}){return n.k.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}copyToTexture(t={}){return n.k.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}blit(t={}){return n.k.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}invalidate({attachments:t=[],x:e=0,y:r=0,width:i,height:o}){const a=Object(n.a)(this.gl),s=a.bindFramebuffer(36008,this.handle);return 0===e&&0===r&&void 0===i&&void 0===o?a.invalidateFramebuffer(36008,t):a.invalidateFramebuffer(36008,t,e,r,i,o),a.bindFramebuffer(36008,s),this}getAttachmentParameter(t,e,r){let n=this._getAttachmentParameterFallback(e);return null===n&&(this.gl.bindFramebuffer(36160,this.handle),n=this.gl.getFramebufferAttachmentParameter(36160,t,e),this.gl.bindFramebuffer(36160,null)),r&&n>1e3&&(n=Object(l.a)(this.gl,n)),n}getAttachmentParameters(t=36064,e,r=this.constructor.ATTACHMENT_PARAMETERS||[]){const n={};for(const i of r){n[e?Object(l.a)(this.gl,i):i]=this.getAttachmentParameter(t,i,e)}return n}getParameters(t=!0){const e=Object.keys(this.attachments),r={};for(const n of e){const e=Number(n);r[t?Object(l.a)(this.gl,e):e]=this.getAttachmentParameters(e,t)}return r}show(){return"undefined"!=typeof window&&window.open(Object(u.a)(this),"luma-debug-texture"),this}log(t=0,e=""){if(t>n.k.level||"undefined"==typeof window)return this;e=e||`Framebuffer ${this.id}`;const r=Object(u.a)(this,{targetMaxHeight:100});return n.k.image({logLevel:t,message:e,image:r},e)(),this}bind({target:t=36160}={}){return this.gl.bindFramebuffer(t,this.handle),this}unbind({target:t=36160}={}){return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,e,r,n,i){let s=null;return t&&(s=s||{},s[36064]=new o.a(this.gl,{id:`${this.id}-color0`,pixels:null,format:6408,type:5121,width:n,height:i,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(s[36064])),e&&r?(s=s||{},s[33306]=new a.a(this.gl,{id:`${this.id}-depth-stencil`,format:35056,width:n,height:111}),this.ownResources.push(s[33306])):e?(s=s||{},s[36096]=new a.a(this.gl,{id:`${this.id}-depth`,format:33189,width:n,height:i}),this.ownResources.push(s[36096])):r&&Object(h.a)(!1),s}_unattach(t){const e=this.attachments[t];e&&(e instanceof a.a?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer({attachment:t=36064,renderbuffer:e}){const{gl:r}=this;r.framebufferRenderbuffer(36160,t,36161,e.handle),this.attachments[t]=e}_attachTexture({attachment:t=36064,texture:e,layer:r,level:i}){const{gl:o}=this;switch(o.bindTexture(e.target,e.handle),e.target){case 35866:case 32879:Object(n.a)(o).framebufferTextureLayer(36160,t,e.target,i,r);break;case 34067:const a=function(t){return t<34069?t+34069:t}(r);o.framebufferTexture2D(36160,t,a,e.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,e.handle,i);break;default:Object(h.a)(!1,"Illegal texture type")}o.bindTexture(e.target,null),this.attachments[t]=e}_setReadBuffer(t){const e=Object(n.g)(this.gl);e?e.readBuffer(t):Object(h.a)(36064===t||1029===t,"Multiple render targets not supported"),this.readBuffer=t}_setDrawBuffers(t){const{gl:e}=this,r=Object(n.a)(e);if(r)r.drawBuffers(t);else{const r=e.getExtension("WEBGL_draw_buffers");r?r.drawBuffersWEBGL(t):Object(h.a)(1===t.length&&(36064===t[0]||1029===t[0]),"Multiple render targets not supported")}this.drawBuffers=t}_getAttachmentParameterFallback(t){const e=Object(c.a)(this.gl);switch(t){case 36052:return e.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return e.WEBGL2?null:8;case 33297:return e.WEBGL2?null:5125;case 33296:return e.WEBGL2||e.EXT_sRGB?null:9729;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}}f.ATTACHMENT_PARAMETERS=[36049,36048,33296,33298,33299,33300,33301,33302,33303]},function(t,e,r){"use strict";function n(t,e){if(t===e)return!0;if(!t||!e)return!1;for(var r in t){var i=t[r],o=e[r];if(!(i===o||Array.isArray(i)&&Array.isArray(o)&&n(i,o)))return!1}return!0}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return p}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function h(){}var f={onStart:h,onUpdate:h,onInterrupt:h,onEnd:h},p=function(){function t(e){a()(this,t),this._inProgress=!1,this._handle=null,this.timeline=e,this.settings={}}return u()(t,[{key:"start",value:function(t){this.cancel(),this.settings=l(l({},f),t),this._inProgress=!0,this.settings.onStart(this)}},{key:"end",value:function(){this._inProgress&&(this.timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd(this))}},{key:"cancel",value:function(){this._inProgress&&(this.settings.onInterrupt(this),this.timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}},{key:"update",value:function(){if(!this._inProgress)return!1;if(null===this._handle){var t=this.timeline,e=this.settings;this._handle=t.addChannel({delay:t.getTime(),duration:e.duration})}return this.time=this.timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate(this),this.timeline.isFinished(this._handle)&&this.end(),!0}},{key:"_onUpdate",value:function(){}},{key:"inProgress",get:function(){return this._inProgress}}]),t}()},function(t,e,r){"use strict";function n(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}function i(t,e,r){const n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/a,t[1]=(r[1]*n+r[5]*i+r[9]*o)/a,t[2]=(r[2]*n+r[6]*i+r[10]*o)/a,t}function o(t,e,r){const n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2],t}function a(t,e,r){const n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n+r[3]*i+r[6]*o,t[1]=r[1]*n+r[4]*i+r[7]*o,t[2]=r[2]*n+r[5]*i+r[8]*o,t[3]=e[3],t}r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"d",(function(){return a}))},function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}));const n="vs",i="fs"},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"d",(function(){return s})),r.d(e,"c",(function(){return u}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window||{},a="object"!=typeof n||"[object process]"!==String(n)||n.browser,s="function"==typeof importScripts,u="undefined"!=typeof window&&void 0!==window.orientation,c=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);c&&parseFloat(c[1])}).call(this,r(65),r(57))},function(t,e,r){"use strict";r.r(e);var n=r(94),i=r(20);async function o(t,e,r){if("number"==typeof t)return await i.a._readToArrayBuffer(t,e,r);t instanceof Blob||(t=new Blob([t]));const n=t.slice(e,e+r);return await async function(t){return await new Promise((e,r)=>{const n=new FileReader;n.onload=t=>{var r;return e(null==t?void 0:null===(r=t.target)||void 0===r?void 0:r.result)},n.onerror=t=>r(t),n.readAsArrayBuffer(t)})}(n)}var a=r(92),s=r(83),u=r(78),c=r(97);function l(t,e={}){if(t=Object(a.b)(t),!s.c){const r=i.a.readFileSync(t,e);return"string"!=typeof r?Object(u.d)(r):r}return e.nothrow||Object(c.a)(!1),null}var h=r(144);async function f(t,e,r){t=Object(a.b)(t),s.c||await i.a.writeFile(t,Object(h.a)(e),{flag:"w"}),Object(c.a)(!1)}function p(t,e,r){t=Object(a.b)(t),s.c||i.a.writeFileSync(t,Object(h.a)(e),{flag:"w"}),Object(c.a)(!1)}var d=r(41);function A(t){Object(d.d)(t)}var g=r(104),m=r(79),y=r(96),v=r(47),_=r(115),b=r(88),x=r(63);function w(t,e,r,n){Object(c.a)(!n||"object"==typeof n),Array.isArray(e)||Object(v.a)(e)||(n=void 0,r=e,e=void 0),r=r||{};const i=e,o=Object(b.b)(i,n),a=Object(m.b)(t,o,r);if(!a)return null;r=Object(d.c)(r,a,o);const{url:s}=Object(x.b)(t);return function(t,e,r,n){if(e=Object(_.b)(e,t,r),t.parseTextSync&&"string"==typeof e)return t.parseTextSync(e,r);if(t.parseSync&&e instanceof ArrayBuffer)return t.parseSync(e,r,n);throw new Error(`${t.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${n.url||""}`)}(a,t,r,n=Object(b.a)({url:s,parseSync:w,parse:()=>{throw new Error("parseSync called parse")},loaders:e},r))}var E=r(151);async function S(t,e,r,n){Object(c.a)(!n||"object"==typeof n),Array.isArray(e)||Object(v.a)(e)||(n=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:i}=Object(x.b)(t),o=await Object(m.a)(t,e,r);return o?(r=Object(d.c)(r,o,e,i),n=Object(b.a)({url:i,parseInBatches:S,parse:y.a,loaders:e},r,n),await async function(t,e,r,n){const i=await async function(t,e,r,n){const i=await Object(_.c)(e,r),o=await async function(t,e=[]){let r=t;for await(const t of e)r=t(r);return r}(i,(null==r?void 0:r.transforms)||[]);if(t.parseInBatches)return t.parseInBatches(o,r,n);return async function*(){const e=await Object(E.a)(o),i=await Object(y.a)(e,t,{...r,mimeType:t.mimeTypes[0]},n),a={mimeType:t.mimeTypes[0],shape:Array.isArray(i)?"row-table":"unknown",batchType:"data",data:i,length:Array.isArray(i)?i.length:1};yield a}()}(t,e,r,n);if(!r.metadata)return i;const o={batchType:"metadata",metadata:{_loader:t,_context:n},data:[],bytesUsed:0};return async function*(t){yield o,yield*t}(i)}(o,t,r,n)):null}var O=r(206);function T(t,e,r,n){Array.isArray(e)||Object(v.a)(e)||(void 0,r=e,e=null);const i=Object(d.a)(r||{});return Array.isArray(t)?t.map(t=>P(t,e,r,i)):P(t,e,r,i)}async function P(t,e,r,n){if("string"==typeof t){const i=t,o=await n(i);return await S(o,e,r)}return await S(t,e,r)}async function M(t,e,r){if(e.encode)return await e.encode(t,r);if(e.encodeSync)return e.encodeSync(t,r);if(e.encodeText)return(new TextEncoder).encode(await e.encodeText(t,r));if(e.encodeInBatches){const n=k(t,e,r),i=[];for await(const t of n)i.push(t);return Object(u.b)(...i)}if(!s.c&&e.encodeURLtoURL){const i=L("input");await f(i,t);const o=L("output"),a=await R(i,o,e,r);return(await Object(n.a)(a)).arrayBuffer()}throw new Error("Writer could not encode data")}function C(t,e,r){if(e.encodeSync)return e.encodeSync(t,r);throw new Error("Writer could not synchronously encode data")}async function I(t,e,r){if(e.text&&e.encodeText)return await e.encodeText(t,r);if(e.text&&(e.encode||e.encodeInBatches)){const n=await M(t,e,r);return(new TextDecoder).decode(n)}throw new Error("Writer could not encode data as text")}function k(t,e,r){if(e.encodeInBatches){const n=function(t){return[{table:t,start:0,end:t.length}]}(t);return e.encodeInBatches(n,r)}throw new Error("Writer could not encode data in batches")}async function R(t,e,r,n){if(t=Object(a.b)(t),e=Object(a.b)(e),s.c||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(t,e,n)}function L(t){return`/tmp/${t}`}async function j(t,e,r,n){const i=await M(t,r,n);return await f(e,i)}function D(t,e,r,n){return p(e,C(t,r,n))}var B=r(211),F=r(116);function z(t,e){const r=t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]();return new ReadableStream({type:"bytes",async pull(t){try{const{done:e,value:n}=await r.next();e?t.close():t.enqueue(new Uint8Array(n))}catch(e){t.error(e)}},async cancel(){var t;await(null==r?void 0:null===(t=r.return)||void 0===t?void 0:t.call(r))}},{highWaterMark:2**24,...e})}var N=r(236);function U(t,e){return s.c?z(t,e):Object(N.makeNodeStream)(t,e)}var V=r(212);const G={name:"Null loader",id:"null",module:"core",version:"3.0.8",worker:!0,mimeTypes:["application/x.empty"],extensions:["null"],tests:[()=>!1],options:{null:{}}},W={name:"Null loader",id:"null",module:"core",version:"3.0.8",mimeTypes:["application/x.empty"],extensions:["null"],parse:async t=>t,parseSync:t=>t,parseInBatches:async function*(t){for await(const e of t)yield e},tests:[()=>!1],options:{null:{}}};var H=r(213);async function q(t,e,r=(()=>{}),n=(()=>{})){if(!(t=await t).ok)return t;const i=t.body;if(!i)return t;const o=t.headers.get("content-length")||0,a=o&&parseInt(o);if(!(o>0))return t;if("undefined"==typeof ReadableStream||!i.getReader)return t;const s=new ReadableStream({async start(t){const o=i.getReader();await async function t(e,r,n,i,o,a,s){try{const{done:u,value:c}=await r.read();if(u)return a(),void e.close();n+=c.byteLength;const l=Math.round(n/i*100);o(l,{loadedBytes:n,totalBytes:i}),e.enqueue(c),await t(e,r,n,i,o,a,s)}catch(t){e.error(t),s(t)}}(t,o,0,a,e,r,n)}});return new Response(s)}var Z=r(4);class X{constructor(t,e){Object(Z.a)(this,"_fetch",void 0),Object(Z.a)(this,"files",{}),Object(Z.a)(this,"lowerCaseFiles",{}),Object(Z.a)(this,"usedFiles",{}),this._fetch=(null==e?void 0:e.fetch)||fetch;for(let e=0;e<t.length;++e){const r=t[e];this.files[r.name]=r,this.lowerCaseFiles[r.name.toLowerCase()]=r,this.usedFiles[r.name]=!1}this.fetch=this.fetch.bind(this)}async fetch(t,e){if(t.includes("://"))return this._fetch(t,e);const r=this.files[t];if(!r)return new Response(t,{status:400,statusText:"NOT FOUND"});const n=new Headers(null==e?void 0:e.headers).get("Range"),i=n&&/bytes=($1)-($2)/.exec(n);if(i){const e=parseInt(i[1]),n=parseInt(i[2]),o=await r.slice(e,n).arrayBuffer(),a=new Response(o);return Object.defineProperty(a,"url",{value:t}),a}const o=new Response(r);return Object.defineProperty(o,"url",{value:t}),o}async readdir(t){const e=[];for(const t in this.files)e.push(t);return e}async stat(t,e){const r=this.files[t];if(!r)throw new Error(t);return{size:r.size}}async unlink(t){delete this.files[t],delete this.lowerCaseFiles[t],this.usedFiles[t]=!0}async open(t,e,r){return this.files[t]}async read(t,e,r=0,n=e.byteLength,i=null){const o=t;return{bytesRead:n,buffer:await o.slice(0,0+n).arrayBuffer()}}async close(t){}_getFile(t,e){const r=this.files[t]||this.lowerCaseFiles[t];return r&&e&&(this.usedFiles[t]=!0),r}}var Q=r(124),Y=r(19);r.d(e,"fetchFile",(function(){return n.a})),r.d(e,"readArrayBuffer",(function(){return o})),r.d(e,"readFileSync",(function(){return l})),r.d(e,"writeFile",(function(){return f})),r.d(e,"writeFileSync",(function(){return p})),r.d(e,"setLoaderOptions",(function(){return A})),r.d(e,"registerLoaders",(function(){return g.c})),r.d(e,"selectLoader",(function(){return m.a})),r.d(e,"selectLoaderSync",(function(){return m.b})),r.d(e,"parse",(function(){return y.a})),r.d(e,"parseSync",(function(){return w})),r.d(e,"parseInBatches",(function(){return S})),r.d(e,"load",(function(){return O.a})),r.d(e,"loadInBatches",(function(){return T})),r.d(e,"encode",(function(){return M})),r.d(e,"encodeSync",(function(){return C})),r.d(e,"encodeInBatches",(function(){return k})),r.d(e,"encodeText",(function(){return I})),r.d(e,"encodeURLtoURL",(function(){return R})),r.d(e,"save",(function(){return j})),r.d(e,"saveSync",(function(){return D})),r.d(e,"setPathPrefix",(function(){return a.c})),r.d(e,"getPathPrefix",(function(){return a.a})),r.d(e,"resolvePath",(function(){return a.b})),r.d(e,"RequestScheduler",(function(){return B.a})),r.d(e,"makeIterator",(function(){return F.a})),r.d(e,"makeStream",(function(){return U})),r.d(e,"makeDOMStream",(function(){return z})),r.d(e,"makeNodeStream",(function(){return V.makeNodeStream})),r.d(e,"NullWorkerLoader",(function(){return G})),r.d(e,"NullLoader",(function(){return W})),r.d(e,"JSONLoader",(function(){return H.a})),r.d(e,"_fetchProgress",(function(){return q})),r.d(e,"_BrowserFileSystem",(function(){return X})),r.d(e,"_unregisterLoaders",(function(){return g.a})),r.d(e,"isBrowser",(function(){return s.c})),r.d(e,"isWorker",(function(){return s.d})),r.d(e,"self",(function(){return s.e})),r.d(e,"window",(function(){return s.f})),r.d(e,"global",(function(){return s.b})),r.d(e,"document",(function(){return s.a})),r.d(e,"assert",(function(){return c.a})),r.d(e,"forEach",(function(){return E.b})),r.d(e,"concatenateArrayBuffersAsync",(function(){return E.a})),r.d(e,"makeTextDecoderIterator",(function(){return Q.c})),r.d(e,"makeTextEncoderIterator",(function(){return Q.d})),r.d(e,"makeLineIterator",(function(){return Q.a})),r.d(e,"makeNumberedLineIterator",(function(){return Q.b})),r.d(e,"isPureObject",(function(){return Y.h})),r.d(e,"isPromise",(function(){return Y.g})),r.d(e,"isIterable",(function(){return Y.d})),r.d(e,"isAsyncIterable",(function(){return Y.a})),r.d(e,"isIterator",(function(){return Y.e})),r.d(e,"isResponse",(function(){return Y.j})),r.d(e,"isReadableStream",(function(){return Y.i})),r.d(e,"isWritableStream",(function(){return Y.k}))},function(t,e,r){"use strict";r.d(e,"d",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"c",(function(){return s}));var n=r(89);function i(t){if(n.toArrayBuffer&&(t=n.toArrayBuffer(t)),t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.buffer;if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function o(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;const n=new Uint8Array(t),i=new Uint8Array(e);for(let t=0;t<n.length;++t)if(n[t]!==i[t])return!1;return!0}function a(...t){const e=t.map(t=>t instanceof ArrayBuffer?new Uint8Array(t):t),r=e.reduce((t,e)=>t+e.byteLength,0),n=new Uint8Array(r);let i=0;for(const t of e)n.set(t,i),i+=t.byteLength;return n.buffer}function s(t,e,r){const n=void 0!==r?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}},function(t,e,r){"use strict";r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return l}));var n=r(78),i=r(47),o=r(63),a=r(104),s=r(19);const u=/\.([^.]+)$/;async function c(t,e=[],r,n){if(!h(t))return null;let i=l(t,e,{...r,nothrow:!0},n);if(i)return i;if(Object(s.b)(t)&&(i=l(t=await t.slice(0,10).arrayBuffer(),e,r,n)),!(i||null!=r&&r.nothrow))throw new Error(f(t));return i}function l(t,e=[],r,n){if(!h(t))return null;if(e&&!Array.isArray(e))return Object(i.b)(e);let s=[];e&&(s=s.concat(e)),null!=r&&r.ignoreRegisteredLoaders||s.push(...Object(a.b)()),function(t){for(const e of t)Object(i.b)(e)}(s);const c=function(t,e,r,n){const{url:i,type:a}=Object(o.b)(t),s=i||(null==n?void 0:n.url);let c=null;null!=r&&r.mimeType&&(c=p(e,null==r?void 0:r.mimeType));return c=c||function(t,e){const r=e&&u.exec(e),n=r&&r[1];return n?function(t,e){e=e.toLowerCase();for(const r of t)for(const t of r.extensions)if(t.toLowerCase()===e)return r;return null}(t,n):null}(e,s),c=c||p(e,a),c=c||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(d(e,r))return r}else if(ArrayBuffer.isView(e)){if(A(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(A(e,0,r))return r}return null}(e,t),c=c||p(e,null==r?void 0:r.fallbackMimeType),c}(t,s,r,n);if(!(c||null!=r&&r.nothrow))throw new Error(f(t));return c}function h(t){return!(t instanceof Response&&204===t.status)}function f(t){const{url:e,type:r}=Object(o.b)(t);let n="No valid loader found";return t&&(n+=` data: "${function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return g(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return g(t,0,e)}return""}(t)}", contentType: "${r}"`),e&&(n+=` url: ${e}`),n}function p(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e===`application/x.${r.id}`)return r}return null}function d(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some(e=>t.startsWith(e))}function A(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>function(t,e,r,i){if(i instanceof ArrayBuffer)return Object(n.a)(i,t,i.byteLength);switch(typeof i){case"function":return i(t,r);case"string":const n=g(t,e,i.length);return i===n;default:return!1}}(t,e,r,i))}function g(t,e,r){if(t.byteLength<e+r)return"";const n=new DataView(t);let i="";for(let t=0;t<r;t++)i+=String.fromCharCode(n.getUint8(e+t));return i}},function(t,e,r){"use strict";function n(t,e){if(t===e)return!0;if(Array.isArray(t)){var r=t.length;if(!e||e.length!==r)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}function i(t){var e,r={};return function(i){for(var o in i)if(!n(i[o],r[o])){e=t(i),r=i;break}return e}}r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return s}));var n=r(9);const i={5126:[5126,1,"float"],35664:[5126,2,"vec2"],35665:[5126,3,"vec3"],35666:[5126,4,"vec4"],5124:[5124,1,"int"],35667:[5124,2,"ivec2"],35668:[5124,3,"ivec3"],35669:[5124,4,"ivec4"],5125:[5125,1,"uint"],36294:[5125,2,"uvec2"],36295:[5125,3,"uvec3"],36296:[5125,4,"uvec4"],35670:[5126,1,"bool"],35671:[5126,2,"bvec2"],35672:[5126,3,"bvec3"],35673:[5126,4,"bvec4"],35674:[5126,8,"mat2"],35685:[5126,8,"mat2x3"],35686:[5126,8,"mat2x4"],35675:[5126,12,"mat3"],35687:[5126,12,"mat3x2"],35688:[5126,12,"mat3x4"],35676:[5126,16,"mat4"],35689:[5126,16,"mat4x2"],35690:[5126,16,"mat4x3"]};function o(t){switch(t){case 0:return 0;case 1:case 3:case 2:return 1;case 4:case 5:case 6:return 4;default:return Object(n.a)(!1),0}}function a(t){const e=i[t];if(!e)return null;const[r,n]=e;return{type:r,components:n}}function s(t,e){switch(t){case 5120:case 5121:case 5122:case 5123:t=5126}for(const r in i){const[n,o,a]=i[r];if(n===t&&o===e)return{glType:r,name:a}}return null}},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"d",(function(){return s})),r.d(e,"e",(function(){return u}));var n=r(7);const i={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},o={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},a={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function s(t,e){const r=i[e];if(!r)return!1;if(void 0===r.gl1&&void 0===r.gl2)return!0;const o=Object(n.j)(t)&&r.gl2||r.gl1;return"string"==typeof o?t.getExtension(o):o}function u(t,e){const r=i[e];switch(r&&r.types[0]){case 5126:return t.getExtension("OES_texture_float_linear");case 5131:return t.getExtension("OES_texture_half_float_linear");default:return!0}}},function(t,e,r){"use strict";(function(t,n){r.d(e,"e",(function(){return o})),r.d(e,"f",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"c",(function(){return c})),r.d(e,"d",(function(){return l}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.self||i.window||i.global||{},a=i.window||i.self||i.global||{},s=i.global||i.self||i.window||{},u=i.document||{},c="object"!=typeof n||"[object process]"!==String(n)||n.browser,l="function"==typeof importScripts,h=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);h&&parseFloat(h[1])}).call(this,r(65),r(57))},function(t,e,r){"use strict";r.d(e,"c",(function(){return u})),r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return l})),r.d(e,"d",(function(){return h}));var n=r(69),i=r(70),o=r(36),a=r(31),s=r(132);function u(t,e){if(Object(o.a)(Object(a.d)(t),"setParameters requires a WebGL context"),Object(s.b)(e))return;const r={};for(const i in e){const o=Number(i),a=n.e[i];a&&("string"==typeof a?r[a]=!0:a(t,e[i],o))}const i=t.state&&t.state.cache;if(i)for(const o in r){(0,n.a[o])(t,e,i)}}function c(t,e){if("number"==typeof(e=e||n.c)){const r=e,i=n.d[r];return i?i(t,r):t.getParameter(r)}const r=Array.isArray(e)?e:Object.keys(e),i={};for(const e of r){const r=n.d[e];i[e]=r?r(t,Number(e)):t.getParameter(Number(e))}return i}function l(t){u(t,n.c)}function h(t,e,r){if(Object(s.b)(e))return r(t);const{nocatch:n=!0}=e;let o;if(Object(i.b)(t),u(t,e),n)o=r(t),Object(i.a)(t);else try{o=r(t)}finally{Object(i.a)(t)}return o}},function(t,e,r){"use strict";r.d(e,"a",(function(){return v}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),c=r(6),l=r.n(c),h=r(1),f=r.n(h),p=r(170),d=r(7),A=r(178);function g(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function y(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}var v=function(t){u()(r,t);var e=y(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"render",value:function(t){var e=this.gl;return Object(d.n)(e,{framebuffer:t.target}),this._drawLayers(t)}},{key:"_drawLayers",value:function(t){var e=t.viewports,r=t.views,n=t.onViewportActive,i=t.clearCanvas,o=void 0===i||i;t.pass=t.pass||"unknown";var a=this.gl;o&&function(t){var e=t.drawingBufferWidth,r=t.drawingBufferHeight;Object(d.n)(t,{viewport:[0,0,e,r]}),t.clear(16640)}(a);var s,u=[],c=g(e);try{for(c.s();!(s=c.n()).done;){var l=s.value,h=l.viewport||l,f=r&&r[h.id];n(h);var p=this._getDrawLayerParams(h,t);t.view=f;var A,m=g(h.subViewports||[h]);try{for(m.s();!(A=m.n()).done;){var y=A.value;t.viewport=y;var v=this._drawLayersInViewport(a,t,p);u.push(v)}}catch(t){m.e(t)}finally{m.f()}}}catch(t){c.e(t)}finally{c.f()}return u}},{key:"_getDrawLayerParams",value:function(t,e){for(var r=e.layers,n=e.pass,i=e.layerFilter,o=e.effects,a=e.moduleParameters,s=[],u=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},i=function i(o,a){var s,u=o.props._offset,c=o.id,l=o.parent&&o.parent.id;if(!l||l in r||i(o.parent,!1),l in n){var h=n[l]=n[l]||t(r[l],r);s=h(o,a),n[c]=h}else Number.isFinite(u)?(s=u+(r[l]||0),n[c]=null):s=e;return a&&s>=e&&(e=s+1),r[c]=s,s};return i}(),c={viewport:t,isPicking:n.startsWith("picking"),renderPass:n},l={},h=0;h<r.length;h++){var f=r[h],p=this._shouldDrawLayer(f,c,i,l),d={shouldDrawLayer:p,layerRenderIndex:u(f,p)};p&&(d.moduleParameters=this._getModuleParameters(f,o,n,a),d.layerParameters=this.getLayerParameters(f,h,t)),s[h]=d}return s}},{key:"_drawLayersInViewport",value:function(t,e,r){var n=e.layers,i=e.pass,o=e.viewport,a=e.view,s=function(t,e){var r=e.viewport,n=t.canvas?t.canvas.clientHeight||t.canvas.height:100,i=r,o=Object(d.e)(t);return[i.x*o,(n-i.y-i.height)*o,i.width*o,i.height*o]}(t,{viewport:o});if(a&&a.props.clear){var u=!0===a.props.clear?{color:!0,depth:!0}:a.props.clear;Object(d.o)(t,{scissorTest:!0,scissor:s},(function(){return Object(A.a)(t,u)}))}var c={totalCount:n.length,visibleCount:0,compositeCount:0,pickableCount:0};Object(d.n)(t,{viewport:s});for(var l=0;l<n.length;l++){var h=n[l],f=r[l],p=f.shouldDrawLayer,g=f.layerRenderIndex,m=f.moduleParameters,y=f.layerParameters;if(p&&h.props.pickable&&c.pickableCount++,h.isComposite)c.compositeCount++;else if(p){c.visibleCount++,m.viewport=o;try{h.drawLayer({moduleParameters:m,uniforms:{layerIndex:g},parameters:y})}catch(t){h.raiseError(t,"drawing ".concat(h," to ").concat(i))}}}return c}},{key:"shouldDrawLayer",value:function(t){return!0}},{key:"getModuleParameters",value:function(t,e){return null}},{key:"getLayerParameters",value:function(t,e){return t.props.parameters}},{key:"_shouldDrawLayer",value:function(t,e,r,n){if(!(this.shouldDrawLayer(t)&&t.props.visible))return!1;e.layer=t;for(var i=t.parent;i;){if(!i.props.visible||!i.filterSubLayer(e))return!1;e.layer=i,i=i.parent}if(r){var o=e.layer.id;if(o in n||(n[o]=r(e)),!n[o])return!1}return t.activateViewport(e.viewport),!0}},{key:"_getModuleParameters",value:function(t,e,r,n){var i=Object.assign(Object.create(t.props),{autoWrapLongitude:t.wrapLongitude,viewport:t.context.viewport,mousePosition:t.context.mousePosition,pickingActive:0,devicePixelRatio:Object(d.e)(this.gl)});if(e){var o,a=g(e);try{for(a.s();!(o=a.n()).done;){var s=o.value;Object.assign(i,s.getModuleParameters(t))}}catch(t){a.e(t)}finally{a.f()}}return Object.assign(i,this.getModuleParameters(t,e),n)}}]),r}(p.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return h}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a()(this,t);var r=e.id,n=void 0===r?"effect":r;this.id=n,this.props=l({},e)}return u()(t,[{key:"preRender",value:function(){}},{key:"getModuleParameters",value:function(){}},{key:"cleanup",value:function(){}}]),t}()},function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n);function o(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const r={};for(let n=0;n<e.length;n++)r[e[n]]=t[n];return r}function a(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=t[e[n]];return r}var s=r(4);let u;class c extends Array{enqueue(t){return this.push(t)}dequeue(){return this.shift()}}u=Symbol.asyncIterator;class l{constructor(){Object(s.a)(this,"_values",void 0),Object(s.a)(this,"_settlers",void 0),Object(s.a)(this,"_closed",void 0),this._values=new c,this._settlers=new c,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[u](){return this}enqueue(t){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");const e=this._settlers.dequeue();t instanceof Error?e.reject(t):e.resolve({value:t})}else this._values.enqueue(t)}next(){if(this._values.length>0){const t=this._values.dequeue();return t instanceof Error?Promise.reject(t):Promise.resolve({value:t})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((t,e)=>{this._settlers.enqueue({resolve:t,reject:e})})}}class h{constructor(t,e){if(Object(s.a)(this,"schema",void 0),Object(s.a)(this,"options",void 0),Object(s.a)(this,"length",0),Object(s.a)(this,"rows",null),Object(s.a)(this,"cursor",0),Object(s.a)(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;if(!t)return null;return t=t.slice(0,this.length),this.rows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}}}class f{constructor(t,e){if(Object(s.a)(this,"schema",void 0),Object(s.a)(this,"options",void 0),Object(s.a)(this,"length",0),Object(s.a)(this,"objectRows",null),Object(s.a)(this,"arrayRows",null),Object(s.a)(this,"cursor",0),Object(s.a)(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"object-row-table":const r=o(t,this._headers);this.addObjectRow(r,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(100),this.arrayRows[this.length]=t,this.length++}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"array-row-table":const r=a(t,this._headers);this.addArrayRow(r,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(100),this.objectRows[this.length]=t,this.length++}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}class p{constructor(t,e){Object(s.a)(this,"schema",void 0),Object(s.a)(this,"length",0),Object(s.a)(this,"allocated",0),Object(s.a)(this,"columns",{}),this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(const r in this.columns)this.columns[r][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(const e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();const t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const e in this.schema){const r=this.schema[e];t[r.name]=this.columns[r.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(const t in this.schema){const e=this.schema[t],r=e.type||Float32Array,n=this.columns[e.index];if(n&&ArrayBuffer.isView(n)){const t=new r(this.allocated);t.set(n),this.columns[e.index]=t}else n?(n.length=this.allocated,this.columns[e.index]=n):this.columns[e.index]=new r(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}const d={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class A{constructor(t,e){Object(s.a)(this,"schema",void 0),Object(s.a)(this,"options",void 0),Object(s.a)(this,"aggregator",null),Object(s.a)(this,"batchCount",0),Object(s.a)(this,"bytesUsed",0),Object(s.a)(this,"isChunkComplete",!1),Object(s.a)(this,"lastBatchEmittedMs",Date.now()),Object(s.a)(this,"totalLength",0),Object(s.a)(this,"totalBytes",0),Object(s.a)(this,"rowBytes",0),this.schema=t,this.options={...d,...e}}limitReached(){var t,e;return!!(Boolean(null===(t=this.options)||void 0===t?void 0:t.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(e=this.options)||void 0===e?void 0:e._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs)&&(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"row-table":return h;case"array-row-table":case"object-row-table":return f;case"columnar-table":return p;case"arrow-table":if(!A.ArrowBatch)throw new Error("TableBatchBuilder");return A.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}Object(s.a)(A,"ArrowBatch",void 0);var g=r(120),m=r.n(g);const{ChunkStreamer:y}=m.a;function v(t){t=t||{},y.call(this,t),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(t){this._input=t;try{for await(const e of t)this.parseChunk(this.getStringChunk(e));this._finished=!0,this.parseChunk("")}catch(t){this._sendError(t)}},this._nextChunk=function(){},this.getStringChunk=function(t){return"string"==typeof t?t:this.textDecoder.decode(t,{stream:!0})}}v.prototype=Object.create(y.prototype),v.prototype.constructor=v;const _={csv:{shape:"object-row-table",optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","\t","|",";"]}},b={id:"csv",module:"csv",name:"CSV",version:"3.0.8",extensions:["csv"],mimeTypes:["text/csv"],category:"table",parse:async(t,e)=>x((new TextDecoder).decode(t),e),parseText:(t,e)=>x(t,e),parseInBatches:function(t,e){var r;"auto"===(e={...e}).batchSize&&(e.batchSize=4e3);const n={..._.csv,...null===(r=e)||void 0===r?void 0:r.csv},i=new l;let o=!0,a=null,s=null,u=null;const c={...n,header:!1,download:!1,chunkSize:5242880,skipEmptyLines:!1,step(t){let r=t.data;if(n.skipEmptyLines){if(""===r.flat().join("").trim())return}const c=t.meta.cursor;if(o&&!a){if("auto"===n.header?w(r):Boolean(n.header))return void(a=r.map(E()))}o&&(o=!1,a||(a=S(n.columnPrefix,r.length)),u=function(t,e){const r=e?{}:[];for(let n=0;n<t.length;n++){const i=e&&e[n]||n;switch(typeof t[n]){case"number":case"boolean":r[i]={name:String(i),index:n,type:Float32Array};break;case"string":default:r[i]={name:String(i),index:n,type:Array}}}return r}(r,a)),n.optimizeMemoryUsage&&(r=JSON.parse(JSON.stringify(r))),s=s||new A(u,{shape:n.shape||"array-row-table",...e});try{s.addRow(r);const t=s&&s.getFullBatch({bytesUsed:c});t&&i.enqueue(t)}catch(t){i.enqueue(t)}},complete(t){try{const e=t.meta.cursor,r=s&&s.getFinalBatch({bytesUsed:e});r&&i.enqueue(r)}catch(t){i.enqueue(t)}i.close()}};return m.a.parse(t,c,v),i},options:_};async function x(t,e){const r={..._.csv,...null==e?void 0:e.csv},n=function(t){return m.a.parse(t,{download:!1,dynamicTyping:!0,preview:1}).data[0]}(t),i="auto"===r.header?w(n):Boolean(r.header),s={...r,header:i,download:!1,transformHeader:i?E():void 0,error:t=>{throw new Error(t)}},u=m.a.parse(t,s);let{data:c}=u;const l=u.meta.fields||S(r.columnPrefix,n.length);switch(r.shape){case"object-row-table":c=c.map(t=>Array.isArray(t)?o(t,l):t);break;case"array-row-table":c=c.map(t=>Array.isArray(t)?t:a(t,l))}return c}function w(t){return t&&t.every(t=>"string"==typeof t)}function E(){const t=new Set;return e=>{let r=e,n=1;for(;t.has(r);)r=`${e}.${n}`,n++;return t.add(r),r}}function S(t,e=0){const r=[];for(let n=0;n<e;n++)r.push(`${t}${n+1}`);return r}var O,T,P=r(104),M={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function C(){return document.createElement("div")}function I(t){if(!t.picked)return null;if(t.object===O)return T;var e={html:R(t.object),style:M};return T=e,O=t.object,e}var k=new Set(["position","index"]);function R(t){var e=C();for(var r in t)if(!k.has(r)){var n=C();n.className="header",n.textContent=r;var i=C();i.className="value",i.textContent=j(t[r]);var o=C();L(o,n,i),o.appendChild(n),o.appendChild(i),e.appendChild(o)}return e.innerHTML}function L(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function j(t){var e;if(Array.isArray(t)&&t.length>4)e="Array<".concat(t.length,">");else if("string"==typeof t)e=t;else if("number"==typeof t)e=String(t);else try{e=JSON.stringify(t)}catch(t){e="<Non-Serializable Object>"}return e.length>50&&(e=e.slice(0,50)),e}function D(t,e){var r=t;for(var n in e)r=r.replace("{".concat(n,"}"),e[n]);return r}var B=r(121),F={};var z=r(45);var N=r(2),U=r.n(N),V=r(3),G=r.n(V),W={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1},H=function(){function t(e){var r=e.container,n=e.props;U()(this,t);var i=n.description,o=document.createElement("div");o.className="deck-json-description-box",Object.assign(o.style,W),this.el=o;var a=document.createElement("div");a.innerHTML=i,o.appendChild(a),r.append(o)}return G()(t,[{key:"remove",value:function(){this.el.remove(),this.description=null}}],[{key:"stringName",get:function(){return"description"}}]),t}();function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function X(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Y(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={},n=Object.keys(e).filter((function(t){return t.charAt(0)===t.charAt(0).toUpperCase()})),i=X(n);try{for(i.s();!(t=i.n()).done;){var o=t.value;r[o]=e[o]}}catch(t){i.e(t)}finally{i.f()}return r}r.d(e,"addCustomLibraries",(function(){return J})),r.d(e,"createDeck",(function(){return rt})),r.d(e,"updateDeck",(function(){return tt})),r.d(e,"jsonConverter",(function(){return $}));var K={classes:Y(z),enumerations:{COORDINATE_SYSTEM:z.COORDINATE_SYSTEM,GL:{DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,FUNC_ADD:32774,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,BLEND_COLOR:32773,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,VENDOR:7936,RENDERER:7937,VERSION:7938,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,BROWSER_DEFAULT_WEBGL:37444,STATIC_DRAW:35044,STREAM_DRAW:35040,DYNAMIC_DRAW:35048,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,CULL_FACE:2884,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,BLEND:3042,DEPTH_TEST:2929,DITHER:3024,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,SCISSOR_TEST:3089,STENCIL_TEST:2960,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CONTEXT_LOST_WEBGL:37442,CW:2304,CCW:2305,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,COMPILE_STATUS:35713,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_ATTRIBUTES:35721,ACTIVE_UNIFORMS:35718,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,ALWAYS:519,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,GEQUAL:518,NOTEQUAL:517,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,TEXTURE_WIDTH:4096,TEXTURE_HEIGHT:4097,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,MAX_3D_TEXTURE_SIZE:32883,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,MAX_TEXTURE_LOD_BIAS:34045,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,RASTERIZER_DISCARD:35977,VERTEX_ARRAY_BINDING:34229,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,MAX_ELEMENT_INDEX:36203,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,RGB9_E5:35901,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2UI:36975,TEXTURE_IMMUTABLE_FORMAT:37167,TEXTURE_IMMUTABLE_LEVELS:33503,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,UNSIGNED_INT_24_8:34042,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,INT_2_10_10_10_REV:36255,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,MAX_SAMPLES:36183,SAMPLER_BINDING:35097,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,UNSIGNED_NORMALIZED:35863,SIGNED_NORMALIZED:36764,VERTEX_ATTRIB_ARRAY_INTEGER:35069,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,DEPTH24_STENCIL8:35056,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,COLOR:6144,DEPTH:6145,STENCIL:6146,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,INVALID_INDEX:4294967295,TIMEOUT_IGNORED:-1,MAX_CLIENT_WAIT_TIMEOUT_WEBGL:37447,VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,UNMASKED_VENDOR_WEBGL:37445,UNMASKED_RENDERER_WEBGL:37446,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047,TEXTURE_MAX_ANISOTROPY_EXT:34046,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35986,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,UNSIGNED_INT_24_8_WEBGL:34042,HALF_FLOAT_OES:36193,RGBA32F_EXT:34836,RGB32F_EXT:34837,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT:33297,UNSIGNED_NORMALIZED_EXT:35863,MIN_EXT:32775,MAX_EXT:32776,SRGB_EXT:35904,SRGB_ALPHA_EXT:35906,SRGB8_ALPHA8_EXT:35907,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:33296,FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723,COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067,COLOR_ATTACHMENT4_WEBGL:36068,COLOR_ATTACHMENT5_WEBGL:36069,COLOR_ATTACHMENT6_WEBGL:36070,COLOR_ATTACHMENT7_WEBGL:36071,COLOR_ATTACHMENT8_WEBGL:36072,COLOR_ATTACHMENT9_WEBGL:36073,COLOR_ATTACHMENT10_WEBGL:36074,COLOR_ATTACHMENT11_WEBGL:36075,COLOR_ATTACHMENT12_WEBGL:36076,COLOR_ATTACHMENT13_WEBGL:36077,COLOR_ATTACHMENT14_WEBGL:36078,COLOR_ATTACHMENT15_WEBGL:36079,DRAW_BUFFER0_WEBGL:34853,DRAW_BUFFER1_WEBGL:34854,DRAW_BUFFER2_WEBGL:34855,DRAW_BUFFER3_WEBGL:34856,DRAW_BUFFER4_WEBGL:34857,DRAW_BUFFER5_WEBGL:34858,DRAW_BUFFER6_WEBGL:34859,DRAW_BUFFER7_WEBGL:34860,DRAW_BUFFER8_WEBGL:34861,DRAW_BUFFER9_WEBGL:34862,DRAW_BUFFER10_WEBGL:34863,DRAW_BUFFER11_WEBGL:34864,DRAW_BUFFER12_WEBGL:34865,DRAW_BUFFER13_WEBGL:34866,DRAW_BUFFER14_WEBGL:34867,DRAW_BUFFER15_WEBGL:34868,MAX_COLOR_ATTACHMENTS_WEBGL:36063,MAX_DRAW_BUFFERS_WEBGL:34852,VERTEX_ARRAY_BINDING_OES:34229,QUERY_COUNTER_BITS_EXT:34916,CURRENT_QUERY_EXT:34917,QUERY_RESULT_EXT:34918,QUERY_RESULT_AVAILABLE_EXT:34919,TIME_ELAPSED_EXT:35007,TIMESTAMP_EXT:36392,GPU_DISJOINT_EXT:36795}}};Object(P.c)([b]);var $=new z.JSONConverter({configuration:K});function J(t,e){if(t){var r={};t.forEach((function(t){var e=t.libraryName,i=t.resourceUri;r[e]=!1,e in window?n(e,window[e]):(Object.defineProperty(window,e,{set:function(t){return n(e,t)},get:function(){return r[e]}}),function(t){if(!F[t]){var e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),F[t]=new Promise((function(t){e.onload=t}))}F[t]}(i))}))}function n(t,n){!function(t,e){var r={classes:Y(t)};e.mergeConfiguration(r)}(n,$),r[t]=n,Object.values(r).every((function(t){return t}))&&"function"==typeof e&&e()}}function tt(t,e){var r=$.convert(t);e.setProps(r)}function et(t){var e=t.mapProvider,r=t.props,n=t.mapboxApiKey,i=t.googleMapsKey,o=t.handleEvent,a=t.getTooltip,s=t.container,u=Z(Z({},o?{onClick:function(t){return o("deck-click-event",t)},onHover:function(t){return o("deck-hover-event",t)},onResize:function(t){return o("deck-resize-event",t)},onViewStateChange:function(t){var e=t.viewState,r=(t.interactionState,t.oldViewState,new z.WebMercatorViewport(e));e.nw=r.unproject([0,0]),e.se=r.unproject([r.width,r.height]),o("deck-view-state-change-event",e)},onDragStart:function(t){return o("deck-drag-start-event",t)},onDrag:function(t){return o("deck-drag-event",t)},onDragEnd:function(t){return o("deck-drag-end-event",t)}}:null),{},{getTooltip:a,container:s});switch(e){case"mapbox":return z.log.info("Using Mapbox base maps")(),new z.DeckGL(Z(Z(Z({},u),r),{},{map:B.a,mapboxApiAccessToken:n,onLoad:B.c}));case"carto":return z.log.info("Using Carto base maps")(),new z.DeckGL(Z(Z({map:B.a},u),r));case"google_maps":return z.log.info("Using Google Maps base maps")(),function(t){var e=t.container,r=(t.onClick,t.onComplete,t.getTooltip,t.googleMapsKey),n=t.layers,i=t.mapStyle,o=void 0===i?"satellite":i,a=t.initialViewState,s=void 0===a?{latitude:0,longitude:0,zoom:1}:a;if(!r)return z.log.warn("No Google Maps API key set")(),null;var u=new z.GoogleMapsOverlay({layers:n}),c={center:{lat:s.latitude,lng:s.longitude},mapTypeId:o,zoom:s.zoom},l=new window.google.maps.Map(e,c);return u.setMap(l),u}(Z(Z(Z({},u),r),{},{googleMapsKey:i}));default:return z.log.info("No recognized map provider specified")(),new z.DeckGL(Z(Z(Z({},u),r),{},{map:null,mapboxApiAccessToken:null}))}}function rt(t){var e,r=t.mapboxApiKey,n=t.googleMapsKey,i=t.container,o=t.jsonInput,a=t.tooltip,s=t.handleEvent,u=t.customLibraries;try{var c=o.layers||[],l=$.convert(o);!function(t,e){var r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);for(var n=[],i=0,o=Object.keys(e);i<o.length;i++){switch(o[i]){case"description":var a=new H({container:r,props:e});n.push(a)}}}(i,l);var h=(l.layers||[]).filter((function(t){return t})),f=function(t,e){return t.filter((function(t){return t&&t.id&&!e.find((function(e){return e.id===t.id}))}))}(c,h),p=function(t){return t?t.html||t.text?function(e){if(!e.picked)return null;var r={style:t.style||M};return t.html?r.html=D(t.html,e.object):r.text=D(t.text,e.object),r}:I:null}(a),d=l.mapProvider;e=et({mapProvider:d,props:l,mapboxApiKey:r,googleMapsKey:n,handleEvent:s,getTooltip:p,container:i});J(u,(function(){if(f.length){var t=($.convert({layers:o.layers}).layers||[]).filter((function(t){return t}));t.length>h.length&&e.setProps({layers:t})}}))}catch(t){console.error(t)}return e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o}));var n=r(41);function i(t,e,r=null){if(r)return r;const i={fetch:Object(n.a)(e,t),...t};return Array.isArray(i.loaders)||(i.loaders=null),i}function o(t,e){if(!e&&t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...t]:t}return r&&r.length?r:null}},function(t,e){},,,function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return s}));let n="";const i={};function o(t){n=t}function a(){return n}function s(t){for(const e in i)if(t.startsWith(e)){const r=i[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${n}${t}`),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return h}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(11),u=[255,255,255],c=[0,0,-1],l=0,h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t);var r=e.color,n=void 0===r?u:r,o=e.intensity,a=void 0===o?1:o,h=e.direction,f=void 0===h?c:h,p=e._shadow,d=void 0!==p&&p;this.id=e.id||"directional-".concat(l++),this.color=n,this.intensity=a,this.type="directional",this.direction=new s.b(f).normalize().toArray(),this.shadow=d}return a()(t,[{key:"getProjectedLight",value:function(){return this}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(92),i=r(99);async function o(t,e){if("string"==typeof t){t=Object(n.b)(t);let r=e;return null!=e&&e.fetch&&"function"!=typeof(null==e?void 0:e.fetch)&&(r=e.fetch),await fetch(t,r)}return await Object(i.b)(t)}},function(t,e,r){"use strict";const n={name:"fp32",vs:"#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\n\nfloat sin_taylor_fp32(float a) {\n  float r, s, t, x;\n\n  if (a == 0.0) {\n    return 0.0;\n  }\n\n  x = -a * a;\n  s = a;\n  r = a;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_3;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_5;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_7;\n  s = s + t;\n\n  r = r * x;\n  t = r * INVERSE_FACTORIAL_9;\n  s = s + t;\n\n  return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n  if (a == 0.0) {\n    sin_t = 0.0;\n    cos_t = 1.0;\n  }\n  sin_t = sin_taylor_fp32(a);\n  cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n    float sin_a;\n    float cos_a;\n\n    if (a == 0.0) {\n        return 0.0;\n    }\n    float z = floor(a / TWO_PI);\n    float r = a - TWO_PI * z;\n\n    float t;\n    float q = floor(r / PI_2 + 0.5);\n    int j = int(q);\n\n    if (j < -2 || j > 2) {\n        return 1.0 / 0.0;\n    }\n\n    t = r - PI_2 * q;\n\n    q = floor(t / PI_16 + 0.5);\n    int k = int(q);\n    int abs_k = int(abs(float(k)));\n\n    if (abs_k > 4) {\n        return 1.0 / 0.0;\n    } else {\n        t = t - PI_16 * q;\n    }\n\n    float u = 0.0;\n    float v = 0.0;\n\n    float sin_t, cos_t;\n    float s, c;\n    sincos_taylor_fp32(t, sin_t, cos_t);\n\n    if (k == 0) {\n        s = sin_t;\n        c = cos_t;\n    } else {\n        if (abs(float(abs_k) - 1.0) < 0.5) {\n            u = COS_TABLE_0;\n            v = SIN_TABLE_0;\n        } else if (abs(float(abs_k) - 2.0) < 0.5) {\n            u = COS_TABLE_1;\n            v = SIN_TABLE_1;\n        } else if (abs(float(abs_k) - 3.0) < 0.5) {\n            u = COS_TABLE_2;\n            v = SIN_TABLE_2;\n        } else if (abs(float(abs_k) - 4.0) < 0.5) {\n            u = COS_TABLE_3;\n            v = SIN_TABLE_3;\n        }\n        if (k > 0) {\n            s = u * sin_t + v * cos_t;\n            c = u * cos_t - v * sin_t;\n        } else {\n            s = u * sin_t - v * cos_t;\n            c = u * cos_t + v * sin_t;\n        }\n    }\n\n    if (j == 0) {\n        sin_a = s;\n        cos_a = c;\n    } else if (j == 1) {\n        sin_a = c;\n        cos_a = -s;\n    } else if (j == -1) {\n        sin_a = -c;\n        cos_a = s;\n    } else {\n        sin_a = -s;\n        cos_a = -c;\n    }\n    return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n  return tan_taylor_fp32(a);\n#else\n  return tan(a);\n#endif\n}\n",fs:null};var i={name:"geometry",vs:"\nstruct VertexGeometry {\n  vec4 position;\n  vec3 worldPosition;\n  vec3 worldPositionAlt;\n  vec3 normal;\n  vec2 uv;\n  vec3 pickingColor;\n} geometry = VertexGeometry(\n  vec4(0.0),\n  vec3(0.0),\n  vec3(0.0),\n  vec3(0.0),\n  vec2(0.0),\n  vec3(0.0)\n);\n",fs:"\n#define SMOOTH_EDGE_RADIUS 0.5\n\nstruct FragmentGeometry {\n  vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n  return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n"},o=r(14),a=Object.keys(o.a).map((function(t){return"const int COORDINATE_SYSTEM_".concat(t," = ").concat(o.a[t],";")})).join(""),s=Object.keys(o.c).map((function(t){return"const int PROJECTION_MODE_".concat(t," = ").concat(o.c[t],";")})).join(""),u=Object.keys(o.d).map((function(t){return"const int UNIT_".concat(t.toUpperCase()," = ").concat(o.d[t],";")})).join(""),c="".concat(a,"\n").concat(s,"\n").concat(u,"\n\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size() {\n  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n    project_uPseudoMeters == false) {\n    \n    if (geometry.position.w == 0.0) {\n      float y = clamp(geometry.worldPosition.y, -89.9, 89.9);\n      return 1.0 / cos(radians(y));\n    }\n  \n    float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n    float y2 = y * y;\n    float y4 = y2 * y2;\n    float y6 = y4 * y2;\n    return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n  }\n  return 1.0;\n}\nfloat project_size(float meters) {\n  return meters * project_uCommonUnitsPerMeter.z * project_size();\n}\n\nvec2 project_size(vec2 meters) {\n  return meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\n\nvec3 project_size(vec3 meters) {\n  return meters * project_uCommonUnitsPerMeter * project_size();\n}\n\nvec4 project_size(vec4 meters) {\n  return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nvec3 project_normal(vec3 vector) {\n  vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n  return normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\n}\n\nvec4 project_offset_(vec4 offset) {\n  float dy = offset.y;\n  vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\n  return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\n  float x = lnglat.x;\n  if (project_uWrapLongitude) {\n    x = mod(x + 180., 360.0) - 180.;\n  }\n  float y = clamp(lnglat.y, -89.9, 89.9);\n  return vec2(\n    radians(x) + PI,\n    PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n  ) * WORLD_SCALE;\n}\n\nvec3 project_globe_(vec3 lnglatz) {\n  float lambda = radians(lnglatz.x);\n  float phi = radians(lnglatz.y);\n  float cosPhi = cos(phi);\n  float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n\n  return vec3(\n    sin(lambda) * cosPhi,\n    -cos(lambda) * cosPhi,\n    sin(phi)\n  ) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\n  vec4 position_world = project_uModelMatrix * position;\n  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n      return vec4(\n        project_mercator_(position_world.xy),\n        project_size(position_world.z),\n        position_world.w\n      );\n    }\n    if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n      position_world.xyz += project_uCoordinateOrigin;\n    }\n  }\n  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n      return vec4(\n        project_globe_(position_world.xyz),\n        position_world.w\n      );\n    }\n  }\n  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n      if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\n        return vec4(\n          project_mercator_(position_world.xy) - project_uCommonOrigin.xy,\n          project_size(position_world.z),\n          position_world.w\n        );\n      }\n    }\n  }\n  if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n    (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n    (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n     project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n    position_world.xyz -= project_uCoordinateOrigin;\n  }\n  return project_offset_(position_world + project_uModelMatrix * vec4(position64Low, 0.0));\n}\n\nvec4 project_position(vec4 position) {\n  return project_position(position, ZERO_64_LOW);\n}\n\nvec3 project_position(vec3 position, vec3 position64Low) {\n  vec4 projected_position = project_position(vec4(position, 1.0), position64Low);\n  return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n  vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\n  return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n  vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\n  return projected_position.xy;\n}\n\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\n  return viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\n  return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\n  vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n  return offset * project_uFocalDistance;\n}\n\nfloat project_size_to_pixel(float meters) {\n  return project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\n  if (unit == UNIT_METERS) return project_size_to_pixel(size);\n  if (unit == UNIT_COMMON) return size * project_uScale;\n  return size;\n}\nfloat project_pixel_size(float pixels) {\n  return pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\n  return pixels / project_uScale;\n}\nmat3 project_get_orientation_matrix(vec3 up) {\n  vec3 uz = normalize(up);\n  vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\n  vec3 uy = cross(uz, ux);\n  return mat3(ux, uy, uz);\n}\n\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\n  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n    transform = project_get_orientation_matrix(commonPosition);\n    return true;\n  }\n  return false;\n}\n"),l=r(113),h={};e.a={name:"project",dependencies:[n,i],vs:c,getUniforms:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h;return t.viewport?Object(l.b)(t):{}}}},function(t,e,r){"use strict";var n=r(52),i=r(150);var o=r(187),a=r(47),s=r(41),u=r(115),c=r(88),l=r(63),h=r(79);async function f(t,e,r,p){Object(n.a)(!p||"object"==typeof p),!e||Array.isArray(e)||Object(a.a)(e)||(p=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:d}=Object(l.b)(t),A=e,g=Object(c.b)(A,p),m=await Object(h.a)(t,g,r);return m?(r=Object(s.c)(r,m,g,d),p=Object(c.a)({url:d,parse:f,loaders:g},r,p),await async function(t,e,r,a){if(function(t,e=i.a){Object(n.a)(t,"no worker provided");const r=t.version}(t),e=await Object(u.a)(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,a,t);if(Object(o.a)(t,r))return await Object(o.b)(t,e,r,a,f);if(t.parseText&&"string"==typeof e)return await t.parseText(e,r,a,t);if(t.parse)return await t.parse(e,r,a,t);throw Object(n.a)(!t.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(m,t,r,p)):null}r.d(e,"a",(function(){return f}))},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"loader assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";var n=r(7),i=r(55),o=r(9);let a="";r.d(e,"a",(function(){return s}));class s extends i.a{static isSupported(t,e){return i.a.isSupported(t,e)}constructor(t,e={}){var r,i;Object(n.b)(t),(e instanceof Promise||"string"==typeof e)&&(e={data:e}),"string"==typeof e.data&&(e=Object.assign({},e,{data:(r=e.data,Object(o.a)("string"==typeof r),r=a+r,new Promise((t,e)=>{try{const n=new Image;n.onload=()=>t(n),n.onerror=()=>e(new Error(`Could not load image ${r}.`)),n.crossOrigin=i&&i.crossOrigin||"anonymous",n.src=r}catch(t){e(t)}}))})),super(t,Object.assign({},e,{target:3553})),this.initialize(e),Object.seal(this)}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));var n=r(19),i=r(63);async function o(t){if(Object(n.j)(t))return t;const e={},r=Object(i.a)(t);r>=0&&(e["content-length"]=String(r));const{url:o,type:a}=Object(i.b)(t);a&&(e["content-type"]=a);const s=await async function(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise(t=>{const r=new FileReader;r.onload=e=>{var r;return t(null==e?void 0:null===(r=e.target)||void 0===r?void 0:r.result)},r.readAsDataURL(e)})}if(t instanceof ArrayBuffer){return`data:base64,${function(t){let e="";const r=new Uint8Array(t);for(let t=0;t<r.byteLength;t++)e+=String.fromCharCode(r[t]);return btoa(e)}(t.slice(0,5))}`}return null}(t);s&&(e["x-first-bytes"]=s),"string"==typeof t&&(t=(new TextEncoder).encode(t));const u=new Response(t,{headers:e});return Object.defineProperty(u,"url",{value:o}),u}async function a(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const r=t.headers.get("Content-Type");let n=t.statusText;r.includes("application/json")&&(n+=` ${await t.text()}`),e+=n,e=e.length>60?`${e.slice(60)}...`:e}catch(t){}return e}(t);throw new Error(e)}}},function(t,e,r){"use strict";var n=r(39);const i="EXT_color_buffer_float";var o={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:i,bpp:2},33327:{gl2:i,bpp:4},34842:{gl2:i,bpp:8},33326:{gl2:i,bpp:4},33328:{gl2:i,bpp:8},34836:{gl2:i,bpp:16},35898:{gl2:i,bpp:4}},a=r(7),s=r(9);r.d(e,"a",(function(){return u}));class u extends n.a{static isSupported(t,{format:e}={format:null}){return!e||function(t,e,r){const n=r[e];if(!n)return!1;const i=Object(a.j)(t)&&n.gl2||n.gl1;return"string"==typeof i?t.getExtension(i):i}(t,e,o)}static getSamplesForFormat(t,{format:e}){return t.getInternalformatParameter(36161,e,32937)}constructor(t,e={}){super(t,e),this.initialize(e),Object.seal(this)}initialize({format:t,width:e=1,height:r=1,samples:n=0}){return Object(s.a)(t,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),0!==n&&Object(a.j)(this.gl)?this.gl.renderbufferStorageMultisample(36161,n,t,e,r):this.gl.renderbufferStorage(36161,t,e,r),this.format=t,this.width=e,this.height=r,this.samples=n,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*o[this.format].bpp),this}resize({width:t,height:e}){return t!==this.width||e!==this.height?this.initialize({width:t,height:e,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}}},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){return o}));var n="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i="undefined"!=typeof window?window:t,o=(void 0!==t||window,"undefined"!=typeof document&&document,!1);try{var a={get passive(){return o=!0,!0}};i.addEventListener("test",a,a),i.removeEventListener("test",a,a)}catch(t){}}).call(this,r(65))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return n}));"undefined"!=typeof window&&window,void 0!==t||window;var n="undefined"!=typeof document?document:{}}).call(this,r(65))},,function(t,e,r){"use strict";r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(47),i=r(41);const o=()=>{const t=Object(i.b)();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function a(t){const e=o();t=Array.isArray(t)?t:[t];for(const r of t){const t=Object(n.b)(r);e.find(e=>t===e)||e.unshift(t)}}function s(){return o()}function u(){Object(i.b)().loaderRegistry=[]}},function(t,e,r){"use strict";r.d(e,"a",(function(){return C}));var n=r(10),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c),h=r(189),f=r.n(h),p=r(8),d=r.n(p),A=r(5),g=r.n(A),m=r(6),y=r.n(m),v=r(1),_=r.n(v),b=r(40),x=r(22),w=r(27),E=r(11);function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function O(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function T(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=_()(t);if(e){var i=_()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y()(this,r)}}var P=Math.PI/180;function M(t){return 512/4003e4/Math.cos(t*P)}var C=function(t){g()(r,t);var e=T(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u()(this,r);var i,o=n.latitude,a=void 0===o?0:o,s=n.longitude,c=void 0===s?0:s,l=n.zoom,h=void 0===l?11:l,p=n.pitch,d=void 0===p?0:p,A=n.bearing,g=void 0===A?0:A,m=n.nearZMultiplier,y=void 0===m?.1:m,v=n.farZMultiplier,_=void 0===v?1.01:v,b=n.orthographic,w=void 0!==b&&b,S=n.projectionMatrix,T=n.repeat,P=void 0!==T&&T,M=n.worldOffset,C=void 0===M?0:M,I=n.legacyMeterSizes,k=void 0!==I&&I,R=n.width,L=n.height,j=n.altitude,D=void 0===j?1.5:j,B=Math.pow(2,h);R=R||1,L=L||1;var F=null;S?(D=S[5]/2,i=Object(x.b)(D)):(n.fovy?(i=n.fovy,D=Object(x.e)(i)):i=Object(x.b)(D),F=Object(x.j)({width:R,height:L,pitch:d,fovy:i,nearZMultiplier:y,farZMultiplier:_}));var z=Object(x.k)({height:L,pitch:d,bearing:g,scale:B,altitude:D});if(C){var N=(new E.a).translate([512*C,0,0]);z=N.multiplyLeft(z)}return(t=e.call(this,O(O(O({},n),{},{width:R,height:L,viewMatrix:z,longitude:c,latitude:a,zoom:h},F),{},{fovy:i,focalDistance:D}))).latitude=a,t.longitude=c,t.zoom=h,t.pitch=d,t.bearing=g,t.altitude=D,t.fovy=i,t.orthographic=w,t._subViewports=P?[]:null,t._pseudoMeters=k,Object.freeze(f()(t)),t}return l()(r,[{key:"projectPosition",value:function(t){if(this._pseudoMeters)return d()(_()(r.prototype),"projectPosition",this).call(this,t);var e=this.projectFlat(t),n=i()(e,2);return[n[0],n[1],(t[2]||0)*M(t[1])]}},{key:"unprojectPosition",value:function(t){if(this._pseudoMeters)return d()(_()(r.prototype),"unprojectPosition",this).call(this,t);var e=this.unprojectFlat(t),n=i()(e,2),o=n[0],a=n[1];return[o,a,(t[2]||0)/M(a)]}},{key:"addMetersToLngLat",value:function(t,e){return Object(x.a)(t,e)}},{key:"panByPosition",value:function(t,e){var r=Object(x.n)(e,this.pixelUnprojectionMatrix),n=this.projectFlat(t),o=w.a([],n,w.d([],r)),a=w.a([],this.center,o),s=this.unprojectFlat(a),u=i()(s,2);return{longitude:u[0],latitude:u[1]}}},{key:"getBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object(x.f)(this,t.z||0);return[Math.min(e[0][0],e[1][0],e[2][0],e[3][0]),Math.min(e[0][1],e[1][1],e[2][1],e[3][1]),Math.max(e[0][0],e[1][0],e[2][0],e[3][0]),Math.max(e[0][1],e[1][1],e[2][1],e[3][1])]}},{key:"fitBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.width,i=this.height,o=Object(x.c)(O({width:n,height:i,bounds:t},e)),a=o.longitude,s=o.latitude,u=o.zoom;return new r({width:n,height:i,longitude:a,latitude:s,zoom:u})}},{key:"subViewports",get:function(){if(this._subViewports&&!this._subViewports.length)for(var t=this.getBounds(),e=Math.floor((t[0]+180)/360),n=Math.ceil((t[2]-180)/360),i=e;i<=n;i++){var o=i?new r(O(O({},this),{},{worldOffset:i})):this;this._subViewports.push(o)}return this._subViewports}}]),r}(b.a);C.displayName="WebMercatorViewport"},function(t,e,r){"use strict";r.d(e,"a",(function(){return k})),r.d(e,"b",(function(){return R}));var n=r(8),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(11),y=r(60),v=r(114),_=r(22),b=r(37);function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function E(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var S=0,O=0,T=1.5,P=0,M=20,C=0,I=60,k=function(t){f()(r,t);var e=E(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.makeViewport,o=n.width,a=n.height,s=n.latitude,c=n.longitude,l=n.zoom,h=n.bearing,f=void 0===h?O:h,p=n.pitch,d=void 0===p?S:p,A=n.altitude,g=void 0===A?T:A,m=n.maxZoom,y=void 0===m?M:m,v=n.minZoom,_=void 0===v?P:v,x=n.maxPitch,w=void 0===x?I:x,E=n.minPitch,k=void 0===E?C:E,R=n.startPanLngLat,L=n.startZoomLngLat,j=n.startRotatePos,D=n.startBearing,B=n.startPitch,F=n.startZoom,z=n.normalize;return u()(this,r),Object(b.a)(Number.isFinite(c)),Object(b.a)(Number.isFinite(s)),Object(b.a)(Number.isFinite(l)),(t=e.call(this,{width:o,height:a,latitude:s,longitude:c,zoom:l,bearing:f,pitch:d,altitude:g,maxZoom:y,minZoom:_,maxPitch:w,minPitch:k,normalize:z}))._state={startPanLngLat:R,startZoomLngLat:L,startRotatePos:j,startBearing:D,startPitch:B,startZoom:F},t.makeViewport=i,t}return l()(r,[{key:"panStart",value:function(t){var e=t.pos;return this._getUpdatedState({startPanLngLat:this._unproject(e)})}},{key:"pan",value:function(t){var e=t.pos,r=t.startPos,n=this._state.startPanLngLat||this._unproject(r);if(!n)return this;var i=this.makeViewport(this._viewportProps).panByPosition(n,e);return this._getUpdatedState(i)}},{key:"panEnd",value:function(){return this._getUpdatedState({startPanLngLat:null})}},{key:"rotateStart",value:function(t){var e=t.pos;return this._getUpdatedState({startRotatePos:e,startBearing:this._viewportProps.bearing,startPitch:this._viewportProps.pitch})}},{key:"rotate",value:function(t){var e,r=t.pos,n=t.deltaAngleX,i=void 0===n?0:n,o=t.deltaAngleY,a=void 0===o?0:o,s=this._state,u=s.startRotatePos,c=s.startBearing,l=s.startPitch;return u&&Number.isFinite(c)&&Number.isFinite(l)?(e=r?this._calculateNewPitchAndBearing(w(w({},this._getRotationParams(r,u)),{},{startBearing:c,startPitch:l})):{bearing:c+i,pitch:l+a},this._getUpdatedState(e)):this}},{key:"rotateEnd",value:function(){return this._getUpdatedState({startBearing:null,startPitch:null})}},{key:"zoomStart",value:function(t){var e=t.pos;return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this._viewportProps.zoom})}},{key:"zoom",value:function(t){var e=t.pos,r=t.startPos,n=t.scale,i=this._state,o=i.startZoom,a=i.startZoomLngLat;Number.isFinite(o)||(o=this._viewportProps.zoom,a=this._unproject(r)||this._unproject(e));var s=this._calculateNewZoom({scale:n,startZoom:o}),u=this.makeViewport(w(w({},this._viewportProps),{},{zoom:s}));return this._getUpdatedState(w({zoom:s},u.panByPosition(a,e)))}},{key:"zoomEnd",value:function(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}},{key:"zoomIn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(t)}},{key:"zoomOut",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(1/t)}},{key:"moveLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([t,0])}},{key:"moveRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([-t,0])}},{key:"moveUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,t])}},{key:"moveDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,-t])}},{key:"rotateLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this._viewportProps.bearing-t})}},{key:"rotateRight",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this._viewportProps.bearing+t})}},{key:"rotateUp",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this._viewportProps.pitch+t})}},{key:"rotateDown",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this._viewportProps.pitch-t})}},{key:"shortestPathFrom",value:function(t){var e=t.getViewportProps(),r=w({},this._viewportProps),n=r.bearing,i=r.longitude;return Math.abs(n-e.bearing)>180&&(r.bearing=n<0?n+360:n-360),Math.abs(i-e.longitude)>180&&(r.longitude=i<0?i+360:i-360),r}},{key:"_zoomFromCenter",value:function(t){var e=this._viewportProps,r=e.width,n=e.height;return this.zoom({pos:[r/2,n/2],scale:t})}},{key:"_panFromCenter",value:function(t){var e=this._viewportProps,r=e.width,n=e.height;return this.pan({startPos:[r/2,n/2],pos:[r/2+t[0],n/2+t[1]]})}},{key:"_getUpdatedState",value:function(t){return new this.constructor(w(w(w({makeViewport:this.makeViewport},this._viewportProps),this._state),t))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,r=t.minZoom,n=t.zoom;t.zoom=Object(m.d)(n,r,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;t.pitch=Object(m.d)(a,o,i);var s=t.normalize;return(void 0===s||s)&&Object.assign(t,Object(_.m)(t)),t}},{key:"_unproject",value:function(t){var e=this.makeViewport(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,r=t.startZoom,n=this._viewportProps,i=n.maxZoom,o=n.minZoom,a=r+Math.log2(e);return Object(m.d)(a,o,i)}},{key:"_calculateNewPitchAndBearing",value:function(t){var e=t.deltaScaleX,r=t.deltaScaleY,n=t.startBearing,i=t.startPitch;r=Object(m.d)(r,-1,1);var o=this._viewportProps,a=o.minPitch,s=o.maxPitch,u=i;return r>0?u=i+r*(s-i):r<0&&(u=i-r*(a-i)),{pitch:u,bearing:n+180*e}}},{key:"_getRotationParams",value:function(t,e){var r=t[0]-e[0],n=t[1]-e[1],i=t[1],o=e[1],a=this._viewportProps,s=a.width,u=a.height,c=r/s,l=0;return n>0?Math.abs(u-o)>5&&(l=n/(o-u)*1.2):n<0&&o>5&&(l=1-i/o),{deltaScaleX:c,deltaScaleY:l=Math.min(1,Math.max(-1,l))}}}]),r}(v.a),R=function(t){f()(r,t);var e=E(r);function r(t){return u()(this,r),t.dragMode=t.dragMode||"pan",e.call(this,k,t)}return l()(r,[{key:"setProps",value:function(t){var e=this.controllerStateProps;i()(g()(r.prototype),"setProps",this).call(this,t),(!e||e.height!==t.height)&&this.updateViewport(new this.ControllerState(w(w({makeViewport:this.makeViewport},this.controllerStateProps),this._state)))}},{key:"linearTransitionProps",get:function(){return["longitude","latitude","zoom","bearing","pitch"]}}]),r}(y.a)},function(t,e,r){"use strict";r.d(e,"a",(function(){return h}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(11),u=r(37);function c(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t),Array.isArray(e)&&(e={compare:e,extract:e,required:e});var r=e,n=r.compare,o=r.extract,a=r.required;this._propsToCompare=n,this._propsToExtract=o,this._requiredProps=a}return a()(t,[{key:"arePropsEqual",value:function(t,e){var r,n=c(this._propsToCompare||Object.keys(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!(i in t&&i in e&&Object(s.e)(t[i],e[i])))return!1}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"initializeProps",value:function(t,e){var r;if(this._propsToExtract){var n,i={},o={},a=c(this._propsToExtract);try{for(a.s();!(n=a.n()).done;){var s=n.value;i[s]=t[s],o[s]=e[s]}}catch(t){a.e(t)}finally{a.f()}r={start:i,end:o}}else r={start:t,end:e};return this._checkRequiredProps(r.start),this._checkRequiredProps(r.end),r}},{key:"interpolateProps",value:function(t,e,r){return e}},{key:"getDuration",value:function(t,e){return e.transitionDuration}},{key:"_checkRequiredProps",value:function(t){this._requiredProps&&this._requiredProps.forEach((function(e){var r=t[e];Object(u.a)(Number.isFinite(r)||Array.isArray(r),"".concat(e," is required for transition"))}))}}]),t}()},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(227),v=r(226),_=r(14),b=r(155),x=r(240),w=r(179),E=r(176),S=r(62),O=r(136),T=r(209),P=r(38);function M(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function I(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var L=function(t){f()(r,t);var e=R(r);function r(t){a()(this,r);var n=t.fp64,i=t.IndexType,o=void 0===i?Uint32Array:i;return e.call(this,k(k({},t),{},{attributes:{positions:{size:3,type:n?Float64Array:Float32Array},vertexValid:{type:Uint8ClampedArray,size:1},indices:{type:o,size:1}}}))}return u()(r,[{key:"get",value:function(t){var e=this.attributes;return"indices"===t?e.indices&&e.indices.subarray(0,this.vertexCount):e[t]}},{key:"updateGeometry",value:function(t){l()(g()(r.prototype),"updateGeometry",this).call(this,t);var e=this.buffers.indices;e&&(this.vertexCount=(e.value||e).length)}},{key:"normalizeGeometry",value:function(t){if(this.normalize){if(t=O.b(t,this.positionSize),this.opts.resolution)return Object(P.b)(t.positions||t,t.holeIndices,{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0});if(this.opts.wrapLongitude)return Object(P.c)(t.positions||t,t.holeIndices,{size:this.positionSize,maxLatitude:86,edgeTypes:!0})}return t}},{key:"getGeometrySize",value:function(t){if(Array.isArray(t)&&!Number.isFinite(t[0])){var e,r=0,n=M(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=this.getGeometrySize(i)}}catch(t){n.e(t)}finally{n.f()}return r}return(t.positions||t).length/this.positionSize}},{key:"getGeometryFromBuffer",value:function(t){return this.normalize||!this.buffers.indices?l()(g()(r.prototype),"getGeometryFromBuffer",this).call(this,t):function(){return null}}},{key:"updateGeometryAttributes",value:function(t,e){if(Array.isArray(t)&&!Number.isFinite(t[0])){var r,n=M(t);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=this.getGeometrySize(i);e.geometrySize=o,this.updateGeometryAttributes(i,e),e.vertexStart+=o,e.indexStart=this.indexStarts[e.geometryIndex+1]}}catch(t){n.e(t)}finally{n.f()}}else this._updateIndices(t,e),this._updatePositions(t,e),this._updateVertexValid(t,e)}},{key:"_updateIndices",value:function(t,e){var r=e.geometryIndex,n=e.vertexStart,i=e.indexStart,o=this.attributes,a=this.indexStarts,s=this.typedArrayManager,u=o.indices;if(u){var c=i,l=O.a(t,this.positionSize,this.opts.preproject);u=s.allocate(u,i+l.length,{copy:!0});for(var h=0;h<l.length;h++)u[c++]=l[h]+n;a[r+1]=i+l.length,o.indices=u}}},{key:"_updatePositions",value:function(t,e){var r=e.vertexStart,n=e.geometrySize,i=this.attributes.positions,o=this.positionSize;if(i)for(var a=t.positions||t,s=r,u=0;u<n;s++,u++){var c=a[u*o],l=a[u*o+1],h=o>2?a[u*o+2]:0;i[3*s]=c,i[3*s+1]=l,i[3*s+2]=h}}},{key:"_updateVertexValid",value:function(t,e){var r=e.vertexStart,n=e.geometrySize,i=this.attributes.vertexValid,o=this.positionSize,a=t&&t.holeIndices;if(t&&t.edgeTypes?i.set(t.edgeTypes,r):i.fill(1,r,r+n),a)for(var s=0;s<a.length;s++)i[r+a[s]/o-1]=0;i[r+n-1]=0}}]),r}(T.a),j="\nattribute vec2 vertexPositions;\nattribute float vertexValid;\n\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nstruct PolygonProps {\n  vec4 fillColors;\n  vec4 lineColors;\n  vec3 positions;\n  vec3 nextPositions;\n  vec3 pickingColors;\n  vec3 positions64Low;\n  vec3 nextPositions64Low;\n  float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n  if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n    return normalize(vector * project_uCommonUnitsPerWorldUnit);\n  }\n  return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n#ifdef IS_SIDE_VERTEX\n  if(vertexValid < 0.5){\n    gl_Position = vec4(0.);\n    return;\n  }\n#endif\n\n  vec3 pos;\n  vec3 pos64Low;\n  vec3 normal;\n  vec4 colors = isWireframe ? props.lineColors : props.fillColors;\n\n  geometry.worldPosition = props.positions;\n  geometry.worldPositionAlt = props.nextPositions;\n  geometry.pickingColor = props.pickingColors;\n\n#ifdef IS_SIDE_VERTEX\n  pos = mix(props.positions, props.nextPositions, vertexPositions.x);\n  pos64Low = mix(props.positions64Low, props.nextPositions64Low, vertexPositions.x);\n#else\n  pos = props.positions;\n  pos64Low = props.positions64Low;\n#endif\n\n  if (extruded) {\n    pos.z += props.elevations * vertexPositions.y * elevationScale;\n\n#ifdef IS_SIDE_VERTEX\n    normal = vec3(\n      props.positions.y - props.nextPositions.y + (props.positions64Low.y - props.nextPositions64Low.y),\n      props.nextPositions.x - props.positions.x + (props.nextPositions64Low.x - props.positions64Low.x),\n      0.0);\n    normal = project_offset_normal(normal);\n#else\n    normal = vec3(0.0, 0.0, 1.0);\n#endif\n    geometry.normal = normal;\n  }\n\n  gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  if (extruded) {\n    vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, normal);\n    vColor = vec4(lightColor, colors.a * opacity);\n  } else {\n    vColor = vec4(colors.rgb, colors.a * opacity);\n  }\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",D="#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\n".concat(j,"\n\nvoid main(void) {\n  PolygonProps props;\n\n  props.positions = positions;\n  props.positions64Low = positions64Low;\n  props.elevations = elevations;\n  props.fillColors = fillColors;\n  props.lineColors = lineColors;\n  props.pickingColors = pickingColors;\n\n  calculatePosition(props);\n}\n"),B="#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\n\nattribute vec3 instancePositions;\nattribute vec3 nextPositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 nextPositions64Low;\nattribute float instanceElevations;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\n".concat(j,"\n\nvoid main(void) {\n  PolygonProps props;\n\n  #if RING_WINDING_ORDER_CW == 1\n    props.positions = instancePositions;\n    props.positions64Low = instancePositions64Low;\n    props.nextPositions = nextPositions;\n    props.nextPositions64Low = nextPositions64Low;\n  #else\n    props.positions = nextPositions;\n    props.positions64Low = nextPositions64Low;\n    props.nextPositions = instancePositions;\n    props.nextPositions64Low = instancePositions64Low;\n  #endif\n  props.elevations = instanceElevations;\n  props.fillColors = instanceFillColors;\n  props.lineColors = instanceLineColors;\n  props.pickingColors = instancePickingColors;\n\n  calculatePosition(props);\n}\n");function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function N(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return W}));var U=[0,0,0,255],V={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:function(t){return t.polygon}},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:U},getLineColor:{type:"accessor",value:U},material:!0},G={enter:function(t,e){return e.length?e.subarray(e.length-t.length):t}},W=function(t){f()(r,t);var e=N(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(t){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"top"===t?D:B,fs:"#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",defines:{RING_WINDING_ORDER_CW:this.props._normalize||"CCW"!==this.props._windingOrder?1:0},modules:[m.a,y.a,v.a]})}},{key:"initializeState",value:function(){var t=this,e=this.context,r=e.gl,n=e.viewport,i=this.props.coordinateSystem;n.isGeospatial&&i===_.a.DEFAULT&&(i=_.a.LNGLAT),this.setState({numInstances:0,polygonTesselator:new L({preproject:i===_.a.LNGLAT&&n.projectFlat,fp64:this.use64bitPositions(),IndexType:!r||Object(x.c)(r,w.a.ELEMENT_INDEX_UINT32)?Uint32Array:Uint16Array})});var o=this.getAttributeManager();o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:!0},positions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:G,accessor:"getPolygon",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{positions:{vertexOffset:0,divisor:0},instancePositions:{vertexOffset:0,divisor:1},nextPositions:{vertexOffset:1,divisor:1}}},vertexValid:{size:1,divisor:1,type:5121,update:this.calculateVertexValid,noAlloc:!0},elevations:{size:1,transition:G,accessor:"getElevation",shaderAttributes:{elevations:{divisor:0},instanceElevations:{divisor:1}}},fillColors:{alias:"colors",size:this.props.colorFormat.length,type:5121,normalized:!0,transition:G,accessor:"getFillColor",defaultValue:U,shaderAttributes:{fillColors:{divisor:0},instanceFillColors:{divisor:1}}},lineColors:{alias:"colors",size:this.props.colorFormat.length,type:5121,normalized:!0,transition:G,accessor:"getLineColor",defaultValue:U,shaderAttributes:{lineColors:{divisor:0},instanceLineColors:{divisor:1}}},pickingColors:{size:3,type:5121,accessor:function(e,r){var n=r.index,i=r.target;return t.encodePickingColor(e&&e.__source?e.__source.index:n,i)},shaderAttributes:{pickingColors:{divisor:0},instancePickingColors:{divisor:1}}}})}},{key:"getPickingInfo",value:function(t){var e=l()(g()(r.prototype),"getPickingInfo",this).call(this,t),n=e.index,i=this.props.data;return i[0]&&i[0].__source&&(e.object=i.find((function(t){return t.__source.index===n}))),e}},{key:"disablePickingIndex",value:function(t){var e=this.props.data;if(e[0]&&e[0].__source)for(var r=0;r<e.length;r++)e[r].__source.index===t&&this._disablePickingIndex(r);else this._disablePickingIndex(t)}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.extruded,i=r.filled,o=r.wireframe,a=r.elevationScale,s=this.state,u=s.topModel,c=s.sideModel,l=s.polygonTesselator,h=z(z({},e),{},{extruded:Boolean(n),elevationScale:a});c&&(c.setInstanceCount(l.instanceCount-1),c.setUniforms(h),o&&(c.setDrawMode(3),c.setUniforms({isWireframe:!0}).draw()),i&&(c.setDrawMode(6),c.setUniforms({isWireframe:!1}).draw())),u&&(u.setVertexCount(l.vertexCount),u.setUniforms(h).draw())}},{key:"updateState",value:function(t){l()(g()(r.prototype),"updateState",this).call(this,t),this.updateGeometry(t);var e,n=t.props,i=t.oldProps,o=t.changeFlags,a=this.getAttributeManager();(o.extensionsChanged||n.filled!==i.filled||n.extruded!==i.extruded)&&(null===(e=this.state.models)||void 0===e||e.forEach((function(t){return t.delete()})),this.setState(this._getModels(this.context.gl)),a.invalidateAll())}},{key:"updateGeometry",value:function(t){var e=t.props,r=(t.oldProps,t.changeFlags);if(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPolygon)){var n=this.state.polygonTesselator,i=e.data.attributes||{};n.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:i.getPolygon,buffers:i,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:r.dataChanged}),this.setState({numInstances:n.instanceCount,startIndices:n.vertexStarts}),r.dataChanged||this.getAttributeManager().invalidateAll()}}},{key:"_getModels",value:function(t){var e,r,n=this.props,i=n.id,o=n.filled,a=n.extruded;if(o){var s=this.getShaders("top");s.defines.NON_INSTANCED_MODEL=1,e=new E.a(t,z(z({},s),{},{id:"".concat(i,"-top"),drawMode:4,attributes:{vertexPositions:new Float32Array([0,1])},uniforms:{isWireframe:!1,isSideVertex:!1},vertexCount:0,isIndexed:!0}))}return a&&((r=new E.a(t,z(z({},this.getShaders("side")),{},{id:"".concat(i,"-side"),geometry:new S.a({drawMode:1,vertexCount:4,attributes:{vertexPositions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),instanceCount:0,isInstanced:1}))).userData.excludeAttributes={indices:!0}),{models:[r,e].filter(Boolean),topModel:e,sideModel:r}}},{key:"calculateIndices",value:function(t){var e=this.state.polygonTesselator;t.startIndices=e.indexStarts,t.value=e.get("indices")}},{key:"calculatePositions",value:function(t){var e=this.state.polygonTesselator;t.startIndices=e.vertexStarts,t.value=e.get("positions")}},{key:"calculateVertexValid",value:function(t){t.value=this.state.polygonTesselator.get("vertexValid")}},{key:"wrapLongitude",get:function(){return!1}}]),r}(b.a);W.layerName="SolidPolygonLayer",W.defaultProps=V},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(226),v=r(18),_=r(14),b=r(155),x=r(176),w=r(62),E=r(209),S=r(38);function O(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return T(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function C(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var I=function(t){f()(r,t);var e=C(r);function r(t){return a()(this,r),e.call(this,M(M({},t),{},{attributes:{positions:{size:3,padding:18,initialize:!0,type:t.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}}))}return u()(r,[{key:"getGeometryFromBuffer",value:function(t){return this.normalize?l()(g()(r.prototype),"getGeometryFromBuffer",this).call(this,t):function(){return null}}},{key:"normalizeGeometry",value:function(t){return this.normalize?function(t,e,r,n){var i=t;if(Array.isArray(t[0])){var o=t.length*e;i=new Array(o);for(var a=0;a<t.length;a++)for(var s=0;s<e;s++)i[a*e+s]=t[a][s]||0}return r?Object(S.d)(i,{size:e,gridResolution:r}):n?Object(S.e)(i,{size:e}):i}(t,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):t}},{key:"get",value:function(t){return this.attributes[t]}},{key:"getGeometrySize",value:function(t){if(Array.isArray(t[0])){var e,r=0,n=O(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=this.getGeometrySize(i)}}catch(t){n.e(t)}finally{n.f()}return r}var o=this.getPathLength(t);return o<2?0:this.isClosed(t)?o<3?0:o+2:o}},{key:"updateGeometryAttributes",value:function(t,e){if(0!==e.geometrySize)if(t&&Array.isArray(t[0])){var r,n=O(t);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=this.getGeometrySize(i);e.geometrySize=o,this.updateGeometryAttributes(i,e),e.vertexStart+=o}}catch(t){n.e(t)}finally{n.f()}}else this._updateSegmentTypes(t,e),this._updatePositions(t,e)}},{key:"_updateSegmentTypes",value:function(t,e){var r=this.attributes.segmentTypes,n=this.isClosed(t),i=e.vertexStart,o=e.geometrySize;r.fill(0,i,i+o),n?(r[i]=4,r[i+o-2]=4):(r[i]+=1,r[i+o-2]+=2),r[i+o-1]=4}},{key:"_updatePositions",value:function(t,e){var r=this.attributes.positions;if(r)for(var n=e.vertexStart,i=e.geometrySize,o=new Array(3),a=n,s=0;s<i;a++,s++)this.getPointOnPath(t,s,o),r[3*a]=o[0],r[3*a+1]=o[1],r[3*a+2]=o[2]}},{key:"getPathLength",value:function(t){return t.length/this.positionSize}},{key:"getPointOnPath",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=this.positionSize;e*n>=t.length&&(e+=1-t.length/n);var i=e*n;return r[0]=t[i],r[1]=t[i+1],r[2]=3===n&&t[i+2]||0,r}},{key:"isClosed",value:function(t){if(!this.normalize)return this.opts.loop;var e=this.positionSize,r=t.length-e;return t[0]===t[r]&&t[1]===t[r+1]&&(2===e||t[2]===t[r+2])}}]),r}(E.a);function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return F}));var j=[0,0,0,255],D={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:function(t){return t.path}},getColor:{type:"accessor",value:j},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},B={enter:function(t,e){return e.length?e.subarray(e.length-t.length):t}},F=function(t){f()(r,t);var e=L(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute float instanceTypes;\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftPositions;\nattribute vec3 instanceRightPositions;\nattribute vec3 instanceLeftPositions64Low;\nattribute vec3 instanceStartPositions64Low;\nattribute vec3 instanceEndPositions64Low;\nattribute vec3 instanceRightPositions64Low;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;\nuniform bool billboard;\nuniform int widthUnits;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n  return -(float(flag) * 2. - 1.);\n}\nvec3 lineJoin(\n  vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n  vec2 width\n) {\n  bool isEnd = positions.x > 0.0;\n  float sideOfPath = positions.y;\n  float isJoint = float(sideOfPath == 0.0);\n\n  vec3 deltaA3 = (currPoint - prevPoint);\n  vec3 deltaB3 = (nextPoint - currPoint);\n\n  mat3 rotationMatrix;\n  bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\n  if (needsRotation) {\n    deltaA3 = deltaA3 * rotationMatrix;\n    deltaB3 = deltaB3 * rotationMatrix;\n  }\n  vec2 deltaA = deltaA3.xy / width;\n  vec2 deltaB = deltaB3.xy / width;\n\n  float lenA = length(deltaA);\n  float lenB = length(deltaB);\n\n  vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n  vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n  vec2 perpA = vec2(-dirA.y, dirA.x);\n  vec2 perpB = vec2(-dirB.y, dirB.x);\n  vec2 tangent = dirA + dirB;\n  tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n  vec2 miterVec = vec2(-tangent.y, tangent.x);\n  vec2 dir = isEnd ? dirA : dirB;\n  vec2 perp = isEnd ? perpA : perpB;\n  float L = isEnd ? lenA : lenB;\n  float sinHalfA = abs(dot(miterVec, perp));\n  float cosHalfA = abs(dot(dirA, miterVec));\n  float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n  float cornerPosition = sideOfPath * turnDirection;\n\n  float miterSize = 1.0 / max(sinHalfA, EPSILON);\n  miterSize = mix(\n    min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n    miterSize,\n    step(0.0, cornerPosition)\n  );\n\n  vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n    * (sideOfPath + isJoint * turnDirection);\n  bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n  bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n  bool isCap = isStartCap || isEndCap;\n  if (isCap) {\n    offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n    vJointType = capType;\n  } else {\n    vJointType = jointType;\n  }\n  vPathLength = L;\n  vCornerOffset = offsetVec;\n  vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n  vMiterLength = isCap ? isJoint : vMiterLength;\n\n  vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n  vPathPosition = vec2(\n    dot(offsetFromStartOfPath, perp),\n    dot(offsetFromStartOfPath, dir)\n  );\n  geometry.uv = vPathPosition;\n\n  float isValid = step(instanceTypes, 3.5);\n  vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n  if (needsRotation) {\n    offset = rotationMatrix * offset;\n  }\n  return currPoint + offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n  if (position.w < EPSILON) {\n    float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n    position = refPosition + (position - refPosition) * r;\n  }\n}\n\nvoid main() {\n  geometry.pickingColor = instancePickingColors;\n\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n\n  float isEnd = positions.x;\n\n  vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n  vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n  vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n  vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n  vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n  vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n  geometry.worldPosition = currPosition;\n  vec2 widthPixels = vec2(clamp(\n    project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n    widthMinPixels, widthMaxPixels) / 2.0);\n  vec3 width;\n\n  if (billboard) {\n    vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n    vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n    vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n    clipLine(prevPositionScreen, currPositionScreen);\n    clipLine(nextPositionScreen, currPositionScreen);\n    clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n    width = vec3(widthPixels, 0.0);\n    DECKGL_FILTER_SIZE(width, geometry);\n\n    vec3 pos = lineJoin(\n      prevPositionScreen.xyz / prevPositionScreen.w,\n      currPositionScreen.xyz / currPositionScreen.w,\n      nextPositionScreen.xyz / nextPositionScreen.w,\n      project_pixel_size_to_clipspace(width.xy)\n    );\n\n    gl_Position = vec4(pos * currPositionScreen.w, currPositionScreen.w);\n  } else {\n    prevPosition = project_position(prevPosition, prevPosition64Low);\n    currPosition = project_position(currPosition, currPosition64Low);\n    nextPosition = project_position(nextPosition, nextPosition64Low);\n\n    width = vec3(project_pixel_size(widthPixels), 0.0);\n    DECKGL_FILTER_SIZE(width, geometry);\n\n    vec4 pos = vec4(\n      lineJoin(prevPosition, currPosition, nextPosition, width.xy),\n      1.0);\n    geometry.position = pos;\n    gl_Position = project_common_position_to_clipspace(pos);\n  }\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float miterLimit;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nvoid main(void) {\n  geometry.uv = vPathPosition;\n\n  if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n    if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n      discard;\n    }\n    if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\n      discard;\n    }\n  }\n  gl_FragColor = vColor;\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a]})}},{key:"initializeState",value:function(){var t=this;this.getAttributeManager().addInstanced({positions:{size:3,vertexOffset:1,type:5130,fp64:this.use64bitPositions(),transition:B,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:5121,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:B,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,accessor:"getColor",transition:B,defaultValue:j},instancePickingColors:{size:3,type:5121,accessor:function(e,r){var n=r.index,i=r.target;return t.encodePickingColor(e&&e.__source?e.__source.index:n,i)}}}),this.setState({pathTesselator:new I({fp64:this.use64bitPositions()})}),this.props.getDashArray&&!this.props.extensions.length&&v.a.removed("getDashArray","PathStyleExtension")()}},{key:"updateState",value:function(t){var e=t.oldProps,n=t.props,i=t.changeFlags;l()(g()(r.prototype),"updateState",this).call(this,{props:n,oldProps:e,changeFlags:i});var o=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){var a=this.state.pathTesselator,s=n.data.attributes||{};a.updateGeometry({data:n.data,geometryBuffer:s.getPath,buffers:s,normalize:!n._pathType,loop:"loop"===n._pathType,getGeometry:n.getPath,positionFormat:n.positionFormat,wrapLongitude:n.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:a.instanceCount,startIndices:a.vertexStarts}),i.dataChanged||o.invalidateAll()}if(i.extensionsChanged){var u,c=this.context.gl;null===(u=this.state.model)||void 0===u||u.delete(),this.state.model=this._getModel(c),o.invalidateAll()}}},{key:"getPickingInfo",value:function(t){var e=l()(g()(r.prototype),"getPickingInfo",this).call(this,t),n=e.index,i=this.props.data;return i[0]&&i[0].__source&&(e.object=i.find((function(t){return t.__source.index===n}))),e}},{key:"disablePickingIndex",value:function(t){var e=this.props.data;if(e[0]&&e[0].__source)for(var r=0;r<e.length;r++)e[r].__source.index===t&&this._disablePickingIndex(r);else this._disablePickingIndex(t)}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.jointRounded,i=r.capRounded,o=r.billboard,a=r.miterLimit,s=r.widthUnits,u=r.widthScale,c=r.widthMinPixels,l=r.widthMaxPixels;this.state.model.setUniforms(e).setUniforms({jointType:Number(n),capType:Number(i),billboard:o,widthUnits:_.d[s],widthScale:u,miterLimit:a,widthMinPixels:c,widthMaxPixels:l}).draw()}},{key:"_getModel",value:function(t){return new x.a(t,R(R({},this.getShaders()),{},{id:this.props.id,geometry:new w.a({drawMode:4,attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0}))}},{key:"calculatePositions",value:function(t){var e=this.state.pathTesselator;t.startIndices=e.vertexStarts,t.value=e.get("positions")}},{key:"calculateSegmentTypes",value:function(t){var e=this.state.pathTesselator;t.startIndices=e.vertexStarts,t.value=e.get("segmentTypes")}},{key:"wrapLongitude",get:function(){return!1}}]),r}(b.a);F.layerName="PathLayer",F.defaultProps=D},function(t,e,r){"use strict";var n,i=r(0),o=r.n(i),a=r(2),s=r.n(a),u=r(3),c=r.n(u),l=r(8),h=r.n(l),f=r(5),p=r.n(f),d=r(6),A=r.n(d),g=r(1),m=r.n(g),y=r(207),v=r(226),_=r(14),b=r(18),x=r(155),w=r(176),E=r(62),S=r(230),O=r(197),T=r(98),P=r(292),M=r(206),C=r(53);function I(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?R(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var j=function(){},D=(n={},o()(n,10241,9987),o()(n,10240,9729),o()(n,10242,33071),o()(n,10243,33071),n);function B(t){return t&&(t.id||t.url)}function F(t,e,r){for(var n=0;n<e.length;n++){var i=e[n],o=i.icon,a=i.xOffset;t[B(o)]=L(L({},o),{},{x:a,y:r})}}var z=function(){function t(e,r){var n=r.onUpdate,i=void 0===n?j:n,o=r.onError,a=void 0===o?j:o;s()(this,t),this.gl=e,this.onUpdate=i,this.onError=a,this._loadOptions=null,this._getIcon=null,this._texture=null,this._externalTexture=null,this._mapping={},this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=4,this._canvasWidth=1024,this._canvasHeight=0,this._canvas=null}return c()(t,[{key:"finalize",value:function(){var t;null===(t=this._texture)||void 0===t||t.delete()}},{key:"getTexture",value:function(){return this._texture||this._externalTexture}},{key:"getIconMapping",value:function(t){var e=this._autoPacking?B(t):t;return this._mapping[e]||{}}},{key:"setProps",value:function(t){var e=t.loadOptions,r=t.autoPacking,n=t.iconAtlas,i=t.iconMapping,o=t.data,a=t.getIcon;e&&(this._loadOptions=e),void 0!==r&&(this._autoPacking=r),a&&(this._getIcon=a),i&&(this._mapping=i),n&&this._updateIconAtlas(n),this._autoPacking&&(o||a)&&"undefined"!=typeof document&&(this._canvas=this._canvas||document.createElement("canvas"),this._updateAutoPacking(o))}},{key:"_updateIconAtlas",value:function(t){var e;null===(e=this._texture)||void 0===e||e.delete(),this._texture=null,this._externalTexture=t,this.onUpdate()}},{key:"_updateAutoPacking",value:function(t){var e,r,n,i,o,a,s=Object.values(function(t,e,r){if(!t||!e)return null;r=r||{};var n,i={},o=Object(C.a)(t),a=o.iterable,s=o.objectInfo,u=I(a);try{for(u.s();!(n=u.n()).done;){var c=n.value;s.index++;var l=e(c,s),h=B(l);if(!l)throw new Error("Icon is missing.");if(!l.url)throw new Error("Icon url is missing.");i[h]||r[h]&&l.url===r[h].url||(i[h]=L(L({},l),{},{source:c,sourceIndex:s.index}))}}catch(t){u.e(t)}finally{u.f()}return i}(t,this._getIcon,this._mapping)||{});if(s.length>0){var u=function(t){for(var e,r=t.icons,n=t.buffer,i=t.mapping,o=void 0===i?{}:i,a=t.xOffset,s=void 0===a?0:a,u=t.yOffset,c=void 0===u?0:u,l=t.rowHeight,h=void 0===l?0:l,f=t.canvasWidth,p=[],d=0;d<r.length;d++){var A=r[d];if(!o[B(A)]){var g=A.height,m=A.width;s+m+n>f&&(F(o,p,c),s=0,c=h+c+n,h=0,p=[]),p.push({icon:A,xOffset:s}),s=s+m+n,h=Math.max(h,g)}}return p.length>0&&F(o,p,c),{mapping:o,rowHeight:h,xOffset:s,yOffset:c,canvasWidth:f,canvasHeight:(e=h+c+n,Math.pow(2,Math.ceil(Math.log2(e))))}}({icons:s,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset}),c=u.mapping,l=u.xOffset,h=u.yOffset,f=u.rowHeight,p=u.canvasHeight;this._rowHeight=f,this._mapping=c,this._xOffset=l,this._yOffset=h,this._canvasHeight=p,this._texture||(this._texture=new T.a(this.gl,{width:this._canvasWidth,height:this._canvasHeight,parameters:D})),this._texture.height!==this._canvasHeight&&(this._texture=(this.gl,e=this._texture,r=this._canvasWidth,n=this._canvasHeight,i=e.width,o=e.height,a=Object(S.a)(e,{width:r,height:n}),Object(O.b)(e,a,{targetY:0,width:i,height:o}),e.delete(),a)),this.onUpdate(),this._loadIcons(s)}}},{key:"_loadIcons",value:function(t){var e,r=this,n=this._canvas.getContext("2d"),i=I(t);try{var o=function(){var t=e.value;r._pendingCount++,Object(M.a)(t.url,P.a,r._loadOptions).then((function(e){var i=B(t),o=r._mapping[i],a=o.x,s=o.y,u=o.width,c=o.height,l=function(t,e,r,n){return r===e.width&&n===e.height?e:(t.canvas.height=n,t.canvas.width=r,t.clearRect(0,0,t.canvas.width,t.canvas.height),t.drawImage(e,0,0,e.width,e.height,0,0,r,n),t.canvas)}(n,e,u,c);r._texture.setSubImageData({data:l,x:a,y:s,width:u,height:c}),r._texture.generateMipmap(),r.onUpdate()})).catch((function(e){r.onError({url:t.url,source:t.source,sourceIndex:t.sourceIndex,loadOptions:r._loadOptions,error:e})})).finally((function(){r._pendingCount--}))};for(i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}},{key:"isLoaded",get:function(){return 0===this._pendingCount}}]),t}();function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function U(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?N(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function V(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m()(t);if(e){var i=m()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return A()(this,r)}}r.d(e,"a",(function(){return H}));var G=[0,0,0,255],W={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:function(t){return t.position}},getIcon:{type:"accessor",value:function(t){return t.icon}},getColor:{type:"accessor",value:G},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,compare:!1,optional:!0}},H=function(t){p()(r,t);var e=V(r);function r(){return s()(this,r),e.apply(this,arguments)}return c()(r,[{key:"getShaders",value:function(){return h()(m()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n  float angle_radian = angle * PI / 180.0;\n  float cos_angle = cos(angle_radian);\n  float sin_angle = sin(angle_radian);\n  mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n  return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n  geometry.uv = positions;\n  geometry.pickingColor = instancePickingColors;\n  uv = positions;\n\n  vec2 iconSize = instanceIconFrames.zw;\n  float sizePixels = clamp(\n    project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), \n    sizeMinPixels, sizeMaxPixels\n  );\n  float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n  vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n  pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n  pixelOffset += instancePixelOffset;\n  pixelOffset.y *= -1.0;\n\n  if (billboard)  {\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n    vec3 offset = vec3(pixelOffset, 0.0);\n    DECKGL_FILTER_SIZE(offset, geometry);\n    gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n  } else {\n    vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n    DECKGL_FILTER_SIZE(offset_common, geometry);\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n  }\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  vTextureCoords = mix(\n    instanceIconFrames.xy,\n    instanceIconFrames.xy + iconSize,\n    (positions.xy + 1.0) / 2.0\n  ) / iconsTextureDim;\n\n  vColor = instanceColors;\n  DECKGL_FILTER_COLOR(vColor, geometry);\n\n  vColorMode = instanceColorModes;\n}\n",fs:"#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n  geometry.uv = uv;\n\n  vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n  vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n  float a = texColor.a * opacity * vColor.a;\n\n  if (a < alphaCutoff) {\n    discard;\n  }\n\n  gl_FragColor = vec4(color, a);\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[y.a,v.a]})}},{key:"initializeState",value:function(){this.state={iconManager:new z(this.context.gl,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceOffsets:{size:2,accessor:"getIcon",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:"getIcon",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:5121,accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getColor",defaultValue:G},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}},{key:"updateState",value:function(t){var e=t.oldProps,n=t.props,i=t.changeFlags;h()(m()(r.prototype),"updateState",this).call(this,{props:n,oldProps:e,changeFlags:i});var o=this.getAttributeManager(),a=n.iconAtlas,s=n.iconMapping,u=n.data,c=n.getIcon,l=this.state.iconManager;l.setProps({loadOptions:n.loadOptions});var f=!1;if(a||this.internalState.isAsyncPropLoading("iconAtlas")?(e.iconAtlas!==n.iconAtlas&&l.setProps({iconAtlas:a,autoPacking:!1}),e.iconMapping!==n.iconMapping&&(l.setProps({iconMapping:s}),f=!0)):l.setProps({autoPacking:!0}),(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getIcon))&&l.setProps({data:u,getIcon:c}),f&&(o.invalidate("instanceOffsets"),o.invalidate("instanceIconFrames"),o.invalidate("instanceColorModes")),i.extensionsChanged){var p,d=this.context.gl;null===(p=this.state.model)||void 0===p||p.delete(),this.state.model=this._getModel(d),o.invalidateAll()}}},{key:"finalizeState",value:function(){h()(m()(r.prototype),"finalizeState",this).call(this),this.state.iconManager.finalize()}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.sizeScale,i=r.sizeMinPixels,o=r.sizeMaxPixels,a=r.sizeUnits,s=r.billboard,u=r.alphaCutoff,c=this.state.iconManager.getTexture();c&&this.state.model.setUniforms(e).setUniforms({iconsTexture:c,iconsTextureDim:[c.width,c.height],sizeUnits:_.d[a],sizeScale:n,sizeMinPixels:i,sizeMaxPixels:o,billboard:s,alphaCutoff:u}).draw()}},{key:"_getModel",value:function(t){return new w.a(t,U(U({},this.getShaders()),{},{id:this.props.id,geometry:new E.a({drawMode:6,attributes:{positions:{size:2,value:new Float32Array([-1,-1,-1,1,1,1,1,-1])}}}),isInstanced:!0}))}},{key:"_onUpdate",value:function(){this.setNeedsRedraw()}},{key:"_onError",value:function(t){var e=this.getCurrentLayer().props.onIconError;e?e(t):b.a.error(t.error)()}},{key:"getInstanceOffset",value:function(t){var e=this.state.iconManager.getIconMapping(t);return[e.width/2-e.anchorX||0,e.height/2-e.anchorY||0]}},{key:"getInstanceColorMode",value:function(t){return this.state.iconManager.getIconMapping(t).mask?1:0}},{key:"getInstanceIconFrame",value:function(t){var e=this.state.iconManager.getIconMapping(t);return[e.x||0,e.y||0,e.width||0,e.height||0]}},{key:"isLoaded",get:function(){return h()(m()(r.prototype),"isLoaded",this)&&this.state.iconManager.isLoaded}}]),r}(x.a);H.layerName="IconLayer",H.defaultProps=W},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(13),i=r(42);class o extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){get ELEMENTS(){return Object(i.a)(!1),0}clone(){return(new this.constructor).copy(this)}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}to(t){return t===this?this:Object(n.f)(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(n.b)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Object(n.e)(this[r],t);return`${t.printTypes?this.constructor.name:""}[${e}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Object(n.d)(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){void 0===r&&(r=e,e=t,t=this);for(let n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if(Array.isArray(t))return this.multiply(t);for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.scale(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}multiplyByScalar(t){return this.scale(t)}get elements(){return this}check(){if(n.b.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}}},function(t,e,r){"use strict";var n=r(44),i=r.n(n),o=r(10),a=r.n(o),s=r(14),u=r(95),c=r(11),l=r(80),h=r(22);function f(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var d=Object(l.a)((function(t){var e=t.viewport,r=t.center;return new c.a(e.viewProjectionMatrix).invert().transform(r)})),A=Object(l.a)((function(t){var e,r=t.viewport,n=t.shadowMatrices,o=[],s=r.pixelUnprojectionMatrix,u=r.isGeospatial?void 0:1,l=[[0,0,u],[r.width,0,u],[0,r.height,u],[r.width,r.height,u],[0,0,-1],[r.width,0,-1],[0,r.height,-1],[r.width,r.height,-1]].map((function(t){return function(t,e){var r=a()(t,3),n=r[0],i=r[1],o=r[2],s=Object(h.n)([n,i,o],e);if(Number.isFinite(o))return s;return[s[0],s[1],0]}(t,s)})),p=f(n);try{var d=function(){var t=e.value,n=t.clone().translate(new c.b(r.center).negate()),a=l.map((function(t){return n.transform(t)})),s=(new c.a).ortho({left:Math.min.apply(Math,i()(a.map((function(t){return t[0]})))),right:Math.max.apply(Math,i()(a.map((function(t){return t[0]})))),bottom:Math.min.apply(Math,i()(a.map((function(t){return t[1]})))),top:Math.max.apply(Math,i()(a.map((function(t){return t[1]})))),near:Math.min.apply(Math,i()(a.map((function(t){return-t[2]})))),far:Math.max.apply(Math,i()(a.map((function(t){return-t[2]}))))});o.push(s.multiplyRight(t))};for(p.s();!(e=p.n()).done;)d()}catch(t){p.e(t)}finally{p.f()}return o})),g=[0,0,0,1],m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function y(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={shadow_uDrawShadowMap:Boolean(t.drawToShadowMap),shadow_uUseShadowMap:!!t.shadowMaps&&t.shadowMaps.length>0,shadow_uColor:t.shadowColor||g,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},n=d({viewport:t.viewport,center:e.project_uCenter}),i=[],o=A({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice(),a=0;a<t.shadowMatrices.length;a++){var u=o[a],l=u.clone().translate(new c.b(t.viewport.center).negate());e.project_uCoordinateSystem===s.a.LNGLAT&&e.project_uProjectionMode===s.c.WEB_MERCATOR?(o[a]=l,i[a]=n):(o[a]=u.clone().multiplyRight(m),i[a]=l.transform(n))}for(var h=0;h<o.length;h++)r["shadow_uViewProjectionMatrices[".concat(h,"]")]=o[h],r["shadow_uProjectCenters[".concat(h,"]")]=i[h],t.shadowMaps&&t.shadowMaps.length>0?r["shadow_uShadowMap".concat(h)]=t.shadowMaps[h]:r["shadow_uShadowMap".concat(h)]=t.dummyShadowMap;return r}e.a={name:"shadow",dependencies:[u.a],vs:"\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n  if (shadow_uDrawShadowMap) {\n    return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n  }\n  if (shadow_uUseShadowMap) {\n    for (int i = 0; i < max_lights; i++) {\n      if(i < int(shadow_uLightCount)) {\n        vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n        shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n      }\n    }\n  }\n  return gl_Position;\n}\n",fs:"\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0,  0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n  vec4 rgbaDepth = texture2D(shadowMap, position.xy);\n\n  float z = dot(rgbaDepth, bitUnpackShift);\n  return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n  if (shadow_uDrawShadowMap) {\n    vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n    rgbaDepth -= rgbaDepth.gbaa * bitMask;\n    return rgbaDepth;\n  }\n  if (shadow_uUseShadowMap) {\n    float shadowAlpha = 0.0;\n    shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n    if(shadow_uLightCount > 1.0) {\n      shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n    }\n    shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n    float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n    return vec4(\n      mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n      blendedAlpha\n    );\n  }\n  return color;\n}\n",inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n    position = shadow_setVertexPosition(geometry.position);\n    ","fs:DECKGL_FILTER_COLOR":"\n    color = shadow_filterShadowColor(color);\n    "},getUniforms:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0){var r=t.shadowEnabled,n=void 0===r||r;return n&&t.shadowMatrices&&t.shadowMatrices.length>0?y(t,e):{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1}}return{}}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return p})),r.d(e,"b",(function(){return d}));var n=r(17),i=r(28),o=r(14),a=r(80),s=[0,0,0,0],u=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],l=[0,0,0],h=[0,0,0],f=Object(a.a)((function(t){var e=t.viewport,r=t.devicePixelRatio,a=t.coordinateSystem,c=t.coordinateOrigin,h=function(t,e,r){var o=t.viewMatrixUncentered,a=t.projectionMatrix,c=t.viewMatrix,l=t.viewProjectionMatrix,h=s,f=s,d=t.cameraPosition,A=p(t,e,r),g=A.geospatialOrigin,m=A.shaderCoordinateOrigin;A.offsetMode&&(f=t.projectPosition(g||m),d=[d[0]-f[0],d[1]-f[1],d[2]-f[2]],f[3]=1,h=i.n([],f,l),c=o||c,l=n.h([],a,c),l=n.h([],l,u));return{viewMatrix:c,viewProjectionMatrix:l,projectionCenter:h,originCommon:f,cameraPosCommon:d,shaderCoordinateOrigin:m,geospatialOrigin:g}}(e,a,c),f=h.projectionCenter,d=h.viewProjectionMatrix,A=h.originCommon,g=h.cameraPosCommon,m=h.shaderCoordinateOrigin,y=h.geospatialOrigin,v=e.getDistanceScales(),_=[e.width*r,e.height*r],b=e.projectionMatrix.transform([0,0,-e.focalDistance,1])[3]||1,x={project_uCoordinateSystem:a,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:m,project_uCommonOrigin:A.slice(0,3),project_uCenter:f,project_uPseudoMeters:Boolean(e._pseudoMeters),project_uViewportSize:_,project_uDevicePixelRatio:r,project_uFocalDistance:b,project_uCommonUnitsPerMeter:v.unitsPerMeter,project_uCommonUnitsPerWorldUnit:v.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:l,project_uScale:e.scale,project_uViewProjectionMatrix:d,project_uCameraPosition:g};if(y){var w=e.getDistanceScales(y);switch(a){case o.a.METER_OFFSETS:x.project_uCommonUnitsPerWorldUnit=w.unitsPerMeter,x.project_uCommonUnitsPerWorldUnit2=w.unitsPerMeter2;break;case o.a.LNGLAT:case o.a.LNGLAT_OFFSETS:e._pseudoMeters||(x.project_uCommonUnitsPerMeter=w.unitsPerMeter),x.project_uCommonUnitsPerWorldUnit=w.unitsPerDegree,x.project_uCommonUnitsPerWorldUnit2=w.unitsPerDegree2;break;case o.a.CARTESIAN:x.project_uCommonUnitsPerWorldUnit=[1,1,w.unitsPerMeter[2]],x.project_uCommonUnitsPerWorldUnit2=[0,0,w.unitsPerMeter2[2]]}}return x}));function p(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h,i=n,a=!0;switch(r=e===o.a.LNGLAT_OFFSETS||e===o.a.METER_OFFSETS?n:t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case o.c.WEB_MERCATOR:e!==o.a.LNGLAT&&e!==o.a.CARTESIAN||(r=[0,0,0],a=!1);break;case o.c.WEB_MERCATOR_AUTO_OFFSET:e===o.a.LNGLAT?i=r:e===o.a.CARTESIAN&&(i=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],r=t.unprojectPosition(i),i[0]-=n[0],i[1]-=n[1],i[2]-=n[2]);break;case o.c.IDENTITY:i=t.position.map(Math.fround);break;case o.c.GLOBE:a=!1,r=null;break;default:a=!1}return i[2]=i[2]||0,{geospatialOrigin:r,shaderCoordinateOrigin:i,offsetMode:a}}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.viewport,r=t.devicePixelRatio,n=void 0===r?1:r,i=t.modelMatrix,a=void 0===i?null:i,s=t.coordinateSystem,u=void 0===s?o.a.DEFAULT:s,l=t.coordinateOrigin,h=t.autoWrapLongitude,p=void 0!==h&&h;u===o.a.DEFAULT&&(u=e.isGeospatial?o.a.LNGLAT:o.a.CARTESIAN);var d=f({viewport:e,devicePixelRatio:n,coordinateSystem:u,coordinateOrigin:l});return d.project_uWrapLongitude=p,d.project_uModelMatrix=a||c,d}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=function(){function t(e){i()(this,t),this._viewportProps=this._applyConstraints(e)}return a()(t,[{key:"getViewportProps",value:function(){return this._viewportProps}},{key:"getState",value:function(){return this._state}},{key:"shortestPathFrom",value:function(t){return this._viewportProps}},{key:"_applyConstraints",value:function(t){return t}}]),t}()},function(t,e,r){"use strict";r.d(e,"b",(function(){return u})),r.d(e,"a",(function(){return c})),r.d(e,"c",(function(){return l}));var n=r(151),i=r(19),o=r(116),a=r(99);const s="Cannot convert supplied data type";function u(t,e,r){if(e.text&&"string"==typeof t)return t;if(Object(i.c)(t)&&(t=t.buffer),t instanceof ArrayBuffer){const r=t;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary){return new TextDecoder("utf8").decode(t)}let r=t.buffer;const n=t.byteLength||t.length;return 0===t.byteOffset&&n===r.byteLength||(r=r.slice(t.byteOffset,t.byteOffset+n)),r}throw new Error(s)}async function c(t,e,r){const c=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if("string"==typeof t||c)return u(t,e);if(Object(i.b)(t)&&(t=await Object(a.b)(t)),Object(i.j)(t)){const r=t;return await Object(a.a)(r),e.binary?await r.arrayBuffer():await r.text()}if(Object(i.i)(t)&&(t=Object(o.a)(t,r)),Object(i.d)(t)||Object(i.a)(t))return Object(n.a)(t);throw new Error(s)}async function l(t,e){if(Object(i.e)(t))return t;if(Object(i.j)(t)){const r=t;await Object(a.a)(r);const n=await r.body;return Object(o.a)(n,e)}return Object(i.b)(t)||Object(i.i)(t)?Object(o.a)(t,e):Object(i.a)(t)?t[Symbol.asyncIterator]():function(t){if(ArrayBuffer.isView(t))return function*(){yield t.buffer}();if(t instanceof ArrayBuffer)return function*(){yield t}();if(Object(i.e)(t))return t;if(Object(i.d)(t))return t[Symbol.iterator]();throw new Error(s)}(t)}},function(t,e,r){"use strict";const n=262144;var i=r(83),o=r(78);function a(t,e){return i.c?async function*(t,e){const r=t.getReader();let n;try{for(;;){const t=n||r.read();null!=e&&e._streamReadAhead&&(n=r.read());const{done:i,value:a}=await t;if(i)return;yield Object(o.d)(a)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield Object(o.d)(e)}(t)}var s=r(19);function u(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<t.length;){const e=Math.min(t.length-n,r),o=t.slice(n,n+e);n+=e,yield i.encode(o)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=n}=e;let i=0;for(;i<t.byteLength;){const e=Math.min(t.byteLength-i,r),n=new ArrayBuffer(e),o=new Uint8Array(t,i,e);new Uint8Array(n).set(o),i+=e,yield n}}(t,e);if(Object(s.b)(t))return async function*(t,e){const r=(null==e?void 0:e.chunkSize)||1048576;let n=0;for(;n<t.size;){const e=n+r,i=await t.slice(n,e).arrayBuffer();n=e,yield i}}(t,e);if(Object(s.i)(t))return a(t,e);if(Object(s.j)(t)){return a(t.body,e)}throw new Error("makeIterator")}r.d(e,"a",(function(){return u}))},function(t,e,r){"use strict";r.r(e),r.d(e,"MODULE_VERSION",(function(){return n})),r.d(e,"MODULE_NAME",(function(){return i}));var n="8.6.0",i="@deck.gl/jupyter-widget"},function(t,e,r){var n,i,o;
/**
 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
 * Released under the Apache License, Version 2.0
 * see: https://github.com/dcodeIO/long.js for details
 */i=[],void 0===(o="function"==typeof(n=function(){"use strict";function t(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function e(t){return!0===(t&&t.__isLong__)}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),t.isLong=e;var r={},n={};function i(t,e){var i,o,s;return e?(s=0<=(t>>>=0)&&t<256)&&(o=n[t])?o:(i=a(t,(0|t)<0?-1:0,!0),s&&(n[t]=i),i):(s=-128<=(t|=0)&&t<128)&&(o=r[t])?o:(i=a(t,t<0?-1:0,!1),s&&(r[t]=i),i)}function o(t,e){if(isNaN(t)||!isFinite(t))return e?A:d;if(e){if(t<0)return A;if(t>=h)return _}else{if(t<=-f)return b;if(t+1>=f)return v}return t<0?o(-t,e).neg():a(t%l|0,t/l|0,e)}function a(e,r,n){return new t(e,r,n)}t.fromInt=i,t.fromNumber=o,t.fromBits=a;var s=Math.pow;function u(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return d;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return u(t.substring(1),e,r).neg();for(var i=o(s(r,8)),a=d,c=0;c<t.length;c+=8){var l=Math.min(8,t.length-c),h=parseInt(t.substring(c,c+l),r);if(l<8){var f=o(s(r,l));a=a.mul(f).add(o(h))}else a=(a=a.mul(i)).add(o(h))}return a.unsigned=e,a}function c(e){return e instanceof t?e:"number"==typeof e?o(e):"string"==typeof e?u(e):a(e.low,e.high,e.unsigned)}t.fromString=u,t.fromValue=c;var l=4294967296,h=l*l,f=h/2,p=i(1<<24),d=i(0);t.ZERO=d;var A=i(0,!0);t.UZERO=A;var g=i(1);t.ONE=g;var m=i(1,!0);t.UONE=m;var y=i(-1);t.NEG_ONE=y;var v=a(-1,2147483647,!1);t.MAX_VALUE=v;var _=a(-1,-1,!0);t.MAX_UNSIGNED_VALUE=_;var b=a(0,-2147483648,!1);t.MIN_VALUE=b;var x=t.prototype;return x.toInt=function(){return this.unsigned?this.low>>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},x.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(b)){var e=o(t),r=this.div(e),n=r.mul(e).sub(this);return r.toString(t)+n.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=o(s(t,6),this.unsigned),a=this,u="";;){var c=a.div(i),l=(a.sub(c.mul(i)).toInt()>>>0).toString(t);if((a=c).isZero())return l+u;for(;l.length<6;)l="0"+l;u=""+l+u}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(b)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},x.isZero=function(){return 0===this.high&&0===this.low},x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||this.high>=0},x.isOdd=function(){return 1==(1&this.low)},x.isEven=function(){return 0==(1&this.low)},x.equals=function(t){return e(t)||(t=c(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},x.eq=x.equals,x.notEquals=function(t){return!this.eq(t)},x.neq=x.notEquals,x.lessThan=function(t){return this.comp(t)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(t){return this.comp(t)<=0},x.lte=x.lessThanOrEqual,x.greaterThan=function(t){return this.comp(t)>0},x.gt=x.greaterThan,x.greaterThanOrEqual=function(t){return this.comp(t)>=0},x.gte=x.greaterThanOrEqual,x.compare=function(t){if(e(t)||(t=c(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(b)?b:this.not().add(g)},x.neg=x.negate,x.add=function(t){e(t)||(t=c(t));var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,s=t.high>>>16,u=65535&t.high,l=t.low>>>16,h=0,f=0,p=0,d=0;return p+=(d+=o+(65535&t.low))>>>16,f+=(p+=i+l)>>>16,h+=(f+=n+u)>>>16,h+=r+s,a((p&=65535)<<16|(d&=65535),(h&=65535)<<16|(f&=65535),this.unsigned)},x.subtract=function(t){return e(t)||(t=c(t)),this.add(t.neg())},x.sub=x.subtract,x.multiply=function(t){if(this.isZero())return d;if(e(t)||(t=c(t)),t.isZero())return d;if(this.eq(b))return t.isOdd()?b:d;if(t.eq(b))return this.isOdd()?b:d;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(p)&&t.lt(p))return o(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,u=t.high>>>16,l=65535&t.high,h=t.low>>>16,f=65535&t.low,A=0,g=0,m=0,y=0;return m+=(y+=s*f)>>>16,g+=(m+=i*f)>>>16,m&=65535,g+=(m+=s*h)>>>16,A+=(g+=n*f)>>>16,g&=65535,A+=(g+=i*h)>>>16,g&=65535,A+=(g+=s*l)>>>16,A+=r*f+n*h+i*l+s*u,a((m&=65535)<<16|(y&=65535),(A&=65535)<<16|(g&=65535),this.unsigned)},x.mul=x.multiply,x.divide=function(t){if(e(t)||(t=c(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?A:d;var r,n,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return A;if(t.gt(this.shru(1)))return m;i=A}else{if(this.eq(b))return t.eq(g)||t.eq(y)?b:t.eq(b)?g:(r=this.shr(1).div(t).shl(1)).eq(d)?t.isNegative()?g:y:(n=this.sub(t.mul(r)),i=r.add(n.div(t)));if(t.eq(b))return this.unsigned?A:d;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=d}for(n=this;n.gte(t);){r=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),u=a<=48?1:s(2,a-48),l=o(r),h=l.mul(t);h.isNegative()||h.gt(n);)h=(l=o(r-=u,this.unsigned)).mul(t);l.isZero()&&(l=g),i=i.add(l),n=n.sub(h)}return i},x.div=x.divide,x.modulo=function(t){return e(t)||(t=c(t)),this.sub(this.div(t).mul(t))},x.mod=x.modulo,x.not=function(){return a(~this.low,~this.high,this.unsigned)},x.and=function(t){return e(t)||(t=c(t)),a(this.low&t.low,this.high&t.high,this.unsigned)},x.or=function(t){return e(t)||(t=c(t)),a(this.low|t.low,this.high|t.high,this.unsigned)},x.xor=function(t){return e(t)||(t=c(t)),a(this.low^t.low,this.high^t.high,this.unsigned)},x.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?a(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):a(0,this.low<<t-32,this.unsigned)},x.shl=x.shiftLeft,x.shiftRight=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?a(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):a(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),0==(t&=63))return this;var r=this.high;return t<32?a(this.low>>>t|r<<32-t,r>>>t,this.unsigned):a(32===t?r:r>>>t-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},x.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},x.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";r.d(e,"a",(function(){return f})),r.d(e,"b",(function(){return p}));var n=r(53),i=r(14);function o(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var s=Math.PI/180,u=new Float32Array(16),c=new Float32Array(12);function l(t,e,r){var n=e[0]*s,i=e[1]*s,o=e[2]*s,a=Math.sin(o),u=Math.sin(n),c=Math.sin(i),l=Math.cos(o),h=Math.cos(n),f=Math.cos(i),p=r[0],d=r[1],A=r[2];t[0]=p*f*h,t[1]=p*c*h,t[2]=p*-u,t[3]=d*(-c*l+f*u*a),t[4]=d*(f*l+c*u*a),t[5]=d*h*a,t[6]=A*(c*a+f*u*l),t[7]=A*(-f*a+c*u*l),t[8]=A*h*l}function h(t){return t[0]=t[0],t[1]=t[1],t[2]=t[2],t[3]=t[4],t[4]=t[5],t[5]=t[6],t[6]=t[8],t[7]=t[9],t[8]=t[10],t[9]=t[12],t[10]=t[13],t[11]=t[14],t.subarray(0,12)}var f={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrix__LOCATION_0:{size:3,elementOffset:0},instanceModelMatrix__LOCATION_1:{size:3,elementOffset:3},instanceModelMatrix__LOCATION_2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update:function(t,e){var r=e.startRow,i=e.endRow,a=this.props,s=a.data,f=a.getOrientation,p=a.getScale,d=a.getTranslation,A=a.getTransformMatrix,g=Array.isArray(A),m=g&&16===A.length,y=Array.isArray(p),v=Array.isArray(f),_=Array.isArray(d),b=m||!g&&Boolean(A(s[0]));t.constant=b?m:v&&y&&_;var x=t.value;if(t.constant){var w;if(b)u.set(A),w=h(u);else l(w=c,f,p),w.set(d,9);t.value=new Float32Array(w)}else{var E,S=r*t.size,O=Object(n.a)(s,r,i),T=O.iterable,P=O.objectInfo,M=o(T);try{for(M.s();!(E=M.n()).done;){var C=E.value;P.index++;var I=void 0;if(b)u.set(m?A:A(C,P)),I=h(u);else l(I=c,v?f:f(C,P),y?p:p(C,P)),I.set(_?d:d(C,P),9);x[S++]=I[0],x[S++]=I[1],x[S++]=I[2],x[S++]=I[3],x[S++]=I[4],x[S++]=I[5],x[S++]=I[6],x[S++]=I[7],x[S++]=I[8],x[S++]=I[9],x[S++]=I[10],x[S++]=I[11]}}catch(t){M.e(t)}finally{M.f()}}}};function p(t,e){return e===i.a.CARTESIAN||e===i.a.METER_OFFSETS||e===i.a.DEFAULT&&!t.isGeospatial}},function(t,e){
/* @license
Papa Parse
v5.0.0-beta.0
https://github.com/mholt/PapaParse
License: MIT
*/
var r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n={};function i(t){this._handle=null,this._finished=!1,this._completed=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(t){var e=c(t);e.chunkSize=parseInt(e.chunkSize),t.step||t.chunk||(e.chunkSize=null);this._handle=new a(e),this._handle.streamer=this,this._config=e}.call(this,t),this.parseChunk=function(t,e){if(this.isFirstChunk&&l(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(t);void 0!==r&&(t=r)}this.isFirstChunk=!1;var n=this._partialLine+t;this._partialLine="";var i=this._handle.parse(n,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var o=i.meta.cursor;this._finished||(this._partialLine=n.substring(o-this._baseIndex),this._baseIndex=o),i&&i.data&&(this._rowCount+=i.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(l(this._config.chunk)&&!e){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return;i=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!a||!l(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||i&&i.meta.paused||this._nextChunk(),i}},this._sendError=function(t){l(this._config.error)&&this._config.error(t)}}function o(t){var e;t=t||{},i.call(this,t),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t=this._config.chunkSize,r=t?e.substr(0,t):e;return e=t?e.substr(t):"",this._finished=!e,this.parseChunk(r)}}}function a(t){var e,r,i,o=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,a=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,h=this,f=0,p=0,d=!1,A=!1,g=[],m={data:[],errors:[],meta:{}};if(l(t.step)){var y=t.step;t.step=function(e){if(m=e,b())_();else{if(_(),!m.data||0===m.data.length)return;f+=e.data.length,t.preview&&f>t.preview?r.abort():y(m,h)}}}function v(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function _(){if(m&&i&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+n.DefaultDelimiter+"'"),i=!1),t.skipEmptyLines)for(var e=0;e<m.data.length;e++)v(m.data[e])&&m.data.splice(e--,1);return b()&&function(){if(!m)return;function e(e){l(t.transformHeader)&&(e=t.transformHeader(e)),g.push(e)}if(Array.isArray(m.data[0])){for(var r=0;b()&&r<m.data.length;r++)m.data[r].forEach(e);m.data.splice(0,1)}else m.data.forEach(e)}(),function(){if(!m||!m.data||!t.header&&!t.dynamicTyping&&!t.transform)return m;function e(e,r){var n,i=t.header?{}:[];for(n=0;n<e.length;n++){var o=n,a=e[n];t.header&&(o=n>=g.length?"__parsed_extra":g[n]),t.transform&&(a=t.transform(a,o)),a=x(o,a),"__parsed_extra"===o?(i[o]=i[o]||[],i[o].push(a)):i[o]=a}return t.header&&(n>g.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+n,p+r):n<g.length&&w("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+n,p+r)),i}var r=1;!m.data[0]||Array.isArray(m.data[0])?(m.data=m.data.map(e),r=m.data.length):m.data=e(m.data,0);t.header&&m.meta&&(m.meta.fields=g);return p+=r,m}()}function b(){return t.header&&0===g.length}function x(e,r){return function(e){return t.dynamicTypingFunction&&void 0===t.dynamicTyping[e]&&(t.dynamicTyping[e]=t.dynamicTypingFunction(e)),!0===(t.dynamicTyping[e]||t.dynamicTyping)}(e)?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&(o.test(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r}function w(t,e,r,n){m.errors.push({type:t,code:e,message:r,row:n})}this.parse=function(o,a,h){var f=t.quoteChar||'"';if(t.newline||(t.newline=function(t,e){t=t.substr(0,1048576);var r=new RegExp(s(e)+"([^]*?)"+s(e),"gm"),n=(t=t.replace(r,"")).split("\r"),i=t.split("\n"),o=i.length>1&&i[0].length<n[0].length;if(1===n.length||o)return"\n";for(var a=0,u=0;u<n.length;u++)"\n"===n[u][0]&&a++;return a>=n.length/2?"\r\n":"\r"}(o,f)),i=!1,t.delimiter)l(t.delimiter)&&(t.delimiter=t.delimiter(o),m.meta.delimiter=t.delimiter);else{var p=function(e,r,i,o,a){var s,c,l;a=a||[",","\t","|",";",n.RECORD_SEP,n.UNIT_SEP];for(var h=0;h<a.length;h++){var f=a[h],p=0,d=0,A=0;l=void 0;for(var g=new u({comments:o,delimiter:f,newline:r,preview:10}).parse(e),m=0;m<g.data.length;m++)if(i&&v(g.data[m]))A++;else{var y=g.data[m].length;d+=y,void 0!==l?y>1&&(p+=Math.abs(y-l),l=y):l=0}g.data.length>0&&(d/=g.data.length-A),(void 0===c||p>c)&&d>1.99&&(c=p,s=f)}return t.delimiter=s,{successful:!!s,bestDelimiter:s}}(o,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);p.successful?t.delimiter=p.bestDelimiter:(i=!0,t.delimiter=n.DefaultDelimiter),m.meta.delimiter=t.delimiter}var A=c(t);return t.preview&&t.header&&A.preview++,e=o,r=new u(A),m=r.parse(e,a,h),_(),d?{meta:{paused:!0}}:m||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,r.abort(),e=e.substr(r.getCharIndex())},this.resume=function(){d=!1,h.streamer.parseChunk(e,!0)},this.aborted=function(){return A},this.abort=function(){A=!0,r.abort(),m.meta.aborted=!0,l(t.complete)&&t.complete(m),e=""}}function s(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u(t){var e,r=(t=t||{}).delimiter,i=t.newline,o=t.comments,a=t.step,u=t.preview,c=t.fastMode,h=e=void 0===t.quoteChar?'"':t.quoteChar;if(void 0!==t.escapeChar&&(h=t.escapeChar),("string"!=typeof r||n.BAD_DELIMITERS.indexOf(r)>-1)&&(r=","),o===r)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||n.BAD_DELIMITERS.indexOf(o)>-1)&&(o=!1),"\n"!==i&&"\r"!==i&&"\r\n"!==i&&(i="\n");var f=0,p=!1;this.parse=function(t,n,d){if("string"!=typeof t)throw new Error("Input must be a string");var A=t.length,g=r.length,m=i.length,y=o.length,v=l(a);f=0;var _=[],b=[],x=[],w=0;if(!t)return D();if(c||!1!==c&&-1===t.indexOf(e)){for(var E=t.split(i),S=0;S<E.length;S++){if(x=E[S],f+=x.length,S!==E.length-1)f+=i.length;else if(d)return D();if(!o||x.substr(0,y)!==o){if(v){if(_=[],k(x.split(r)),B(),p)return D()}else k(x.split(r));if(u&&S>=u)return _=_.slice(0,u),D(!0)}}return D()}for(var O,T=t.indexOf(r,f),P=t.indexOf(i,f),M=new RegExp(s(h)+s(e),"g");;)if(t[f]!==e)if(o&&0===x.length&&t.substr(f,y)===o){if(-1===P)return D();f=P+m,P=t.indexOf(i,f),T=t.indexOf(r,f)}else if(-1!==T&&(T<P||-1===P))x.push(t.substring(f,T)),f=T+g,T=t.indexOf(r,f);else{if(-1===P)break;if(x.push(t.substring(f,P)),j(P+m),v&&(B(),p))return D();if(u&&_.length>=u)return D(!0)}else{for(O=f,f++;;){if(-1===(O=t.indexOf(e,O+1)))return d||b.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:_.length,index:f}),L();if(O===A-1)return L(t.substring(f,O).replace(M,e));if(e!==h||t[O+1]!==h){if(e===h||0===O||t[O-1]!==h){var C=R(-1===P?T:Math.min(T,P));if(t[O+1+C]===r){if(x.push(t.substring(f,O).replace(M,e)),f=O+1+C+g,T=t.indexOf(r,f),P=t.indexOf(i,f),v&&(B(),p))return D();if(u&&_.length>=u)return D(!0);break}var I=R(P);if(t.substr(O+1+I,m)===i){if(x.push(t.substring(f,O).replace(M,e)),j(O+1+I+m),T=t.indexOf(r,f),v&&(B(),p))return D();if(u&&_.length>=u)return D(!0);break}b.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:f}),O++}}else O++}if(v&&(B(),p))return D();if(u&&_.length>=u)return D(!0)}return L();function k(t){_.push(t),w=f}function R(e){var r=0;if(-1!==e){var n=t.substring(O+1,e);n&&""===n.trim()&&(r=n.length)}return r}function L(e){return d?D():(void 0===e&&(e=t.substr(f)),x.push(e),f=A,k(x),v&&B(),D())}function j(e){f=e,k(x),x=[],P=t.indexOf(i,f)}function D(t,e){return{data:e||!1?_[0]:_,errors:b,meta:{delimiter:r,linebreak:i,aborted:p,truncated:!!t,cursor:w+(n||0)}}}function B(){a(D(void 0,!0)),_=[],b=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return f}}function c(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var r in t)e[r]=c(t[r]);return e}function l(t){return"function"==typeof t}t.exports=n,n.parse=function(t,e,r){var i=(e=e||{}).dynamicTyping||!1;l(i)&&(e.dynamicTypingFunction=i,i={});if(e.dynamicTyping=i,e.transform=!!l(e.transform)&&e.transform,e.worker&&n.WORKERS_SUPPORTED){var a=newWorker();return a.userStep=e.step,a.userChunk=e.chunk,a.userComplete=e.complete,a.userError=e.error,e.step=l(e.step),e.chunk=l(e.chunk),e.complete=l(e.complete),e.error=l(e.error),delete e.worker,void a.postMessage({input:t,config:e,workerId:a.id})}var s=null;"string"==typeof t&&(s=new o(e));s||(s=new r(e));return s.stream(t)},n.unparse=function(t,e){var r=!1,i=!0,o=",",a="\r\n",u='"',c=u+u,l=!1,h=null;!function(){if("object"!=typeof e)return;"string"!=typeof e.delimiter||n.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(o=e.delimiter);("boolean"==typeof e.quotes||Array.isArray(e.quotes))&&(r=e.quotes);"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines);"string"==typeof e.newline&&(a=e.newline);"string"==typeof e.quoteChar&&(u=e.quoteChar);"boolean"==typeof e.header&&(i=e.header);if(Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");h=e.columns}void 0!==e.escapeChar&&(c=e.escapeChar+u)}();var f=new RegExp(s(u),"g");"string"==typeof t&&(t=JSON.parse(t));if(Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return d(null,t,l);if("object"==typeof t[0])return d(h||p(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:p(t.data[0])),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),d(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t){if("object"!=typeof t)return[];var e=[];for(var r in t)e.push(r);return e}function d(t,e,r){var n="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var s=Array.isArray(t)&&t.length>0,u=!Array.isArray(e[0]);if(s&&i){for(var c=0;c<t.length;c++)c>0&&(n+=o),n+=A(t[c],c);e.length>0&&(n+=a)}for(var l=0;l<e.length;l++){var h=s?t.length:e[l].length,f=!1,p=s?0===Object.keys(e[l]).length:0===e[l].length;if(r&&!s&&(f="greedy"===r?""===e[l].join("").trim():1===e[l].length&&0===e[l][0].length),"greedy"===r&&s){for(var d=[],g=0;g<h;g++){var m=u?t[g]:g;d.push(e[l][m])}f=""===d.join("").trim()}if(!f){for(var y=0;y<h;y++){y>0&&!p&&(n+=o);var v=s&&u?t[y]:y;n+=A(e[l][v],y)}l<e.length-1&&(!r||h>0&&!p)&&(n+=a)}}return n}function A(t,e){return null==t?"":t.constructor===Date?JSON.stringify(t).slice(1,25):(t=t.toString().replace(f,c),"boolean"==typeof r&&r||Array.isArray(r)&&r[e]||function(t,e){for(var r=0;r<e.length;r++)if(t.indexOf(e[r])>-1)return!0;return!1}(t,n.BAD_DELIMITERS)||t.indexOf(o)>-1||" "===t.charAt(0)||" "===t.charAt(t.length-1)?u+t+u:t)}},n.RECORD_SEP=String.fromCharCode(30),n.UNIT_SEP=String.fromCharCode(31),n.BYTE_ORDER_MARK="\ufeff",n.BAD_DELIMITERS=["\r","\n",'"',n.BYTE_ORDER_MARK],n.WORKERS_SUPPORTED=!1,n.NODE_STREAM_INPUT=1,n.LocalChunkSize=10485760,n.RemoteChunkSize=5242880,n.DefaultDelimiter=",",n.Parser=u,n.ParserHandle=a,n.ChunkStreamer=i,n.StringStreamer=o,o.prototype=Object.create(o.prototype),o.prototype.constructor=o},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return a})),r.d(e,"c",(function(){return s}));var n,i=r(174);t.browser&&(n=r(268));var o="https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.1/mapbox-gl.css";function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o;Object(i.b)(t)}function s(){for(var t=0,e=["mapboxgl-missing-css"];t<e.length;t++){var r=e[t],n=document.getElementsByClassName(r)[0];n&&n.style&&(n.style.display="none")}}e.a=n}).call(this,r(57))},function(t,e,r){"use strict";var n=r(36),i=r(31);const o=t=>Object(i.e)(t)?void 0:0,a={3074:t=>Object(i.e)(t)?void 0:36064,35723:t=>Object(i.e)(t)?void 0:4352,35977:o,32937:o,36795:(t,e)=>{const r=Object(i.e)(t)?t.getExtension("EXT_disjoint_timer_query_webgl2"):t.getExtension("EXT_disjoint_timer_query");return r&&r.GPU_DISJOINT_EXT?e(r.GPU_DISJOINT_EXT):0},37445:(t,e)=>{const r=t.getExtension("WEBGL_debug_renderer_info");return e(r&&r.UNMASKED_VENDOR_WEBGL||7936)},37446:(t,e)=>{const r=t.getExtension("WEBGL_debug_renderer_info");return e(r&&r.UNMASKED_RENDERER_WEBGL||7937)},34047:(t,e)=>{const r=t.luma.extensions.EXT_texture_filter_anisotropic;return r?e(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:o,35071:o,37447:o,36063:(t,e)=>{if(!Object(i.e)(t)){const r=t.getExtension("WEBGL_draw_buffers");return r?e(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:o,35374:o,35377:o,34852:t=>{if(!Object(i.e)(t)){const e=t.getExtension("WEBGL_draw_buffers");return e?e.MAX_DRAW_BUFFERS_WEBGL:0}},36203:t=>t.getExtension("OES_element_index")?2147483647:65535,33001:t=>t.getExtension("OES_element_index")?16777216:65535,33e3:t=>16777216,37157:o,35373:o,35657:o,36183:o,37137:o,34045:o,35978:o,35979:o,35968:o,35376:o,35375:o,35659:o,37154:o,35371:o,35658:o,35076:o,35077:o,35380:o};r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));const s={OES_vertex_array_object:{meta:{suffix:"OES"},createVertexArray:()=>{Object(n.a)(!1,"VertexArray requires WebGL2 or OES_vertex_array_object extension")},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},ANGLE_instanced_arrays:{meta:{suffix:"ANGLE"},vertexAttribDivisor(t,e){Object(n.a)(0===e,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},WEBGL_draw_buffers:{meta:{suffix:"WEBGL"},drawBuffers:()=>{Object(n.a)(!1)}},EXT_disjoint_timer_query:{meta:{suffix:"EXT"},createQuery:()=>{Object(n.a)(!1)},deleteQuery:()=>{Object(n.a)(!1)},beginQuery:()=>{Object(n.a)(!1)},endQuery:()=>{},getQuery(t,e){return this.getQueryObject(t,e)},getQueryParameter(t,e){return this.getQueryObject(t,e)},getQueryObject:()=>{}}},u={readBuffer:(t,e,r)=>{Object(i.e)(t)&&e(r)},getVertexAttrib:(t,e,r,n)=>{const{webgl2:o,ext:a}=function(t,e){return{webgl2:Object(i.e)(t),ext:t.getExtension(e)}}(t,"ANGLE_instanced_arrays");let s;switch(n){case 35069:s=!!o&&void 0;break;case 35070:s=o||a?void 0:0}return void 0!==s?s:e(r,n)},getProgramParameter:(t,e,r,n)=>{if(!Object(i.e)(t))switch(n){case 35967:return 35981;case 35971:case 35382:return 0}return e(r,n)},getInternalformatParameter:(t,e,r,n,o)=>{if(!Object(i.e)(t))switch(o){case 32937:return new Int32Array([0])}return t.getInternalformatParameter(r,n,o)},getTexParameter(t,e,r,n){switch(n){case 34046:const{extensions:e}=t.luma,r=e.EXT_texture_filter_anisotropic;n=r&&r.TEXTURE_MAX_ANISOTROPY_EXT||34046}return e(r,n)},getParameter:function(t,e,r){const n=a[r],i="function"==typeof n?n(t,e,r):n;return void 0!==i?i:e(r)},hint:(t,e,r,n)=>e(r,n)}},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},function(t,e,r){"use strict";async function*n(t,e={}){const r=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:r.decode(e,{stream:!0})}async function*i(t){const e=new TextEncoder;for await(const r of t)yield"string"==typeof r?e.encode(r):r}async function*o(t){let e="";for await(const r of t){let t;for(e+=r;(t=e.indexOf("\n"))>=0;){const r=e.slice(0,t+1);e=e.slice(t+1),yield r}}e.length>0&&(yield e)}async function*a(t){let e=1;for await(const r of t)yield{counter:e,line:r},e++}r.d(e,"c",(function(){return n})),r.d(e,"d",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return a}))},function(t,e,r){"use strict";function n(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return i(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return i(t,0,e)}return""}function i(t,e,r){if(t.byteLength<=e+r)return"";const n=new DataView(t);let i="";for(let t=0;t<r;t++)i+=String.fromCharCode(n.getUint8(e+t));return i}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";(function(t){function n(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if(void 0!==t&&t.hrtime){const r=t.hrtime();e=1e3*r[0]+r[1]/1e6}else e=Date.now();return e}r.d(e,"a",(function(){return n}))}).call(this,r(57))},function(t,e,r){"use strict";r.d(e,"a",(function(){return p})),r.d(e,"b",(function(){return A}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(73);function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var f=function(){},p={BREAK:1,SNAP_TO_END:2,IGNORE:3},d={transitionEasing:function(t){return t},transitionInterruption:p.BREAK,onTransitionStart:f,onTransitionInterrupt:f,onTransitionEnd:f},A=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a()(this,t),this.ControllerState=e,this.props=h(h({},d),r),this.propsInTransition=null,this.transition=new c.a(r.timeline),this.onViewStateChange=r.onViewStateChange||f,this.onStateChange=r.onStateChange||f,this._onTransitionUpdate=this._onTransitionUpdate.bind(this)}return u()(t,[{key:"finalize",value:function(){this.transition.cancel()}},{key:"getViewportInTransition",value:function(){return this.propsInTransition}},{key:"processViewStateChange",value:function(t){var e=!1,r=this.props;if(t=h(h({},d),t),this.props=t,this._shouldIgnoreViewportChange(r,t))return e;if(this._isTransitionEnabled(t)){var n=this.transition.settings,i=n.interruption,o=n.endProps,a=h(h({},r),i===p.SNAP_TO_END?o:this.propsInTransition||r);this._triggerTransition(a,t),e=!0}else this.transition.cancel();return e}},{key:"updateTransition",value:function(){this.transition.update()}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,r=t.transitionInterpolator;return(e>0||"auto"===e)&&Boolean(r)}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return!!this.transition.inProgress&&this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(t,e){return this.transition.inProgress?this.transition.settings.interruption===p.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e)}},{key:"_triggerTransition",value:function(t,e){var r=new this.ControllerState(t),n=new this.ControllerState(e).shortestPathFrom(r),i=e.transitionInterpolator,o=i.getDuration?i.getDuration(t,e):e.transitionDuration;if(0!==o){var a=e.transitionInterpolator.initializeProps(t,n);this.propsInTransition={},this.duration=o,this.transition.start({duration:o,easing:e.transitionEasing,interpolator:e.transitionInterpolator,interruption:e.transitionInterruption,startProps:a.start,endProps:a.end,onStart:e.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(e.onTransitionInterrupt),onEnd:this._onTransitionEnd(e.onTransitionEnd)}),this.onStateChange({inTransition:!0}),this.updateTransition()}}},{key:"_onTransitionEnd",value:function(t){var e=this;return function(r){e.propsInTransition=null,e.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t(r)}}},{key:"_onTransitionUpdate",value:function(t){var e=t.time,r=t.settings,n=r.interpolator,i=r.startProps,o=r.endProps,a=r.duration,s=(0,r.easing)(e/a),u=n.interpolateProps(i,o,s);this.propsInTransition=new this.ControllerState(h(h({},this.props),u)).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return O}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(107),y=r(11);function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function b(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var E=["longitude","latitude","zoom","bearing","pitch"],S=["longitude","latitude","zoom"],O=function(t){f()(r,t);var e=w(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a()(this,r);var i=Array.isArray(n)?n:n.transitionProps;return(t=e.call(this,i||{compare:E,extract:E,required:S})).opts=n,t}return u()(r,[{key:"initializeProps",value:function(t,e){var n=l()(g()(r.prototype),"initializeProps",this).call(this,t,e),i=this.opts,o=i.makeViewport,a=i.around;if(o&&a){var s=o(t),u=o(e),c=s.unproject(a);n.start.around=a,Object.assign(n.end,{around:u.project(c),aroundPosition:c,width:e.width,height:e.height})}return n}},{key:"interpolateProps",value:function(t,e,r){var n,i={},o=b(this._propsToExtract);try{for(o.s();!(n=o.n()).done;){var a=n.value;i[a]=Object(y.f)(t[a]||0,e[a]||0,r)}}catch(t){o.e(t)}finally{o.f()}if(e.aroundPosition){var s=this.opts.makeViewport(_(_({},e),i));Object.assign(i,s.panByPosition(e.aroundPosition,Object(y.f)(t.around,e.around,r)))}return i}}]),r}(m.a)},function(t,e,r){"use strict";r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return c}));var n=r(24),i=r.n(n),o=r(33).b.COMPONENT;function a(t){var e=p(t);for(var r in e){var n=e[r],i=n.validate;if(i&&!i(t[r],n))throw new Error("Invalid prop ".concat(r,": ").concat(t[r]))}}function s(t,e){var r=c({newProps:t,oldProps:e,propTypes:p(t),ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=function(t,e){if(null===e)return"oldProps is null, initial diff";var r=null,n=t.dataComparator,i=t._dataDiff;n?n(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied");r&&i&&(r=i(t.data,e.data)||r);return r}(t,e),i=!1;return n||(i=function(t,e){if(null===e)return"oldProps is null, initial diff";if("all"in t.updateTriggers){if(f(t,e,"all"))return{all:!0}}var r={},n=!1;for(var i in t.updateTriggers){if("all"!==i)f(t,e,i)&&(r[i]=!0,n=r)}return n}(t,e)),{dataChanged:n,propsChanged:r,updateTriggersChanged:i,extensionsChanged:h(t,e),transitionsChanged:u(t,e)}}function u(t,e){if(!t.transitions)return null;var r={},n=p(t);for(var i in t.transitions){var o=n[i],a=o&&o.type;("number"===a||"color"===a||"array"===a)&&l(t[i],e[i],o)&&(r[i]=!0)}return r}function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.newProps,r=t.oldProps,n=t.ignoreProps,o=void 0===n?{}:n,a=t.propTypes,s=void 0===a?{}:a,u=t.triggerName,c=void 0===u?"props":u;if(r===e)return null;if("object"!==i()(e)||null===e)return"".concat(c," changed shallowly");if("object"!==i()(r)||null===r)return"".concat(c," changed shallowly");for(var h=0,f=Object.keys(e);h<f.length;h++){var p=f[h];if(!(p in o)){if(!(p in r))return"".concat(c,".").concat(p," added");var d=l(e[p],r[p],s[p]);if(d)return"".concat(c,".").concat(p," ").concat(d)}}for(var A=0,g=Object.keys(r);A<g.length;A++){var m=g[A];if(!(m in o)){if(!(m in e))return"".concat(c,".").concat(m," dropped");if(!Object.hasOwnProperty.call(e,m)){var y=l(e[m],r[m],s[m]);if(y)return"".concat(c,".").concat(m," ").concat(y)}}}return null}function l(t,e,r){var n=r&&r.equal;return n&&!n(t,e,r)?"changed deeply":n||!(n=t&&e&&t.equals)||n.call(t,e)?n||e===t?null:"changed shallowly":"changed deeply"}function h(t,e){if(null===e)return"oldProps is null, initial diff";var r=e.extensions,n=t.extensions;if(n===r)return!1;if(n.length!==r.length)return!0;for(var i=0;i<n.length;i++)if(!n[i].equals(r[i]))return!0;return!1}function f(t,e,r){var n=t.updateTriggers[r];n=null==n?{}:n;var i=e.updateTriggers[r];return c({oldProps:i=null==i?{}:i,newProps:n,triggerName:r})}function p(t){var e=t[o],r=e&&e.constructor;return r?r._propTypes:{}}},function(t,e,r){"use strict";var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),c=r(6),l=r.n(c),h=r(1),f=r.n(h),p=r(195),d=r(98),A=r(148),g=r(93),m=r(86),y=r(11),v=r(0),_=r.n(v),b=r(8),x=r.n(b),w=r(85),E=r(100),S=r(71),O=r(7);function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){_()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}var C=function(t){u()(r,t);var e=M(r);function r(t,n){var o,a,s;return i()(this,r),(s=e.call(this,t,n)).shadowMap=new d.a(t,{width:1,height:1,parameters:(o={},_()(o,10241,9729),_()(o,10240,9729),_()(o,10242,33071),_()(o,10243,33071),o)}),s.depthBuffer=new E.a(t,{format:33189,width:1,height:1}),s.fbo=new S.a(t,{id:"shadowmap",width:1,height:1,attachments:(a={},_()(a,36064,s.shadowMap),_()(a,36096,s.depthBuffer),a)}),s}return a()(r,[{key:"render",value:function(t){var e=this,n=this.fbo;Object(O.o)(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},(function(){var i=t.viewports[0],o=Object(O.e)(e.gl),a=i.width*o,s=i.height*o;a===n.width&&s===n.height||n.resize({width:a,height:s}),x()(f()(r.prototype),"render",e).call(e,P(P({},t),{},{target:n,pass:"shadow"}))}))}},{key:"shouldDrawLayer",value:function(t){return!1!==t.props.shadowEnabled}},{key:"getModuleParameters",value:function(){return{drawToShadowMap:!0}}},{key:"delete",value:function(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}}]),r}(w.a),I=r(112);function k(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}r.d(e,"a",(function(){return F}));var j={color:[255,255,255],intensity:1},D=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],B=[0,0,0,200/255],F=function(t){u()(r,t);var e=L(r);function r(t){var n;for(var o in i()(this,r),(n=e.call(this,t)).ambientLight=null,n.directionalLights=[],n.pointLights=[],n.shadowColor=B,n.shadowPasses=[],n.shadowMaps=[],n.dummyShadowMap=null,n.shadow=!1,n.programManager=null,t){var a=t[o];switch(a.type){case"ambient":n.ambientLight=a;break;case"directional":n.directionalLights.push(a);break;case"point":n.pointLights.push(a)}}return n._applyDefaultLights(),n.shadow=n.directionalLights.some((function(t){return t.shadow})),n}return a()(r,[{key:"preRender",value:function(t,e){var r=e.layers,n=e.layerFilter,i=e.viewports,o=e.onViewportActive,a=e.views;if(this.shadow){this.shadowMatrices=this._createLightMatrix(),0===this.shadowPasses.length&&this._createShadowPasses(t),this.programManager||(this.programManager=p.a.getDefaultProgramManager(t),I.a&&this.programManager.addDefaultModule(I.a)),this.dummyShadowMap||(this.dummyShadowMap=new d.a(t,{width:1,height:1}));for(var s=0;s<this.shadowPasses.length;s++){this.shadowPasses[s].render({layers:r,layerFilter:n,viewports:i,onViewportActive:o,views:a,moduleParameters:{shadowLightId:s,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}}},{key:"getModuleParameters",value:function(t){var e=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return e.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map((function(e){return e.getProjectedLight({layer:t})})),pointLights:this.pointLights.map((function(e){return e.getProjectedLight({layer:t})}))},e}},{key:"cleanup",value:function(){var t,e=k(this.shadowPasses);try{for(e.s();!(t=e.n()).done;){t.value.delete()}}catch(t){e.e(t)}finally{e.f()}this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(I.a),this.programManager=null)}},{key:"_createLightMatrix",value:function(){var t,e=[],r=k(this.directionalLights);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=(new y.a).lookAt({eye:new y.b(n.direction).negate()});e.push(i)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"_createShadowPasses",value:function(t){for(var e=0;e<this.directionalLights.length;e++){var r=new C(t);this.shadowPasses[e]=r,this.shadowMaps[e]=r.shadowMap}}},{key:"_applyDefaultLights",value:function(){var t=this.ambientLight,e=this.pointLights,r=this.directionalLights;t||0!==e.length||0!==r.length||(this.ambientLight=new A.a(j),this.directionalLights.push(new g.a(D[0]),new g.a(D[1])))}}]),r}(m.a)},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){for(const e in t)return!1;return!0}function i(t,e){if(t===e)return!0;const r=Array.isArray(t)||ArrayBuffer.isView(t),n=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&n&&t.length===e.length){for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}return!1}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(7);function i(t,e,r){const{removedProps:i={},deprecatedProps:o={},replacedProps:a={}}=r;for(const r in i)if(r in e){const e=i[r]?`${t}.${i[r]}`:"N/A";n.k.removed(`${t}.${r}`,e)()}for(const r in o)if(r in e){const e=o[r];n.k.deprecated(`${t}.${r}`,`${t}.${e}`)()}let s=null;for(const r in a)if(r in e){const i=a[r];n.k.deprecated(`${t}.${r}`,`${t}.${i}`)(),s=s||Object.assign({},e),s[i]=e[r],delete s[r]}return s||e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return g})),r.d(e,"b",(function(){return m}));var n=r(0),i=r.n(n),o=r(10),a=r.n(o),s=r(14),u=r(113),c=r(105),l=r(28),h=r(21),f=r(22);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.projectPosition(t);if(r&&e instanceof c.a){var i=a()(t,3),o=i[0],s=i[1],u=i[2],l=void 0===u?0:u,h=e.getDistanceScales([o,s]);n[2]=l*h.unitsPerMeter[2]}return n}function A(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},t),r=t.coordinateSystem,n=t.viewport,o=t.coordinateOrigin,a=t.fromCoordinateSystem,u=t.fromCoordinateOrigin;return r===s.a.DEFAULT&&(r=n.isGeospatial?s.a.LNGLAT:s.a.CARTESIAN),void 0===a&&(e.fromCoordinateSystem=r),void 0===u&&(e.fromCoordinateOrigin=o),e.coordinateSystem=r,e}function g(t,e){var r=e.viewport,n=e.modelMatrix,i=e.coordinateSystem,o=e.coordinateOrigin,u=e.offsetMode,c=a()(t,3),h=c[0],p=c[1],A=c[2],g=void 0===A?0:A;if(n){var m=l.n([],[h,p,g,1],n),y=a()(m,3);h=y[0],p=y[1],g=y[2]}switch(i){case s.a.LNGLAT:return d([h,p,g],r,u);case s.a.LNGLAT_OFFSETS:return d([h+o[0],p+o[1],g+(o[2]||0)],r,u);case s.a.METER_OFFSETS:return d(Object(f.a)(o,[h,p,g]),r,u);case s.a.CARTESIAN:default:return r.isGeospatial?[h+o[0],p+o[1],g+o[2]]:r.projectPosition([h,p,g])}}function m(t,e){var r=A(e),n=r.viewport,i=r.coordinateSystem,o=r.coordinateOrigin,a=r.modelMatrix,s=r.fromCoordinateSystem,c=r.fromCoordinateOrigin,l=Object(u.a)(n,i,o),f=l.geospatialOrigin,p=l.shaderCoordinateOrigin,d=l.offsetMode,m=g(t,{viewport:n,modelMatrix:a,coordinateSystem:s,coordinateOrigin:c,offsetMode:d});if(d){var y=n.projectPosition(f||p);h.q(m,m,y)}return m}},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return a}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window,a="object"!=typeof n||"[object process]"!==String(n)||n.browser,s=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);s&&parseFloat(s[1])}).call(this,r(65),r(57))},function(t,e,r){"use strict";r.d(e,"b",(function(){return g})),r.d(e,"a",(function(){return m}));var n=r(10),i=r.n(n),o=r(237),a=r.n(o),s=r(38);function u(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var l=s.a.CLOCKWISE,h=s.a.COUNTER_CLOCKWISE,f={isClosed:!0};function p(t,e,r,n){for(var i=0;i<e;i++)if(t[r+i]!==t[n-e+i])return!1;return!0}function d(t,e,r,n,i){for(var o=e,a=r.length,u=0;u<a;u++)for(var c=0;c<n;c++)t[o++]=r[u][c]||0;if(!function(t){var e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}(r))for(var l=0;l<n;l++)t[o++]=r[0][l]||0;return f.start=e,f.end=o,f.size=n,Object(s.h)(t,i,f),o}function A(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,u=(o=o||r.length)-i;if(u<=0)return e;for(var c=e,l=0;l<u;l++)t[c++]=r[i+l];if(!p(r,n,i,o))for(var h=0;h<n;h++)t[c++]=r[i+h];return f.start=e,f.end=c,f.size=n,Object(s.h)(t,a,f),c}function g(t,e){!function(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}(t);var r=[],n=[];if(t.positions){var o=t,a=o.positions,s=o.holeIndices;if(s){for(var c=0,f=0;f<=s.length;f++)c=A(r,c,a,e,s[f-1],s[f],0===f?l:h),n.push(c);return n.pop(),{positions:r,holeIndices:n}}t=a}if(Number.isFinite(t[0]))return A(r,0,t,e,0,r.length,l),r;if(!function(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}(t)){var p,g=0,m=u(t.entries());try{for(m.s();!(p=m.n()).done;){var y=i()(p.value,2),v=y[0];g=d(r,g,y[1],e,0===v?l:h),n.push(g)}}catch(t){m.e(t)}finally{m.f()}return n.pop(),{positions:r,holeIndices:n}}return d(r,0,t,e,l),r}function m(t,e,r){var n=null;t.holeIndices&&(n=t.holeIndices.map((function(t){return t/e})));var i=t.positions||t;if(r){var o=i.length;i=i.slice();for(var s=[],u=0;u<o;u+=e){s[0]=i[u],s[1]=i[u+1];var c=r(s);i[u]=c[0],i[u+1]=c[1]}}return a()(i,n,e)}},function(t,e,r){"use strict";var n=r(126);class i{constructor(t,e){this.name=t,this.type=e,this.sampleSize=1,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Object(n.a)(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Object(n.a)()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class o{constructor({id:t,stats:e}){this.id=t,this.stats={},this._initializeStats(e),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[e])}getTable(){const t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(t=>this._getOrCreate(t))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:r}=t;return this.stats[e]||(this.stats[e]=t instanceof i?t:new i(e,r)),this.stats[e]}}r.d(e,"a",(function(){return o}))},function(t,e,r){"use strict";var n="#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n  vec3 color;\n  vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n  return pointLight.attenuation.x\n       + pointLight.attenuation.y * distance\n       + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n";r.d(e,"a",(function(){return a}));const i={lightSources:{}};function o({color:t=[0,0,0],intensity:e=1}={}){return t.map(t=>t*e/255)}const a={name:"lights",vs:n,fs:n,getUniforms:function t(e=i){if("lightSources"in e){const{ambientLight:t,pointLights:r,directionalLights:n}=e.lightSources||{};return t||r&&r.length>0||n&&n.length>0?Object.assign({},function({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){const n={};return n["lighting_uAmbientLight.color"]=t?o(t):[0,0,0],e.forEach((t,e)=>{n[`lighting_uPointLight[${e}].color`]=o(t),n[`lighting_uPointLight[${e}].position`]=t.position,n[`lighting_uPointLight[${e}].attenuation`]=t.attenuation||[1,0,0]}),n.lighting_uPointLightCount=e.length,r.forEach((t,e)=>{n[`lighting_uDirectionalLight[${e}].color`]=o(t),n[`lighting_uDirectionalLight[${e}].direction`]=t.direction}),n.lighting_uDirectionalLightCount=r.length,n}({ambientLight:t,pointLights:r,directionalLights:n}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){const r={pointLights:[],directionalLights:[]};for(const t of e.lights||[])switch(t.type){case"ambient":r.ambientLight=t;break;case"directional":r.directionalLights.push(t);break;case"point":r.pointLights.push(t)}return t({lightSources:r})}return{}},defines:{MAX_LIGHTS:3}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(7),i=r(137),o=r(26);const a=new class{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new i.a({id:t})),this.stats.get(t)}};if(o.global.luma&&"8.5.10"!==o.global.luma.VERSION)throw new Error(`luma.gl - multiple VERSIONs detected: ${o.global.luma.VERSION} vs 8.5.10`);o.global.luma||(Object(o.isBrowser)()&&n.k.log(1,"luma.gl 8.5.10 - set luma.log.level=1 (or higher) to trace rendering")(),o.global.luma=o.global.luma||{VERSION:"8.5.10",version:"8.5.10",log:n.k,stats:a,globals:{modules:{},nodeIO:{}}});o.global.luma},function(t,e,r){var n;
/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */!function(i,o,a,s){"use strict";var u,c=["","webkit","Moz","MS","ms","o"],l=o.createElement("div"),h=Math.round,f=Math.abs,p=Date.now;function d(t,e,r){return setTimeout(b(t,r),e)}function A(t,e,r){return!!Array.isArray(t)&&(g(t,r[e],r),!0)}function g(t,e,r){var n;if(t)if(t.forEach)t.forEach(e,r);else if(void 0!==t.length)for(n=0;n<t.length;)e.call(r,t[n],n,t),n++;else for(n in t)t.hasOwnProperty(n)&&e.call(r,t[n],n,t)}function m(t,e,r){var n="DEPRECATED METHOD: "+e+"\n"+r+" AT \n";return function(){var e=new Error("get-stack-trace"),r=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,n,r),t.apply(this,arguments)}}u="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}return e}:Object.assign;var y=m((function(t,e,r){for(var n=Object.keys(e),i=0;i<n.length;)(!r||r&&void 0===t[n[i]])&&(t[n[i]]=e[n[i]]),i++;return t}),"extend","Use `assign`."),v=m((function(t,e){return y(t,e,!0)}),"merge","Use `assign`.");function _(t,e,r){var n,i=e.prototype;(n=t.prototype=Object.create(i)).constructor=t,n._super=i,r&&u(n,r)}function b(t,e){return function(){return t.apply(e,arguments)}}function x(t,e){return"function"==typeof t?t.apply(e&&e[0]||void 0,e):t}function w(t,e){return void 0===t?e:t}function E(t,e,r){g(P(e),(function(e){t.addEventListener(e,r,!1)}))}function S(t,e,r){g(P(e),(function(e){t.removeEventListener(e,r,!1)}))}function O(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function T(t,e){return t.indexOf(e)>-1}function P(t){return t.trim().split(/\s+/g)}function M(t,e,r){if(t.indexOf&&!r)return t.indexOf(e);for(var n=0;n<t.length;){if(r&&t[n][r]==e||!r&&t[n]===e)return n;n++}return-1}function C(t){return Array.prototype.slice.call(t,0)}function I(t,e,r){for(var n=[],i=[],o=0;o<t.length;){var a=e?t[o][e]:t[o];M(i,a)<0&&n.push(t[o]),i[o]=a,o++}return r&&(n=e?n.sort((function(t,r){return t[e]>r[e]})):n.sort()),n}function k(t,e){for(var r,n,i=e[0].toUpperCase()+e.slice(1),o=0;o<c.length;){if((n=(r=c[o])?r+i:e)in t)return n;o++}}var R=1;function L(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||i}var j="ontouchstart"in i,D=void 0!==k(i,"PointerEvent"),B=j&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),F=["x","y"],z=["clientX","clientY"];function N(t,e){var r=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){x(t.options.enable,[t])&&r.handler(e)},this.init()}function U(t,e,r){var n=r.pointers.length,i=r.changedPointers.length,o=1&e&&n-i==0,a=12&e&&n-i==0;r.isFirst=!!o,r.isFinal=!!a,o&&(t.session={}),r.eventType=e,function(t,e){var r=t.session,n=e.pointers,i=n.length;r.firstInput||(r.firstInput=V(e));i>1&&!r.firstMultiple?r.firstMultiple=V(e):1===i&&(r.firstMultiple=!1);var o=r.firstInput,a=r.firstMultiple,s=a?a.center:o.center,u=e.center=G(n);e.timeStamp=p(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=Z(s,u),e.distance=q(s,u),function(t,e){var r=e.center,n=t.offsetDelta||{},i=t.prevDelta||{},o=t.prevInput||{};1!==e.eventType&&4!==o.eventType||(i=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=t.offsetDelta={x:r.x,y:r.y});e.deltaX=i.x+(r.x-n.x),e.deltaY=i.y+(r.y-n.y)}(r,e),e.offsetDirection=H(e.deltaX,e.deltaY);var c=W(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=f(c.x)>f(c.y)?c.x:c.y,e.scale=a?(l=a.pointers,h=n,q(h[0],h[1],z)/q(l[0],l[1],z)):1,e.rotation=a?function(t,e){return Z(e[1],e[0],z)+Z(t[1],t[0],z)}(a.pointers,n):0,e.maxPointers=r.prevInput?e.pointers.length>r.prevInput.maxPointers?e.pointers.length:r.prevInput.maxPointers:e.pointers.length,function(t,e){var r,n,i,o,a=t.lastInterval||e,s=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(s>25||void 0===a.velocity)){var u=e.deltaX-a.deltaX,c=e.deltaY-a.deltaY,l=W(s,u,c);n=l.x,i=l.y,r=f(l.x)>f(l.y)?l.x:l.y,o=H(u,c),t.lastInterval=e}else r=a.velocity,n=a.velocityX,i=a.velocityY,o=a.direction;e.velocity=r,e.velocityX=n,e.velocityY=i,e.direction=o}(r,e);var l,h;var d=t.element;O(e.srcEvent.target,d)&&(d=e.srcEvent.target);e.target=d}(t,r),t.emit("hammer.input",r),t.recognize(r),t.session.prevInput=r}function V(t){for(var e=[],r=0;r<t.pointers.length;)e[r]={clientX:h(t.pointers[r].clientX),clientY:h(t.pointers[r].clientY)},r++;return{timeStamp:p(),pointers:e,center:G(e),deltaX:t.deltaX,deltaY:t.deltaY}}function G(t){var e=t.length;if(1===e)return{x:h(t[0].clientX),y:h(t[0].clientY)};for(var r=0,n=0,i=0;i<e;)r+=t[i].clientX,n+=t[i].clientY,i++;return{x:h(r/e),y:h(n/e)}}function W(t,e,r){return{x:e/t||0,y:r/t||0}}function H(t,e){return t===e?1:f(t)>=f(e)?t<0?2:4:e<0?8:16}function q(t,e,r){r||(r=F);var n=e[r[0]]-t[r[0]],i=e[r[1]]-t[r[1]];return Math.sqrt(n*n+i*i)}function Z(t,e,r){r||(r=F);var n=e[r[0]]-t[r[0]],i=e[r[1]]-t[r[1]];return 180*Math.atan2(i,n)/Math.PI}N.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(L(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(L(this.element),this.evWin,this.domHandler)}};var X={mousedown:1,mousemove:2,mouseup:4};function Q(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,N.apply(this,arguments)}_(Q,N,{handler:function(t){var e=X[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}});var Y={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},K={2:"touch",3:"pen",4:"mouse",5:"kinect"},$="pointerdown",J="pointermove pointerup pointercancel";function tt(){this.evEl=$,this.evWin=J,N.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&($="MSPointerDown",J="MSPointerMove MSPointerUp MSPointerCancel"),_(tt,N,{handler:function(t){var e=this.store,r=!1,n=t.type.toLowerCase().replace("ms",""),i=Y[n],o=K[t.pointerType]||t.pointerType,a="touch"==o,s=M(e,t.pointerId,"pointerId");1&i&&(0===t.button||a)?s<0&&(e.push(t),s=e.length-1):12&i&&(r=!0),s<0||(e[s]=t,this.callback(this.manager,i,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),r&&e.splice(s,1))}});var et={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function rt(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,N.apply(this,arguments)}function nt(t,e){var r=C(t.touches),n=C(t.changedTouches);return 12&e&&(r=I(r.concat(n),"identifier",!0)),[r,n]}_(rt,N,{handler:function(t){var e=et[t.type];if(1===e&&(this.started=!0),this.started){var r=nt.call(this,t,e);12&e&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:r[0],changedPointers:r[1],pointerType:"touch",srcEvent:t})}}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ot(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},N.apply(this,arguments)}function at(t,e){var r=C(t.touches),n=this.targetIds;if(3&e&&1===r.length)return n[r[0].identifier]=!0,[r,r];var i,o,a=C(t.changedTouches),s=[],u=this.target;if(o=r.filter((function(t){return O(t.target,u)})),1===e)for(i=0;i<o.length;)n[o[i].identifier]=!0,i++;for(i=0;i<a.length;)n[a[i].identifier]&&s.push(a[i]),12&e&&delete n[a[i].identifier],i++;return s.length?[I(o.concat(s),"identifier",!0),s]:void 0}_(ot,N,{handler:function(t){var e=it[t.type],r=at.call(this,t,e);r&&this.callback(this.manager,e,{pointers:r[0],changedPointers:r[1],pointerType:"touch",srcEvent:t})}});function st(){N.apply(this,arguments);var t=b(this.handler,this);this.touch=new ot(this.manager,t),this.mouse=new Q(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ut(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,ct.call(this,e)):12&t&&ct.call(this,e)}function ct(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var r={x:e.clientX,y:e.clientY};this.lastTouches.push(r);var n=this.lastTouches;setTimeout((function(){var t=n.indexOf(r);t>-1&&n.splice(t,1)}),2500)}}function lt(t){for(var e=t.srcEvent.clientX,r=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var i=this.lastTouches[n],o=Math.abs(e-i.x),a=Math.abs(r-i.y);if(o<=25&&a<=25)return!0}return!1}_(st,N,{handler:function(t,e,r){var n="touch"==r.pointerType,i="mouse"==r.pointerType;if(!(i&&r.sourceCapabilities&&r.sourceCapabilities.firesTouchEvents)){if(n)ut.call(this,e,r);else if(i&&lt.call(this,r))return;this.callback(t,e,r)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ht=k(l.style,"touchAction"),ft=void 0!==ht,pt=function(){if(!ft)return!1;var t={},e=i.CSS&&i.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(r){t[r]=!e||i.CSS.supports("touch-action",r)})),t}();function dt(t,e){this.manager=t,this.set(e)}dt.prototype={set:function(t){"compute"==t&&(t=this.compute()),ft&&this.manager.element.style&&pt[t]&&(this.manager.element.style[ht]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return g(this.manager.recognizers,(function(e){x(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(T(t,"none"))return"none";var e=T(t,"pan-x"),r=T(t,"pan-y");if(e&&r)return"none";if(e||r)return e?"pan-x":"pan-y";if(T(t,"manipulation"))return"manipulation";return"auto"}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,r=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,i=T(n,"none")&&!pt.none,o=T(n,"pan-y")&&!pt["pan-y"],a=T(n,"pan-x")&&!pt["pan-x"];if(i){var s=1===t.pointers.length,u=t.distance<2,c=t.deltaTime<250;if(s&&u&&c)return}if(!a||!o)return i||o&&6&r||a&&24&r?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};function At(t){this.options=u({},this.defaults,t||{}),this.id=R++,this.manager=null,this.options.enable=w(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function gt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function mt(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function yt(t,e){var r=e.manager;return r?r.get(t):t}function vt(){At.apply(this,arguments)}function _t(){vt.apply(this,arguments),this.pX=null,this.pY=null}function bt(){vt.apply(this,arguments)}function xt(){At.apply(this,arguments),this._timer=null,this._input=null}function wt(){vt.apply(this,arguments)}function Et(){vt.apply(this,arguments)}function St(){At.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ot(t,e){return(e=e||{}).recognizers=w(e.recognizers,Ot.defaults.preset),new Tt(t,e)}At.prototype={defaults:{},set:function(t){return u(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(A(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=yt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return A(t,"dropRecognizeWith",this)?this:(t=yt(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(A(t,"requireFailure",this))return this;var e=this.requireFail;return-1===M(e,t=yt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(A(t,"dropRequireFailure",this))return this;t=yt(t,this);var e=M(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,r=this.state;function n(r){e.manager.emit(r,t)}r<8&&n(e.options.event+gt(r)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),r>=8&&n(e.options.event+gt(r))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=u({},t);if(!x(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},_(vt,At,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,r=t.eventType,n=6&e,i=this.attrTest(t);return n&&(8&r||!i)?16|e:n||i?4&r?8|e:2&e?4|e:2:32}}),_(_t,vt,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push("pan-y"),24&t&&e.push("pan-x"),e},directionTest:function(t){var e=this.options,r=!0,n=t.distance,i=t.direction,o=t.deltaX,a=t.deltaY;return i&e.direction||(6&e.direction?(i=0===o?1:o<0?2:4,r=o!=this.pX,n=Math.abs(t.deltaX)):(i=0===a?1:a<0?8:16,r=a!=this.pY,n=Math.abs(t.deltaY))),t.direction=i,r&&n>e.threshold&&i&e.direction},attrTest:function(t){return vt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=mt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(bt,vt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return["none"]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(xt,At,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,n=t.distance<e.threshold,i=t.deltaTime>e.time;if(this._input=t,!n||!r||12&t.eventType&&!i)this.reset();else if(1&t.eventType)this.reset(),this._timer=d((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}}),_(wt,vt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return["none"]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Et,vt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return _t.prototype.getTouchAction.call(this)},attrTest:function(t){var e,r=this.options.direction;return 30&r?e=t.overallVelocity:6&r?e=t.overallVelocityX:24&r&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&r&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&f(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=mt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(St,At,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return["manipulation"]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,n=t.distance<e.threshold,i=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(n&&i&&r){if(4!=t.eventType)return this.failTimeout();var o=!this.pTime||t.timeStamp-this.pTime<e.interval,a=!this.pCenter||q(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&o?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=d((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return 32},failTimeout:function(){return this._timer=d((function(){this.state=32}),this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ot.VERSION="2.0.7",Ot.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[wt,{enable:!1}],[bt,{enable:!1},["rotate"]],[Et,{direction:6}],[_t,{direction:6},["swipe"]],[St],[St,{event:"doubletap",taps:2},["tap"]],[xt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Tt(t,e){var r;this.options=u({},Ot.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((r=this).options.inputClass||(D?tt:B?ot:j?st:Q))(r,U),this.touchAction=new dt(this,this.options.touchAction),Pt(this,!0),g(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Pt(t,e){var r,n=t.element;n.style&&(g(t.options.cssProps,(function(i,o){r=k(n.style,o),e?(t.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=t.oldCssProps[r]||""})),e||(t.oldCssProps={}))}Tt.prototype={set:function(t){return u(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var r;this.touchAction.preventDefaults(t);var n=this.recognizers,i=e.curRecognizer;(!i||i&&8&i.state)&&(i=e.curRecognizer=null);for(var o=0;o<n.length;)r=n[o],2===e.stopped||i&&r!=i&&!r.canRecognizeWith(i)?r.reset():r.recognize(t),!i&&14&r.state&&(i=e.curRecognizer=r),o++}},get:function(t){if(t instanceof At)return t;for(var e=this.recognizers,r=0;r<e.length;r++)if(e[r].options.event==t)return e[r];return null},add:function(t){if(A(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(A(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,r=M(e,t);-1!==r&&(e.splice(r,1),this.touchAction.update())}return this},on:function(t,e){if(void 0!==t&&void 0!==e){var r=this.handlers;return g(P(t),(function(t){r[t]=r[t]||[],r[t].push(e)})),this}},off:function(t,e){if(void 0!==t){var r=this.handlers;return g(P(t),(function(t){e?r[t]&&r[t].splice(M(r[t],e),1):delete r[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var r=o.createEvent("Event");r.initEvent(t,!0,!0),r.gesture=e,e.target.dispatchEvent(r)}(t,e);var r=this.handlers[t]&&this.handlers[t].slice();if(r&&r.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var n=0;n<r.length;)r[n](e),n++}},destroy:function(){this.element&&Pt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},u(Ot,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:24,DIRECTION_ALL:30,Manager:Tt,Input:N,TouchAction:dt,TouchInput:ot,MouseInput:Q,PointerEventInput:tt,TouchMouseInput:st,SingleTouchInput:rt,Recognizer:At,AttrRecognizer:vt,Tap:St,Pan:_t,Swipe:Et,Pinch:bt,Rotate:wt,Press:xt,on:E,off:S,each:g,merge:v,extend:y,assign:u,inherit:_,bindFn:b,prefixed:k}),(void 0!==i?i:"undefined"!=typeof self?self:{}).Hammer=Ot,void 0===(n=function(){return Ot}.call(e,r,e,t))||(t.exports=n)}(window,document)},function(t,e){},,function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(13),i=r(147),o=r(21);class a{constructor({phi:t=0,theta:e=0,radius:r=1,bearing:n,pitch:i,altitude:o,radiusScale:a=6371e3}={}){this.phi=t,this.theta=e,this.radius=r||o||1,this.radiusScale=a||1,void 0!==n&&(this.bearing=n),void 0!==i&&(this.pitch=i),this.check()}toString(){return this.formatString(n.b)}formatString({printTypes:t=!1}){const e=n.e;return`${t?"Spherical":""}[rho:${e(this.radius)},theta:${e(this.theta)},phi:${e(this.phi)}]`}equals(t){return Object(n.d)(this.radius,t.radius)&&Object(n.d)(this.theta,t.theta)&&Object(n.d)(this.phi,t.phi)}exactEquals(t){return this.radius===t.radius&&this.theta===t.theta&&this.phi===t.phi}get bearing(){return 180-Object(n.c)(this.phi)}set bearing(t){this.phi=Math.PI-Object(n.h)(t)}get pitch(){return Object(n.c)(this.theta)}set pitch(t){this.theta=Object(n.h)(t)}get longitude(){return Object(n.c)(this.phi)}get latitude(){return Object(n.c)(this.theta)}get lng(){return Object(n.c)(this.phi)}get lat(){return Object(n.c)(this.theta)}get z(){return(this.radius-1)*this.radiusScale}set(t,e,r){return this.radius=t,this.phi=e,this.theta=r,this.check()}clone(){return(new a).copy(this)}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this.check()}fromLngLatZ([t,e,r]){this.radius=1+r/this.radiusScale,this.phi=Object(n.h)(e),this.theta=Object(n.h)(t)}fromVector3(t){return this.radius=o.h(t),this.radius>0&&(this.theta=Math.atan2(t[0],t[1]),this.phi=Math.acos(Object(n.a)(t[2]/this.radius,-1,1))),this.check()}toVector3(){return new i.a(0,0,this.radius).rotateX({radians:this.theta}).rotateZ({radians:this.phi})}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}check(){if(!(Number.isFinite(this.phi)&&Number.isFinite(this.theta)&&this.radius>0))throw new Error("SphericalCoordinates: some fields set to invalid numbers");return this}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(89);function i(t){return n.toBuffer?n.toBuffer(t):t}},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o}));var n=r(97);function i(t,e){return Object(n.a)(t>=0),Object(n.a)(e>0),t+(e-1)&~(e-1)}function o(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{const e=t.byteOffset,r=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,e,r)}return e.set(n,r),r+i(n.byteLength,4)}},function(t,e,r){"use strict";r.r(e);var n=r(225);r.d(e,"SimpleMeshLayer",(function(){return n.a}));var i=r(220);r.d(e,"ScenegraphLayer",(function(){return i.a}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var n=r(168),i=r(13),o=r(23),a=r(21),s=r(74);const u=[0,0,0],c={};class l extends n.a{static get ZERO(){return c.ZERO=c.ZERO||Object.freeze(new l(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Object(i.f)(t)?this.copy(t):(i.b.debug&&(Object(o.a)(t),Object(o.a)(e),Object(o.a)(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return i.b.debug&&(Object(o.a)(t.x),Object(o.a)(t.y),Object(o.a)(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Object(o.a)(t)}angle(t){return a.b(this,t)}cross(t){return a.d(this,this,t),this.check()}rotateX({radians:t,origin:e=u}){return a.m(this,this,e,t),this.check()}rotateY({radians:t,origin:e=u}){return a.n(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=u}){return a.o(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return a.s(this,this,t),this.check()}transformAsVector(t){return Object(s.c)(this,this,t),this.check()}transformByMatrix3(t){return a.r(this,this,t),this.check()}transformByMatrix2(t){return Object(s.b)(this,this,t),this.check()}transformByQuaternion(t){return a.t(this,this,t),this.check()}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(2),i=r.n(n),o=[255,255,255],a=0,s=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t);var r=e.color,n=void 0===r?o:r,s=e.intensity,u=void 0===s?1:s;this.id=e.id||"ambient-".concat(a++),this.color=n,this.intensity=u,this.type="ambient"}},function(t,e,r){"use strict";r.d(e,"a",(function(){return b}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),p=r(1),d=r.n(p),A=r(61),g=r(105),m=r(106);function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function v(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var b=function(t){l()(r,t);var e=_(r);function r(t){return a()(this,r),e.call(this,v(v({},t),{},{type:g.a}))}return u()(r,[{key:"controller",get:function(){return this._getControllerProps({type:m.b})}}]),r}(A.a);b.displayName="MapView"},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));const n="3.0.8"},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o}));var n=r(78);async function i(t,e){for(;;){const{done:r,value:n}=await t.next();if(r)return void t.return();if(e(n))return}}async function o(t){const e=[];for await(const r of t)e.push(r);return Object(n.b)(...e)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(195);function i(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var a=[r(95).a],s=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function u(t){var e,r=n.a.getDefaultProgramManager(t),o=i(a);try{for(o.s();!(e=o.n()).done;){var u=e.value;r.addDefaultModule(u)}}catch(t){o.e(t)}finally{o.f()}var c,l=i(s);try{for(l.s();!(c=l.n()).done;){var h=c.value;r.addShaderHook(h)}}catch(t){l.e(t)}finally{l.f()}return r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(0),i=r.n(n);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e){if(!e)return t;var r=a(a({},t),e);if("defines"in e&&(r.defines=a(a({},t.defines),e.defines)),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some((function(t){return"project64"===t.name})))){var n=r.modules.findIndex((function(t){return"project32"===t.name}));n>=0&&r.modules.splice(n,1)}if("inject"in e)if(t.inject){var i=a({},t.inject);for(var o in e.inject)i[o]=(i[o]||"")+e.inject[o];r.inject=i}else r.inject=e.inject;return r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(24),i=r.n(n);function o(t){if(null===(e=t)||"object"!==i()(e))throw new Error("count(): argument not an object");var e;if("function"==typeof t.count)return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(function(t){return null!==t&&"object"===i()(t)&&t.constructor===Object}(t))return Object.keys(t).length;throw new Error("count(): argument not a container")}},function(t,e,r){"use strict";var n=r(10),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),p=r(1),d=r.n(p),A=r(0),g=r.n(A),m=r(14),y=r(156),v=r(46),_=r(11),b=r(73);function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var w=function(t){l()(r,t);var e=x(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"_onUpdate",value:function(){var t=this.time,e=this.settings,r=e.fromValue,n=e.toValue,i=e.duration,o=(0,e.easing)(t/i);this._value=Object(_.f)(r,n,o)}},{key:"value",get:function(){return this._value}}]),r}(b.a);function E(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function S(t,e,r,n,i){var o=e-t;return(r-e)*i+-o*n+o+e}function O(t,e){if(Array.isArray(t)){for(var r=0,n=0;n<t.length;n++){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}return Math.abs(t-e)}var T=function(t){l()(r,t);var e=E(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"_onUpdate",value:function(){var t=this.settings,e=t.fromValue,r=t.toValue,n=t.damping,i=t.stiffness,o=this._prevValue,a=void 0===o?e:o,s=this._currValue,u=void 0===s?e:s,c=function(t,e,r,n,i){if(Array.isArray(r)){for(var o=[],a=0;a<r.length;a++)o[a]=S(t[a],e[a],r[a],n,i);return o}return S(t,e,r,n,i)}(a,u,r,n,i),l=O(c,r),h=O(c,u);l<1e-5&&h<1e-5&&(c=r,this.end()),this._prevValue=u,this._currValue=c}},{key:"value",get:function(){return this._currValue}}]),r}(b.a),P=r(18);function M(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function I(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R,L={interpolation:w,spring:T},j=function(){function t(e){a()(this,t),this.transitions=new Map,this.timeline=e}return u()(t,[{key:"add",value:function(t,e,r,n){var i=this.transitions;if(i.has(t)){var o=i.get(t),a=o.value;e=void 0===a?o.settings.fromValue:a,this.remove(t)}if(n=Object(v.e)(n)){var s=L[n.type];if(s){var u=new s(this.timeline);u.start(k(k({},n),{},{fromValue:e,toValue:r})),i.set(t,u)}else P.a.error("unsupported transition type '".concat(n.type,"'"))()}}},{key:"remove",value:function(t){var e=this.transitions;e.has(t)&&(e.get(t).cancel(),e.delete(t))}},{key:"update",value:function(){var t,e={},r=M(this.transitions);try{for(r.s();!(t=r.n()).done;){var n=i()(t.value,2),o=n[0],a=n[1];a.update(),e[o]=a.value,a.inProgress||this.remove(o)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"clear",value:function(){var t,e=M(this.transitions.keys());try{for(e.s();!(t=e.n()).done;){var r=t.value;this.remove(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"active",get:function(){return this.transitions.size>0}}]),t}(),D=r(129),B=r(154),F=r(32),z=r(7),N=r(37),U=r(80),V=r(153),G=r(134),W=r(67),H=r(33),q=r(53),Z=r(24),X=r.n(Z),Q=r(98);function Y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function K(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var $=(R={},g()(R,10241,9987),g()(R,10240,9729),g()(R,10242,33071),g()(R,10243,33071),R),J={};function tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?tt(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var rt={boolean:{validate:function(t,e){return!0},equal:function(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate:function(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate:function(t,e){return e.optional&&!t||at(t)&&(3===t.length||4===t.length)},equal:function(t,e,r){return nt(t,e)}},accessor:{validate:function(t,e){var r=st(t);return"function"===r||r===st(e.value)},equal:function(t,e,r){return"function"==typeof e||nt(t,e)}},array:{validate:function(t,e){return e.optional&&!t||at(t)},equal:function(t,e,r){return r.compare?nt(t,e):t===e}},function:{validate:function(t,e){return e.optional&&!t||"function"==typeof t},equal:function(t,e,r){return!r.compare||t===e}},data:{transform:function(t,e,r){var n=(r?r.props:{}).dataTransform;return n&&t?n(t):t}},image:{transform:function(t,e,r){return function(t,e){var r=t.context&&t.context.gl;if(!r||!e)return null;if(e instanceof Q.a)return e;e.constructor&&"Object"!==e.constructor.name&&(e={data:e});var n=null;e.compressed&&(n=g()({},10241,e.data.length>1?9985:9729));var i=new Q.a(r,K(K({},e),{},{parameters:K(K(K({},$),n),t.props.textureParameters)}));return J[i.id]=!0,i}(r,t)},release:function(t){var e;(e=t)&&e instanceof Q.a&&J[e.id]&&(e.delete(),delete J[e.id])}}};function nt(t,e){if(t===e)return!0;if(!at(t)||!at(e))return!1;var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function it(t,e){switch(st(e)){case"object":return ot(t,e);case"array":return ot(t,{type:"array",value:e,compare:!1});case"boolean":return ot(t,{type:"boolean",value:e});case"number":return ot(t,{type:"number",value:e});case"function":return ot(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function ot(t,e){return"type"in e?et(et({name:t},rt[e.type]),e):"value"in e?et({name:t,type:st(e.value)},e):{name:t,type:"object",value:e}}function at(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function st(t){return at(t)?"array":null===t?"null":X()(t)}function ut(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return ct(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ct(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ft=H.b.COMPONENT,pt=H.b.ASYNC_ORIGINAL,dt=H.b.ASYNC_RESOLVED,At=H.b.ASYNC_DEFAULTS;function gt(){var t=this,e=mt(t.constructor),r=Object.create(e);r[ft]=t,r[pt]={},r[dt]={};for(var n=0;n<arguments.length;++n){var i=arguments[n];for(var o in i)r[o]=i[o]}return Object.freeze(r),r}function mt(t){var e=_t(t,"_mergedDefaultProps");return e||(function(t){if(!t.prototype)return;var e=Object.getPrototypeOf(t),r=mt(e),n=function(t){for(var e={},r={},n={},o=0,a=Object.entries(t);o<a.length;o++){var s=i()(a[o],2),u=s[0],c=s[1];if(c&&c.deprecatedFor)n[u]=Array.isArray(c.deprecatedFor)?c.deprecatedFor:[c.deprecatedFor];else{var l=it(u,c);e[u]=l,r[u]=l.value}}return{propTypes:e,defaultProps:r,deprecatedProps:n}}(_t(t,"defaultProps")||{}),o=function(t,e,r){var n=Object.create(null);Object.assign(n,e,t);var i=function(t){var e=_t(t,"layerName")||_t(t,"componentName");e||P.a.once(0,"".concat(t.name,".componentName not specified"))();return e||t.name}(r);return delete t.id,Object.defineProperties(n,{id:{writable:!0,value:i}}),n}(n.defaultProps,r,t),a=ht(ht({},e._propTypes),n.propTypes);!function(t,e){var r={},n={};for(var i in e){var o=e[i],a=o.name,s=o.value;o.async&&(r[a]=s,n[a]=yt(a))}t[At]=r,t[pt]={},Object.defineProperties(t,n)}(o,a);var s=ht(ht({},e._deprecatedProps),n.deprecatedProps);(function(t,e){var r=function(r){Object.defineProperty(t,r,{enumerable:!1,set:function(t){var n,i="".concat(this.id,": ").concat(r),o=ut(e[r]);try{for(o.s();!(n=o.n()).done;){var a=n.value;vt(this,a)||(this[a]=t)}}catch(t){o.e(t)}finally{o.f()}P.a.deprecated(i,e[r].join("/"))()}})};for(var n in e)r(n)})(o,s),t._mergedDefaultProps=o,t._propTypes=a,t._deprecatedProps=s}(t),t._mergedDefaultProps)}function yt(t){return{enumerable:!0,set:function(e){"string"==typeof e||e instanceof Promise||Object(q.c)(e)?this[pt][t]=e:this[dt][t]=e},get:function(){if(this[dt]){if(t in this[dt])return this[dt][t]||this[At][t];if(t in this[pt]){var e=this[ft]&&this[ft].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[At][t]}}return this[At][t]}}}function vt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _t(t,e){return vt(t,e)&&t[e]}var bt=r(43),xt=r.n(bt),wt=r(68),Et=r.n(wt),St=r(234),Ot=r.n(St),Tt=H.b.ASYNC_ORIGINAL,Pt=H.b.ASYNC_RESOLVED,Mt=H.b.ASYNC_DEFAULTS,Ct=Object.freeze({}),It=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a()(this,t),this.component=e,this.asyncProps={},this.onAsyncPropUpdated=function(){},this.oldProps=Ct,this.oldAsyncProps=null}var e;return u()(t,[{key:"finalize",value:function(){for(var t in this.asyncProps){var e=this.asyncProps[t];e.type&&e.type.release&&e.type.release(e.resolvedValue,e.type,this.component)}}},{key:"getOldProps",value:function(){return this.oldAsyncProps||this.oldProps}},{key:"resetOldProps",value:function(){this.oldAsyncProps=null,this.oldProps=this.component.props}},{key:"freezeAsyncOldProps",value:function(){if(!this.oldAsyncProps)for(var t in this.oldProps=this.oldProps||this.component.props,this.oldAsyncProps=Object.create(this.oldProps),this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}},{key:"hasAsyncProp",value:function(t){return t in this.asyncProps}},{key:"getAsyncProp",value:function(t){var e=this.asyncProps[t];return e&&e.resolvedValue}},{key:"isAsyncPropLoading",value:function(t){if(t){var e=this.asyncProps[t];return Boolean(e&&e.pendingLoadCount>0&&e.pendingLoadCount!==e.resolvedLoadCount)}for(var r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}},{key:"reloadAsyncProp",value:function(t,e){this._watchPromise(t,Promise.resolve(e))}},{key:"setAsyncProps",value:function(t){var e=t[Pt]||{},r=t[Tt]||t,n=t[Mt]||{};for(var i in e){var o=e[i];this._createAsyncPropData(i,n[i]),this._updateAsyncProp(i,o),e[i]=this.getAsyncProp(i)}for(var a in r){var s=r[a];this._createAsyncPropData(a,n[a]),this._updateAsyncProp(a,s)}}},{key:"_updateAsyncProp",value:function(t,e){if(this._didAsyncInputValueChange(t,e)){if("string"==typeof e){var r,n=null===(r=this.layer)||void 0===r?void 0:r.props.fetch;n&&(e=n(e,{propName:t,layer:this.layer}))}e instanceof Promise?this._watchPromise(t,e):Object(q.c)(e)?this._resolveAsyncIterable(t,e):this._setPropValue(t,e)}}},{key:"_didAsyncInputValueChange",value:function(t,e){var r=this.asyncProps[t];return e!==r.resolvedValue&&e!==r.lastValue&&(r.lastValue=e,!0)}},{key:"_setPropValue",value:function(t,e){this.freezeAsyncOldProps();var r=this.asyncProps[t];e=this._postProcessValue(r,e),r.resolvedValue=e,r.pendingLoadCount++,r.resolvedLoadCount=r.pendingLoadCount}},{key:"_setAsyncPropValue",value:function(t,e,r){var n=this.asyncProps[t];n&&r>=n.resolvedLoadCount&&void 0!==e&&(this.freezeAsyncOldProps(),n.resolvedValue=e,n.resolvedLoadCount=r,this.onAsyncPropUpdated(t,e))}},{key:"_watchPromise",value:function(t,e){var r=this,n=this.asyncProps[t];n.pendingLoadCount++;var i=n.pendingLoadCount;e.then((function(e){var o;e=r._postProcessValue(n,e),r._setAsyncPropValue(t,e,i);var a=null===(o=r.layer)||void 0===o?void 0:o.props.onDataLoad;"data"===t&&a&&a(e,{propName:t,layer:r.layer})})).catch((function(e){var n;null===(n=r.layer)||void 0===n||n.raiseError(e,"loading ".concat(t," of ").concat(r.layer))}))}},{key:"_resolveAsyncIterable",value:(e=Et()(xt.a.mark((function t(e,r){var n,i,o,a,s,u,c,l,h,f,p,d,A,g,m;return xt.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:"data"!==e&&this._setPropValue(e,r),(i=this.asyncProps[e]).pendingLoadCount++,o=i.pendingLoadCount,a=[],s=0,u=!0,c=!1,t.prev=8,h=Ot()(r);case 10:return t.next=12,h.next();case 12:return f=t.sent,u=f.done,t.next=16,f.value;case 16:if(p=t.sent,u){t.next=27;break}d=p,A=this.component?this.component.props:{},g=A.dataTransform,a=g?g(d,a):a.concat(d),Object.defineProperty(a,"__diff",{enumerable:!1,value:[{startRow:s,endRow:a.length}]}),s=a.length,this._setAsyncPropValue(e,a,o);case 24:u=!0,t.next=10;break;case 27:t.next=33;break;case 29:t.prev=29,t.t0=t.catch(8),c=!0,l=t.t0;case 33:if(t.prev=33,t.prev=34,u||null==h.return){t.next=38;break}return t.next=38,h.return();case 38:if(t.prev=38,!c){t.next=41;break}throw l;case 41:return t.finish(38);case 42:return t.finish(33);case 43:(m=null===(n=this.layer)||void 0===n?void 0:n.props.onDataLoad)&&m(a,{propName:e,layer:this.layer});case 45:case"end":return t.stop()}}),t,this,[[8,29,33,43],[34,,38,42]])}))),function(t,r){return e.apply(this,arguments)})},{key:"_postProcessValue",value:function(t,e){var r=t.type;return r&&(r.release&&r.release(t.resolvedValue,r,this.component),r.transform)?r.transform(e,r,this.component):e}},{key:"_createAsyncPropData",value:function(t,e){if(!this.asyncProps[t]){var r=this.component&&this.component.constructor._propTypes;this.asyncProps[t]={type:r&&r[t],lastValue:null,resolvedValue:e,pendingLoadCount:0,resolvedLoadCount:0}}}}]),t}();function kt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Rt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?kt(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Lt=H.b.ASYNC_ORIGINAL,jt=H.b.ASYNC_RESOLVED,Dt=H.b.ASYNC_DEFAULTS,Bt=0,Ft=function(){function t(){a()(this,t),this.props=gt.apply(this,arguments),this.id=this.props.id,this.count=Bt++,this.lifecycle=H.a.NO_STATE,this.parent=null,this.context=null,this.state=null,this.internalState=null,Object.seal(this)}return u()(t,[{key:"clone",value:function(t){var e=this.props,r={};for(var n in e[Dt])n in e[jt]?r[n]=e[jt][n]:n in e[Lt]&&(r[n]=e[Lt][n]);return new this.constructor(Rt(Rt(Rt({},e),r),t))}},{key:"_initState",value:function(){this.internalState=new It({})}},{key:"root",get:function(){for(var t=this;t.parent;)t=t.parent;return t}},{key:"stats",get:function(){return this.internalState.stats}}]),t}();function zt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}Ft.componentName="Component",Ft.defaultProps={};var Nt=function(t){l()(r,t);var e=zt(r);function r(t){var n,i=t.attributeManager,o=t.layer;return a()(this,r),(n=e.call(this,o)).attributeManager=i,n.model=null,n.needsRedraw=!0,n.subLayers=null,n.usesPickingColorCache=!1,n}return u()(r,[{key:"layer",get:function(){return this.component},set:function(t){this.component=t}}]),r}(It),Ut=r(22),Vt=r(206);function Gt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Wt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ht(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Zt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?qt(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return Jt}));var Xt=Math.pow(2,24)-1,Qt=Object.freeze([]),Yt=Object(U.a)((function(t){var e=t.oldViewport,r=t.viewport;return e.equals(r)})),Kt=new Uint8ClampedArray(0),$t={data:{type:"data",value:Qt,async:!0},dataComparator:null,_dataDiff:{type:"function",value:function(t){return t&&t.__diff},compare:!1,optional:!0},dataTransform:{type:"function",value:null,compare:!1,optional:!0},onDataLoad:{type:"function",value:null,compare:!1,optional:!0},onError:{type:"function",value:null,compare:!1,optional:!0},fetch:{type:"function",value:function(t,e){var r,n=e.propName,i=e.layer,o=e.loaders,a=e.loadOptions,s=e.signal,u=i.context.resourceManager;(a=a||i.getLoadOptions(),o=o||i.props.loaders,s)&&(a=Zt(Zt({},a),{},{fetch:Zt(Zt({},null===(r=a)||void 0===r?void 0:r.fetch),{},{signal:s})}));var c=u.contains(t);return c||a||(u.add({resourceId:t,data:Object(Vt.a)(t,o),persistent:!1}),c=!0),c?u.subscribe({resourceId:t,onChange:function(t){return i.internalState.reloadAsyncProp(n,t)},consumerId:i.id,requestId:n}):Object(Vt.a)(t,o,a)},compare:!1},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},onHover:{type:"function",value:null,compare:!1,optional:!0},onClick:{type:"function",value:null,compare:!1,optional:!0},onDragStart:{type:"function",value:null,compare:!1,optional:!0},onDrag:{type:"function",value:null,compare:!1,optional:!0},onDragEnd:{type:"function",value:null,compare:!1,optional:!0},coordinateSystem:m.a.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,compare:!0},getPolygonOffset:{type:"function",value:function(t){return[0,100*-t.layerIndex]},compare:!1},highlightedObjectIndex:-1,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},Jt=function(t){l()(r,t);var e=Ht(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"toString",value:function(){var t=this.constructor.layerName||this.constructor.name;return"".concat(t,"({id: '").concat(this.props.id,"'})")}},{key:"raiseError",value:function(t,e){var r,n,i,o;(e&&(t.message="".concat(e,": ").concat(t.message)),null===(r=(n=this.props).onError)||void 0===r?void 0:r.call(n,t))||(null===(i=this.context)||void 0===i||null===(o=i.onError)||void 0===o||o.call(i,t,this))}},{key:"setState",value:function(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}},{key:"setNeedsRedraw",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.internalState&&(this.internalState.needsRedraw=t)}},{key:"setNeedsUpdate",value:function(){this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0}},{key:"getNeedsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};return this._getNeedsRedraw(t)}},{key:"needsUpdate",value:function(){return this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams())}},{key:"hasUniformTransition",value:function(){return this.internalState.uniformTransitions.active}},{key:"isPickable",value:function(){return this.props.pickable&&this.props.visible}},{key:"getModels",value:function(){return this.state&&(this.state.models||(this.state.model?[this.state.model]:[]))}},{key:"getAttributeManager",value:function(){return this.internalState&&this.internalState.attributeManager}},{key:"getCurrentLayer",value:function(){return this.internalState&&this.internalState.layer}},{key:"getLoadOptions",value:function(){return this.props.loadOptions}},{key:"project",value:function(t){var e=this.context.viewport,r=Object(G.a)(t,{viewport:e,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),n=Object(Ut.p)(r,e.pixelProjectionMatrix),o=i()(n,3),a=o[0],s=o[1],u=o[2];return 2===t.length?[a,s]:[a,s,u]}},{key:"unproject",value:function(t){return this.context.viewport.unproject(t)}},{key:"projectPosition",value:function(t){return Object(G.b)(t,{viewport:this.context.viewport,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem})}},{key:"use64bitPositions",value:function(){var t=this.props.coordinateSystem;return t===m.a.DEFAULT||t===m.a.LNGLAT||t===m.a.CARTESIAN}},{key:"onHover",value:function(t,e){return!!this.props.onHover&&this.props.onHover(t,e)}},{key:"onClick",value:function(t,e){return!!this.props.onClick&&this.props.onClick(t,e)}},{key:"nullPickingColor",value:function(){return[0,0,0]}},{key:"encodePickingColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e[0]=t+1&255,e[1]=t+1>>8&255,e[2]=t+1>>8>>8&255,e}},{key:"decodePickingColor",value:function(t){Object(N.a)(t instanceof Uint8Array);var e=i()(t,3);return e[0]+256*e[1]+65536*e[2]-1}},{key:"initializeState",value:function(){throw new Error("Layer ".concat(this," has not defined initializeState"))}},{key:"getShaders",value:function(t){var e,r=Gt(this.props.extensions);try{for(r.s();!(e=r.n()).done;){var n=e.value;t=Object(V.a)(t,n.getShaders.call(this,n))}}catch(t){r.e(t)}finally{r.f()}return t}},{key:"shouldUpdateState",value:function(t){t.oldProps,t.props,t.context;return t.changeFlags.propsOrDataChanged}},{key:"updateState",value:function(t){var e=t.oldProps,r=t.props,n=(t.context,t.changeFlags),i=this.getAttributeManager();if(n.dataChanged&&i){var o=n.dataChanged;if(Array.isArray(o)){var a,s=Gt(o);try{for(s.s();!(a=s.n()).done;){var u=a.value;i.invalidateAll(u)}}catch(t){s.e(t)}finally{s.f()}}else i.invalidateAll()}var c=e.highlightedObjectIndex>=0||e.pickable,l=r.highlightedObjectIndex>=0||r.pickable;if(c!==l&&i){var h=i.attributes,f=h.pickingColors,p=h.instancePickingColors,d=f||p;d&&(l&&d.constant&&(d.constant=!1,i.invalidate(d.id)),d.value||l||(d.constant=!0,d.value=[0,0,0]))}}},{key:"finalizeState",value:function(){var t,e=Gt(this.getModels());try{for(e.s();!(t=e.n()).done;){t.value.delete()}}catch(t){e.e(t)}finally{e.f()}var r=this.getAttributeManager();r&&r.finalize(),this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState.uniformTransitions.clear(),this.internalState.finalize()}},{key:"draw",value:function(t){var e,r=Gt(this.getModels());try{for(r.s();!(e=r.n()).done;){e.value.draw(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"getPickingInfo",value:function(t){var e=t.info,r=(t.mode,e.index);return r>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[r]),e}},{key:"activateViewport",value:function(t){var e=this.internalState.viewport;this.internalState.viewport=t,e&&Yt({oldViewport:e,viewport:t})||(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}},{key:"invalidateAttribute",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all",e=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],this.getAttributeManager());e&&("all"===t?e.invalidateAll():e.invalidate(t))}},{key:"updateAttributes",value:function(t){var e,r=Gt(this.getModels());try{for(r.s();!(e=r.n()).done;){var n=e.value;this._setModelAttributes(n,t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"_updateAttributes",value:function(t){var e=this.getAttributeManager();if(e){var r=this.getNumInstances(t),n=this.getStartIndices(t);e.update({data:t.data,numInstances:r,startIndices:n,props:t,transitions:t.transitions,buffers:t.data.attributes,context:this,ignoreUnknownAttributes:!0});var i=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(i)}}},{key:"_updateAttributeTransition",value:function(){var t=this.getAttributeManager();t&&t.updateTransition()}},{key:"_updateUniformTransition",value:function(){var t=this.internalState.uniformTransitions;if(t.active){var e=t.update(),r=Object.create(this.props);for(var n in e)Object.defineProperty(r,n,{value:e[n]});return r}return this.props}},{key:"calculateInstancePickingColors",value:function(t,e){var r=e.numInstances;if(!t.constant){var n=Math.floor(Kt.length/3);if(this.internalState.usesPickingColorCache=!0,n<r){r>Xt&&P.a.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Kt=W.a.allocate(Kt,r,{size:3,copy:!0,maxCount:Math.max(r,Xt)});for(var i=Math.floor(Kt.length/3),o=[],a=n;a<i;a++)this.encodePickingColor(a,o),Kt[3*a+0]=o[0],Kt[3*a+1]=o[1],Kt[3*a+2]=o[2]}t.value=Kt.subarray(0,3*r)}}},{key:"_setModelAttributes",value:function(t,e){var r=this.getAttributeManager(),n=t.userData.excludeAttributes||{},i=r.getShaderAttributes(e,n);t.setAttributes(i)}},{key:"disablePickingIndex",value:function(t){this._disablePickingIndex(t)}},{key:"_disablePickingIndex",value:function(t){var e=this.getAttributeManager().attributes,r=e.pickingColors,n=e.instancePickingColors,i=r||n,o=i.getVertexOffset(t),a=i.getVertexOffset(t+1);i.buffer.subData({data:new Uint8Array(a-o),offset:o})}},{key:"restorePickingColors",value:function(){var t=this.getAttributeManager().attributes,e=t.pickingColors,r=t.instancePickingColors,n=e||r;this.internalState.usesPickingColorCache&&n.value.buffer!==Kt.buffer&&(n.value=Kt.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0})}},{key:"getNumInstances",value:function(t){return void 0!==(t=t||this.props).numInstances?t.numInstances:this.state&&void 0!==this.state.numInstances?this.state.numInstances:Object(B.a)(t.data)}},{key:"getStartIndices",value:function(t){return void 0!==(t=t||this.props).startIndices?t.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}},{key:"_initialize",value:function(){Object(F.a)("layer.initialize",this),this._initState(),this.initializeState(this.context);var t,e=Gt(this.props.extensions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.initializeState.call(this,this.context,r)}}catch(t){e.e(t)}finally{e.f()}this.setChangeFlags({dataChanged:!0,propsChanged:!0,viewportChanged:!0,extensionsChanged:!0}),this._updateState()}},{key:"_update",value:function(){var t=this.needsUpdate();Object(F.a)("layer.update",this,t),t&&this._updateState()}},{key:"_updateState",value:function(){var t=this.props,e=this.context.viewport,r=this._updateUniformTransition();this.internalState.propsInTransition=r,this.context.viewport=this.internalState.viewport||e,this.props=r;try{var n=this._getUpdateParams(),i=this.getModels();if(this.context.gl)this.updateState(n);else try{this.updateState(n)}catch(t){}var o,a=Gt(this.props.extensions);try{for(a.s();!(o=a.n()).done;){var s=o.value;s.updateState.call(this,n,s)}}catch(t){a.e(t)}finally{a.f()}var u=this.getModels()[0]!==i[0];this._updateModules(n,u),this.isComposite?this._renderLayers(n):(this.setNeedsRedraw(),this._updateAttributes(this.props),this.state.model&&this.state.model.setInstanceCount(this.getNumInstances()))}finally{this.context.viewport=e,this.props=t,this.clearChangeFlags(),this.internalState.needsUpdate=!1,this.internalState.resetOldProps()}}},{key:"_finalize",value:function(){Object(F.a)("layer.finalize",this),this.finalizeState(this.context);var t,e=Gt(this.props.extensions);try{for(e.s();!(t=e.n()).done;){var r=t.value;r.finalizeState.call(this,r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"drawLayer",value:function(t){var e=this,r=t.moduleParameters,n=void 0===r?null:r,i=t.uniforms,o=void 0===i?{}:i,a=t.parameters,s=void 0===a?{}:a;this._updateAttributeTransition();var u=this.props;this.props=this.internalState.propsInTransition||u;var c=this.props.opacity;o.opacity=Math.pow(c,1/2.2);try{n&&this.setModuleParameters(n);var l=this.props.getPolygonOffset,h=l&&l(o)||[0,0];Object(z.n)(this.context.gl,{polygonOffset:h}),Object(z.o)(this.context.gl,s,(function(){var t,r={moduleParameters:n,uniforms:o,parameters:s,context:e.context},i=Gt(e.props.extensions);try{for(i.s();!(t=i.n()).done;){var a=t.value;a.draw.call(e,r,a)}}catch(t){i.e(t)}finally{i.f()}e.draw(r)}))}finally{this.props=u}}},{key:"getChangeFlags",value:function(){return this.internalState.changeFlags}},{key:"setChangeFlags",value:function(t){var e=this.internalState.changeFlags;for(var r in t)if(t[r]){var n=!1;switch(r){case"dataChanged":Array.isArray(e[r])&&(e[r]=Array.isArray(t[r])?e[r].concat(t[r]):t[r],n=!0);default:e[r]||(e[r]=t[r],n=!0)}n&&Object(F.a)("layer.changeFlag",this,r,t)}var i=e.dataChanged||e.updateTriggersChanged||e.propsChanged||e.extensionsChanged;e.propsOrDataChanged=i,e.somethingChanged=i||t.viewportChanged||t.stateChanged}},{key:"clearChangeFlags",value:function(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}},{key:"diffProps",value:function(t,e){var r=Object(D.b)(t,e);if(r.updateTriggersChanged)for(var n in r.updateTriggersChanged)r.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(r.transitionsChanged)for(var i in r.transitionsChanged)this.internalState.uniformTransitions.add(i,e[i],t[i],t.transitions[i]);return this.setChangeFlags(r)}},{key:"validateProps",value:function(){Object(D.c)(this.props)}},{key:"setModuleParameters",value:function(t){var e,r=Gt(this.getModels());try{for(r.s();!(e=r.n()).done;){e.value.updateModuleSettings(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"updateAutoHighlight",value:function(t){this.props.autoHighlight&&this._updateAutoHighlight(t)}},{key:"_updateAutoHighlight",value:function(t){var e={pickingSelectedColor:t.picked?t.color:null},r=this.props.highlightColor;t.picked&&"function"==typeof r&&(e.pickingHighlightColor=r(t)),this.setModuleParameters(e),this.setNeedsRedraw()}},{key:"_updateModules",value:function(t,e){var r=t.props,n=t.oldProps,i=r.autoHighlight,o=r.highlightedObjectIndex,a=r.highlightColor;if(e||n.autoHighlight!==i||n.highlightedObjectIndex!==o||n.highlightColor!==a){var s={};i||(s.pickingSelectedColor=null),Array.isArray(a)&&(s.pickingHighlightColor=a),Number.isInteger(o)&&(s.pickingSelectedColor=o>=0?this.encodePickingColor(o):null),this.setModuleParameters(s)}}},{key:"_getUpdateParams",value:function(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}},{key:"_getNeedsRedraw",value:function(t){if(!this.internalState)return!1;var e=!1;e=e||this.internalState.needsRedraw&&this.id,this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags;var r=this.getAttributeManager(),n=r&&r.getNeedsRedraw(t);return e=e||n}},{key:"_getAttributeManager",value:function(){return new y.a(this.context.gl,{id:this.props.id,stats:this.context.stats,timeline:this.context.timeline})}},{key:"_initState",value:function(){Object(N.a)(!this.internalState&&!this.state),Object(N.a)(isFinite(this.props.coordinateSystem));var t=this._getAttributeManager();t&&t.addInstanced({instancePickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new Nt({attributeManager:t,layer:this}),this.clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:function(){return P.a.deprecated("layer.state.attributeManager","layer.getAttributeManager()"),t}}),this.internalState.layer=this,this.internalState.uniformTransitions=new j(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props)}},{key:"_transferState",value:function(t){Object(F.a)("layer.matched",this,this===t);var e=t.state,r=t.internalState;this!==t&&(this.internalState=r,this.internalState.layer=this,this.state=e,this.internalState.setAsyncProps(this.props),this.diffProps(this.props,this.internalState.getOldProps()))}},{key:"_onAsyncPropUpdated",value:function(){this.diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}},{key:"isLoaded",get:function(){return this.internalState&&!this.internalState.isAsyncPropLoading()}},{key:"wrapLongitude",get:function(){return this.props.wrapLongitude}}]),r}(Ft);Jt.layerName="Layer",Jt.defaultProps=$t},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(10),l=r.n(c),h=r(8),f=r.n(h),p=r(5),d=r.n(p),A=r(6),g=r.n(A),m=r(1),y=r.n(m),v=r(240),_=r(179),b=r(34);function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var E=function(){function t(e,r){a()(this,t),this.opts=r,this.source=e}return u()(t,[{key:"getValue",value:function(){var t=this.source.getBuffer(),e=this.getAccessor();if(t)return[t,e];var r=this.source.value,n=e.size,i=r;if(r&&r.length!==n){i=new Float32Array(n);for(var o=e.elementOffset||0,a=0;a<n;++a)i[a]=r[o+a]}return i}},{key:"getAccessor",value:function(){return w(w({},this.source.getAccessor()),this.opts)}},{key:"value",get:function(){return this.source.value}}]),t}();var S=r(67),O=r(35),T=r(18);function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function C(t){return t.stride||t.size*t.bytesPerElement}function I(t,e){e.offset&&T.a.removed("shaderAttribute.offset","vertexOffset, elementOffset")();var r=C(t),n=("vertexOffset"in e?e.vertexOffset:t.vertexOffset||0)*r+(e.elementOffset||0)*t.bytesPerElement+(t.offset||0);return M(M({},e),{},{offset:n,stride:r})}var k=function(){function t(e,r){a()(this,t),this.gl=e,this.id=r.id,this.size=r.size;var n=r.logicalType||r.type,i=5130===n,o=r.defaultValue;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0),r.defaultValue=o;var s=n;i?s=5126:!s&&r.isIndexed?s=e&&Object(v.b)(e,_.a.ELEMENT_INDEX_UINT32)?5125:5123:s||(s=5126),r.logicalType=n,r.type=s;var u=function(t){switch(t){case 5126:return Float32Array;case 5130:return Float64Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return Uint8ClampedArray;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Unknown GL type")}}(n||s||5126);this.shaderAttributes={},this.doublePrecision=i,i&&!1===r.fp64&&(u=Float32Array),r.bytesPerElement=u.BYTES_PER_ELEMENT,this.defaultType=u,this.value=null,this.settings=r,this.state={externalBuffer:null,bufferAccessor:r,allocatedValue:null,constant:!1},this._buffer=null,this.setData(r)}return u()(t,[{key:"delete",value:function(){this._buffer&&(this._buffer.delete(),this._buffer=null),S.a.release(this.state.allocatedValue)}},{key:"getShaderAttributes",value:function(t,e){if(this.doublePrecision){var r={},n=this.value instanceof Float64Array,o=(a=this.getAccessor(),{high:s=I(a,e||{}),low:M(M({},s),{},{offset:s.offset+4*a.size})});return r[t]=new E(this,o.high),r["".concat(t,"64Low")]=n?new E(this,o.low):new Float32Array(this.size),r}var a,s;if(e){var u=I(this.getAccessor(),e);return i()({},t,new E(this,u))}return i()({},t,this)}},{key:"getBuffer",value:function(){return this.state.constant?null:this.state.externalBuffer||this._buffer}},{key:"getValue",value:function(){return this.state.constant?this.value:[this.getBuffer(),this.getAccessor()]}},{key:"getAccessor",value:function(){return this.state.bufferAccessor}},{key:"setData",value:function(t){var e=this.state;ArrayBuffer.isView(t)?t={value:t}:t instanceof b.a&&(t={buffer:t});var r=M(M({},this.settings),t);if(e.bufferAccessor=r,t.constant){var n=t.value;if(n=this._normalizeValue(n,[],0),this.settings.normalized&&(n=this._normalizeConstant(n)),!(!e.constant||!this._areValuesEqual(n,this.value)))return!1;e.externalBuffer=null,e.constant=!0,this.value=n}else if(t.buffer){var i=t.buffer;e.externalBuffer=i,e.constant=!1,this.value=t.value;var o=t.value instanceof Float64Array;r.type=t.type||i.accessor.type,r.bytesPerElement=i.accessor.BYTES_PER_ELEMENT*(o?2:1),r.stride=C(r)}else if(t.value){this._checkExternalBuffer(t);var a=t.value;e.externalBuffer=null,e.constant=!1,this.value=a,r.bytesPerElement=a.BYTES_PER_ELEMENT,r.stride=C(r);var s=this.buffer,u=this.byteOffset;this.doublePrecision&&a instanceof Float64Array&&(a=Object(O.f)(a,r));var c=a.byteLength+u+2*r.stride;s.byteLength<c&&s.reallocate(c),s.setAccessor(null),s.subData({data:a,offset:u}),r.type=t.type||s.accessor.type}return!0}},{key:"updateSubBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.value,r=t.startOffset,n=void 0===r?0:r,i=t.endOffset;this.buffer.subData({data:this.doublePrecision&&e instanceof Float64Array?Object(O.f)(e,{size:this.size,startIndex:n,endIndex:i}):e.subarray(n,i),offset:n*e.BYTES_PER_ELEMENT+this.byteOffset})}},{key:"allocate",value:function(t){var e=t.numInstances,r=t.copy,n=void 0!==r&&r,i=this.state,o=i.allocatedValue,a=S.a.allocate(o,e+1,{size:this.size,type:this.defaultType,copy:n});this.value=a;var s=this.buffer,u=this.byteOffset;return s.byteLength<a.byteLength+u&&(s.reallocate(a.byteLength+u),n&&o&&s.subData({data:o instanceof Float64Array?Object(O.f)(o,this):o,offset:u})),i.allocatedValue=a,i.constant=!1,i.externalBuffer=null,i.bufferAccessor=this.settings,!0}},{key:"_checkExternalBuffer",value:function(t){var e=t.value;if(!t.constant&&e){var r=this.defaultType,n=!1;if(this.doublePrecision&&(n=e.BYTES_PER_ELEMENT<4),n)throw new Error("Attribute ".concat(this.id," does not support ").concat(e.constructor.name));e instanceof r||!this.settings.normalized||"normalized"in t||T.a.warn("Attribute ".concat(this.id," is normalized"))()}}},{key:"_normalizeConstant",value:function(t){switch(this.settings.type){case 5120:return new Float32Array(t).map((function(t){return(t+128)/255*2-1}));case 5122:return new Float32Array(t).map((function(t){return(t+32768)/65535*2-1}));case 5121:return new Float32Array(t).map((function(t){return t/255}));case 5123:return new Float32Array(t).map((function(t){return t/65535}));default:return t}}},{key:"_normalizeValue",value:function(t,e,r){var n=this.settings,i=n.defaultValue,o=n.size;if(Number.isFinite(t))return e[r]=t,e;if(!t)return e[r]=i[0],e;switch(o){case 4:e[r+3]=Number.isFinite(t[3])?t[3]:i[3];case 3:e[r+2]=Number.isFinite(t[2])?t[2]:i[2];case 2:e[r+1]=Number.isFinite(t[1])?t[1]:i[1];case 1:e[r+0]=Number.isFinite(t[0])?t[0]:i[0];break;default:for(var a=o;--a>=0;)e[r+a]=Number.isFinite(t[a])?t[a]:i[a]}return e}},{key:"_areValuesEqual",value:function(t,e){if(!t||!e)return!1;for(var r=this.size,n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}},{key:"buffer",get:function(){if(!this._buffer){var t=this.settings,e=t.isIndexed,r=t.type;this._buffer=new b.a(this.gl,{id:this.id,target:e?34963:34962,accessor:{type:r}})}return this._buffer}},{key:"byteOffset",get:function(){var t=this.getAccessor();return t.vertexOffset?t.vertexOffset*C(t):0}}]),t}(),R=r(37),L=r(53),j=r(66),D=[],B=[[0,1/0]];function F(t,e){if(t===B)return t;if(e[0]<0&&(e[0]=0),e[0]>=e[1])return t;for(var r=[],n=t.length,i=0,o=0;o<n;o++){var a=t[o];a[1]<e[0]?(r.push(a),i=o+1):a[0]>e[1]?r.push(a):e=[Math.min(a[0],e[0]),Math.max(a[1],e[1])]}return r.splice(i,0,e),r}var z=r(46);function N(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function V(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=y()(t);if(e){var i=y()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return g()(this,r)}}var G=function(t){d()(r,t);var e=V(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a()(this,r),n=e.call(this,t,i);var o=i.transition,s=void 0!==o&&o,u=i.noAlloc,c=void 0!==u&&u,l=i.update,h=void 0===l?null:l,f=i.accessor,p=void 0===f?null:f,d=i.transform,A=void 0===d?null:d,g=i.startIndices,m=void 0===g?null:g;return Object.assign(n.settings,{transition:s,noAlloc:c,update:h||p&&n._autoUpdater,accessor:p,transform:A}),Object.assign(n.state,{lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,updateRanges:B,startIndices:m}),Object.seal(n.settings),Object.seal(n.state),n._validateAttributeUpdaters(),n}return u()(r,[{key:"needsUpdate",value:function(){return this.state.needsUpdate}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.clearChangedFlags,r=void 0!==e&&e,n=this.state.needsRedraw;return this.state.needsRedraw=n&&!r,n}},{key:"getUpdateTriggers",value:function(){var t=this.settings.accessor;return[this.id].concat("function"!=typeof t&&t||[])}},{key:"supportsTransition",value:function(){return Boolean(this.settings.transition)}},{key:"getTransitionSetting",value:function(t){if(!t||!this.supportsTransition())return null;var e=this.settings.accessor,r=this.settings.transition,n=Array.isArray(e)?t[e.find((function(e){return t[e]}))]:t[e];return Object(z.e)(n,r)}},{key:"setNeedsUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id,e=arguments.length>1?arguments[1]:void 0;if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),e){var r=e.startRow,n=void 0===r?0:r,i=e.endRow,o=void 0===i?1/0:i;this.state.updateRanges=F(this.state.updateRanges,[n,o])}else this.state.updateRanges=B}},{key:"clearNeedsUpdate",value:function(){this.state.needsUpdate=!1,this.state.updateRanges=D}},{key:"setNeedsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id;this.state.needsRedraw=this.state.needsRedraw||t}},{key:"update",value:function(t){this.setData(t)}},{key:"allocate",value:function(t){var e=this.state,n=this.settings;return!n.noAlloc&&(!!n.update&&(f()(y()(r.prototype),"allocate",this).call(this,{numInstances:t,copy:e.updateRanges!==B}),!0))}},{key:"updateBuffer",value:function(t){var e=t.numInstances,n=t.data,i=t.props,o=t.context;if(!this.needsUpdate())return!1;var a=this.state.updateRanges,s=this.settings,u=s.update,c=s.noAlloc,h=!0;if(u){var p,d=N(a);try{for(d.s();!(p=d.n()).done;){var A=l()(p.value,2),g=A[0],m=A[1];u.call(o,this,{data:n,startRow:g,endRow:m,props:i,numInstances:e})}}catch(t){d.e(t)}finally{d.f()}if(this.value)if(this.constant||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else{var v,_=N(a);try{for(_.s();!(v=_.n()).done;){var b=l()(v.value,2),x=b[0],w=b[1],E=Number.isFinite(x)?this.getVertexOffset(x):0,S=Number.isFinite(w)?this.getVertexOffset(w):c||!Number.isFinite(e)?this.value.length:e*this.size;f()(y()(r.prototype),"updateSubBuffer",this).call(this,{startOffset:E,endOffset:S})}}catch(t){_.e(t)}finally{_.f()}}else;this._checkAttributeArray()}else h=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),h}},{key:"setConstantValue",value:function(t){return void 0!==t&&"function"!=typeof t&&(this.setData({constant:!0,value:t})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}},{key:"setExternalBuffer",value:function(t){var e=this.state;return t?(this.clearNeedsUpdate(),e.lastExternalBuffer===t||(e.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t),!0)):(e.lastExternalBuffer=null,!1)}},{key:"setBinaryValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.state,n=this.settings;if(!t)return r.binaryValue=null,r.binaryAccessor=null,!1;if(n.noAlloc)return!1;if(r.binaryValue===t)return this.clearNeedsUpdate(),!0;r.binaryValue=t,this.setNeedsRedraw(),ArrayBuffer.isView(t)&&(t={value:t});var i=n.transform||e!==this.startIndices;if(i){Object(R.a)(ArrayBuffer.isView(t.value),"invalid ".concat(n.accessor));var o=t.size&&t.size!==this.size;return r.binaryAccessor=Object(L.b)(t.value,{size:t.size||this.size,stride:t.stride,offset:t.offset,startIndices:e,nested:o}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}},{key:"getVertexOffset",value:function(t){var e=this.startIndices;return(e?e[t]:t)*this.size}},{key:"getShaderAttributes",value:function(){var t=this.settings.shaderAttributes||i()({},this.id,null),e={};for(var n in t)Object.assign(e,f()(y()(r.prototype),"getShaderAttributes",this).call(this,n,t[n]));return e}},{key:"_autoUpdater",value:function(t,e){var r=e.data,n=e.startRow,i=e.endRow,o=e.props,a=e.numInstances;if(!t.constant){var s=t.settings,u=t.state,c=t.value,l=t.size,h=t.startIndices,f=s.accessor,p=s.transform,d=u.binaryAccessor||("function"==typeof f?f:o[f]);Object(R.a)("function"==typeof d,'accessor "'.concat(f,'" is not a function'));var A,g=t.getVertexOffset(n),m=Object(L.a)(r,n,i),y=m.iterable,v=m.objectInfo,_=N(y);try{for(_.s();!(A=_.n()).done;){var b=A.value;v.index++;var x=d(b,v);if(p&&(x=p.call(this,x)),h){var w=(v.index<h.length-1?h[v.index+1]:a)-h[v.index];if(x&&Array.isArray(x[0])){var E,S=g,O=N(x);try{for(O.s();!(E=O.n()).done;){var T=E.value;t._normalizeValue(T,c,S),S+=l}}catch(t){O.e(t)}finally{O.f()}}else x&&x.length>l?c.set(x,g):(t._normalizeValue(x,v.target,0),Object(j.a)({target:c,source:v.target,start:g,count:w}));g+=w*l}else t._normalizeValue(x,c,g),g+=l}}catch(t){_.e(t)}finally{_.f()}}}},{key:"_validateAttributeUpdaters",value:function(){var t=this.settings;if(!(t.noAlloc||"function"==typeof t.update))throw new Error("Attribute ".concat(this.id," missing update or accessor"))}},{key:"_checkAttributeArray",value:function(){var t=this.value,e=Math.min(4,this.size);if(t&&t.length>=e){var r=!0;switch(e){case 4:r=r&&Number.isFinite(t[3]);case 3:r=r&&Number.isFinite(t[2]);case 2:r=r&&Number.isFinite(t[1]);case 1:r=r&&Number.isFinite(t[0]);break;default:r=!1}if(!r)throw new Error("Illegal attribute generated for ".concat(this.id))}}},{key:"startIndices",get:function(){return this.state.startIndices},set:function(t){this.state.startIndices=t}}]),r}(k),W=r(32),H=r(294),q=r(73);function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function X(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Q(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Y(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var K=function(){function t(e){var r=e.gl,n=e.attribute,i=e.timeline;a()(this,t),this.gl=r,this.type="interpolation",this.transition=new q.a(i),this.attribute=n,this.attributeInTransition=new G(r,n.settings),this.currentStartIndices=n.startIndices,this.currentLength=0,this.transform=function(t,e){var r=Object(z.c)(e.size);return new H.a(t,{vs:"\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nattribute ATTRIBUTE_TYPE aFrom;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n  vCurrent = mix(aFrom, aTo, time);\n  gl_Position = vec4(0.0);\n}\n",defines:{ATTRIBUTE_TYPE:r},varyings:["vCurrent"]})}(r,n);var o={byteLength:0,usage:35050};this.buffers=[new b.a(r,o),new b.a(r,o)]}return u()(t,[{key:"start",value:function(t,e){if(t.duration<=0)this.transition.cancel();else{var r=this.gl,n=this.buffers,i=this.attribute;Object(z.a)(n);var o,a={numInstances:e,attribute:i,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter},s=Q(n);try{for(s.s();!(o=s.n()).done;){var u=o.value;Object(z.f)(X({buffer:u},a))}}catch(t){s.e(t)}finally{s.f()}this.currentStartIndices=i.startIndices,this.currentLength=Object(z.b)(i,e),this.attributeInTransition.update({buffer:n[1],value:i.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/i.size),sourceBuffers:{aFrom:n[0],aTo:Object(z.d)(r,i)},feedbackBuffers:{vCurrent:n[1]}})}}},{key:"update",value:function(){var t=this.transition.update();if(t){var e=this.transition,r=e.time,n=e.settings,i=n.duration,o=(0,n.easing)(r/i);this.transform.run({uniforms:{time:o}})}return t}},{key:"cancel",value:function(){for(this.transition.cancel(),this.transform.delete();this.buffers.length;)this.buffers.pop().delete()}},{key:"inProgress",get:function(){return this.transition.inProgress}}]),t}();var $=r(197),J=r(98),tt=r(71);function et(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function it(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nt(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ot={interpolation:K,spring:function(){function t(e){var r=e.gl,n=e.attribute,o=e.timeline;a()(this,t),this.gl=r,this.type="spring",this.transition=new q.a(o),this.attribute=n,this.attributeInTransition=new G(r,it(it({},n.settings),{},{normalized:!1})),this.currentStartIndices=n.startIndices,this.currentLength=0,this.texture=function(t){return new J.a(t,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}(r),this.framebuffer=function(t,e){return new tt.a(t,{id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,attachments:i()({},36064,e)})}(r,this.texture),this.transform=function(t,e,r){var n=Object(z.c)(e.size);return new H.a(t,{framebuffer:r,vs:"\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nattribute ATTRIBUTE_TYPE aPrev;\nattribute ATTRIBUTE_TYPE aCur;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vNext;\nvarying float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n  ATTRIBUTE_TYPE velocity = cur - prev;\n  ATTRIBUTE_TYPE delta = dest - cur;\n  ATTRIBUTE_TYPE spring = delta * stiffness;\n  ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n  return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n  bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n  vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n  vNext = getNextValue(aCur, aPrev, aTo);\n  gl_Position = vec4(0, 0, 0, 1);\n  gl_PointSize = 100.0;\n}\n",fs:"\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nvarying float vIsTransitioningFlag;\n\nvoid main(void) {\n  if (vIsTransitioningFlag == 0.0) {\n    discard;\n  }\n  gl_FragColor = vec4(1.0);\n}",defines:{ATTRIBUTE_TYPE:n},varyings:["vNext"]})}(r,n,this.framebuffer);var s={byteLength:0,usage:35050};this.buffers=[new b.a(r,s),new b.a(r,s),new b.a(r,s)]}return u()(t,[{key:"start",value:function(t,e){var r,n=this.gl,i=this.buffers,o=this.attribute,a={numInstances:e,attribute:o,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter},s=et(i);try{for(s.s();!(r=s.n()).done;){var u=r.value;Object(z.f)(it({buffer:u},a))}}catch(t){s.e(t)}finally{s.f()}this.currentStartIndices=o.startIndices,this.currentLength=Object(z.b)(o,e),this.attributeInTransition.update({buffer:i[1],value:o.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/o.size),sourceBuffers:{aTo:Object(z.d)(n,o)}})}},{key:"update",value:function(){var t=this.buffers,e=this.transform,r=this.framebuffer,n=this.transition;return!!n.update()&&(e.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),e.run({framebuffer:r,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:n.settings.stiffness,damping:n.settings.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),Object(z.a)(t),this.attributeInTransition.update({buffer:t[1],value:this.attribute.value}),Object($.c)(r)[0]>0||n.end(),!0)}},{key:"cancel",value:function(){for(this.transition.cancel(),this.transform.delete();this.buffers.length;)this.buffers.pop().delete();this.texture.delete(),this.texture=null,this.framebuffer.delete(),this.framebuffer=null}},{key:"inProgress",get:function(){return this.transition.inProgress}}]),t}()},at=function(){function t(e,r){var n=r.id,i=r.timeline;a()(this,t),this.id=n,this.gl=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=H.a.isSupported(e)}return u()(t,[{key:"finalize",value:function(){for(var t in this.transitions)this._removeTransition(t)}},{key:"update",value:function(t){var e=t.attributes,r=t.transitions,n=t.numInstances;for(var i in this.numInstances=n||1,e){var o=e[i],a=o.getTransitionSetting(r);a&&this._updateAttribute(i,o,a)}for(var s in this.transitions){var u=e[s];u&&u.getTransitionSetting(r)||this._removeTransition(s)}}},{key:"hasAttribute",value:function(t){var e=this.transitions[t];return e&&e.inProgress}},{key:"getAttributes",value:function(){var t={};for(var e in this.transitions){var r=this.transitions[e];r.inProgress&&(t[e]=r.attributeInTransition)}return t}},{key:"run",value:function(){if(!this.isSupported||0===this.numInstances)return!1;for(var t in this.transitions){this.transitions[t].update()&&(this.needsRedraw=!0)}var e=this.needsRedraw;return this.needsRedraw=!1,e}},{key:"_removeTransition",value:function(t){this.transitions[t].cancel(),delete this.transitions[t]}},{key:"_updateAttribute",value:function(t,e,r){var n=this.transitions[t],i=!n||n.type!==r.type;if(i){if(!this.isSupported)return void T.a.warn("WebGL2 not supported by this browser. Transition for ".concat(t," is disabled."))();n&&this._removeTransition(t);var o=ot[r.type];o?this.transitions[t]=new o({attribute:e,timeline:this.timeline,gl:this.gl}):(T.a.error("unsupported transition type '".concat(r.type,"'"))(),i=!1)}(i||e.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(r,this.numInstances))}}]),t}();function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?st(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return ct}));var ct=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.id,i=void 0===n?"attribute-manager":n,o=r.stats,s=r.timeline;a()(this,t),this.id=i,this.gl=e,this.attributes={},this.updateTriggers={},this.accessors={},this.needsRedraw=!0,this.userData={},this.stats=o,this.attributeTransitionManager=new at(e,{id:"".concat(i,"-transitions"),timeline:s}),Object.seal(this)}return u()(t,[{key:"finalize",value:function(){for(var t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}},{key:"getNeedsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,e&&this.id}},{key:"setNeedsRedraw",value:function(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.needsRedraw=!0,this}},{key:"add",value:function(t,e){this._add(t,e)}},{key:"addInstanced",value:function(t,e){this._add(t,e,{instanced:1})}},{key:"remove",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];void 0!==this.attributes[r]&&(this.attributes[r].delete(),delete this.attributes[r])}}},{key:"invalidate",value:function(t,e){var r=this._invalidateTrigger(t,e);Object(W.a)("attributeManager.invalidate",this,t,r)}},{key:"invalidateAll",value:function(t){for(var e in this.attributes)this.attributes[e].setNeedsUpdate(e,t);Object(W.a)("attributeManager.invalidate",this,"all")}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.data,r=t.numInstances,n=t.startIndices,i=void 0===n?null:n,o=t.transitions,a=t.props,s=void 0===a?{}:a,u=t.buffers,c=void 0===u?{}:u,l=t.context,h=void 0===l?{}:l,f=!1;for(var p in Object(W.a)("attributeManager.updateStart",this),this.stats&&this.stats.get("Update Attributes").timeStart(),this.attributes){var d=this.attributes[p],A=d.settings.accessor;d.startIndices=i,s[p]&&T.a.removed("props.".concat(p),"data.attributes.".concat(p))(),d.setExternalBuffer(c[p])||d.setBinaryValue(c[A],e.startIndices)||!c[A]&&d.setConstantValue(s[A])||d.needsUpdate()&&(f=!0,this._updateAttribute({attribute:d,numInstances:r,data:e,props:s,context:h})),this.needsRedraw|=d.needsRedraw()}f&&Object(W.a)("attributeManager.updateEnd",this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:o})}},{key:"updateTransition",value:function(){var t=this.attributeTransitionManager.run();return this.needsRedraw=this.needsRedraw||t,t}},{key:"getAttributes",value:function(){return this.attributes}},{key:"getChangedAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearChangedFlags:!1},e=this.attributes,r=this.attributeTransitionManager,n=ut({},r.getAttributes());for(var i in e){var o=e[i];o.needsRedraw(t)&&!r.hasAttribute(i)&&(n[i]=o)}return n}},{key:"getShaderAttributes",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=this.getAttributes());var r={};for(var n in t)e[n]||Object.assign(r,t[n].getShaderAttributes());return r}},{key:"getAccessors",value:function(){return this.updateTriggers}},{key:"_add",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(var n in e&&T.a.warn("AttributeManager.add({updaters}) - updater map no longer supported")(),t){var i=t[n];this.attributes[n]=this._createAttribute(n,i,r)}this._mapUpdateTriggersToAttributes()}},{key:"_createAttribute",value:function(t,e,r){var n=ut(ut({},e),{},{id:t,isIndexed:e.isIndexed||e.elements||!1,constant:e.constant||!1,size:(e.elements?1:e.size)||1,value:e.value||null,divisor:e.instanced||r.instanced?1:e.divisor||0});return new G(this.gl,n)}},{key:"_mapUpdateTriggersToAttributes",value:function(){var t=this,e={},r=function(r){t.attributes[r].getUpdateTriggers().forEach((function(t){e[t]||(e[t]=[]),e[t].push(r)}))};for(var n in this.attributes)r(n);this.updateTriggers=e}},{key:"_invalidateTrigger",value:function(t,e){var r=this.attributes,n=this.updateTriggers[t];return n&&n.forEach((function(t){var n=r[t];n&&n.setNeedsUpdate(n.id,e)})),n}},{key:"_updateAttribute",value:function(t){var e=t.attribute,r=t.numInstances;(Object(W.a)("attribute.updateStart",e),e.constant)?e.setConstantValue(e.value):(e.allocate(r)&&Object(W.a)("attribute.allocate",e,r),e.updateBuffer(t)&&(this.needsRedraw=!0,Object(W.a)("attribute.updateEnd",e,r)))}}]),t}()},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(227),v=r(226),_=r(14),b=r(155),x=r(176),w=r(18),E=r(48),S=r(62),O=r(38);function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var C=function(t){f()(r,t);var e=M(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a()(this,r);var n=t.id,i=void 0===n?Object(E.c)("column-geometry"):n,o=I(t),s=o.indices,u=o.attributes;return e.call(this,P(P({},t),{},{id:i,indices:s,attributes:u}))}return r}(S.a);function I(t){var e=t.radius,r=t.height,n=void 0===r?1:r,i=t.nradial,o=void 0===i?10:i,a=t.vertices;a&&(w.a.assert(a.length>=o),a=a.flatMap((function(t){return[t[0],t[1]]})),Object(O.h)(a,O.a.COUNTER_CLOCKWISE));var s=n>0,u=o+1,c=s?3*u+1:o,l=2*Math.PI/o,h=new Uint16Array(s?3*o*2:0),f=new Float32Array(3*c),p=new Float32Array(3*c),d=0;if(s){for(var A=0;A<u;A++)for(var g=A*l,m=A%o,y=Math.sin(g),v=Math.cos(g),_=0;_<2;_++)f[d+0]=a?a[2*m]:v*e,f[d+1]=a?a[2*m+1]:y*e,f[d+2]=(.5-_)*n,p[d+0]=a?a[2*m]:v,p[d+1]=a?a[2*m+1]:y,d+=3;f[d+0]=f[d-3],f[d+1]=f[d-2],f[d+2]=f[d-1],d+=3}for(var b=s?0:1;b<u;b++){var x=Math.floor(b/2)*Math.sign(.5-b%2),E=x*l,S=(x+o)%o,T=Math.sin(E),P=Math.cos(E);f[d+0]=a?a[2*S]:P*e,f[d+1]=a?a[2*S+1]:T*e,f[d+2]=n/2,p[d+2]=1,d+=3}if(s)for(var M=0,C=0;C<o;C++)h[M++]=2*C+0,h[M++]=2*C+2,h[M++]=2*C+0,h[M++]=2*C+1,h[M++]=2*C+1,h[M++]=2*C+3;return{indices:h,attributes:{POSITION:{size:3,value:f},NORMAL:{size:3,value:p}}}}function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return B}));var j=[0,0,0,255],D={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,getPosition:{type:"accessor",value:function(t){return t.position}},getFillColor:{type:"accessor",value:j},getLineColor:{type:"accessor",value:j},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}},B=function(t){f()(r,t);var e=L(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"\n#define SHADER_NAME column-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec3 instancePositions;\nattribute float instanceElevations;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute float instanceStrokeWidths;\n\nattribute vec3 instancePickingColors;\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform bool extruded;\nuniform bool isStroke;\nuniform float coverage;\nuniform float elevationScale;\nuniform float edgeDistance;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int radiusUnits;\nuniform int widthUnits;\nvarying vec4 vColor;\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n\n  vec4 color = isStroke ? instanceLineColors : instanceFillColors;\n  mat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n  float elevation = 0.0;\n  float strokeOffsetRatio = 1.0;\n\n  if (extruded) {\n    elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;\n  } else if (isStroke) {\n    float widthPixels = clamp(\n      project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n      widthMinPixels, widthMaxPixels) / 2.0;\n    strokeOffsetRatio -= sign(positions.z) * project_pixel_size(widthPixels) / project_size(edgeDistance * coverage * radius);\n  }\n  float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);\n  float dotRadius = radius * coverage * shouldRender;\n\n  geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n  geometry.pickingColor = instancePickingColors;\n  vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n  vec3 centroidPosition64Low = instancePositions64Low;\n  vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\n  if (radiusUnits == UNIT_METERS) {\n    offset = project_size(offset);\n  }\n  vec3 pos = vec3(offset, 0.);\n  DECKGL_FILTER_SIZE(pos, geometry);\n\n  gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  if (extruded && !isStroke) {\n    vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n    vColor = vec4(lightColor, color.a * opacity);\n  } else {\n    vColor = vec4(color.rgb, color.a * opacity);\n  }\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  gl_FragColor = vColor;\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a,v.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getFillColor",defaultValue:j},instanceLineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getLineColor",defaultValue:j},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i});var o=i.extensionsChanged;if(o){var a,s=this.context.gl;null===(a=this.state.model)||void 0===a||a.delete(),this.state.model=this._getModel(s),this.getAttributeManager().invalidateAll()}(o||e.diskResolution!==n.diskResolution||e.vertices!==n.vertices||(e.extruded||e.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(e)}},{key:"getGeometry",value:function(t,e,r){var n=new C({radius:1,height:r?2:0,vertices:e,nradial:t}),i=0;if(e)for(var o=0;o<t;o++){var a=e[o];i+=Math.sqrt(a[0]*a[0]+a[1]*a[1])/t}else i=1;return this.setState({edgeDistance:Math.cos(Math.PI/t)*i}),n}},{key:"_getModel",value:function(t){return new x.a(t,R(R({},this.getShaders()),{},{id:this.props.id,isInstanced:!0}))}},{key:"_updateGeometry",value:function(t){var e=t.diskResolution,r=t.vertices,n=t.extruded,i=t.stroked,o=this.getGeometry(e,r,n||i);this.setState({fillVertexCount:o.attributes.POSITION.value.length/3,wireframeVertexCount:o.indices.value.length}),this.state.model.setProps({geometry:o})}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.lineWidthUnits,i=r.lineWidthScale,o=r.lineWidthMinPixels,a=r.lineWidthMaxPixels,s=r.radiusUnits,u=r.elevationScale,c=r.extruded,l=r.filled,h=r.stroked,f=r.wireframe,p=r.offset,d=r.coverage,A=r.radius,g=r.angle,m=this.state,y=m.model,v=m.fillVertexCount,b=m.wireframeVertexCount,x=m.edgeDistance;y.setUniforms(e).setUniforms({radius:A,angle:g/180*Math.PI,offset:p,extruded:c,coverage:d,elevationScale:u,edgeDistance:x,radiusUnits:_.d[s],widthUnits:_.d[n],widthScale:i,widthMinPixels:o,widthMaxPixels:a}),c&&f&&(y.setProps({isIndexed:!0}),y.setVertexCount(b).setDrawMode(1).setUniforms({isStroke:!0}).draw()),l&&(y.setProps({isIndexed:!1}),y.setVertexCount(v).setDrawMode(5).setUniforms({isStroke:!1}).draw()),!c&&h&&(y.setProps({isIndexed:!1}),y.setVertexCount(2*v/3).setDrawMode(5).setUniforms({isStroke:!0}).draw())}}]),r}(b.a);B.layerName="ColumnLayer",B.defaultProps=D},function(t,e,r){"use strict";var n=r(10),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(53),y=r(190),v=r(162),_=r(238),b=r.n(_),x=r(18);function w(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var S=[];function O(t,e,r,n){for(var i=0,o=e;o<r;o++){var a=t[o],s=null,u=n&&n[a];u&&(s=u.width),i+=s}return i}function T(t,e,r,n,i,o){for(var a=e,s=0,u=e;u<r;u++){var c=O(t,u,u+1,i);s+c>n&&(a<u&&o.push(u),a=u,s=0),s+=c}return s}function P(t,e,r,n,i,o){for(var a=e,s=e,u=e,c=0,l=e;l<r;l++)if(" "===t[l]?u=l+1:" "!==t[l+1]&&l+1!==r||(u=l+1),u>s){var h=O(t,s,u,i);c+h>n&&(a<s&&(o.push(s),a=s,c=0),h>n&&(h=T(t,s,u,n,i,o),a=o[o.length-1])),s=u,c+=h}return c}function M(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;void 0===o&&(o=t.length);var a=[];return"break-all"===e?T(t,i,o,r,n,a):P(t,i,o,r,n,a),a}function C(t,e,r,n,i,o){for(var a=0,s=0,u=e;u<r;u++){var c=t[u],l=n[c];l?(s||(s=l.height),i[u]=a+l.width/2,a+=l.width):(x.a.warn("Missing character: ".concat(c," (").concat(c.codePointAt(0),")"))(),i[u]=a,a+=32)}o[0]=a,o[1]=s}function I(t,e,r,n,i){for(var o=(t=Array.from(t)).length,a=new Array(o),s=new Array(o),u=new Array(o),c=("break-word"===r||"break-all"===r)&&isFinite(n)&&n>0,l=[0,0],h=[],f=0,p=0,d=0,A=0;A<=o;A++){var g=t[A];if("\n"!==g&&A!==o||(d=A),d>p){for(var m=c?M(t,r,n,i,p,d):S,y=0;y<=m.length;y++){var v=0===y?p:m[y-1],_=y<m.length?m[y]:d;C(t,v,_,i,a,h);for(var b=v;b<_;b++)s[b]=f+h[1]/2,u[b]=h[0];f+=h[1]*e,l[0]=Math.max(l[0],h[0])}p=d}"\n"===g&&(a[p]=0,s[p]=0,u[p]=0,p++)}return l[1]=f,{x:a,y:s,rowWidth:u,size:l}}var k=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;u()(this,t),this.limit=e,this.clear()}return l()(t,[{key:"clear",value:function(){this._cache={},this._order=[]}},{key:"get",value:function(t){var e=this._cache[t];return e&&(this._deleteOrder(t),this._appendOrder(t)),e}},{key:"set",value:function(t,e){this._cache[t]?(this.delete(t),this._cache[t]=e,this._appendOrder(t)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[t]=e,this._appendOrder(t))}},{key:"delete",value:function(t){this._cache[t]&&(this._deleteCache(t),this._deleteOrder(t))}},{key:"_deleteCache",value:function(t){delete this._cache[t]}},{key:"_deleteOrder",value:function(t){var e=this._order.findIndex((function(e){return e===t}));e>=0&&this._order.splice(e,1)}},{key:"_appendOrder",value:function(t){this._order.push(t)}}]),t}();function R(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return L(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var D=function(){for(var t=[],e=32;e<128;e++)t.push(String.fromCharCode(e));return t}(),B=new k(3),F=["fontFamily","fontWeight","characterSet","fontSize","sdf","buffer","cutoff","radius"];function z(t,e){var r=B.get(t);if(!r)return e;var n=[],i=r.mapping,o=Object.keys(i);o=new Set(o);var a=e;return a instanceof Array&&(a=new Set(a)),a.forEach((function(t){o.has(t)||n.push(t)})),n}function N(t,e){for(var r=0;r<t.length;r++)e.data[4*r+3]=t[r]}function U(t,e,r,n){t.font="".concat(n," ").concat(r,"px ").concat(e),t.fillStyle="#000",t.textBaseline="baseline",t.textAlign="left"}var V=function(){function t(){u()(this,t),this.props={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:D,fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12},this._key=null,this._atlas=null}return l()(t,[{key:"setProps",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};F.forEach((function(r){r in e&&(t.props[r]=e[r])}));var r=this._key;this._key=this._getKey();var n=z(this._key,this.props.characterSet),i=B.get(this._key);if(i&&0===n.length)this._key!==r&&(this._atlas=i);else{var o=this._generateFontAtlas(this._key,n,i);this._atlas=o,B.set(this._key,o)}}},{key:"_generateFontAtlas",value:function(t,e,r){var n=this.props,i=n.fontFamily,o=n.fontWeight,s=n.fontSize,u=n.buffer,c=n.sdf,l=n.radius,h=n.cutoff,f=r&&r.data;f||((f=document.createElement("canvas")).width=1024);var p=f.getContext("2d");U(p,i,s,o);var d=function(t){var e,r=t.characterSet,n=t.getFontWidth,i=t.fontHeight,o=t.buffer,a=t.maxCanvasWidth,s=t.mapping,u=void 0===s?{}:s,c=t.xOffset,l=void 0===c?0:c,h=t.yOffset,f=void 0===h?0:h,p=0,d=l,A=0,g=w(r);try{for(g.s();!(e=g.n()).done;){var m=e.value;if(!u[m]){var y=n(m,A++);d+y+2*o>a&&(d=0,p++),u[m]={x:d+o,y:f+p*(i+2*o)+o,width:y,height:i},d+=y+2*o}}}catch(t){g.e(t)}finally{g.f()}var v,_=i+2*o;return{mapping:u,xOffset:d,yOffset:f+p*_,canvasHeight:(v=f+(p+1)*_,Math.pow(2,Math.ceil(Math.log2(v))))}}(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({getFontWidth:function(t){return p.measureText(t).width},fontHeight:1.2*s,buffer:u,characterSet:e,maxCanvasWidth:1024},r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset})),A=d.mapping,g=d.canvasHeight,m=d.xOffset,y=d.yOffset;if(f.height!==g){var v=p.getImageData(0,0,f.width,f.height);f.height=g,p.putImageData(v,0,0)}if(U(p,i,s,o),c){var _,x=new b.a(s,u,l,h,i,o),E=p.getImageData(0,0,x.size,x.size),S=R(e);try{for(S.s();!(_=S.n()).done;){var O=_.value;N(x.draw(O),E),p.putImageData(E,A[O].x-u,A[O].y+u)}}catch(t){S.e(t)}finally{S.f()}}else{var T,P=R(e);try{for(P.s();!(T=P.n()).done;){var M=T.value;p.fillText(M,A[M].x,A[M].y+.9*s)}}catch(t){P.e(t)}finally{P.f()}}return{xOffset:m,yOffset:y,mapping:A,data:f,width:f.width,height:f.height}}},{key:"_getKey",value:function(){var t=this.props,e=t.fontFamily,r=t.fontWeight,n=t.fontSize,i=t.buffer,o=t.sdf,a=t.radius,s=t.cutoff;return o?"".concat(e," ").concat(r," ").concat(n," ").concat(i," ").concat(a," ").concat(s):"".concat(e," ").concat(r," ").concat(n," ").concat(i)}},{key:"texture",get:function(){return this._atlas}},{key:"mapping",get:function(){return this._atlas&&this._atlas.mapping}},{key:"scale",get:function(){return 1.2}}]),t}(),G=r(160);function W(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function X(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return et}));var Q={fontSize:64,buffer:4,sdf:!1,radius:12,cutoff:.25,smoothing:.1},Y={start:1,middle:0,end:-1},K={top:1,center:0,bottom:-1},$=[0,0,0,255],J=["fontSize","buffer","sdf","radius","cutoff"],tt={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:$},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:D},fontFamily:"Monaco, monospace",fontWeight:"normal",lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:$},fontSettings:{},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:function(t){return t.text}},getPosition:{type:"accessor",value:function(t){return t.position}},getColor:{type:"accessor",value:$},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},et=function(t){f()(r,t);var e=X(r);function r(){return u()(this,r),e.apply(this,arguments)}return l()(r,[{key:"initializeState",value:function(){this.state={styleVersion:0,fontAtlasManager:new V}}},{key:"updateState",value:function(t){var e=t.props,r=t.oldProps,n=t.changeFlags,i=n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getText),o=this.state.characterSet;i&&this._updateText();var a=o!==this.state.characterSet||this._fontChanged(r,e);a&&this._updateFontAtlas(r,e),(a||e.lineHeight!==r.lineHeight||e.wordBreak!==r.wordBreak||e.maxWidth!==r.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}},{key:"getPickingInfo",value:function(t){var e=t.info;return e.object=e.index>=0?this.props.data[e.index]:null,e}},{key:"_updateFontAtlas",value:function(t,e){var r=e.fontSettings,n=e.fontFamily,i=e.fontWeight,o=this.state,a=o.fontAtlasManager,s=o.characterSet;a.setProps(Z(Z(Z({},Q),r),{},{characterSet:s,fontFamily:n,fontWeight:i}))}},{key:"_fontChanged",value:function(t,e){if(t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight)return!0;if(t.fontSettings===e.fontSettings)return!1;var r=t.fontSettings||{},n=e.fontSettings||{};return J.some((function(t){return r[t]!==n[t]}))}},{key:"_updateText",value:function(){var t,e=this.props,r=e.data,n=e.characterSet,i=r.attributes&&r.attributes.getText,o=this.props.getText,a=r.startIndices,s="auto"===n&&new Set;if(i&&a){var u=function(t){var e=t.value,r=t.length,n=t.stride,i=t.offset,o=t.startIndices,a=t.characterSet,s=e.BYTES_PER_ELEMENT,u=n?n/s:1,c=i?i/s:0,l=o[r]||Math.ceil((e.length-c)/u),h=a&&new Set,f=new Array(r),p=e;if(u>1||c>0){p=new e.constructor(l);for(var d=0;d<l;d++)p[d]=e[d*u+c]}for(var A=0;A<r;A++){var g=o[A],m=o[A+1]||l,y=p.subarray(g,m);f[A]=String.fromCodePoint.apply(null,y),h&&y.forEach(h.add,h)}if(h){var v,_=w(h);try{for(_.s();!(v=_.n()).done;){var b=v.value;a.add(String.fromCodePoint(b))}}catch(t){_.e(t)}finally{_.f()}}return{texts:f,characterCount:l}}(Z(Z({},ArrayBuffer.isView(i)?{value:i}:i),{},{length:r.length,startIndices:a,characterSet:s})),c=u.texts;t=u.characterCount,o=function(t,e){var r=e.index;return c[r]}}else{var l=Object(m.a)(r),h=l.iterable,f=l.objectInfo;a=[0],t=0;var p,d=W(h);try{for(d.s();!(p=d.n()).done;){var A=p.value;f.index++;var g=Array.from(o(A,f)||"");s&&g.forEach(s.add,s),t+=g.length,a.push(t)}}catch(t){d.e(t)}finally{d.f()}}this.setState({getText:o,startIndices:a,numInstances:t,characterSet:s||n})}},{key:"getBoundingRect",value:function(t,e){var r=this.state.fontAtlasManager.mapping,n=this.state.getText,o=this.props,a=o.wordBreak,s=o.maxWidth,u=o.lineHeight,c=o.getTextAnchor,l=o.getAlignmentBaseline,h=I(n(t,e)||"",u,a,s,r),f=i()(h.size,2),p=f[0],d=f[1];return[(Y["function"==typeof c?c(t,e):c]-1)*p/2,(K["function"==typeof l?l(t,e):l]-1)*d/2,p,d]}},{key:"getIconOffsets",value:function(t,e){for(var r=this.state.fontAtlasManager.mapping,n=this.state.getText,o=this.props,a=o.wordBreak,s=o.maxWidth,u=o.lineHeight,c=o.getTextAnchor,l=o.getAlignmentBaseline,h=I(n(t,e)||"",u,a,s,r),f=h.x,p=h.y,d=h.rowWidth,A=i()(h.size,2),g=A[0],m=A[1],y=Y["function"==typeof c?c(t,e):c],v=K["function"==typeof l?l(t,e):l],_=f.length,b=new Array(2*_),x=0,w=0;w<_;w++){var E=(1-y)*(g-d[w])/2;b[x++]=(y-1)*g/2+E+f[w],b[x++]=(v-1)*m/2+p[w]}return b}},{key:"renderLayers",value:function(){var t=this.state,e=t.startIndices,r=t.numInstances,n=t.getText,i=t.fontAtlasManager,o=i.scale,a=i.texture,s=i.mapping,u=t.styleVersion,c=this.props,l=c.data,h=c._dataDiff,f=c.getPosition,p=c.getColor,d=c.getSize,A=c.getAngle,g=c.getPixelOffset,m=c.getBackgroundColor,y=c.getBorderColor,_=c.getBorderWidth,b=c.backgroundPadding,x=c.background,w=c.billboard,E=c.fontSettings,S=c.outlineWidth,O=c.outlineColor,T=c.sizeScale,P=c.sizeUnits,M=c.sizeMinPixels,C=c.sizeMaxPixels,I=c.transitions,k=c.updateTriggers,R=this.getSubLayerClass("characters",v.a),L=this.getSubLayerClass("background",G.a);return[x&&new L({getFillColor:m,getLineColor:y,getLineWidth:_,padding:b,getPosition:f,getSize:d,getAngle:A,getPixelOffset:g,billboard:w,sizeScale:T/this.state.fontAtlasManager.props.fontSize,sizeUnits:P,sizeMinPixels:M,sizeMaxPixels:C,transitions:I&&{getPosition:I.getPosition,getAngle:I.getAngle,getSize:I.getSize,getFillColor:I.getBackgroundColor,getLineColor:I.getBorderColor,getLineWidth:I.getBorderWidth,getPixelOffset:I.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:k.getPosition,getAngle:k.getAngle,getSize:k.getSize,getFillColor:k.getBackgroundColor,getLineColor:k.getBorderColor,getLineWidth:k.getBorderWidth,getPixelOffset:k.getPixelOffset,getBoundingRect:{getText:k.getText,getTextAnchor:k.getTextAnchor,getAlignmentBaseline:k.getAlignmentBaseline,styleVersion:u}}}),{data:l.attributes?{length:l.length,attributes:l.attributes.background||{}}:l,_dataDiff:h,autoHighlight:!1,getBoundingRect:this.getBoundingRect.bind(this)}),new R({sdf:E.sdf,smoothing:Number.isFinite(E.smoothing)?E.smoothing:Q.smoothing,outlineWidth:S,outlineColor:O,iconAtlas:a,iconMapping:s,getPosition:f,getColor:p,getSize:d,getAngle:A,getPixelOffset:g,billboard:w,sizeScale:T*o,sizeUnits:P,sizeMinPixels:M*o,sizeMaxPixels:C*o,transitions:I&&{getPosition:I.getPosition,getAngle:I.getAngle,getColor:I.getColor,getSize:I.getSize,getPixelOffset:I.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{getIcon:k.getText,getPosition:k.getPosition,getAngle:k.getAngle,getColor:k.getColor,getSize:k.getSize,getPixelOffset:k.getPixelOffset,getIconOffsets:{getText:k.getText,getTextAnchor:k.getTextAnchor,getAlignmentBaseline:k.getAlignmentBaseline,styleVersion:u}}}),{data:l,_dataDiff:h,startIndices:e,numInstances:r,getIconOffsets:this.getIconOffsets.bind(this),getIcon:n})]}}]),r}(y.a);et.layerName="TextLayer",et.defaultProps=tt},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(226),v=r(14),_=r(155),b=r(176),x=r(62);function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return P}));var O=[0,0,0,255],T={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:function(t){return t.position}},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:O},getLineColor:{type:"accessor",value:O},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},P=function(t){f()(r,t);var e=S(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n  outerRadiusPixels = clamp(\n    project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\n    radiusMinPixels, radiusMaxPixels\n  );\n  float lineWidthPixels = clamp(\n    project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\n    lineWidthMinPixels, lineWidthMaxPixels\n  );\n  outerRadiusPixels += stroked * lineWidthPixels / 2.0;\n  unitPosition = positions.xy;\n  geometry.uv = unitPosition;\n  geometry.pickingColor = instancePickingColors;\n\n  innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\n  \n  if (billboard) {\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n    vec3 offset = positions * outerRadiusPixels;\n    DECKGL_FILTER_SIZE(offset, geometry);\n    gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n  } else {\n    vec3 offset = positions * project_pixel_size(outerRadiusPixels);\n    DECKGL_FILTER_SIZE(offset, geometry);\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n  }\n\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n  DECKGL_FILTER_COLOR(vFillColor, geometry);\n  vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n  DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n  geometry.uv = unitPosition;\n\n  float distToCenter = length(unitPosition) * outerRadiusPixels;\n  float inCircle = antialiasing ? \n    smoothedge(distToCenter, outerRadiusPixels) : \n    step(distToCenter, outerRadiusPixels);\n\n  if (inCircle == 0.0) {\n    discard;\n  }\n\n  if (stroked > 0.5) {\n    float isLine = antialiasing ? \n      smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n      step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n    if (filled) {\n      gl_FragColor = mix(vFillColor, vLineColor, isLine);\n    } else {\n      if (isLine == 0.0) {\n        discard;\n      }\n      gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n    }\n  } else if (filled) {\n    gl_FragColor = vFillColor;\n  } else {\n    discard;\n  }\n\n  gl_FragColor.a *= inCircle;\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),i.extensionsChanged){var o,a=this.context.gl;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(a),this.getAttributeManager().invalidateAll()}}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.radiusUnits,i=r.radiusScale,o=r.radiusMinPixels,a=r.radiusMaxPixels,s=r.stroked,u=r.filled,c=r.billboard,l=r.antialiasing,h=r.lineWidthUnits,f=r.lineWidthScale,p=r.lineWidthMinPixels,d=r.lineWidthMaxPixels;this.state.model.setUniforms(e).setUniforms({stroked:s?1:0,filled:u,billboard:c,antialiasing:l,radiusUnits:v.d[n],radiusScale:i,radiusMinPixels:o,radiusMaxPixels:a,lineWidthUnits:v.d[h],lineWidthScale:f,lineWidthMinPixels:p,lineWidthMaxPixels:d}).draw()}},{key:"_getModel",value:function(t){return new b.a(t,E(E({},this.getShaders()),{},{id:this.props.id,geometry:new x.a({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0])}}}),isInstanced:!0}))}}]),r}(_.a);P.layerName="ScatterplotLayer",P.defaultProps=T},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(226),v=r(14),_=r(155),b=r(176),x=r(62);function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return T}));var O={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:function(t){return t.position}},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},T=function(t){f()(r,t);var e=S(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME text-background-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceRects;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec2 instancePixelOffsets;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n  float angle_radian = radians(angle);\n  float cos_angle = cos(angle_radian);\n  float sin_angle = sin(angle_radian);\n  mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n  return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n  geometry.uv = positions;\n  geometry.pickingColor = instancePickingColors;\n  uv = positions;\n  vLineWidth = instanceLineWidths;\n  float sizePixels = clamp(\n    project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\n    sizeMinPixels, sizeMaxPixels\n  );\n\n  dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\n\n  vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\n  pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n  pixelOffset += instancePixelOffsets;\n  pixelOffset.y *= -1.0;\n\n  if (billboard)  {\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n    vec3 offset = vec3(pixelOffset, 0.0);\n    DECKGL_FILTER_SIZE(offset, geometry);\n    gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n  } else {\n    vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n    DECKGL_FILTER_SIZE(offset_common, geometry);\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n  }\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n  DECKGL_FILTER_COLOR(vFillColor, geometry);\n  vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n  DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool stroked;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvoid main(void) {\n  geometry.uv = uv;\n\n  vec2 pixelPosition = uv * dimensions;\n  if (stroked) {\n    float distToEdge = min(\n      min(pixelPosition.x, dimensions.x - pixelPosition.x),\n      min(pixelPosition.y, dimensions.y - pixelPosition.y)\n    );\n    float isBorder = smoothedge(distToEdge, vLineWidth);\n    gl_FragColor = mix(vFillColor, vLineColor, isBorder);\n  } else {\n    gl_FragColor = vFillColor;\n  }\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),i.extensionsChanged){var o,a=this.context.gl;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(a),this.getAttributeManager().invalidateAll()}}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.billboard,i=r.sizeScale,o=r.sizeUnits,a=r.sizeMinPixels,s=r.sizeMaxPixels,u=r.getLineWidth,c=this.props.padding;c.length<4&&(c=[c[0],c[1],c[0],c[1]]),this.state.model.setUniforms(e).setUniforms({billboard:n,stroked:Boolean(u),padding:c,sizeUnits:v.d[o],sizeScale:i,sizeMinPixels:a,sizeMaxPixels:s}).draw()}},{key:"_getModel",value:function(t){return new b.a(t,E(E({},this.getShaders()),{},{id:this.props.id,geometry:new x.a({drawMode:6,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,1,1,0,1])}}}),isInstanced:!0}))}}]),r}(_.a);T.layerName="TextBackgroundLayer",T.defaultProps=O},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(290),l=r(33),h=r(18),f=r(32),p=r(66),d=r(137),A=r(206);function g(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var y=function(){function t(e,r,n){a()(this,t),this.id=e,this.context=n,this._loadCount=0,this._subscribers=new Set,this.setData(r)}return u()(t,[{key:"subscribe",value:function(t){this._subscribers.add(t)}},{key:"unsubscribe",value:function(t){this._subscribers.delete(t)}},{key:"inUse",value:function(){return this._subscribers.size>0}},{key:"delete",value:function(){}},{key:"getData",value:function(){var t=this;return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then((function(){return t.getData()}))}},{key:"setData",value:function(t,e){var r=this;if(t!==this._data||e){this._data=t;var n=++this._loadCount,i=t;"string"==typeof t&&(i=Object(A.a)(t)),i instanceof Promise?(this.isLoaded=!1,this._loader=i.then((function(t){r._loadCount===n&&(r.isLoaded=!0,r._error=null,r._content=t)})).catch((function(t){r._loadCount===n&&(r.isLoaded=!0,r._error=t||!0)}))):(this.isLoaded=!0,this._error=null,this._content=t);var o,a=g(this._subscribers);try{for(a.s();!(o=a.n()).done;){o.value.onChange(this.getData())}}catch(t){a.e(t)}finally{a.f()}}}}]),t}(),v=function(){function t(e){var r=e.gl,n=e.protocol;a()(this,t),this.protocol=n||"resource://",this._context={gl:r,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}return u()(t,[{key:"contains",value:function(t){return!!t.startsWith(this.protocol)||t in this._resources}},{key:"add",value:function(t){var e=t.resourceId,r=t.data,n=t.forceUpdate,i=void 0!==n&&n,o=t.persistent,a=void 0===o||o,s=this._resources[e];s?s.setData(r,i):(s=new y(e,r,this._context),this._resources[e]=s),s.persistent=a}},{key:"remove",value:function(t){var e=this._resources[t];e&&(e.delete(),delete this._resources[t])}},{key:"unsubscribe",value:function(t){var e=t.consumerId,r=this._consumers[e];if(r){for(var n in r){var i=r[n];i.resource&&i.resource.unsubscribe(i)}delete this._consumers[e],this.prune()}}},{key:"subscribe",value:function(t){var e=t.resourceId,r=t.onChange,n=t.consumerId,i=t.requestId,o=void 0===i?"default":i,a=this._resources,s=this.protocol;e.startsWith(s)&&(a[e=e.replace(s,"")]||this.add({resourceId:e,data:null,persistent:!1}));var u=a[e];if(this._track(n,o,u,r),u)return u.getData()}},{key:"prune",value:function(){var t=this;this._pruneRequest||(this._pruneRequest=setTimeout((function(){return t._prune()}),0))}},{key:"finalize",value:function(){for(var t in this._resources)this._resources[t].delete()}},{key:"_track",value:function(t,e,r,n){var i=this._consumers,o=i[t]=i[t]||{},a=o[e]||{};a.resource&&(a.resource.unsubscribe(a),a.resource=null,this.prune()),r&&(o[e]=a,a.onChange=n,a.resource=r,r.subscribe(a))}},{key:"_prune",value:function(){this._pruneRequest=null;for(var t=0,e=Object.keys(this._resources);t<e.length;t++){var r=e[t],n=this._resources[r];n.persistent||n.inUse()||(n.delete(),delete this._resources[r])}}}]),t}(),_=r(40),b=r(152);function x(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return T}));var O=Object.seal({layerManager:null,resourceManager:null,deck:null,gl:null,stats:null,shaderCache:null,pickingFBO:null,mousePosition:null,userData:{}}),T=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.deck,i=r.stats,o=r.viewport,s=r.timeline;a()(this,t),this.lastRenderedLayers=[],this.layers=[],this.resourceManager=new v({gl:e,protocol:"deck://"}),this.context=S(S({},O),{},{layerManager:this,gl:e,deck:n,programManager:e&&Object(b.a)(e),stats:i||new d.a({id:"deck.gl"}),viewport:o||new _.a({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:s||new c.a,resourceManager:this.resourceManager}),this._nextLayers=null,this._needsRedraw="Initial render",this._needsUpdate=!1,this._debug=!1,this.activateViewport=this.activateViewport.bind(this),Object.seal(this)}return u()(t,[{key:"finalize",value:function(){this.resourceManager.finalize();var t,e=x(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._finalizeLayer(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);var r,n=x(this.layers);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=i.getNeedsRedraw(t);e=e||o}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"needsUpdate",value:function(){return this._nextLayers&&this._nextLayers!==this.lastRenderedLayers?"layers changed":this._needsUpdate}},{key:"setNeedsRedraw",value:function(t){this._needsRedraw=this._needsRedraw||t}},{key:"setNeedsUpdate",value:function(t){this._needsUpdate=this._needsUpdate||t}},{key:"getLayers",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.layerIds,r=void 0===e?null:e;return r?this.layers.filter((function(t){return r.find((function(e){return 0===t.id.indexOf(e)}))})):this.layers}},{key:"setProps",value:function(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}},{key:"setLayers",value:function(t,e){Object(f.a)("layerManager.setLayers",this,e,t),this.lastRenderedLayers=t;var r,n=x(t=Object(p.b)(t,Boolean));try{for(n.s();!(r=n.n()).done;){r.value.context=this.context}}catch(t){n.e(t)}finally{n.f()}return this._updateLayers(this.layers,t),this}},{key:"updateLayers",value:function(){var t=this.needsUpdate();t&&(this.setNeedsRedraw("updating layers: ".concat(t)),this.setLayers(this._nextLayers||this.lastRenderedLayers,t)),this._nextLayers=null}},{key:"activateViewport",value:function(t){return Object(f.a)("layerManager.activateViewport",this,t),t&&(this.context.viewport=t),this}},{key:"_handleError",value:function(t,e,r){r.raiseError(e,"".concat(t," of ").concat(r))}},{key:"_updateLayers",value:function(t,e){var r,n={},i=x(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;n[o.id]?h.a.warn("Multiple old layers with same id ".concat(o.id))():n[o.id]=o}}catch(t){i.e(t)}finally{i.f()}var a=[];this._updateSublayersRecursively(e,n,a),this._finalizeOldLayers(n);for(var s=!1,u=0,c=a;u<c.length;u++){if(c[u].hasUniformTransition()){s=!0;break}}this._needsUpdate=s,this.layers=a}},{key:"_updateSublayersRecursively",value:function(t,e,r){var n,i=x(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.context=this.context;var a=e[o.id];null===a&&h.a.warn("Multiple new layers with same id ".concat(o.id))(),e[o.id]=null;var s=null;try{this._debug&&a!==o&&o.validateProps(),a?(this._transferLayerState(a,o),this._updateLayer(o)):this._initializeLayer(o),r.push(o),s=o.isComposite&&o.getSubLayers()}catch(t){this._handleError("matching",t,o)}s&&this._updateSublayersRecursively(s,e,r)}}catch(t){i.e(t)}finally{i.f()}}},{key:"_finalizeOldLayers",value:function(t){for(var e in t){var r=t[e];r&&this._finalizeLayer(r)}}},{key:"_initializeLayer",value:function(t){try{t._initialize(),t.lifecycle=l.a.INITIALIZED}catch(e){this._handleError("initialization",e,t)}}},{key:"_transferLayerState",value:function(t,e){e._transferState(t),e.lifecycle=l.a.MATCHED,e!==t&&(t.lifecycle=l.a.AWAITING_GC)}},{key:"_updateLayer",value:function(t){try{t._update()}catch(e){this._handleError("update",e,t)}}},{key:"_finalizeLayer",value:function(t){this._needsRedraw=this._needsRedraw||"finalized ".concat(t),t.lifecycle=l.a.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=l.a.FINALIZED}catch(e){this._handleError("finalization",e,t)}}}]),t}()},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(18),y=r(110);function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function b(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return w}));var x=[],w=function(t){f()(r,t);var e=b(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return _(_({},l()(g()(r.prototype),"getShaders",this).call(this)),{},{fs:"#define SHADER_NAME multi-icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float gamma;\nuniform bool sdf;\nuniform float alphaCutoff;\nuniform float buffer;\nuniform float outlineBuffer;\nuniform vec4 outlineColor;\n\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n  geometry.uv = uv;\n\n  if (!picking_uActive) {\n    float alpha = texture2D(iconsTexture, vTextureCoords).a;\n    vec4 color = vColor;\n    if (sdf) {\n      float distance = alpha;\n      alpha = smoothstep(buffer - gamma, buffer + gamma, distance);\n\n      if (outlineBuffer > 0.0) {\n        float inFill = alpha;\n        float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\n        color = mix(outlineColor, vColor, inFill);\n        alpha = inBorder;\n      }\n    }\n    float a = alpha * color.a;\n    \n    if (a < alphaCutoff) {\n      discard;\n    }\n\n    gl_FragColor = vec4(color.rgb, a * opacity);\n  }\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n"})}},{key:"initializeState",value:function(){var t=this;l()(g()(r.prototype),"initializeState",this).call(this),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:5121,size:3,accessor:function(e,r){var n=r.index,i=r.target;return t.encodePickingColor(n,i)}}})}},{key:"updateState",value:function(t){l()(g()(r.prototype),"updateState",this).call(this,t);var e=t.props,n=t.oldProps,i=e.outlineColor;i!==n.outlineColor&&((i=i.map((function(t){return t/255})))[3]=Number.isFinite(i[3])?i[3]:1,this.setState({outlineColor:i})),!e.sdf&&e.outlineWidth&&m.a.warn("".concat(this.id,": fontSettings.sdf is required to render outline"))()}},{key:"draw",value:function(t){var e=this.props,n=e.sdf,i=e.smoothing,o=e.outlineWidth,a=this.state.outlineColor;t.uniforms=_(_({},t.uniforms),{},{buffer:.75,outlineBuffer:o?Math.max(i,.75*(1-o)):-1,gamma:i,sdf:Boolean(n),outlineColor:a}),l()(g()(r.prototype),"draw",this).call(this,t)}},{key:"getInstanceOffset",value:function(t){var e=this;return t?Array.from(t).map((function(t){return l()(g()(r.prototype),"getInstanceOffset",e).call(e,t)})):x}},{key:"getInstanceColorMode",value:function(t){return 1}},{key:"getInstanceIconFrame",value:function(t){var e=this;return t?Array.from(t).map((function(t){return l()(g()(r.prototype),"getInstanceIconFrame",e).call(e,t)})):x}}]),r}(y.a);w.layerName="MultiIconLayer",w.defaultProps={getIconOffsets:{type:"accessor",value:function(t){return t.offsets}},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}}},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(32),l=r(5),h=r.n(l),f=r(6),p=r.n(f),d=r(1),A=r.n(d);function g(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=A()(t);if(e){var i=A()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}var m=function(t){h()(r,t);var e=g(r);function r(){return a()(this,r),e.apply(this,arguments)}return r}(r(85).a),y=r(171),v=r(71);function _(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return E}));var E=function(){function t(e){a()(this,t),this.gl=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new m(e),this.pickLayersPass=new y.a(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}return u()(t,[{key:"setProps",value:function(t){"layerFilter"in t&&this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),"drawPickingColors"in t&&this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}},{key:"renderLayers",value:function(t){var e=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass;t.layerFilter=t.layerFilter||this.layerFilter,t.effects=t.effects||[],t.target=t.target||v.a.getDefaultFramebuffer(this.gl),this._preRender(t.effects,t);var r=this.lastPostProcessEffect?this.renderBuffers[0]:t.target,n=e.render(w(w({},t),{},{target:r}));this._postRender(t.effects,t),this.renderCount++,Object(c.a)("deckRenderer.renderLayers",this,n,t)}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}},{key:"finalize",value:function(){var t,e=this.renderBuffers,r=_(e);try{for(r.s();!(t=r.n()).done;){t.value.delete()}}catch(t){r.e(t)}finally{r.f()}e.length=0}},{key:"_preRender",value:function(t,e){var r,n=null,i=_(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.preRender(this.gl,e),o.postRender&&(n=o)}}catch(t){i.e(t)}finally{i.f()}n&&this._resizeRenderBuffers(),this.lastPostProcessEffect=n}},{key:"_resizeRenderBuffers",value:function(){var t=this.renderBuffers;0===t.length&&t.push(new v.a(this.gl),new v.a(this.gl));var e,r=_(t);try{for(r.s();!(e=r.n()).done;){e.value.resize()}}catch(t){r.e(t)}finally{r.f()}}},{key:"_postRender",value:function(t,e){var r,n=this.renderBuffers,i={inputBuffer:n[0],swapBuffer:n[1],target:null},o=_(t);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(a.postRender){if(a===this.lastPostProcessEffect){i.target=e.target,a.postRender(this.gl,i);break}var s=a.postRender(this.gl,i);i.inputBuffer=s,i.swapBuffer=s===n[0]?n[1]:n[0]}}}catch(t){o.e(t)}finally{o.f()}}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return d}));var n=r(24),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c);function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function f(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var p={onIninitialize:function(t){return t},onFinalize:function(t){return t},onMessage:null},d=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Transport";u()(this,t),this.name=e,this._messageQueue=[],this.userData={}}return l()(t,null,[{key:"setCallbacks",value:function(t){var e=t.onInitialize,r=t.onFinalize,n=t.onMessage;e&&(p.onInitialize=e),r&&(p.onFinalize=r),n&&(p.onMessage=n)}}]),l()(t,[{key:"getRootDOMElement",value:function(){return"undefined"!=typeof document?document.body:null}},{key:"sendJSONMessage",value:function(){console.error("Back-channel not implemented for this transport")}},{key:"sendBinaryMessage",value:function(){console.error("Back-channel not implemented for this transport")}},{key:"_initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=f({transport:this},t);p.onInitialize(e)}},{key:"_finalize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=f({transport:this},t);p.onFinalize(e),this._destroyed=!0}},{key:"_messageReceived",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=f({transport:this},t),console.debug("Delivering transport message",t),p.onMessage(t)}}],[{key:"_stringifyJSONSafe",value:function(t){var e=new Set;return JSON.stringify(t,(function(t,r){if("object"===i()(r)&&null!==r){if(e.has(r))try{return JSON.parse(JSON.stringify(r))}catch(t){return}e.add(r)}return r}))}}]),t}()},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));var n=r(166);function i(){return!("object"==typeof t&&"[object process]"===String(t)&&!t.browser)||Object(n.a)()}}).call(this,r(57))},function(t,e,r){"use strict";(function(t){function n(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"==typeof t.versions&&Boolean(t.versions.electron))return!0;const r="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;return!!(n&&n.indexOf("Electron")>=0)}r.d(e,"a",(function(){return n}))}).call(this,r(57))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(7);function i(t,e,r,i){const o=`See luma.gl ${r} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,a=Object.getPrototypeOf(t);i.forEach(t=>{a.methodName||(a[t]=()=>{throw n.k.removed(`Calling removed method ${e}.${t}: `,o)(),new Error(t)})})}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(111),i=r(23),o=r(42);class a extends n.a{get ELEMENTS(){return Object(o.a)(!1),0}copy(t){return Object(o.a)(!1),this}get x(){return this[0]}set x(t){this[0]=Object(i.a)(t)}get y(){return this[1]}set y(t){this[1]=Object(i.a)(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Object(i.a)(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Object(i.a)(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Object(o.a)(t>=0&&t<this.ELEMENTS,"index is out of range"),Object(i.a)(this[t])}setComponent(t,e){return Object(o.a)(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(111),i=r(23),o=r(13),a=r(42);class s extends n.a{get ELEMENTS(){return Object(a.a)(!1),0}get RANK(){return Object(a.a)(!1),0}toString(){let t="[";if(o.b.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+e]}`}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=` ${this[e]}`}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Object(i.a)(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return h}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var h=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a()(this,t);var n=r.id,i=void 0===n?"pass":n;this.id=i,this.gl=e,this.props=l({},r)}return u()(t,[{key:"setProps",value:function(t){Object.assign(this.props,t)}},{key:"render",value:function(){}},{key:"cleanup",value:function(){}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(85),y=r(7),v=r(18);function _(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var w={blendFunc:[1,0,32771,0],blendEquation:32774},E=function(t){f()(r,t);var e=x(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"render",value:function(t){return t.pickingFBO?this._drawPickingBuffer(t):l()(g()(r.prototype),"render",this).call(this,t)}},{key:"_drawPickingBuffer",value:function(t){var e=this,n=t.layers,i=t.layerFilter,o=t.views,a=t.viewports,s=t.onViewportActive,u=t.pickingFBO,c=t.deviceRect,h=c.x,f=c.y,p=c.width,d=c.height,A=t.pass,m=void 0===A?"picking":A,v=t.redrawReason,_=t.pickZ,x=this.gl;this.pickZ=_;var E=!_&&{byLayer:new Map,byAlpha:[]};this._colors=E;var O=Object(y.o)(x,b(b({scissorTest:!0,scissor:[h,f,p,d],clearColor:[0,0,0,0],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0]},w),{},{blend:!_}),(function(){return l()(g()(r.prototype),"render",e).call(e,{target:u,layers:n,layerFilter:i,views:o,viewports:a,onViewportActive:s,pass:m,redrawReason:v})}));return this._colors=null,{decodePickingColor:E&&S.bind(null,E),stats:O}}},{key:"shouldDrawLayer",value:function(t){return t.props.pickable}},{key:"getModuleParameters",value:function(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}},{key:"getLayerParameters",value:function(t,e,r){var n=b({},t.props.parameters);return this.pickZ?n.blend=!1:(Object.assign(n,w),n.blend=!0,n.blendColor=function(t,e,r){var n,i=t.byLayer,o=t.byAlpha;if(i.has(e)){var a=i.get(e);a.viewports.push(r),n=a.a}else if((n=i.size+1)<=255){var s={a:n,layer:e,viewports:[r]};i.set(e,s),o[n]=s}else v.a.warn("Too many pickable layers, only picking the first 255")(),n=0;return[0,0,0,n/255]}(this._colors,t,r)),n}}]),r}(m.a);function S(t,e){var r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));function n(t){const e=i(t);return function(t){const e=i(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,!1)))return null;return{mimeType:"image/png",width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}(e)||function(t){const e=i(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,!1)&&255===e.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let o=2;for(;o+9<e.byteLength;){const t=e.getUint16(o,!1);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(o+5,!1),width:e.getUint16(o+7,!1)};if(!r.has(t))return null;o+=2,o+=e.getUint16(o,!1)}return null}(e)||function(t){const e=i(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:e.getUint16(6,!0),height:e.getUint16(8,!0)}}(e)||function(t){const e=i(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,!1)&&e.getUint32(2,!0)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,!0),height:e.getUint32(22,!0)}}(e)}function i(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}},function(t,e,r){"use strict";function n(t){for(var e=t.data,r=t.getIndex,n=t.dataRange,i=t.replace,o=n.startRow,a=void 0===o?0:o,s=n.endRow,u=void 0===s?1/0:s,c=e.length,l=c,h=c,f=0;f<c;f++){var p=r(e[f]);if(l>f&&p>=a&&(l=f),p>=u){h=f;break}}for(var d=l,A=h-l!==i.length,g=A&&e.slice(h),m=0;m<i.length;m++)e[d++]=i[m];if(A){for(var y=0;y<g.length;y++)e[d++]=g[y];e.length=d}return{startRow:l,endRow:l+i.length}}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";function n(t){var e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function i(t,e){var r=document.createElement("div");return r.style.width=Number.isFinite(t)?"".concat(t,"px"):t,r.style.height="".concat(e,"px"),r.style.position="relative",r}r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i}))},function(t,e,r){"use strict";const n={name:"Draco",id:"draco",module:"draco",version:"3.0.8",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};var i=r(4);class o{constructor(t,e){Object(i.a)(this,"fields",void 0),Object(i.a)(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const r of t)e[r.name]&&console.warn("Schema: duplicated field name",r.name,r),e[r.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){const e=Object.create(null);for(const r of t)e[r]=!0;const r=this.fields.filter(t=>e[t.name]);return new o(r,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new o(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof o){const n=t;e=n.fields,r=a(a(new Map,this.metadata),n.metadata)}else e=t;const n=Object.create(null);for(const t of this.fields)n[t.name]=t;for(const t of e)n[t.name]=t;const i=Object.values(n);return new o(i,r)}}function a(t,e){return new Map([...t||new Map,...e||new Map])}let s,u,c,l,h,f,p,d;!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(s||(s={}));class A{static isNull(t){return t&&t.typeId===s.Null}static isInt(t){return t&&t.typeId===s.Int}static isFloat(t){return t&&t.typeId===s.Float}static isBinary(t){return t&&t.typeId===s.Binary}static isUtf8(t){return t&&t.typeId===s.Utf8}static isBool(t){return t&&t.typeId===s.Bool}static isDecimal(t){return t&&t.typeId===s.Decimal}static isDate(t){return t&&t.typeId===s.Date}static isTime(t){return t&&t.typeId===s.Time}static isTimestamp(t){return t&&t.typeId===s.Timestamp}static isInterval(t){return t&&t.typeId===s.Interval}static isList(t){return t&&t.typeId===s.List}static isStruct(t){return t&&t.typeId===s.Struct}static isUnion(t){return t&&t.typeId===s.Union}static isFixedSizeBinary(t){return t&&t.typeId===s.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===s.FixedSizeList}static isMap(t){return t&&t.typeId===s.Map}static isDictionary(t){return t&&t.typeId===s.Dictionary}get typeId(){return s.NONE}compareTo(t){return this===t}}u=Symbol.toStringTag;class g extends A{constructor(t,e){super(),Object(i.a)(this,"isSigned",void 0),Object(i.a)(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return s.Int}get[u](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class m extends g{constructor(){super(!0,8)}}class y extends g{constructor(){super(!0,16)}}class v extends g{constructor(){super(!0,32)}}class _ extends g{constructor(){super(!1,8)}}class b extends g{constructor(){super(!1,16)}}class x extends g{constructor(){super(!1,32)}}const w=32,E=64;c=Symbol.toStringTag;class S extends A{constructor(t){super(),Object(i.a)(this,"precision",void 0),this.precision=t}get typeId(){return s.Float}get[c](){return"Float"}toString(){return`Float${this.precision}`}}class O extends S{constructor(){super(w)}}class T extends S{constructor(){super(E)}}l=Symbol.toStringTag;h=Symbol.toStringTag;f=Symbol.toStringTag;p=Symbol.toStringTag;d=Symbol.toStringTag;class P extends A{constructor(t,e){super(),Object(i.a)(this,"listSize",void 0),Object(i.a)(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return s.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[d](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}class M{constructor(t,e,r=!1,n=new Map){Object(i.a)(this,"name",void 0),Object(i.a)(this,"type",void 0),Object(i.a)(this,"nullable",void 0),Object(i.a)(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new M(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?`, metadata: ${this.metadata}`:""}`}}function C(t,e,r){const n=r?I(r.metadata):void 0,i=function(t){switch(t.constructor){case Int8Array:return new m;case Uint8Array:return new _;case Int16Array:return new y;case Uint16Array:return new b;case Int32Array:return new v;case Uint32Array:return new x;case Float32Array:return new O;case Float64Array:return new T;default:throw new Error("array type not supported")}}(e.value);return new M(t,new P(e.size,new M("value",i)),!1,n)}function I(t){const e=new Map;for(const r in t)e.set(`${r}.string`,JSON.stringify(t[r]));return e}const k={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},R={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class L{constructor(t){Object(i.a)(this,"draco",void 0),Object(i.a)(this,"decoder",void 0),Object(i.a)(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(n){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e=`DRACO decompression failed: ${t.error_msg()}`;throw new Error(e)}const a=this._getDracoLoaderData(i,n,e),s=this._getMeshData(i,a,e),u=function(t){let e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0;const s=t.POSITION?t.POSITION.value:[],u=s&&s.length;for(let t=0;t<u;t+=3){const u=s[t],c=s[t+1],l=s[t+2];e=u<e?u:e,r=c<r?c:r,n=l<n?l:n,i=u>i?u:i,o=c>o?c:o,a=l>a?l:a}return[[e,r,n],[i,o,a]]}(s.attributes),c=function(t,e,r){const n=I(e.metadata),i=[],a=function(t){const e={};for(const r in t){const n=t[r];e[n.name||"undefined"]=n}return e}(e.attributes);for(const e in t){const r=C(e,t[e],a[e]);i.push(r)}if(r){const t=C("indices",r);i.push(t)}return new o(i,n)}(s.attributes,a,s.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:u},...s,schema:c}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const i=this.decoder.GetAttribute(t,n),o=this._getAttributeMetadata(t,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:o};const a=this._getQuantizationTransform(i,e);a&&(r[i.unique_id()].quantization_transform=a);const s=this._getOctahedronTransform(i,e);s&&(r[i.unique_id()].octahedron_transform=s)}return r}_getMeshData(t,e,r){const n=this._getMeshAttributes(e,t,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const i of Object.values(t.attributes)){const t=this._deduceAttributeName(i,r);i.name=t;const{value:o,size:a}=this._getAttributeValues(e,i);n[t]={value:o,size:a,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(t){const e=3*t.num_faces(),r=4*e,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(t,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,e).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){const e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){const r=R[e.data_type],n=e.num_components,i=t.num_points()*n,o=i*r.BYTES_PER_ELEMENT,a=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}(this.draco,r);let s;const u=this.draco._malloc(o);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,a,o,u),s=new r(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}return{value:s,size:n}}_deduceAttributeName(t,e){const r=t.unique_id;for(const[t,n]of Object.entries(e.extraAttributes||{}))if(n===r)return t;const n=t.attribute_type;for(const t in k){if(this.draco[t]===n)return k[t]}const i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){const e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){const r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};const e={},r=this.metadataQuerier.NumEntries(t);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(t,n);e[r]=this._getDracoMetadataField(t,r)}return e}_getDracoMetadataField(t,e){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);const n=function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){const{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,n=[...e,...r];for(const t of n)this.decoder.SkipAttributeTransform(this.draco[t])}_getQuantizationTransform(t,e){const{quantizedAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map(t=>e.min_value(t))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}var j=r(76),D=r(141),B=r(52);const F={};async function z(t,e=null,r={}){return e&&(t=function(t,e,r){if(t.startsWith("http"))return t;const n=r.modules||{};if(n[t])return n[t];if(!j.b)return`modules/${e}/dist/libs/${t}`;if(r.CDN)return Object(B.a)(r.CDN.startsWith("http")),`${r.CDN}/${e}@3.0.8/dist/libs/${t}`;if(j.d)return`../src/libs/${t}`;return`modules/${e}/src/libs/${t}`}(t,e,r)),F[t]=F[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!j.b)return D.requireFromFile&&await D.requireFromFile(t);if(j.d)return importScripts(t);const e=await fetch(t);return function(t,e){if(!j.b)return D.requireFromString&&D.requireFromString(t,e);if(j.d)return eval.call(j.a,t),null;const r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch(e){r.text=t}return document.body.appendChild(r),null}(await e.text(),t)}(t),await F[t]}let N;async function U(t){const e=t.modules||{};return N=e.draco3d?N||e.draco3d.createDecoderModule({}).then(t=>({draco:t})):N||async function(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await z("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",t);break;case"wasm":default:[e,r]=await Promise.all([await z("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",t),await z("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",t)])}return e=e||globalThis.DracoDecoderModule,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise(e=>{t({...r,onModuleLoaded:t=>e({draco:t})})})}(e,r)}(t),await N}r.d(e,"a",(function(){return V}));const V={...n,parse:async function(t,e){const{draco:r}=await U(e),n=new L(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}}},function(t,e,r){"use strict";var n=r(7),i=r(195),o=r(48),a=r(9),s=r(178),u=r(293),c=r(64),l=r(34),h=r(39);let f=null;function p(t,e){var r;return new t((r=t.BYTES_PER_ELEMENT*e,(!f||f.byteLength<r)&&(f=new ArrayBuffer(r)),f),0,e)}var d=r(59),A=r(165),g=r(166);class m extends h.a{static isSupported(t,e={}){return!e.constantAttributeZero||(Object(n.j)(t)||"Chrome"===function(t){if(!t&&!Object(A.a)())return"Node";if(Object(g.a)(t))return"Electron";const e="undefined"!=typeof navigator?navigator:{},r=t||e.userAgent||"";if(r.indexOf("Edge")>-1)return"Edge";const n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i?"IE":d.b.chrome?"Chrome":d.b.safari?"Safari":d.b.mozInnerScreenX?"Firefox":"Unknown"}())}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new m(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return m.MAX_ATTRIBUTES=m.MAX_ATTRIBUTES||t.getParameter(34921),m.MAX_ATTRIBUTES}static setConstant(t,e,r){switch(r.constructor){case Float32Array:m._setConstantFloatArray(t,e,r);break;case Int32Array:m._setConstantIntArray(t,e,r);break;case Uint32Array:m._setConstantUintArray(t,e,r);break;default:Object(a.a)(!1)}}constructor(t,e={}){const r=e.id||e.program&&e.program.id;super(t,Object.assign({},e,{id:r})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=e.isDefaultArray||!1,this.gl2=t,this.initialize(e),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return m.getMaxAttributes(this.gl)}initialize(t={}){return this.setProps(t)}setProps(t){return this}setElementBuffer(t=null,e={}){return Object(a.a)(!t||34963===t.target,"elements must be GL.ELEMENT_ARRAY_BUFFER"),this.bind(()=>{this.gl.bindBuffer(34963,t?t.handle:null)}),this}setBuffer(t,e,r){if(34963===e.target)return this.setElementBuffer(e,r);const{size:i,type:o,stride:s,offset:u,normalized:c,integer:l,divisor:h}=r,{gl:f,gl2:p}=this;return t=Number(t),this.bind(()=>{f.bindBuffer(34962,e.handle),l?(Object(a.a)(Object(n.j)(f)),p.vertexAttribIPointer(t,i,o,s,u)):f.vertexAttribPointer(t,i,o,c,s,u),f.enableVertexAttribArray(t),p.vertexAttribDivisor(t,h||0)}),this}enable(t,e=!0){return!e&&0===t&&!m.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind(()=>e?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t))),this}getConstantBuffer(t,e){const r=this._normalizeConstantArrayValue(e),n=r.byteLength*t,i=r.length*t;let o=!this.buffer;if(this.buffer=this.buffer||new l.a(this.gl,n),o=o||this.buffer.reallocate(n),o=o||!this._compareConstantArrayValues(r,this.bufferValue),o){const t=p(e.constructor,i);!function({target:t,source:e,start:r=0,count:n=1}){const i=e.length,o=n*i;let a=0;for(let n=r;a<i;a++)t[n++]=e[a];for(;a<o;)a<o-a?(t.copyWithin(r+a,r,r+a),a*=2):(t.copyWithin(r+a,r,r+o-a),a=o)}({target:t,source:r,start:0,count:i}),this.buffer.subData(t),this.bufferValue=e}return this.buffer}_normalizeConstantArrayValue(t){return Array.isArray(t)?new Float32Array(t):t}_compareConstantArrayValues(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}static _setConstantFloatArray(t,e,r){switch(r.length){case 1:t.vertexAttrib1fv(e,r);break;case 2:t.vertexAttrib2fv(e,r);break;case 3:t.vertexAttrib3fv(e,r);break;case 4:t.vertexAttrib4fv(e,r);break;default:Object(a.a)(!1)}}static _setConstantIntArray(t,e,r){switch(Object(a.a)(Object(n.j)(t)),r.length){case 1:t.vertexAttribI1iv(e,r);break;case 2:t.vertexAttribI2iv(e,r);break;case 3:t.vertexAttribI3iv(e,r);break;case 4:t.vertexAttribI4iv(e,r);break;default:Object(a.a)(!1)}}static _setConstantUintArray(t,e,r){switch(Object(a.a)(Object(n.j)(t)),r.length){case 1:t.vertexAttribI1uiv(e,r);break;case 2:t.vertexAttribI2uiv(e,r);break;case 3:t.vertexAttribI3uiv(e,r);break;case 4:t.vertexAttribI4uiv(e,r);break;default:Object(a.a)(!1)}}_createHandle(){return this.gl.createVertexArray()}_deleteHandle(t){return this.gl2.deleteVertexArray(t),[this.elements]}_bindHandle(t){this.gl2.bindVertexArray(t)}_getParameter(t,{location:e}){return Object(a.a)(Number.isFinite(e)),this.bind(()=>{switch(t){case 34373:return this.gl.getVertexAttribOffset(e,t);default:return this.gl.getVertexAttrib(e,t)}})}}var y=r(167);const v=/^(.+)__LOCATION_([0-9]+)$/,_=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"];class b{constructor(t,e={}){const r=e.id||e.program&&e.program.id;this.id=r,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new m(t),Object(y.a)(this,"VertexArray","v6.0",_),this.initialize(e),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(t={}){return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;const{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"attributes"in t&&this.setAttributes(t.attributes),"elements"in t&&this.setElementBuffer(t.elements),"bindOnUse"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind(()=>{for(const e in t){const r=t[e];this._setAttribute(e,r)}this.gl.bindBuffer(34962,null)}),this}setElementBuffer(t=null,e={}){return this.elements=t,this.elementsAccessor=e,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,e),this}setBuffer(t,e,r={}){if(34963===e.target)return this.setElementBuffer(e,r);const{location:n,accessor:i}=this._resolveLocationAndAccessor(t,e,e.accessor,r);return n>=0&&(this.values[n]=e,this.accessors[n]=i,this.clearDrawParams(),this.vertexArrayObject.setBuffer(n,e,i)),this}setConstant(t,e,r={}){const{location:n,accessor:i}=this._resolveLocationAndAccessor(t,e,Object.assign({size:e.length},r));return n>=0&&(e=this.vertexArrayObject._normalizeConstantArrayValue(e),this.values[n]=e,this.accessors[n]=i,this.clearDrawParams(),this.vertexArrayObject.enable(n,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new l.a(this.gl,{accessor:{size:4}});for(let t=0;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++)this.values[t]instanceof l.a&&(this.gl.disableVertexAttribArray(t),this.gl.bindBuffer(34962,this.buffer.handle),this.gl.vertexAttribPointer(t,1,5126,!1,0,0))}),this}bindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++){const e=this.values[t];e instanceof l.a&&this.setBuffer(t,e)}}),this}bindForDraw(t,e,r){let n;return this.vertexArrayObject.bind(()=>{this._setConstantAttributes(t,e),n=r()}),n}_resolveLocationAndAccessor(t,e,r,i){const o={location:-1,accessor:null},{location:s,name:u}=this._getAttributeIndex(t);if(!Number.isFinite(s)||s<0)return this.unused[t]=e,n.k.once(3,()=>`unused value ${t} in ${this.id}`)(),o;const l=this._getAttributeInfo(u||s);if(!l)return o;const h=this.accessors[s]||{},f=c.a.resolve(l.accessor,h,r,i),{size:p,type:d}=f;return Object(a.a)(Number.isFinite(p)&&Number.isFinite(d)),{location:s,accessor:f}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){const e=Number(t);if(Number.isFinite(e))return{location:e};const r=v.exec(t),n=r?r[1]:t,i=r?Number(r[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(n)+i,name:n}:{location:-1}}_setAttribute(t,e){if(e instanceof l.a)this.setBuffer(t,e);else if(Array.isArray(e)&&e.length&&e[0]instanceof l.a){const r=e[0],n=e[1];this.setBuffer(t,r,n)}else if(ArrayBuffer.isView(e)||Array.isArray(e)){const r=e;this.setConstant(t,r)}else{if(!(e.buffer instanceof l.a))throw new Error("VertexArray: attributes must be Buffers or constants (i.e. typed array)");{const r=e;this.setBuffer(t,r.buffer,r)}}}_setConstantAttributes(t,e){const r=Math.max(0|t,0|e);let n=this.values[0];ArrayBuffer.isView(n)&&this._setConstantAttributeZero(n,r);for(let t=1;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++)n=this.values[t],ArrayBuffer.isView(n)&&this._setConstantAttribute(t,n)}_setConstantAttributeZero(t,e){if(m.isSupported(this.gl,{constantAttributeZero:!0}))return void this._setConstantAttribute(0,t);const r=this.vertexArrayObject.getConstantBuffer(e,t);this.vertexArrayObject.setBuffer(0,r,this.accessors[0])}_setConstantAttribute(t,e){m.setConstant(this.gl,t,e)}_updateDrawParams(){const t={isIndexed:!1,isInstanced:!1,indexCount:1/0,vertexCount:1/0,instanceCount:1/0};for(let e=0;e<this.vertexArrayObject.MAX_ATTRIBUTES;e++)this._updateDrawParamsForLocation(t,e);return this.elements&&(t.elementCount=this.elements.getElementCount(this.elements.accessor),t.isIndexed=!0,t.indexType=this.elementsAccessor.type||this.elements.accessor.type,t.indexOffset=this.elementsAccessor.offset||0),t.indexCount===1/0&&(t.indexCount=0),t.vertexCount===1/0&&(t.vertexCount=0),t.instanceCount===1/0&&(t.instanceCount=0),t}_updateDrawParamsForLocation(t,e){const r=this.values[e],n=this.accessors[e];if(!r)return;const{divisor:i}=n,o=i>0;if(t.isInstanced=t.isInstanced||o,r instanceof l.a){const e=r;if(o){const r=e.getVertexCount(n);t.instanceCount=Math.min(t.instanceCount,r)}else{const r=e.getVertexCount(n);t.vertexCount=Math.min(t.vertexCount,r)}}}setElements(t=null,e={}){return n.k.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(t,e)}}var x=r(289),w=r(49),E=r(81);function S(t,e={}){const{isInteger:r=!1}=e;if(Array.isArray(t)||ArrayBuffer.isView(t))return function(t,e){const{maxElts:r=16,size:n=1}=e;let i="[";for(let o=0;o<t.length&&o<r;++o)o>0&&(i+=`,${o%n==0?" ":""}`),i+=S(t[o],e);return`${i}${t.length>r?"...":"]"}`}(t,e);if(!Number.isFinite(t))return String(t);if(Math.abs(t)<1e-16)return r?"0":"0.";if(r)return t.toFixed(0);if(Math.abs(t)>100&&Math.abs(t)<1e4)return t.toFixed(0);const n=t.toPrecision(2);return n.indexOf(".0")===n.length-2?n.slice(0,-1):n}function O(t,e,r,n){const{gl:i}=t;if(!e)return{[n]:"null","Format ":"N/A"};let o,a,s,u="NOT PROVIDED",c=1,h=0,f=0;if(r&&(u=r.type,c=r.size,u=String(u).replace("Array",""),o=-1!==u.indexOf("nt")),e instanceof l.a){const t=e,{data:l,changed:p}=t.getDebugData();let d;if(a=p?"*":"",s=l,f=t.byteLength,h=f/l.BYTES_PER_ELEMENT/c,r){d=`${r.divisor>0?"I ":"P "} ${h} (x${c}=${f} bytes ${Object(w.a)(i,u)})`}else o=!0,d=`${f} bytes`;return{[n]:`${a}${S(s,{size:c,isInteger:o})}`,"Format ":d}}return s=e,c=e.length,u=String(e.constructor.name).replace("Array",""),o=-1!==u.indexOf("nt"),{[n]:`${S(s,{size:c,isInteger:o})} (constant)`,"Format ":`${c}x${u} (constant)`}}function T(t,e){const{type:r,size:n}=e,i=Object(E.b)(r,n);return i?`${t} (${i.name})`:t}function P({header:t="Uniforms",program:e,uniforms:r,undefinedOnly:n=!1}){Object(a.a)(e);const i=e._uniformSetters,o={},s=Object.keys(i).sort();let u=0;for(const e of s)e.match(".*_.*")||e.match(".*Matrix")||M({table:o,header:t,uniforms:r,uniformName:e,undefinedOnly:n})&&u++;for(const e of s)e.match(".*Matrix")&&M({table:o,header:t,uniforms:r,uniformName:e,undefinedOnly:n})&&u++;for(const e of s)o[e]||M({table:o,header:t,uniforms:r,uniformName:e,undefinedOnly:n})&&u++;let c=0;const l={};if(!n)for(const e in r){const n=r[e];o[e]||(c++,l[e]={Type:`NOT USED: ${n}`,[t]:S(n)})}return{table:o,count:u,unusedTable:l,unusedCount:c}}function M({table:t,header:e,uniforms:r,uniformName:n,undefinedOnly:i}){const o=r[n],a=function(t){return null!=t}(o);return(!i||!a)&&(t[n]={[e]:a?S(o):"N/A","Uniform Type":a?o:"NOT PROVIDED"},!0)}function C(t){const{type:e,size:r}=t.accessor,n=Object(E.b)(e,r);return n?`${n.name} ${t.name}`:t.name}const I={POSITION:"positions",NORMAL:"normals",COLOR_0:"colors",TEXCOORD_0:"texCoords",TEXCOORD_1:"texCoords1",TEXCOORD_2:"texCoords2"};function k(t,e){const{attributeMap:r=I}=e||{};return r&&r[t]||t}function R(t,e){let r;switch(t){case"texCoords":case"texCoord1":case"texCoord2":case"texCoord3":r="uvs";break;case"vertices":case"positions":case"normals":case"pickingColors":r="vectors"}switch(r){case"vectors":e.size=e.size||3;break;case"uvs":e.size=e.size||2}Object(a.a)(Number.isFinite(e.size),`attribute ${t} needs size`)}r.d(e,"a",(function(){return D}));const L=()=>{},j={};class D{constructor(t,e={}){const{id:r=Object(o.c)("model")}=e;Object(a.a)(Object(n.i)(t)),this.id=r,this.gl=t,this.id=e.id||Object(o.c)("Model"),this.lastLogTime=0,this.animated=!1,this.initialize(e)}initialize(t){this.props={},this.programManager=t.programManager||i.a.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;const{program:e=null,vs:r,fs:n,modules:o,defines:s,inject:u,varyings:c,bufferMode:l,transpileToGLSL100:h}=t;this.programProps={program:e,vs:r,fs:n,modules:o,defines:s,inject:u,varyings:c,bufferMode:l,transpileToGLSL100:h},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=void 0!==t.drawMode?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},Object(a.a)(void 0!==this.drawMode&&Number.isFinite(this.vertexCount),"Model needs drawMode and vertexCount")}setProps(t){this._setModelProps(t)}delete(){for(const t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){const{program:e,vs:r,fs:n,modules:i,defines:o,inject:a,varyings:s,bufferMode:u,transpileToGLSL100:c}=t;this.programProps={program:e,vs:r,fs:n,modules:i,defines:o,inject:a,varyings:s,bufferMode:u,transpileToGLSL100:c},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return Object(a.a)(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return Object(a.a)(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=function(t,e,r){const n={};let i=e.indices;for(const o in e.attributes){const a=e.attributes[o],s=k(o,r);if("indices"===o)i=a;else if(a.constant)n[s]=a.value;else{const e=a.value,r={...a};delete r.value,n[s]=[new l.a(t,e),r],R(o,r)}}if(i){const e=i.value||i;Object(a.a)(e instanceof Uint16Array||e instanceof Uint32Array,'attribute array for "indices" must be of integer type');const r={size:1,isIndexed:void 0===i.isIndexed||i.isIndexed};n.indices=[new l.a(t,{data:e,target:34963}),r]}return n}(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(t={}){if(Object(o.a)(t))return this;const e={};for(const r in t){const n=t[r];e[r]=n.getValue?n.getValue():n}return this.vertexArray.setAttributes(e),this}setUniforms(t={}){return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();const e=this.programManager.getUniforms(this.program);return e?e(t):{}}updateModuleSettings(t){const e=this.getModuleUniforms(t||{});return this.setUniforms(e)}clear(t){return Object(s.a)(this.program.gl,t),this}draw(t={}){this._checkProgram();const{moduleSettings:e=null,framebuffer:r,uniforms:i={},attributes:o={},transformFeedback:a=this.transformFeedback,parameters:s={},vertexArray:u=this.vertexArray}=t;let c;this.setAttributes(o),this.updateModuleSettings(e),this.setUniforms(i),n.k.priority>=2&&(c=this._logDrawCallStart(2));const l=this.vertexArray.getDrawParams(),{isIndexed:h=l.isIndexed,indexType:f=l.indexType,indexOffset:p=l.indexOffset,vertexArrayInstanced:d=l.isInstanced}=this.props;d&&!this.isInstanced&&n.k.warn("Found instanced attributes on non-instanced model",this.id)();const{isInstanced:A,instanceCount:g}=this,{onBeforeRender:m=L,onAfterRender:y=L}=this.props;m(),this.program.setUniforms(this.uniforms);const v=this.program.draw(Object.assign(j,t,{logPriority:c,uniforms:null,framebuffer:r,parameters:s,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:u,transformFeedback:a,isIndexed:h,indexType:f,isInstanced:A,instanceCount:g,offset:h?p:0}));return y(),n.k.priority>=2&&this._logDrawCallEnd(c,u,r),v}transform(t={}){const{discard:e=!0,feedbackBuffers:r,unbindModels:n=[]}=t;let{parameters:i}=t;r&&this._setFeedbackBuffers(r),e&&(i=Object.assign({},i,{35977:e})),n.forEach(t=>t.vertexArray.unbindBuffers());try{this.draw(Object.assign({},t,{parameters:i}))}finally{n.forEach(t=>t.vertexArray.bindBuffers())}return this}render(t={}){return n.k.warn("Model.render() is deprecated. Use Model.setUniforms() and Model.draw()")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),"uniforms"in t&&this.setUniforms(t.uniforms),"pickable"in t&&(this.pickable=t.pickable),"instanceCount"in t&&(this.instanceCount=t.instanceCount),"geometry"in t&&this.setGeometry(t.geometry),"attributes"in t&&this.setAttributes(t.attributes),"_feedbackBuffers"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:t}=this.programProps;if(t)this._managedProgram=!1;else{const{vs:e,fs:r,modules:n,inject:i,defines:o,varyings:a,bufferMode:s,transpileToGLSL100:u}=this.programProps;t=this.programManager.get({vs:e,fs:r,modules:n,inject:i,defines:o,varyings:a,bufferMode:s,transpileToGLSL100:u}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}Object(a.a)(t instanceof u.a,"Model needs a program"),this._programDirty=!1,t!==this.program&&(this.program=t,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new b(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(const t in this.geometryBuffers){const e=this.geometryBuffers[t][0]||this.geometryBuffers[t];e instanceof l.a&&e.delete()}}_setAnimationProps(t){this.animated&&Object(a.a)(t,"Model.draw(): animated uniforms but no animationProps")}_setFeedbackBuffers(t={}){if(Object(o.a)(t))return this;const{gl:e}=this.program;return this.transformFeedback=this.transformFeedback||new x.a(e,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){const e=t>3?0:1e4;if(!(Date.now()-this.lastLogTime<e))return this.lastLogTime=Date.now(),n.k.group(2,`>>> DRAWING MODEL ${this.id}`,{collapsed:n.k.level<=2})(),t}_logDrawCallEnd(t,e,r,i){if(void 0===t)return;const o=function({vertexArray:t,header:e="Attributes"}){if(!t.configuration)return{};const r={};t.elements&&(r.ELEMENT_ARRAY_BUFFER=O(t,t.elements,null,e));const n=t.values;for(const i in n){const o=t._getAttributeInfo(i);if(o){let a=`${i}: ${o.name}`;const s=t.accessors[o.location];s&&(a=`${i}: ${T(o.name,s)}`),r[a]=O(t,n[i],s,e)}}return r}({vertexArray:e,header:`${this.id} attributes`,attributes:this._attributes}),{table:a,unusedTable:s,unusedCount:u}=P({header:`${this.id} uniforms`,program:this.program,uniforms:Object.assign({},this.program.uniforms,r)}),{table:c,count:l}=P({header:`${this.id} uniforms`,program:this.program,uniforms:Object.assign({},this.program.uniforms,r),undefinedOnly:!0});l>0&&n.k.log("MISSING UNIFORMS",Object.keys(c))(),u>0&&n.k.log("UNUSED UNIFORMS",Object.keys(s))();const h=function(t){const e={},r=`Accessors for ${t.id}`;for(const n of t.attributeInfos)if(n){e[`in ${C(n)}`]={[r]:JSON.stringify(n.accessor)}}for(const n of t.varyingInfos)if(n){e[`out ${C(n)}`]={[r]:JSON.stringify(n.accessor)}}return e}(this.vertexArray.configuration);n.k.table(t,o)(),n.k.table(t,a)(),n.k.table(t+1,h)(),i&&i.log({logLevel:2,message:`Rendered to ${i.id}`}),n.k.groupEnd(2,`>>> DRAWING MODEL ${this.id}`)()}}},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return a}));var n=r(7),i=r(9);function o(t,{framebuffer:e=null,color:r=null,depth:o=null,stencil:a=null}={}){const s={};e&&(s.framebuffer=e);let u=0;r&&(u|=16384,!0!==r&&(s.clearColor=r)),o&&(u|=256,!0!==o&&(s.clearDepth=o)),a&&(u|=1024,!0!==o&&(s.clearStencil=o)),Object(i.a)(0!==u,"clear: bad arguments"),Object(n.o)(t,s,()=>{t.clear(u)})}function a(t,{framebuffer:e=null,buffer:r=6144,drawBuffer:o=0,value:a=[0,0,0,0]}={}){Object(n.a)(t),Object(n.o)(t,{framebuffer:e},()=>{switch(r){case 6144:switch(a.constructor){case Int32Array:t.clearBufferiv(r,o,a);break;case Uint32Array:t.clearBufferuiv(r,o,a);break;case Float32Array:default:t.clearBufferfv(r,o,a)}break;case 6145:t.clearBufferfv(6145,0,[a]);break;case 6146:t.clearBufferiv(6146,0,[a]);break;case 34041:const[e,n]=a;t.clearBufferfi(34041,0,e,n);break;default:Object(i.a)(!1,"clear: bad arguments")}})}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(71),i=r(98);const o={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};e.b={[o.WEBGL2]:[!1,!0],[o.VERTEX_ARRAY_OBJECT]:["OES_vertex_array_object",!0],[o.TIMER_QUERY]:["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],[o.INSTANCED_RENDERING]:["ANGLE_instanced_arrays",!0],[o.MULTIPLE_RENDER_TARGETS]:["WEBGL_draw_buffers",!0],[o.ELEMENT_INDEX_UINT32]:["OES_element_index_uint",!0],[o.BLEND_EQUATION_MINMAX]:["EXT_blend_minmax",!0],[o.FLOAT_BLEND]:["EXT_float_blend"],[o.COLOR_ENCODING_SRGB]:["EXT_sRGB",!0],[o.TEXTURE_DEPTH]:["WEBGL_depth_texture",!0],[o.TEXTURE_FLOAT]:["OES_texture_float",!0],[o.TEXTURE_HALF_FLOAT]:["OES_texture_half_float",!0],[o.TEXTURE_FILTER_LINEAR_FLOAT]:["OES_texture_float_linear"],[o.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:["OES_texture_half_float_linear"],[o.TEXTURE_FILTER_ANISOTROPIC]:["EXT_texture_filter_anisotropic"],[o.COLOR_ATTACHMENT_RGBA32F]:[function(t){const e=new i.a(t,{format:6408,type:5126,dataFormat:6408}),r=new n.a(t,{id:"test-framebuffer",check:!1,attachments:{36064:e}}),o=r.getStatus();return e.delete(),r.delete(),36053===o},"EXT_color_buffer_float"],[o.COLOR_ATTACHMENT_FLOAT]:[!1,"EXT_color_buffer_float"],[o.COLOR_ATTACHMENT_HALF_FLOAT]:["EXT_color_buffer_half_float"],[o.GLSL_FRAG_DATA]:["WEBGL_draw_buffers",!0],[o.GLSL_FRAG_DEPTH]:["EXT_frag_depth",!0],[o.GLSL_DERIVATIVES]:["OES_standard_derivatives",!0],[o.GLSL_TEXTURE_LOD]:["EXT_shader_texture_lod",!0]}},function(t,e,r){"use strict";var n=r(75),i=r(177);r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return l})),r.d(e,"b",(function(){return h}));const o={[n.b]:"#ifdef MODULE_LOGDEPTH\n  logdepth_adjustPosition(gl_Position);\n#endif\n",[n.a]:"#ifdef MODULE_MATERIAL\n  gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n  gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n  gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n  gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n  gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n  logdepth_setFragDepth();\n#endif\n"},a="__LUMA_INJECT_DECLARATIONS__",s=/void\s+main\s*\([^)]*\)\s*\{\n?/,u=/}\n?[^{}]*$/,c=[];function l(t,e,r,i=!1){const l=e===n.b;for(const e in r){const n=r[e];n.sort((t,e)=>t.order-e.order),c.length=n.length;for(let t=0,e=n.length;t<e;++t)c[t]=n[t].injection;const i=`${c.join("\n")}\n`;switch(e){case"vs:#decl":l&&(t=t.replace(a,i));break;case"vs:#main-start":l&&(t=t.replace(s,t=>t+i));break;case"vs:#main-end":l&&(t=t.replace(u,t=>i+t));break;case"fs:#decl":l||(t=t.replace(a,i));break;case"fs:#main-start":l||(t=t.replace(s,t=>t+i));break;case"fs:#main-end":l||(t=t.replace(u,t=>i+t));break;default:t=t.replace(e,t=>t+i)}}return t=t.replace(a,""),i&&(t=t.replace(/\}\s*$/,t=>t+o[e])),t}function h(t){const e={};return Object(i.a)(Array.isArray(t)&&t.length>1),t.forEach(t=>{for(const r in t)e[r]=e[r]?`${e[r]}\n${t[r]}`:t[r]}),e}},,,,,function(t,e,r){"use strict";(function(t){var n=r(123);Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){if("undefined"!=typeof window&&"object"===(0,i.default)(window.process)&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"===(0,i.default)(t.versions)&&Boolean(t.versions.electron))return!0;var r="object"===("undefined"==typeof navigator?"undefined":(0,i.default)(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;if(n&&n.indexOf("Electron")>=0)return!0;return!1};var i=n(r(24))}).call(this,r(57))},function(t,e,r){"use strict";r.r(e);var n=r(10),i=r.n(n),o=r(0),a=r.n(o),s=r(2),u=r.n(s),c=r(3),l=r.n(c),h=r(24),f=r.n(h);function p(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!t)throw new Error("JSON conversion error ".concat(e))}function d(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function g(t,e){var r,n=t,i=d(function(t){if("string"==typeof t){var e=y[t];return e||(e=t.split("."),y[t]=e),e}return Array.isArray(t)?t:[t]}(e));try{for(i.s();!(r=i.n()).done;){var o=r.value;n=m(n)?n[o]:void 0}}catch(t){i.e(t)}finally{i.f()}return n}function m(t){return null!==t&&"object"===f()(t)}var y={};var v=r(194),_=r.n(v),b={"-":function(t){return t}};function x(t,e){if(t in b)return b[t];var r,n=_.a.parse(t);return n.right||n.left||"Identifier"!==n.type?(!function t(e,r){if(Array.isArray(e))e.forEach((function(e){return t(e,r)}));else if(e&&"object"===f()(e))for(var n in e.type&&r(e),e)t(e[n],r)}(n,(function(t){if("CallExpression"===t.type)throw new Error("Function calls not allowed in JSON expressions")})),r=function(t){return _.a.eval(n,t)}):r=function(e){return g(e,t)},b[t]=r,r}var w=function(t){return t&&"object"===f()(t)},E=function(){function t(){u()(this,t),this.typeKey="@@type",this.functionKey="@@function",this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.convertFunction=x,this.preProcessClassProps=function(t,e){return e},this.postProcessConvertedJson=function(t){return t};for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0,o=r;i<o.length;i++){var a=o[i];this.merge(a)}}return l()(t,[{key:"merge",value:function(t){for(var e in t)switch(e){case"layers":case"views":Object.assign(this.classes,t[e]);break;default:if(e in this){var r=t[e];this[e]=w(this[e])?Object.assign(this[e],r):r}}}},{key:"validate",value:function(t){return p(!this.typeKey||"string"==typeof this.typeKey),p(w(this.classes)),!0}}]),t}();function S(t){return t.replace("@@=","")}function O(t,e){var r,n={};for(var i in t){var o=t[i];"string"==typeof(r=o)&&r.startsWith("@@=")&&(o=x(o=S(o))),n[i]=o}return n}function T(t,e,r){var n=r.classes[t],i=r.reactComponents[t];if(!n&&!i){var o=r.log,a=JSON.stringify(e,null,0).slice(0,40);return o&&o.warn("JSON converter: No registered class of type ".concat(t,"(").concat(a,"...)  ")),null}return n?function(t,e,r){r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r));return e=O(e),new t(e)}(n,e,r):function(t,e,r){var n=r.React,i=e.children,o=void 0===i?[]:i;delete e.children,r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r));return e=O(e),n.createElement(t,e,o)}(i,e,r)}function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var C=function(t){return t&&"object"===f()(t)},I=function(){function t(e){u()(this,t),this.log=console,this.configuration={},this.onJSONChange=function(){},this.json=null,this.convertedJson=null,this.setProps(e)}return l()(t,[{key:"finalize",value:function(){}},{key:"setProps",value:function(t){"configuration"in t&&(this.configuration=t.configuration instanceof E?t.configuration:new E(t.configuration)),"onJSONChange"in t&&(this.onJSONChange=t.onJSONChange)}},{key:"mergeConfiguration",value:function(t){this.configuration.merge(t)}},{key:"convert",value:function(t){if(!t||t===this.json)return this.convertedJson;this.json=t;var e=function(t,e){return e=new E(e),k(t,"",e)}(function(t){return"string"==typeof t?JSON.parse(t):t}(t),this.configuration);return e=this.configuration.postProcessConvertedJson(e),this.convertedJson=e,e}},{key:"convertJson",value:function(t){return this.convert(t)}}]),t}();function k(t,e,r){return Array.isArray(t)?t.map((function(t,e){return k(t,String(e),r)})):function(t,e){var r=e.typeKey;return C(t)&&Boolean(t[r])}(t,r)?function(t,e){var r=e.typeKey,n=t[r],i=M({},t);return delete i[r],i=R(i,e),T(n,i,e)}(t,r):C(t)?"@@function"in t?function(t,e){var r=e.functionKey,n=M({},t);delete n[r],n=R(n,e);var i=t[r],o=e.functions[i];return p(o,"Function ".concat(i," not found.")),o(n)}(t,r):R(t,r):"string"==typeof t?function(t,e,r){if(t.startsWith("@@=")&&r.convertFunction)return t=t.replace("@@=",""),r.convertFunction(t,r);if(t.startsWith("@@#")){if(t=t.replace("@@#",""),r.constants[t])return r.constants[t];var n=t.split("."),o=i()(n,2),a=o[0],s=o[1];return r.enumerations[a][s]}return t}(t,0,r):t}function R(t,e){p(C(t));var r={};for(var n in t){var i=t[n];r[n]=k(i,0,e)}return r}var L=r(164);function j(t,e){if(t===e)return!0;if("object"!==f()(t)||null===t||"object"!==f()(e)||null===e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!(r in e)||t[r]!==e[r])return!1;for(var n in e)if(!(n in t))return!1;return!0}r.d(e,"JSONConverter",(function(){return I})),r.d(e,"JSONConfiguration",(function(){return E})),r.d(e,"Transport",(function(){return L.a})),r.d(e,"_convertFunctions",(function(){return O})),r.d(e,"_parseExpressionString",(function(){return x})),r.d(e,"_shallowEqualObjects",(function(){return j}))},function(t,e,r){"use strict";var n=r(4),i=r(76),o=r(52);const a=new Map;function s(t){Object(o.a)(t.source&&!t.url||!t.source&&t.url);let e=a.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return u((e=t,`try {\n  importScripts('${e}');\n} catch (error) {\n  console.error(error);\n  throw error;\n}`));var e}(t.url),a.set(t.url,e)),t.source&&(e=u(t.source),a.set(t.source,e))),Object(o.a)(e),e}function u(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function c(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}const l=()=>{};class h{static isSupported(){return"undefined"!=typeof Worker}constructor(t){Object(n.a)(this,"name",void 0),Object(n.a)(this,"source",void 0),Object(n.a)(this,"url",void 0),Object(n.a)(this,"terminated",!1),Object(n.a)(this,"worker",void 0),Object(n.a)(this,"onMessage",void 0),Object(n.a)(this,"onError",void 0),Object(n.a)(this,"_loadableURL","");const{name:e,source:r,url:i}=t;Object(o.a)(r||i),this.name=e,this.source=r,this.url=i,this.onMessage=l,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=l,this.onError=l,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||function t(e,r=!0,n){const i=n||new Set;if(e){if(c(e))i.add(e);else if(c(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"==typeof e)for(const n in e)t(e[n],r,i)}else;return void 0===n?Array.from(i):[]}(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=s({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}}class f{constructor(t,e){Object(n.a)(this,"name",void 0),Object(n.a)(this,"workerThread",void 0),Object(n.a)(this,"isRunning",void 0),Object(n.a)(this,"result",void 0),Object(n.a)(this,"_resolve",void 0),Object(n.a)(this,"_reject",void 0),this.name=t,this.workerThread=e,this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},this.result=new Promise((t,e)=>{this._resolve=t,this._reject=e})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){Object(o.a)(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Object(o.a)(this.isRunning),this.isRunning=!1,this._reject(t)}}class p{constructor(t){Object(n.a)(this,"name","unnamed"),Object(n.a)(this,"source",void 0),Object(n.a)(this,"url",void 0),Object(n.a)(this,"maxConcurrency",1),Object(n.a)(this,"maxMobileConcurrency",1),Object(n.a)(this,"onDebug",()=>{}),Object(n.a)(this,"reuseWorkers",!0),Object(n.a)(this,"props",{}),Object(n.a)(this,"jobQueue",[]),Object(n.a)(this,"idleQueue",[]),Object(n.a)(this,"count",0),Object(n.a)(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t,e=((t,e,r)=>t.done(r)),r=((t,e)=>t.error(e))){const n=new Promise(n=>(this.jobQueue.push({name:t,onMessage:e,onError:r,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const r=new f(e.name,t);t.onMessage=t=>e.onMessage(r,t.type,t.payload),t.onError=t=>e.onError(r,t),e.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new h({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return i.c?this.maxMobileConcurrency:this.maxConcurrency}}const d={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class A{static isSupported(){return h.isSupported()}static getWorkerFarm(t={}){return A._workerFarm=A._workerFarm||new A({}),A._workerFarm.setProps(t),A._workerFarm}constructor(t){Object(n.a)(this,"props",void 0),Object(n.a)(this,"workerPools",new Map),this.props={...d},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy()}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:r,url:n}=t;let i=this.workerPools.get(e);return i||(i=new p({name:e,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}Object(n.a)(A,"_workerFarm",void 0);function g(t,e){return!!A.isSupported()&&(t.worker&&(null==e?void 0:e.worker))}async function m(t,e,r,n,i){const a=t.id,s=function(t,e={}){const r=e[t.id]||{},n=`${t.id}-worker.js`;let i=r.workerUrl;if("test"===e._workerType&&(i=`modules/${t.module}/dist/${n}`),!i){let e=t.version;"latest"===e&&(e="latest");const r=e?`@${e}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${r}/dist/${n}`}return Object(o.a)(i),i}(t,r),u=A.getWorkerFarm(r).getWorkerPool({name:a,url:s});r=JSON.parse(JSON.stringify(r));const c=await u.startJob("process-on-worker",y.bind(null,i));c.postMessage("process",{input:e,options:r});const l=await c.result;return await l.result}async function y(t,e,r,n){switch(r){case"done":e.done(n);break;case"error":e.error(n.error);break;case"process":const{id:i,input:o,options:a}=n;try{const r=await t(o,a);e.postMessage("done",{id:i,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:r})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}r.d(e,"a",(function(){return g})),r.d(e,"b",(function(){return m}))},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return A}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),c=r(6),l=r.n(c),h=r(1),f=r.n(h),p=r(164);function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}var A=function(t){u()(r,t);var e=d(r);function r(){var t;return i()(this,r),(t=e.call(this,"Jupyter Transport (JavaScript <=> Jupyter Kernel)")).jupyterModel=null,t.jupyterView=null,t}return a()(r,[{key:"getRootDOMElement",value:function(){return this.jupyterView.el}},{key:"sendJSONMessage",value:function(t,e){var r=p.a._stringifyJSONSafe({type:t,data:e});this.jupyterModel.send(r)}}]),r}(p.a)},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return S}));var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(155),y=r(32),v=r(66);function _(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function E(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}var S=function(t){f()(r,t);var e=E(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getSubLayers",value:function(){return this.internalState&&this.internalState.subLayers||[]}},{key:"initializeState",value:function(){}},{key:"setState",value:function(t){l()(g()(r.prototype),"setState",this).call(this,t),this.setNeedsUpdate()}},{key:"getPickingInfo",value:function(t){var e=t.info,r=e.object;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id?(e.object=r.__source.object,e.index=r.__source.index,e):e}},{key:"renderLayers",value:function(){return null}},{key:"filterSubLayer",value:function(t){return!0}},{key:"shouldRenderSubLayer",value:function(t,e){return e&&e.length}},{key:"getSubLayerClass",value:function(t,e){var r=this.props._subLayerProps;return r&&r[t]&&r[t].type||e}},{key:"getSubLayerRow",value:function(t,e,r){return t.__source={parent:this,object:e,index:r},t}},{key:"getSubLayerAccessor",value:function(t){if("function"==typeof t){var e={data:this.props.data,target:[]};return function(r,n){return r&&r.__source?(e.index=r.__source.index,t(r.__source.object,e)):t(r,n)}}return t}},{key:"getSubLayerProps",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.props,r=e.opacity,n=e.pickable,i=e.visible,o=e.parameters,a=e.getPolygonOffset,s=e.highlightedObjectIndex,u=e.autoHighlight,c=e.highlightColor,l=e.coordinateSystem,h=e.coordinateOrigin,f=e.wrapLongitude,p=e.positionFormat,d=e.modelMatrix,A=e.extensions,g=e.fetch,m=e._subLayerProps,y={opacity:r,pickable:n,visible:i,parameters:o,getPolygonOffset:a,highlightedObjectIndex:s,autoHighlight:u,highlightColor:c,coordinateSystem:l,coordinateOrigin:h,wrapLongitude:f,positionFormat:p,modelMatrix:d,extensions:A,fetch:g},v=m&&m[t.id],b=v&&v.updateTriggers,x=t.id||"sublayer";if(v){var E=this.constructor._propTypes,S=t.type?t.type._propTypes:{};for(var O in v){var T=S[O]||E[O];T&&"accessor"===T.type&&(v[O]=this.getSubLayerAccessor(v[O]))}}Object.assign(y,t,v),y.id="".concat(this.props.id,"-").concat(x),y.updateTriggers=w(w({all:this.props.updateTriggers.all},t.updateTriggers),b);var P,M=_(A);try{for(M.s();!(P=M.n()).done;){var C=P.value,I=C.getSubLayerProps.call(this,C);I&&Object.assign(y,I,{updateTriggers:Object.assign(y.updateTriggers,I.updateTriggers)})}}catch(t){M.e(t)}finally{M.f()}return y}},{key:"_updateAutoHighlight",value:function(t){var e,r=_(this.getSubLayers());try{for(r.s();!(e=r.n()).done;){e.value.updateAutoHighlight(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"_getAttributeManager",value:function(){return null}},{key:"_renderLayers",value:function(){var t=this.internalState.subLayers,e=!t||this.needsUpdate();e&&(t=this.renderLayers(),t=Object(v.b)(t,Boolean),this.internalState.subLayers=t),Object(y.a)("compositeLayer.renderLayers",this,e,t);var r,n=_(t);try{for(n.s();!(r=n.n()).done;){r.value.parent=this}}catch(t){n.e(t)}finally{n.f()}}},{key:"isComposite",get:function(){return!0}},{key:"isLoaded",get:function(){return l()(g()(r.prototype),"isLoaded",this)&&this.getSubLayers().every((function(t){return t.isLoaded}))}}]),r}(m.a);S.layerName="CompositeLayer"},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(161),l=r(72),h=r(18),f=r(66);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var A=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a()(this,t),this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="Initial render",this._needsUpdate=!0,this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}return u()(t,[{key:"finalize",value:function(){for(var t in this.controllers)this.controllers[t]&&this.controllers[t].finalize();this.controllers={}}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}},{key:"setNeedsUpdate",value:function(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}},{key:"updateViewStates",value:function(){for(var t in this.controllers){var e=this.controllers[t];e&&e.updateTransition()}}},{key:"getViewports",value:function(t){return t?this._viewports.filter((function(e){return e.containsPixel(t)})):this._viewports}},{key:"getViews",value:function(){var t={};return this.views.forEach((function(e){t[e.id]=e})),t}},{key:"getView",value:function(t){return"string"==typeof t?this.views.find((function(e){return e.id===t})):t}},{key:"getViewState",value:function(t){var e=this.getView(t),r=e&&this.viewState[e.getViewStateId()]||this.viewState;return e?e.filterViewState(r):r}},{key:"getViewport",value:function(t){return this._viewportMap[t]}},{key:"unproject",value:function(t,e){for(var r=this.getViewports(),n={x:t[0],y:t[1]},i=r.length-1;i>=0;--i){var o=r[i];if(o.containsPixel(n)){var a=t.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,e)}}return null}},{key:"setProps",value:function(t){"views"in t&&this._setViews(t.views),"viewState"in t&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}},{key:"_update",value:function(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}},{key:"_setSize",value:function(t,e){t===this.width&&e===this.height||(this.width=t,this.height=e,this.setNeedsUpdate("Size changed"))}},{key:"_setViews",value:function(t){t=Object(f.b)(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}},{key:"_setViewState",value:function(t){t?(!Object(l.a)(t,this.viewState)&&this.setNeedsUpdate("viewState changed"),this.viewState=t):h.a.warn("missing `viewState` or `initialViewState`")()}},{key:"_onViewStateChange",value:function(t,e){e.viewId=t,this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange(e)}},{key:"_createController",value:function(t,e){return new(0,e.type)(d({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,e.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:function(e){return t._getViewport(e,{width:e.width,height:e.height})}},e))}},{key:"_updateController",value:function(t,e,r,n){var i=t.controller;return i?(i=d(d(d(d({},e),t.props),i),{},{id:t.id,x:r.x,y:r.y,width:r.width,height:r.height}),n?n.setProps(i):n=this._createController(t,i),n):null}},{key:"_rebuildViewports",value:function(){var t=this.width,e=this.height,r=this.views,n=this.controllers;this._viewports=[],this.controllers={};for(var i=!1,o=r.length;o--;){var a=r[o],s=this.getViewState(a),u=a.makeViewport({width:t,height:e,viewState:s}),c=n[a.id];a.controller&&!c&&(i=!0),!i&&a.controller||!c||(c.finalize(),c=null),this.controllers[a.id]=this._updateController(a,s,u,c),this._viewports.unshift(u)}for(var l in n)n[l]&&!this.controllers[l]&&n[l].finalize();this._buildViewportMap()}},{key:"_buildViewportMap",value:function(){var t=this;this._viewportMap={},this._viewports.forEach((function(e){e.id&&(t._viewportMap[e.id]=t._viewportMap[e.id]||e)}))}},{key:"_diffViews",value:function(t,e){return t.length!==e.length||t.some((function(r,n){return!t[n].equals(e[n])}))}}]),t}(),g=r(149),m=r(130);function y(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return v(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return v(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var _=new m.a,b=function(){function t(){a()(this,t),this.effects=[],this._internalEffects=[],this._needsRedraw="Initial render",this.setEffects()}return u()(t,[{key:"setProps",value:function(t){"effects"in t&&(t.effects.length===this.effects.length&&Object(l.a)(t.effects,this.effects)||(this.setEffects(t.effects),this._needsRedraw="effects changed"))}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}},{key:"getEffects",value:function(){return this._internalEffects}},{key:"finalize",value:function(){this.cleanup()}},{key:"setEffects",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.cleanup(),this.effects=t,this._createInternalEffects()}},{key:"cleanup",value:function(){var t,e=y(this.effects);try{for(e.s();!(t=e.n()).done;){t.value.cleanup()}}catch(t){e.e(t)}finally{e.f()}var r,n=y(this._internalEffects);try{for(n.s();!(r=n.n()).done;){r.value.cleanup()}}catch(t){n.e(t)}finally{n.f()}this.effects.length=0,this._internalEffects.length=0}},{key:"_createInternalEffects",value:function(){this._internalEffects=this.effects.slice(),this.effects.some((function(t){return t instanceof m.a}))||this._internalEffects.push(_)}}]),t}(),x=r(86),w=r(163),E=r(71),S=r(98),O=r(7),T=r(197),P=r(171);function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I={pickedColor:null,pickedLayer:null,pickedObjectIndex:-1};function k(t){var e=t.pickedColors,r=t.decodePickingColor,n=t.deviceX,i=t.deviceY,o=t.deviceRadius,a=t.deviceRect;if(e){for(var s=a.x,u=a.y,c=a.width,l=a.height,f=o*o,p=-1,d=0,A=0;A<l;A++){var g=A+u-i,m=g*g;if(m>f)d+=4*c;else for(var y=0;y<c;y++){if(e[d+3]-1>=0){var v=y+s-n,_=v*v+m;_<=f&&(f=_,p=d)}d+=4}}if(p>=0){var b=e.slice(p,p+4),x=r(b);if(x){var w=Math.floor(p/4/c),E=p/4-w*c;return C(C({},x),{},{pickedColor:b,pickedX:s+E,pickedY:u+w})}h.a.error("Picked non-existent layer. Is picking buffer corrupt?")()}}return I}function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){var e=t.pickInfo,r=t.viewports,n=t.pixelRatio,i=t.x,o=t.y,a=t.z,s=r[0];r.length>1&&(s=function(t,e){for(var r=t.length-1;r>=0;r--){var n=t[r];if(n.containsPixel(e))return n}return t[0]}((null==e?void 0:e.pickedViewports)||r,{x:i,y:o}));var u=s&&s.unproject([i-s.x,o-s.y],{targetZ:a});return{color:null,layer:null,viewport:s,index:-1,picked:!1,x:i,y:o,pixel:[i,o],coordinate:u,devicePixel:e&&[e.pickedX,e.pickedY],pixelRatio:n}}function j(t){var e=t.pickInfo,r=t.lastPickedInfo,n=t.mode,o=t.layers,a=e.pickedColor,s=e.pickedLayer,u=e.pickedObjectIndex,c=s?[s]:[];if("hover"===n){var l=r.index,h=r.layerId,f=s&&s.props.id;if(f!==h||u!==l){if(f!==h){var p=o.find((function(t){return t.props.id===h}));p&&c.unshift(p)}r.layerId=f,r.index=u,r.info=null}}var d=L(t),A=new Map;return A.set(null,d),c.forEach((function(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?R(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},d);t===s&&(e.color=a,e.index=u,e.picked=!0),e=D({layer:t,info:e,mode:n}),t===s&&"hover"===n&&(r.info=e),A.set(e.layer.id,e),"hover"===n&&e.layer.updateAutoHighlight(e)})),A}function D(t){for(var e=t.layer,r=t.info,n=t.mode;e&&r;){var i=r.layer||null;r.sourceLayer=i,r.layer=e,r=e.getPickingInfo({info:r,mode:n,sourceLayer:i}),e=e.parent}return r}function B(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?z(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var U=function(){function t(e){a()(this,t),this.gl=e,this.pickingFBO=null,this.pickLayersPass=new P.a(e),this.layerFilter=null,this.lastPickedInfo={index:-1,layerId:null,info:null}}return u()(t,[{key:"setProps",value:function(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}},{key:"finalize",value:function(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}},{key:"pickObject",value:function(t){return this._pickClosestObject(t)}},{key:"pickObjects",value:function(t){return this._pickVisibleObjects(t)}},{key:"getLastPickedObject",value:function(t){var e=t.x,r=t.y,n=t.layers,i=t.viewports,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.lastPickedInfo.info,a=o&&o.layer&&o.layer.id,s=o&&o.viewport&&o.viewport.id,u=a?n.find((function(t){return t.id===a})):null,c=s&&i.find((function(t){return t.id===s}))||i[0],l=c&&c.unproject([e-c.x,r-c.y]),h={x:e,y:r,viewport:c,coordinate:l,layer:u};return u?N(N({},o),h):Object.assign(h,{color:null,object:null,index:-1})}},{key:"_resizeBuffer",value:function(){var t=this.gl;return this.pickingFBO||(this.pickingFBO=new E.a(t),E.a.isSupported(t,{colorBufferFloat:!0})&&(this.depthFBO=new E.a(t),this.depthFBO.attach(i()({},36064,new S.a(t,{format:Object(O.j)(t)?34836:6408,type:5126}))))),this.pickingFBO.resize({width:t.canvas.width,height:t.canvas.height}),this.depthFBO&&this.depthFBO.resize({width:t.canvas.width,height:t.canvas.height}),this.pickingFBO}},{key:"_getPickable",value:function(t){if(!1===this._pickable)return null;var e=t.filter((function(t){return t.isPickable()&&!t.isComposite}));return e.length?e:null}},{key:"_pickClosestObject",value:function(t){var e=t.layers,r=t.views,n=t.viewports,i=t.x,o=t.y,a=t.radius,s=void 0===a?0:a,u=t.depth,c=void 0===u?1:u,l=t.mode,h=void 0===l?"query":l,f=t.unproject3D,p=t.onViewportActive;if(!(e=this._getPickable(e)))return{result:[],emptyInfo:L({viewports:n,x:i,y:o})};this._resizeBuffer();for(var d,A=Object(O.e)(this.gl),g=Object(O.d)(this.gl,[i,o],!0),m=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],y=Math.round(s*A),v=this.pickingFBO,_=v.width,b=v.height,x=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:y,deviceWidth:_,deviceHeight:b}),w=[],E={},S=0;S<c;S++){var T=k(N(N({},x&&this._drawAndSample({layers:e,views:r,viewports:n,onViewportActive:p,deviceRect:x,pass:"picking:".concat(h),redrawReason:h})),{},{deviceX:m[0],deviceY:m[1],deviceRadius:y,deviceRect:x})),P=void 0;if(T.pickedLayer&&f&&this.depthFBO)P=this._drawAndSample({layers:[T.pickedLayer],views:r,viewports:n,onViewportActive:p,deviceRect:{x:T.pickedX,y:T.pickedY,width:1,height:1},pass:"picking:".concat(h),redrawReason:"pick-z",pickZ:!0}).pickedColors[0]*n[0].distanceScales.metersPerUnit[2]+n[0].position[2];if(T.pickedColor&&S+1<c){var M=T.pickedColor[3]-1;E[M]=!0,e[M].disablePickingIndex(T.pickedObjectIndex)}var C,I=B((d=j({pickInfo:T,lastPickedInfo:this.lastPickedInfo,mode:h,layers:e,viewports:n,x:i,y:o,z:P,pixelRatio:A})).values());try{for(I.s();!(C=I.n()).done;){var R=C.value;R.layer&&w.push(R)}}catch(t){I.e(t)}finally{I.f()}if(!T.pickedColor)break}for(var D in E)e[D].restorePickingColors();return{result:w,emptyInfo:d&&d.get(null)}}},{key:"_pickVisibleObjects",value:function(t){var e=t.layers,r=t.views,n=t.viewports,i=t.x,o=t.y,a=t.width,s=void 0===a?1:a,u=t.height,c=void 0===u?1:u,l=t.mode,f=void 0===l?"query":l,p=t.maxObjects,d=void 0===p?null:p,A=t.onViewportActive;if(!(e=this._getPickable(e)))return[];this._resizeBuffer();for(var g=Object(O.e)(this.gl),m=Object(O.d)(this.gl,[i,o],!0),y=m.x,v=m.y+m.height,_=Object(O.d)(this.gl,[i+s,o+c],!0),b=_.x+_.width,x=_.y,w={x:y,y:x,width:b-y,height:v-x},E=function(t){var e=t.pickedColors,r=t.decodePickingColor,n=new Map;if(e)for(var i=0;i<e.length;i+=4){if(e[i+3]-1>=0){var o=e.slice(i,i+4),a=o.join(",");if(!n.has(a)){var s=r(o);s?n.set(a,C(C({},s),{},{pickedColor:o})):h.a.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(n.values())}(this._drawAndSample({layers:e,views:r,viewports:n,onViewportActive:A,deviceRect:w,pass:"picking:".concat(f),redrawReason:f})),S=new Map,T=Number.isFinite(d),P=0;P<E.length&&!(T&&S.size>=d);P++){var M=E[P],I={color:M.pickedColor,layer:null,index:M.pickedObjectIndex,picked:!0,x:i,y:o,width:s,height:c,pixelRatio:g};I=D({layer:M.pickedLayer,info:I,mode:f}),S.has(I.object)||S.set(I.object,I)}return Array.from(S.values())}},{key:"_drawAndSample",value:function(t){var e=t.layers,r=t.views,n=t.viewports,i=t.onViewportActive,o=t.deviceRect,a=t.pass,s=t.redrawReason,u=t.pickZ,c=u?this.depthFBO:this.pickingFBO,l=this.pickLayersPass.render({layers:e,layerFilter:this.layerFilter,views:r,viewports:n,onViewportActive:i,pickingFBO:c,deviceRect:o,pass:a,redrawReason:s,pickZ:u}).decodePickingColor,h=o.x,f=o.y,p=o.width,d=o.height,A=new(u?Float32Array:Uint8Array)(p*d*4);return Object(T.c)(c,{sourceX:h,sourceY:f,sourceWidth:p,sourceHeight:d,target:A}),{pickedColors:A,decodePickingColor:l}}},{key:"_getPickingRect",value:function(t){var e=t.deviceX,r=t.deviceY,n=t.deviceRadius,i=t.deviceWidth,o=t.deviceHeight,a=Math.max(0,e-n),s=Math.max(0,r-n),u=Math.min(i,e+n+1)-a,c=Math.min(o,r+n+1)-s;return u<=0||c<=0?null:{x:a,y:s,width:u,height:c}}}]),t}(),V={zIndex:1,position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:0,left:0,display:"none"},G=function(){function t(e){a()(this,t);var r=e.parentElement;r&&(this.el=document.createElement("div"),this.el.className="deck-tooltip",Object.assign(this.el.style,V),r.appendChild(this.el)),this.isVisible=!1}return u()(t,[{key:"setTooltip",value:function(t,e,r){var n=this.el;if("string"==typeof t)n.innerText=t;else{if(!t)return this.isVisible=!1,void(n.style.display="none");"text"in t&&(n.innerText=t.text),"html"in t&&(n.innerHTML=t.html),"className"in t&&(n.className=t.className),Object.assign(n.style,t.style)}this.isVisible=!0,n.style.display="block",n.style.transform="translate(".concat(e,"px, ").concat(r,"px)")}},{key:"remove",value:function(){this.el&&this.el.remove()}}]),t}(),W=r(67),H=r(192),q=r(26),Z=r(139),X=r(9),Q=r(39),Y=r(240),K=r(179);class $ extends Q.a{static isSupported(t,e=[]){const r=Object(O.j)(t),n=Object(Y.c)(t,K.a.TIMER_QUERY);let i=r||n;for(const t of e)switch(t){case"queries":i=i&&r;break;case"timers":i=i&&n;break;default:Object(X.a)(!1)}return i}constructor(t,e={}){super(t,e),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(35007)}beginOcclusionQuery({conservative:t=!1}={}){return this.begin(t?36202:35887)}beginTransformFeedbackQuery(){return this.begin(35976)}begin(t){return this._queryPending?this:(this.target=t,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;const t=this.gl2.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(36795)}getResult(){return this.gl2.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let e=0;return this._pollingPromise=new Promise((r,n)=>{const i=()=>{this.isResultAvailable()?(r(this.getResult()),this._pollingPromise=null):e++>t?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)}),this._pollingPromise}_createHandle(){return $.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}}const J=Object(q.isBrowser)()&&"undefined"!=typeof document;let tt=0;class et{constructor(t={}){const{onCreateContext:e=(t=>Object(O.c)(t)),onAddHTML:r=null,onInitialize:n=(()=>{}),onRender:i=(()=>{}),onFinalize:o=(()=>{}),onError:a,gl:s=null,glOptions:u={},debug:c=!1,createFramebuffer:l=!1,autoResizeViewport:h=!0,autoResizeDrawingBuffer:f=!0,stats:p=Z.a.get(`animation-loop-${tt++}`)}=t;let{useDevicePixels:d=!0}=t;"useDevicePixelRatio"in t&&(O.k.deprecated("useDevicePixelRatio","useDevicePixels")(),d=t.useDevicePixelRatio),this.props={onCreateContext:e,onAddHTML:r,onInitialize:n,onRender:i,onFinalize:o,onError:a,gl:s,glOptions:u,debug:c,createFramebuffer:l},this.gl=s,this.needsRedraw=null,this.timeline=null,this.stats=p,this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:h,autoResizeDrawingBuffer:f,useDevicePixels:d}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return Object(X.a)("string"==typeof t),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.autoResizeViewport=t.autoResizeViewport),"autoResizeDrawingBuffer"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),"useDevicePixels"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(t={}){if(this._running)return this;this._running=!0;const e=this._getPageLoadPromise().then(()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=$.isSupported(this.gl,["timers"])?new $(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(t=>{this._running&&(this._addCallbackData(t||{}),!1!==t&&this._startLoop())});return this.props.onError&&e.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(...t){return this.props.onCreateContext(...t)}onInitialize(...t){return this.props.onInitialize(...t)}onRender(...t){return this.props.onRender(...t)}onFinalize(...t){return this.props.onFinalize(...t)}getHTMLControlValue(t,e=1){const r=document.getElementById(t);return r?Number(r.value):e}setViewParameters(){return O.k.removed("AnimationLoop.setViewParameters","AnimationLoop.setProps")(),this}_startLoop(){const t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=J?new Promise((t,e)=>{J&&"complete"===document.readyState?t(document):window.addEventListener("load",()=>{t(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):(e=t,"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e));var e}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):(e=t,"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60));var e}_renderFrame(...t){this.display?this.display._renderFrame(...t):this.onRender(...t)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){const{width:t,height:e,aspect:r}=this._getSizeAndAspect();t===this.animationProps.width&&e===this.animationProps.height||this.setNeedsRedraw("drawing buffer resized"),r!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,this.animationProps.aspect=r,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){"object"==typeof t&&null!==t&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&"undefined"!=typeof OffscreenCanvas&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?Object(O.h)(this.props.gl,t):this.onCreateContext(t),!Object(O.i)(this.gl))throw new Error("AnimationLoop.onCreateContext - illegal context returned");Object(O.l)(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){const t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";const e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",t.appendChild(this.gl.canvas),t.appendChild(e);const r=this.props.onAddHTML(e);r&&(e.innerHTML=r)}}_getSizeAndAspect(){const t=this.gl.drawingBufferWidth,e=this.gl.drawingBufferHeight;let r=1;const{canvas:n}=this.gl;return n&&n.clientHeight?r=n.clientWidth/n.clientHeight:t>0&&e>0&&(r=t/e),{width:t,height:e,aspect:r}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&Object(O.m)(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new E.a(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get("GPU Time").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){const{canvas:t}=this.gl;t&&(t.addEventListener("mousemove",this._onMousemove),t.addEventListener("mouseleave",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}}var rt=r(290),nt=r(137);function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ot,at,st=r(50),ut=r(51),ct=r(140),lt=r.n(ct),ht={mousedown:1,mousemove:2,mouseup:4};ot=lt.a.PointerEventInput,at=ot.prototype.handler,ot.prototype.handler=function(t){var e=this.store;t.button>0&&(function(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return!0;return!1}(e,(function(e){return e.pointerId===t.pointerId}))||e.push(t)),at.call(this,t)},lt.a.MouseInput.prototype.handler=function(t){var e=ht[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};var ft=lt.a.Manager,pt=lt.a,dt=pt?[[pt.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[pt.Rotate,{enable:!1}],[pt.Pinch,{enable:!1}],[pt.Swipe,{enable:!1}],[pt.Pan,{threshold:0,enable:!1}],[pt.Press,{enable:!1}],[pt.Tap,{event:"doubletap",taps:2,enable:!1}],[pt.Tap,{event:"anytap",enable:!1}],[pt.Tap,{enable:!1}]]:null,At={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},gt={doubletap:["tap"]},mt={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},yt=["keydown","keyup"],vt=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],_t=["wheel","mousewheel","DOMMouseScroll"],bt={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},xt={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},wt=r(101),Et=-1!==wt.b.indexOf("firefox"),St=_t,Ot=function(){function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object(st.a)(this,t),this.element=e,this.callback=r,this.options=Object.assign({enable:!0},i),this.events=St.concat(i.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach((function(t){return e.addEventListener(t,n.handleEvent,!!wt.a&&{passive:!1})}))}return Object(ut.a)(t,[{key:"destroy",value:function(){var t=this;this.events.forEach((function(e){return t.element.removeEventListener(e,t.handleEvent)}))}},{key:"enableEventType",value:function(t,e){"wheel"===t&&(this.options.enable=e)}},{key:"handleEvent",value:function(t){if(this.options.enable){var e=t.deltaY;wt.c.WheelEvent&&(Et&&t.deltaMode===wt.c.WheelEvent.DOM_DELTA_PIXEL&&(e/=wt.c.devicePixelRatio),t.deltaMode===wt.c.WheelEvent.DOM_DELTA_LINE&&(e*=40));var r={x:t.clientX,y:t.clientY};0!==e&&e%4.000244140625==0&&(e=Math.floor(e/4.000244140625)),t.shiftKey&&e&&(e*=.25),this._onWheel(t,-e,r)}}},{key:"_onWheel",value:function(t,e,r){this.callback({type:"wheel",center:r,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}]),t}(),Tt=vt,Pt=function(){function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object(st.a)(this,t),this.element=e,this.callback=r,this.pressed=!1,this.options=Object.assign({enable:!0},i),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=Tt.concat(i.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach((function(t){return e.addEventListener(t,n.handleEvent)}))}return Object(ut.a)(t,[{key:"destroy",value:function(){var t=this;this.events.forEach((function(e){return t.element.removeEventListener(e,t.handleEvent)}))}},{key:"enableEventType",value:function(t,e){"pointermove"===t&&(this.enableMoveEvent=e),"pointerover"===t&&(this.enableOverEvent=e),"pointerout"===t&&(this.enableOutEvent=e),"pointerleave"===t&&(this.enableLeaveEvent=e)}},{key:"handleEvent",value:function(t){this.handleOverEvent(t),this.handleOutEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)}},{key:"handleOverEvent",value:function(t){this.enableOverEvent&&"mouseover"===t.type&&this.callback({type:"pointerover",srcEvent:t,pointerType:"mouse",target:t.target})}},{key:"handleOutEvent",value:function(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:"pointerout",srcEvent:t,pointerType:"mouse",target:t.target})}},{key:"handleLeaveEvent",value:function(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:"pointerleave",srcEvent:t,pointerType:"mouse",target:t.target})}},{key:"handleMoveEvent",value:function(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this.callback({type:"pointermove",srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}]),t}(),Mt=yt,Ct=function(){function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object(st.a)(this,t),this.element=e,this.callback=r,this.options=Object.assign({enable:!0},i),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=Mt.concat(i.events||[]),this.handleEvent=this.handleEvent.bind(this),e.tabIndex=i.tabIndex||0,e.style.outline="none",this.events.forEach((function(t){return e.addEventListener(t,n.handleEvent)}))}return Object(ut.a)(t,[{key:"destroy",value:function(){var t=this;this.events.forEach((function(e){return t.element.removeEventListener(e,t.handleEvent)}))}},{key:"enableEventType",value:function(t,e){"keydown"===t&&(this.enableDownEvent=e),"keyup"===t&&(this.enableUpEvent=e)}},{key:"handleEvent",value:function(t){var e=t.target||t.srcElement;"INPUT"===e.tagName&&"text"===e.type||"TEXTAREA"===e.tagName||(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:"keydown",srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:"keyup",srcEvent:t,key:t.key,target:t.target}))}}]),t}(),It=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object(st.a)(this,t),this.element=e,this.callback=r,this.options=Object.assign({enable:!0},n),this.handleEvent=this.handleEvent.bind(this),e.addEventListener("contextmenu",this.handleEvent)}return Object(ut.a)(t,[{key:"destroy",value:function(){this.element.removeEventListener("contextmenu",this.handleEvent)}},{key:"enableEventType",value:function(t,e){"contextmenu"===t&&(this.options.enable=e)}},{key:"handleEvent",value:function(t){this.options.enable&&this.callback({type:"contextmenu",center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}]),t}();function kt(t){return(kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Rt={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4};var Lt={srcElement:"root",priority:0},jt=function(){function t(e){Object(st.a)(this,t),this.eventManager=e,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}return Object(ut.a)(t,[{key:"isEmpty",value:function(){return!this._active}},{key:"add",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=this.handlers,a=this.handlersByElement;r&&("object"!==kt(r)||r.addEventListener)&&(r={srcElement:r}),r=r?Object.assign({},Lt,r):Lt;var s=a.get(r.srcElement);s||(s=[],a.set(r.srcElement,s));var u={type:t,handler:e,srcElement:r.srcElement,priority:r.priority};n&&(u.once=!0),i&&(u.passive=!0),o.push(u),this._active=this._active||!u.passive;for(var c=s.length-1;c>=0&&!(s[c].priority>=u.priority);)c--;s.splice(c+1,0,u)}},{key:"remove",value:function(t,e){for(var r=this.handlers,n=this.handlersByElement,i=r.length-1;i>=0;i--){var o=r[i];if(o.type===t&&o.handler===e){r.splice(i,1);var a=n.get(o.srcElement);a.splice(a.indexOf(o),1),0===a.length&&n.delete(o.srcElement)}}this._active=r.some((function(t){return!t.passive}))}},{key:"handleEvent",value:function(t){if(!this.isEmpty()){for(var e=this._normalizeEvent(t),r=t.srcEvent.target;r&&r!==e.rootElement;){if(this._emit(e,r),e.handled)return;r=r.parentNode}this._emit(e,"root")}}},{key:"_emit",value:function(t,e){var r=this.handlersByElement.get(e);if(r){for(var n=!1,i=function(){t.handled=!0},o=function(){t.handled=!0,n=!0},a=[],s=0;s<r.length;s++){var u=r[s],c=u.type,l=u.handler,h=u.once;if(l(Object.assign({},t,{type:c,stopPropagation:i,stopImmediatePropagation:o})),h&&a.push(r[s]),n)break}for(var f=0;f<a.length;f++){var p=a[f],d=p.type,A=p.handler;this.remove(d,A)}}}},{key:"_normalizeEvent",value:function(t){var e=this.eventManager.element;return Object.assign({},t,function(t){var e=Rt[t.srcEvent.type];if(!e)return null;var r=t.srcEvent,n=r.buttons,i=r.button,o=r.which,a=!1,s=!1,u=!1;return 4===e||2===e&&!Number.isFinite(n)?(a=1===o,s=2===o,u=3===o):2===e?(a=Boolean(1&n),s=Boolean(4&n),u=Boolean(2&n)):1===e&&(a=0===i,s=1===i,u=2===i),{leftButton:a,middleButton:s,rightButton:u}}(t),function(t,e){var r=t.srcEvent;if(!t.center&&!Number.isFinite(r.clientX))return null;var n=t.center||{x:r.clientX,y:r.clientY},i=e.getBoundingClientRect(),o=i.width/e.offsetWidth,a=i.height/e.offsetHeight;return{center:n,offsetCenter:{x:(n.x-i.left-e.clientLeft)/o,y:(n.y-i.top-e.clientTop)/a}}}(t,e),{handled:!1,rootElement:e})}}]),t}();function Dt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Bt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Bt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ft={events:null,recognizers:null,recognizerOptions:{},Manager:ft,touchAction:"none",tabIndex:0},zt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object(st.a)(this,t),this.options=Object.assign({},Ft,r),this.events=new Map,this._onBasicInput=this._onBasicInput.bind(this),this._onOtherEvent=this._onOtherEvent.bind(this),this.setElement(e);var n=r.events;n&&this.on(n)}return Object(ut.a)(t,[{key:"setElement",value:function(t){var e=this;if(this.element&&this.destroy(),this.element=t,t){var r=this.options,n=r.Manager;for(var i in this.manager=new n(t,{touchAction:r.touchAction,recognizers:r.recognizers||dt}).on("hammer.input",this._onBasicInput),r.recognizers||Object.keys(At).forEach((function(t){var r=e.manager.get(t);r&&At[t].forEach((function(t){r.recognizeWith(t)}))})),r.recognizerOptions){var o=this.manager.get(i);if(o){var a=r.recognizerOptions[i];delete a.enable,o.set(a)}}this.wheelInput=new Ot(t,this._onOtherEvent,{enable:!1}),this.moveInput=new Pt(t,this._onOtherEvent,{enable:!1}),this.keyInput=new Ct(t,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new It(t,this._onOtherEvent,{enable:!1});var s,u=Dt(this.events);try{for(u.s();!(s=u.n()).done;){var c=it(s.value,2),l=c[0],h=c[1];h.isEmpty()||(this._toggleRecognizer(h.recognizerName,!0),this.manager.on(l,h.handleEvent))}}catch(t){u.e(t)}finally{u.f()}}}},{key:"destroy",value:function(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}},{key:"on",value:function(t,e,r){this._addEventHandler(t,e,r,!1)}},{key:"once",value:function(t,e,r){this._addEventHandler(t,e,r,!0)}},{key:"watch",value:function(t,e,r){this._addEventHandler(t,e,r,!1,!0)}},{key:"off",value:function(t,e){this._removeEventHandler(t,e)}},{key:"_toggleRecognizer",value:function(t,e){var r=this.manager;if(r){var n=r.get(t);if(n&&n.options.enable!==e){n.set({enable:e});var i=gt[t];i&&!this.options.recognizers&&i.forEach((function(i){var o=r.get(i);e?(o.requireFailure(t),n.dropRequireFailure(i)):o.dropRequireFailure(t)}))}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}}},{key:"_addEventHandler",value:function(t,e,r,n,i){if("string"==typeof t){var o=this.manager,a=this.events,s=xt[t]||t,u=a.get(s);u||(u=new jt(this),a.set(s,u),u.recognizerName=bt[s]||s,o&&o.on(s,u.handleEvent)),u.add(t,e,r,n,i),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}else for(var c in r=e,t)this._addEventHandler(c,t[c],r,n,i)}},{key:"_removeEventHandler",value:function(t,e){if("string"==typeof t){var r=this.events,n=xt[t]||t,i=r.get(n);if(i&&(i.remove(t,e),i.isEmpty())){var o,a=i.recognizerName,s=!1,u=Dt(r.values());try{for(u.s();!(o=u.n()).done;){var c=o.value;if(c.recognizerName===a&&!c.isEmpty()){s=!0;break}}}catch(t){u.e(t)}finally{u.f()}s||this._toggleRecognizer(a,!1)}}else for(var l in t)this._removeEventHandler(l,t[l])}},{key:"_onBasicInput",value:function(t){var e=t.srcEvent,r=mt[e.type];r&&this.manager.emit(r,t)}},{key:"_onOtherEvent",value:function(t){this.manager.emit(t.type,t)}}]),t}(),Nt=r(37),Ut=r(14);function Vt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Gt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Wt(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function qt(){}r.d(e,"a",(function(){return Xt}));var Zt={id:"",width:"100%",height:"100%",pickingRadius:0,layerFilter:null,glOptions:{},gl:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},onWebGLInitialized:qt,onResize:qt,onViewStateChange:qt,onInteractionStateChange:qt,onBeforeRender:qt,onAfterRender:qt,onLoad:qt,onError:function(t,e){return h.a.error(t)()},_onMetrics:null,getCursor:function(t){return t.isDragging?"grabbing":"grab"},debug:!1,drawPickingColors:!1},Xt=function(){function t(e){a()(this,t),e=Ht(Ht({},Zt),e),this.props={},this.width=0,this.height=0,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this._needsRedraw=!0,this._pickRequest={},this._lastPointerDownInfo=null,this.viewState=null,this.interactiveState={isHovering:!1,isDragging:!1},this._onEvent=this._onEvent.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),e.viewState&&e.initialViewState&&h.a.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),"IE"===Object(q.getBrowser)()&&h.a.warn("IE 11 support will be deprecated in v8.0")(),e.gl||"undefined"!=typeof document&&(this.canvas=this._createCanvas(e)),this.animationLoop=this._createAnimationLoop(e),this.stats=new nt.a({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(e),e._typedArrayManagerProps&&W.a.setProps(e._typedArrayManagerProps),this.animationLoop.start()}return u()(t,[{key:"finalize",value:function(){this.animationLoop.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager&&(this.layerManager.finalize(),this.layerManager=null,this.viewManager.finalize(),this.viewManager=null,this.effectManager.finalize(),this.effectManager=null,this.deckRenderer.finalize(),this.deckRenderer=null,this.deckPicker.finalize(),this.deckPicker=null,this.eventManager.destroy(),this.eventManager=null,this.tooltip.remove(),this.tooltip=null),this.props.canvas||this.props.gl||!this.canvas||(this.canvas.parentElement.removeChild(this.canvas),this.canvas=null)}},{key:"setProps",value:function(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&h.a.removed("onLayerHover","onHover")(),"onLayerClick"in t&&h.a.removed("onLayerClick","onClick")(),t.initialViewState&&!Object(l.a)(this.props.initialViewState,t.initialViewState)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);var e=Object.create(this.props);Object.assign(e,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(e),this.layerManager&&(this.viewManager.setProps(e),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(e),this.effectManager.setProps(e),this.deckRenderer.setProps(e),this.deckPicker.setProps(e)),this.stats.get("setProps Time").timeEnd()}},{key:"needsRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};if(this.props._animate)return"Deck._animate";var e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);var r=this.viewManager.needsRedraw(t),n=this.layerManager.needsRedraw(t),i=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return e=e||r||n||i||o}},{key:"redraw",value:function(t){if(this.layerManager){var e=t||this.needsRedraw({clearRedrawFlags:!0});e&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(e):this._drawLayers(e))}}},{key:"getViews",value:function(){return this.viewManager.views}},{key:"getViewports",value:function(t){return this.viewManager.getViewports(t)}},{key:"pickObject",value:function(t){var e=this._pick("pickObject","pickObject Time",t).result;return e.length?e[0]:null}},{key:"pickMultipleObjects",value:function(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}},{key:"pickObjects",value:function(t){return this._pick("pickObjects","pickObjects Time",t)}},{key:"_addResources",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var r in t)this.layerManager.resourceManager.add({resourceId:r,data:t[r],forceUpdate:e})}},{key:"_removeResources",value:function(t){var e,r=Vt(t);try{for(r.s();!(e=r.n()).done;){var n=e.value;this.layerManager.resourceManager.remove(n)}}catch(t){r.e(t)}finally{r.f()}}},{key:"_pick",value:function(t,e,r){var n=this.stats;n.get("Pick Count").incrementCount(),n.get(e).timeStart();var i=this.deckPicker[t](Ht({layers:this.layerManager.getLayers(r),views:this.viewManager.getViews(),viewports:this.getViewports(r),onViewportActive:this.layerManager.activateViewport},r));return n.get(e).timeEnd(),i}},{key:"_createCanvas",value:function(t){var e=t.canvas;("string"==typeof e&&(e=document.getElementById(e),Object(Nt.a)(e)),e)||((e=document.createElement("canvas")).id=t.id||"deckgl-overlay",(t.parent||document.body).appendChild(e));return Object.assign(e.style,t.style),e}},{key:"_setCanvasSize",value:function(t){if(this.canvas){var e=t.width,r=t.height;(e||0===e)&&(e=Number.isFinite(e)?"".concat(e,"px"):e,this.canvas.style.width=e),(r||0===r)&&(r=Number.isFinite(r)?"".concat(r,"px"):r,this.canvas.style.position="absolute",this.canvas.style.height=r)}}},{key:"_updateCanvasSize",value:function(){if(this._checkForCanvasSizeChange()){var t=this.width,e=this.height;this.viewManager.setProps({width:t,height:e}),this.props.onResize({width:this.width,height:this.height})}}},{key:"_checkForCanvasSizeChange",value:function(){var t=this.canvas;if(!t)return!1;var e=t.clientWidth||t.width,r=t.clientHeight||t.height;return(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,!0)}},{key:"_createAnimationLoop",value:function(t){var e=this,r=t.width,n=t.height,i=t.gl,o=t.glOptions,a=t.debug,s=t.onError,u=t.onBeforeRender,c=t.onAfterRender,l=t.useDevicePixels,h=t.autoResizeDrawingBuffer;return new et({width:r,height:n,useDevicePixels:l,autoResizeDrawingBuffer:h,autoResizeViewport:!1,gl:i,onCreateContext:function(t){return Object(O.c)(Ht(Ht(Ht({},o),t),{},{canvas:e.canvas,debug:a,onContextLost:function(){return e._onContextLost()}}))},onInitialize:function(t){return e._setGLContext(t.gl)},onRender:this._onRenderFrame.bind(this),onBeforeRender:u,onAfterRender:c,onError:s})}},{key:"_getViewState",value:function(){return this.props.viewState||this.viewState}},{key:"_getViews",value:function(){var t=this.props.views||[new g.a({id:"default-view"})];return(t=Array.isArray(t)?t:[t]).length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}},{key:"_onContextLost",value:function(){var t=this.props.onError;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}},{key:"_onPointerMove",value:function(t){var e=this._pickRequest;if("pointerleave"===t.type)e.x=-1,e.y=-1,e.radius=0;else{if(t.leftButton||t.rightButton)return;var r=t.offsetCenter;if(!r)return;e.x=r.x,e.y=r.y,e.radius=this.props.pickingRadius}this.layerManager&&(this.layerManager.context.mousePosition={x:e.x,y:e.y}),e.event=t,e.mode="hover"}},{key:"_pickAndCallback",value:function(){var t=this._pickRequest;if(t.event){var e=this._pick("pickObject","pickObject Time",t),r=e.result,n=e.emptyInfo;this.interactiveState.isHovering=r.length>0;var i,o=n,a=!1,s=Vt(r);try{for(s.s();!(i=s.n()).done;){var u=i.value;o=u,a=u.layer.onHover(u,t.event)}}catch(t){s.e(t)}finally{s.f()}if(!a&&this.props.onHover&&this.props.onHover(o,t.event),this.props.getTooltip){var c=this.props.getTooltip(o);this.tooltip.setTooltip(c,o.x,o.y)}t.event=null}}},{key:"_updateCursor",value:function(){var t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.interactiveState))}},{key:"_setGLContext",value:function(t){if(!this.layerManager){this.canvas||(this.canvas=t.canvas,Object(O.h)(t,{enable:!0,copyState:!0})),this.tooltip=new G(this.canvas),Object(O.n)(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);var e=new rt.a;for(var r in e.play(),this.animationLoop.attachTimeline(e),this.eventManager=new zt(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}}),Ut.b)this.eventManager.on(r,this._onEvent);this.viewManager=new A({timeline:e,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});var n=this.viewManager.getViewports()[0];this.layerManager=new c.a(t,{deck:this,stats:this.stats,viewport:n,timeline:e}),this.effectManager=new b,this.deckRenderer=new w.a(t),this.deckPicker=new U(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}}},{key:"_drawLayers",value:function(t,e){var r=this.layerManager.context.gl;Object(O.n)(r,this.props.parameters),this.props.onBeforeRender({gl:r}),this.deckRenderer.renderLayers(Ht({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",redrawReason:t,effects:this.effectManager.getEffects()},e)),this.props.onAfterRender({gl:r})}},{key:"_onRenderFrame",value:function(t){this._getFrameStats(),this._metricsCounter++%60==0&&(this._getMetrics(),this.stats.reset(),h.a.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(!1),this.viewManager&&this.viewManager.updateViewStates()}},{key:"_onViewStateChange",value:function(t){var e=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState=Ht(Ht({},this.viewState),{},i()({},t.viewId,e)),this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}},{key:"_onInteractionStateChange",value:function(t){this.interactiveState.isDragging=t.isDragging,this.props.onInteractionStateChange(t)}},{key:"_onEvent",value:function(t){var e=Ut.b[t.type],r=t.offsetCenter;if(e&&r){var n=this.layerManager.getLayers(),i=this.deckPicker.getLastPickedObject({x:r.x,y:r.y,layers:n,viewports:this.getViewports(r)},this._lastPointerDownInfo),o=i.layer,a=o&&(o[e.handler]||o.props[e.handler]),s=this.props[e.handler],u=!1;a&&(u=a.call(o,i,t)),!u&&s&&s(i,t)}}},{key:"_onPointerDown",value:function(t){var e=t.offsetCenter;this._lastPointerDownInfo=this.pickObject({x:e.x,y:e.y,radius:this.props.pickingRadius})}},{key:"_getFrameStats",value:function(){var t=this.stats;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();var e=this.animationLoop.stats;t.get("GPU Time").addTime(e.get("GPU Time").lastTiming),t.get("CPU Time").addTime(e.get("CPU Time").lastTiming)}},{key:"_getMetrics",value:function(){var t=this.metrics,e=this.stats;t.fps=e.get("frameRate").getHz(),t.setPropsTime=e.get("setProps Time").time,t.updateAttributesTime=e.get("Update Attributes").time,t.framesRedrawn=e.get("Redraw Count").count,t.pickTime=e.get("pickObject Time").time+e.get("pickMultipleObjects Time").time+e.get("pickObjects Time").time,t.pickCount=e.get("Pick Count").count,t.gpuTime=e.get("GPU Time").time,t.cpuTime=e.get("CPU Time").time,t.gpuTimePerFrame=e.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=e.get("CPU Time").getAverageTime();var r=Z.a.get("Memory Usage");t.bufferMemory=r.get("Buffer Memory").count,t.textureMemory=r.get("Texture Memory").count,t.renderbufferMemory=r.get("Renderbuffer Memory").count,t.gpuMemory=r.get("GPU Memory").count}}]),t}();Xt.getPropTypes=function(t){return{id:t.string,width:t.oneOfType([t.number,t.string]),height:t.oneOfType([t.number,t.string]),layers:t.oneOfType([t.object,t.array]),layerFilter:t.func,views:t.oneOfType([t.object,t.array]),viewState:t.object,effects:t.arrayOf(t.instanceOf(x.a)),controller:t.oneOfType([t.func,t.bool,t.object]),gl:t.object,glOptions:t.object,parameters:t.object,pickingRadius:t.number,useDevicePixels:t.oneOfType([t.bool,t.number]),touchAction:t.string,eventRecognizerOptions:t.object,onWebGLInitialized:t.func,onResize:t.func,onViewStateChange:t.func,onInteractionStateChange:t.func,onBeforeRender:t.func,onAfterRender:t.func,onLoad:t.func,onError:t.func,debug:t.bool,drawPickingColors:t.bool,_framebuffer:t.object,_animate:t.bool,_pickable:t.bool,_typedArrayManagerProps:t.object}},Xt.defaultProps=Zt,Xt.VERSION=H.a.VERSION},function(t,e,r){"use strict";var n=r(104),i=r(292),o=r(26),a=r(18),s=r(32);var u={name:"JSON",extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(t){var e=t[0],r=t[t.length-1];return"{"===e&&"}"===r||"["===e&&"]"===r},parseTextSync:JSON.parse},c=o.global.deck&&o.global.deck.VERSION;if(c&&"8.6.0"!==c)throw new Error("deck.gl - multiple versions detected: ".concat(c," vs ").concat("8.6.0"));c||(a.a.log(1,"deck.gl ".concat("8.6.0"))(),o.global.deck=Object.assign(o.global.deck||{},{VERSION:"8.6.0",version:"8.6.0",log:a.a,_registerLoggers:s.b}),Object(n.c)([u,[i.a,{imagebitmap:{premultiplyAlpha:"none"}}]]));e.a=o.global.deck},function(t,e,r){"use strict";t.exports=i;var n=r(266);function i(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(t){return t.type===i.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function c(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function l(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function h(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function f(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function p(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function d(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function A(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function g(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function m(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function y(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function v(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function _(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=y(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=y(this.buf,this.pos)+4294967296*_(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return s(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&o?function(t,e,r){return o.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){var n="",i=e;for(;i<r;){var o,a,s,u=t[i],c=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l>r)break;1===l?u<128&&(c=u):2===l?128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)<=127&&(c=null):3===l?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((c=(15&u)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===l&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,l=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),i+=l}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==i.Bytes)return t.push(this.readVarint(e));var r=a(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==i.Bytes)return t.push(this.readSVarint());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==i.Bytes)return t.push(this.readBoolean());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==i.Bytes)return t.push(this.readFloat());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==i.Bytes)return t.push(this.readDouble());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==i.Bytes)return t.push(this.readFixed32());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==i.Bytes)return t.push(this.readSFixed32());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==i.Bytes)return t.push(this.readFixed64());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==i.Bytes)return t.push(this.readSFixed64());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===i.Varint)for(;this.buf[this.pos++]>127;);else if(e===i.Bytes)this.pos=this.readVarint()+this.pos;else if(e===i.Fixed32)this.pos+=4;else{if(e!==i.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),v(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),v(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),v(this.buf,-1&t,this.pos),v(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),v(this.buf,-1&t,this.pos),v(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&u(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&u(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,i.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,A,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,i.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,i.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,i.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,i.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,r){const n=r(267),i={"||":function(t,e){return t||e},"&&":function(t,e){return t&&e},"|":function(t,e){return t|e},"^":function(t,e){return t^e},"&":function(t,e){return t&e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"<":function(t,e){return t<e},">":function(t,e){return t>e},"<=":function(t,e){return t<=e},">=":function(t,e){return t>=e},"<<":function(t,e){return t<<e},">>":function(t,e){return t>>e},">>>":function(t,e){return t>>>e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e}},o={"-":function(t){return-t},"+":function(t){return+t},"~":function(t){return~t},"!":function(t){return!t}};function a(t,e){return t.map((function(t){return l(t,e)}))}async function s(t,e){return await Promise.all(t.map(t=>h(t,e)))}function u(t,e){const r=l(t.object,e);return t.computed?[r,r[l(t.property,e)]]:[r,r[t.property.name]]}async function c(t,e){const r=await h(t.object,e);return t.computed?[r,r[await h(t.property,e)]]:[r,r[t.property.name]]}function l(t,e){switch(t.type){case"ArrayExpression":return a(t.elements,e);case"BinaryExpression":return i[t.operator](l(t.left,e),l(t.right,e));case"CallExpression":let r,n,s;if("MemberExpression"===t.callee.type?(s=u(t.callee,e),r=s[0],n=s[1]):n=l(t.callee,e),"function"!=typeof n)return;return n.apply(r,a(t.arguments,e));case"ConditionalExpression":return l(t.test,e)?l(t.consequent,e):l(t.alternate,e);case"Identifier":return e[t.name];case"Literal":return t.value;case"LogicalExpression":return"||"===t.operator?l(t.left,e)||l(t.right,e):"&&"===t.operator?l(t.left,e)&&l(t.right,e):i[t.operator](l(t.left,e),l(t.right,e));case"MemberExpression":return u(t,e)[1];case"ThisExpression":return e;case"UnaryExpression":return o[t.operator](l(t.argument,e));default:return}}async function h(t,e){switch(t.type){case"ArrayExpression":return await s(t.elements,e);case"BinaryExpression":{const[r,n]=await Promise.all([h(t.left,e),h(t.right,e)]);return i[t.operator](r,n)}case"CallExpression":let r,n,a;if("MemberExpression"===t.callee.type?(a=await c(t.callee,e),r=a[0],n=a[1]):n=await h(t.callee,e),"function"!=typeof n)return;return await n.apply(r,await s(t.arguments,e));case"ConditionalExpression":return await h(t.test,e)?await h(t.consequent,e):await h(t.alternate,e);case"Identifier":return e[t.name];case"Literal":return t.value;case"LogicalExpression":{if("||"===t.operator)return await h(t.left,e)||await h(t.right,e);if("&&"===t.operator)return await h(t.left,e)&&await h(t.right,e);const[r,n]=await Promise.all([h(t.left,e),h(t.right,e)]);return i[t.operator](r,n)}case"MemberExpression":return(await c(t,e))[1];case"ThisExpression":return e;case"UnaryExpression":return o[t.operator](await h(t.argument,e));default:return}}t.exports={parse:n,eval:l,evalAsync:h,compile:function(t){return l.bind(null,n(t))},compileAsync:function(t){return h.bind(null,n(t))}}},function(t,e,r){"use strict";var n=r(75),i=r(196),o=r(177);function a(t){return s(function t(e,r){return e.map(e=>e instanceof i.a?e:(Object(o.a)("string"!=typeof e,`Shader module use by name is deprecated. Import shader module '${e}' and use it directly.`),Object(o.a)(e.name,"shader module has no name"),(e=new i.a(e)).dependencies=t(e.dependencies),e))}(t))}function s(t){const e={},r={};return u({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((t,e)=>r[e]-r[t]).map(t=>e[t])}function u({modules:t,level:e,moduleMap:r,moduleDepth:n}){if(e>=5)throw new Error("Possible loop in shader dependency graph");for(const i of t)r[i.name]=i,(void 0===n[i.name]||n[i.name]<e)&&(n[i.name]=e);for(const i of t)i.dependencies&&u({modules:i.dependencies,level:e+1,moduleMap:r,moduleDepth:n})}const c={GLSL_FRAG_DATA:["WEBGL_draw_buffers",!0],GLSL_FRAG_DEPTH:["EXT_frag_depth",!0],GLSL_DERIVATIVES:["OES_standard_derivatives",!0],GLSL_TEXTURE_LOD:["EXT_shader_texture_lod",!0]},l={};Object.keys(c).forEach(t=>{l[t]=t});const h={};function f(t,e,r={}){const n=c[e];if(Object(o.a)(n,e),!function(t={}){const e="undefined"!=typeof window&&window.navigator||{},r=t.userAgent||e.userAgent||"",n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i}(r))return!0;if(e in h)return h[e];const i=`#extension GL_${n[0]} : ${r.behavior||"enable"}\nvoid main(void) {}`,a=t.createShader(35633);t.shaderSource(a,i),t.compileShader(a);const s=t.getShaderParameter(a,35713);return t.deleteShader(a),h[e]=s,s}function p(t,e){const r=c[e];Object(o.a)(r,e);const n=function(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}(t)&&r[1]||r[0],i="string"==typeof n?Boolean(t.getExtension(n)):n;return Object(o.a)(!1===i||!0===i),i}function d(t,e){return(e=Array.isArray(e)?e:[e]).every(e=>p(t,e))}var A=r(180);function g(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}const m=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],y=[...m,[g("attribute"),"in $1"],[g("varying"),"out $1"]],v=[...m,[g("varying"),"in $1"]],_=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],b=[..._,[g("in"),"attribute $1"],[g("out"),"varying $1"]],x=[..._,[g("in"),"varying $1"]],w=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,E=/void\s+main\s*\([^)]*\)\s*\{\n?/;function S(t,e,r){switch(e){case 300:return r?O(t,y):function(t){const e=(t=O(t,v)).match(w);if(e){const r=e[1];t=t.replace(new RegExp("\\bgl_FragColor\\b","g"),r)}else{const e="fragmentColor";t=t.replace(E,t=>`out vec4 ${e};\n${t}`).replace(new RegExp("\\bgl_FragColor\\b","g"),e)}return t}(t);case 100:return r?O(t,b):function(t){const e=(t=O(t,x)).match(w);if(e){const r=e[1];t=t.replace(w,"").replace(new RegExp(`\\b${r}\\b`,"g"),"gl_FragColor")}return t}(t);default:throw new Error(`unknown GLSL version ${e}`)}}function O(t,e){for(const[r,n]of e)t=t.replace(r,n);return t}const T=`\n\n${A.a}\n\n`,P={[n.b]:"vertex",[n.a]:"fragment"};function M(t,{id:e,source:r,type:i,modules:a,defines:s={},hookFunctions:u=[],inject:c={},transpileToGLSL100:h=!1,prologue:p=!0,log:g}){Object(o.a)("string"==typeof r,"shader source must be a string");const m=i===n.b,y=r.split("\n");let v=100,_="",b=r;0===y[0].indexOf("#version ")?(v=300,_=y[0],b=y.slice(1).join("\n")):_=`#version ${v}`;const x={};a.forEach(t=>{Object.assign(x,t.getDefines())}),Object.assign(x,s);let w=p?`${_}\n${function({id:t,source:e,type:r}){return t&&"string"==typeof t&&-1===e.indexOf("SHADER_NAME")?`\n#define SHADER_NAME ${t}_${P[r]}\n\n`:""}({id:e,source:r,type:i})}\n${function({type:t}){return`\n#define SHADER_TYPE_${P[t].toUpperCase()}\n`}({type:i})}\n${function(t){switch(function(t){const e=t.getExtension("WEBGL_debug_renderer_info"),r=t.getParameter(e&&e.UNMASKED_VENDOR_WEBGL||7936),n=t.getParameter(e&&e.UNMASKED_RENDERER_WEBGL||7937);return{gpuVendor:function(t,e){if(t.match(/NVIDIA/i)||e.match(/NVIDIA/i))return"NVIDIA";if(t.match(/INTEL/i)||e.match(/INTEL/i))return"INTEL";if(t.match(/AMD/i)||e.match(/AMD/i)||t.match(/ATI/i)||e.match(/ATI/i))return"AMD";return"UNKNOWN GPU"}(r,n),vendor:r,renderer:n,version:t.getParameter(7938),shadingLanguageVersion:t.getParameter(35724)}}(t).gpuVendor.toLowerCase()){case"nvidia":return"#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}(t)}\n${function(t,e,r){let n="#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n";return d(t,l.GLSL_FRAG_DEPTH)&&(n+="\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n"),d(t,l.GLSL_DERIVATIVES)&&f(t,l.GLSL_DERIVATIVES)&&(n+="\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n"),d(t,l.GLSL_FRAG_DATA)&&f(t,l.GLSL_FRAG_DATA,{behavior:"require"})&&(n+="\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n"),d(t,l.GLSL_TEXTURE_LOD)&&(n+="// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n"),n}(t)}\n${function(t={}){let e=0,r="";for(const n in t){0===e&&(r+="\n// APPLICATION DEFINES\n"),e++;const i=t[n];(i||Number.isFinite(i))&&(r+=`#define ${n.toUpperCase()} ${t[n]}\n`)}0===e&&(r+="\n");return r}(x)}\n${m?"":"precision highp float;\n\n"}\n`:`${_}\n`;const E=function(t){const e={vs:{},fs:{}};return t.forEach(t=>{let r;"string"!=typeof t?(r=t,t=r.hook):r={},t=t.trim();const[n,i]=t.split(":"),o=t.replace(/\(.+/,"");e[n][o]=Object.assign(r,{signature:i})}),e}(u),O={},M={},C={};for(const t in c){const e="string"==typeof c[t]?{injection:c[t],order:0}:c[t],r=t.match(/^(v|f)s:(#)?([\w-]+)$/);if(r){const n=r[2],i=r[3];n?"decl"===i?M[t]=[e]:C[t]=[e]:O[t]=[e]}else C[t]=[e]}for(const t of a){g&&t.checkDeprecations(b,g),w+=t.getModuleSource(i,v);const e=t.injections[i];for(const t in e){const r=t.match(/^(v|f)s:#([\w-]+)$/);if(r){const n="decl"===r[2]?M:C;n[t]=n[t]||[],n[t].push(e[t])}else O[t]=O[t]||[],O[t].push(e[t])}}return w+=T,w=Object(A.c)(w,i,M),w+=function(t,e){let r="";for(const n in t){const i=t[n];if(r+=`void ${i.signature} {\n`,i.header&&(r+=`  ${i.header}`),e[n]){const t=e[n];t.sort((t,e)=>t.order-e.order);for(const e of t)r+=`  ${e.injection}\n`}i.footer&&(r+=`  ${i.footer}`),r+="}\n"}return r}(E[i],O),w+=b,w=Object(A.c)(w,i,C),w=S(w,h?100:v,m),w}function C(t){return function(e){const r={};for(const n of t){const t=n.getUniforms(e,r);Object.assign(r,t)}return r}}var I=r(293);r.d(e,"a",(function(){return k}));class k{static getDefaultProgramManager(t){return t.luma=t.luma||{},t.luma.defaultProgramManager=t.luma.defaultProgramManager||new k(t),t.luma.defaultProgramManager}constructor(t){this.gl=t,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(t){this._defaultModules.find(e=>e.name===t.name)||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){const e="string"==typeof t?t:t.name;this._defaultModules=this._defaultModules.filter(t=>t.name!==e),this.stateHash++}addShaderHook(t,e){e&&(t=Object.assign(e,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(t={}){const{vs:e="",fs:r="",defines:i={},inject:o={},varyings:s=[],bufferMode:u=35981,transpileToGLSL100:c=!1}=t,l=this._getModuleList(t.modules),h=this._getHash(e),f=this._getHash(r),p=l.map(t=>this._getHash(t.name)).sort(),d=s.map(t=>this._getHash(t)),A=Object.keys(i).sort(),g=Object.keys(o).sort(),m=[],y=[];for(const t of A)m.push(this._getHash(t)),m.push(this._getHash(i[t]));for(const t of g)y.push(this._getHash(t)),y.push(this._getHash(o[t]));const v=`${h}/${f}D${m.join("/")}M${p.join("/")}I${y.join("/")}V${d.join("/")}H${this.stateHash}B${u}${c?"T":""}`;if(!this._programCache[v]){const t=function(t,e){const{vs:r,fs:i}=e,o=a(e.modules||[]);return{gl:t,vs:M(t,Object.assign({},e,{source:r,type:n.b,modules:o})),fs:M(t,Object.assign({},e,{source:i,type:n.a,modules:o})),getUniforms:C(o)}}(this.gl,{vs:e,fs:r,modules:l,inject:o,defines:i,hookFunctions:this._hookFunctions,transpileToGLSL100:c});this._programCache[v]=new I.a(this.gl,{hash:v,vs:t.vs,fs:t.fs,varyings:s,bufferMode:u}),this._getUniforms[v]=t.getUniforms||(t=>{}),this._useCounts[v]=0}return this._useCounts[v]++,this._programCache[v]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){const e=t.hash;this._useCounts[e]--,0===this._useCounts[e]&&(this._programCache[e].delete(),delete this._programCache[e],delete this._getUniforms[e],delete this._useCounts[e])}_getHash(t){return void 0===this._hashes[t]&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(t=[]){const e=new Array(this._defaultModules.length+t.length),r={};let n=0;for(let t=0,i=this._defaultModules.length;t<i;++t){const i=this._defaultModules[t],o=i.name;e[n++]=i,r[o]=!0}for(let i=0,o=t.length;i<o;++i){const o=t[i],a=o.name;r[a]||(e[n++]=o,r[a]=!0)}return e.length=n,e}}},function(t,e,r){"use strict";var n=r(177);const i={number:{validate:(t,e)=>Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)},array:{validate:(t,e)=>Array.isArray(t)||ArrayBuffer.isView(t)}};function o(t){let e=a(t);return"object"===e?t?"type"in t?Object.assign({},t,i[t.type]):"value"in t?(e=a(t.value),Object.assign({type:e},t,i[e])):{type:"object",value:t}:{type:"object",value:null}:Object.assign({type:e,value:t},i[e])}function a(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}r.d(e,"a",(function(){return s})),r.d(e,"b",(function(){return u}));class s{constructor({name:t,vs:e,fs:r,dependencies:i=[],uniforms:a,getUniforms:s,deprecations:u=[],defines:c={},inject:l={},vertexShader:h,fragmentShader:f}){Object(n.a)("string"==typeof t),this.name=t,this.vs=e||h,this.fs=r||f,this.getModuleUniforms=s,this.dependencies=i,this.deprecations=this._parseDeprecationDefinitions(u),this.defines=c,this.injections=function(t){const e={vs:{},fs:{}};for(const r in t){let n=t[r];const i=r.slice(0,2);"string"==typeof n&&(n={order:0,injection:n}),e[i][r]=n}return e}(l),a&&(this.uniforms=function(t){const e={};for(const r in t){const n=o(t[r]);e[r]=n}return e}(a))}getModuleSource(t){let e;switch(t){case"vs":e=this.vs||"";break;case"fs":e=this.fs||"";break;default:Object(n.a)(!1)}return`#define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_")}\n${e}// END MODULE_${this.name}\n\n`}getUniforms(t,e){return this.getModuleUniforms?this.getModuleUniforms(t,e):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,e){this.deprecations.forEach(r=>{r.regex.test(t)&&(r.deprecated?e.deprecated(r.old,r.new)():e.removed(r.old,r.new)())})}_parseDeprecationDefinitions(t){return t.forEach(t=>{switch(t.type){case"function":t.regex=new RegExp(`\\b${t.old}\\(`);break;default:t.regex=new RegExp(`${t.type} ${t.old};`)}}),t}_defaultGetUniforms(t={}){const e={},r=this.uniforms;for(const i in r){const o=r[i];i in t&&!o.private?(o.validate&&Object(n.a)(o.validate(t[i],o),`${this.name}: invalid ${i}`),e[i]=t[i]):e[i]=o.value}return e}}function u(t){if(!t.normalized&&(t.normalized=!0,t.uniforms&&!t.getUniforms)){const e=new s(t);t.getUniforms=e.getUniforms.bind(e)}return t}},function(t,e,r){"use strict";var n=r(34),i=r(71),o=r(55),a=r(7),s=r(54),u=r(9);function c(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Object(u.a)(!1),0}}var l=r(230);function h(t,e={}){const{sourceX:r=0,sourceY:n=0,sourceFormat:i=6408}=e;let{sourceAttachment:o=36064,target:a=null,sourceWidth:l,sourceHeight:h,sourceType:f}=e;const{framebuffer:p,deleteFramebuffer:d}=A(t);Object(u.a)(p);const{gl:g,handle:m,attachments:y}=p;l=l||p.width,h=h||p.height,36064===o&&null===m&&(o=1028),Object(u.a)(y[o]),f=f||y[o].type,a=function(t,e,r,n,i){if(t)return t;e=e||5121;const o=Object(s.c)(e,{clamped:!1}),a=c(r);return new o(n*i*a)}(a,f,i,l,h),f=f||Object(s.b)(a);const v=g.bindFramebuffer(36160,m);return g.readPixels(r,n,l,h,i,f,a),g.bindFramebuffer(36160,v||null),d&&p.delete(),a}function f(t,{sourceX:e=0,sourceY:r=0,sourceFormat:i=6408,target:o=null,targetByteOffset:s=0,sourceWidth:l,sourceHeight:h,sourceType:f}){const{framebuffer:p,deleteFramebuffer:d}=A(t);Object(u.a)(p),l=l||p.width,h=h||p.height;const g=Object(a.a)(p.gl);if(f=f||(o?o.type:5121),!o){const t=c(i),e=function(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Object(u.a)(!1),0}}(f),r=s+l*h*t*e;o=new n.a(g,{byteLength:r,accessor:{type:f,size:t}})}return o.bind({target:35051}),Object(a.o)(g,{framebuffer:p},()=>{g.readPixels(e,r,l,h,i,f,s)}),o.unbind({target:35051}),d&&p.delete(),o}function p(t,{sourceAttachment:e=36064,targetMaxHeight:r=Number.MAX_SAFE_INTEGER}={}){let n=h(t,{sourceAttachment:e}),{width:i,height:o}=t;for(;o>r;)({data:n,width:i,height:o}=Object(s.d)({data:n,width:i,height:o}));Object(s.a)({data:n,width:i,height:o});const a=document.createElement("canvas");a.width=i,a.height=o;const u=a.getContext("2d"),c=u.createImageData(i,o);return c.data.set(n),u.putImageData(c,0,0),a.toDataURL()}function d(t,e,r={}){const{sourceX:n=0,sourceY:i=0,targetMipmaplevel:s=0,targetInternalFormat:c=6408}=r;let{targetX:l,targetY:h,targetZ:f,width:p,height:d}=r;const{framebuffer:g,deleteFramebuffer:m}=A(t);Object(u.a)(g);const{gl:y,handle:v}=g,_=void 0!==l||void 0!==h||void 0!==f;l=l||0,h=h||0,f=f||0;const b=y.bindFramebuffer(36160,v);Object(u.a)(e);let x=null;if(e instanceof o.a&&(x=e,p=Number.isFinite(p)?p:x.width,d=Number.isFinite(d)?d:x.height,x.bind(0),e=x.target),_)switch(e){case 3553:case 34067:y.copyTexSubImage2D(e,s,l,h,n,i,p,d);break;case 35866:case 32879:Object(a.a)(y).copyTexSubImage3D(e,s,l,h,f,n,i,p,d)}else y.copyTexImage2D(e,s,c,n,i,p,d,0);return x&&x.unbind(),y.bindFramebuffer(36160,b||null),m&&g.delete(),x}function A(t){return t instanceof i.a?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:Object(l.b)(t),deleteFramebuffer:!0}}r.d(e,"c",(function(){return h})),r.d(e,"d",(function(){return f})),r.d(e,"a",(function(){return p})),r.d(e,"b",(function(){return d}))},,,,,function(t,e,r){"use strict";(function(t){var e=r(229),n=r(36),i=r(122);function o(t,{extension:e,target:r,target2:o}){const a=i.b[e];Object(n.a)(a);const{meta:s={}}=a,{suffix:u=""}=s,c=t.getExtension(e);for(const e of Object.keys(a)){const n=`${e}${u}`;let i=null;"meta"===e||"function"==typeof t[e]||(c&&"function"==typeof c[n]?i=(...t)=>c[n](...t):"function"==typeof a[e]&&(i=a[e].bind(r))),i&&(r[e]=i,o[e]=i)}}(void 0!==t?t:window).polyfillContext=function(t){t.luma=t.luma||{};const{luma:r}=t;return r.polyfilled||(Object(e.a)(t),function(t){t.luma.extensions={};const e=t.getSupportedExtensions()||[];for(const r of e)t.luma[r]=t.getExtension(r)}(t),function(t,e){for(const r of Object.getOwnPropertyNames(e))"overrides"!==r&&o(t,{extension:r,target:t.luma,target2:t})}(t,i.b),function(t,{target:e,target2:r}){Object.keys(i.a).forEach(n=>{if("function"==typeof i.a[n]){const o=t[n]?t[n].bind(t):()=>{},a=i.a[n].bind(null,t,o);e[n]=a,r[n]=a}})}(t,{target:r,target2:t}),r.polyfilled=!0),t}}).call(this,r(65))},function(t,e,r){"use strict";(function(t,n){var i=r(123);Object.defineProperty(e,"__esModule",{value:!0}),e.console=e.process=e.document=e.global=e.window=e.self=void 0;var o=i(r(24)),a={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"===(void 0===n?"undefined":(0,o.default)(n))&&n},s=a.self||a.window||a.global;e.self=s;var u=a.window||a.self||a.global;e.window=u;var c=a.global||a.self||a.window;e.global=c;var l=a.document||{};e.document=l;var h=a.process||{};e.process=h;var f=console;e.console=f}).call(this,r(65),r(57))},function(t,e,r){"use strict";(function(t){var n=r(123);Object.defineProperty(e,"__esModule",{value:!0}),e.default=a,e.isBrowserMainThread=function(){return a()&&"undefined"!=typeof document};var i=n(r(24)),o=n(r(185));function a(){return!("object"===(void 0===t?"undefined":(0,i.default)(t))&&"[object process]"===String(t)&&!t.browser)||(0,o.default)()}}).call(this,r(57))},function(t,e,r){"use strict";r.d(e,"a",(function(){return d}));var n=r(23),i=r(169),o=r(74),a=r(17),s=r(27),u=r(21),c=r(28);const l=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),h=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),f=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),p={};class d extends i.a{static get IDENTITY(){return p.IDENTITY=p.IDENTITY||Object.freeze(new d(l)),p.IDENTITY}static get ZERO(){return p.ZERO=p.ZERO||Object.freeze(new d(h)),p.ZERO}get INDICES(){return f}get ELEMENTS(){return 16}get RANK(){return 4}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=a,this[7]=s,this[8]=u,this[9]=c,this[10]=l,this[11]=h,this[12]=f,this[13]=p,this[14]=d,this[15]=A,this.check()}setRowMajor(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A){return this[0]=t,this[1]=i,this[2]=u,this[3]=f,this[4]=e,this[5]=o,this[6]=c,this[7]=p,this[8]=r,this[9]=a,this[10]=l,this[11]=d,this[12]=n,this[13]=s,this[14]=h,this[15]=A,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(l)}fromQuaternion(t){return a.c(this,t),this.check()}frustum({left:t,right:e,bottom:r,top:n,near:i,far:o}){return o===1/0?d._computeInfinitePerspectiveOffCenter(this,t,e,r,n,i):a.d(this,t,e,r,n,i,o),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,i,o){const a=2*o/(r-e),s=2*o/(i-n),u=(r+e)/(r-e),c=(i+n)/(i-n),l=-2*o;return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=u,t[9]=c,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),e=e||[0,0,0],r=r||[0,1,0],a.g(this,t,e,r),this.check()}ortho({left:t,right:e,bottom:r,top:n,near:i=.1,far:o=500}){return a.i(this,t,e,r,n,i,o),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:i=500}){if(t>2*Math.PI)throw Error("radians");const o=t/2,a=r*Math.tan(o),s=a*e;return(new d).ortho({left:-s,right:s,bottom:-a,top:a,near:n,far:i})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return a.j(this,t,r,n,i),this.check()}determinant(){return a.a(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return a.q(this,this),this.check()}invert(){return a.f(this,this),this.check()}multiplyLeft(t){return a.h(this,t,this),this.check()}multiplyRight(t){return a.h(this,this,t),this.check()}rotateX(t){return a.l(this,this,t),this.check()}rotateY(t){return a.m(this,this,t),this.check()}rotateZ(t){return a.n(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return a.k(this,this,t,e),this.check()}scale(t){return Array.isArray(t)?a.o(this,this,t):a.o(this,this,[t,t,t]),this.check()}translate(t){return a.p(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=c.n(e||[-0,-0,-0,-0],t,this),Object(n.b)(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:e=s.j(e||[-0,-0],t,this);break;case 3:e=u.s(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(n.b)(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=Object(o.a)(e||[-0,-0],t,this);break;case 3:e=Object(o.c)(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(n.b)(e,t.length),e}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}transformPoint(t,e){return Object(n.c)("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return Object(n.c)("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return Object(n.c)("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(19),i=r(47),o=r(41),a=r(96);async function s(t,e,r,s){Array.isArray(e)||Object(i.a)(e)||(void 0,r=e,e=void 0);const u=Object(o.a)(r);let c=t;return"string"==typeof t&&(c=await u(t)),Object(n.b)(t)&&(c=await u(t)),await Object(a.a)(c,e,r)}},function(t,e,r){"use strict";var n=r(95);e.a={name:"project32",dependencies:[n.a],vs:"\nvec4 project_position_to_clipspace(\n  vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n  vec3 projectedPosition = project_position(position, position64Low);\n  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n    // offset is specified as ENU\n    // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n    mat3 rotation = project_get_orientation_matrix(projectedPosition);\n    offset = rotation * offset;\n  }\n  commonPosition = vec4(projectedPosition + offset, 1.0);\n  return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n  vec3 position, vec3 position64Low, vec3 offset\n) {\n  vec4 commonPosition;\n  return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n"}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(72),u=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t),this.opts=e}return a()(t,[{key:"equals",value:function(t){return this===t||this.constructor===t.constructor&&Object(s.a)(this.opts,t.opts)}},{key:"getShaders",value:function(t){return null}},{key:"getSubLayerProps",value:function(t){var e=t.constructor.defaultProps,r=void 0===e?{}:e,n={updateTriggers:{}};for(var i in r)if(i in this.props){var o=r[i],a=this.props[i];n[i]=a,o&&"accessor"===o.type&&(n.updateTriggers[i]=this.props.updateTriggers[i],"function"==typeof a&&(n[i]=this.getSubLayerAccessor(a,!0)))}return n}},{key:"initializeState",value:function(t,e){}},{key:"updateState",value:function(t,e){}},{key:"draw",value:function(t,e){}},{key:"finalizeState",value:function(t){}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",(function(){return p}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(53),u=r(67),c=r(37),l=r(34);function h(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var p=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t);var r=e.attributes,n=void 0===r?{}:r;this.typedArrayManager=u.a,this.indexStarts=null,this.vertexStarts=null,this.vertexCount=0,this.instanceCount=0,this.attributes={},this._attributeDefs=n,this.opts=e,this.updateGeometry(e),Object.seal(this)}return a()(t,[{key:"updateGeometry",value:function(t){Object.assign(this.opts,t);var e=this.opts,r=e.data,n=e.buffers,i=void 0===n?{}:n,o=e.getGeometry,a=e.geometryBuffer,s=e.positionFormat,u=e.dataChanged,l=e.normalize,f=void 0===l||l;if(this.data=r,this.getGeometry=o,this.positionSize=a&&a.size||("XY"===s?2:3),this.buffers=i,this.normalize=f,a&&(Object(c.a)(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(a),f||(i.positions=a)),this.geometryBuffer=i.positions,Array.isArray(u)){var p,d=h(u);try{for(d.s();!(p=d.n()).done;){var A=p.value;this._rebuildGeometry(A)}}catch(t){d.e(t)}finally{d.f()}}else this._rebuildGeometry()}},{key:"updatePartialGeometry",value:function(t){var e=t.startRow,r=t.endRow;this._rebuildGeometry({startRow:e,endRow:r})}},{key:"normalizeGeometry",value:function(t){return t}},{key:"updateGeometryAttributes",value:function(t,e,r){throw new Error("Not implemented")}},{key:"getGeometrySize",value:function(t){throw new Error("Not implemented")}},{key:"getGeometryFromBuffer",value:function(t){var e=t.value||t;return Object(c.a)(ArrayBuffer.isView(e)),Object(s.b)(e,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices})}},{key:"_allocate",value:function(t,e){var r=this.attributes,n=this.buffers,i=this._attributeDefs,o=this.typedArrayManager;for(var a in i)if(a in n)o.release(r[a]),r[a]=null;else{var s=i[a];s.copy=e,r[a]=o.allocate(r[a],t,s)}}},{key:"_forEachGeometry",value:function(t,e,r){var n,i=this.data,o=this.getGeometry,a=Object(s.a)(i,e,r),u=a.iterable,c=a.objectInfo,l=h(u);try{for(l.s();!(n=l.n()).done;){var f=n.value;c.index++,t(o(f,c),c.index)}}catch(t){l.e(t)}finally{l.f()}}},{key:"_rebuildGeometry",value:function(t){var e=this;if(this.data&&this.getGeometry){var r=this.indexStarts,n=this.vertexStarts,i=this.instanceCount,o=this.data,a=this.geometryBuffer,s=t||{},u=s.startRow,c=void 0===u?0:u,h=s.endRow,f=void 0===h?1/0:h,p={};if(t||(r=[0],n=[0]),this.normalize||!a)this._forEachGeometry((function(t,r){t=e.normalizeGeometry(t),p[r]=t,n[r+1]=n[r]+e.getGeometrySize(t)}),c,f),i=n[n.length-1];else if(a.buffer instanceof l.a){var d=a.stride||4*this.positionSize;n=o.startIndices,i=n[o.length]||a.buffer.byteLength/d}else{var A=a.value||a,g=a.stride/A.BYTES_PER_ELEMENT||this.positionSize;n=o.startIndices,i=n[o.length]||A.length/g}this._allocate(i,Boolean(t)),this.indexStarts=r,this.vertexStarts=n,this.instanceCount=i;var m={};this._forEachGeometry((function(t,o){t=p[o]||t,m.vertexStart=n[o],m.indexStart=r[o];var a=o<n.length-1?n[o+1]:i;m.geometrySize=a-n[o],m.geometryIndex=o,e.updateGeometryAttributes(t,m)}),c,f),this.vertexCount=r[r.length-1]}}}]),t}()},function(t,e){},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(4),i=r(137);const o={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class a{constructor(t={}){Object(n.a)(this,"props",void 0),Object(n.a)(this,"stats",void 0),Object(n.a)(this,"activeRequestCount",0),Object(n.a)(this,"requestQueue",[]),Object(n.a)(this,"requestMap",new Map),Object(n.a)(this,"deferredUpdate",null),this.props={...o,...t},this.stats=new i.a({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const r={handle:t,priority:0,getPriority:e},n=new Promise(t=>(r.resolve=t,r));return this.requestQueue.push(r),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){const{handle:e,resolve:r}=t;let n=!1;const i=()=>{n||(n=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;e<t;++e){const t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const r=t[e];this._updateRequest(r)||(t.splice(e,1),this.requestMap.delete(r.handle),e--)}t.sort((t,e)=>t.priority-e.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}},function(t,e){},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));const n={name:"JSON",id:"json",module:"json",version:"3.0.8",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:i,parse:async t=>i((new TextDecoder).decode(t)),options:{}};function i(t){return JSON.parse(t)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return g}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),c=r(6),l=r.n(c),h=r(1),f=r.n(h),p=r(275),d=r(14);function A(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}var g=function(t){u()(r,t);var e=A(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"getGeometry",value:function(t){return new p.a}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.elevationScale,i=r.extruded,o=r.offset,a=r.coverage,s=r.cellSize,u=r.angle,c=r.radiusUnits;this.state.model.setUniforms(e).setUniforms({radius:s/2,radiusUnits:d.d[c],angle:u,offset:o,extruded:i,coverage:a,elevationScale:n,edgeDistance:1,isWireframe:!1}).draw()}}]),r}(r(157).a);g.layerName="GridCellLayer",g.defaultProps={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",min:0,value:[1,1]}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return S}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),c=r(6),l=r.n(c),h=r(1),f=r.n(h),p=r(18),d=r(53),A=r(190),g=r(108),m=r(109),y=r(136),v=r(173);function _(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f()(t);if(e){var i=f()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return l()(this,r)}}var w=[0,0,0,255],E={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:function(t){return t.polygon}},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:w},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},S=function(t){u()(r,t);var e=x(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){this.state={paths:[]},this.props.getLineDashArray&&p.a.removed("getLineDashArray","PathStyleExtension")()}},{key:"updateState",value:function(t){var e=this,r=(t.oldProps,t.props,t.changeFlags),n=r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPolygon);if(n&&Array.isArray(r.dataChanged)){var i=this.state.paths.slice(),o=r.dataChanged.map((function(t){return Object(v.a)({data:i,getIndex:function(t){return t.__source.index},dataRange:t,replace:e._getPaths(t)})}));this.setState({paths:i,pathsDiff:o})}else n&&this.setState({paths:this._getPaths(),pathsDiff:null})}},{key:"_getPaths",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.props,n=r.data,i=r.getPolygon,o=r.positionFormat,a=r._normalize,s=[],u="XY"===o?2:3,c=e.startRow,l=e.endRow,h=Object(d.a)(n,c,l),f=h.iterable,p=h.objectInfo,A=_(f);try{for(A.s();!(t=A.n()).done;){var g=t.value;p.index++;var m=i(g,p);a&&(m=y.b(m,u));var v=m,b=v.holeIndices,x=m.positions||m;if(b)for(var w=0;w<=b.length;w++){var E=x.slice(b[w-1]||0,b[w]||x.length);s.push(this.getSubLayerRow({path:E},g,p.index))}else s.push(this.getSubLayerRow({path:x},g,p.index))}}catch(t){A.e(t)}finally{A.f()}return s}},{key:"renderLayers",value:function(){var t=this.props,e=t.data,r=t._dataDiff,n=t.stroked,i=t.filled,o=t.extruded,a=t.wireframe,s=t._normalize,u=t._windingOrder,c=t.elevationScale,l=t.transitions,h=t.positionFormat,f=this.props,p=f.lineWidthUnits,d=f.lineWidthScale,A=f.lineWidthMinPixels,y=f.lineWidthMaxPixels,v=f.lineJointRounded,_=f.lineMiterLimit,b=f.lineDashJustified,x=this.props,E=x.getFillColor,S=x.getLineColor,O=x.getLineWidth,T=x.getLineDashArray,P=x.getElevation,M=x.getPolygon,C=x.updateTriggers,I=x.material,k=this.state,R=k.paths,L=k.pathsDiff,j=this.getSubLayerClass("fill",g.a),D=this.getSubLayerClass("stroke",m.a),B=this.shouldRenderSubLayer("fill",R)&&new j({_dataDiff:r,extruded:o,elevationScale:c,filled:i,wireframe:a,_normalize:s,_windingOrder:u,getElevation:P,getFillColor:E,getLineColor:o&&a?S:w,material:I,transitions:l},this.getSubLayerProps({id:"fill",updateTriggers:{getPolygon:C.getPolygon,getElevation:C.getElevation,getFillColor:C.getFillColor,lineColors:o&&a,getLineColor:C.getLineColor}}),{data:e,positionFormat:h,getPolygon:M});return[!o&&B,!o&&n&&this.shouldRenderSubLayer("stroke",R)&&new D({_dataDiff:L&&function(){return L},widthUnits:p,widthScale:d,widthMinPixels:A,widthMaxPixels:y,jointRounded:v,miterLimit:_,dashJustified:b,_pathType:"loop",transitions:l&&{getWidth:l.getLineWidth,getColor:l.getLineColor,getPath:l.getPolygon},getColor:this.getSubLayerAccessor(S),getWidth:this.getSubLayerAccessor(O),getDashArray:this.getSubLayerAccessor(T)},this.getSubLayerProps({id:"stroke",updateTriggers:{getWidth:C.getLineWidth,getColor:C.getLineColor,getDashArray:C.getLineDashArray}}),{data:R,positionFormat:h,getPath:function(t){return t.path}}),o&&B]}}]),r}(A.a);S.layerName="PolygonLayer",S.defaultProps=E},function(t,e,r){"use strict";r.d(e,"a",(function(){return p}));var n=r(169),i=r(23),o=r(74),a=r(56),s=r(27),u=r(21);const c=Object.freeze([1,0,0,0,1,0,0,0,1]),l=Object.freeze([0,0,0,0,0,0,0,0,0]),h=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),f={};class p extends n.a{static get IDENTITY(){return f.IDENTITY=f.IDENTITY||Object.freeze(new p(c)),f.IDENTITY}static get ZERO(){return f.ZERO=f.ZERO||Object.freeze(new p(l)),f.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return h}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}set(t,e,r,n,i,o,a,s,u){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=a,this[7]=s,this[8]=u,this.check()}setRowMajor(t,e,r,n,i,o,a,s,u){return this[0]=t,this[1]=n,this[2]=a,this[3]=e,this[4]=i,this[5]=s,this[6]=r,this[7]=o,this[8]=u,this.check()}determinant(){return a.b(this)}identity(){return this.copy(c)}fromQuaternion(t){return a.c(this,t),this.check()}transpose(){return a.i(this,this),this.check()}invert(){return a.d(this,this),this.check()}multiplyLeft(t){return a.e(this,t,this),this.check()}multiplyRight(t){return a.e(this,this,t),this.check()}rotate(t){return a.f(this,this,t),this.check()}scale(t){return Array.isArray(t)?a.g(this,this,t):a.g(this,this,[t,t,t]),this.check()}translate(t){return a.h(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=s.i(e||[-0,-0],t,this);break;case 3:e=u.r(e||[-0,-0,-0],t,this);break;case 4:e=Object(o.d)(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(i.b)(e,t.length),e}transformVector(t,e){return Object(i.c)("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return Object(i.c)("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return Object(i.c)("Matrix3.transformVector"),this.transform(t,e)}}},function(t,e,r){"use strict";e.a={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,PI_OVER_TWO:Math.PI/2,PI_OVER_FOUR:Math.PI/4,PI_OVER_SIX:Math.PI/6,TWO_PI:2*Math.PI}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(125);function i(t){try{return JSON.parse(t)}catch(e){throw new Error(`Failed to parse JSON from data starting with "${Object(n.a)(t)}"`)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(168),i=r(13),o=r(23),a=r(27),s=r(74);class u extends n.a{constructor(t=0,e=0){super(2),Object(i.f)(t)&&1===arguments.length?this.copy(t):(i.b.debug&&(Object(o.a)(t),Object(o.a)(e)),this[0]=t,this[1]=e)}set(t,e){return this[0]=t,this[1]=e,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return i.b.debug&&(Object(o.a)(t.x),Object(o.a)(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return a.j(this,this,t),this.check()}transformAsVector(t){return Object(s.a)(this,this,t),this.check()}transformByMatrix3(t){return a.i(this,this,t),this.check()}transformByMatrix2x3(t){return a.h(this,this,t),this.check()}transformByMatrix2(t){return a.g(this,this,t),this.check()}}},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(24),y=r.n(m),v=r(207),_=r(226),b=r(18),x=r(155),w=r(7),E=r(295),S=r(147),O=r(205),T=r(48),P=r(9);class M{constructor(t={}){const{id:e}=t;this.id=e||Object(T.c)(this.constructor.name),this.display=!0,this.position=new S.a,this.rotation=new S.a,this.scale=new S.a(1,1,1),this.matrix=new O.a,this.userData={},this.props={},this._setScenegraphNodeProps(t)}delete(){}setProps(t){return this._setScenegraphNodeProps(t),this}toString(){return`{type: ScenegraphNode, id: ${this.id})}`}setPosition(t){return Object(P.a)(3===t.length,"setPosition requires vector argument"),this.position=t,this}setRotation(t){return Object(P.a)(3===t.length,"setRotation requires vector argument"),this.rotation=t,this}setScale(t){return Object(P.a)(3===t.length,"setScale requires vector argument"),this.scale=t,this}setMatrix(t,e=!0){e?this.matrix.copy(t):this.matrix=t}setMatrixComponents({position:t,rotation:e,scale:r,update:n=!0}){return t&&this.setPosition(t),e&&this.setRotation(e),r&&this.setScale(r),n&&this.updateMatrix(),this}updateMatrix(){const t=this.position,e=this.rotation,r=this.scale;return this.matrix.identity(),this.matrix.translate(t),this.matrix.rotateXYZ(e),this.matrix.scale(r),this}update(t={}){const{position:e,rotation:r,scale:n}=t;return e&&this.setPosition(e),r&&this.setRotation(r),n&&this.setScale(n),this.updateMatrix(),this}getCoordinateUniforms(t,e){Object(P.a)(t),e=e||this.matrix;const r=new O.a(t).multiplyRight(e),n=r.invert(),i=n.transpose();return{viewMatrix:t,modelMatrix:e,objectMatrix:e,worldMatrix:r,worldInverseMatrix:n,worldInverseTransposeMatrix:i}}_setScenegraphNodeProps(t){"display"in t&&(this.display=t.display),"position"in t&&this.setPosition(t.position),"rotation"in t&&this.setRotation(t.rotation),"scale"in t&&this.setScale(t.scale),"matrix"in t&&this.setMatrix(t.matrix),Object.assign(this.props,t)}}var C=r(34),I=r(64);class k extends M{constructor(t={}){t=Array.isArray(t)?{children:t}:t;const{children:e=[]}=t;w.k.assert(e.every(t=>t instanceof M),"every child must an instance of ScenegraphNode"),super(t),this.children=e}add(...t){for(const e of t)Array.isArray(e)?this.add(...e):this.children.push(e);return this}remove(t){const e=this.children,r=e.indexOf(t);return r>-1&&e.splice(r,1),this}removeAll(){return this.children=[],this}delete(){this.children.forEach(t=>t.delete()),this.removeAll(),super.delete()}traverse(t,{worldMatrix:e=new O.a}={}){const r=new O.a(e).multiplyRight(this.matrix);for(const e of this.children)e instanceof k?e.traverse(t,{worldMatrix:r}):t(e,{worldMatrix:r})}}var R=r(228);const L={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},j={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function D(t){if(!t._animation){const e=j[t.componentType],r=L[t.type],n=r*t.count,{buffer:i,byteOffset:o}=t.bufferView.data,a=new e(i,o+(t.byteOffset||0),n);if(1===r)t._animation=Array.from(a);else{const e=[];for(let t=0;t<a.length;t+=r)e.push(Array.from(a.slice(t,t+r)));t._animation=e}}return t._animation}const B=new O.a;const F=new R.a;function z(t,{input:e,interpolation:r,output:n},i,o){const a=t%e[e.length-1],s=e.findIndex(t=>t>=a),u=Math.max(0,s-1);if(!Array.isArray(i[o]))switch(o){case"translation":i[o]=[0,0,0];break;case"rotation":i[o]=[0,0,0,1];break;case"scale":i[o]=[1,1,1];break;default:w.k.warn(`Bad animation path ${o}`)()}Object(P.a)(i[o].length===n[u].length);const c=e[u],l=e[s];switch(r){case"STEP":!function(t,e,r){for(let n=0;n<r.length;n++)t[e][n]=r[n]}(i,o,n[u]);break;case"LINEAR":if(l>c){const t=(a-c)/(l-c);!function(t,e,r,n,i){if("rotation"===e){F.slerp({start:r,target:n,ratio:i});for(let r=0;r<F.length;r++)t[e][r]=F[r]}else for(let o=0;o<r.length;o++)t[e][o]=i*n[o]+(1-i)*r[o]}(i,o,n[u],n[s],t)}break;case"CUBICSPLINE":if(l>c){const t=(a-c)/(l-c),e=l-c;!function(t,e,{p0:r,outTangent0:n,inTangent1:i,p1:o,tDiff:a,ratio:s}){for(let u=0;u<t[e].length;u++){const c=n[u]*a,l=i[u]*a;t[e][u]=(2*Math.pow(s,3)-3*Math.pow(s,2)+1)*r[u]+(Math.pow(s,3)-2*Math.pow(s,2)+s)*c+(-2*Math.pow(s,3)+3*Math.pow(s,2))*o[u]+(Math.pow(s,3)-Math.pow(s,2))*l}}(i,o,{p0:n[3*u+1],outTangent0:n[3*u+2],inTangent1:n[3*s+0],p1:n[3*s+1],tDiff:e,ratio:t})}break;default:w.k.warn(`Interpolation ${r} not supported`)()}}class N{constructor(t){this.startTime=0,this.playing=!0,this.speed=1,this.channels=[],Object.assign(this,t)}animate(t){if(!this.playing)return;const e=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:t,target:r,path:n})=>{z(e,t,r,n),function(t,e){if(e.matrix.identity(),t.translation&&e.matrix.translate(t.translation),t.rotation){const r=B.fromQuaternion(t.rotation);e.matrix.multiplyRight(r)}t.scale&&e.matrix.scale(t.scale)}(r,r._node)})}}class U{constructor(t){this.animations=t.animations.map((e,r)=>{const n=e.name||`Animation-${r}`,i=e.samplers.map(({input:e,interpolation:r="LINEAR",output:n})=>({input:D(t.accessors[e]),interpolation:r,output:D(t.accessors[n])})),o=e.channels.map(({sampler:e,target:r})=>({sampler:i[e],target:t.nodes[r.node],path:r.path}));return new N({name:n,channels:o})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(e=>e.animate(t))}getAnimations(){return this.animations}}var V=r(176);class G extends M{constructor(t,e={}){super(e),this.onBeforeRender=null,this.AfterRender=null,t instanceof V.a?(this.model=t,this._setModelNodeProps(e)):this.model=new V.a(t,e),this.managedResources=e.managedResources||[]}setProps(t){return super.setProps(t),this._setModelNodeProps(t),this}delete(){this.model&&(this.model.delete(),this.model=null),this.managedResources.forEach(t=>t.delete()),this.managedResources=[]}draw(...t){return this.model.draw(...t)}setUniforms(...t){return this.model.setUniforms(...t),this}setAttributes(...t){return this.model.setAttributes(...t),this}updateModuleSettings(...t){return this.model.updateModuleSettings(...t),this}_setModelNodeProps(t){this.model.setProps(t)}}var W=r(239);function H(t,e){return Object(w.j)(t)?`#version 300 es\n${e}`:e}const q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Z={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1};class X{constructor(t,e={}){this.gl=t,this.options=Object.assign({},Z,e)}instantiate(t){return this.gltf=t,(t.scenes||[]).map(t=>this.createScene(t))}createAnimator(){return Array.isArray(this.gltf.animations)?new U(this.gltf):null}createScene(t){const e=(t.nodes||[]).map(t=>this.createNode(t));return new k({id:t.name||t.id,children:e})}createNode(t){if(!t._node){const e=(t.children||[]).map(t=>this.createNode(t));t.mesh&&e.push(this.createMesh(t.mesh));const r=new k({id:t.name||t.id,children:e});if(t.matrix)r.setMatrix(t.matrix);else{if(r.matrix.identity(),t.translation&&r.matrix.translate(t.translation),t.rotation){const e=(new O.a).fromQuaternion(t.rotation);r.matrix.multiplyRight(e)}t.scale&&r.matrix.scale(t.scale)}t._node=r}return t._node}createMesh(t){if(!t._mesh){const e=(t.primitives||[]).map((e,r)=>this.createPrimitive(e,r,t)),r=new k({id:t.name||t.id,children:e});t._mesh=r}return t._mesh}getVertexCount(t){w.k.warn("getVertexCount() not found")()}createPrimitive(t,e,r){return function(t,e){const{id:r,drawMode:n,vertexCount:i,attributes:o,modelOptions:a}=e,s=new W.a(t,e);w.k.info(4,"createGLTFModel defines: ",s.defines)();const u=[];u.push(...s.generatedTextures),u.push(...Object.values(o).map(t=>t.buffer));const c=new G(t,Object.assign({id:r,drawMode:n,vertexCount:i,modules:[E.a],defines:s.defines,parameters:s.parameters,vs:H(t,"\n#if (__VERSION__ < 300)\n  #define _attr attribute\n#else\n  #define _attr in\n#endif\n\n  _attr vec4 POSITION;\n\n  #ifdef HAS_NORMALS\n    _attr vec4 NORMAL;\n  #endif\n\n  #ifdef HAS_TANGENTS\n    _attr vec4 TANGENT;\n  #endif\n\n  #ifdef HAS_UV\n    _attr vec2 TEXCOORD_0;\n  #endif\n\n  void main(void) {\n    vec4 _NORMAL = vec4(0.);\n    vec4 _TANGENT = vec4(0.);\n    vec2 _TEXCOORD_0 = vec2(0.);\n\n    #ifdef HAS_NORMALS\n      _NORMAL = NORMAL;\n    #endif\n\n    #ifdef HAS_TANGENTS\n      _TANGENT = TANGENT;\n    #endif\n\n    #ifdef HAS_UV\n      _TEXCOORD_0 = TEXCOORD_0;\n    #endif\n\n    pbr_setPositionNormalTangentUV(POSITION, _NORMAL, _TANGENT, _TEXCOORD_0);\n    gl_Position = u_MVPMatrix * POSITION;\n  }\n"),fs:H(t,"\n#if (__VERSION__ < 300)\n  #define fragmentColor gl_FragColor\n#else\n  out vec4 fragmentColor;\n#endif\n\n  void main(void) {\n    fragmentColor = pbr_filterColor(vec4(0));\n  }\n"),managedResources:u},a));return c.setProps({attributes:o}),c.setUniforms(s.uniforms),c}(this.gl,Object.assign({id:t.name||`${r.name||r.id}-primitive-${e}`,drawMode:t.mode||4,vertexCount:t.indices?t.indices.count:this.getVertexCount(t.attributes),attributes:this.createAttributes(t.attributes,t.indices),material:t.material},this.options))}createAttributes(t,e){const r={};return Object.keys(t).forEach(e=>{r[e]=this.createAccessor(t[e],this.createBuffer(t[e],this.gl.ARRAY_BUFFER))}),e&&(r.indices=this.createAccessor(e,this.createBuffer(e,this.gl.ELEMENT_ARRAY_BUFFER))),w.k.info(4,"glTF Attributes",{attributes:t,indices:e,generated:r})(),r}createBuffer(t,e){t.bufferView||(t.bufferView={});const{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[e]||(r.lumaBuffers[e]=new C.a(this.gl,{id:`from-${r.id}`,data:r.data||t.value,target:e})),r.lumaBuffers[e]}createAccessor(t,e){return new I.a({buffer:e,offset:t.byteOffset||0,stride:t.bufferView.byteStride||0,type:t.componentType,size:q[t.type]})}createSampler(t){return t}needsPOT(){return!1}}var Q=r(291),Y=r(43),K=r.n(Y),$=r(68),J=r.n($);function tt(){return(tt=J()(K.a.mark((function t(e){var r;return K.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],e.scenes.forEach((function(t){t.traverse((function(t){Object.values(t.model.getUniforms()).forEach((function(t){!1===t.loaded&&r.push(t)}))}))})),t.next=4,et((function(){return r.some((function(t){return!t.loaded}))}));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function et(t){return rt.apply(this,arguments)}function rt(){return(rt=J()(K.a.mark((function t(e){return K.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e()){t.next=5;break}return t.next=3,new Promise((function(t){return requestAnimationFrame(t)}));case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var nt=r(119);function it(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ot(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?it(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):it(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function at(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return ct}));var st=[255,255,255,255],ut={scenegraph:{type:"object",value:null,async:!0},getScene:function(t){return t&&t.scenes?"object"===y()(t.scene)?t.scene:t.scenes[t.scene||0]:t},getAnimator:function(t){return t&&t.animator},_animations:null,sizeScale:{type:"number",value:1,min:0},sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:function(t){return t.position}},getColor:{type:"accessor",value:st},_lighting:"flat",_imageBasedLightingEnvironment:null,getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},loaders:[Q.a]},ct=function(t){f()(r,t);var e=at(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){var t=[v.a,_.a];return"pbr"===this.props._lighting&&t.push(E.a),{vs:"#version 300 es\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin mat3 instanceModelMatrix;\nin vec3 instanceTranslation;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform mat4 sceneModelMatrix;\nuniform bool composeModelMatrix;\nin vec4 POSITION;\n\n#ifdef HAS_UV\n  in vec2 TEXCOORD_0;\n#endif\n\n#ifdef MODULE_PBR\n  #ifdef HAS_NORMALS\n    in vec4 NORMAL;\n  #endif\n#endif\nout vec4 vColor;\n#ifndef MODULE_PBR\n  #ifdef HAS_UV\n    out vec2 vTEXCOORD_0;\n  #endif\n#endif\nvoid main(void) {\n  #if defined(HAS_UV) && !defined(MODULE_PBR)\n    vTEXCOORD_0 = TEXCOORD_0;\n    geometry.uv = vTEXCOORD_0;\n  #endif\n\n  geometry.worldPosition = instancePositions;\n  geometry.pickingColor = instancePickingColors;\n\n  #ifdef MODULE_PBR\n    #ifdef HAS_NORMALS\n      pbr_vNormal = project_normal(instanceModelMatrix * (sceneModelMatrix * vec4(NORMAL.xyz, 0.0)).xyz);\n      geometry.normal = pbr_vNormal;\n    #endif\n\n    #ifdef HAS_UV\n      pbr_vUV = TEXCOORD_0;\n    #else\n      pbr_vUV = vec2(0., 0.);\n    #endif\n    geometry.uv = pbr_vUV;\n  #endif\n\n  float originalSize = project_size_to_pixel(sizeScale);\n  float clampedSize = clamp(originalSize, sizeMinPixels, sizeMaxPixels);\n\n  vec3 pos = (instanceModelMatrix * (sceneModelMatrix * POSITION).xyz) * sizeScale * (clampedSize / originalSize) + instanceTranslation;\n  if(composeModelMatrix) {\n    DECKGL_FILTER_SIZE(pos, geometry);\n    gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n  }\n  else {\n    pos = project_size(pos);\n    DECKGL_FILTER_SIZE(pos, geometry);\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);\n  }\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  #ifdef MODULE_PBR\n    pbr_vPosition = geometry.position.xyz;\n  #endif\n\n  vColor = instanceColors;\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\nuniform float opacity;\nin vec4 vColor;\n\nout vec4 fragmentColor;\n#ifndef MODULE_PBR\n  #if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\n    in vec2 vTEXCOORD_0;\n    uniform sampler2D u_BaseColorSampler;\n  #endif\n#endif\n\nvoid main(void) {\n  #ifdef MODULE_PBR\n    fragmentColor = vColor * pbr_filterColor(vec4(0));\n    geometry.uv = pbr_vUV;\n  #else\n    #if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\n      fragmentColor = vColor * texture2D(u_BaseColorSampler, vTEXCOORD_0);\n      geometry.uv = vTEXCOORD_0;\n    #else\n      fragmentColor = vColor;\n    #endif\n  #endif\n\n  fragmentColor.a *= opacity;\n  DECKGL_FILTER_COLOR(fragmentColor, geometry);\n}\n",modules:t}}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),accessor:"getPosition",transition:!0},instanceColors:{type:5121,size:this.props.colorFormat.length,accessor:"getColor",normalized:!0,defaultValue:st,transition:!0},instanceModelMatrix:nt.a})}},{key:"updateState",value:function(t){l()(g()(r.prototype),"updateState",this).call(this,t);var e=t.props,n=t.oldProps;e.scenegraph!==n.scenegraph?this._updateScenegraph(e):e._animations!==n._animations&&this._applyAnimationsProp(this.state.scenegraph,this.state.animator,e._animations)}},{key:"finalizeState",value:function(){l()(g()(r.prototype),"finalizeState",this).call(this),this._deleteScenegraph()}},{key:"_updateScenegraph",value:function(t){var e=this,r=this.context.gl,n=null;if(t.scenegraph instanceof M)n={scenes:[t.scenegraph]};else if(t.scenegraph&&!t.scenegraph.gltf){var i=t.scenegraph,o=function(t,e,r){const n=new X(t,r);return{scenes:n.instantiate(e),animator:n.createAnimator()}}(r,i,this._getModelOptions());n=ot({gltf:i},o),function(t){return tt.apply(this,arguments)}(o).then((function(){return e.setNeedsRedraw()}))}else t.scenegraph&&(b.a.deprecated("ScenegraphLayer.props.scenegraph","Use GLTFLoader instead of GLTFScenegraphLoader")(),n=t.scenegraph);var a={layer:this,gl:r},s=t.getScene(n,a),u=t.getAnimator(n,a);s instanceof M?(this._deleteScenegraph(),this._applyAllAttributes(s),this._applyAnimationsProp(s,u,t._animations),this.setState({scenegraph:s,animator:u})):null!==s&&b.a.warn("invalid scenegraph:",s)()}},{key:"_applyAllAttributes",value:function(t){var e=this;if(this.state.attributesAvailable){var r=this.getAttributeManager().getAttributes();t.traverse((function(t){e._setModelAttributes(t.model,r)}))}}},{key:"_applyAnimationsProp",value:function(t,e,r){if(t&&e&&r){var n=e.getAnimations();Object.keys(r).sort().forEach((function(t){var e=r[t];if("*"===t)n.forEach((function(t){Object.assign(t,e)}));else if(Number.isFinite(Number(t))){var i=Number(t);i>=0&&i<n.length?Object.assign(n[i],e):b.a.warn("animation ".concat(t," not found"))()}else{var o=n.find((function(e){return e.name===t}));o?Object.assign(o,e):b.a.warn("animation ".concat(t," not found"))()}}))}}},{key:"_deleteScenegraph",value:function(){var t=this.state.scenegraph;t instanceof M&&t.delete()}},{key:"_getModelOptions",value:function(){var t=this.props._imageBasedLightingEnvironment,e=null;return t&&(e="function"==typeof t?t({gl:this.context.gl,layer:this}):t),{gl:this.context.gl,waitForFullLoad:!0,imageBasedLightingEnvironment:e,modelOptions:ot({isInstanced:!0,transpileToGLSL100:!Object(w.j)(this.context.gl)},this.getShaders()),useTangents:!1}}},{key:"updateAttributes",value:function(t){var e=this;this.setState({attributesAvailable:!0}),this.state.scenegraph&&this.state.scenegraph.traverse((function(r){e._setModelAttributes(r.model,t)}))}},{key:"draw",value:function(t){var e=t.moduleParameters,r=void 0===e?null:e,n=t.parameters,i=void 0===n?{}:n,o=t.context;if(this.state.scenegraph){this.props._animations&&this.state.animator&&(this.state.animator.animate(o.timeline.getTime()),this.setNeedsRedraw());var a=this.context.viewport,s=this.props,u=s.sizeScale,c=s.sizeMinPixels,l=s.sizeMaxPixels,h=s.opacity,f=s.coordinateSystem,p=this.getNumInstances();this.state.scenegraph.traverse((function(t,e){var n=e.worldMatrix;t.model.setInstanceCount(p),t.updateModuleSettings(r),t.draw({parameters:i,uniforms:{sizeScale:u,opacity:h,sizeMinPixels:c,sizeMaxPixels:l,composeModelMatrix:Object(nt.b)(a,f),sceneModelMatrix:n,u_Camera:t.model.getUniforms().project_uCameraPosition}})}))}}}]),r}(x.a);ct.layerName="ScenegraphLayer",ct.defaultProps=ut},function(t,e,r){"use strict";var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(8),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),p=r(1),d=r.n(p),A=r(0),g=r.n(A),m=r(18),y=r(190),v=r(173);function _(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function x(t,e){if(!t)return null;var r="startIndices"in t?t.startIndices[e]:e,n=t.featureIds.value[r];return-1!==r?function(t,e,r){var n={properties:b({},t.properties[e])};for(var i in t.numericProps)n.properties[i]=t.numericProps[i].value[r];return n}(t,n,r):null}var w=r(110),E=r(159),S=r(158),O=r(109),T=r(108),P={circle:{type:E.a,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:w.a,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:S.a,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},M={type:O.a,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",getLineColor:"getColor",getLineWidth:"getWidth"}},C={type:T.a,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function I(t){var e=t.type,r=t.props,n={};for(var i in r)n[i]=e.defaultProps[r[i]];return n}function k(t,e){var r=t.props,n=r.transitions,i=r.updateTriggers,o={updateTriggers:{},transitions:n&&{getPosition:n.geometry}};for(var a in e){var s=e[a],u=t.props[a];a.startsWith("get")&&(u=t.getSubLayerAccessor(u),o.updateTriggers[s]=i[a],n&&(o.transitions[s]=n[a])),o[s]=u}return o}function R(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},i=r.startRow,o=void 0===i?0:i,a=r.endRow,s=void 0===a?t.length:a,u=o;u<s;u++){var c=t[u];m.a.assert(c&&c.geometry,"GeoJSON does not have geometry");var l=c.geometry;if("GeometryCollection"===l.type){m.a.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");for(var h=l.geometries,f=0;f<h.length;f++){var p=h[f];L(p,n,e,c,u)}}else L(l,n,e,c,u)}return n}function L(t,e,r,n,i){var o=t.type,a=t.coordinates,s=e.pointFeatures,u=e.lineFeatures,c=e.polygonFeatures,l=e.polygonOutlineFeatures;if(function(t,e){var r=j[t];m.a.assert(r,"Unknown GeoJSON type ".concat(t));for(;e&&--r>0;)e=e[0];return e&&Number.isFinite(e[0])}(o,a))switch(o){case"Point":s.push(r({geometry:t},n,i));break;case"MultiPoint":a.forEach((function(t){s.push(r({geometry:{type:"Point",coordinates:t}},n,i))}));break;case"LineString":u.push(r({geometry:t},n,i));break;case"MultiLineString":a.forEach((function(t){u.push(r({geometry:{type:"LineString",coordinates:t}},n,i))}));break;case"Polygon":c.push(r({geometry:t},n,i)),a.forEach((function(t){l.push(r({geometry:{type:"LineString",coordinates:t}},n,i))}));break;case"MultiPolygon":a.forEach((function(t){c.push(r({geometry:{type:"Polygon",coordinates:t}},n,i)),t.forEach((function(t){l.push(r({geometry:{type:"LineString",coordinates:t}},n,i))}))}))}else m.a.warn("".concat(o," coordinates are malformed"))()}var j={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function D(t){return t.geometry.coordinates}function B(t,e){var r={points:{},lines:{},polygons:{},polygonsOutline:{}},n=t.points,i=t.lines,o=t.polygons,a=function(t,e){var r={points:null,lines:null,polygons:null};for(var n in r){var i=t[n].globalFeatureIds.value;r[n]=new Uint8ClampedArray(3*i.length);for(var o=[],a=0;a<i.length;a++)e(i[a],o),r[n][3*a+0]=o[0],r[n][3*a+1]=o[1],r[n][3*a+2]=o[2]}return r}(t,e);return r.points.data={length:n.positions.value.length/n.positions.size,attributes:{getPosition:n.positions,instancePickingColors:{size:3,value:a.points}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{getPath:i.positions,instancePickingColors:{size:3,value:a.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines._pathType="open",r.polygons.data={length:o.polygonIndices.value.length-1,startIndices:o.polygonIndices.value,attributes:{getPolygon:o.positions,pickingColors:{size:3,value:a.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygons._normalize=!1,o.triangles&&(r.polygons.data.attributes.indices=o.triangles.value),r.polygonsOutline.data={length:o.primitivePolygonIndices.value.length-1,startIndices:o.primitivePolygonIndices.value,attributes:{getPath:o.positions,instancePickingColors:{size:3,value:a.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygonsOutline._pathType="open",r}function F(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function U(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?U(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r.d(e,"a",(function(){return W}));var G=V(V(V(V(V(V({},I(P.circle)),I(P.icon)),I(P.text)),I(M)),I(C)),{},{stroked:!0,filled:!0,extruded:!1,wireframe:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:function(t){return t.properties.icon}},getText:{type:"accessor",value:function(t){return t.properties.text}},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}}),W=function(t){l()(r,t);var e=N(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){this.state={layerProps:{},features:{}},this.props.getLineDashArray&&m.a.removed("getLineDashArray","PathStyleExtension")()}},{key:"updateState",value:function(t){var e=t.props,r=t.changeFlags;if(r.dataChanged){var n=this.props.data,i=n&&"points"in n&&"polygons"in n&&"lines"in n;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:r}):this._updateStateJSON({props:e,changeFlags:r})}}},{key:"_updateStateBinary",value:function(t){var e=t.props,r=(t.changeFlags,B(e.data,this.encodePickingColor));this.setState({layerProps:r})}},{key:"_updateStateJSON",value:function(t){var e=t.props,r=t.changeFlags,n=function(t){if(Array.isArray(t))return t;switch(m.a.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return m.a.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}(e.data),i=this.getSubLayerRow.bind(this),o={},a={};if(Array.isArray(r.dataChanged)){var s=this.state.features;for(var u in s)o[u]=s[u].slice(),a[u]=[];var c,l=F(r.dataChanged);try{for(l.s();!(c=l.n()).done;){var h=c.value,f=R(n,i,h);for(var p in s)a[p].push(Object(v.a)({data:o[p],getIndex:function(t){return t.__source.index},dataRange:h,replace:f[p]}))}}catch(t){l.e(t)}finally{l.f()}}else o=R(n,i);var d=function(t,e){var r={points:{},lines:{},polygons:{},polygonsOutline:{}},n=t.pointFeatures,i=t.lineFeatures,o=t.polygonFeatures,a=t.polygonOutlineFeatures;return r.points.data=n,r.points._dataDiff=e.pointFeatures&&function(){return e.pointFeatures},r.points.getPosition=D,r.lines.data=i,r.lines._dataDiff=e.lineFeatures&&function(){return e.lineFeatures},r.lines.getPath=D,r.polygons.data=o,r.polygons._dataDiff=e.polygonFeatures&&function(){return e.polygonFeatures},r.polygons.getPolygon=D,r.polygonsOutline.data=a,r.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&function(){return e.polygonOutlineFeatures},r.polygonsOutline.getPath=D,r}(o,a);this.setState({features:o,featuresDiff:a,layerProps:d})}},{key:"_updateAutoHighlight",value:function(t){var e,r="".concat(this.id,"-points-"),n=t.sourceLayer.id.startsWith(r),i=F(this.getSubLayers());try{for(i.s();!(e=i.n()).done;){var o=e.value;o.id.startsWith(r)===n&&o.updateAutoHighlight(t)}}catch(t){i.e(t)}finally{i.f()}}},{key:"_renderPolygonLayer",value:function(){var t=this.props,e=t.extruded,r=t.wireframe,n=this.state.layerProps,i="polygons-fill",o=this.shouldRenderSubLayer(i,n.polygons.data)&&this.getSubLayerClass(i,C.type);if(o){var a=k(this,C.props),s=e&&r;return s||delete a.getLineColor,a.updateTriggers.lineColors=s,new o(a,this.getSubLayerProps({id:i,updateTriggers:a.updateTriggers}),n.polygons)}return null}},{key:"_renderLineLayers",value:function(){var t=this.props,e=t.extruded,r=t.stroked,n=this.state.layerProps,i=!e&&r&&this.shouldRenderSubLayer("polygons-stroke",n.polygonsOutline.data)&&this.getSubLayerClass("polygons-stroke",M.type),o=this.shouldRenderSubLayer("linestrings",n.lines.data)&&this.getSubLayerClass("linestrings",M.type);if(i||o){var a=k(this,M.props);return[i&&new i(a,this.getSubLayerProps({id:"polygons-stroke",updateTriggers:a.updateTriggers}),n.polygonsOutline),o&&new o(a,this.getSubLayerProps({id:"linestrings",updateTriggers:a.updateTriggers}),n.lines)]}return null}},{key:"_renderPointLayers",value:function(){var t=this.props.pointType,e=this.state,r=e.layerProps,n=e.binary,i=this.props.highlightedObjectIndex;!n&&Number.isFinite(i)&&(i=r.points.data.findIndex((function(t){return t.__source.index===i})));var o,a=[],s=F(new Set(t.split("+")));try{for(s.s();!(o=s.n()).done;){var u=o.value,c="points-".concat(u),l=P[u],h=l&&this.shouldRenderSubLayer(c,r.points.data)&&this.getSubLayerClass(c,l.type);if(h){var f=k(this,l.props);a.push(new h(f,this.getSubLayerProps({id:c,updateTriggers:f.updateTriggers,highlightedObjectIndex:i}),r.points))}}}catch(t){s.e(t)}finally{s.f()}return a}},{key:"renderLayers",value:function(){var t=this.props.extruded,e=this._renderPolygonLayer();return[!t&&e,this._renderLineLayers(),this._renderPointLayers(),t&&e]}},{key:"getSubLayerAccessor",value:function(t){return this.state.binary&&"function"==typeof t?function(e,r){var n=x(r.data,r.index);return t(n,r)}:u()(d()(r.prototype),"getSubLayerAccessor",this).call(this,t)}}]),r}(y.a);W.layerName="GeoJsonLayer",W.defaultProps=G},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(226),v=r(14),_=r(155),b=r(176),x=r(62);function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return P}));var O=[0,0,0,255],T={getSourcePosition:{type:"accessor",value:function(t){return t.sourcePosition}},getTargetPosition:{type:"accessor",value:function(t){return t.targetPosition}},getSourceColor:{type:"accessor",value:O},getTargetColor:{type:"accessor",value:O},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},P=function(t){f()(r,t);var e=S(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instanceHeights;\nattribute float instanceTilts;\n\nuniform bool greatCircle;\nuniform bool useShortestPath;\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n\n  float deltaZ = targetZ - sourceZ;\n  float dh = distance * instanceHeights;\n  if (dh == 0.0) {\n    return sourceZ + deltaZ * ratio;\n  }\n  float unitZ = deltaZ / dh;\n  float p2 = unitZ * unitZ + 1.0;\n  float dir = step(deltaZ, 0.0);\n  float z0 = mix(sourceZ, targetZ, dir);\n  float r = mix(ratio, 1.0 - ratio, dir);\n  return sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n  return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n  return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n  float distance = length(source.xy - target.xy);\n  float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n  float tiltAngle = radians(instanceTilts);\n  vec2 tiltDirection = normalize(target.xy - source.xy);\n  vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n  return vec3(\n    mix(source.xy, target.xy, segmentRatio) + tilt,\n    z * cos(tiltAngle)\n  );\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n  vec2 sourceRadians = radians(source);\n  vec2 targetRadians = radians(target);\n  vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n  vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n  float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n  return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n  vec2 lngLat;\n  if(abs(angularDist - PI) < 0.001) {\n    lngLat = (1.0 - t) * source.xy + t * target.xy;\n  } else {\n    float a = sin((1.0 - t) * angularDist);\n    float b = sin(t * angularDist);\n    vec3 p = source3D.yxz * a + target3D.yxz * b;\n    lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n  }\n\n  float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n  return vec3(lngLat, z);\n}\n\nvoid main(void) {\n  geometry.worldPosition = instanceSourcePositions;\n  geometry.worldPositionAlt = instanceTargetPositions;\n\n  float segmentIndex = positions.x;\n  float segmentRatio = getSegmentRatio(segmentIndex);\n  float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n  float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));\n  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n  isValid = 1.0;\n\n  uv = vec2(segmentRatio, positions.y);\n  geometry.uv = uv;\n  geometry.pickingColor = instancePickingColors;\n\n  vec4 curr;\n  vec4 next;\n  vec3 source;\n  vec3 target;\n\n  if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n    source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n    target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n    float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n    vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n    vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n    vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n    if (abs(currPos.x - prevPos.x) > 180.0) {\n      indexDir = -1.0;\n      isValid = 0.0;\n    } else if (abs(currPos.x - nextPos.x) > 180.0) {\n      indexDir = 1.0;\n      isValid = 0.0;\n    }\n    nextPos = indexDir < 0.0 ? prevPos : nextPos;\n    nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n    if (isValid == 0.0) {\n      nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n      float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n      currPos = mix(currPos, nextPos, t);\n      segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n    }\n\n    vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n    vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n  \n    curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n    next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n  \n  } else {\n    vec3 source_world = instanceSourcePositions;\n    vec3 target_world = instanceTargetPositions;\n    if (useShortestPath) {\n      source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n      target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n      float deltaLng = target_world.x - source_world.x;\n      if (deltaLng > 180.) target_world.x -= 360.;\n      if (deltaLng < -180.) source_world.x -= 360.;\n    }\n    source = project_position(source_world, instanceSourcePositions64Low);\n    target = project_position(target_world, instanceTargetPositions64Low);\n    float antiMeridianX = 0.0;\n\n    if (useShortestPath) {\n      if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n        antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n      }\n      float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n      if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n        isValid = 0.0;\n        indexDir = sign(segmentRatio - thresholdRatio);\n        segmentRatio = thresholdRatio;\n      }\n    }\n\n    nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n    vec3 currPos = interpolateFlat(source, target, segmentRatio);\n    vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n    if (useShortestPath) {\n      if (nextPos.x < antiMeridianX) {\n        currPos.x += TILE_SIZE;\n        nextPos.x += TILE_SIZE;\n      }\n    }\n\n    curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n    next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n    geometry.position = vec4(currPos, 1.0);\n  }\n  float widthPixels = clamp(\n    project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n    widthMinPixels, widthMaxPixels\n  );\n  vec3 offset = vec3(\n    getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),\n    0.0);\n  DECKGL_FILTER_SIZE(offset, geometry);\n  gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n  vColor = vec4(color.rgb, color.a * opacity);\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nvoid main(void) {\n  if (isValid == 0.0) {\n    discard;\n  }\n\n  gl_FragColor = vColor;\n  geometry.uv = uv;\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getSourceColor",defaultValue:O},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getTargetColor",defaultValue:O},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),i.extensionsChanged){var o,a=this.context.gl;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(a),this.getAttributeManager().invalidateAll()}}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.widthUnits,i=r.widthScale,o=r.widthMinPixels,a=r.widthMaxPixels,s=r.greatCircle,u=r.wrapLongitude;this.state.model.setUniforms(e).setUniforms({greatCircle:s,widthUnits:v.d[n],widthScale:i,widthMinPixels:o,widthMaxPixels:a,useShortestPath:u}).draw()}},{key:"_getModel",value:function(t){for(var e=[],r=0;r<50;r++)e=e.concat([r,1,0,r,-1,0]);var n=new b.a(t,E(E({},this.getShaders()),{},{id:this.props.id,geometry:new x.a({drawMode:5,attributes:{positions:new Float32Array(e)}}),isInstanced:!0}));return n.setUniforms({numSegments:50}),n}},{key:"wrapLongitude",get:function(){return!1}}]),r}(_.a);P.layerName="ArcLayer",P.defaultProps=T},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(226),v=r(14),_=r(155),b=r(176),x=r(62);function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return T}));var O={getSourcePosition:{type:"accessor",value:function(t){return t.sourcePosition}},getTargetPosition:{type:"accessor",value:function(t){return t.targetPosition}},getColor:{type:"accessor",value:[0,0,0,255]},getWidth:{type:"accessor",value:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},T=function(t){f()(r,t);var e=S(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME line-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\n\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float useShortestPath;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n  return dir_screenspace * offset_direction * width / 2.0;\n}\n\nvec3 splitLine(vec3 a, vec3 b, float x) {\n  float t = (x - a.x) / (b.x - a.x);\n  return vec3(x, mix(a.yz, b.yz, t));\n}\n\nvoid main(void) {\n  geometry.worldPosition = instanceSourcePositions;\n  geometry.worldPositionAlt = instanceTargetPositions;\n\n  vec3 source_world = instanceSourcePositions;\n  vec3 target_world = instanceTargetPositions;\n  vec3 source_world_64low = instanceSourcePositions64Low;\n  vec3 target_world_64low = instanceTargetPositions64Low;\n\n  if (useShortestPath > 0.5 || useShortestPath < -0.5) {\n    source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n    target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n    float deltaLng = target_world.x - source_world.x;\n\n    if (deltaLng * useShortestPath > 180.) {\n      source_world.x += 360. * useShortestPath;\n      source_world = splitLine(source_world, target_world, 180. * useShortestPath);\n      source_world_64low = vec3(0.0);\n    } else if (deltaLng * useShortestPath < -180.) {\n      target_world.x += 360. * useShortestPath;\n      target_world = splitLine(source_world, target_world, 180. * useShortestPath);\n      target_world_64low = vec3(0.0);\n    } else if (useShortestPath < 0.) {\n      gl_Position = vec4(0.);\n      return;\n    }\n  }\n  vec4 source_commonspace;\n  vec4 target_commonspace;\n  vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);\n  vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);\n  float segmentIndex = positions.x;\n  vec4 p = mix(source, target, segmentIndex);\n  geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);\n  uv = positions.xy;\n  geometry.uv = uv;\n  geometry.pickingColor = instancePickingColors;\n  float widthPixels = clamp(\n    project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n    widthMinPixels, widthMaxPixels\n  );\n  vec3 offset = vec3(\n    getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),\n    0.0);\n  DECKGL_FILTER_SIZE(offset, geometry);\n  gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME line-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\n\nvoid main(void) {\n  geometry.uv = uv;\n\n  gl_FragColor = vColor;\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),i.extensionsChanged){var o,a=this.context.gl;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(a),this.getAttributeManager().invalidateAll()}}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.widthUnits,i=r.widthScale,o=r.widthMinPixels,a=r.widthMaxPixels,s=r.wrapLongitude;this.state.model.setUniforms(e).setUniforms({widthUnits:v.d[n],widthScale:i,widthMinPixels:o,widthMaxPixels:a,useShortestPath:s?1:0}).draw(),s&&this.state.model.setUniforms({useShortestPath:-1}).draw()}},{key:"_getModel",value:function(t){return new b.a(t,E(E({},this.getShaders()),{},{id:this.props.id,geometry:new x.a({drawMode:5,attributes:{positions:new Float32Array([0,-1,0,0,1,0,1,-1,0,1,1,0])}}),isInstanced:!0}))}},{key:"wrapLongitude",get:function(){return!1}}]),r}(_.a);T.layerName="LineLayer",T.defaultProps=O},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(207),y=r(227),v=r(226),_=r(14),b=r(155),x=r(176),w=r(62);function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function O(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"a",(function(){return C}));var T=[0,0,0,255],P=[0,0,1],M={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:function(t){return t.position}},getNormal:{type:"accessor",value:P},getColor:{type:"accessor",value:T},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};var C=function(t){f()(r,t);var e=O(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){return l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#define SHADER_NAME point-cloud-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\nuniform int sizeUnits;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n  geometry.normal = project_normal(instanceNormals);\n  unitPosition = positions.xy;\n  geometry.uv = unitPosition;\n  geometry.pickingColor = instancePickingColors;\n  vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0);\n  DECKGL_FILTER_SIZE(offset, geometry);\n\n  gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);\n  gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n  vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n  vColor = vec4(lightColor, instanceColors.a * opacity);\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME point-cloud-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n  geometry.uv = unitPosition;\n\n  float distToCenter = length(unitPosition);\n\n  if (distToCenter > 1.0) {\n    discard;\n  }\n\n  gl_FragColor = vColor;\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[m.a,y.a,v.a]})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:P},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getColor",defaultValue:T}})}},{key:"updateState",value:function(t){var e,n,i,o=t.props,a=t.oldProps,s=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:o,oldProps:a,changeFlags:s}),s.extensionsChanged){var u,c=this.context.gl;null===(u=this.state.model)||void 0===u||u.delete(),this.state.model=this._getModel(c),this.getAttributeManager().invalidateAll()}s.dataChanged&&(e=o.data,n=e.header,i=e.attributes,n&&i&&(e.length=n.vertexCount,i.POSITION&&(i.instancePositions=i.POSITION),i.NORMAL&&(i.instanceNormals=i.NORMAL),i.COLOR_0&&(i.instanceColors=i.COLOR_0)))}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.pointSize,i=r.sizeUnits;this.state.model.setUniforms(e).setUniforms({sizeUnits:_.d[i],radiusPixels:n}).draw()}},{key:"_getModel",value:function(t){for(var e=[],r=0;r<3;r++){var n=r/3*Math.PI*2;e.push(2*Math.cos(n),2*Math.sin(n),0)}return new x.a(t,S(S({},this.getShaders()),{},{id:this.props.id,geometry:new w.a({drawMode:4,attributes:{positions:new Float32Array(e)}}),isInstanced:!0}))}}]),r}(b.a);C.layerName="PointCloudLayer",C.defaultProps=M},function(t,e,r){"use strict";var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(18),y=r(207),v=r(227),_=r(226),b=r(155),x=r(62),w=r(7),E=r(98),S=r(176),O=r(240),T=r(179),P=r(119);function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}function k(t,e){(t.COLOR_0||t.colors)&&e||(t.colors={constant:!0,value:new Float32Array([1,1,1])}),m.a.assert(t.positions||t.POSITION,'no "postions" or "POSITION" attribute in mesh')}function R(t,e){if(t.attributes)return k(t.attributes,e),t instanceof x.a?t:new x.a(t);if(t.positions||t.POSITION)return k(t,e),new x.a({attributes:t});throw Error("Invalid mesh")}r.d(e,"a",(function(){return j}));var L={mesh:{value:null,type:"object",async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_useMeshColors:{type:"boolean",value:!1},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:function(t){return t.position}},getColor:{type:"accessor",value:[0,0,0,255]},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]}},j=function(t){f()(r,t);var e=I(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"getShaders",value:function(){var t=!Object(w.j)(this.context.gl),e={};return Object(O.b)(this.context.gl,T.a.GLSL_DERIVATIVES)&&(e.DERIVATIVES_AVAILABLE=1),l()(g()(r.prototype),"getShaders",this).call(this,{vs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nuniform float sizeScale;\nuniform bool composeModelMatrix;\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin mat3 instanceModelMatrix;\nin vec3 instanceTranslation;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\n\nvoid main(void) {\n  geometry.worldPosition = instancePositions;\n  geometry.uv = texCoords;\n  geometry.pickingColor = instancePickingColors;\n\n  vTexCoord = texCoords;\n  cameraPosition = project_uCameraPosition;\n  normals_commonspace = project_normal(instanceModelMatrix * normals);\n  vColor = vec4(colors * instanceColors.rgb, instanceColors.a);\n  geometry.normal = normals_commonspace;\n\n  vec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;\n\n  if (composeModelMatrix) {\n    DECKGL_FILTER_SIZE(pos, geometry);\n    gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);\n  }\n  else {\n    pos = project_size(pos);\n    DECKGL_FILTER_SIZE(pos, geometry);\n    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);\n  }\n\n  geometry.position = position_commonspace;\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n  geometry.uv = vTexCoord;\n\n  vec3 normal;\n  if (flatShading) {\n#ifdef DERIVATIVES_AVAILABLE\n    normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n    normal = vec3(0.0, 0.0, 1.0);\n#endif\n  } else {\n    normal = normals_commonspace;\n  }\n\n  vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n  vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n  fragColor = vec4(lightColor, color.a * opacity);\n\n  DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[y.a,v.b,_.a],transpileToGLSL100:t,defines:e})}},{key:"initializeState",value:function(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:5130,fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:5121,transition:!0,size:this.props.colorFormat.length,normalized:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:P.a}),this.setState({emptyTexture:new E.a(this.context.gl,{data:new Uint8Array(4),width:1,height:1})})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;if(l()(g()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),e.mesh!==n.mesh||i.extensionsChanged){var o;if(null===(o=this.state.model)||void 0===o||o.delete(),e.mesh){this.state.model=this.getModel(e.mesh);var a=e.mesh.attributes||e.mesh;this.setState({hasNormals:Boolean(a.NORMAL||a.normals)})}this.getAttributeManager().invalidateAll()}e.texture!==n.texture&&this.setTexture(e.texture),this.state.model&&this.state.model.setDrawMode(this.props.wireframe?3:4)}},{key:"finalizeState",value:function(){l()(g()(r.prototype),"finalizeState",this).call(this),this.state.emptyTexture.delete()}},{key:"draw",value:function(t){var e=t.uniforms;if(this.state.model){var r=this.context.viewport,n=this.props,i=n.sizeScale,o=n.coordinateSystem,a=n._instanced;this.state.model.setUniforms(e).setUniforms({sizeScale:i,composeModelMatrix:!a||Object(P.b)(r,o),flatShading:!this.state.hasNormals}).draw()}}},{key:"getModel",value:function(t){var e=new S.a(this.context.gl,C(C({},this.getShaders()),{},{id:this.props.id,geometry:R(t,this.props._useMeshColors),isInstanced:!0})),r=this.props.texture,n=this.state.emptyTexture;return e.setUniforms({sampler:r||n,hasTexture:Boolean(r)}),e}},{key:"setTexture",value:function(t){var e=this.state,r=e.emptyTexture,n=e.model;null==n||n.setUniforms({sampler:t||r,hasTexture:Boolean(t)})}}]),r}(b.a);j.layerName="SimpleMeshLayer",j.defaultProps=L},function(t,e,r){"use strict";var n=r(0),i=r.n(n);const o={pickingSelectedColor:null,pickingHighlightColor:new Uint8Array([0,255,255,255]),pickingActive:!1,pickingAttribute:!1};const a={name:"picking",vs:"uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n  return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n  return\n    picking_uSelectedColorValid &&\n    !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n  if (picking_uActive) {\n    picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n    if (!picking_uAttribute) {\n      picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n    }\n  } else {\n    picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n  }\n}\n\nvoid picking_setPickingAttribute(float value) {\n  if (picking_uAttribute) {\n    picking_vRGBcolor_Avalid.r = value;\n  }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n  if (picking_uAttribute) {\n    picking_vRGBcolor_Avalid.rg = value;\n  }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n  if (picking_uAttribute) {\n    picking_vRGBcolor_Avalid.rgb = value;\n  }\n}\n",fs:"uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n  if (picking_uActive) {\n    return color;\n  }\n  bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n  if (selected) {\n    float highLightAlpha = picking_uHighlightColor.a;\n    float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n    float highLightRatio = highLightAlpha / blendedAlpha;\n\n    vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n    return vec4(blendedRGB, blendedAlpha);\n  } else {\n    return color;\n  }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n  if (picking_uActive) {\n    if (picking_vRGBcolor_Avalid.a == 0.0) {\n      discard;\n    }\n    return picking_vRGBcolor_Avalid;\n  }\n  return color;\n}\nvec4 picking_filterColor(vec4 color) {\n  vec4 highightColor = picking_filterHighlightColor(color);\n  return picking_filterPickingColor(highightColor);\n}\n\n",getUniforms:function(t=o){const e={};if(void 0!==t.pickingSelectedColor)if(t.pickingSelectedColor){const r=t.pickingSelectedColor.slice(0,3);e.picking_uSelectedColorValid=1,e.picking_uSelectedColor=r}else e.picking_uSelectedColorValid=0;if(t.pickingHighlightColor){const r=Array.from(t.pickingHighlightColor,t=>t/255);Number.isFinite(r[3])||(r[3]=1),e.picking_uHighlightColor=r}return void 0!==t.pickingActive&&(e.picking_uActive=Boolean(t.pickingActive),e.picking_uAttribute=Boolean(t.pickingAttribute)),e}};function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}e.a=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({inject:{"vs:DECKGL_FILTER_COLOR":"\n  picking_setPickingColor(geometry.pickingColor);\n  // for picking depth values\n  picking_setPickingAttribute(geometry.position.z);\n  ","fs:DECKGL_FILTER_COLOR":{order:99,injection:"\n  // use highlight color if this fragment belongs to the selected object.\n  color = picking_filterHighlightColor(color);\n\n  // use picking color if rendering to picking FBO.\n  color = picking_filterPickingColor(color);\n    "}}},a)},function(t,e,r){"use strict";var n=r(138),i="\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3  lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n    vec3 halfway_direction = normalize(light_direction + view_direction);\n    float lambertian = dot(light_direction, normal_worldspace);\n    float specular = 0.0;\n    if (lambertian > 0.0) {\n      float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n      specular = pow(specular_angle, lighting_uShininess);\n    }\n    lambertian = max(lambertian, 0.0);\n    return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n  vec3 lightColor = surfaceColor;\n\n  if (lighting_uEnabled) {\n    vec3 view_direction = normalize(cameraPosition - position_worldspace);\n    lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n    for (int i = 0; i < MAX_LIGHTS; i++) {\n      if (i >= lighting_uPointLightCount) {\n        break;\n      }\n      PointLight pointLight = lighting_uPointLight[i];\n      vec3 light_position_worldspace = pointLight.position;\n      vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n      lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n    }\n\n    for (int i = 0; i < MAX_LIGHTS; i++) {\n      if (i >= lighting_uDirectionalLightCount) {\n        break;\n      }\n      DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n      lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n    }\n  }\n  return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n  vec3 lightColor = vec3(0, 0, 0);\n  vec3 surfaceColor = vec3(0, 0, 0);\n\n  if (lighting_uEnabled) {\n    vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n    for (int i = 0; i < MAX_LIGHTS; i++) {\n      if (i >= lighting_uPointLightCount) {\n        break;\n      }\n      PointLight pointLight = lighting_uPointLight[i];\n      vec3 light_position_worldspace = pointLight.position;\n      vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n      lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n    }\n\n    for (int i = 0; i < MAX_LIGHTS; i++) {\n      if (i >= lighting_uDirectionalLightCount) {\n        break;\n      }\n      DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n      lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n    }\n  }\n  return lightColor;\n}\n";r.d(e,"a",(function(){return s})),r.d(e,"b",(function(){return u}));const o={};function a(t=o){if(!("material"in t))return{};const{material:e}=t;return e?function(t){const{ambient:e=.35,diffuse:r=.6,shininess:n=32,specularColor:i=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:n,lighting_uSpecularColor:i.map(t=>t/255)}}(e):{lighting_uEnabled:!1}}const s={name:"gouraud-lighting",dependencies:[n.a],vs:i,defines:{LIGHTING_VERTEX:1},getUniforms:a},u={name:"phong-lighting",dependencies:[n.a],fs:i,defines:{LIGHTING_FRAGMENT:1},getUniforms:a}},function(t,e,r){"use strict";var n=r(111),i=r(23),o=r(42),a=r(12),s=r(56),u=r(21),c=r(28);function l(){var t=new a.a(4);return a.a!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function h(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function f(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],u=r[1],c=r[2],l=r[3];return t[0]=n*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-n*c,t[2]=o*l+a*c+n*u-i*s,t[3]=a*l-n*s-i*u-o*c,t}function p(t,e,r,n){var i,o,s,u,c,l=e[0],h=e[1],f=e[2],p=e[3],d=r[0],A=r[1],g=r[2],m=r[3];return(o=l*d+h*A+f*g+p*m)<0&&(o=-o,d=-d,A=-A,g=-g,m=-m),1-o>a.b?(i=Math.acos(o),s=Math.sin(i),u=Math.sin((1-n)*i)/s,c=Math.sin(n*i)/s):(u=1-n,c=n),t[0]=u*l+c*d,t[1]=u*h+c*A,t[2]=u*f+c*g,t[3]=u*p+c*m,t}function d(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t}c.b,c.g,c.c,c.l;var A,g,m,y,v,_,b=c.a,x=c.k,w=c.d,E=c.i,S=c.h,O=c.m,T=c.j,P=(c.f,c.e,A=u.c(),g=u.f(1,0,0),m=u.f(0,1,0),function(t,e,r){var n=u.e(e,r);return n<-.999999?(u.d(A,g,e),u.g(A)<1e-6&&u.d(A,m,e),u.l(A,A),h(t,A,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(u.d(A,e,r),t[0]=A[0],t[1]=A[1],t[2]=A[2],t[3]=1+n,T(t,t))});y=l(),v=l(),_=s.a();r.d(e,"a",(function(){return C}));const M=[0,0,0,1];class C extends n.a{constructor(t=0,e=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,r,n){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this.check()}fromMatrix3(t){return d(this,t),this.check()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.check()}fromAxisRotation(t,e){return h(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Object(i.a)(t)}get y(){return this[1]}set y(t){this[1]=Object(i.a)(t)}get z(){return this[2]}set z(t){this[2]=Object(i.a)(t)}get w(){return this[3]}set w(t){this[3]=Object(i.a)(t)}len(){return S(this)}lengthSquared(){return O(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return w(this,t)}rotationTo(t,e){return P(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return b(this,this,t),this.check()}calculateW(){var t,e,r,n,i;return t=this,r=(e=this)[0],n=e[1],i=e[2],t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),this.check()}conjugate(){var t,e;return e=this,(t=this)[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],this.check()}invert(){var t,e,r,n,i,o,a,s;return t=this,r=(e=this)[0],n=e[1],i=e[2],o=e[3],s=(a=r*r+n*n+i*i+o*o)?1/a:0,t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,this.check()}lerp(t,e,r){return E(this,t,e,r),this.check()}multiplyRight(t,e){return Object(o.a)(!e),f(this,this,t),this.check()}multiplyLeft(t,e){return Object(o.a)(!e),f(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);t[0]=n*u+a*s,t[1]=i*u+o*s,t[2]=o*u-i*s,t[3]=a*u-n*s}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);t[0]=n*u-o*s,t[1]=i*u+a*s,t[2]=o*u+n*s,t[3]=a*u-i*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);t[0]=n*u+i*s,t[1]=i*u-n*s,t[2]=o*u+a*s,t[3]=a*u-o*s}(this,this,t),this.check()}scale(t){return x(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=M,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return p(this,t,e,r),this.check()}transformVector4(t,e=t){return c.o(e,t,this),Object(i.b)(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(26);const i={};function o(t,e){var r;i[t]=!0,void 0!==e&&(r=e,n.global.console&&n.global.console.error&&n.global.console.error(r))}const a=function t(e){const r=e.gl;this.ext=e,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(e.maxVertexAttribs);for(let e=0;e<this.attribs.length;e++){const n=new t.VertexAttrib(r);this.attribs[e]=n}this.maxAttrib=0};(a.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()}).prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};const s=function(t){const e=this;this.gl=t,function(t){const e=t.getError;t.getError=function(){let r;do{r=e.apply(t),0!==r&&(i[r]=!0)}while(0!==r);for(r in i)if(i[r])return delete i[r],parseInt(r,10);return 0}}(t);const r=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(t){return t===e.VERTEX_ARRAY_BINDING_OES?e.currentVertexArrayObject===e.defaultVertexArrayObject?null:e.currentVertexArrayObject:r.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(t){const n=e.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,t);const i=n.attribs[t];return i.enabled=!0,r.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(t){const n=e.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,t);const i=n.attribs[t];return i.enabled=!1,r.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(t,n){switch(t){case 34962:e.currentArrayBuffer=n;break;case 34963:e.currentVertexArrayObject.elementArrayBuffer=n}return r.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(t,n){const i=e.currentVertexArrayObject,o=i.attribs[t];switch(n){case 34975:return o.buffer;case 34338:return o.enabled;case 34339:return o.size;case 34340:return o.stride;case 34341:return o.type;case 34922:return o.normalized;default:return r.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(t,n,i,o,a,s){const u=e.currentVertexArrayObject;u.maxAttrib=Math.max(u.maxAttrib,t);const c=u.attribs[t];return c.buffer=e.currentArrayBuffer,c.size=n,c.type=i,c.normalized=o,c.stride=a,c.offset=s,c.recache(),r.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{var t;t="OESVertexArrayObject emulation library context restored",n.global.console&&n.global.console.log&&n.global.console.log(t),e.reset_()},!0),this.reset_()};function u(t){if("function"==typeof t.createVertexArray)return;const e=t.getSupportedExtensions;t.getSupportedExtensions=function(){const t=e.call(this)||[];return t.indexOf("OES_vertex_array_object")<0&&t.push("OES_vertex_array_object"),t};const r=t.getExtension;t.getExtension=function(e){const n=r.call(this,e);return n||("OES_vertex_array_object"!==e?null:(t.__OESVertexArrayObject||(this.__OESVertexArrayObject=new s(this)),this.__OESVertexArrayObject))}}s.prototype.VERTEX_ARRAY_BINDING_OES=34229,s.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(let t=0;t<this.vertexArrayObjects.length;++t)this.vertexArrayObjects.isAlive=!1;const t=this.gl;this.maxVertexAttribs=t.getParameter(34921),this.defaultVertexArrayObject=new a(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)},s.prototype.createVertexArrayOES=function(){const t=new a(this);return this.vertexArrayObjects.push(t),t},s.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)},s.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof a&&t.hasBeenBound&&t.ext===this)},s.prototype.bindVertexArrayOES=function(t){const e=this.gl;if(t&&!t.isAlive)return void o(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");const r=this.original,n=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;const i=this.currentVertexArrayObject;if(n===i)return;n&&i.elementArrayBuffer===n.elementArrayBuffer||r.bindBuffer.call(e,34963,i.elementArrayBuffer);let a=this.currentArrayBuffer;const s=Math.max(n?n.maxAttrib:0,i.maxAttrib);for(let t=0;t<=s;t++){const o=i.attribs[t],s=n?n.attribs[t]:null;if(n&&o.enabled===s.enabled||(o.enabled?r.enableVertexAttribArray.call(e,t):r.disableVertexAttribArray.call(e,t)),o.enabled){let i=!1;n&&o.buffer===s.buffer||(a!==o.buffer&&(r.bindBuffer.call(e,34962,o.buffer),a=o.buffer),i=!0),(i||o.cached!==s.cached)&&r.vertexAttribPointer.call(e,t,o.size,o.type,o.normalized,o.stride,o.offset)}}this.currentArrayBuffer!==a&&r.bindBuffer.call(e,34962,this.currentArrayBuffer)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return c}));var n=r(98),i=r(231),o=r(232),a=r(71),s=r(9);function u(t,e){Object(s.a)(t instanceof n.a||t instanceof i.a||t instanceof o.a);const r=t.constructor,{gl:a,width:u,height:c,format:l,type:h,dataFormat:f,border:p,mipmaps:d}=t;return new r(a,Object.assign({width:u,height:c,format:l,type:h,dataFormat:f,border:p,mipmaps:d},e))}function c(t,e){const{gl:r,width:n,height:i,id:o}=t;return new a.a(r,Object.assign({},e,{id:`framebuffer-for-${o}`,width:n,height:i,attachments:{36064:t}}))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(7),i=r(55);const o=[34069,34070,34071,34072,34073,34074];class a extends i.a{constructor(t,e={}){Object(n.b)(t),super(t,Object.assign({},e,{target:34067})),this.initialize(e),Object.seal(this)}initialize(t={}){const{mipmaps:e=!0,parameters:r={}}=t;return this.opts=t,this.setCubeMapImageData(t).then(()=>{this.loaded=!0,e&&this.generateMipmap(t),this.setParameters(r)}),this}subImage({face:t,data:e,x:r=0,y:n=0,mipmapLevel:i=0}){return this._subImage({target:t,data:e,x:r,y:n,mipmapLevel:i})}async setCubeMapImageData({width:t,height:e,pixels:r,data:i,border:a=0,format:s=6408,type:u=5121}){const{gl:c}=this,l=r||i,h=await Promise.all(o.map(t=>{const e=l[t];return Promise.all(Array.isArray(e)?e:[e])}));this.bind(),o.forEach((r,i)=>{h[i].length>1&&!1!==this.opts.mipmaps&&n.k.warn(`${this.id} has mipmap and multiple LODs.`)(),h[i].forEach((n,i)=>{t&&e?c.texImage2D(r,i,s,t,e,a,s,u,n):c.texImage2D(r,i,s,s,u,n)})}),this.unbind()}setImageDataForFace(t){const{face:e,width:r,height:n,pixels:i,data:o,border:a=0,format:s=6408,type:u=5121}=t,{gl:c}=this,l=i||o;return this.bind(),l instanceof Promise?l.then(r=>this.setImageDataForFace(Object.assign({},t,{face:e,data:r,pixels:r}))):this.width||this.height?c.texImage2D(e,0,s,r,n,a,s,u,l):c.texImage2D(e,0,s,s,u,l),this}}a.FACES=o},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(7),i=r(55),o=r(82),a=r(34);class s extends i.a{static isSupported(t){return Object(n.j)(t)}constructor(t,e={}){Object(n.a)(t),super(t,e=Object.assign({depth:1},e,{target:32879,unpackFlipY:!1})),this.initialize(e),Object.seal(this)}setImageData({level:t=0,dataFormat:e=6408,width:r,height:i,depth:s=1,border:u=0,format:c,type:l=5121,offset:h=0,data:f,parameters:p={}}){if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),Object(n.o)(this.gl,p,()=>{ArrayBuffer.isView(f)&&this.gl.texImage3D(this.target,t,e,r,i,s,u,c,l,f),f instanceof a.a&&(this.gl.bindBuffer(35052,f.handle),this.gl.texImage3D(this.target,t,e,r,i,s,u,c,l,h))}),f&&f.byteLength)this._trackAllocatedMemory(f.byteLength,"Texture");else{const t=o.a[this.dataFormat]||4,e=o.c[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*t*e,"Texture")}return this.loaded=!0,this}}},function(t,e,r){var n=r(261);t.exports=function(t,e){if(null==t)return{};var r,i,o=n(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}},function(t,e){t.exports=function(t){var e;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(e=t[Symbol.asyncIterator]))return e.call(t);if(Symbol.iterator&&null!=(e=t[Symbol.iterator]))return e.call(t)}throw new TypeError("Object is not async iterable")}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return f}));var n=r(50),i=r(51),o=r(4),a=r(29),s=r.n(a),u=r(102);var c={container:s.a.object,gl:s.a.object,mapboxApiAccessToken:s.a.string,mapboxApiUrl:s.a.string,attributionControl:s.a.bool,preserveDrawingBuffer:s.a.bool,reuseMaps:s.a.bool,transformRequest:s.a.func,mapOptions:s.a.object,mapStyle:s.a.oneOfType([s.a.string,s.a.object]),visible:s.a.bool,asyncRender:s.a.bool,onLoad:s.a.func,onError:s.a.func,width:s.a.number,height:s.a.number,viewState:s.a.object,longitude:s.a.number,latitude:s.a.number,zoom:s.a.number,bearing:s.a.number,pitch:s.a.number,altitude:s.a.number},l={container:u.a.body,mapboxApiAccessToken:function(){var e=null;if("undefined"!=typeof window&&window.location){var r=window.location.search.match(/access_token=([^&\/]*)/);e=r&&r[1]}e||void 0===t||(e=e||t.env.MapboxAccessToken||t.env.REACT_APP_MAPBOX_ACCESS_TOKEN);return e||"no-token"}(),mapboxApiUrl:"https://api.mapbox.com",preserveDrawingBuffer:!1,attributionControl:!0,reuseMaps:!1,mapOptions:{},mapStyle:"mapbox://styles/mapbox/light-v8",visible:!0,asyncRender:!1,onLoad:function(){},onError:function(t){t&&console.error(t.error)},width:0,height:0,longitude:0,latitude:0,zoom:0,bearing:0,pitch:0,altitude:1.5};function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"component";t.debug&&s.a.checkPropTypes(c,t,"prop",e)}var f=function(){function t(e){var r=this;if(Object(n.a)(this,t),Object(o.a)(this,"mapboxgl",void 0),Object(o.a)(this,"props",l),Object(o.a)(this,"_map",null),Object(o.a)(this,"width",0),Object(o.a)(this,"height",0),Object(o.a)(this,"_fireLoadEvent",(function(){r.props.onLoad({type:"load",target:r._map})})),!e.mapboxgl)throw new Error("Mapbox not available");this.mapboxgl=e.mapboxgl,t.initialized||(t.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return Object(i.a)(t,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"resize",value:function(){return this._map.resize(),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(e){this._map=t.savedMap;var r=this._map.getContainer(),n=e.container;for(n.classList.add("mapboxgl-map");r.childNodes.length>0;)n.appendChild(r.childNodes[0]);this._map._container=n,t.savedMap=null,e.mapStyle&&this._map.setStyle(e.mapStyle,{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(e){if(e.reuseMaps&&t.savedMap)this._reuse(e);else{if(e.gl){var r=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=r,e.gl}}var n={container:e.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:e.mapStyle,interactive:!1,trackResize:!1,attributionControl:e.attributionControl,preserveDrawingBuffer:e.preserveDrawingBuffer};e.transformRequest&&(n.transformRequest=e.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},n,e.mapOptions)),this._map.once("load",e.onLoad),this._map.on("error",e.onError)}return this}},{key:"_destroy",value:function(){this._map&&(t.savedMap?this._map.remove():(t.savedMap=this._map,this._map.off("load",this.props.onLoad),this._map.off("error",this.props.onError),this._map.off("styledata",this._fireLoadEvent)),this._map=null)}},{key:"_initialize",value:function(t){var e=this;h(t=Object.assign({},l,t),"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||l.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var r=t.container;Object.defineProperty(r,"offsetWidth",{get:function(){return e.width}}),Object.defineProperty(r,"clientWidth",{get:function(){return e.width}}),Object.defineProperty(r,"offsetHeight",{get:function(){return e.height}}),Object.defineProperty(r,"clientHeight",{get:function(){return e.height}});var n=this._map.getCanvas();n&&(n.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,e){if(this._map){h(e=Object.assign({},this.props,e),"Mapbox");var r=this._updateMapViewport(t,e),n=this._updateMapSize(t,e);e.asyncRender||!r&&!n||this.redraw(),this.props=e}}},{key:"_updateMapSize",value:function(t,e){var r=t.width!==e.width||t.height!==e.height;return r&&(this.width=e.width,this.height=e.height,this.resize()),r}},{key:"_updateMapViewport",value:function(t,e){var r=this._getViewState(t),n=this._getViewState(e),i=n.latitude!==r.latitude||n.longitude!==r.longitude||n.zoom!==r.zoom||n.pitch!==r.pitch||n.bearing!==r.bearing||n.altitude!==r.altitude;return i&&(this._map.jumpTo(this._viewStateToMapboxProps(n)),n.altitude!==r.altitude&&(this._map.transform.altitude=n.altitude)),i}},{key:"_getViewState",value:function(t){var e=t.viewState||t,r=e.longitude,n=e.latitude,i=e.zoom,o=e.pitch,a=void 0===o?0:o,s=e.bearing,u=void 0===s?0:s,c=e.altitude;return{longitude:r,latitude:n,zoom:i,pitch:a,bearing:u,altitude:void 0===c?1.5:c}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==u.a)try{var e=u.a.createElement("div");e.className="mapboxgl-map",e.style.display="none",u.a.body.append(e);var r="static"!==window.getComputedStyle(e).position;if(!r){var n=u.a.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),u.a.head.append(n)}}catch(t){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),t}();Object(o.a)(f,"initialized",!1),Object(o.a)(f,"propTypes",c),Object(o.a)(f,"defaultProps",l),Object(o.a)(f,"savedMap",null)}).call(this,r(57))},function(t,e){},function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n,s,u,c,l,p,d,g=e&&e.length,m=g?e[0]*r:t.length,y=i(t,0,m,r,!0),v=[];if(!y||y.next===y.prev)return v;if(g&&(y=function(t,e,r,n){var a,s,u,c,l,p=[];for(a=0,s=e.length;a<s;a++)u=e[a]*n,c=a<s-1?e[a+1]*n:t.length,(l=i(t,u,c,n,!1))===l.next&&(l.steiner=!0),p.push(A(l));for(p.sort(h),a=0;a<p.length;a++)f(p[a],r),r=o(r,r.next);return r}(t,e,y,r)),t.length>80*r){n=u=t[0],s=c=t[1];for(var _=r;_<m;_+=r)(l=t[_])<n&&(n=l),(p=t[_+1])<s&&(s=p),l>u&&(u=l),p>c&&(c=p);d=0!==(d=Math.max(u-n,c-s))?1/d:0}return a(y,v,r,n,s,d),v}function i(t,e,r,n,i){var o,a;if(i===P(t,e,r,n)>0)for(o=e;o<r;o+=n)a=S(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=S(o,t[o],t[o+1],a);return a&&v(a,a.next)&&(O(a),a=a.next),a}function o(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!v(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(O(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function a(t,e,r,n,i,h,f){if(t){!f&&h&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=d(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,c=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<c&&(s++,n=n.nextZ);e++);for(u=c;s>0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,c*=2}while(a>1)}(i)}(t,n,i,h);for(var p,A,g=t;t.prev!==t.next;)if(p=t.prev,A=t.next,h?u(t,n,i,h):s(t))e.push(p.i/r),e.push(t.i/r),e.push(A.i/r),O(t),t=A.next,g=A.next;else if((t=A)===g){f?1===f?a(t=c(o(t),e,r),e,r,n,i,h,2):2===f&&l(t,e,r,n,i,h):a(o(t),e,r,n,i,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(g(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&y(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function u(t,e,r,n){var i=t.prev,o=t,a=t.next;if(y(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=d(s,u,e,r,n),f=d(c,l,e,r,n),p=t.prevZ,A=t.nextZ;p&&p.z>=h&&A&&A.z<=f;){if(p!==t.prev&&p!==t.next&&g(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,A!==t.prev&&A!==t.next&&g(i.x,i.y,o.x,o.y,a.x,a.y,A.x,A.y)&&y(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&g(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;A&&A.z<=f;){if(A!==t.prev&&A!==t.next&&g(i.x,i.y,o.x,o.y,a.x,a.y,A.x,A.y)&&y(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function c(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!v(i,a)&&_(i,n,n.next,a)&&w(i,a)&&w(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),O(n),O(n.next),n=t=a),n=n.next}while(n!==t);return o(n)}function l(t,e,r,n,i,s){var u=t;do{for(var c=u.next.next;c!==u.prev;){if(u.i!==c.i&&m(u,c)){var l=E(u,c);return u=o(u,u.next),l=o(l,l.next),a(u,e,r,n,i,s),void a(l,e,r,n,i,s)}c=c.next}u=u.next}while(u!==t)}function h(t,e){return t.x-e.x}function f(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var u,c=r,l=r.x,h=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=l&&i!==n.x&&g(o<h?i:a,o,l,h,o<h?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),w(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&p(r,n)))&&(r=n,f=u)),n=n.next}while(n!==c);return r}(t,e)){var r=E(e,t);o(r,r.next)}}function p(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function d(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function A(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function g(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&_(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||v(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function v(t,e){return t.x===e.x&&t.y===e.y}function _(t,e,r,n){var i=x(y(t,e,r)),o=x(y(t,e,n)),a=x(y(r,n,t)),s=x(y(r,n,e));return i!==o&&a!==s||(!(0!==i||!b(t,r,e))||(!(0!==o||!b(t,n,e))||(!(0!==a||!b(r,t,n))||!(0!==s||!b(r,e,n)))))}function b(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function x(t){return t>0?1:t<0?-1:0}function w(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function E(t,e){var r=new T(t.i,t.x,t.y),n=new T(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function S(t,e,r,n){var i=new T(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function O(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function P(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}t.exports=n,t.exports.default=n,n.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(P(t,0,o,r));if(i)for(var s=0,u=e.length;s<u;s++){var c=e[s]*r,l=s<u-1?e[s+1]*r:t.length;a-=Math.abs(P(t,c,l,r))}var h=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,p=n[s+1]*r,d=n[s+2]*r;h+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},function(t,e,r){"use strict";t.exports=n,t.exports.default=n;function n(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function i(t,e,r,n,i,a,s){for(var u=0;u<e;u++){for(var c=0;c<r;c++)n[c]=t[c*e+u];for(o(n,i,a,s,r),c=0;c<r;c++)t[c*e+u]=i[c]}for(c=0;c<r;c++){for(u=0;u<e;u++)n[u]=t[c*e+u];for(o(n,i,a,s,e),u=0;u<e;u++)t[c*e+u]=Math.sqrt(i[u])}}function o(t,e,r,n,i){r[0]=0,n[0]=-1e20,n[1]=1e20;for(var o=1,a=0;o<i;o++){for(var s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);s<=n[a];)a--,s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);r[++a]=o,n[a]=s,n[a+1]=1e20}for(o=0,a=0;o<i;o++){for(;n[a+1]<o;)a++;e[o]=(o-r[a])*(o-r[a])+t[r[a]]}}n.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),r=new Uint8ClampedArray(this.size*this.size),n=0;n<this.size*this.size;n++){var o=e.data[4*n+3]/255;this.gridOuter[n]=1===o?0:0===o?1e20:Math.pow(Math.max(0,.5-o),2),this.gridInner[n]=1===o?1e20:0===o?0:Math.pow(Math.max(0,o-.5),2)}for(i(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),i(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),n=0;n<this.size*this.size;n++){var a=this.gridOuter[n]-this.gridInner[n];r[n]=Math.max(0,Math.min(255,Math.round(255-255*(a/this.radius+this.cutoff))))}return r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(240),i=r(179),o=r(98),a=r(7);class s{constructor(t,{attributes:e,material:r,pbrDebug:o,imageBasedLightingEnvironment:a,lights:s,useTangents:u}){this.gl=t,this.defines={MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},Object(n.b)(t,i.a.GLSL_TEXTURE_LOD)&&(this.defines.USE_TEX_LOD=1),this.uniforms={u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},this.parameters={},this.generatedTextures=[],a&&(this.uniforms.u_DiffuseEnvSampler=a.getDiffuseEnvSampler(),this.uniforms.u_SpecularEnvSampler=a.getSpecularEnvSampler(),this.uniforms.u_brdfLUT=a.getBrdfTexture(),this.uniforms.u_ScaleIBLAmbient=[1,1]),o&&(this.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],this.uniforms.u_ScaleFGDSpec=[0,0,0,0]),this.defineIfPresent(e.NORMAL,"HAS_NORMALS"),this.defineIfPresent(e.TANGENT&&u,"HAS_TANGENTS"),this.defineIfPresent(e.TEXCOORD_0,"HAS_UV"),this.defineIfPresent(a,"USE_IBL"),this.defineIfPresent(s,"USE_LIGHTS"),this.defineIfPresent(o,"PBR_DEBUG"),r&&this.parseMaterial(r)}defineIfPresent(t,e){t&&(this.defines[e]=1)}parseTexture(t,e,r=null){const n=t.texture&&t.texture.sampler&&t.texture.sampler.parameters||{},i=t.texture.source.image;let a,s={};i.compressed?(a=i,s={[this.gl.TEXTURE_MIN_FILTER]:i.data.length>1?this.gl.LINEAR_MIPMAP_NEAREST:this.gl.LINEAR}):a={data:i};const u=new o.a(this.gl,{id:t.name||t.id,parameters:{...n,...s},pixelStore:{[this.gl.UNPACK_FLIP_Y_WEBGL]:!1},...a});this.uniforms[e]=u,this.defineIfPresent(r,r),this.generatedTextures.push(u)}parsePbrMetallicRoughness(t){t.baseColorTexture&&this.parseTexture(t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP"),this.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&this.parseTexture(t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP");const{metallicFactor:e=1,roughnessFactor:r=1}=t;this.uniforms.u_MetallicRoughnessValues=[e,r]}parseMaterial(t){if(this.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&this.parsePbrMetallicRoughness(t.pbrMetallicRoughness),t.normalTexture){this.parseTexture(t.normalTexture,"u_NormalSampler","HAS_NORMALMAP");const{scale:e=1}=t.normalTexture;this.uniforms.u_NormalScale=e}if(t.occlusionTexture){this.parseTexture(t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP");const{strength:e=1}=t.occlusionTexture;this.uniforms.u_OcclusionStrength=e}if(t.emissiveTexture&&(this.parseTexture(t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP"),this.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),"MASK"===t.alphaMode){const{alphaCutoff:e=.5}=t;this.defines.ALPHA_CUTOFF=1,this.uniforms.u_AlphaCutoff=e}else"BLEND"===t.alphaMode&&(a.k.warn("BLEND alphaMode might not work well because it requires mesh sorting")(),Object.assign(this.parameters,{blend:!0,blendEquation:this.gl.FUNC_ADD,blendFunc:[this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA,this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA]}))}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"c",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(179),i=r(7),o=r(9);function a(t,e){return s(t,e)}function s(t,e){return(e=Array.isArray(e)?e:[e]).every(e=>c(t,e))}function u(t){t.luma=t.luma||{},t.luma.caps=t.luma.caps||{};for(const e in n.b)void 0===t.luma.caps[e]&&(t.luma.caps[e]=c(t,e));return t.luma.caps}function c(t,e){return t.luma=t.luma||{},t.luma.caps=t.luma.caps||{},void 0===t.luma.caps[e]&&(t.luma.caps[e]=function(t,e){const r=n.b[e];let a;Object(o.a)(r,e);const s=Object(i.j)(t)&&r[1]||r[0];if("function"==typeof s)a=s(t);else if(Array.isArray(s)){a=!0;for(const e of s)a=a&&Boolean(t.getExtension(e))}else"string"==typeof s?a=Boolean(t.getExtension(s)):"boolean"==typeof s?a=s:Object(o.a)(!1);return a}(t,e)),t.luma.caps[e]||i.k.log(2,`Feature: ${e} not supported`)(),t.luma.caps[e]}},,,,,,,function(t,e,r){var n=document.body&&document.body.getAttribute("data-base-url");n&&(window.__webpack_public_path__="".concat(n,"nbextensions/pydeck/nb_extension"));var i=r(188).default.jupyterTransport,o=null,a=null;try{o=r(273).default,a=r(250).default}catch(t){}var s=r(117),u=s.MODULE_VERSION,c=s.MODULE_NAME,l=r(87),h=l.createDeck,f=l.updateDeck,p=r(274).initPlayground;p(),t.exports={jupyterTransport:i,MODULE_VERSION:u,MODULE_NAME:c,JupyterTransportModel:o,JupyterTransportView:a,initPlayground:p,createDeck:h,updateDeck:f}},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},function(t,e,r){var n=r(1);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t}},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return y}));var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(8),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),p=r(1),d=r.n(p),A=r(131),g=r(188);function m(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var y=function(t){l()(r,t);var e=m(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initialize",value:function(){this.listenTo(this.model,"destroy",this.remove),this.transport=new g.default,this.transport.jupyterModel=this.model,this.transport.jupyterView=this,this.transport._initialize(),u()(d()(r.prototype),"initialize",this).apply(this,arguments)}},{key:"remove",value:function(){this.transport&&(this.transport._finalize(),this.transport.jupyterModel=null,this.transport.jupyterView=null,this.transport=null)}},{key:"render",value:function(){u()(d()(r.prototype),"render",this).call(this),this.model.on("change:json_input",this.onJsonChanged.bind(this)),this.model.on("change:data_buffer",this.onDataBufferChanged.bind(this)),this.onDataBufferChanged()}},{key:"onJsonChanged",value:function(){var t=JSON.parse(this.model.get("json_input"));this.transport._messageReceived({type:"json",json:t})}},{key:"onDataBufferChanged",value:function(){var t=this.model.get("json_input"),e=this.model.get("data_buffer");t&&e?this.transport._messageReceived({type:"json-with-binary",json:t,binary:e}):this.transport._messageReceived({type:"json",json:t})}}]),r}(A.DOMWidgetView)},function(t,e,r){(function(e){const n=r(271),i=r(15),o=r(263).default,{registerLoaders:a,load:s,parse:u,fetchFile:c}=r(77),l="undefined"==typeof window?e:window;l.deck=l.deck||{},l.luma=l.luma||{},l.loaders=l.loaders||{},Object.assign(l.deck,i,{DeckGL:o}),Object.assign(l.luma,n),Object.assign(l.loaders,{registerLoaders:a,load:s,parse:u,fetchFile:c}),t.exports=l.deck}).call(this,r(65))},function(t,e){},function(t,e,r){"use strict";var n=r(123),i=r(24);Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"self",{enumerable:!0,get:function(){return o.self}}),Object.defineProperty(e,"window",{enumerable:!0,get:function(){return o.window}}),Object.defineProperty(e,"global",{enumerable:!0,get:function(){return o.global}}),Object.defineProperty(e,"document",{enumerable:!0,get:function(){return o.document}}),Object.defineProperty(e,"process",{enumerable:!0,get:function(){return o.process}}),Object.defineProperty(e,"console",{enumerable:!0,get:function(){return o.console}}),Object.defineProperty(e,"isBrowser",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"isBrowserMainThread",{enumerable:!0,get:function(){return a.isBrowserMainThread}}),Object.defineProperty(e,"getBrowser",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"isMobile",{enumerable:!0,get:function(){return s.isMobile}}),Object.defineProperty(e,"isElectron",{enumerable:!0,get:function(){return u.default}});var o=r(203),a=l(r(204)),s=l(r(254)),u=n(r(185));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(c=function(t){return t?r:e})(t)}function l(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==i(t)&&"function"!=typeof t)return{default:t};var r=c(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var s=o?Object.getOwnPropertyDescriptor(t,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}},function(t,e,r){"use strict";var n=r(123);Object.defineProperty(e,"__esModule",{value:!0}),e.isMobile=function(){return void 0!==i.window.orientation},e.default=function(t){if(!t&&!(0,o.default)())return"Node";if((0,a.default)(t))return"Electron";var e="undefined"!=typeof navigator?navigator:{},r=t||e.userAgent||"";if(r.indexOf("Edge")>-1)return"Edge";var n=-1!==r.indexOf("MSIE "),s=-1!==r.indexOf("Trident/");if(n||s)return"IE";if(i.window.chrome)return"Chrome";if(i.window.safari)return"Safari";if(i.window.mozInnerScreenX)return"Firefox";return"Unknown"};var i=r(203),o=n(r(204)),a=n(r(185))},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r,n){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=v(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=u(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}(t,r,a),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var c={};function l(){}function h(){}function f(){}var p={};p[i]=function(){return this};var d=Object.getPrototypeOf,A=d&&d(d(w([])));A&&A!==e&&r.call(A,i)&&(p=A);var g=f.prototype=l.prototype=Object.create(p);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function y(t){var e;this._invoke=function(n,i){function o(){return new Promise((function(e,o){!function e(n,i,o,a){var s=u(t[n],t,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,o,a)}),(function(t){e("throw",t,o,a)})):Promise.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return e("throw",t,o,a)}))}a(s.arg)}(n,i,e,o)}))}return e=e?e.then(o,o):o()}}function v(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,v(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=g.constructor=f,f.constructor=h,f[a]=h.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(y.prototype),y.prototype[o]=function(){return this},t.AsyncIterator=y,t.async=function(e,r,n,i){var o=new y(s(e,r,n,i));return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},m(g),g[a]="Generator",g[i]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=w,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;b(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return a}));var n=r(235),i=r(191);const o={position:"absolute",left:0,top:0,width:"100%",height:"100%"};class a extends i.a{constructor(t={}){if("undefined"==typeof document)throw Error("Deck can only be used in the browser");const{mapCanvas:e,deckCanvas:r}=function(t){let{container:e=document.body}=t;if("string"==typeof e&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");"static"===window.getComputedStyle(e).position&&(e.style.position="relative");const r=document.createElement("div");e.appendChild(r),Object.assign(r.style,o);const n=document.createElement("canvas");return e.appendChild(n),Object.assign(n.style,o),{container:e,mapCanvas:r,deckCanvas:n}}(t),i=t.viewState||t.initialViewState,a=Number.isFinite(i&&i.latitude),{map:s=window.mapboxgl}=t;super({canvas:r,...t}),s&&s.Map?this._map=a&&new n.a({...t,viewState:i,container:e,mapboxgl:s}):this._map=s,this._onBeforeRender=t=>{if(this.onBeforeRender(t),this._map){const t=this.getViewports()[0];this._map.setProps({width:t.width,height:t.height,viewState:t})}}}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(t){"onBeforeRender"in t&&this._onBeforeRender&&t.onBeforeRender!==this._onBeforeRender&&(this.onBeforeRender=t.onBeforeRender,t.onBeforeRender=this._onBeforeRender),"mapStyle"in t&&this._map&&this._map._map.setStyle(t.mapStyle),super.setProps(t)}}},function(t,e,r){"use strict";var n=r(265);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,r,i,o,a){if(a!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var r={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return r.PropTypes=r,r}},function(t,e,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,A=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*A}},function(t,e,r){!function(r){"use strict";var n=function(t,e){var r=new Error(t+" at character "+e);throw r.index=e,r.description=t,r},i={"-":!0,"!":!0,"~":!0,"+":!0},o={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},a=function(t){var e,r=0;for(var n in t)(e=n.length)>r&&t.hasOwnProperty(n)&&(r=e);return r},s=a(i),u=a(o),c={true:!0,false:!1,null:null},l=function(t){return o[t]||0},h=function(t,e,r){return{type:"||"===t||"&&"===t?"LogicalExpression":"BinaryExpression",operator:t,left:e,right:r}},f=function(t){return t>=48&&t<=57},p=function(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=128&&!o[String.fromCharCode(t)]},d=function(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t>=128&&!o[String.fromCharCode(t)]},A=function(t){for(var e,r,a=0,A=t.charAt,g=t.charCodeAt,m=function(e){return A.call(t,e)},y=function(e){return g.call(t,e)},v=t.length,_=function(){for(var t=y(a);32===t||9===t||10===t||13===t;)t=y(++a)},b=function(){var t,e,r=w();return _(),63!==y(a)?r:(a++,(t=b())||n("Expected expression",a),_(),58===y(a)?(a++,(e=b())||n("Expected expression",a),{type:"ConditionalExpression",test:r,consequent:t,alternate:e}):void n("Expected :",a))},x=function(){_();for(var e=t.substr(a,u),r=e.length;r>0;){if(o.hasOwnProperty(e)&&(!p(y(a))||a+e.length<t.length&&!d(y(a+e.length))))return a+=r,e;e=e.substr(0,--r)}return!1},w=function(){var t,e,r,i,o,s,u,c;if(s=E(),!(e=x()))return s;for(o={value:e,prec:l(e)},(u=E())||n("Expected expression after "+e,a),i=[s,o,u];(e=x())&&0!==(r=l(e));){for(o={value:e,prec:r};i.length>2&&r<=i[i.length-2].prec;)u=i.pop(),e=i.pop().value,s=i.pop(),t=h(e,s,u),i.push(t);(t=E())||n("Expected expression after "+e,a),i.push(o,t)}for(t=i[c=i.length-1];c>1;)t=h(i[c-1].value,i[c-2],t),c-=2;return t},E=function(){var e,r,n;if(_(),e=y(a),f(e)||46===e)return S();if(39===e||34===e)return O();if(91===e)return I();for(n=(r=t.substr(a,s)).length;n>0;){if(i.hasOwnProperty(r)&&(!p(y(a))||a+r.length<t.length&&!d(y(a+r.length))))return a+=n,{type:"UnaryExpression",operator:r,argument:E(),prefix:!0};r=r.substr(0,--n)}return!(!p(e)&&40!==e)&&M()},S=function(){for(var t,e,r="";f(y(a));)r+=m(a++);if(46===y(a))for(r+=m(a++);f(y(a));)r+=m(a++);if("e"===(t=m(a))||"E"===t){for(r+=m(a++),"+"!==(t=m(a))&&"-"!==t||(r+=m(a++));f(y(a));)r+=m(a++);f(y(a-1))||n("Expected exponent ("+r+m(a)+")",a)}return e=y(a),p(e)?n("Variable names cannot start with a number ("+r+m(a)+")",a):46===e&&n("Unexpected period",a),{type:"Literal",value:parseFloat(r),raw:r}},O=function(){for(var t,e="",r=m(a++),i=!1;a<v;){if((t=m(a++))===r){i=!0;break}if("\\"===t)switch(t=m(a++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||n('Unclosed quote after "'+e+'"',a),{type:"Literal",value:e,raw:r+e+r}},T=function(){var e,r=y(a),i=a;for(p(r)?a++:n("Unexpected "+m(a),a);a<v&&(r=y(a),d(r));)a++;return e=t.slice(i,a),c.hasOwnProperty(e)?{type:"Literal",value:c[e],raw:e}:"this"===e?{type:"ThisExpression"}:{type:"Identifier",name:e}},P=function(t){for(var e,r,i=[],o=!1;a<v;){if(_(),(e=y(a))===t){o=!0,a++;break}44===e?a++:((r=b())&&"Compound"!==r.type||n("Expected comma",a),i.push(r))}return o||n("Expected "+String.fromCharCode(t),a),i},M=function(){var t,e;for(e=40===(t=y(a))?C():T(),_(),t=y(a);46===t||91===t||40===t;)a++,46===t?(_(),e={type:"MemberExpression",computed:!1,object:e,property:T()}):91===t?(e={type:"MemberExpression",computed:!0,object:e,property:b()},_(),93!==(t=y(a))&&n("Unclosed [",a),a++):40===t&&(e={type:"CallExpression",arguments:P(41),callee:e}),_(),t=y(a);return e},C=function(){a++;var t=b();if(_(),41===y(a))return a++,t;n("Unclosed (",a)},I=function(){return a++,{type:"ArrayExpression",elements:P(93)}},k=[];a<v;)59===(e=y(a))||44===e?a++:(r=b())?k.push(r):a<v&&n('Unexpected "'+m(a)+'"',a);return 1===k.length?k[0]:{type:"Compound",body:k}};A.version="0.3.4",A.toString=function(){return"JavaScript Expression Parser (JSEP) v"+A.version},A.addUnaryOp=function(t){return s=Math.max(t.length,s),i[t]=!0,this},A.addBinaryOp=function(t,e){return u=Math.max(t.length,u),o[t]=e,this},A.addLiteral=function(t,e){return c[t]=e,this},A.removeUnaryOp=function(t){return delete i[t],t.length===s&&(s=a(i)),this},A.removeAllUnaryOps=function(){return i={},s=0,this},A.removeBinaryOp=function(t){return delete o[t],t.length===u&&(u=a(o)),this},A.removeAllBinaryOps=function(){return o={},u=0,this},A.removeLiteral=function(t){return delete c[t],this},A.removeAllLiterals=function(){return c={},this},t.exports?e=t.exports=A:e.parse=A}()},function(t,e,r){t.exports=function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),(r=i(a)).workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=o;function o(t,e){this.x=t,this.y=e}function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!a(t[r],e[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var n in t)if(!a(t[n],e[n]))return!1;return!0}return t===e}function s(t,e,n,i){var o=new r(t,e,n,i);return function(t){return o.solve(t)}}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var u=s(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function l(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function h(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}var f=1;function p(){return f++}function d(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function A(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function g(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function m(t,e){return-1!==t.indexOf(e,t.length-e.length)}function y(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function v(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function _(t){return Array.isArray(t)?t.map(_):"object"==typeof t&&t?y(t,_):t}var b={};function x(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function E(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r<n;i=r++)o=t[r],e+=((a=t[i]).x-o.x)*(o.y+a.y);return e}function S(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function O(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var T=null;function P(t){if(null==T){var e=t.navigator?t.navigator.userAgent:null;T=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return T}function M(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var C,I,k,R,L=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),j=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,D=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,B={now:L,frame:function(t){var e=j(t);return{cancel:function(){return D(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return C||(C=self.document.createElement("a")),C.href=t,C.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==I&&(I=self.matchMedia("(prefers-reduced-motion: reduce)")),I.matches)}},F={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},z={supported:!1,testSupport:function(t){!N&&R&&(U?V(t):k=t)}},N=!1,U=!1;function V(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,R),t.isContextLost())return;z.supported=!0}catch(t){}t.deleteTexture(e),N=!0}self.document&&((R=self.document.createElement("img")).onload=function(){k&&V(k),k=null,U=!0},R.onerror=function(){N=!0,k=null},R.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var G="01",W=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}W.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",G,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},W.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},W.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},W.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=Q(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},W.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=Q(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},W.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=Q(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},W.prototype.normalizeSpriteURL=function(t,e,r,n){var i=Q(t);return H(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,Y(i))},W.prototype.normalizeTileURL=function(t,e,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),!e||!H(e))return t;var n=Q(t),i=B.devicePixelRatio>=2||512===r?"@2x":"",o=z.supported?".webp":"$1";return n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,""+i+o),n.path=n.path.replace(/^.+\/v4\//,"/"),n.path="/v4"+n.path,F.REQUIRE_ACCESS_TOKEN&&(F.ACCESS_TOKEN||this._customAccessToken)&&this._skuToken&&n.params.push("sku="+this._skuToken),this._makeAPIURL(n,this._customAccessToken)},W.prototype.canonicalizeTileURL=function(t){var e=Q(t);if(!e.path.match(/(^\/v4\/)/)||!e.path.match(/\.[\w]+$/))return t;var r="mapbox://tiles/";r+=e.path.replace("/v4/","");var n=e.params.filter((function(t){return!t.match(/^access_token=/)}));return n.length&&(r+="?"+n.join("&")),r},W.prototype.canonicalizeTileset=function(t,e){if(!H(e))return t.tiles||[];for(var r=[],n=0,i=t.tiles;n<i.length;n+=1){var o=i[n],a=this.canonicalizeTileURL(o);r.push(a)}return r},W.prototype._makeAPIURL=function(t,e){var r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=Q(F.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"/"!==n.path&&(t.path=""+n.path+t.path),!F.REQUIRE_ACCESS_TOKEN)return Y(t);if(!(e=e||F.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),Y(t)};var q=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Z(t){return q.test(t)}var X=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Q(t){var e=t.match(X);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Y(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function K(t){if(!t)return null;var e,r=t.split(".");if(!r||3!==r.length)return null;try{return JSON.parse((e=r[1],decodeURIComponent(self.atob(e).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(t){return null}}var $=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};$.prototype.getStorageKey=function(t){var e,r=K(F.ACCESS_TOKEN),n="";return r&&r.u?(e=r.u,n=self.btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))})))):n=F.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+n:"mapbox.eventData:"+n},$.prototype.fetchEventData=function(){var t=M("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=self.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=self.localStorage.getItem(r);i&&(this.anonId=i)}catch(t){x("Unable to read from LocalStorage")}},$.prototype.saveEventData=function(){var t=M("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{self.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){x("Unable to write to LocalStorage")}},$.prototype.processRequests=function(t){},$.prototype.postEvent=function(t,e,r,n){var i=this;if(F.EVENTS_URL){var o=Q(F.EVENTS_URL);o.params.push("access_token="+(n||F.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.6.1",skuId:G,userId:this.anonId},s=e?h(a,e):a,u={url:Y(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=_t(u,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},$.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var J,tt,et=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(F.EVENTS_URL&&n||F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Z(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),A(this.anonId)||(this.anonId=d()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}($),rt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.postTurnstileEvent=function(t,e){F.EVENTS_URL&&F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Z(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=K(F.ACCESS_TOKEN),n=r?r.u:F.ACCESS_TOKEN,i=n!==this.eventData.tokenU;A(this.anonId)||(this.anonId=d(),i=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),u=(o-this.eventData.lastSuccess)/864e5;i=i||u>=1||u<-1||a.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=n)}),t)}},e}($)),nt=rt.postTurnstileEvent.bind(rt),it=new et,ot=it.postMapLoadEvent.bind(it),at="mapbox-tiles",st=500,ut=50;function ct(){self.caches&&!J&&(J=self.caches.open(at))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ht=1/0,ft={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ft);var pt=function(t){function e(e,r,n){401===r&&Z(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),dt=S()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===self.location.protocol?self.parent:self).location.href};function At(t,e){var r,n=new self.AbortController,i=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:dt(),signal:n.signal}),o=!1,a=!1,s=(r=i.url).indexOf("sku=")>0&&Z(r);"json"===t.type&&i.headers.set("Accept","application/json");var u=function(r,n,o){if(!a){if(r&&"SecurityError"!==r.message&&x(r),n&&o)return c(n);var u=Date.now();self.fetch(i).then((function(r){if(r.ok){var n=s?r.clone():null;return c(r,n,u)}return e(new pt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,s){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){a||(n&&s&&function(t,e,r){if(ct(),J){var n={status:e.status,statusText:e.statusText,headers:new self.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=O(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===tt)try{new Response(new ReadableStream),tt=!0}catch(t){tt=!1}tt?e(t.body):t.blob().then(e)}(e,(function(e){var r=new self.Response(e,n);ct(),J&&J.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return x(t.message)}))})))}}(i,n,s),o=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){a||e(new Error(t.message))}))};return s?function(t,e){if(ct(),!J)return e(null);var r=lt(t.url);J.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=O(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,u):u(null,null),{cancel:function(){a=!0,o||n.abort()}}}var gt,mt,yt=function(t,e){if(r=t.url,!(/^file:/.test(r)||/^file:/.test(dt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return At(t,e);if(S()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new self.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new pt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},vt=function(t,e){return yt(h(t,{type:"arrayBuffer"}),e)},_t=function(t,e){return yt(h(t,{method:"POST"}),e)};gt=[],mt=0;var bt=function(t,e){if(z.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),mt>=F.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return gt.push(r),r}mt++;var n=!1,i=function(){if(!n)for(n=!0,mt--;gt.length&&mt<F.MAX_PARALLEL_IMAGE_REQUESTS;){var t=gt.shift(),e=t.requestParameters,r=t.callback;t.cancelled||(t.cancel=bt(e,r).cancel)}},o=vt(t,(function(t,r,n,o){if(i(),t)e(t);else if(r){var a=new self.Image;a.onload=function(){e(null,a),self.URL.revokeObjectURL(a.src)},a.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var s=new self.Blob([new Uint8Array(r)],{type:"image/png"});a.cacheControl=n,a.expires=o,a.src=r.byteLength?self.URL.createObjectURL(s):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}}));return{cancel:function(){o.cancel(),i()}}};function xt(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function wt(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var Et=function(t,e){void 0===e&&(e={}),h(this,e),this.type=t},St=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",h({error:e},r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Et),Ot=function(){};Ot.prototype.on=function(t,e){return this._listeners=this._listeners||{},xt(t,e,this._listeners),this},Ot.prototype.off=function(t,e){return wt(t,e,this._listeners),wt(t,e,this._oneTimeListeners),this},Ot.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},xt(t,e,this._oneTimeListeners),this},Ot.prototype.fire=function(t,e){"string"==typeof t&&(t=new Et(t,e||{}));var r=t.type;if(this.listens(r)){t.target=this;for(var n=0,i=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];n<i.length;n+=1)i[n].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];o<a.length;o+=1){var s=a[o];wt(r,s,this._oneTimeListeners),s.call(this,t)}var u=this._eventedParent;u&&(h(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),u.fire(t))}else t instanceof St&&console.error(t.error);return this},Ot.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Ot.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Tt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}}},Pt=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Mt(t){var e=t.key,r=t.value;return r?[new Pt(e,r,"constants have been deprecated as of v8")]:[]}function Ct(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}function It(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function kt(t){if(Array.isArray(t))return t.map(kt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var r in t)e[r]=kt(t[r]);return e}return It(t)}var Rt=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Lt=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,n=e;r<n.length;r+=1){var i=n[r],o=i[0],a=i[1];this.bindings[o]=a}};Lt.prototype.concat=function(t){return new Lt(this,t)},Lt.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Lt.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var jt={kind:"null"},Dt={kind:"number"},Bt={kind:"string"},Ft={kind:"boolean"},zt={kind:"color"},Nt={kind:"object"},Ut={kind:"value"},Vt={kind:"collator"},Gt={kind:"formatted"},Wt={kind:"resolvedImage"};function Ht(t,e){return{kind:"array",itemType:t,N:e}}function qt(t){if("array"===t.kind){var e=qt(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Zt=[jt,Dt,Bt,Ft,zt,Gt,Nt,Ht(Ut),Wt];function Xt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Xt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Zt;r<n.length;r+=1)if(!Xt(n[r],e))return null}return"Expected "+qt(t)+" but found "+qt(e)+" instead."}var Qt=e((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function a(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=i.indexOf("("),c=i.indexOf(")");if(-1!==u&&c+1===i.length){var l=i.substr(0,u),h=i.substr(u+1,c-(u+1)).split(","),f=1;switch(l){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),A=a(h[2]),g=A<=.5?A*(d+1):A+d-A*d,m=2*A-g;return[n(255*s(m,g,p+1/3)),n(255*s(m,g,p)),n(255*s(m,g,p-1/3)),f];default:return null}}return null}}catch(t){}})).parseCSSColor,Yt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};Yt.parse=function(t){if(t){if(t instanceof Yt)return t;if("string"==typeof t){var e=Qt(t);if(e)return new Yt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Yt.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],i=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+i+")"},Yt.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},Yt.black=new Yt(0,0,0,1),Yt.white=new Yt(1,1,1,1),Yt.transparent=new Yt(0,0,0,0),Yt.red=new Yt(1,0,0,1);var Kt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Kt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Kt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var $t=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},Jt=function(t){this.sections=t};Jt.fromString=function(t){return new Jt([new $t(t,null,null,null,null)])},Jt.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},Jt.factory=function(t){return t instanceof Jt?t:Jt.fromString(t)},Jt.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},Jt.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];if(n.image)t.push(["image",n.image.name]);else{t.push(n.text);var i={};n.fontStack&&(i["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(i["font-scale"]=n.scale),n.textColor&&(i["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(i)}}return t};var te=function(t){this.name=t.name,this.available=t.available};function ee(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function re(t){if(null===t)return jt;if("string"==typeof t)return Bt;if("boolean"==typeof t)return Ft;if("number"==typeof t)return Dt;if(t instanceof Yt)return zt;if(t instanceof Kt)return Vt;if(t instanceof Jt)return Gt;if(t instanceof te)return Wt;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n<i.length;n+=1){var o=re(i[n]);if(e){if(e===o)continue;e=Ut;break}e=o}return Ht(e||Ut,r)}return Nt}function ne(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Yt||t instanceof Jt||t instanceof te?t.toString():JSON.stringify(t)}te.prototype.toString=function(){return this.name},te.fromString=function(t){return new te({name:t,available:!1})},te.prototype.serialize=function(){return["image",this.name]};var ie=function(t,e){this.type=t,this.value=e};ie.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!function t(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Yt)return!0;if(e instanceof Kt)return!0;if(e instanceof Jt)return!0;if(e instanceof te)return!0;if(Array.isArray(e)){for(var r=0,n=e;r<n.length;r+=1)if(!t(n[r]))return!1;return!0}if("object"==typeof e){for(var i in e)if(!t(e[i]))return!1;return!0}return!1}(t[1]))return e.error("invalid value");var r=t[1],n=re(r),i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new ie(n,r)},ie.prototype.evaluate=function(){return this.value},ie.prototype.eachChild=function(){},ie.prototype.possibleOutputs=function(){return[this.value]},ie.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Yt?["rgba"].concat(this.value.toArray()):this.value instanceof Jt?this.value.serialize():this.value};var oe=function(t){this.name="ExpressionEvaluationError",this.message=t};oe.prototype.toJSON=function(){return this.message};var ae={string:Bt,number:Dt,boolean:Ft,object:Nt},se=function(t,e){this.type=t,this.args=e};se.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r,n=1,i=t[0];if("array"===i){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in ae)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=ae[s],n++}else o=Ut;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++}r=Ht(o,a)}else r=ae[i];for(var u=[];n<t.length;n++){var c=e.parse(t[n],n,Ut);if(!c)return null;u.push(c)}return new se(r,u)},se.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var r=this.args[e].evaluate(t);if(!Xt(this.type,re(r)))return r;if(e===this.args.length-1)throw new oe("Expected value to be of type "+qt(this.type)+", but found "+qt(re(r))+" instead.")}return null},se.prototype.eachChild=function(t){this.args.forEach(t)},se.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},se.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);var n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ue=function(t){this.type=Gt,this.sections=t};ue.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Dt)))return null;var u=null;if(a["text-font"]&&!(u=e.parse(a["text-font"],1,Ht(Bt))))return null;var c=null;if(a["text-color"]&&!(c=e.parse(a["text-color"],1,zt)))return null;var l=n[n.length-1];l.scale=s,l.font=u,l.textColor=c}else{var h=e.parse(t[o],1,Ut);if(!h)return null;var f=h.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:h,scale:null,font:null,textColor:null})}}return new ue(n)},ue.prototype.evaluate=function(t){return new Jt(this.sections.map((function(e){var r=e.content.evaluate(t);return re(r)===Wt?new $t("",r,null,null,null):new $t(ne(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ue.prototype.eachChild=function(t){for(var e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}},ue.prototype.possibleOutputs=function(){return[void 0]},ue.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t.push(n.content.serialize());var i={};n.scale&&(i["font-scale"]=n.scale.serialize()),n.font&&(i["text-font"]=n.font.serialize()),n.textColor&&(i["text-color"]=n.textColor.serialize()),t.push(i)}return t};var ce=function(t){this.type=Wt,this.input=t};ce.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Bt);return r?new ce(r):e.error("No image name provided.")},ce.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=!1;return t.availableImages&&t.availableImages.indexOf(e)>-1&&(r=!0),new te({name:e,available:r})},ce.prototype.eachChild=function(t){t(this.input)},ce.prototype.possibleOutputs=function(){return[void 0]},ce.prototype.serialize=function(){return["image",this.input.serialize()]};var le={"to-boolean":Ft,"to-color":zt,"to-number":Dt,"to-string":Bt},he=function(t,e){this.type=t,this.args=e};he.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=le[r],i=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,Ut);if(!a)return null;i.push(a)}return new he(n,i)},he.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,r,n=0,i=this.args;n<i.length;n+=1){if(r=null,(e=i[n].evaluate(t))instanceof Yt)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(r=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ee(e[0],e[1],e[2],e[3])))return new Yt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new oe(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,u=this.args;s<u.length;s+=1){if(null===(a=u[s].evaluate(t)))return 0;var c=Number(a);if(!isNaN(c))return c}throw new oe("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?Jt.fromString(ne(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?te.fromString(ne(this.args[0].evaluate(t))):ne(this.args[0].evaluate(t))},he.prototype.eachChild=function(t){this.args.forEach(t)},he.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},he.prototype.serialize=function(){if("formatted"===this.type.kind)return new ue([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ce(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var fe=["Unknown","Point","LineString","Polygon"],pe=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null};pe.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},pe.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?fe[this.feature.type]:this.feature.type:null},pe.prototype.properties=function(){return this.feature&&this.feature.properties||{}},pe.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Yt.parse(t)),e};var de=function(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n};de.prototype.evaluate=function(t){return this._evaluate(t,this.args)},de.prototype.eachChild=function(t){this.args.forEach(t)},de.prototype.possibleOutputs=function(){return[void 0]},de.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},de.parse=function(t,e){var r,n=t[0],i=de.definitions[n];if(!i)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter((function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1})),u=null,c=0,l=s;c<l.length;c+=1){var h=l[c],f=h[0],p=h[1];u=new _e(e.registry,e.path,null,e.scope);for(var d=[],A=!1,g=1;g<t.length;g++){var m=t[g],y=Array.isArray(f)?f[g-1]:f.type,v=u.parse(m,1+d.length,y);if(!v){A=!0;break}d.push(v)}if(!A)if(Array.isArray(f)&&f.length!==d.length)u.error("Expected "+f.length+" arguments, but found "+d.length+" instead.");else{for(var _=0;_<d.length;_++){var b=Array.isArray(f)?f[_]:f.type,x=d[_];u.concat(_+1).checkSubtype(b,x.type)}if(0===u.errors.length)return new de(n,o,p,d)}}if(1===s.length)(r=e.errors).push.apply(r,u.errors);else{for(var w=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(qt).join(", ")+")":"("+qt(e.type)+"...)"})).join(" | "),E=[],S=1;S<t.length;S++){var O=e.parse(t[S],1+E.length);if(!O)return null;E.push(qt(O.type))}e.error("Expected arguments of type "+w+", but found ("+E.join(", ")+") instead.")}return null},de.register=function(t,e){for(var r in de.definitions=e,e)t[r]=de};var Ae=function(t,e,r){this.type=Vt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function ge(t){if(t instanceof de){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}var e=!0;return t.eachChild((function(t){e&&!ge(t)&&(e=!1)})),e}function me(t){if(t instanceof de&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!me(t)&&(e=!1)})),e}function ye(t,e){if(t instanceof de&&e.indexOf(t.name)>=0)return!1;var r=!0;return t.eachChild((function(t){r&&!ye(t,e)&&(r=!1)})),r}Ae.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");var n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Ft);if(!n)return null;var i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Ft);if(!i)return null;var o=null;return r.locale&&!(o=e.parse(r.locale,1,Bt))?null:new Ae(n,i,o)},Ae.prototype.evaluate=function(t){return new Kt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},Ae.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},Ae.prototype.possibleOutputs=function(){return[void 0]},Ae.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var ve=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};ve.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var r=t[1];return e.scope.has(r)?new ve(r,e.scope.get(r)):e.error('Unknown variable "'+r+'". Make sure "'+r+'" has been bound in an enclosing "let" expression before using it.',1)},ve.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},ve.prototype.eachChild=function(){},ve.prototype.possibleOutputs=function(){return[void 0]},ve.prototype.serialize=function(){return["var",this.name]};var _e=function(t,e,r,n,i){void 0===e&&(e=[]),void 0===n&&(n=new Lt),void 0===i&&(i=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=n,this.errors=i,this.expectedType=r};function be(t,e){for(var r,n,i=t.length-1,o=0,a=i,s=0;o<=a;)if(r=t[s=Math.floor((o+a)/2)],n=t[s+1],r<=e){if(s===i||e<n)return s;o=s+1}else{if(!(r>e))throw new oe("Input is not a number.");a=s-1}return 0}_e.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},_e.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new se(e,[t]):"coerce"===r?new he(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ie)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof ve)return t(e.boundExpression);if(e instanceof de&&"error"===e.name)return!1;if(e instanceof Ae)return!1;var r=e instanceof he||e instanceof se,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof ie})),!!n&&ge(e)&&ye(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var u=new pe;try{o=new ie(o.type,o.evaluate(u))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},_e.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new _e(this.registry,n,e||null,i,this.errors)},_e.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Rt(n,t))},_e.prototype.checkSubtype=function(t,e){var r=Xt(t,e);return r&&this.error(r),r};var xe=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n<i.length;n+=1){var o=i[n],a=o[0],s=o[1];this.labels.push(a),this.outputs.push(s)}};function we(t,e,r){return t*(1-r)+e*r}xe.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var r=e.parse(t[1],1,Dt);if(!r)return null;var n=[],i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],u=o,c=o+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var l=e.parse(s,c,i);if(!l)return null;i=i||l.type,n.push([a,l])}return new xe(i,r,n)},xe.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[be(e,n)].evaluate(t)},xe.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},xe.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map((function(t){return t.possibleOutputs()})))},xe.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ee=Object.freeze({__proto__:null,number:we,color:function(t,e,r){return new Yt(we(t.r,e.r,r),we(t.g,e.g,r),we(t.b,e.b,r),we(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return we(t,e[n],r)}))}}),Se=6/29,Oe=3*Se*Se,Te=Math.PI/180,Pe=180/Math.PI;function Me(t){return t>.008856451679035631?Math.pow(t,1/3):t/Oe+4/29}function Ce(t){return t>Se?t*t*t:Oe*(t-4/29)}function Ie(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ke(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Re(t){var e=ke(t.r),r=ke(t.g),n=ke(t.b),i=Me((.4124564*e+.3575761*r+.1804375*n)/.95047),o=Me((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-Me((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function Le(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Ce(e),r=.95047*Ce(r),n=1.08883*Ce(n),new Yt(Ie(3.2404542*r-1.5371385*e-.4985314*n),Ie(-.969266*r+1.8760108*e+.041556*n),Ie(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function je(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var De={forward:Re,reverse:Le,interpolate:function(t,e,r){return{l:we(t.l,e.l,r),a:we(t.a,e.a,r),b:we(t.b,e.b,r),alpha:we(t.alpha,e.alpha,r)}}},Be={forward:function(t){var e=Re(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*Pe;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Te,r=t.c;return Le({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:je(t.h,e.h,r),c:we(t.c,e.c,r),l:we(t.l,e.l,r),alpha:we(t.alpha,e.alpha,r)}}},Fe=Object.freeze({__proto__:null,lab:De,hcl:Be}),ze=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var o=0,a=i;o<a.length;o+=1){var s=a[o],u=s[0],c=s[1];this.labels.push(u),this.outputs.push(c)}};function Ne(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}ze.interpolationFactor=function(t,e,n,i){var o=0;if("exponential"===t.name)o=Ne(e,t.base,n,i);else if("linear"===t.name)o=Ne(e,1,n,i);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new r(a[0],a[1],a[2],a[3]).solve(Ne(e,1,n,i))}return o},ze.parse=function(t,e){var r=t[0],n=t[1],i=t[2],o=t.slice(3);if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){var a=n[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:a}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);var s=n.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Dt)))return null;var u=[],c=null;"interpolate-hcl"===r||"interpolate-lab"===r?c=zt:e.expectedType&&"value"!==e.expectedType.kind&&(c=e.expectedType);for(var l=0;l<o.length;l+=2){var h=o[l],f=o[l+1],p=l+3,d=l+4;if("number"!=typeof h)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(u.length&&u[u.length-1][0]>=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var A=e.parse(f,d,c);if(!A)return null;c=c||A.type,u.push([h,A])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new ze(c,r,n,i,u):e.error("Type "+qt(c)+" is not interpolatable.")},ze.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=be(e,n),a=e[o],s=e[o+1],u=ze.interpolationFactor(this.interpolation,n,a,s),c=r[o].evaluate(t),l=r[o+1].evaluate(t);return"interpolate"===this.operator?Ee[this.type.kind.toLowerCase()](c,l,u):"interpolate-hcl"===this.operator?Be.reverse(Be.interpolate(Be.forward(c),Be.forward(l),u)):De.reverse(De.interpolate(De.forward(c),De.forward(l),u))},ze.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},ze.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map((function(t){return t.possibleOutputs()})))},ze.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],r=0;r<this.labels.length;r++)e.push(this.labels[r],this.outputs[r].serialize());return e};var Ue=function(t,e){this.type=t,this.args=e};Ue.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var r=null,n=e.expectedType;n&&"value"!==n.kind&&(r=n);for(var i=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=a[o],u=e.parse(s,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!u)return null;r=r||u.type,i.push(u)}var c=n&&i.some((function(t){return Xt(n,t.type)}));return new Ue(c?Ut:r,i)},Ue.prototype.evaluate=function(t){for(var e,r=null,n=0,i=0,o=this.args;i<o.length&&(n++,(r=o[i].evaluate(t))&&r instanceof te&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null===r);i+=1);return r},Ue.prototype.eachChild=function(t){this.args.forEach(t)},Ue.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},Ue.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Ve=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};Ve.prototype.evaluate=function(t){return this.result.evaluate(t)},Ve.prototype.eachChild=function(t){for(var e=0,r=this.bindings;e<r.length;e+=1)t(r[e][1]);t(this.result)},Ve.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var r=[],n=1;n<t.length-1;n+=2){var i=t[n];if("string"!=typeof i)return e.error("Expected string, but found "+typeof i+" instead.",n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);var o=e.parse(t[n+1],n+1);if(!o)return null;r.push([i,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return a?new Ve(r,a):null},Ve.prototype.possibleOutputs=function(){return this.result.possibleOutputs()},Ve.prototype.serialize=function(){for(var t=["let"],e=0,r=this.bindings;e<r.length;e+=1){var n=r[e],i=n[0],o=n[1];t.push(i,o.serialize())}return t.push(this.result.serialize()),t};var Ge=function(t,e,r){this.type=t,this.index=e,this.input=r};Ge.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Dt),n=e.parse(t[2],2,Ht(e.expectedType||Ut));if(!r||!n)return null;var i=n.type;return new Ge(i.itemType,r,n)},Ge.prototype.evaluate=function(t){var e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new oe("Array index out of bounds: "+e+" < 0.");if(e>=r.length)throw new oe("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new oe("Array index must be an integer, but found "+e+" instead.");return r[e]},Ge.prototype.eachChild=function(t){t(this.index),t(this.input)},Ge.prototype.possibleOutputs=function(){return[void 0]},Ge.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var We=function(t,e){this.type=Ft,this.needle=t,this.haystack=e};We.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r,n=e.parse(t[1],1,Ut),i=e.parse(t[2],2,Ut);return n&&i?"boolean"!==(r=n.type).kind&&"string"!==r.kind&&"number"!==r.kind&&"null"!==r.kind&&"value"!==r.kind?e.error("Expected first argument to be of type boolean, string, number or null, but found "+qt(n.type)+" instead"):new We(n,i):null},We.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!e||!r)return!1;if(!function(t){return"boolean"==typeof t||"string"==typeof t||"number"==typeof t}(e))throw new oe("Expected first argument to be of type boolean, string or number, but found "+qt(re(e))+" instead.");if(!function(t){return Array.isArray(t)||"string"==typeof t}(r))throw new oe("Expected second argument to be of type array or string, but found "+qt(re(r))+" instead.");return r.indexOf(e)>=0},We.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},We.prototype.possibleOutputs=function(){return[!0,!1]},We.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var He=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};He.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],u=t[a+1];Array.isArray(s)||(s=[s]);var c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(var l=0,h=s;l<h.length;l+=1){var f=h[l];if("number"!=typeof f&&"string"!=typeof f)return c.error("Branch labels must be numbers or strings.");if("number"==typeof f&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof f&&Math.floor(f)!==f)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,re(f)))return null}else r=re(f);if(void 0!==i[String(f)])return c.error("Branch labels must be unique.");i[String(f)]=o.length}var p=e.parse(u,a,n);if(!p)return null;n=n||p.type,o.push(p)}var d=e.parse(t[1],1,Ut);if(!d)return null;var A=e.parse(t[t.length-1],t.length-1,n);return A?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new He(r,n,d,i,o,A):null},He.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(re(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},He.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},He.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map((function(t){return t.possibleOutputs()}))).concat(this.otherwise.possibleOutputs())},He.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();i<o.length;i+=1){var a=o[i];void 0===(h=n[this.cases[a]])?(n[this.cases[a]]=r.length,r.push([this.cases[a],[a]])):r[h][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},u=0,c=r;u<c.length;u+=1){var l=c[u],h=l[0],f=l[1];1===f.length?e.push(s(f[0])):e.push(f.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var qe=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};function Ze(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Xe(t,e,r,n){return 0===n.compare(e,r)}function Qe(t,e,r){var n="=="!==t&&"!="!==t;return function(){function i(t,e,r){this.type=Ft,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return i.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var r=t[0],o=e.parse(t[1],1,Ut);if(!o)return null;if(!Ze(r,o.type))return e.concat(1).error('"'+r+"\" comparisons are not supported for type '"+qt(o.type)+"'.");var a=e.parse(t[2],2,Ut);if(!a)return null;if(!Ze(r,a.type))return e.concat(2).error('"'+r+"\" comparisons are not supported for type '"+qt(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+qt(o.type)+"' and '"+qt(a.type)+"'.");n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new se(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new se(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,Vt)))return null}return new i(o,a,s)},i.prototype.evaluate=function(i){var o=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){var s=re(o),u=re(a);if(s.kind!==u.kind||"string"!==s.kind&&"number"!==s.kind)throw new oe('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+u.kind+") instead.")}if(this.collator&&!n&&this.hasUntypedArgument){var c=re(o),l=re(a);if("string"!==c.kind||"string"!==l.kind)return e(i,o,a)}return this.collator?r(i,o,a,this.collator.evaluate(i)):e(i,o,a)},i.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},i.prototype.possibleOutputs=function(){return[!0,!1]},i.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},i}()}qe.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var n=[],i=1;i<t.length-1;i+=2){var o=e.parse(t[i],i,Ft);if(!o)return null;var a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([o,a]),r=r||a.type}var s=e.parse(t[t.length-1],t.length-1,r);return s?new qe(r,n,s):null},qe.prototype.evaluate=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[0],o=n[1];if(i.evaluate(t))return o.evaluate(t)}return this.otherwise.evaluate(t)},qe.prototype.eachChild=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[0],o=n[1];t(i),t(o)}t(this.otherwise)},qe.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.branches.map((function(t){return t[0],t[1].possibleOutputs()}))).concat(this.otherwise.possibleOutputs())},qe.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Ye=Qe("==",(function(t,e,r){return e===r}),Xe),Ke=Qe("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!Xe(0,e,r,n)})),$e=Qe("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),Je=Qe(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),tr=Qe("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),er=Qe(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),rr=function(t,e,r,n,i){this.type=Bt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};rr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Dt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Bt)))return null;var o=null;if(n.currency&&!(o=e.parse(n.currency,1,Bt)))return null;var a=null;if(n["min-fraction-digits"]&&!(a=e.parse(n["min-fraction-digits"],1,Dt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Dt))?null:new rr(r,i,o,a,s)},rr.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},rr.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},rr.prototype.possibleOutputs=function(){return[void 0]},rr.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var nr=function(t){this.type=Dt,this.input=t};nr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+qt(r.type)+" instead."):new nr(r):null},nr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new oe("Expected value to be of type string or array, but found "+qt(re(e))+" instead.")},nr.prototype.eachChild=function(t){t(this.input)},nr.prototype.possibleOutputs=function(){return[void 0]},nr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var ir={"==":Ye,"!=":Ke,">":Je,"<":$e,">=":er,"<=":tr,array:se,at:Ge,boolean:se,case:qe,coalesce:Ue,collator:Ae,format:ue,image:ce,in:We,interpolate:ze,"interpolate-hcl":ze,"interpolate-lab":ze,length:nr,let:Ve,literal:ie,match:He,number:se,"number-format":rr,object:se,step:xe,string:se,"to-boolean":he,"to-color":he,"to-number":he,"to-string":he,var:ve};function or(t,e){var r=e[0],n=e[1],i=e[2],o=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var a=o?o.evaluate(t):1,s=ee(r,n,i,a);if(s)throw new oe(s);return new Yt(r/255*a,n/255*a,i/255*a,a)}function ar(t,e){return t in e}function sr(t,e){var r=e[t];return void 0===r?null:r}function ur(t){return{type:t}}function cr(t){return{result:"success",value:t}}function lr(t){return{result:"error",value:t}}function hr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function fr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pr(t){return!!t.expression&&t.expression.interpolated}function dr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ar(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function gr(t){return t}function mr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function yr(t,e,r,n,i){return mr(typeof r===i?n[r]:void 0,t.default,e.default)}function vr(t,e,r){if("number"!==dr(r))return mr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=be(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function _r(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==dr(r))return mr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=be(t.stops.map((function(t){return t[0]})),r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],u=t.stops[o+1][1],c=Ee[e.type]||gr;if(t.colorSpace&&"rgb"!==t.colorSpace){var l=Fe[t.colorSpace];c=function(t,e){return l.reverse(l.interpolate(l.forward(t),l.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return c(r,n,a)}}:c(s,u,a)}function br(t,e,r){return"color"===e.type?r=Yt.parse(r):"formatted"===e.type?r=Jt.fromString(r.toString()):"resolvedImage"===e.type?r=te.fromString(r.toString()):dr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),mr(r,t.default,e.default)}de.register(ir,{error:[{kind:"error"},[Bt],function(t,e){var r=e[0];throw new oe(r.evaluate(t))}],typeof:[Bt,[Ut],function(t,e){return qt(re(e[0].evaluate(t)))}],"to-rgba":[Ht(Dt,4),[zt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[zt,[Dt,Dt,Dt],or],rgba:[zt,[Dt,Dt,Dt,Dt],or],has:{type:Ft,overloads:[[[Bt],function(t,e){return ar(e[0].evaluate(t),t.properties())}],[[Bt,Nt],function(t,e){var r=e[0],n=e[1];return ar(r.evaluate(t),n.evaluate(t))}]]},get:{type:Ut,overloads:[[[Bt],function(t,e){return sr(e[0].evaluate(t),t.properties())}],[[Bt,Nt],function(t,e){var r=e[0],n=e[1];return sr(r.evaluate(t),n.evaluate(t))}]]},"feature-state":[Ut,[Bt],function(t,e){return sr(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Bt,[],function(t){return t.geometryType()}],id:[Ut,[],function(t){return t.id()}],zoom:[Dt,[],function(t){return t.globals.zoom}],"heatmap-density":[Dt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Dt,[],function(t){return t.globals.lineProgress||0}],accumulated:[Ut,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Dt,ur(Dt),function(t,e){for(var r=0,n=0,i=e;n<i.length;n+=1)r+=i[n].evaluate(t);return r}],"*":[Dt,ur(Dt),function(t,e){for(var r=1,n=0,i=e;n<i.length;n+=1)r*=i[n].evaluate(t);return r}],"-":{type:Dt,overloads:[[[Dt,Dt],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)-n.evaluate(t)}],[[Dt],function(t,e){return-e[0].evaluate(t)}]]},"/":[Dt,[Dt,Dt],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)/n.evaluate(t)}],"%":[Dt,[Dt,Dt],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)%n.evaluate(t)}],ln2:[Dt,[],function(){return Math.LN2}],pi:[Dt,[],function(){return Math.PI}],e:[Dt,[],function(){return Math.E}],"^":[Dt,[Dt,Dt],function(t,e){var r=e[0],n=e[1];return Math.pow(r.evaluate(t),n.evaluate(t))}],sqrt:[Dt,[Dt],function(t,e){var r=e[0];return Math.sqrt(r.evaluate(t))}],log10:[Dt,[Dt],function(t,e){var r=e[0];return Math.log(r.evaluate(t))/Math.LN10}],ln:[Dt,[Dt],function(t,e){var r=e[0];return Math.log(r.evaluate(t))}],log2:[Dt,[Dt],function(t,e){var r=e[0];return Math.log(r.evaluate(t))/Math.LN2}],sin:[Dt,[Dt],function(t,e){var r=e[0];return Math.sin(r.evaluate(t))}],cos:[Dt,[Dt],function(t,e){var r=e[0];return Math.cos(r.evaluate(t))}],tan:[Dt,[Dt],function(t,e){var r=e[0];return Math.tan(r.evaluate(t))}],asin:[Dt,[Dt],function(t,e){var r=e[0];return Math.asin(r.evaluate(t))}],acos:[Dt,[Dt],function(t,e){var r=e[0];return Math.acos(r.evaluate(t))}],atan:[Dt,[Dt],function(t,e){var r=e[0];return Math.atan(r.evaluate(t))}],min:[Dt,ur(Dt),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Dt,ur(Dt),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Dt,[Dt],function(t,e){var r=e[0];return Math.abs(r.evaluate(t))}],round:[Dt,[Dt],function(t,e){var r=e[0].evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Dt,[Dt],function(t,e){var r=e[0];return Math.floor(r.evaluate(t))}],ceil:[Dt,[Dt],function(t,e){var r=e[0];return Math.ceil(r.evaluate(t))}],"filter-==":[Ft,[Bt,Ut],function(t,e){var r=e[0],n=e[1];return t.properties()[r.value]===n.value}],"filter-id-==":[Ft,[Ut],function(t,e){var r=e[0];return t.id()===r.value}],"filter-type-==":[Ft,[Bt],function(t,e){var r=e[0];return t.geometryType()===r.value}],"filter-<":[Ft,[Bt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<o}],"filter-id-<":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<i}],"filter->":[Ft,[Bt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Ft,[Bt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Ft,[Bt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Ft,[Ut],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ft,[],function(t){return null!==t.id()}],"filter-type-in":[Ft,[Ht(Bt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ft,[Ht(Ut)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ft,[Bt,Ht(Ut)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ft,[Bt,Ht(Ut)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[ur(Ft),function(t,e){for(var r=0,n=e;r<n.length;r+=1)if(!n[r].evaluate(t))return!1;return!0}]]},any:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)||n.evaluate(t)}],[ur(Ft),function(t,e){for(var r=0,n=e;r<n.length;r+=1)if(n[r].evaluate(t))return!0;return!1}]]},"!":[Ft,[Ft],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Ft,[Bt],function(t,e){var r=e[0],n=t.globals&&t.globals.isSupportedScript;return!n||n(r.evaluate(t))}],upcase:[Bt,[Bt],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Bt,[Bt],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Bt,ur(Ut),function(t,e){return e.map((function(e){return ne(e.evaluate(t))})).join("")}],"resolved-locale":[Bt,[Vt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var xr=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new pe,this._defaultValue=e?function(t){return"color"===t.type&&Ar(t.default)?new Yt(0,0,0,0):"color"===t.type?Yt.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function wr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in ir}function Er(t,e){var r=new _e(ir,[],e?function(t){var e={color:zt,string:Bt,number:Dt,enum:Bt,boolean:Ft,formatted:Gt,resolvedImage:Wt};return"array"===t.type?Ht(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?cr(new xr(n,e)):lr(r.errors)}xr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)},xr.prototype.evaluate=function(t,e,r,n,i){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=i||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new oe("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Sr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!me(e.expression)};Sr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i)},Sr.prototype.evaluate=function(t,e,r,n,i){return this._styleExpression.evaluate(t,e,r,n,i)};var Or=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!me(e.expression),this.interpolationType=n};function Tr(t,e){if("error"===(t=Er(t,e)).result)return t;var r=t.value.expression,n=ge(r);if(!n&&!hr(e))return lr([new Rt("","data expressions not supported")]);var i=ye(r,["zoom"]);if(!i&&!fr(e))return lr([new Rt("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof Ve)r=t(e.result);else if(e instanceof Ue)for(var n=0,i=e.args;n<i.length;n+=1){var o=i[n];if(r=t(o))break}else(e instanceof xe||e instanceof ze)&&e.input instanceof de&&"zoom"===e.input.name&&(r=e);return r instanceof Rt?r:(e.eachChild((function(e){var n=t(e);n instanceof Rt?r=n:!r&&n?r=new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&n&&r!==n&&(r=new Rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),r)}(r);if(!o&&!i)return lr([new Rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof Rt)return lr([o]);if(o instanceof ze&&!pr(e))return lr([new Rt("",'"interpolate" expressions cannot be used with this property')]);if(!o)return cr(new Sr(n?"constant":"source",t.value));var a=o instanceof ze?o.interpolation:void 0;return cr(new Or(n?"camera":"composite",t.value,o.labels,a))}Or.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i)},Or.prototype.evaluate=function(t,e,r,n,i){return this._styleExpression.evaluate(t,e,r,n,i)},Or.prototype.interpolationFactor=function(t,e,r){return this.interpolationType?ze.interpolationFactor(this.interpolationType,t,e,r):0};var Pr=function(t,e){this._parameters=t,this._specification=e,Ct(this,function t(e,r){var n,i,o,a="color"===r.type,s=e.stops&&"object"==typeof e.stops[0][0],u=s||void 0!==e.property,c=s||!u,l=e.type||(pr(r)?"exponential":"interval");if(a&&((e=Ct({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],Yt.parse(t[1])]}))),e.default?e.default=Yt.parse(e.default):e.default=Yt.parse(r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Fe[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===l)n=_r;else if("interval"===l)n=vr;else if("categorical"===l){n=yr,i=Object.create(null);for(var h=0,f=e.stops;h<f.length;h+=1){var p=f[h];i[p[0]]=p[1]}o=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'+l+'"');n=br}if(s){for(var d={},A=[],g=0;g<e.stops.length;g++){var m=e.stops[g],y=m[0].zoom;void 0===d[y]&&(d[y]={zoom:y,type:e.type,property:e.property,default:e.default,stops:[]},A.push(y)),d[y].stops.push([m[0].value,m[1]])}for(var v=[],_=0,b=A;_<b.length;_+=1){var x=b[_];v.push([d[x].zoom,t(d[x],r)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:ze.interpolationFactor.bind(void 0,w),zoomStops:v.map((function(t){return t[0]})),evaluate:function(t,n){var i=t.zoom;return _r({stops:v,base:e.base},r,i).evaluate(i,n)}}}if(c){var E="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:ze.interpolationFactor.bind(void 0,E),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){var a=t.zoom;return n(e,r,a,i,o)}}}return{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?mr(e.default,r.default):n(e,r,s,i,o)}}}(this._parameters,this._specification))};function Mr(t){var e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],u=dr(r);if("object"!==u)return[new Pt(e,r,"object expected, "+u+" found")];for(var c in r){var l=c.split(".")[0],h=n[l]||n["*"],f=void 0;if(i[l])f=i[l];else if(n[l])f=Jr;else if(i["*"])f=i["*"];else{if(!n["*"]){s.push(new Pt(e,r[c],'unknown property "'+c+'"'));continue}f=Jr}s=s.concat(f({key:(e?e+".":e)+c,value:r[c],valueSpec:h,style:o,styleSpec:a,object:r,objectKey:c},r))}for(var p in n)i[p]||n[p].required&&void 0===n[p].default&&void 0===r[p]&&s.push(new Pt(e,r,'missing required property "'+p+'"'));return s}function Cr(t){var e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,o=t.key,a=t.arrayElementValidator||Jr;if("array"!==dr(e))return[new Pt(o,e,"array expected, "+dr(e)+" found")];if(r.length&&e.length!==r.length)return[new Pt(o,e,"array length "+r.length+" expected, length "+e.length+" found")];if(r["min-length"]&&e.length<r["min-length"])return[new Pt(o,e,"array length at least "+r["min-length"]+" expected, length "+e.length+" found")];var s={type:r.value,values:r.values};i.$version<7&&(s.function=r.function),"object"===dr(r.value)&&(s=r.value);for(var u=[],c=0;c<e.length;c++)u=u.concat(a({array:e,arrayIndex:c,value:e[c],valueSpec:s,style:n,styleSpec:i,key:o+"["+c+"]"}));return u}function Ir(t){var e=t.key,r=t.value,n=t.valueSpec,i=dr(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new Pt(e,r,"number expected, "+i+" found")]:"minimum"in n&&r<n.minimum?[new Pt(e,r,r+" is less than the minimum value "+n.minimum)]:"maximum"in n&&r>n.maximum?[new Pt(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function kr(t){var e,r,n,i=t.valueSpec,o=It(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,u=!s,c="array"===dr(t.value.stops)&&"array"===dr(t.value.stops[0])&&"object"===dr(t.value.stops[0][0]),l=Mr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new Pt(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Cr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===dr(r)&&0===r.length&&e.push(new Pt(t.key,r,"array must have at least one stop")),e},default:function(t){return Jr({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&l.push(new Pt(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||l.push(new Pt(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!pr(t.valueSpec)&&l.push(new Pt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!hr(t.valueSpec)?l.push(new Pt(t.key,t.value,"property functions not supported")):s&&!fr(t.valueSpec)&&l.push(new Pt(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!c||void 0!==t.value.property||l.push(new Pt(t.key,t.value,'"property" property is required')),l;function h(t){var e=[],o=t.value,s=t.key;if("array"!==dr(o))return[new Pt(s,o,"array expected, "+dr(o)+" found")];if(2!==o.length)return[new Pt(s,o,"array length 2 expected, length "+o.length+" found")];if(c){if("object"!==dr(o[0]))return[new Pt(s,o,"object expected, "+dr(o[0])+" found")];if(void 0===o[0].zoom)return[new Pt(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new Pt(s,o,"object stop key must have value")];if(n&&n>It(o[0].zoom))return[new Pt(s,o[0].zoom,"stop zoom values must appear in ascending order")];It(o[0].zoom)!==n&&(n=It(o[0].zoom),r=void 0,a={}),e=e.concat(Mr({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ir,value:f}}))}else e=e.concat(f({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return wr(kt(o[1]))?e.concat([new Pt(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(Jr({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function f(t,n){var s=dr(t.value),u=It(t.value),c=null!==t.value?t.value:n;if(e){if(s!==e)return[new Pt(t.key,c,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Pt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var l="number expected, "+s+" found";return hr(i)&&void 0===o&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Pt(t.key,c,l)]}return"categorical"!==o||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==o&&"number"===s&&void 0!==r&&u<r?[new Pt(t.key,c,"stop domain values must appear in ascending order")]:(r=u,"categorical"===o&&u in a?[new Pt(t.key,c,"stop domain values must be unique")]:(a[u]=!0,[])):[new Pt(t.key,c,"integer expected, found "+u)]}}function Rr(t){var e=("property"===t.expressionContext?Tr:Er)(kt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new Pt(""+t.key+e.key,t.value,e.message)}));var r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&-1!==r.possibleOutputs().indexOf(void 0))return[new Pt(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!me(r))return[new Pt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!me(r))return[new Pt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ye(r,["zoom","feature-state"]))return[new Pt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ge(r))return[new Pt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Lr(t){var e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(It(r))&&i.push(new Pt(e,r,"expected one of ["+n.values.join(", ")+"], "+JSON.stringify(r)+" found")):-1===Object.keys(n.values).indexOf(It(r))&&i.push(new Pt(e,r,"expected one of ["+Object.keys(n.values).join(", ")+"], "+JSON.stringify(r)+" found")),i}function jr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&Array.isArray(t[2]);case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);e<r.length;e+=1){var n=r[e];if(!jr(n)&&"boolean"!=typeof n)return!1}return!0;default:return!0}}Pr.deserialize=function(t){return new Pr(t._parameters,t._specification)},Pr.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var Dr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Br(t){if(null==t)return function(){return!0};jr(t)||(t=zr(t));var e=Er(t,Dr);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return function(t,r){return e.value.evaluate(t,r)}}function Fr(t,e){return t<e?-1:t>e?1:0}function zr(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?Nr(t[1],t[2],"=="):"!="===r?Gr(Nr(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?Nr(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(zr))):"all"===r?["all"].concat(t.slice(1).map(zr)):"none"===r?["all"].concat(t.slice(1).map(zr).map(Gr)):"in"===r?Ur(t[1],t.slice(2)):"!in"===r?Gr(Ur(t[1],t.slice(2))):"has"===r?Vr(t[1]):"!has"!==r||Gr(Vr(t[1]))}function Nr(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function Ur(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(Fr)]]:["filter-in-small",t,["literal",e]]}}function Vr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Gr(t){return["!",t]}function Wr(t){return jr(kt(t.value))?Rr(Ct({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==dr(r))return[new Pt(n,r,"array expected, "+dr(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new Pt(n,r,"filter array must have at least 1 element")];switch(a=a.concat(Lr({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),It(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===It(r[1])&&a.push(new Pt(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new Pt(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=dr(r[1]))&&a.push(new Pt(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s<r.length;s++)i=dr(r[s]),"$type"===It(r[1])?a=a.concat(Lr({key:n+"["+s+"]",value:r[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&a.push(new Pt(n+"["+s+"]",r[s],"string, number, or boolean expected, "+i+" found"));break;case"any":case"all":case"none":for(var u=1;u<r.length;u++)a=a.concat(t({key:n+"["+u+"]",value:r[u],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=dr(r[1]),2!==r.length?a.push(new Pt(n,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"string"!==i&&a.push(new Pt(n+"[1]",r[1],"string expected, "+i+" found"))}return a}(t)}function Hr(t,e){var r=t.key,n=t.style,i=t.styleSpec,o=t.value,a=t.objectKey,s=i[e+"_"+t.layerType];if(!s)return[];var u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&s[u[1]]&&s[u[1]].transition)return Jr({key:r,value:o,valueSpec:i.transition,style:n,styleSpec:i});var c,l=t.valueSpec||s[a];if(!l)return[new Pt(r,o,'unknown property "'+a+'"')];if("string"===dr(o)&&hr(l)&&!l.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new Pt(r,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(c[1])+" }`.")];var h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new Pt(r,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Ar(kt(o))&&"identity"===It(o.type)&&h.push(new Pt(r,o,'"text-font" does not support identity functions'))),h.concat(Jr({key:t.key,value:o,valueSpec:l,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function qr(t){return Hr(t,"paint")}function Zr(t){return Hr(t,"layout")}function Xr(t){var e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;r.type||r.ref||e.push(new Pt(n,r,'either "type" or "ref" is required'));var a,s=It(r.type),u=It(r.ref);if(r.id)for(var c=It(r.id),l=0;l<t.arrayIndex;l++){var h=i.layers[l];It(h.id)===c&&e.push(new Pt(n,r.id,'duplicate layer id "'+r.id+'", previously used at line '+h.id.__line__))}if("ref"in r)["type","source","source-layer","filter","layout"].forEach((function(t){t in r&&e.push(new Pt(n,r[t],'"'+t+'" is prohibited for ref layers'))})),i.layers.forEach((function(t){It(t.id)===u&&(a=t)})),a?a.ref?e.push(new Pt(n,r.ref,"ref cannot reference another ref layer")):s=It(a.type):e.push(new Pt(n,r.ref,'ref layer "'+u+'" not found'));else if("background"!==s)if(r.source){var f=i.sources&&i.sources[r.source],p=f&&It(f.type);f?"vector"===p&&"raster"===s?e.push(new Pt(n,r.source,'layer "'+r.id+'" requires a raster source')):"raster"===p&&"raster"!==s?e.push(new Pt(n,r.source,'layer "'+r.id+'" requires a vector source')):"vector"!==p||r["source-layer"]?"raster-dem"===p&&"hillshade"!==s?e.push(new Pt(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===p&&f.lineMetrics||e.push(new Pt(n,r,'layer "'+r.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new Pt(n,r,'layer "'+r.id+'" must specify a "source-layer"')):e.push(new Pt(n,r.source,'source "'+r.source+'" not found'))}else e.push(new Pt(n,r,'missing required property "source"'));return e=e.concat(Mr({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Jr({key:n+".type",value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"})},filter:Wr,layout:function(t){return Mr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return Zr(Ct({layerType:s},t))}}})},paint:function(t){return Mr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return qr(Ct({layerType:s},t))}}})}}}))}function Qr(t){var e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new Pt(r,e,'"type" is required')];var o,a=It(e.type);switch(a){case"vector":case"raster":case"raster-dem":return Mr({key:r,value:e,valueSpec:n["source_"+a.replace("-","_")],style:t.style,styleSpec:n});case"geojson":if(o=Mr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n}),e.cluster)for(var s in e.clusterProperties){var u=e.clusterProperties[s],c=u[0],l=u[1],h="string"==typeof c?[c,["accumulated"],["get",s]]:c;o.push.apply(o,Rr({key:r+"."+s+".map",value:l,expressionContext:"cluster-map"})),o.push.apply(o,Rr({key:r+"."+s+".reduce",value:h,expressionContext:"cluster-reduce"}))}return o;case"video":return Mr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Mr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new Pt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Lr({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function Yr(t){var e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=dr(e);if(void 0===e)return o;if("object"!==a)return o.concat([new Pt("light",e,"object expected, "+a+" found")]);for(var s in e){var u=s.match(/^(.*)-transition$/);o=u&&n[u[1]]&&n[u[1]].transition?o.concat(Jr({key:s,value:e[s],valueSpec:r.transition,style:i,styleSpec:r})):n[s]?o.concat(Jr({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):o.concat([new Pt(s,e[s],'unknown property "'+s+'"')])}return o}function Kr(t){var e=t.value,r=t.key,n=dr(e);return"string"!==n?[new Pt(r,e,"string expected, "+n+" found")]:[]}var $r={"*":function(){return[]},array:Cr,boolean:function(t){var e=t.value,r=t.key,n=dr(e);return"boolean"!==n?[new Pt(r,e,"boolean expected, "+n+" found")]:[]},number:Ir,color:function(t){var e=t.key,r=t.value,n=dr(r);return"string"!==n?[new Pt(e,r,"color expected, "+n+" found")]:null===Qt(r)?[new Pt(e,r,'color expected, "'+r+'" found')]:[]},constants:Mt,enum:Lr,filter:Wr,function:kr,layer:Xr,object:Mr,source:Qr,light:Yr,string:Kr,formatted:function(t){return 0===Kr(t).length?[]:Rr(t)},resolvedImage:function(t){return 0===Kr(t).length?[]:Rr(t)}};function Jr(t){var e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Ar(It(e))?kr(t):r.expression&&wr(kt(e))?Rr(t):r.type&&$r[r.type]?$r[r.type](t):Mr(Ct({},t,{valueSpec:r.type?n[r.type]:r}))}function tn(t){var e=t.value,r=t.key,n=Kr(t);return n.length?n:(-1===e.indexOf("{fontstack}")&&n.push(new Pt(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new Pt(r,e,'"glyphs" url must include a "{range}" token')),n)}function en(t,e){void 0===e&&(e=Tt);var r=[];return r=r.concat(Jr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:tn,"*":function(){return[]}}})),t.constants&&(r=r.concat(Mt({key:"constants",value:t.constants,style:t,styleSpec:e}))),rn(r)}function rn(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function nn(t){return function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return rn(t.apply(this,e))}}en.source=nn(Qr),en.light=nn(Yr),en.layer=nn(Xr),en.filter=nn(Wr),en.paintProperty=nn(qr),en.layoutProperty=nn(Zr);var on=en,an=on.light,sn=on.paintProperty,un=on.layoutProperty;function cn(t,e){var r=!1;if(e&&e.length)for(var n=0,i=e;n<i.length;n+=1){var o=i[n];t.fire(new St(new Error(o.message))),r=!0}return r}var ln=hn;function hn(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],e=i[1],r=i[2],this.d=e+2*r;for(var o=0;o<this.d*this.d;o++){var a=i[3+o],s=i[3+o+1];n.push(a===s?null:i.subarray(a,s))}var u=i[3+n.length],c=i[3+n.length+1];this.keys=i.subarray(u,c),this.bboxes=i.subarray(c),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var l=0;l<this.d*this.d;l++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var h=r/e*t;this.min=-h,this.max=t+h}hn.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},hn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},hn.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},hn.prototype.query=function(t,e,r,n,i){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s},hn.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=this.cells[i];if(null!==u)for(var c=this.keys,l=this.bboxes,h=0;h<u.length;h++){var f=u[h];if(void 0===a[f]){var p=4*f;(s?s(l[p+0],l[p+1],l[p+2],l[p+3]):t<=l[p+2]&&e<=l[p+3]&&r>=l[p+0]&&n>=l[p+1])?(a[f]=!0,o.push(c[f])):a[f]=!1}}},hn.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToCellCoord(t),c=this._convertToCellCoord(e),l=this._convertToCellCoord(r),h=this._convertToCellCoord(n),f=u;f<=l;f++)for(var p=c;p<=h;p++){var d=this.d*p+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(p),this._convertFromCellCoord(f+1),this._convertFromCellCoord(p+1)))&&i.call(this,t,e,r,n,d,o,a,s))return}},hn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},hn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},hn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer};var fn=self.ImageData,pn={};function dn(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),pn[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}for(var An in dn("Object",Object),ln.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},ln.deserialize=function(t){return new ln(t.buffer)},dn("Grid",ln),dn("Color",Yt),dn("Error",Error),dn("ResolvedImage",te),dn("StylePropertyFunction",Pr),dn("StyleExpression",xr,{omit:["_evaluator"]}),dn("ZoomDependentExpression",Or),dn("ZoomConstantExpression",Sr),dn("CompoundExpression",de,{omit:["_evaluate"]}),ir)ir[An]._classRegistryKey||dn("Expression_"+An,ir[An]);function gn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function mn(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(gn(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var r=t;return e&&e.push(r.buffer),r}if(t instanceof fn)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var n=[],i=0,o=t;i<o.length;i+=1){var a=o[i];n.push(mn(a,e))}return n}if("object"==typeof t){var s=t.constructor,u=s._classRegistryKey;if(!u)throw new Error("can't serialize object of unregistered class");var c=s.serialize?s.serialize(t,e):{};if(!s.serialize){for(var l in t)if(t.hasOwnProperty(l)&&!(pn[u].omit.indexOf(l)>=0)){var h=t[l];c[l]=pn[u].shallow.indexOf(l)>=0?h:mn(h,e)}t instanceof Error&&(c.message=t.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==u&&(c.$name=u),c}throw new Error("can't serialize object of type "+typeof t)}function yn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||gn(t)||ArrayBuffer.isView(t)||t instanceof fn)return t;if(Array.isArray(t))return t.map(yn);if("object"==typeof t){var e=t.$name||"Object",r=pn[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,o=Object.keys(t);i<o.length;i+=1){var a=o[i];if("$name"!==a){var s=t[a];n[a]=pn[e].shallow.indexOf(a)>=0?s:yn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var vn=function(){this.first=!0};vn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))};var _n={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function bn(t){for(var e=0,r=t;e<r.length;e+=1)if(wn(r[e].charCodeAt(0)))return!0;return!1}function xn(t){return!(_n.Arabic(t)||_n["Arabic Supplement"](t)||_n["Arabic Extended-A"](t)||_n["Arabic Presentation Forms-A"](t)||_n["Arabic Presentation Forms-B"](t))}function wn(t){return!(746!==t&&747!==t&&(t<4352||!(_n["Bopomofo Extended"](t)||_n.Bopomofo(t)||_n["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||_n["CJK Compatibility Ideographs"](t)||_n["CJK Compatibility"](t)||_n["CJK Radicals Supplement"](t)||_n["CJK Strokes"](t)||!(!_n["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_n["CJK Unified Ideographs Extension A"](t)||_n["CJK Unified Ideographs"](t)||_n["Enclosed CJK Letters and Months"](t)||_n["Hangul Compatibility Jamo"](t)||_n["Hangul Jamo Extended-A"](t)||_n["Hangul Jamo Extended-B"](t)||_n["Hangul Jamo"](t)||_n["Hangul Syllables"](t)||_n.Hiragana(t)||_n["Ideographic Description Characters"](t)||_n.Kanbun(t)||_n["Kangxi Radicals"](t)||_n["Katakana Phonetic Extensions"](t)||_n.Katakana(t)&&12540!==t||!(!_n["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!_n["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||_n["Unified Canadian Aboriginal Syllabics"](t)||_n["Unified Canadian Aboriginal Syllabics Extended"](t)||_n["Vertical Forms"](t)||_n["Yijing Hexagram Symbols"](t)||_n["Yi Syllables"](t)||_n["Yi Radicals"](t))))}function En(t){return!(wn(t)||function(t){return!!(_n["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||_n["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||_n["Letterlike Symbols"](t)||_n["Number Forms"](t)||_n["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||_n["Control Pictures"](t)&&9251!==t||_n["Optical Character Recognition"](t)||_n["Enclosed Alphanumerics"](t)||_n["Geometric Shapes"](t)||_n["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||_n["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||_n["CJK Symbols and Punctuation"](t)||_n.Katakana(t)||_n["Private Use Area"](t)||_n["CJK Compatibility Forms"](t)||_n["Small Form Variants"](t)||_n["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Sn(t){return t>=1424&&t<=2303||_n["Arabic Presentation Forms-A"](t)||_n["Arabic Presentation Forms-B"](t)}function On(t,e){return!(!e&&Sn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||_n.Khmer(t))}function Tn(t){for(var e=0,r=t;e<r.length;e+=1)if(Sn(r[e].charCodeAt(0)))return!0;return!1}var Pn="deferred",Mn="loading",Cn="loaded",In=null,kn="unavailable",Rn=null,Ln=function(t){In&&In(t)};function jn(){Dn.fire(new Et("pluginStateChange",{pluginStatus:kn,pluginURL:Rn}))}var Dn=new Ot,Bn=function(){return kn},Fn=function(){if(kn!==Pn||!Rn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");kn=Mn,jn(),Rn&&vt({url:Rn},(function(t){t?Ln(t):(kn=Cn,jn())}))},zn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return kn===Cn||null!=zn.applyArabicShaping},isLoading:function(){return kn===Mn},setState:function(t){kn=t.pluginStatus,Rn=t.pluginURL},isParsed:function(){return null!=zn.applyArabicShaping&&null!=zn.processBidirectionalText&&null!=zn.processStyledBidirectionalText},getPluginURL:function(){return Rn}},Nn=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new vn,this.transition={})};Nn.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;r<n.length;r+=1)if(!On(n[r].charCodeAt(0),e))return!1;return!0}(t,zn.isLoaded())},Nn.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},Nn.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var Un=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ar(t))return new Pr(t,e);if(wr(t)){var r=Tr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=Yt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};Un.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},Un.prototype.possiblyEvaluate=function(t,e){return this.property.possiblyEvaluate(this,t,e)};var Vn=function(t){this.property=t,this.value=new Un(t,void 0)};Vn.prototype.transitioned=function(t,e){return new Wn(this.property,this.value,e,h({},t.transition,this.transition),t.now)},Vn.prototype.untransitioned=function(){return new Wn(this.property,this.value,null,{},0)};var Gn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};Gn.prototype.getValue=function(t){return _(this._values[t].value.value)},Gn.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Vn(this._values[t].property)),this._values[t].value=new Un(this._values[t].property,null===e?void 0:_(e))},Gn.prototype.getTransition=function(t){return _(this._values[t].transition)},Gn.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Vn(this._values[t].property)),this._values[t].transition=_(e)||void 0},Gn.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e],i=this.getValue(n);void 0!==i&&(t[n]=i);var o=this.getTransition(n);void 0!==o&&(t[n+"-transition"]=o)}return t},Gn.prototype.transitioned=function(t,e){for(var r=new Hn(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var o=i[n];r._values[o]=this._values[o].transitioned(t,e._values[o])}return r},Gn.prototype.untransitioned=function(){for(var t=new Hn(this._properties),e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e];t._values[n]=this._values[n].untransitioned()}return t};var Wn=function(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)};Wn.prototype.possiblyEvaluate=function(t,e){var r=t.now||0,n=this.value.possiblyEvaluate(t,e),i=this.prior;if(i){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return i.possiblyEvaluate(t,e);var o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(t,e),n,function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return n};var Hn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Hn.prototype.possiblyEvaluate=function(t,e){for(var r=new Xn(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var o=i[n];r._values[o]=this._values[o].possiblyEvaluate(t,e)}return r},Hn.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1){var r=e[t];if(this._values[r].prior)return!0}return!1};var qn=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};qn.prototype.getValue=function(t){return _(this._values[t].value)},qn.prototype.setValue=function(t,e){this._values[t]=new Un(this._values[t].property,null===e?void 0:_(e))},qn.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e],i=this.getValue(n);void 0!==i&&(t[n]=i)}return t},qn.prototype.possiblyEvaluate=function(t,e){for(var r=new Xn(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var o=i[n];r._values[o]=this._values[o].possiblyEvaluate(t,e)}return r};var Zn=function(t,e,r){this.property=t,this.value=e,this.parameters=r};Zn.prototype.isConstant=function(){return"constant"===this.value.kind},Zn.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},Zn.prototype.evaluate=function(t,e,r){return this.property.evaluate(this.value,this.parameters,t,e,r)};var Xn=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};Xn.prototype.get=function(t){return this._values[t]};var Qn=function(t){this.specification=t};Qn.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},Qn.prototype.interpolate=function(t,e,r){var n=Ee[this.specification.type];return n?n(t,e,r):t};var Yn=function(t,e){this.specification=t,this.overrides=e};Yn.prototype.possiblyEvaluate=function(t,e,r){return"constant"===t.expression.kind||"camera"===t.expression.kind?new Zn(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r)},e):new Zn(this,t.expression,e)},Yn.prototype.interpolate=function(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Zn(this,{kind:"constant",value:void 0},t.parameters);var n=Ee[this.specification.type];return n?new Zn(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t},Yn.prototype.evaluate=function(t,e,r,n,i){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i)};var Kn=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.possiblyEvaluate=function(t,e,r){if(void 0===t.value)return new Zn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var n=t.expression.evaluate(e,null,{},r),i="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(i,i,i,e);return new Zn(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){var a=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Zn(this,{kind:"constant",value:a},e)}return new Zn(this,t.expression,e)},e.prototype.evaluate=function(t,e,r,n,i){if("source"===t.kind){var o=t.evaluate(e,r,n,i);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value},e.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(Yn),$n=function(t){this.specification=t};$n.prototype.possiblyEvaluate=function(t,e,r){if(void 0!==t.value){if("constant"===t.expression.kind){var n=t.expression.evaluate(e,null,{},r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Nn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom+1),e)),e)}},$n.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},$n.prototype.interpolate=function(t){return t};var Jn=function(t){this.specification=t};Jn.prototype.possiblyEvaluate=function(t,e,r){return!!t.expression.evaluate(e,null,{},r)},Jn.prototype.interpolate=function(){return!1};var ti=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new Un(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Vn(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};dn("DataDrivenProperty",Yn),dn("DataConstantProperty",Qn),dn("CrossFadedDataDrivenProperty",Kn),dn("CrossFadedProperty",$n),dn("ColorRampProperty",Jn);var ei=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter=function(){return!0},"custom"!==e.type&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new qn(r.layout)),r.paint)){for(var n in this._transitionablePaint=new Gn(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e){var n="layers."+this.id+".layout."+t;if(this._validate(un,n,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e},e.prototype.getPaintProperty=function(t){return m(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e){var n="layers."+this.id+".paint."+t;if(this._validate(sn,n,t,e,r))return!1}if(m(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var i=this._transitionablePaint._values[t],o="cross-faded-data-driven"===i.property.specification["property-type"],a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var u=this._transitionablePaint._values[t].value;return u.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(t,s,u)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),v(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&cn(this,t.call(on,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Tt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof Zn&&hr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Ot),ri={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},ni=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},ii=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function oi(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i,o=(i=t.type,ri[i].BYTES_PER_ELEMENT),a=r=ai(r,Math.max(e,o)),s=t.components||1;return n=Math.max(n,o),r+=o*s,{name:t.name,type:t.type,components:s,offset:a}})),size:ai(r,Math.max(n,e)),alignment:e}}function ai(t,e){return Math.ceil(t/e)*e}ii.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},ii.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},ii.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},ii.prototype.clear=function(){this.length=0},ii.prototype.resize=function(t){this.reserve(t),this.length=t},ii.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},ii.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var si=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(ii);si.prototype.bytesPerElement=4,dn("StructArrayLayout2i4",si);var ui=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(ii);ui.prototype.bytesPerElement=8,dn("StructArrayLayout4i8",ui);var ci=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(ii);ci.prototype.bytesPerElement=12,dn("StructArrayLayout2i4i12",ci);var li=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=4*t,u=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=o,this.uint8[u+7]=a,t},e}(ii);li.prototype.bytesPerElement=8,dn("StructArrayLayout2i4ub8",li);var hi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,o,a,s)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u){var c=8*t;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=n,this.uint16[c+3]=i,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=u,t},e}(ii);hi.prototype.bytesPerElement=16,dn("StructArrayLayout8ui16",hi);var fi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,c,l,h){var f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,n,i,o,a,s,u,c,l,h)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,c,l,h,f){var p=12*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=u,this.int16[p+8]=c,this.int16[p+9]=l,this.int16[p+10]=h,this.int16[p+11]=f,t},e}(ii);fi.prototype.bytesPerElement=24,dn("StructArrayLayout4i4ui4i24",fi);var pi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(ii);pi.prototype.bytesPerElement=12,dn("StructArrayLayout3f12",pi);var di=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var r=1*t;return this.uint32[r+0]=e,t},e}(ii);di.prototype.bytesPerElement=4,dn("StructArrayLayout1ul4",di);var Ai=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,c,l){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,o,a,s,u,c,l)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,c,l,h){var f=12*t,p=6*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=o,this.int16[f+5]=a,this.uint32[p+3]=s,this.uint16[f+8]=u,this.uint16[f+9]=c,this.int16[f+10]=l,this.int16[f+11]=h,t},e}(ii);Ai.prototype.bytesPerElement=24,dn("StructArrayLayout6i1ul2ui2i24",Ai);var gi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(ii);gi.prototype.bytesPerElement=12,dn("StructArrayLayout2i2i2i12",gi);var mi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t},e}(ii);mi.prototype.bytesPerElement=12,dn("StructArrayLayout2ub2f12",mi);var yi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g){var m=this.length;return this.resize(m+1),this.emplace(m,t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g,m){var y=24*t,v=12*t,_=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=n,this.uint16[y+3]=i,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=u,this.uint16[y+11]=c,this.uint16[y+12]=l,this.float32[v+7]=h,this.float32[v+8]=f,this.uint8[_+36]=p,this.uint8[_+37]=d,this.uint8[_+38]=A,this.uint32[v+10]=g,this.int16[y+22]=m,t},e}(ii);yi.prototype.bytesPerElement=48,dn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",yi);var vi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x,w,E,S){var O=this.length;return this.resize(O+1),this.emplace(O,t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x,w,E,S)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x,w,E,S,O){var T=30*t,P=15*t;return this.int16[T+0]=e,this.int16[T+1]=r,this.int16[T+2]=n,this.int16[T+3]=i,this.int16[T+4]=o,this.int16[T+5]=a,this.int16[T+6]=s,this.int16[T+7]=u,this.uint16[T+8]=c,this.uint16[T+9]=l,this.uint16[T+10]=h,this.uint16[T+11]=f,this.uint16[T+12]=p,this.uint16[T+13]=d,this.uint16[T+14]=A,this.uint16[T+15]=g,this.uint16[T+16]=m,this.uint16[T+17]=y,this.uint16[T+18]=v,this.uint16[T+19]=_,this.uint16[T+20]=b,this.uint16[T+21]=x,this.uint32[P+11]=w,this.float32[P+12]=E,this.float32[P+13]=S,this.float32[P+14]=O,t},e}(ii);vi.prototype.bytesPerElement=60,dn("StructArrayLayout8i14ui1ul3f60",vi);var _i=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var r=1*t;return this.float32[r+0]=e,t},e}(ii);_i.prototype.bytesPerElement=4,dn("StructArrayLayout1f4",_i);var bi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(ii);bi.prototype.bytesPerElement=6,dn("StructArrayLayout3i6",bi);var xi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=2*t,o=4*t;return this.uint32[i+0]=e,this.uint16[o+2]=r,this.uint16[o+3]=n,t},e}(ii);xi.prototype.bytesPerElement=8,dn("StructArrayLayout1ul2ui8",xi);var wi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(ii);wi.prototype.bytesPerElement=6,dn("StructArrayLayout3ui6",wi);var Ei=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(ii);Ei.prototype.bytesPerElement=4,dn("StructArrayLayout2ui4",Ei);var Si=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var r=1*t;return this.uint16[r+0]=e,t},e}(ii);Si.prototype.bytesPerElement=2,dn("StructArrayLayout1ui2",Si);var Oi=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(ii);Oi.prototype.bytesPerElement=8,dn("StructArrayLayout2f8",Oi);var Ti=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._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(ii);Ti.prototype.bytesPerElement=16,dn("StructArrayLayout4f16",Ti);var Pi=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={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(ni);Pi.prototype.size=24;var Mi=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.get=function(t){return new Pi(this,t)},e}(Ai);dn("CollisionBoxArray",Mi);var Ci=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={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},r.associatedIconIndex.set=function(t){this._structArray.int16[this._pos2+22]=t},Object.defineProperties(e.prototype,r),e}(ni);Ci.prototype.size=48;var Ii=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.get=function(t){return new Ci(this,t)},e}(yi);dn("PlacedSymbolArray",Ii);var ki=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={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.rightJustifiedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+2]=t},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.centerJustifiedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+3]=t},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.leftJustifiedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+4]=t},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.verticalPlacedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+5]=t},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.placedIconSymbolIndex.set=function(t){this._structArray.int16[this._pos2+6]=t},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.verticalPlacedIconSymbolIndex.set=function(t){this._structArray.int16[this._pos2+7]=t},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.key.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.textBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.verticalTextBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+13]=t},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.iconBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+14]=t},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+15]=t},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.verticalIconBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+16]=t},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.featureIndex.set=function(t){this._structArray.uint16[this._pos2+17]=t},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numHorizontalGlyphVertices.set=function(t){this._structArray.uint16[this._pos2+18]=t},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numVerticalGlyphVertices.set=function(t){this._structArray.uint16[this._pos2+19]=t},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numIconVertices.set=function(t){this._structArray.uint16[this._pos2+20]=t},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.numVerticalIconVertices.set=function(t){this._structArray.uint16[this._pos2+21]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+11]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+11]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+12]},r.textBoxScale.set=function(t){this._structArray.float32[this._pos4+12]=t},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.set=function(t){this._structArray.float32[this._pos4+13]=t},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.set=function(t){this._structArray.float32[this._pos4+14]=t},Object.defineProperties(e.prototype,r),e}(ni);ki.prototype.size=60;var Ri=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.get=function(t){return new ki(this,t)},e}(vi);dn("SymbolInstanceArray",Ri);var Li=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={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,r),e}(ni);Li.prototype.size=4;var ji=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.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new Li(this,t)},e}(_i);dn("GlyphOffsetArray",ji);var Di=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={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,r),e}(ni);Di.prototype.size=6;var Bi=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.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new Di(this,t)},e}(bi);dn("SymbolLineVertexArray",Bi);var Fi=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={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,r),e}(ni);Fi.prototype.size=8;var zi=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.get=function(t){return new Fi(this,t)},e}(xi);dn("FeatureIndexArray",zi);var Ni=oi([{name:"a_pos",components:2,type:"Int16"}],4).members,Ui=function(t){void 0===t&&(t=[]),this.segments=t};function Vi(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}Ui.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>Ui.MAX_VERTEX_ARRAY_LENGTH&&x("Max vertices per segment is "+Ui.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>Ui.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},Ui.prototype.get=function(){return this.segments},Ui.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var r=e[t];for(var n in r.vaos)r.vaos[n].destroy()}},Ui.simpleSegment=function(t,e,r,n){return new Ui([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])},Ui.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,dn("SegmentVector",Ui);var Gi=function(){this.ids=[],this.positions=[],this.indexed=!1};function Wi(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Gi.prototype.add=function(t,e,r,n){this.ids.push(t),this.positions.push(e,r,n)},Gi.prototype.getPositions=function(t){for(var e=0,r=this.ids.length-1;e<r;){var n=e+r>>1;this.ids[n]>=t?r=n:e=n+1}for(var i=[];this.ids[e]===t;){var o=this.positions[3*e],a=this.positions[3*e+1],s=this.positions[3*e+2];i.push({index:o,start:a,end:s}),e++}return i},Gi.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){if(!(n>=i)){for(var o=e[n+i>>1],a=n-1,s=i+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;Wi(e,a,s),Wi(r,3*a,3*s),Wi(r,3*a+1,3*s+1),Wi(r,3*a+2,3*s+2)}t(e,r,n,s),t(e,r,s+1,i)}}(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}},Gi.deserialize=function(t){var e=new Gi;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e},dn("FeaturePositionMap",Gi);var Hi=function(t,e){this.gl=t.gl,this.location=e},qi=function(t){function e(e,r){t.call(this,e,r),this.current=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(Hi),Zi=function(t){function e(e,r){t.call(this,e,r),this.current=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(Hi),Xi=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(Hi),Qi=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(Hi),Yi=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(Hi),Ki=function(t){function e(e,r){t.call(this,e,r),this.current=Yt.transparent}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(Hi),$i=new Float32Array(16),Ji=function(t){function e(e,r){t.call(this,e,r),this.current=$i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(Hi);function to(t){return[Vi(255*t.r,255*t.g),Vi(255*t.b,255*t.a)]}var eo=function(t,e,r){this.value=t,this.names=e,this.uniformNames=this.names.map((function(t){return"u_"+t})),this.type=r,this.maxValue=-1/0};eo.prototype.defines=function(){return this.names.map((function(t){return"#define HAS_UNIFORM_u_"+t}))},eo.prototype.setConstantPatternPositions=function(){},eo.prototype.populatePaintArray=function(){},eo.prototype.updatePaintArray=function(){},eo.prototype.upload=function(){},eo.prototype.destroy=function(){},eo.prototype.setUniforms=function(t,e,r,n){e.set(n.constantOr(this.value))},eo.prototype.getBinding=function(t,e){return"color"===this.type?new Ki(t,e):new Zi(t,e)},eo.serialize=function(t){var e=t.value,r=t.names,n=t.type;return{value:mn(e),names:r,type:n}},eo.deserialize=function(t){var e=t.value,r=t.names,n=t.type;return new eo(yn(e),r,n)};var ro=function(t,e,r){this.value=t,this.names=e,this.uniformNames=this.names.map((function(t){return"u_"+t})),this.type=r,this.maxValue=-1/0,this.patternPositions={patternTo:null,patternFrom:null}};ro.prototype.defines=function(){return this.names.map((function(t){return"#define HAS_UNIFORM_u_"+t}))},ro.prototype.populatePaintArray=function(){},ro.prototype.updatePaintArray=function(){},ro.prototype.upload=function(){},ro.prototype.destroy=function(){},ro.prototype.setConstantPatternPositions=function(t,e){this.patternPositions.patternTo=t.tlbr,this.patternPositions.patternFrom=e.tlbr},ro.prototype.setUniforms=function(t,e,r,n,i){var o=this.patternPositions;"u_pattern_to"===i&&o.patternTo&&e.set(o.patternTo),"u_pattern_from"===i&&o.patternFrom&&e.set(o.patternFrom)},ro.prototype.getBinding=function(t,e){return new Yi(t,e)};var no=function(t,e,r,n){this.expression=t,this.names=e,this.type=r,this.uniformNames=this.names.map((function(t){return"a_"+t})),this.maxValue=-1/0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new n};no.prototype.defines=function(){return[]},no.prototype.setConstantPatternPositions=function(){},no.prototype.populatePaintArray=function(t,e,r,n){var i=this.paintVertexArray,o=i.length;i.reserve(t);var a=this.expression.evaluate(new Nn(0),e,{},[],n);if("color"===this.type)for(var s=to(a),u=o;u<t;u++)i.emplaceBack(s[0],s[1]);else{for(var c=o;c<t;c++)i.emplaceBack(a);this.maxValue=Math.max(this.maxValue,a)}},no.prototype.updatePaintArray=function(t,e,r,n){var i=this.paintVertexArray,o=this.expression.evaluate({zoom:0},r,n);if("color"===this.type)for(var a=to(o),s=t;s<e;s++)i.emplace(s,a[0],a[1]);else{for(var u=t;u<e;u++)i.emplace(u,o);this.maxValue=Math.max(this.maxValue,o)}},no.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},no.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},no.prototype.setUniforms=function(t,e){e.set(0)},no.prototype.getBinding=function(t,e){return new Zi(t,e)};var io=function(t,e,r,n,i,o){this.expression=t,this.names=e,this.uniformNames=this.names.map((function(t){return"u_"+t+"_t"})),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=-1/0;var a=o;this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?4:2,offset:0}})),this.paintVertexArray=new a};io.prototype.defines=function(){return[]},io.prototype.setConstantPatternPositions=function(){},io.prototype.populatePaintArray=function(t,e,r,n){var i=this.paintVertexArray,o=i.length;i.reserve(t);var a=this.expression.evaluate(new Nn(this.zoom),e,{},[],n),s=this.expression.evaluate(new Nn(this.zoom+1),e,{},[],n);if("color"===this.type)for(var u=to(a),c=to(s),l=o;l<t;l++)i.emplaceBack(u[0],u[1],c[0],c[1]);else{for(var h=o;h<t;h++)i.emplaceBack(a,s);this.maxValue=Math.max(this.maxValue,a,s)}},io.prototype.updatePaintArray=function(t,e,r,n){var i=this.paintVertexArray,o=this.expression.evaluate({zoom:this.zoom},r,n),a=this.expression.evaluate({zoom:this.zoom+1},r,n);if("color"===this.type)for(var s=to(o),u=to(a),c=t;c<e;c++)i.emplace(c,s[0],s[1],u[0],u[1]);else{for(var l=t;l<e;l++)i.emplace(l,o,a);this.maxValue=Math.max(this.maxValue,o,a)}},io.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},io.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},io.prototype.interpolationFactor=function(t){return this.useIntegerZoom&&(t=Math.floor(t)),c(this.expression.interpolationFactor(t,this.zoom,this.zoom+1),0,1)},io.prototype.setUniforms=function(t,e,r){e.set(this.interpolationFactor(r.zoom))},io.prototype.getBinding=function(t,e){return new Zi(t,e)};var oo=function(t,e,r,n,i,o,a){this.expression=t,this.names=e,this.type=r,this.uniformNames=this.names.map((function(t){return"u_"+t+"_t"})),this.useIntegerZoom=n,this.zoom=i,this.maxValue=-1/0,this.layerId=a,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Uint16",components:4,offset:0}})),this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o};oo.prototype.defines=function(){return[]},oo.prototype.setConstantPatternPositions=function(){},oo.prototype.populatePaintArray=function(t,e,r){var n=this.zoomInPaintVertexArray,i=this.zoomOutPaintVertexArray,o=this.layerId,a=n.length;if(n.reserve(t),i.reserve(t),r&&e.patterns&&e.patterns[o]){var s=e.patterns[o],u=s.min,c=s.mid,l=s.max,h=r[u],f=r[c],p=r[l];if(!h||!f||!p)return;for(var d=a;d<t;d++)n.emplaceBack(f.tl[0],f.tl[1],f.br[0],f.br[1],h.tl[0],h.tl[1],h.br[0],h.br[1]),i.emplaceBack(f.tl[0],f.tl[1],f.br[0],f.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1])}},oo.prototype.updatePaintArray=function(t,e,r,n,i){var o=this.zoomInPaintVertexArray,a=this.zoomOutPaintVertexArray,s=this.layerId;if(i&&r.patterns&&r.patterns[s]){var u=r.patterns[s],c=u.min,l=u.mid,h=u.max,f=i[c],p=i[l],d=i[h];if(!f||!p||!d)return;for(var A=t;A<e;A++)o.emplace(A,p.tl[0],p.tl[1],p.br[0],p.br[1],f.tl[0],f.tl[1],f.br[0],f.br[1]),a.emplace(A,p.tl[0],p.tl[1],p.br[0],p.br[1],d.tl[0],d.tl[1],d.br[0],d.br[1])}},oo.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},oo.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()},oo.prototype.setUniforms=function(t,e){e.set(0)},oo.prototype.getBinding=function(t,e){return new Zi(t,e)};var ao=function(){this.binders={},this.cacheKey="",this._buffers=[]};ao.createDynamic=function(t,e,r){var n=new ao,i=[];for(var o in t.paint._values)if(r(o)){var a=t.paint.get(o);if(a instanceof Zn&&hr(a.property.specification)){var s=uo(o,t.type),u=a.property.specification.type,c=a.property.useIntegerZoom;if("cross-faded"===a.property.specification["property-type"]||"cross-faded-data-driven"===a.property.specification["property-type"])if("constant"===a.value.kind)n.binders[o]=new ro(a.value.value,s,u),i.push("/u_"+o);else{var l=co(o,u,"source");n.binders[o]=new oo(a.value,s,u,c,e,l,t.id),i.push("/a_"+o)}else if("constant"===a.value.kind)n.binders[o]=new eo(a.value.value,s,u),i.push("/u_"+o);else if("source"===a.value.kind){var h=co(o,u,"source");n.binders[o]=new no(a.value,s,u,h),i.push("/a_"+o)}else{var f=co(o,u,"composite");n.binders[o]=new io(a.value,s,u,c,e,f),i.push("/z_"+o)}}}return n.cacheKey=i.sort().join(""),n},ao.prototype.populatePaintArrays=function(t,e,r,n,i){for(var o in this.binders)this.binders[o].populatePaintArray(t,e,n,i)},ao.prototype.setConstantPatternPositions=function(t,e){for(var r in this.binders)this.binders[r].setConstantPatternPositions(t,e)},ao.prototype.updatePaintArrays=function(t,e,r,n,i){var o=!1;for(var a in t)for(var s=0,u=e.getPositions(+a);s<u.length;s+=1){var c=u[s],l=r.feature(c.index);for(var h in this.binders){var f=this.binders[h];if(!(f instanceof eo||f instanceof ro)&&!0===f.expression.isStateDependent){var p=n.paint.get(h);f.expression=p.value,f.updatePaintArray(c.start,c.end,l,t[a],i),o=!0}}}return o},ao.prototype.defines=function(){var t=[];for(var e in this.binders)t.push.apply(t,this.binders[e].defines());return t},ao.prototype.getPaintVertexBuffers=function(){return this._buffers},ao.prototype.getUniforms=function(t,e){var r=[];for(var n in this.binders)for(var i=this.binders[n],o=0,a=i.uniformNames;o<a.length;o+=1){var s=a[o];if(e[s]){var u=i.getBinding(t,e[s]);r.push({name:s,property:n,binding:u})}}return r},ao.prototype.setUniforms=function(t,e,r,n){for(var i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.name,u=a.property,c=a.binding;this.binders[u].setUniforms(t,c,n,r.get(u),s)}},ao.prototype.updatePatternPaintBuffers=function(t){var e=[];for(var r in this.binders){var n=this.binders[r];if(n instanceof oo){var i=2===t.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&e.push(i)}else(n instanceof no||n instanceof io)&&n.paintVertexBuffer&&e.push(n.paintVertexBuffer)}this._buffers=e},ao.prototype.upload=function(t){for(var e in this.binders)this.binders[e].upload(t);var r=[];for(var n in this.binders){var i=this.binders[n];(i instanceof no||i instanceof io)&&i.paintVertexBuffer&&r.push(i.paintVertexBuffer)}this._buffers=r},ao.prototype.destroy=function(){for(var t in this.binders)this.binders[t].destroy()};var so=function(t,e,r,n){void 0===n&&(n=function(){return!0}),this.programConfigurations={};for(var i=0,o=e;i<o.length;i+=1){var a=o[i];this.programConfigurations[a.id]=ao.createDynamic(a,r,n),this.programConfigurations[a.id].layoutAttributes=t}this.needsUpload=!1,this._featureMap=new Gi,this._bufferOffset=0};function uo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from"],"fill-pattern":["pattern_to","pattern_from"],"fill-extrusion-pattern":["pattern_to","pattern_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function co(t,e,r){var n={color:{source:Oi,composite:Ti},number:{source:_i,composite:Oi}},i=function(t){return{"line-pattern":{source:hi,composite:hi},"fill-pattern":{source:hi,composite:hi},"fill-extrusion-pattern":{source:hi,composite:hi}}[t]}(t);return i&&i[r]||n[e][r]}so.prototype.populatePaintArrays=function(t,e,r,n,i){for(var o in this.programConfigurations)this.programConfigurations[o].populatePaintArrays(t,e,r,n,i);void 0!==e.id&&this._featureMap.add(+e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},so.prototype.updatePaintArrays=function(t,e,r,n){for(var i=0,o=r;i<o.length;i+=1){var a=o[i];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,n)||this.needsUpload}},so.prototype.get=function(t){return this.programConfigurations[t]},so.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},so.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},dn("ConstantBinder",eo),dn("CrossFadedConstantBinder",ro),dn("SourceExpressionBinder",no),dn("CrossFadedCompositeBinder",oo),dn("CompositeExpressionBinder",io),dn("ProgramConfiguration",ao,{omit:["_buffers"]}),dn("ProgramConfigurationSet",so);var lo=8192,ho={min:-1*Math.pow(2,14),max:Math.pow(2,14)-1};function fo(t){for(var e=lo/t.extent,r=t.loadGeometry(),n=0;n<r.length;n++)for(var i=r[n],o=0;o<i.length;o++){var a=i[o];a.x=Math.round(a.x*e),a.y=Math.round(a.y*e),(a.x<ho.min||a.x>ho.max||a.y<ho.min||a.y>ho.max)&&(x("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a.x=c(a.x,ho.min,ho.max),a.y=c(a.y,ho.min,ho.max))}return r}function po(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Ao=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new wi,this.segments=new Ui,this.programConfigurations=new so(Ni,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function go(t,e){for(var r=0;r<t.length;r++)if(So(e,t[r]))return!0;for(var n=0;n<e.length;n++)if(So(t,e[n]))return!0;return!!_o(t,e)}function mo(t,e,r){return!!So(t,e)||!!xo(e,t,r)}function yo(t,e){if(1===t.length)return Eo(e,t[0]);for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;i++)if(So(t,n[i]))return!0;for(var o=0;o<t.length;o++)if(Eo(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(_o(t,e[a]))return!0;return!1}function vo(t,e,r){if(t.length>1){if(_o(t,e))return!0;for(var n=0;n<e.length;n++)if(xo(e[n],t,r))return!0}for(var i=0;i<t.length;i++)if(xo(t[i],e,r))return!0;return!1}function _o(t,e){if(0===t.length||0===e.length)return!1;for(var r=0;r<t.length-1;r++)for(var n=t[r],i=t[r+1],o=0;o<e.length-1;o++)if(bo(n,i,e[o],e[o+1]))return!0;return!1}function bo(t,e,r,n){return w(t,r,n)!==w(e,r,n)&&w(t,e,r)!==w(t,e,n)}function xo(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(var i=1;i<e.length;i++)if(wo(t,e[i-1],e[i])<n)return!0;return!1}function wo(t,e,r){var n=e.distSqr(r);if(0===n)return t.distSqr(e);var i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function Eo(t,e){for(var r,n,i,o=!1,a=0;a<t.length;a++)for(var s=0,u=(r=t[a]).length-1;s<r.length;u=s++)n=r[s],i=r[u],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function So(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Oo(t,e,r){var n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;var o=w(t,e,r[0]);return o!==w(t,e,r[1])||o!==w(t,e,r[2])||o!==w(t,e,r[3])}function To(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].maxValue}function Po(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Mo(t,e,r,n,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===r&&a._rotate(-n);for(var s=[],u=0;u<t.length;u++){var c=t[u];s.push(c.sub(a))}return s}Ao.prototype.populate=function(t,e){var r=this.layers[0],n=[],i=null;"circle"===r.type&&(i=r.layout.get("circle-sort-key"));for(var o=0,a=t;o<a.length;o+=1){var s=a[o],u=s.feature,c=s.index,l=s.sourceLayerIndex;if(this.layers[0]._featureFilter(new Nn(this.zoom),u)){var h=fo(u),f=i?i.evaluate(u,{}):void 0,p={id:u.id,properties:u.properties,type:u.type,sourceLayerIndex:l,index:c,geometry:h,patterns:{},sortKey:f};n.push(p)}}i&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var d=0,A=n;d<A.length;d+=1){var g=A[d],m=g,y=m.geometry,v=m.index,_=m.sourceLayerIndex,b=t[v].feature;this.addFeature(g,y,v),e.featureIndex.insert(b,y,v,_,this.index)}},Ao.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Ao.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ao.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ao.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ni),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ao.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ao.prototype.addFeature=function(t,e,r){for(var n=0,i=e;n<i.length;n+=1)for(var o=0,a=i[n];o<a.length;o+=1){var s=a[o],u=s.x,c=s.y;if(!(u<0||u>=lo||c<0||c>=lo)){var l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=l.vertexLength;po(this.layoutVertexArray,u,c,-1,-1),po(this.layoutVertexArray,u,c,1,-1),po(this.layoutVertexArray,u,c,1,1),po(this.layoutVertexArray,u,c,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),l.vertexLength+=4,l.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{})},dn("CircleBucket",Ao,{omit:["layers"]});var Co,Io=new ti({"circle-sort-key":new Yn(Tt.layout_circle["circle-sort-key"])}),ko={paint:new ti({"circle-radius":new Yn(Tt.paint_circle["circle-radius"]),"circle-color":new Yn(Tt.paint_circle["circle-color"]),"circle-blur":new Yn(Tt.paint_circle["circle-blur"]),"circle-opacity":new Yn(Tt.paint_circle["circle-opacity"]),"circle-translate":new Qn(Tt.paint_circle["circle-translate"]),"circle-translate-anchor":new Qn(Tt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Qn(Tt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Qn(Tt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Yn(Tt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Yn(Tt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Yn(Tt.paint_circle["circle-stroke-opacity"])}),layout:Io},Ro="undefined"!=typeof Float32Array?Float32Array:Array;function Lo(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)}),Co=new Ro(3),Ro!=Float32Array&&(Co[0]=0,Co[1]=0,Co[2]=0),function(){var t=new Ro(4);Ro!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var jo=function(t){function e(e){t.call(this,e,ko)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new Ao(t)},e.prototype.queryRadius=function(t){var e=t;return To("circle-radius",this,e)+To("circle-stroke-width",this,e)+Po(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a,s){for(var u=Mo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),l="map"===this.paint.get("circle-pitch-alignment"),h=l?u:function(t,e){return t.map((function(t){return Do(t,e)}))}(u,s),f=l?c*a:c,p=0,d=n;p<d.length;p+=1)for(var A=0,g=d[p];A<g.length;A+=1){var m=g[A],y=l?m:Do(m,s),v=f,_=Lo([],[m.x,m.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?v*=_[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(v*=o.cameraToCenterDistance/_[3]),mo(h,y,v))return!0}return!1},e}(ei);function Do(t,e){var r=Lo([],[t.x,t.y,0,1],e);return new i(r[0]/r[3],r[1]/r[3])}var Bo=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}(Ao);function Fo(t,e,r,n){var i=e.width,o=e.height;if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*o*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*o*r);return t.width=i,t.height=o,t.data=n,t}function zo(t,e,r){var n=e.width,i=e.height;if(n!==t.width||i!==t.height){var o=Fo({},{width:n,height:i},r);No(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r),t.width=n,t.height=i,t.data=o.data}}function No(t,e,r,n,i,o){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,u=0;u<i.height;u++)for(var c=((r.y+u)*t.width+r.x)*o,l=((n.y+u)*e.width+n.x)*o,h=0;h<i.width*o;h++)s[l+h]=a[c+h];return e}dn("HeatmapBucket",Bo,{omit:["layers"]});var Uo=function(t,e){Fo(this,t,1,e)};Uo.prototype.resize=function(t){zo(this,t,1)},Uo.prototype.clone=function(){return new Uo({width:this.width,height:this.height},new Uint8Array(this.data))},Uo.copy=function(t,e,r,n,i){No(t,e,r,n,i,1)};var Vo=function(t,e){Fo(this,t,4,e)};Vo.prototype.resize=function(t){zo(this,t,4)},Vo.prototype.replace=function(t,e){e?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t},Vo.prototype.clone=function(){return new Vo({width:this.width,height:this.height},new Uint8Array(this.data))},Vo.copy=function(t,e,r,n,i){No(t,e,r,n,i,4)},dn("AlphaImage",Uo),dn("RGBAImage",Vo);var Go={paint:new ti({"heatmap-radius":new Yn(Tt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Yn(Tt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qn(Tt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Jn(Tt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qn(Tt.paint_heatmap["heatmap-opacity"])})};function Wo(t,e){for(var r=new Uint8Array(1024),n={},i=0,o=0;i<256;i++,o+=4){n[e]=i/255;var a=t.evaluate(n);r[o+0]=Math.floor(255*a.r/a.a),r[o+1]=Math.floor(255*a.g/a.a),r[o+2]=Math.floor(255*a.b/a.a),r[o+3]=Math.floor(255*a.a)}return new Vo({width:256,height:1},r)}var Ho=function(t){function e(e){t.call(this,e,Go),this._updateColorRamp()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new Bo(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){var t=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Wo(t,"heatmapDensity"),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e}(ei),qo={paint:new ti({"hillshade-illumination-direction":new Qn(Tt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Qn(Tt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Qn(Tt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Qn(Tt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Qn(Tt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Qn(Tt.paint_hillshade["hillshade-accent-color"])})},Zo=function(t){function e(e){t.call(this,e,qo)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(ei),Xo=oi([{name:"a_pos",components:2,type:"Int16"}],4).members,Qo=Ko,Yo=Ko;function Ko(t,e,r){r=r||2;var n,i,o,a,s,u,c,l=e&&e.length,h=l?e[0]*r:t.length,f=$o(t,0,h,r,!0),p=[];if(!f||f.next===f.prev)return p;if(l&&(f=function(t,e,r,n){var i,o,a,s=[];for(i=0,o=e.length;i<o;i++)(a=$o(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(ca(a));for(s.sort(oa),i=0;i<s.length;i++)aa(s[i],r),r=Jo(r,r.next);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(s=t[d])<n&&(n=s),(u=t[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);c=0!==(c=Math.max(o-n,a-i))?1/c:0}return ta(f,p,r,n,i,c),p}function $o(t,e,r,n,i){var o,a;if(i===xa(t,e,r,n)>0)for(o=e;o<r;o+=n)a=va(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=va(o,t[o],t[o+1],a);return a&&pa(a,a.next)&&(_a(a),a=a.next),a}function Jo(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!pa(n,n.next)&&0!==fa(n.prev,n,n.next))n=n.next;else{if(_a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ta(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=ua(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,c=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<c&&(s++,n=n.nextZ);e++);for(u=c;s>0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,c*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,c=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?ra(t,n,i,o):ea(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),_a(t),t=u.next,c=u.next;else if((t=u)===c){a?1===a?ta(t=na(Jo(t),e,r),e,r,n,i,o,2):2===a&&ia(t,e,r,n,i,o):ta(Jo(t),e,r,n,i,o,1);break}}}function ea(t){var e=t.prev,r=t,n=t.next;if(fa(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(la(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&fa(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ra(t,e,r,n){var i=t.prev,o=t,a=t.next;if(fa(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=ua(s,u,e,r,n),f=ua(c,l,e,r,n),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&la(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&fa(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&la(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&fa(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&la(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&fa(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&la(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&fa(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function na(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!pa(i,o)&&da(i,n,n.next,o)&&ma(i,o)&&ma(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),_a(n),_a(n.next),n=t=o),n=n.next}while(n!==t);return Jo(n)}function ia(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ha(a,s)){var u=ya(a,s);return a=Jo(a,a.next),u=Jo(u,u.next),ta(a,e,r,n,i,o),void ta(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function oa(t,e){return t.x-e.x}function aa(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var u,c=r,l=r.x,h=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=l&&i!==n.x&&la(o<h?i:a,o,l,h,o<h?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),ma(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&sa(r,n)))&&(r=n,f=u)),n=n.next}while(n!==c);return r}(t,e)){var r=ya(e,t);Jo(r,r.next)}}function sa(t,e){return fa(t.prev,t,e.prev)<0&&fa(e.next,t,t.next)<0}function ua(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ca(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function la(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function ha(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&da(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(ma(t,e)&&ma(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(fa(t.prev,t,e.prev)||fa(t,e.prev,e))||pa(t,e)&&fa(t.prev,t,t.next)>0&&fa(e.prev,e,e.next)>0)}function fa(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function pa(t,e){return t.x===e.x&&t.y===e.y}function da(t,e,r,n){var i=ga(fa(t,e,r)),o=ga(fa(t,e,n)),a=ga(fa(r,n,t)),s=ga(fa(r,n,e));return i!==o&&a!==s||!(0!==i||!Aa(t,r,e))||!(0!==o||!Aa(t,n,e))||!(0!==a||!Aa(r,t,n))||!(0!==s||!Aa(r,e,n))}function Aa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ga(t){return t>0?1:t<0?-1:0}function ma(t,e){return fa(t.prev,t,t.next)<0?fa(t,e,t.next)>=0&&fa(t,t.prev,e)>=0:fa(t,e,t.prev)<0||fa(t,t.next,e)<0}function ya(t,e){var r=new ba(t.i,t.x,t.y),n=new ba(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function va(t,e,r,n){var i=new ba(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function _a(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ba(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function xa(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function wa(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),c=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*c*(a-c)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*c/a+l)),Math.min(i,Math.floor(r+(a-s)*c/a+l)),o)}var h=e[r],f=n,p=i;for(Ea(e,n,r),o(e[i],h)>0&&Ea(e,n,i);f<p;){for(Ea(e,f,p),f++,p--;o(e[f],h)<0;)f++;for(;o(e[p],h)>0;)p--}0===o(e[n],h)?Ea(e,n,p):Ea(e,++p,i),p<=r&&(n=p+1),r<=p&&(i=p-1)}}(t,e,r||0,n||t.length-1,i||Sa)}function Ea(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Sa(t,e){return t<e?-1:t>e?1:0}function Oa(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a<r;a++){var s=E(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===i&&(i=s<0),i===s<0?(n&&o.push(n),n=[t[a]]):n.push(t[a]))}if(n&&o.push(n),e>1)for(var u=0;u<o.length;u++)o[u].length<=e||(wa(o[u],e,1,o[u].length-1,Ta),o[u]=o[u].slice(0,e));return o}function Ta(t,e){return e.area-t.area}function Pa(t,e,r){for(var n=r.patternDependencies,i=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].paint.get(t+"-pattern");s.isConstant()||(i=!0);var u=s.constantOr(null);u&&(i=!0,n[u.to]=!0,n[u.from]=!0)}return i}function Ma(t,e,r,n,i){for(var o=i.patternDependencies,a=0,s=e;a<s.length;a+=1){var u=s[a],c=u.paint.get(t+"-pattern").value;if("constant"!==c.kind){var l=c.evaluate({zoom:n-1},r,{},i.availableImages),h=c.evaluate({zoom:n},r,{},i.availableImages),f=c.evaluate({zoom:n+1},r,{},i.availableImages);l=l&&l.name?l.name:l,h=h&&h.name?h.name:h,f=f&&f.name?f.name:f,o[l]=!0,o[h]=!0,o[f]=!0,r.patterns[u.id]={min:l,mid:h,max:f}}}return r}Ko.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(xa(t,0,o,r));if(i)for(var s=0,u=e.length;s<u;s++){var c=e[s]*r,l=s<u-1?e[s+1]*r:t.length;a-=Math.abs(xa(t,c,l,r))}var h=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,p=n[s+1]*r,d=n[s+2]*r;h+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},Ko.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r},Qo.default=Yo;var Ca=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new si,this.indexArray=new wi,this.indexArray2=new Ei,this.programConfigurations=new so(Xo,t.layers,t.zoom),this.segments=new Ui,this.segments2=new Ui,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Ca.prototype.populate=function(t,e){this.hasPattern=Pa("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),n=[],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a.feature,u=a.index,c=a.sourceLayerIndex;if(this.layers[0]._featureFilter(new Nn(this.zoom),s)){var l=fo(s),h=r?r.evaluate(s,{},e.availableImages):void 0,f={id:s.id,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:l,patterns:{},sortKey:h};n.push(f)}}r&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var p=0,d=n;p<d.length;p+=1){var A=d[p],g=A,m=g.geometry,y=g.index,v=g.sourceLayerIndex;if(this.hasPattern){var _=Ma("fill",this.layers,A,this.zoom,e);this.patternFeatures.push(_)}else this.addFeature(A,m,y,{});var b=t[y].feature;e.featureIndex.insert(b,m,y,v,this.index)}},Ca.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Ca.prototype.addFeatures=function(t,e){for(var r=0,n=this.patternFeatures;r<n.length;r+=1){var i=n[r];this.addFeature(i,i.geometry,i.index,e)}},Ca.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ca.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ca.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xo),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},Ca.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},Ca.prototype.addFeature=function(t,e,r,n){for(var i=0,o=Oa(e,500);i<o.length;i+=1){for(var a=o[i],s=0,u=0,c=a;u<c.length;u+=1)s+=c[u].length;for(var l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),h=l.vertexLength,f=[],p=[],d=0,A=a;d<A.length;d+=1){var g=A[d];if(0!==g.length){g!==a[0]&&p.push(f.length/2);var m=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),y=m.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(y+g.length-1,y),f.push(g[0].x),f.push(g[0].y);for(var v=1;v<g.length;v++)this.layoutVertexArray.emplaceBack(g[v].x,g[v].y),this.indexArray2.emplaceBack(y+v-1,y+v),f.push(g[v].x),f.push(g[v].y);m.vertexLength+=g.length,m.primitiveLength+=g.length}}for(var _=Qo(f,p),b=0;b<_.length;b+=3)this.indexArray.emplaceBack(h+_[b],h+_[b+1],h+_[b+2]);l.vertexLength+=s,l.primitiveLength+=_.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n)},dn("FillBucket",Ca,{omit:["layers","patternFeatures"]});var Ia=new ti({"fill-sort-key":new Yn(Tt.layout_fill["fill-sort-key"])}),ka={paint:new ti({"fill-antialias":new Qn(Tt.paint_fill["fill-antialias"]),"fill-opacity":new Yn(Tt.paint_fill["fill-opacity"]),"fill-color":new Yn(Tt.paint_fill["fill-color"]),"fill-outline-color":new Yn(Tt.paint_fill["fill-outline-color"]),"fill-translate":new Qn(Tt.paint_fill["fill-translate"]),"fill-translate-anchor":new Qn(Tt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Kn(Tt.paint_fill["fill-pattern"])}),layout:Ia},Ra=function(t){function e(e){t.call(this,e,ka)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r);var n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new Ca(t)},e.prototype.queryRadius=function(){return Po(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){return yo(Mo(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),n)},e.prototype.isTileClipped=function(){return!0},e}(ei),La=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,ja=Da;function Da(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(Ba,this,e)}function Ba(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function Fa(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;i<o;a=i++)e=t[i],n+=((r=t[a]).x-e.x)*(e.y+r.y);return n}Da.types=["Unknown","Point","LineString","Polygon"],Da.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,u=[];t.pos<r;){if(o<=0){var c=t.readVarint();n=7&c,o=c>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&u.push(e),u},Da.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,c=-1/0;t.pos<e;){if(n<=0){var l=t.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>s&&(s=i),(o+=t.readSVarint())<u&&(u=o),o>c&&(c=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,u,s,c]},Da.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,u=this.loadGeometry(),c=Da.types[this.type];function l(t){for(var e=0;e<t.length;e++){var r=t[e],n=180-360*(r.y+s)/o;t[e]=[360*(r.x+a)/o-180,360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<u.length;n++)h[n]=u[n][0];l(u=h);break;case 2:for(n=0;n<u.length;n++)l(u[n]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],o=0;o<e;o++){var a=Fa(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}(u),n=0;n<u.length;n++)for(i=0;i<u[n].length;i++)l(u[n][i])}1===u.length?u=u[0]:c="Multi"+c;var f={type:"Feature",geometry:{type:c,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f};var za=Na;function Na(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ua,this,e),this.length=this._features.length}function Ua(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function Va(t,e,r){if(3===t){var n=new za(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Na.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ja(this._pbf,e,this.extent,this._keys,this._values)};var Ga={VectorTile:function(t,e){this.layers=t.readFields(Va,{},e)},VectorTileFeature:ja,VectorTileLayer:za},Wa=Ga.VectorTileFeature.types,Ha=Math.pow(2,13);function qa(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,2*Math.floor(n*Ha)+a,i*Ha*2,o*Ha*2,Math.round(s))}var Za=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ci,this.indexArray=new wi,this.programConfigurations=new so(La,t.layers,t.zoom),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Xa(t,e){return t.x===e.x&&(t.x<0||t.x>lo)||t.y===e.y&&(t.y<0||t.y>lo)}function Qa(t){return t.every((function(t){return t.x<0}))||t.every((function(t){return t.x>lo}))||t.every((function(t){return t.y<0}))||t.every((function(t){return t.y>lo}))}Za.prototype.populate=function(t,e){this.features=[],this.hasPattern=Pa("fill-extrusion",this.layers,e);for(var r=0,n=t;r<n.length;r+=1){var i=n[r],o=i.feature,a=i.index,s=i.sourceLayerIndex;if(this.layers[0]._featureFilter(new Nn(this.zoom),o)){var u=fo(o),c={sourceLayerIndex:s,index:a,geometry:u,properties:o.properties,type:o.type,patterns:{}};void 0!==o.id&&(c.id=o.id),this.hasPattern?this.features.push(Ma("fill-extrusion",this.layers,c,this.zoom,e)):this.addFeature(c,u,a,{}),e.featureIndex.insert(o,u,a,s,this.index,!0)}}},Za.prototype.addFeatures=function(t,e){for(var r=0,n=this.features;r<n.length;r+=1){var i=n[r],o=i.geometry;this.addFeature(i,o,i.index,e)}},Za.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Za.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Za.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Za.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,La),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Za.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Za.prototype.addFeature=function(t,e,r,n){for(var i=0,o=Oa(e,500);i<o.length;i+=1){for(var a=o[i],s=0,u=0,c=a;u<c.length;u+=1)s+=c[u].length;for(var l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=0,f=a;h<f.length;h+=1){var p=f[h];if(0!==p.length&&!Qa(p))for(var d=0,A=0;A<p.length;A++){var g=p[A];if(A>=1){var m=p[A-1];if(!Xa(g,m)){l.vertexLength+4>Ui.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var y=g.sub(m)._perp()._unit(),v=m.dist(g);d+v>32768&&(d=0),qa(this.layoutVertexArray,g.x,g.y,y.x,y.y,0,0,d),qa(this.layoutVertexArray,g.x,g.y,y.x,y.y,0,1,d),d+=v,qa(this.layoutVertexArray,m.x,m.y,y.x,y.y,0,0,d),qa(this.layoutVertexArray,m.x,m.y,y.x,y.y,0,1,d);var _=l.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),l.vertexLength+=4,l.primitiveLength+=2}}}}if(l.vertexLength+s>Ui.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray)),"Polygon"===Wa[t.type]){for(var b=[],x=[],w=l.vertexLength,E=0,S=a;E<S.length;E+=1){var O=S[E];if(0!==O.length){O!==a[0]&&x.push(b.length/2);for(var T=0;T<O.length;T++){var P=O[T];qa(this.layoutVertexArray,P.x,P.y,0,0,1,1,0),b.push(P.x),b.push(P.y)}}}for(var M=Qo(b,x),C=0;C<M.length;C+=3)this.indexArray.emplaceBack(w+M[C],w+M[C+2],w+M[C+1]);l.primitiveLength+=M.length/3,l.vertexLength+=s}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n)},dn("FillExtrusionBucket",Za,{omit:["layers","features"]});var Ya={paint:new ti({"fill-extrusion-opacity":new Qn(Tt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Yn(Tt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qn(Tt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qn(Tt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Kn(Tt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Yn(Tt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Yn(Tt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qn(Tt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Ka=function(t){function e(e){t.call(this,e,Ya)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new Za(t)},e.prototype.queryRadius=function(){return Po(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s,u){var c=Mo(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),l=this.paint.get("fill-extrusion-height").evaluate(e,r),h=this.paint.get("fill-extrusion-base").evaluate(e,r),f=function(t,e,r,n){for(var o=[],a=0,s=t;a<s.length;a+=1){var u=s[a],c=[u.x,u.y,0,1];Lo(c,c,e),o.push(new i(c[0]/c[3],c[1]/c[3]))}return o}(c,u),p=function(t,e,r,n){for(var o=[],a=[],s=n[8]*e,u=n[9]*e,c=n[10]*e,l=n[11]*e,h=n[8]*r,f=n[9]*r,p=n[10]*r,d=n[11]*r,A=0,g=t;A<g.length;A+=1){for(var m=[],y=[],v=0,_=g[A];v<_.length;v+=1){var b=_[v],x=b.x,w=b.y,E=n[0]*x+n[4]*w+n[12],S=n[1]*x+n[5]*w+n[13],O=n[2]*x+n[6]*w+n[14],T=n[3]*x+n[7]*w+n[15],P=O+c,M=T+l,C=E+h,I=S+f,k=O+p,R=T+d,L=new i((E+s)/M,(S+u)/M);L.z=P/M,m.push(L);var j=new i(C/R,I/R);j.z=k/R,y.push(j)}o.push(m),a.push(y)}return[o,a]}(n,h,l,u);return function(t,e,r){var n=1/0;yo(r,e)&&(n=Ja(r,e[0]));for(var i=0;i<e.length;i++)for(var o=e[i],a=t[i],s=0;s<o.length-1;s++){var u=o[s],c=o[s+1],l=a[s],h=[u,c,a[s+1],l,u];go(r,h)&&(n=Math.min(n,Ja(r,h)))}return n!==1/0&&n}(p[0],p[1],f)},e}(ei);function $a(t,e){return t.x*e.x+t.y*e.y}function Ja(t,e){if(1===t.length){var r=e[0],n=e[1],i=e[3],o=t[0],a=n.sub(r),s=i.sub(r),u=o.sub(r),c=$a(a,a),l=$a(a,s),h=$a(s,s),f=$a(u,a),p=$a(u,s),d=c*h-l*l,A=(h*f-l*p)/d,g=(c*p-l*f)/d,m=1-A-g;return r.z*m+n.z*A+i.z*g}for(var y=1/0,v=0,_=e;v<_.length;v+=1){var b=_[v];y=Math.min(y,b.z)}return y}var ts=oi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,es=Ga.VectorTileFeature.types,rs=Math.cos(Math.PI/180*37.5),ns=Math.pow(2,14)/.5,is=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new li,this.indexArray=new wi,this.programConfigurations=new so(ts,t.layers,t.zoom),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};is.prototype.populate=function(t,e){this.hasPattern=Pa("line",this.layers,e);for(var r=this.layers[0].layout.get("line-sort-key"),n=[],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a.feature,u=a.index,c=a.sourceLayerIndex;if(this.layers[0]._featureFilter(new Nn(this.zoom),s)){var l=fo(s),h=r?r.evaluate(s,{}):void 0,f={id:s.id,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:l,patterns:{},sortKey:h};n.push(f)}}r&&n.sort((function(t,e){return t.sortKey-e.sortKey}));for(var p=0,d=n;p<d.length;p+=1){var A=d[p],g=A,m=g.geometry,y=g.index,v=g.sourceLayerIndex;if(this.hasPattern){var _=Ma("line",this.layers,A,this.zoom,e);this.patternFeatures.push(_)}else this.addFeature(A,m,y,{});var b=t[y].feature;e.featureIndex.insert(b,m,y,v,this.index)}},is.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},is.prototype.addFeatures=function(t,e){for(var r=0,n=this.patternFeatures;r<n.length;r+=1){var i=n[r];this.addFeature(i,i.geometry,i.index,e)}},is.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},is.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},is.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ts),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},is.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},is.prototype.addFeature=function(t,e,r,n){for(var i=this.layers[0].layout,o=i.get("line-join").evaluate(t,{}),a=i.get("line-cap"),s=i.get("line-miter-limit"),u=i.get("line-round-limit"),c=0,l=e;c<l.length;c+=1){var h=l[c];this.addLine(h,t,o,a,s,u,r,n)}},is.prototype.addLine=function(t,e,r,n,i,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end")){this.clipStart=+e.properties.mapbox_clip_start,this.clipEnd=+e.properties.mapbox_clip_end;for(var u=0;u<t.length-1;u++)this.totalDistance+=t[u].dist(t[u+1])}for(var c="Polygon"===es[e.type],l=t.length;l>=2&&t[l-1].equals(t[l-2]);)l--;for(var h=0;h<l-1&&t[h].equals(t[h+1]);)h++;if(!(l<(c?3:2))){"bevel"===r&&(i=1.05);var f,p=this.overscaling<=16?15*lo/(512*this.overscaling):0,d=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),A=void 0,g=void 0,m=void 0,y=void 0;this.e1=this.e2=-1,c&&(f=t[l-2],y=t[h].sub(f)._unit()._perp());for(var v=h;v<l;v++)if(!(g=c&&v===l-1?t[h+1]:t[v+1])||!t[v].equals(g)){y&&(m=y),f&&(A=f),f=t[v],y=g?g.sub(f)._unit()._perp():m;var _=(m=m||y).add(y);0===_.x&&0===_.y||_._unit();var b=m.x*y.x+m.y*y.y,x=_.x*y.x+_.y*y.y,w=0!==x?1/x:1/0,E=2*Math.sqrt(2-2*x),S=x<rs&&A&&g,O=m.x*y.y-m.y*y.x>0;if(S&&v>h){var T=f.dist(A);if(T>2*p){var P=f.sub(f.sub(A)._mult(p/T)._round());this.updateDistance(A,P),this.addCurrentVertex(P,m,0,0,d),A=P}}var M=A&&g,C=M?r:c?"butt":n;if(M&&"round"===C&&(w<o?C="miter":w<=2&&(C="fakeround")),"miter"===C&&w>i&&(C="bevel"),"bevel"===C&&(w>2&&(C="flipbevel"),w<i&&(C="miter")),A&&this.updateDistance(A,f),"miter"===C)_._mult(w),this.addCurrentVertex(f,_,0,0,d);else if("flipbevel"===C){if(w>100)_=y.mult(-1);else{var I=w*m.add(y).mag()/m.sub(y).mag();_._perp()._mult(I*(O?-1:1))}this.addCurrentVertex(f,_,0,0,d),this.addCurrentVertex(f,_.mult(-1),0,0,d)}else if("bevel"===C||"fakeround"===C){var k=-Math.sqrt(w*w-1),R=O?k:0,L=O?0:k;if(A&&this.addCurrentVertex(f,m,R,L,d),"fakeround"===C)for(var j=Math.round(180*E/Math.PI/20),D=1;D<j;D++){var B=D/j;if(.5!==B){var F=B-.5;B+=B*F*(B-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*F*F+(.848013+b*(.215638*b-1.06021)))}var z=y.sub(m)._mult(B)._add(m)._unit()._mult(O?-1:1);this.addHalfVertex(f,z.x,z.y,!1,O,0,d)}g&&this.addCurrentVertex(f,y,-R,-L,d)}else if("butt"===C)this.addCurrentVertex(f,_,0,0,d);else if("square"===C){var N=A?1:-1;this.addCurrentVertex(f,_,N,N,d)}else"round"===C&&(A&&(this.addCurrentVertex(f,m,0,0,d),this.addCurrentVertex(f,m,1,1,d,!0)),g&&(this.addCurrentVertex(f,y,-1,-1,d,!0),this.addCurrentVertex(f,y,0,0,d)));if(S&&v<l-1){var U=f.dist(g);if(U>2*p){var V=f.add(g.sub(f)._mult(p/U)._round());this.updateDistance(f,V),this.addCurrentVertex(V,y,0,0,d),f=V}}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,s)}},is.prototype.addCurrentVertex=function(t,e,r,n,i,o){void 0===o&&(o=!1);var a=e.x+e.y*r,s=e.y-e.x*r,u=-e.x+e.y*n,c=-e.y-e.x*n;this.addHalfVertex(t,a,s,o,!1,r,i),this.addHalfVertex(t,u,c,o,!0,-n,i),this.distance>ns/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,o))},is.prototype.addHalfVertex=function(t,e,r,n,i,o,a){var s=t.x,u=t.y,c=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((s<<1)+(n?1:0),(u<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&c)<<2,c>>6);var l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),i?this.e2=l:this.e1=l},is.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(ns-1):this.distance},dn("LineBucket",is,{omit:["layers","patternFeatures"]});var os=new ti({"line-cap":new Qn(Tt.layout_line["line-cap"]),"line-join":new Yn(Tt.layout_line["line-join"]),"line-miter-limit":new Qn(Tt.layout_line["line-miter-limit"]),"line-round-limit":new Qn(Tt.layout_line["line-round-limit"]),"line-sort-key":new Yn(Tt.layout_line["line-sort-key"])}),as={paint:new ti({"line-opacity":new Yn(Tt.paint_line["line-opacity"]),"line-color":new Yn(Tt.paint_line["line-color"]),"line-translate":new Qn(Tt.paint_line["line-translate"]),"line-translate-anchor":new Qn(Tt.paint_line["line-translate-anchor"]),"line-width":new Yn(Tt.paint_line["line-width"]),"line-gap-width":new Yn(Tt.paint_line["line-gap-width"]),"line-offset":new Yn(Tt.paint_line["line-offset"]),"line-blur":new Yn(Tt.paint_line["line-blur"]),"line-dasharray":new $n(Tt.paint_line["line-dasharray"]),"line-pattern":new Kn(Tt.paint_line["line-pattern"]),"line-gradient":new Jn(Tt.paint_line["line-gradient"])}),layout:os},ss=new(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.possiblyEvaluate=function(e,r){return r=new Nn(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(Yn))(as.paint.properties["line-width"].specification);ss.useIntegerZoom=!0;var us=function(t){function e(e){t.call(this,e,as)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Wo(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=ss.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new is(t)},e.prototype.queryRadius=function(t){var e=t,r=cs(To("line-width",this,e),To("line-gap-width",this,e)),n=To("line-offset",this,e);return r/2+Math.abs(n)+Po(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s){var u=Mo(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),c=s/2*cs(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(n=function(t,e){for(var r=[],n=new i(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],u=0;u<a.length;u++){var c=a[u-1],l=a[u],h=a[u+1],f=0===u?n:l.sub(c)._unit()._perp(),p=u===a.length-1?n:h.sub(l)._unit()._perp(),d=f._add(p)._unit(),A=d.x*p.x+d.y*p.y;d._mult(1/A),s.push(d._mult(e)._add(l))}r.push(s)}return r}(n,l*s)),function(t,e,r){for(var n=0;n<e.length;n++){var i=e[n];if(t.length>=3)for(var o=0;o<i.length;o++)if(So(t,i[o]))return!0;if(vo(t,i,r))return!0}return!1}(u,n,c)},e.prototype.isTileClipped=function(){return!0},e}(ei);function cs(t,e){return e>0?e+2*t:t}var ls=oi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hs=oi([{name:"a_projected_pos",components:3,type:"Float32"}],4),fs=(oi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),oi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),ps=(oi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),ds=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function As(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),zn.applyArabicShaping&&(t=zn.applyArabicShaping(t)),t}(t.text,e,r)})),t}oi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),oi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"}]),oi([{type:"Float32",name:"offsetX"}]),oi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var gs={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"},ms=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},ys=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,A=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*A},vs=_s;function _s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}_s.Varint=0,_s.Fixed64=1,_s.Bytes=2,_s.Fixed32=5;var bs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function xs(t){return t.type===_s.Bytes?t.readVarint()+t.pos:t.pos+1}function ws(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Es(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Ss(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Os(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Ts(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Ps(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Ms(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Cs(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Is(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ks(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Rs(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Ls(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function js(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Ds(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Bs(t,e,r){1===t&&r.readMessage(Fs,e)}function Fs(t,e,r){if(3===t){var n=r.readMessage(zs,{}),i=n.id,o=n.bitmap,a=n.width,s=n.height,u=n.left,c=n.top,l=n.advance;e.push({id:i,bitmap:new Uo({width:a+6,height:s+6},o),metrics:{width:a,height:s,left:u,top:c,advance:l}})}}function zs(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function Ns(t){for(var e=0,r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];e+=o.w*o.h,r=Math.max(r,o.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],s=0,u=0,c=0,l=t;c<l.length;c+=1)for(var h=l[c],f=a.length-1;f>=0;f--){var p=a[f];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,u=Math.max(u,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===p.w&&h.h===p.h){var d=a.pop();f<a.length&&(a[f]=d)}else h.h===p.h?(p.x+=h.w,p.w-=h.w):h.w===p.w?(p.y+=h.h,p.h-=h.h):(a.push({x:p.x+h.w,y:p.y,w:p.w-h.w,h:h.h}),p.y+=h.h,p.h-=h.h);break}}return{w:s,h:u,fill:e/(s*u)||0}}_s.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ls(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ds(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ls(this.buf,this.pos)+4294967296*Ls(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ls(this.buf,this.pos)+4294967296*Ds(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ms(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ms(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return ws(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return ws(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return ws(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return ws(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return ws(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return ws(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bs?function(t,e,r){return bs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var o,a,s,u=t[i],c=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l>r)break;1===l?u<128&&(c=u):2===l?128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)<=127&&(c=null):3===l?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((c=(15&u)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===l&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,l=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),i+=l}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==_s.Bytes)return t.push(this.readVarint(e));var r=xs(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==_s.Bytes)return t.push(this.readSVarint());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==_s.Bytes)return t.push(this.readBoolean());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==_s.Bytes)return t.push(this.readFloat());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==_s.Bytes)return t.push(this.readDouble());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==_s.Bytes)return t.push(this.readFixed32());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==_s.Bytes)return t.push(this.readSFixed32());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==_s.Bytes)return t.push(this.readFixed64());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==_s.Bytes)return t.push(this.readSFixed64());var e=xs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===_s.Varint)for(;this.buf[this.pos++]>127;);else if(e===_s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===_s.Fixed32)this.pos+=4;else{if(e!==_s.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),js(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),js(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),js(this.buf,-1&t,this.pos),js(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),js(this.buf,-1&t,this.pos),js(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Es(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ys(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ys(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&Es(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,_s.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ss,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Os,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ms,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ts,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Ps,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Cs,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Is,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ks,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Rs,e)},writeBytesField:function(t,e){this.writeTag(t,_s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,_s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,_s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,_s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,_s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,_s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,_s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,_s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,_s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,_s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Us=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n},Vs={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};Vs.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Vs.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Vs.tlbr.get=function(){return this.tl.concat(this.br)},Vs.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Us.prototype,Vs);var Gs=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var o=Ns(i),a=o.w,s=o.h,u=new Vo({width:a||1,height:s||1});for(var c in t){var l=t[c],h=r[c].paddedRect;Vo.copy(l.data,u,{x:0,y:0},{x:h.x+1,y:h.y+1},l.data)}for(var f in e){var p=e[f],d=n[f].paddedRect,A=d.x+1,g=d.y+1,m=p.data.width,y=p.data.height;Vo.copy(p.data,u,{x:0,y:0},{x:A,y:g},p.data),Vo.copy(p.data,u,{x:0,y:y-1},{x:A,y:g-1},{width:m,height:1}),Vo.copy(p.data,u,{x:0,y:0},{x:A,y:g+y},{width:m,height:1}),Vo.copy(p.data,u,{x:m-1,y:0},{x:A-1,y:g},{width:1,height:y}),Vo.copy(p.data,u,{x:0,y:0},{x:A+m,y:g},{width:1,height:y})}this.image=u,this.iconPositions=r,this.patternPositions=n};Gs.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],o={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(o),e[n]=new Us(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},Gs.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},Gs.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl,i=n[0],o=n[1];r.update(e.data,void 0,{x:i,y:o})}},dn("ImagePosition",Us),dn("ImageAtlas",Gs);var Ws={horizontal:1,vertical:2,horizontalOnly:3},Hs=function(){this.scale=1,this.fontStack="",this.imageName=null};Hs.forText=function(t,e){var r=new Hs;return r.scale=t||1,r.fontStack=e,r},Hs.forImage=function(t){var e=new Hs;return e.imageName=t,e};var qs=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Zs(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A){var g,m=qs.fromFeature(t,i);h===Ws.vertical&&m.verticalizePunctuation();var y=zn.processBidirectionalText,v=zn.processStyledBidirectionalText;if(y&&1===m.sections.length){g=[];for(var _=0,b=y(m.toString(),tu(m,c,o,e,n,p,d));_<b.length;_+=1){var x=b[_],w=new qs;w.text=x,w.sections=m.sections;for(var E=0;E<x.length;E++)w.sectionIndex.push(0);g.push(w)}}else if(v){g=[];for(var S=0,O=v(m.text,m.sectionIndex,tu(m,c,o,e,n,p,d));S<O.length;S+=1){var T=O[S],P=new qs;P.text=T[0],P.sectionIndex=T[1],P.sections=m.sections,g.push(P)}}else g=function(t,e){for(var r=[],n=t.text,i=0,o=0,a=e;o<a.length;o+=1){var s=a[o];r.push(t.substring(i,s)),i=s}return i<n.length&&r.push(t.substring(i,n.length)),r}(m,tu(m,c,o,e,n,p,d));var M=[],C={positionedLines:M,text:m.toString(),top:l[1],bottom:l[1],left:l[0],right:l[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,o,a,s,u,c,l,h){for(var f=0,p=-17,d=0,A=0,g="right"===s?1:"left"===s?0:.5,m=0,y=0,v=i;y<v.length;y+=1){var _=v[y];_.trim();var b=_.getMaxScale(),x=24*(b-1),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[m]=w;var E=w.positionedGlyphs,S=0;if(_.length()){for(var O=0;O<_.length();O++){var T=_.getSection(O),P=_.getSectionIndex(O),M=_.getCharCode(O),C=0,I=null,k=null,R=null,L=24,j=!(u===Ws.horizontal||!l&&!wn(M)||l&&(Xs[M]||(H=M,_n.Arabic(H)||_n["Arabic Supplement"](H)||_n["Arabic Extended-A"](H)||_n["Arabic Presentation Forms-A"](H)||_n["Arabic Presentation Forms-B"](H))));if(T.imageName){var D=n[T.imageName];if(!D)continue;R=T.imageName,t.iconsInText=t.iconsInText||!0,k=D.paddedRect;var B=D.displaySize;T.scale=24*T.scale/h,I={width:B[0],height:B[1],left:1,top:-3,advance:j?B[1]:B[0]},C=x+(24-B[1]*T.scale),L=I.advance;var F=j?B[0]*T.scale-24*b:B[1]*T.scale-24*b;F>0&&F>S&&(S=F)}else{var z=r[T.fontStack],N=z&&z[M];if(N&&N.rect)k=N.rect,I=N.metrics;else{var U=e[T.fontStack],V=U&&U[M];if(!V)continue;I=V.metrics}C=24*(b-T.scale)}j?(t.verticalizable=!0,E.push({glyph:M,imageName:R,x:f,y:p+C,vertical:j,scale:T.scale,fontStack:T.fontStack,sectionIndex:P,metrics:I,rect:k}),f+=L*T.scale+c):(E.push({glyph:M,imageName:R,x:f,y:p+C,vertical:j,scale:T.scale,fontStack:T.fontStack,sectionIndex:P,metrics:I,rect:k}),f+=I.advance*T.scale+c)}if(0!==E.length){var G=f-c;d=Math.max(G,d),ru(E,0,E.length-1,g,S)}f=0;var W=o*b+S;w.lineOffset=Math.max(S,x),p+=W,A=Math.max(W,A),++m}else p+=o,++m}var H,q=p- -17,Z=eu(a),X=Z.horizontalAlign,Q=Z.verticalAlign;(function(t,e,r,n,i,o,a,s,u){var c,l=(e-r)*i;c=o!==a?-s*n- -17:(-n*u+.5)*a;for(var h=0,f=t;h<f.length;h+=1)for(var p=0,d=f[h].positionedGlyphs;p<d.length;p+=1){var A=d[p];A.x+=l,A.y+=c}})(t.positionedLines,g,X,Q,d,A,o,q,i.length),t.top+=-Q*q,t.bottom=t.top+q,t.left+=-X*d,t.right=t.left+d}(C,e,r,n,g,a,s,u,h,c,f,A),!function(t){for(var e=0,r=t;e<r.length;e+=1)if(0!==r[e].positionedGlyphs.length)return!1;return!0}(M)&&C}qs.fromFeature=function(t,e){for(var r=new qs,n=0;n<t.sections.length;n++){var i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r},qs.prototype.length=function(){return this.text.length},qs.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},qs.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},qs.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},qs.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",r=0;r<t.length;r++){var n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;n&&En(n)&&!gs[t[r+1]]||i&&En(i)&&!gs[t[r-1]]||!gs[t[r]]?e+=t[r]:e+=gs[t[r]]}return e}(this.text)},qs.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Xs[this.text.charCodeAt(e)];e++)t++;for(var r=this.text.length,n=this.text.length-1;n>=0&&n>=t&&Xs[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},qs.prototype.substring=function(t,e){var r=new qs;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},qs.prototype.toString=function(){return this.text},qs.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},qs.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Hs.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n<t.text.length;++n)this.sectionIndex.push(r)},qs.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(Hs.forImage(e)),this.sectionIndex.push(this.sections.length-1)):x("Reached maximum number of images 6401")}else x("Can't add FormattedSection with an empty image.")},qs.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Xs={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Qs={};function Ys(t,e,r,n,i,o){if(e.imageName){var a=n[e.imageName];return a?a.displaySize[0]*e.scale*24/o+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Ks(t,e,r,n){var i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function $s(t,e,r){var n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Js(t,e,r,n,i,o){for(var a=null,s=Ks(e,r,i,o),u=0,c=n;u<c.length;u+=1){var l=c[u],h=Ks(e-l.x,r,i,o)+l.badness;h<=s&&(a=l,s=h)}return{index:t,x:e,priorBreak:a,badness:s}}function tu(t,e,r,n,i,o,a){if("point"!==o)return[];if(!t)return[];for(var s,u=[],c=function(t,e,r,n,i,o){for(var a=0,s=0;s<t.length();s++){var u=t.getSection(s);a+=Ys(t.getCharCode(s),u,n,i,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),l=t.text.indexOf("​")>=0,h=0,f=0;f<t.length();f++){var p=t.getSection(f),d=t.getCharCode(f);if(Xs[d]||(h+=Ys(d,p,n,i,e,a)),f<t.length()-1){var A=!((s=d)<11904||!(_n["Bopomofo Extended"](s)||_n.Bopomofo(s)||_n["CJK Compatibility Forms"](s)||_n["CJK Compatibility Ideographs"](s)||_n["CJK Compatibility"](s)||_n["CJK Radicals Supplement"](s)||_n["CJK Strokes"](s)||_n["CJK Symbols and Punctuation"](s)||_n["CJK Unified Ideographs Extension A"](s)||_n["CJK Unified Ideographs"](s)||_n["Enclosed CJK Letters and Months"](s)||_n["Halfwidth and Fullwidth Forms"](s)||_n.Hiragana(s)||_n["Ideographic Description Characters"](s)||_n["Kangxi Radicals"](s)||_n["Katakana Phonetic Extensions"](s)||_n.Katakana(s)||_n["Vertical Forms"](s)||_n["Yi Radicals"](s)||_n["Yi Syllables"](s)));(Qs[d]||A||p.imageName)&&u.push(Js(f+1,h,c,u,$s(d,t.getCharCode(f+1),A&&l),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Js(t.length(),h,c,u,0,!0))}function eu(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function ru(t,e,r,n,i){if(n||i)for(var o=t[r],a=o.metrics.advance*o.scale,s=(t[r].x+a)*n,u=e;u<=r;u++)t[u].x-=s,t[u].y+=i}function nu(t,e,r,n,i,o){var a,s=t.image;if(s.content){var u=s.content,c=s.pixelRatio||1;a=[u[0]/c,u[1]/c,s.displaySize[0]-u[2]/c,s.displaySize[1]-u[3]/c]}var l,h,f,p,d=e.left*o,A=e.right*o;"width"===r||"both"===r?(p=i[0]+d-n[3],h=i[0]+A+n[1]):h=(p=i[0]+(d+A-s.displaySize[0])/2)+s.displaySize[0];var g=e.top*o,m=e.bottom*o;return"height"===r||"both"===r?(l=i[1]+g-n[0],f=i[1]+m+n[2]):f=(l=i[1]+(g+m-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:l,right:h,bottom:f,left:p,collisionPadding:a}}Qs[10]=!0,Qs[32]=!0,Qs[38]=!0,Qs[40]=!0,Qs[41]=!0,Qs[43]=!0,Qs[45]=!0,Qs[47]=!0,Qs[173]=!0,Qs[183]=!0,Qs[8203]=!0,Qs[8208]=!0,Qs[8211]=!0,Qs[8231]=!0;var iu=function(t){function e(e,r,n,i){t.call(this,e,r),this.angle=n,void 0!==i&&(this.segment=i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(i);dn("Anchor",iu);var ou=128;function au(t,e){var r=e.expression;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Nn(t+1))};if("source"===r.kind)return{kind:"source"};for(var n=r.zoomStops,i=r.interpolationType,o=0;o<n.length&&n[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);var s=n[o],u=n[a];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:u,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:u,minSize:r.evaluate(new Nn(s)),maxSize:r.evaluate(new Nn(u)),interpolationType:i}}function su(t,e,r){var n=e.uSize,i=e.uSizeT,o=r.lowerSize,a=r.upperSize;return"source"===t.kind?o/ou:"composite"===t.kind?we(o/ou,a/ou,i):n}function uu(t,e){var r=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){var i=t.interpolationType,o=t.minZoom,a=t.maxZoom,s=i?c(ze.interpolationFactor(i,e,o,a),0,1):0;"camera"===t.kind?n=we(t.minSize,t.maxSize,s):r=s}return{uSizeT:r,uSize:n}}var cu=Object.freeze({__proto__:null,getSizeData:au,evaluateSizeForFeature:su,evaluateSizeForZoom:uu,SIZE_PACK_FACTOR:ou});function lu(t,e,r,n,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var u=[],c=0;s<r/2;){var l=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var p=l.angleTo(h)-h.angleTo(f);for(p=Math.abs((p+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:s,angleDelta:p}),c+=p;s-u[0].distance>n;)c-=u.shift().angleDelta;if(c>i)return!1;a++,s+=h.dist(f)}return!0}function hu(t){for(var e=0,r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function fu(t,e,r){return t?.6*e*r:0}function pu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function du(t,e,r,n,i,o){for(var a=fu(r,i,o),s=pu(r,n)*o,u=0,c=hu(t)/2,l=0;l<t.length-1;l++){var h=t[l],f=t[l+1],p=h.dist(f);if(u+p>c){var d=(c-u)/p,A=we(h.x,f.x,d),g=we(h.y,f.y,d),m=new iu(A,g,f.angleTo(h),l);return m._round(),!a||lu(t,m,s,a,e)?m:void 0}u+=p}}function Au(t,e,r,n,i,o,a,s,u){var c=fu(n,o,a),l=pu(n,i),h=l*a,f=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-h<e/4&&(e=h+e/4),function t(e,r,n,i,o,a,s,u,c){for(var l=a/2,h=hu(e),f=0,p=r-n,d=[],A=0;A<e.length-1;A++){for(var g=e[A],m=e[A+1],y=g.dist(m),v=m.angleTo(g);p+n<f+y;){var _=((p+=n)-f)/y,b=we(g.x,m.x,_),x=we(g.y,m.y,_);if(b>=0&&b<c&&x>=0&&x<c&&p-l>=0&&p+l<=h){var w=new iu(b,x,v,A);w._round(),i&&!lu(e,w,a,i,o)||d.push(w)}}f+=y}return u||d.length||s||(d=t(e,f/2,n,i,o,a,s,!0,c)),d}(t,f?e/2*s%e:(l/2+2*o)*a*s%e,e,c,r,h,f,!1,u)}function gu(t,e,r,n){var o=[],a=t.image,s=a.pixelRatio,u=a.paddedRect.w-2,c=a.paddedRect.h-2,l=t.right-t.left,h=t.bottom-t.top,f=a.stretchX||[[0,u]],p=a.stretchY||[[0,c]],d=function(t,e){return t+e[1]-e[0]},A=f.reduce(d,0),g=p.reduce(d,0),m=u-A,y=c-g,v=0,_=A,b=0,x=g,w=0,E=m,S=0,O=y;if(a.content&&n){var T=a.content;v=mu(f,0,T[0]),b=mu(p,0,T[1]),_=mu(f,T[0],T[2]),x=mu(p,T[1],T[3]),w=T[0]-v,S=T[1]-b,E=T[2]-T[0]-_,O=T[3]-T[1]-x}var P=function(n,o,u,c){var f=vu(n.stretch-v,_,l,t.left),p=_u(n.fixed-w,E,n.stretch,A),d=vu(o.stretch-b,x,h,t.top),m=_u(o.fixed-S,O,o.stretch,g),y=vu(u.stretch-v,_,l,t.left),T=_u(u.fixed-w,E,u.stretch,A),P=vu(c.stretch-b,x,h,t.top),M=_u(c.fixed-S,O,c.stretch,g),C=new i(f,d),I=new i(y,d),k=new i(y,P),R=new i(f,P),L=new i(p/s,m/s),j=new i(T/s,M/s),D=e*Math.PI/180;if(D){var B=Math.sin(D),F=Math.cos(D),z=[F,-B,B,F];C._matMult(z),I._matMult(z),R._matMult(z),k._matMult(z)}var N=n.stretch+n.fixed,U=u.stretch+u.fixed,V=o.stretch+o.fixed,G=c.stretch+c.fixed;return{tl:C,tr:I,bl:R,br:k,tex:{x:a.paddedRect.x+1+N,y:a.paddedRect.y+1+V,w:U-N,h:G-V},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:j,minFontScaleX:E/s/l,minFontScaleY:O/s/h,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var M=yu(f,m,A),C=yu(p,y,g),I=0;I<M.length-1;I++)for(var k=M[I],R=M[I+1],L=0;L<C.length-1;L++){var j=C[L],D=C[L+1];o.push(P(k,j,R,D))}else o.push(P({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:c+1}));return o}function mu(t,e,r){for(var n=0,i=0,o=t;i<o.length;i+=1){var a=o[i];n+=Math.max(e,Math.min(r,a[1]))-Math.max(e,Math.min(r,a[0]))}return n}function yu(t,e,r){for(var n=[{fixed:-1,stretch:0}],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a[0],u=a[1],c=n[n.length-1];n.push({fixed:s-c.stretch,stretch:c.stretch}),n.push({fixed:s-c.stretch,stretch:c.stretch+(u-s)})}return n.push({fixed:e+1,stretch:r}),n}function vu(t,e,r,n){return t/e*r+n}function _u(t,e,r,n){return t-e*r/n}var bu=function(t,e,r,n,o,a,s,u,c,l,h,f){var p=s.top*u-c,d=s.bottom*u+c,A=s.left*u-c,g=s.right*u+c,m=s.collisionPadding;if(m&&(A-=m[0]*u,p-=m[1]*u,g+=m[2]*u,d+=m[3]*u),this.boxStartIndex=t.length,l){var y=d-p,v=g-A;y>0&&(y=Math.max(10*u,y),this._addLineCollisionCircles(t,e,r,r.segment,v,y,n,o,a,h))}else{if(f){var _=new i(A,p),b=new i(g,p),x=new i(A,d),w=new i(g,d),E=f*Math.PI/180;_._rotate(E),b._rotate(E),x._rotate(E),w._rotate(E),A=Math.min(_.x,b.x,x.x,w.x),g=Math.max(_.x,b.x,x.x,w.x),p=Math.min(_.y,b.y,x.y,w.y),d=Math.max(_.y,b.y,x.y,w.y)}t.emplaceBack(r.x,r.y,A,p,g,d,n,o,a,0,0)}this.boxEndIndex=t.length};bu.prototype._addLineCollisionCircles=function(t,e,r,n,i,o,a,s,u,c){var l=o/2,h=Math.floor(i/l)||1,f=1+.4*Math.log(c)/Math.LN2,p=Math.floor(h*f/2),d=-o/2,A=r,g=n+1,m=d,y=-i/2,v=y-i/4;do{if(--g<0){if(m>y)return;g=0;break}m-=e[g].dist(A),A=e[g]}while(m>v);for(var _=e[g].dist(e[g+1]),b=-p;b<h+p;b++){var x=b*l,w=y+x;if(x<0&&(w+=x),x>i&&(w+=x-i),!(w<m)){for(;m+_<w;){if(m+=_,++g+1>=e.length)return;_=e[g].dist(e[g+1])}var E=w-m,S=e[g],O=e[g+1].sub(S)._unit()._mult(E)._add(S)._round(),T=Math.abs(w-d)<l?0:.8*(w-d);t.emplaceBack(O.x,O.y,-o/2,-o/2,o/2,o/2,a,s,u,o/2,T)}}};var xu=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=wu),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function wu(t,e){return t<e?-1:t>e?1:0}function Eu(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,u=t[0],c=0;c<u.length;c++){var l=u[c];(!c||l.x<n)&&(n=l.x),(!c||l.y<o)&&(o=l.y),(!c||l.x>a)&&(a=l.x),(!c||l.y>s)&&(s=l.y)}var h=a-n,f=s-o,p=Math.min(h,f),d=p/2,A=new xu([],Su);if(0===p)return new i(n,o);for(var g=n;g<a;g+=p)for(var m=o;m<s;m+=p)A.push(new Ou(g+d,m+d,d,t));for(var y=function(t){for(var e=0,r=0,n=0,i=t[0],o=0,a=i.length,s=a-1;o<a;s=o++){var u=i[o],c=i[s],l=u.x*c.y-c.x*u.y;r+=(u.x+c.x)*l,n+=(u.y+c.y)*l,e+=3*l}return new Ou(r/e,n/e,0,t)}(t),v=A.length;A.length;){var _=A.pop();(_.d>y.d||!y.d)&&(y=_,r&&console.log("found best %d after %d probes",Math.round(1e4*_.d)/1e4,v)),_.max-y.d<=e||(d=_.h/2,A.push(new Ou(_.p.x-d,_.p.y-d,d,t)),A.push(new Ou(_.p.x+d,_.p.y-d,d,t)),A.push(new Ou(_.p.x-d,_.p.y+d,d,t)),A.push(new Ou(_.p.x+d,_.p.y+d,d,t)),v+=4)}return r&&(console.log("num probes: "+v),console.log("best distance: "+y.d)),y.p}function Su(t,e){return e.max-t.max}function Ou(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;i<e.length;i++)for(var o=e[i],a=0,s=o.length,u=s-1;a<s;u=a++){var c=o[a],l=o[u];c.y>t.y!=l.y>t.y&&t.x<(l.x-c.x)*(t.y-c.y)/(l.y-c.y)+c.x&&(r=!r),n=Math.min(n,wo(t,c,l))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}xu.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},xu.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},xu.prototype.peek=function(){return this.data[0]},xu.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},xu.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&r(e[s],a)<0&&(o=s,a=e[s]),r(a,i)>=0)break;e[t]=a,t=o}e[t]=i};var Tu=e((function(t){t.exports=function(t,e){var r,n,i,o,a,s,u,c;for(r=3&t.length,n=t.length-r,i=e,a=3432918353,s=461845907,c=0;c<n;)u=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,i=27492+(65535&(o=5*(65535&(i=(i^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(c+2))<<16;case 2:u^=(255&t.charCodeAt(c+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(c)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),Pu=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),Mu=Tu,Cu=Tu,Iu=Pu;Mu.murmur3=Cu,Mu.murmur2=Iu;var ku=Number.POSITIVE_INFINITY;function Ru(t,e){return e[1]!==ku?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function Lu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var ju=32640;function Du(t,e,r,n,o,a,s,u,c,l,h,f,p,d){var A=function(t,e,r,n,o,a,s,u){for(var c=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,l=[],h=0,f=e.positionedLines;h<f.length;h+=1)for(var p=f[h],d=0,A=p.positionedGlyphs;d<A.length;d+=1){var g=A[d];if(g.rect){var m=g.rect||{},y=4,v=!0,_=1,b=0,x=(o||u)&&g.vertical,w=g.metrics.advance*g.scale/2;if(u&&e.verticalizable){var E=24*(g.scale-1),S=(24-g.metrics.width*g.scale)/2;b=p.lineOffset/2-(g.imageName?-S:E)}if(g.imageName){var O=s[g.imageName];v=O.sdf,y=1/(_=O.pixelRatio)}var T=o?[g.x+w,g.y]:[0,0],P=o?[0,0]:[g.x+w+r[0],g.y+r[1]-b],M=[0,0];x&&(M=P,P=[0,0]);var C=(g.metrics.left-y)*g.scale-w+P[0],I=(-g.metrics.top-y)*g.scale+P[1],k=C+m.w*g.scale/_,R=I+m.h*g.scale/_,L=new i(C,I),j=new i(k,I),D=new i(C,R),B=new i(k,R);if(x){var F=new i(-w,w- -17),z=-Math.PI/2,N=12-w,U=g.imageName?N:0,V=new i(22-N,-U),G=new(Function.prototype.bind.apply(i,[null].concat(M)));L._rotateAround(z,F)._add(V)._add(G),j._rotateAround(z,F)._add(V)._add(G),D._rotateAround(z,F)._add(V)._add(G),B._rotateAround(z,F)._add(V)._add(G)}if(c){var W=Math.sin(c),H=Math.cos(c),q=[H,-W,W,H];L._matMult(q),j._matMult(q),D._matMult(q),B._matMult(q)}var Z=new i(0,0),X=new i(0,0);l.push({tl:L,tr:j,bl:D,br:B,tex:m,writingMode:e.writingMode,glyphOffset:T,sectionIndex:g.sectionIndex,isSDF:v,pixelOffsetTL:Z,pixelOffsetBR:X,minFontScaleX:0,minFontScaleY:0})}}return l}(0,r,u,o,a,s,n,t.allowVerticalPlacement),g=t.textSizeData,m=null;"source"===g.kind?(m=[ou*o.layout.get("text-size").evaluate(s,{})])[0]>ju&&x(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===g.kind&&((m=[ou*d.compositeTextSizes[0].evaluate(s,{}),ou*d.compositeTextSizes[1].evaluate(s,{})])[0]>ju||m[1]>ju)&&x(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,A,m,u,a,s,l,e,c.lineStartIndex,c.lineLength,p);for(var y=0,v=h;y<v.length;y+=1)f[v[y]]=t.text.placedSymbolArray.length-1;return 4*A.length}function Bu(t){for(var e in t)return t[e];return null}function Fu(t,e,r,n){var i=t.compareText;if(e in i){for(var o=i[e],a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}else i[e]=[];return i[e].push(n),!1}var zu=Ga.VectorTileFeature.types,Nu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uu(t,e,r,n,i,o,a,s,u,c,l,h,f){var p=s?Math.min(ju,Math.round(s[0])):0,d=s?Math.min(ju,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),o,a,(p<<1)+(u?1:0),d,16*c,16*l,256*h,256*f)}function Vu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Gu(t){for(var e=0,r=t.sections;e<r.length;e+=1)if(Tn(r[e].text))return!0;return!1}var Wu=function(t){this.layoutVertexArray=new fi,this.indexArray=new wi,this.programConfigurations=t,this.segments=new Ui,this.dynamicLayoutVertexArray=new pi,this.opacityVertexArray=new di,this.placedSymbolArray=new Ii};Wu.prototype.upload=function(t,e,r,n){r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ls.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,hs.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Nu,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t)},Wu.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},dn("SymbolBuffers",Wu);var Hu=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Ui,this.collisionVertexArray=new mi};Hu.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,fs.members,!0)},Hu.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},dn("CollisionBuffers",Hu);var qu=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasPaintOverrides=!1,this.hasRTLText=!1;var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=au(this.zoom,e["text-size"]),this.iconSizeData=au(this.zoom,e["icon-size"]);var r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.sortFeaturesByKey="viewport-y"!==i&&void 0!==n.constantOr(1);var o="viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey;this.sortFeaturesByY=o&&(r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement")),"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((function(t){return Ws[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};qu.prototype.createArrays=function(){var t=this.layers[0].layout;this.hasPaintOverrides=Yu.hasPaintOverrides(t),this.text=new Wu(new so(ls.members,this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new Wu(new so(ls.members,this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.textCollisionBox=new Hu(gi,ps.members,Ei),this.iconCollisionBox=new Hu(gi,ps.members,Ei),this.textCollisionCircle=new Hu(gi,ds.members,wi),this.iconCollisionCircle=new Hu(gi,ds.members,wi),this.glyphOffsetArray=new ji,this.lineVertexArray=new Bi,this.symbolInstances=new Ri},qu.prototype.calculateGlyphDependencies=function(t,e,r,n,i){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||n)&&i){var a=gs[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},qu.prototype.populate=function(t,e){var r=this.layers[0],n=r.layout,i=n.get("text-font"),o=n.get("text-field"),a=n.get("icon-image"),s=("constant"!==o.value.kind||o.value.value instanceof Jt&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&("constant"!==i.value.kind||i.value.value.length>0),u=("constant"!==a.value.kind||!!a.value.value)&&Object.keys(a.parameters).length>0,c=n.get("symbol-sort-key");if(this.features=[],s||u){for(var l=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,p=new Nn(this.zoom),d=0,A=t;d<A.length;d+=1){var g=A[d],m=g.feature,y=g.index,v=g.sourceLayerIndex;if(r._featureFilter(p,m)){var _=void 0;if(s){var b=r.getValueAndResolveTokens("text-field",m,f),x=Jt.factory(b);Gu(x)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Bn()||this.hasRTLText&&zn.isParsed())&&(_=As(x,r,m))}var w=void 0;if(u){var E=r.getValueAndResolveTokens("icon-image",m,f);w=E instanceof te?E:te.fromString(E)}if(_||w){var S=this.sortFeaturesByKey?c.evaluate(m,{}):void 0,O={text:_,icon:w,index:y,sourceLayerIndex:v,geometry:fo(m),properties:m.properties,type:zu[m.type],sortKey:S};if(void 0!==m.id&&(O.id=m.id),this.features.push(O),w&&(l[w.name]=!0),_){var T=i.evaluate(m,{}).join(","),P="map"===n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Ws.vertical)>=0;for(var M=0,C=_.sections;M<C.length;M+=1){var I=C[M];if(I.image)l[I.image.name]=!0;else{var k=bn(_.toString()),R=I.fontStack||T,L=h[R]=h[R]||{};this.calculateGlyphDependencies(I.text,L,P,this.allowVerticalPlacement,k)}}}}}}"line"===n.get("symbol-placement")&&(this.features=function(t){var e={},r={},n=[],i=0;function o(e){n.push(t[e]),i++}function a(t,e,i){var o=r[t];return delete r[t],r[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(i[0]),o}function s(t,r,i){var o=e[r];return delete e[r],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=i[0].concat(n[o].geometry[0]),o}function u(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}for(var c=0;c<t.length;c++){var l=t[c],h=l.geometry,f=l.text?l.text.toString():null;if(f){var p=u(f,h),d=u(f,h,!0);if(p in r&&d in e&&r[p]!==e[d]){var A=s(p,d,h),g=a(p,d,n[A].geometry);delete e[p],delete r[d],r[u(f,n[g].geometry,!0)]=g,n[A].geometry=null}else p in r?a(p,d,h):d in e?s(p,d,h):(o(c),e[p]=i-1,r[d]=i-1)}else o(c)}return n.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},qu.prototype.update=function(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))},qu.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},qu.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},qu.prototype.upload=function(t){this.uploaded||(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t),this.textCollisionCircle.upload(t),this.iconCollisionCircle.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},qu.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.textCollisionBox.destroy(),this.iconCollisionBox.destroy(),this.textCollisionCircle.destroy(),this.iconCollisionCircle.destroy()},qu.prototype.addToLineVertexArray=function(t,e){var r=this.lineVertexArray.length;if(void 0!==t.segment){for(var n=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:n},a<e.length-1&&(n+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u<e.length;u++){var c=o[u];this.lineVertexArray.emplaceBack(c.x,c.y,c.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}},qu.prototype.addSymbols=function(t,e,r,n,i,o,a,s,u,c,l){var h=this,f=t.indexArray,p=t.layoutVertexArray,d=t.dynamicLayoutVertexArray,A=t.segments.prepareSegment(4*e.length,t.layoutVertexArray,t.indexArray,o.sortKey),g=this.glyphOffsetArray.length,m=A.vertexLength,y=this.allowVerticalPlacement&&a===Ws.vertical?Math.PI/2:0,v=function(t){var e=t.tl,n=t.tr,i=t.bl,o=t.br,a=t.tex,u=t.pixelOffsetTL,c=t.pixelOffsetBR,l=t.minFontScaleX,g=t.minFontScaleY,m=A.vertexLength,v=t.glyphOffset[1];Uu(p,s.x,s.y,e.x,v+e.y,a.x,a.y,r,t.isSDF,u.x,u.y,l,g),Uu(p,s.x,s.y,n.x,v+n.y,a.x+a.w,a.y,r,t.isSDF,c.x,u.y,l,g),Uu(p,s.x,s.y,i.x,v+i.y,a.x,a.y+a.h,r,t.isSDF,u.x,c.y,l,g),Uu(p,s.x,s.y,o.x,v+o.y,a.x+a.w,a.y+a.h,r,t.isSDF,c.x,c.y,l,g),Vu(d,s,y),f.emplaceBack(m,m+1,m+2),f.emplaceBack(m+1,m+2,m+3),A.vertexLength+=4,A.primitiveLength+=2,h.glyphOffsetArray.emplaceBack(t.glyphOffset[0])};if(o.text&&o.text.sections){var _=o.text.sections;if(this.hasPaintOverrides){for(var b,x=function(e,r){void 0===b||b===e&&!r||t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length,o,o.index,{},_[b]),b=e},w=0,E=e;w<E.length;w+=1){var S=E[w];x(S.sectionIndex,!1),v(S)}x(b,!0)}else{for(var O=0,T=e;O<T.length;O+=1)v(T[O]);t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length,o,o.index,{},_[0])}}else{for(var P=0,M=e;P<M.length;P+=1)v(M[P]);t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length,o,o.index,{})}t.placedSymbolArray.emplaceBack(s.x,s.y,g,this.glyphOffsetArray.length-g,m,u,c,s.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,l)},qu.prototype._addCollisionDebugVertex=function(t,e,r,n,i,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(o.x),Math.round(o.y))},qu.prototype.addCollisionDebugVertices=function(t,e,r,n,o,a,s,u){var c=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),l=c.vertexLength,h=o.layoutVertexArray,f=o.collisionVertexArray,p=s.anchorX,d=s.anchorY;if(this._addCollisionDebugVertex(h,f,a,p,d,new i(t,e)),this._addCollisionDebugVertex(h,f,a,p,d,new i(r,e)),this._addCollisionDebugVertex(h,f,a,p,d,new i(r,n)),this._addCollisionDebugVertex(h,f,a,p,d,new i(t,n)),c.vertexLength+=4,u){var A=o.indexArray;A.emplaceBack(l,l+1,l+2),A.emplaceBack(l,l+2,l+3),c.primitiveLength+=2}else{var g=o.indexArray;g.emplaceBack(l,l+1),g.emplaceBack(l+1,l+2),g.emplaceBack(l+2,l+3),g.emplaceBack(l+3,l),c.primitiveLength+=4}},qu.prototype.addDebugCollisionBoxes=function(t,e,r,n){for(var i=t;i<e;i++){var o=this.collisionBoxArray.get(i),a=o.x1,s=o.y1,u=o.x2,c=o.y2,l=o.radius>0;this.addCollisionDebugVertices(a,s,u,c,l?n?this.textCollisionCircle:this.iconCollisionCircle:n?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,r,l)}},qu.prototype.generateCollisionDebugBuffers=function(){for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}},qu.prototype._deserializeCollisionBoxesForSymbol=function(t,e,r,n,i,o,a,s,u){for(var c={},l=e;l<r;l++){var h=t.get(l);if(0===h.radius){c.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.textFeatureIndex=h.featureIndex;break}c.textCircles||(c.textCircles=[],c.textFeatureIndex=h.featureIndex),c.textCircles.push(h.anchorPointX,h.anchorPointY,h.radius,h.signedDistanceFromAnchor,1)}for(var f=n;f<i;f++){var p=t.get(f);if(0===p.radius){c.verticalTextBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,anchorPointX:p.anchorPointX,anchorPointY:p.anchorPointY},c.verticalTextFeatureIndex=p.featureIndex;break}}for(var d=o;d<a;d++){var A=t.get(d);if(0===A.radius){c.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},c.iconFeatureIndex=A.featureIndex;break}}for(var g=s;g<u;g++){var m=t.get(g);if(0===m.radius){c.verticalIconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},c.verticalIconFeatureIndex=m.featureIndex;break}}return c},qu.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}},qu.prototype.hasTextData=function(){return this.text.segments.get().length>0},qu.prototype.hasIconData=function(){return this.icon.segments.get().length>0},qu.prototype.hasTextCollisionBoxData=function(){return this.textCollisionBox.segments.get().length>0},qu.prototype.hasIconCollisionBoxData=function(){return this.iconCollisionBox.segments.get().length>0},qu.prototype.hasTextCollisionCircleData=function(){return this.textCollisionCircle.segments.get().length>0},qu.prototype.hasIconCollisionCircleData=function(){return this.iconCollisionCircle.segments.get().length>0},qu.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i<n;i+=4)t.indexArray.emplaceBack(i,i+1,i+2),t.indexArray.emplaceBack(i+1,i+2,i+3)},qu.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var e=Math.sin(t),r=Math.cos(t),n=[],i=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);n.push(0|Math.round(e*s.anchorX+r*s.anchorY)),i.push(s.featureIndex)}return o.sort((function(t,e){return n[t]-n[e]||i[e]-i[t]})),o},qu.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r<n.length;r+=1){var i=n[r],o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t,r,n){t>=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},dn("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=Vu;var Zu=new ti({"symbol-placement":new Qn(Tt.layout_symbol["symbol-placement"]),"symbol-spacing":new Qn(Tt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qn(Tt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Yn(Tt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qn(Tt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qn(Tt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Qn(Tt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qn(Tt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qn(Tt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Yn(Tt.layout_symbol["icon-size"]),"icon-text-fit":new Qn(Tt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qn(Tt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Yn(Tt.layout_symbol["icon-image"]),"icon-rotate":new Yn(Tt.layout_symbol["icon-rotate"]),"icon-padding":new Qn(Tt.layout_symbol["icon-padding"]),"icon-keep-upright":new Qn(Tt.layout_symbol["icon-keep-upright"]),"icon-offset":new Yn(Tt.layout_symbol["icon-offset"]),"icon-anchor":new Yn(Tt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qn(Tt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qn(Tt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qn(Tt.layout_symbol["text-rotation-alignment"]),"text-field":new Yn(Tt.layout_symbol["text-field"]),"text-font":new Yn(Tt.layout_symbol["text-font"]),"text-size":new Yn(Tt.layout_symbol["text-size"]),"text-max-width":new Yn(Tt.layout_symbol["text-max-width"]),"text-line-height":new Qn(Tt.layout_symbol["text-line-height"]),"text-letter-spacing":new Yn(Tt.layout_symbol["text-letter-spacing"]),"text-justify":new Yn(Tt.layout_symbol["text-justify"]),"text-radial-offset":new Yn(Tt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qn(Tt.layout_symbol["text-variable-anchor"]),"text-anchor":new Yn(Tt.layout_symbol["text-anchor"]),"text-max-angle":new Qn(Tt.layout_symbol["text-max-angle"]),"text-writing-mode":new Qn(Tt.layout_symbol["text-writing-mode"]),"text-rotate":new Yn(Tt.layout_symbol["text-rotate"]),"text-padding":new Qn(Tt.layout_symbol["text-padding"]),"text-keep-upright":new Qn(Tt.layout_symbol["text-keep-upright"]),"text-transform":new Yn(Tt.layout_symbol["text-transform"]),"text-offset":new Yn(Tt.layout_symbol["text-offset"]),"text-allow-overlap":new Qn(Tt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Qn(Tt.layout_symbol["text-ignore-placement"]),"text-optional":new Qn(Tt.layout_symbol["text-optional"])}),Xu={paint:new ti({"icon-opacity":new Yn(Tt.paint_symbol["icon-opacity"]),"icon-color":new Yn(Tt.paint_symbol["icon-color"]),"icon-halo-color":new Yn(Tt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Yn(Tt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Yn(Tt.paint_symbol["icon-halo-blur"]),"icon-translate":new Qn(Tt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qn(Tt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Yn(Tt.paint_symbol["text-opacity"]),"text-color":new Yn(Tt.paint_symbol["text-color"],{runtimeType:zt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Yn(Tt.paint_symbol["text-halo-color"]),"text-halo-width":new Yn(Tt.paint_symbol["text-halo-width"]),"text-halo-blur":new Yn(Tt.paint_symbol["text-halo-blur"]),"text-translate":new Qn(Tt.paint_symbol["text-translate"]),"text-translate-anchor":new Qn(Tt.paint_symbol["text-translate-anchor"])}),layout:Zu},Qu=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:jt,this.defaultValue=t};Qu.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},Qu.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Qu.prototype.possibleOutputs=function(){return[void 0]},Qu.prototype.serialize=function(){return null},dn("FormatSectionOverride",Qu,{omit:["defaultValue"]});var Yu=function(t){function e(e){t.call(this,e,Xu)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],o=0,a=n;o<a.length;o+=1){var s=a[o];i.indexOf(s)<0&&i.push(s)}this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(t,e,r){var n=this.layout.get(t).evaluate(e,{},r),i=this._unevaluatedLayout._values[t];return i.isDataDriven()||wr(i.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,r){return r in t?String(t[r]):""}))}(e.properties,n)},e.prototype.createBucket=function(t){return new qu(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,r=Xu.paint.overridableProperties;t<r.length;t+=1){var n=r[t];if(e.hasPaintOverride(this.layout,n)){var i,o=this.paint.get(n),a=new Qu(o),s=new xr(a,o.property.specification);i="constant"===o.value.kind||"source"===o.value.kind?new Sr("source",s):new Or("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[n]=new Zn(o.property,i,o.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var r=t.get("text-field"),n=Xu.paint.properties[e],i=!1,o=function(t){for(var e=0,r=t;e<r.length;e+=1){var o=r[e];if(n.overrides&&n.overrides.hasOverride(o))return void(i=!0)}};if("constant"===r.value.kind&&r.value.value instanceof Jt)o(r.value.value.sections);else if("source"===r.value.kind){var a=function(t){if(!i)if(t instanceof ie&&re(t.value)===Gt){var e=t.value;o(e.sections)}else t instanceof ue?o(t.sections):t.eachChild(a)},s=r.value;s._styleExpression&&a(s._styleExpression.expression)}return i},e.hasPaintOverrides=function(t){for(var r=0,n=Xu.paint.overridableProperties;r<n.length;r+=1){var i=n[r];if(e.hasPaintOverride(t,i))return!0}return!1},e}(ei),Ku={paint:new ti({"background-color":new Qn(Tt.paint_background["background-color"]),"background-pattern":new $n(Tt.paint_background["background-pattern"]),"background-opacity":new Qn(Tt.paint_background["background-opacity"])})},$u=function(t){function e(e){t.call(this,e,Ku)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ei),Ju={paint:new ti({"raster-opacity":new Qn(Tt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qn(Tt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qn(Tt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qn(Tt.paint_raster["raster-brightness-max"]),"raster-saturation":new Qn(Tt.paint_raster["raster-saturation"]),"raster-contrast":new Qn(Tt.paint_raster["raster-contrast"]),"raster-resampling":new Qn(Tt.paint_raster["raster-resampling"]),"raster-fade-duration":new Qn(Tt.paint_raster["raster-fade-duration"])})},tc=function(t){function e(e){t.call(this,e,Ju)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ei),ec=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.is3D=function(){return"3d"===this.implementation.renderingMode},e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},e}(ei),rc={circle:jo,heatmap:Ho,hillshade:Zo,fill:Ra,"fill-extrusion":Ka,line:us,symbol:Yu,background:$u,raster:tc},nc=self.HTMLImageElement,ic=self.HTMLCanvasElement,oc=self.HTMLVideoElement,ac=self.ImageData,sc=function(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)};sc.prototype.update=function(t,e,r){var n=t.width,i=t.height,o=!(this.size&&this.size[0]===n&&this.size[1]===i||r),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[n,i],t instanceof nc||t instanceof ic||t instanceof oc||t instanceof ac?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,n,i,0,this.format,s.UNSIGNED_BYTE,t.data);else{var u=r||{x:0,y:0},c=u.x,l=u.y;t instanceof nc||t instanceof ic||t instanceof oc||t instanceof ac?s.texSubImage2D(s.TEXTURE_2D,0,c,l,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,c,l,n,i,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},sc.prototype.bind=function(t,e,r){var n=this.context.gl;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)},sc.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},sc.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var uc=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};uc.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){t._triggered=!1,t._callback()}),0))},uc.prototype.remove=function(){delete this._channel,this._callback=function(){}};var cc=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},g(["receive","process"],this),this.invoker=new uc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=S()?t:self};function lc(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}cc.prototype.send=function(t,e,r,n,i){var o=this;void 0===i&&(i=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);var s=P(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:mn(e,s)},s),{cancel:function(){r&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:n,sourceMapId:o.mapId})}}},cc.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else S()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},cc.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},cc.prototype.processTask=function(t,e){var r=this;if("<response>"===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(yn(e.error)):n(null,yn(e.data)))}else{var i=!1,o=P(this.globalScope)?void 0:[],a=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"<response>",sourceMapId:r.mapId,error:e?mn(e):null,data:mn(n,o)},o)}:function(t){i=!0},s=null,u=yn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,a);else if(this.parent.getWorkerSource){var c=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,c[0],u.source)[c[1]](u,a)}else a(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},cc.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var hc=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};hc.prototype.setNorthEast=function(t){return this._ne=t instanceof fc?new fc(t.lng,t.lat):fc.convert(t),this},hc.prototype.setSouthWest=function(t){return this._sw=t instanceof fc?new fc(t.lng,t.lat):fc.convert(t),this},hc.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof fc)e=t,r=t;else{if(!(t instanceof hc))return Array.isArray(t)?t.every(Array.isArray)?this.extend(hc.convert(t)):this.extend(fc.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new fc(e.lng,e.lat),this._ne=new fc(r.lng,r.lat)),this},hc.prototype.getCenter=function(){return new fc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},hc.prototype.getSouthWest=function(){return this._sw},hc.prototype.getNorthEast=function(){return this._ne},hc.prototype.getNorthWest=function(){return new fc(this.getWest(),this.getNorth())},hc.prototype.getSouthEast=function(){return new fc(this.getEast(),this.getSouth())},hc.prototype.getWest=function(){return this._sw.lng},hc.prototype.getSouth=function(){return this._sw.lat},hc.prototype.getEast=function(){return this._ne.lng},hc.prototype.getNorth=function(){return this._ne.lat},hc.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},hc.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},hc.prototype.isEmpty=function(){return!(this._sw&&this._ne)},hc.prototype.contains=function(t){var e=fc.convert(t),r=e.lng,n=e.lat,i=this._sw.lat<=n&&n<=this._ne.lat,o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),i&&o},hc.convert=function(t){return!t||t instanceof hc?t:new hc(t)};var fc=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};fc.prototype.wrap=function(){return new fc(l(this.lng,-180,180),this.lat)},fc.prototype.toArray=function(){return[this.lng,this.lat]},fc.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},fc.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new hc(new fc(this.lng-r,this.lat-e),new fc(this.lng+r,this.lat+e))},fc.convert=function(t){if(t instanceof fc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new fc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new fc(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var pc=2*Math.PI*6378137;function dc(t){return pc*Math.cos(t*Math.PI/180)}function Ac(t){return(180+t)/360}function gc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function mc(t,e){return t/dc(e)}function yc(t){var e=180-360*t;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}var vc=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};vc.fromLngLat=function(t,e){void 0===e&&(e=0);var r=fc.convert(t);return new vc(Ac(r.lng),gc(r.lat),mc(e,r.lat))},vc.prototype.toLngLat=function(){return new fc(360*this.x-180,yc(this.y))},vc.prototype.toAltitude=function(){return this.z*dc(yc(this.y))},vc.prototype.meterInMercatorCoordinateUnits=function(){return 1/pc*(t=yc(this.y),1/Math.cos(t*Math.PI/180));var t};var _c=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=wc(0,t,e,r)};_c.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},_c.prototype.url=function(t,e){var r,n,i,o,a,s=(r=this.x,n=this.y,i=this.z,o=lc(256*r,256*(n=Math.pow(2,i)-n-1),i),a=lc(256*(r+1),256*(n+1),i),o[0]+","+o[1]+","+a[0]+","+a[1]),u=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<<o-1)?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",u).replace("{bbox-epsg-3857}",s)},_c.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new i((t.x*e-this.x)*lo,(t.y*e-this.y)*lo)},_c.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var bc=function(t,e){this.wrap=t,this.canonical=e,this.key=wc(t,e.z,e.x,e.y)},xc=function(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new _c(r,+n,+i),this.key=wc(e,t,n,i)};function wc(t,e,r,n){(t*=2)<0&&(t=-1*t-1);var i=1<<e;return 32*(i*i*t+i*n+r)+e}xc.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},xc.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new xc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new xc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},xc.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},xc.prototype.children=function(t){if(this.overscaledZ>=t)return[new xc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new xc(e,this.wrap,e,r,n),new xc(e,this.wrap,e,r+1,n),new xc(e,this.wrap,e,r,n+1),new xc(e,this.wrap,e,r+1,n+1)]},xc.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},xc.prototype.wrapped=function(){return new xc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},xc.prototype.unwrapTo=function(t){return new xc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},xc.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},xc.prototype.toUnwrapped=function(){return new bc(this.wrap,this.canonical)},xc.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},xc.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new vc(t.x-this.wrap,t.y))},dn("CanonicalTileID",_c),dn("OverscaledTileID",xc,{omit:["posMatrix"]});var Ec=function(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return x('"'+r+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(var i=0;i<n;i++)this.data[this._idx(-1,i)]=this.data[this._idx(0,i)],this.data[this._idx(n,i)]=this.data[this._idx(n-1,i)],this.data[this._idx(i,-1)]=this.data[this._idx(i,0)],this.data[this._idx(i,n)]=this.data[this._idx(i,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]};Ec.prototype.get=function(t,e){var r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[n],r[n+1],r[n+2])},Ec.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Ec.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Ec.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Ec.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Ec.prototype.getPixels=function(){return new Vo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Ec.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,u=-r*this.dim,c=o;c<a;c++)for(var l=n;l<i;l++)this.data[this._idx(l,c)]=t.data[this._idx(l+s,c+u)]},dn("DEMData",Ec);var Sc=oi([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Oc=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}};Oc.prototype.encode=function(t){return this._stringToNumber[t]},Oc.prototype.decode=function(t){return this._numberToString[t]};var Tc=function(t,e,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)},Pc={geometry:{configurable:!0}};Pc.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},Pc.geometry.set=function(t){this._geometry=t},Tc.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(Tc.prototype,Pc);var Mc=function(){this.state={},this.stateChanges={},this.deletedStates={}};Mc.prototype.updateState=function(t,e,r){var n=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},h(this.stateChanges[t][n],r),null===this.deletedStates[t])for(var i in this.deletedStates[t]={},this.state[t])i!==n&&(this.deletedStates[t][i]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][n])for(var o in this.deletedStates[t][n]={},this.state[t][n])r[o]||(this.deletedStates[t][n][o]=null);else for(var a in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][a]&&delete this.deletedStates[t][n][a]},Mc.prototype.removeFeatureState=function(t,e,r){if(null!==this.deletedStates[t]){var n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e&&e>=0)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e&&e>=0)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}},Mc.prototype.getState=function(t,e){var r=String(e),n=this.state[t]||{},i=this.stateChanges[t]||{},o=h({},n[r],i[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var a=this.deletedStates[t][e];if(null===a)return{};for(var s in a)delete o[s]}return o},Mc.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},Mc.prototype.coalesceChanges=function(t,e){var r={};for(var n in this.stateChanges){this.state[n]=this.state[n]||{};var i={};for(var o in this.stateChanges[n])this.state[n][o]||(this.state[n][o]={}),h(this.state[n][o],this.stateChanges[n][o]),i[o]=this.state[n][o];r[n]=i}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var u in this.state[a])s[u]={},this.state[a][u]={};else for(var c in this.deletedStates[a]){if(null===this.deletedStates[a][c])this.state[a][c]={};else for(var l=0,f=Object.keys(this.deletedStates[a][c]);l<f.length;l+=1){var p=f[l];delete this.state[a][c][p]}s[c]=this.state[a][c]}r[a]=r[a]||{},h(r[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(var d in t)t[d].setFeatureState(r,e)};var Cc=function(t,e,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=e||new ln(lo,16,0),this.grid3D=new ln(lo,16,0),this.featureIndexArray=r||new zi};function Ic(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y)}return{minX:e,minY:r,maxX:n,maxY:i}}function kc(t,e){return e-t}Cc.prototype.insert=function(t,e,r,n,i,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);for(var s=o?this.grid3D:this.grid,u=0;u<e.length;u++){for(var c=e[u],l=[1/0,1/0,-1/0,-1/0],h=0;h<c.length;h++){var f=c[h];l[0]=Math.min(l[0],f.x),l[1]=Math.min(l[1],f.y),l[2]=Math.max(l[2],f.x),l[3]=Math.max(l[3],f.y)}l[0]<lo&&l[1]<lo&&l[2]>=0&&l[3]>=0&&s.insert(a,l[0],l[1],l[2],l[3])}},Cc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Ga.VectorTile(new vs(this.rawTileData)).layers,this.sourceLayerCoder=new Oc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Cc.prototype.query=function(t,e,r){var n=this;this.loadVTLayers();for(var o=t.params||{},a=lo/t.tileSize/t.scale,s=Br(o.filter),u=t.queryGeometry,c=t.queryPadding*a,l=Ic(u),h=this.grid.query(l.minX-c,l.minY-c,l.maxX+c,l.maxY+c),f=Ic(t.cameraQueryGeometry),p=0,d=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,o){return function(t,e,r,n,o){for(var a=0,s=t;a<s.length;a+=1){var u=s[a];if(e<=u.x&&r<=u.y&&n>=u.x&&o>=u.y)return!0}var c=[new i(e,r),new i(e,o),new i(n,o),new i(n,r)];if(t.length>2)for(var l=0,h=c;l<h.length;l+=1)if(So(t,h[l]))return!0;for(var f=0;f<t.length-1;f++)if(Oo(t[f],t[f+1],c))return!0;return!1}(t.cameraQueryGeometry,e-c,r-c,n+c,o+c)}));p<d.length;p+=1){var A=d[p];h.push(A)}h.sort(kc);for(var g,m={},y=function(i){var c=h[i];if(c!==g){g=c;var l=n.featureIndexArray.get(c),f=null;n.loadMatchingFeature(m,l.bucketIndex,l.sourceLayerIndex,l.featureIndex,s,o.layers,e,(function(e,i){f||(f=fo(e));var o={};return e.id&&(o=r.getState(i.sourceLayer||"_geojsonTileLayer",e.id)),i.queryIntersectsFeature(u,e,o,f,n.z,t.transform,a,t.pixelPosMatrix)}))}},v=0;v<h.length;v++)y(v);return m},Cc.prototype.loadMatchingFeature=function(t,e,r,n,i,o,a,s){var u=this.bucketLayerIDs[e];if(!o||function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(o,u)){var c=this.sourceLayerCoder.decode(r),l=this.vtLayers[c].feature(n);if(i(new Nn(this.tileID.overscaledZ),l))for(var h=0;h<u.length;h++){var f=u[h];if(!(o&&o.indexOf(f)<0)){var p=a[f];if(p){var d=!s||s(l,p);if(d){var A=new Tc(l,this.z,this.x,this.y);A.layer=p.serialize();var g=t[f];void 0===g&&(g=t[f]=[]),g.push({featureIndex:n,feature:A,intersectionZ:d})}}}}}},Cc.prototype.lookupSymbolFeatures=function(t,e,r,n,i,o){var a={};this.loadVTLayers();for(var s=Br(n),u=0,c=t;u<c.length;u+=1){var l=c[u];this.loadMatchingFeature(a,e,r,l,s,i,o)}return a},Cc.prototype.hasLayer=function(t){for(var e=0,r=this.bucketLayerIDs;e<r.length;e+=1)for(var n=0,i=r[e];n<i.length;n+=1)if(t===i[n])return!0;return!1},dn("FeatureIndex",Cc,{omit:["rawTileData","sourceLayerCoder"]});var Rc=function(t,e){this.tileID=t,this.uid=p(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};Rc.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<B.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},Rc.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},Rc.prototype.loadVectorData=function(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var n in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){var r={};if(!e)return r;for(var n=function(){var t=o[i],n=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==n.length){t.layers=n,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return n.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=n;a<s.length;a+=1){var u=s[a];r[u.id]=t}}},i=0,o=t;i<o.length;i+=1)n();return r}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var i=this.buckets[n];if(i instanceof qu){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var o in this.buckets){var a=this.buckets[o];if(a instanceof qu&&a.hasRTLText){this.hasRTLText=!0,zn.isLoading()||zn.isLoaded()||"deferred"!==Bn()||Fn();break}}for(var s in this.queryPadding=0,this.buckets){var u=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(s).queryRadius(u))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new Mi},Rc.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},Rc.prototype.getBucket=function(t){return this.buckets[t.id]},Rc.prototype.upload=function(t){for(var e in this.buckets){var r=this.buckets[e];r.uploadPending()&&r.upload(t)}var n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new sc(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new sc(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)},Rc.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},Rc.prototype.queryRenderedFeatures=function(t,e,r,n,i,o,a,s,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:i,tileSize:this.tileSize,pixelPosMatrix:u,transform:a,params:o,queryPadding:this.queryPadding*s},t,e):{}},Rc.prototype.querySourceFeatures=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData){var r=this.latestFeatureIndex.loadVTLayers(),n=e?e.sourceLayer:"",i=r._geojsonTileLayer||r[n];if(i)for(var o=Br(e&&e.filter),a=this.tileID.canonical,s=a.z,u=a.x,c=a.y,l={z:s,x:u,y:c},h=0;h<i.length;h++){var f=i.feature(h);if(o(new Nn(this.tileID.overscaledZ),f)){var p=new Tc(f,s,u,c);p.tile=l,t.push(p)}}}},Rc.prototype.clearMask=function(){this.segments&&(this.segments.destroy(),delete this.segments),this.maskedBoundsBuffer&&(this.maskedBoundsBuffer.destroy(),delete this.maskedBoundsBuffer),this.maskedIndexBuffer&&(this.maskedIndexBuffer.destroy(),delete this.maskedIndexBuffer),delete this.mask},Rc.prototype.setMask=function(t,e){if(!a(this.mask,t)&&(this.clearMask(),this.mask=t,!a(t,{0:!0}))){var r=new ui,n=new wi;this.segments=new Ui,this.segments.prepareSegment(0,r,n);for(var o=Object.keys(t),s=0;s<o.length;s++){var u=t[+o[s]],c=lo>>u.z,l=new i(u.x*c,u.y*c),h=new i(l.x+c,l.y+c),f=this.segments.prepareSegment(4,r,n);r.emplaceBack(l.x,l.y,l.x,l.y),r.emplaceBack(h.x,l.y,h.x,l.y),r.emplaceBack(l.x,h.y,l.x,h.y),r.emplaceBack(h.x,h.y,h.x,h.y);var p=f.vertexLength;n.emplaceBack(p,p+1,p+2),n.emplaceBack(p+1,p+2,p+3),f.vertexLength+=4,f.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,Sc.members),this.maskedIndexBuffer=e.createIndexBuffer(n)}},Rc.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Rc.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Rc.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=O(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(e)if(this.expirationTime<e)i=!0;else{var o=this.expirationTime-e;o?this.expirationTime=n+Math.max(o,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Rc.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},Rc.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var r=this.latestFeatureIndex.loadVTLayers();for(var n in this.buckets){var i=this.buckets[n],o=i.layers[0].sourceLayer||"_geojsonTileLayer",a=r[o],s=t[o];a&&s&&0!==Object.keys(s).length&&(i.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{}),e&&e.style&&(this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(n).queryRadius(i))))}}},Rc.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},Rc.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<B.now()},Rc.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},Rc.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=B.now()+t},Rc.prototype.setDependencies=function(t,e){for(var r={},n=0,i=e;n<i.length;n+=1)r[i[n]]=!0;this.dependencies[t]=r},Rc.prototype.hasDependency=function(t,e){for(var r=0,n=t;r<n.length;r+=1){var i=n[r],o=this.dependencies[i];if(o)for(var a=0,s=e;a<s.length;a+=1)if(o[s[a]])return!0}return!1},t.Actor=cc,t.AlphaImage=Uo,t.CanonicalTileID=_c,t.CollisionBoxArray=Mi,t.Color=Yt,t.DEMData=Ec,t.DataConstantProperty=Qn,t.DictionaryCoder=Oc,t.EXTENT=lo,t.ErrorEvent=St,t.EvaluationParameters=Nn,t.Event=Et,t.Evented=Ot,t.FeatureIndex=Cc,t.FillBucket=Ca,t.FillExtrusionBucket=Za,t.ImageAtlas=Gs,t.ImagePosition=Us,t.LineBucket=is,t.LngLat=fc,t.LngLatBounds=hc,t.MercatorCoordinate=vc,t.ONE_EM=24,t.OverscaledTileID=xc,t.Point=i,t.Point$1=i,t.ProgramConfiguration=ao,t.Properties=ti,t.Protobuf=vs,t.RGBAImage=Vo,t.RequestManager=W,t.ResourceType=ft,t.SegmentVector=Ui,t.SourceFeatureState=Mc,t.StructArrayLayout1ui2=Si,t.StructArrayLayout2i4=si,t.StructArrayLayout2ui4=Ei,t.StructArrayLayout3ui6=wi,t.StructArrayLayout4i8=ui,t.SymbolBucket=qu,t.Texture=sc,t.Tile=Rc,t.Transitionable=Gn,t.Uniform1f=Zi,t.Uniform1i=qi,t.Uniform2f=Xi,t.Uniform3f=Qi,t.Uniform4f=Yi,t.UniformColor=Ki,t.UniformMatrix4f=Ji,t.UnwrappedTileID=bc,t.ValidationError=Pt,t.WritingMode=Ws,t.ZoomHistory=vn,t.addDynamicAttributes=Vu,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i)}))}))},t.bezier=s,t.bindAll=g,t.browser=B,t.cacheEntryPossiblyAdded=function(t){++ht>ut&&(t.getActor().send("enforceCacheSizeLimit",st),ht=0)},t.clamp=c,t.clearTileCache=function(t){var e=self.caches.delete(at);t&&e.catch(t).then((function(){return t()}))},t.clone=function(t){var e=new Ro(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=_,t.config=F,t.create=function(){var t=new Ro(16);return Ro!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new Ro(9);return Ro!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new Ro(4);return Ro!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Er,t.createLayout=oi,t.createStyleLayer=function(t){return"custom"===t.type?new ec(t):new rc[t.type](t)},t.deepEqual=a,t.ease=u,t.emitValidationErrors=cn,t.endsWith=m,t.enforceCacheSizeLimit=function(t){ct(),J&&J.then((function(e){e.keys().then((function(r){for(var n=0;n<r.length-t;n++)e.delete(r[n])}))}))},t.evaluateSizeForFeature=su,t.evaluateSizeForZoom=uu,t.evaluateVariableOffset=Ru,t.evented=Dn,t.extend=h,t.featureFilter=Br,t.filterObject=v,t.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.getAnchorAlignment=eu,t.getAnchorJustification=Lu,t.getArrayBuffer=vt,t.getImage=bt,t.getJSON=function(t,e){return yt(h(t,{type:"json"}),e)},t.getRTLTextPluginStatus=Bn,t.getReferrer=dt,t.getVideo=function(t,e){var r,n,i=self.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(var o=0;o<t.length;o++){var a=self.document.createElement("source");r=t[o],n=void 0,(n=self.document.createElement("a")).href=r,(n.protocol!==self.document.location.protocol||n.host!==self.document.location.host)&&(i.crossOrigin="Anonymous"),a.src=t[o],i.appendChild(a)}return{cancel:function(){}}},t.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],f=e[10],p=e[11],d=e[12],A=e[13],g=e[14],m=e[15],y=r*s-n*a,v=r*u-i*a,_=r*c-o*a,b=n*u-i*s,x=n*c-o*s,w=i*c-o*u,E=l*A-h*d,S=l*g-f*d,O=l*m-p*d,T=h*g-f*A,P=h*m-p*A,M=f*m-p*g,C=y*M-v*P+_*T+b*O-x*S+w*E;return C?(C=1/C,t[0]=(s*M-u*P+c*T)*C,t[1]=(i*P-n*M-o*T)*C,t[2]=(A*w-g*x+m*b)*C,t[3]=(f*x-h*w-p*b)*C,t[4]=(u*O-a*M-c*S)*C,t[5]=(r*M-i*O+o*S)*C,t[6]=(g*_-d*w-m*v)*C,t[7]=(l*w-f*_+p*v)*C,t[8]=(a*P-s*O+c*E)*C,t[9]=(n*O-r*P-o*E)*C,t[10]=(d*x-A*_+m*y)*C,t[11]=(h*_-l*x-p*y)*C,t[12]=(s*S-a*T-u*E)*C,t[13]=(r*T-n*S+i*E)*C,t[14]=(A*v-d*b-g*y)*C,t[15]=(l*b-h*v+f*y)*C,t):null},t.isChar=_n,t.isMapboxURL=H,t.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},t.makeRequest=yt,t.mapObject=y,t.mercatorXfromLng=Ac,t.mercatorYfromLat=gc,t.mercatorZfromAltitude=mc,t.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],p=e[10],d=e[11],A=e[12],g=e[13],m=e[14],y=e[15],v=r[0],_=r[1],b=r[2],x=r[3];return t[0]=v*n+_*s+b*h+x*A,t[1]=v*i+_*u+b*f+x*g,t[2]=v*o+_*c+b*p+x*m,t[3]=v*a+_*l+b*d+x*y,v=r[4],_=r[5],b=r[6],x=r[7],t[4]=v*n+_*s+b*h+x*A,t[5]=v*i+_*u+b*f+x*g,t[6]=v*o+_*c+b*p+x*m,t[7]=v*a+_*l+b*d+x*y,v=r[8],_=r[9],b=r[10],x=r[11],t[8]=v*n+_*s+b*h+x*A,t[9]=v*i+_*u+b*f+x*g,t[10]=v*o+_*c+b*p+x*m,t[11]=v*a+_*l+b*d+x*y,v=r[12],_=r[13],b=r[14],x=r[15],t[12]=v*n+_*s+b*h+x*A,t[13]=v*i+_*u+b*f+x*g,t[14]=v*o+_*c+b*p+x*m,t[15]=v*a+_*l+b*d+x*y,t},t.mvt=Ga,t.number=we,t.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(a+o)*c,t[15]=1,t},t.parseGlyphPBF=function(t){return new vs(t).readFields(Bs,[])},t.pbf=vs,t.performSymbolLayout=function(t,e,r,n,o,a){t.createArrays();var s=512*t.overscaling;t.tilePixelRatio=lo/s,t.compareText={},t.iconsNeedLinear=!1;var u=t.layers[0].layout,c=t.layers[0]._unevaluatedLayout._values,l={};if("composite"===t.textSizeData.kind){var h=t.textSizeData,f=h.minZoom,p=h.maxZoom;l.compositeTextSizes=[c["text-size"].possiblyEvaluate(new Nn(f)),c["text-size"].possiblyEvaluate(new Nn(p))]}if("composite"===t.iconSizeData.kind){var d=t.iconSizeData,A=d.minZoom,g=d.maxZoom;l.compositeIconSizes=[c["icon-size"].possiblyEvaluate(new Nn(A)),c["icon-size"].possiblyEvaluate(new Nn(g))]}l.layoutTextSize=c["text-size"].possiblyEvaluate(new Nn(t.zoom+1)),l.layoutIconSize=c["icon-size"].possiblyEvaluate(new Nn(t.zoom+1)),l.textMaxSize=c["text-size"].possiblyEvaluate(new Nn(18));for(var m=24*u.get("text-line-height"),y="map"===u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement"),v=u.get("text-keep-upright"),_=u.get("text-size"),b=function(){var a=E[w],s=u.get("text-font").evaluate(a,{}).join(","),c=_.evaluate(a,{}),h=l.layoutTextSize.evaluate(a,{}),f=l.layoutIconSize.evaluate(a,{}),p={horizontal:{},vertical:void 0},d=a.text,A=[0,0];if(d){var g=d.toString(),b=24*u.get("text-letter-spacing").evaluate(a,{}),S=function(t){for(var e=0,r=t;e<r.length;e+=1)if(!xn(r[e].charCodeAt(0)))return!1;return!0}(g)?b:0,O=u.get("text-anchor").evaluate(a,{}),T=u.get("text-variable-anchor");if(!T){var P=u.get("text-radial-offset").evaluate(a,{});A=P?Ru(O,[24*P,ku]):u.get("text-offset").evaluate(a,{}).map((function(t){return 24*t}))}var M=y?"center":u.get("text-justify").evaluate(a,{}),C=u.get("symbol-placement"),I="point"===C?24*u.get("text-max-width").evaluate(a,{}):0,k=function(){t.allowVerticalPlacement&&bn(g)&&(p.vertical=Zs(d,e,r,o,s,I,m,O,"left",S,A,Ws.vertical,!0,C,h,c))};if(!y&&T){for(var R="auto"===M?T.map((function(t){return Lu(t)})):[M],L=!1,j=0;j<R.length;j++){var D=R[j];if(!p.horizontal[D])if(L)p.horizontal[D]=p.horizontal[0];else{var B=Zs(d,e,r,o,s,I,m,"center",D,S,A,Ws.horizontal,!1,C,h,c);B&&(p.horizontal[D]=B,L=1===B.positionedLines.length)}}k()}else{"auto"===M&&(M=Lu(O));var F=Zs(d,e,r,o,s,I,m,O,M,S,A,Ws.horizontal,!1,C,h,c);F&&(p.horizontal[M]=F),k(),bn(g)&&y&&v&&(p.vertical=Zs(d,e,r,o,s,I,m,O,M,S,A,Ws.vertical,!1,C,h,c))}}var z=void 0,N=!1;if(a.icon&&a.icon.name){var U=n[a.icon.name];U&&(z=function(t,e,r){var n=eu(r),i=n.horizontalAlign,o=n.verticalAlign,a=e[0],s=e[1],u=a-t.displaySize[0]*i,c=u+t.displaySize[0],l=s-t.displaySize[1]*o;return{image:t,top:l,bottom:l+t.displaySize[1],left:u,right:c}}(o[a.icon.name],u.get("icon-offset").evaluate(a,{}),u.get("icon-anchor").evaluate(a,{})),N=U.sdf,void 0===t.sdfIcons?t.sdfIcons=U.sdf:t.sdfIcons!==U.sdf&&x("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),U.pixelRatio!==t.pixelRatio?t.iconsNeedLinear=!0:0!==u.get("icon-rotate").constantOr(1)&&(t.iconsNeedLinear=!0))}var V=Bu(p.horizontal)||p.vertical;t.iconsInText=!!V&&V.iconsInText,(V||z)&&function(t,e,r,n,o,a,s,u,c,l){var h=a.textMaxSize.evaluate(e,{});void 0===h&&(h=s);var f,p=t.layers[0].layout,d=p.get("icon-offset").evaluate(e,{}),A=Bu(r.horizontal),g=s/24,m=t.tilePixelRatio*g,y=t.tilePixelRatio*h/24,v=t.tilePixelRatio*u,_=t.tilePixelRatio*p.get("symbol-spacing"),b=p.get("text-padding")*t.tilePixelRatio,w=p.get("icon-padding")*t.tilePixelRatio,E=p.get("text-max-angle")/180*Math.PI,S="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),O="map"===p.get("icon-rotation-alignment")&&"point"!==p.get("symbol-placement"),T=p.get("symbol-placement"),P=_/2,M=p.get("icon-text-fit");n&&"none"!==M&&(t.allowVerticalPlacement&&r.vertical&&(f=nu(n,r.vertical,M,p.get("icon-text-fit-padding"),d,g)),A&&(n=nu(n,A,M,p.get("icon-text-fit-padding"),d,g)));var C=function(i,s){s.x<0||s.x>=lo||s.y<0||s.y>=lo||function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,w){var E,S,O,T,P,M=t.addToLineVertexArray(e,r),C=0,I=0,k=0,R=0,L=-1,j=-1,D={},B=Mu(""),F=0,z=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(F=(E=s.layout.get("text-offset").evaluate(_,{}).map((function(t){return 24*t})))[0],z=E[1]):(F=24*s.layout.get("text-radial-offset").evaluate(_,{}),z=ku),t.allowVerticalPlacement&&n.vertical){var N=s.layout.get("text-rotate").evaluate(_,{})+90,U=n.vertical;T=new bu(u,r,e,c,l,h,U,f,p,d,t.overscaling,N),a&&(P=new bu(u,r,e,c,l,h,a,g,m,d,t.overscaling,N))}if(i){var V=s.layout.get("icon-rotate").evaluate(_,{}),G="none"!==s.layout.get("icon-text-fit"),W=gu(i,V,w,G),H=a?gu(a,V,w,G):void 0;O=new bu(u,r,e,c,l,h,i,g,m,!1,t.overscaling,V),C=4*W.length;var q=t.iconSizeData,Z=null;"source"===q.kind?(Z=[ou*s.layout.get("icon-size").evaluate(_,{})])[0]>ju&&x(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===q.kind&&((Z=[ou*b.compositeIconSizes[0].evaluate(_,{}),ou*b.compositeIconSizes[1].evaluate(_,{})])[0]>ju||Z[1]>ju)&&x(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,W,Z,v,y,_,!1,e,M.lineStartIndex,M.lineLength,-1),L=t.icon.placedSymbolArray.length-1,H&&(I=4*H.length,t.addSymbols(t.icon,H,Z,v,y,_,Ws.vertical,e,M.lineStartIndex,M.lineLength,-1),j=t.icon.placedSymbolArray.length-1)}for(var X in n.horizontal){var Q=n.horizontal[X];if(!S){B=Mu(Q.text);var Y=s.layout.get("text-rotate").evaluate(_,{});S=new bu(u,r,e,c,l,h,Q,f,p,d,t.overscaling,Y)}var K=1===Q.positionedLines.length;if(k+=Du(t,e,Q,o,s,d,_,A,M,n.vertical?Ws.horizontal:Ws.horizontalOnly,K?Object.keys(n.horizontal):[X],D,L,b),K)break}n.vertical&&(R+=Du(t,e,n.vertical,o,s,d,_,A,M,Ws.vertical,["vertical"],D,j,b));var $=S?S.boxStartIndex:t.collisionBoxArray.length,J=S?S.boxEndIndex:t.collisionBoxArray.length,tt=T?T.boxStartIndex:t.collisionBoxArray.length,et=T?T.boxEndIndex:t.collisionBoxArray.length,rt=O?O.boxStartIndex:t.collisionBoxArray.length,nt=O?O.boxEndIndex:t.collisionBoxArray.length,it=P?P.boxStartIndex:t.collisionBoxArray.length,ot=P?P.boxEndIndex:t.collisionBoxArray.length;t.glyphOffsetArray.length>=qu.MAX_GLYPHS&&x("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),t.symbolInstances.emplaceBack(e.x,e.y,D.right>=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,L,j,B,$,J,tt,et,rt,nt,it,ot,c,k,R,C,I,0,f,F,z)}(t,s,i,r,n,o,f,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,m,b,S,c,v,w,O,d,e,a,l)};if("line"===T)for(var I=0,k=function(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var u=t[s],c=void 0,l=0;l<u.length-1;l++){var h=u[l],f=u[l+1];h.x<0&&f.x<0||(h.x<0?h=new i(0,h.y+(f.y-h.y)*((0-h.x)/(f.x-h.x)))._round():f.x<0&&(f=new i(0,h.y+(f.y-h.y)*((0-h.x)/(f.x-h.x)))._round()),h.y<0&&f.y<0||(h.y<0?h=new i(h.x+(f.x-h.x)*((0-h.y)/(f.y-h.y)),0)._round():f.y<0&&(f=new i(h.x+(f.x-h.x)*((0-h.y)/(f.y-h.y)),0)._round()),h.x>=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),c&&h.equals(c[c.length-1])||(c=[h],a.push(c)),c.push(f)))))}return a}(e.geometry,0,0,lo,lo);I<k.length;I+=1)for(var R=k[I],L=0,j=Au(R,_,E,r.vertical||A,n,24,y,t.overscaling,lo);L<j.length;L+=1){var D=j[L];A&&Fu(t,A.text,P,D)||C(R,D)}else if("line-center"===T)for(var B=0,F=e.geometry;B<F.length;B+=1){var z=F[B];if(z.length>1){var N=du(z,E,r.vertical||A,n,24,y);N&&C(z,N)}}else if("Polygon"===e.type)for(var U=0,V=Oa(e.geometry,0);U<V.length;U+=1){var G=V[U],W=Eu(G,16);C(G[0],new iu(W.x,W.y,0))}else if("LineString"===e.type)for(var H=0,q=e.geometry;H<q.length;H+=1){var Z=q[H];C(Z,new iu(Z[0].x,Z[0].y,0))}else if("Point"===e.type)for(var X=0,Q=e.geometry;X<Q.length;X+=1)for(var Y=0,K=Q[X];Y<K.length;Y+=1){var $=K[Y];C([$],new iu($.x,$.y,0))}}(t,a,p,z,n,l,h,f,A,N)},w=0,E=t.features;w<E.length;w+=1)b();a&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,r,n,i){var o,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n];i in t&&(r[i]=t[i])}return r},t.plugin=zn,t.polygonIntersectsPolygon=go,t.postMapLoadEvent=ot,t.postTurnstileEvent=nt,t.potpack=Ns,t.rasterBoundsAttributes=Sc,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=dn,t.registerForPluginStateChange=function(t){return t({pluginStatus:kn,pluginURL:Rn}),Dn.on("pluginStateChange",t),t},t.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*-s+o*u,t[3]=i*-s+a*u,t},t.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*n,t[5]=a*i+l*n,t[6]=s*i+h*n,t[7]=u*i+f*n,t[8]=c*i-o*n,t[9]=l*i-a*n,t[10]=h*i-s*n,t[11]=f*i-u*n,t},t.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],c=e[4],l=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*n,t[1]=a*i+l*n,t[2]=s*i+h*n,t[3]=u*i+f*n,t[4]=c*i-o*n,t[5]=l*i-a*n,t[6]=h*i-s*n,t[7]=f*i-u*n,t},t.scale=function(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setCacheLimits=function(t,e){st=t,ut=e},t.setRTLTextPlugin=function(t,e,r){if(void 0===r&&(r=!1),kn===Pn||kn===Mn||kn===Cn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rn=B.resolveURL(t),kn=Pn,In=e,jn(),r||Fn()},t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.styleSpec=Tt,t.symbolSize=cu,t.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},t.transformMat4=Lo,t.translate=function(t,e,r){var n,i,o,a,s,u,c,l,h,f,p,d,A=r[0],g=r[1],m=r[2];return e===t?(t[12]=e[0]*A+e[4]*g+e[8]*m+e[12],t[13]=e[1]*A+e[5]*g+e[9]*m+e[13],t[14]=e[2]*A+e[6]*g+e[10]*m+e[14],t[15]=e[3]*A+e[7]*g+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=p,t[11]=d,t[12]=n*A+s*g+h*m+e[12],t[13]=i*A+u*g+f*m+e[13],t[14]=o*A+c*g+p*m+e[14],t[15]=a*A+l*g+d*m+e[15]),t},t.triggerPluginCompletionEvent=Ln,t.uniqueId=p,t.validateCustomStyleLayer=function(t){var e=[],r=t.id;return void 0===r&&e.push({message:"layers."+r+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+r+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+r+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateLight=an,t.validateStyle=on,t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.vectorTile=Ga,t.version="1.6.1",t.warnOnce=x,t.webpSupported=z,t.window=self,t.wrap=l})),n(0,(function(t){function e(t){var r=typeof t;if("number"===r||"boolean"===r||"string"===r||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var n="[",i=0,o=t;i<o.length;i+=1)n+=e(o[i])+",";return n+"]"}for(var a=Object.keys(t).sort(),s="{",u=0;u<a.length;u++)s+=JSON.stringify(a[u])+":"+e(t[a[u]])+",";return s+"}"}function r(r){for(var n="",i=0,o=t.refProperties;i<o.length;i+=1)n+="/"+e(r[o[i]]);return n}var n=function(t){this.keyCache={},t&&this.replace(t)};n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var i=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var u=this._layers[s.id]=t.createStyleLayer(s);u._featureFilter=t.featureFilter(u.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var c=0,l=n;c<l.length;c+=1){var h=l[c];delete this.keyCache[h],delete this._layerConfigs[h],delete this._layers[h]}this.familiesBySource={};for(var f=0,p=function(t,e){for(var n={},i=0;i<t.length;i++){var o=e&&e[t[i].id]||r(t[i]);e&&(e[t[i].id]=o);var a=n[o];a||(a=n[o]=[]),a.push(t[i])}var s=[];for(var u in n)s.push(n[u]);return s}(t.values(this._layerConfigs),this.keyCache);f<p.length;f+=1){var d=p[f].map((function(t){return i._layers[t.id]})),A=d[0];if("none"!==A.visibility){var g=A.source||"",m=this.familiesBySource[g];m||(m=this.familiesBySource[g]={});var y=A.sourceLayer||"_geojsonTileLayer",v=m[y];v||(v=m[y]=[]),v.push(d)}}};var i=function(e){var r={},n=[];for(var i in e){var o=e[i],a=r[i]={};for(var s in o){var u=o[+s];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var c={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(c),a[s]={rect:c,metrics:u.metrics}}}}var l=t.potpack(n),h=l.w,f=l.h,p=new t.AlphaImage({width:h||1,height:f||1});for(var d in e){var A=e[d];for(var g in A){var m=A[+g];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var y=r[d][g].rect;t.AlphaImage.copy(m.bitmap,p,{x:0,y:0},{x:y.x+1,y:y.y+1},m.bitmap)}}}this.image=p,this.positions=r};t.register("GlyphAtlas",i);var o=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies};function a(e,r,n){for(var i=new t.EvaluationParameters(r),o=0,a=e;o<a.length;o+=1)a[o].recalculate(i,n)}o.prototype.parse=function(e,r,n,o,s){var u=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var c=new t.DictionaryCoder(Object.keys(e.layers).sort()),l=new t.FeatureIndex(this.tileID);l.bucketLayerIDs=[];var h,f,p,d,A={},g={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},m=r.familiesBySource[this.source];for(var y in m){var v=e.layers[y];if(v){1===v.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+y+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var _=c.encode(y),b=[],x=0;x<v.length;x++){var w=v.feature(x);b.push({feature:w,index:x,sourceLayerIndex:_})}for(var E=0,S=m[y];E<S.length;E+=1){var O=S[E],T=O[0];T.minzoom&&this.zoom<Math.floor(T.minzoom)||T.maxzoom&&this.zoom>=T.maxzoom||"none"!==T.visibility&&(a(O,this.zoom,n),(A[T.id]=T.createBucket({index:l.bucketLayerIDs.length,layers:O,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceID:this.source})).populate(b,g),l.bucketLayerIDs.push(O.map((function(t){return t.id}))))}}}var P=t.mapObject(g.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(P).length?o.send("getGlyphs",{uid:this.uid,stacks:P},(function(t,e){h||(h=t,f=e,I.call(u))})):f={};var M=Object.keys(g.iconDependencies);M.length?o.send("getImages",{icons:M,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,p=e,I.call(u))})):p={};var C=Object.keys(g.patternDependencies);function I(){if(h)return s(h);if(f&&p&&d){var e=new i(f),r=new t.ImageAtlas(p,d);for(var o in A){var u=A[o];u instanceof t.SymbolBucket?(a(u.layers,this.zoom,n),t.performSymbolLayout(u,f,e.positions,p,r.iconPositions,this.showCollisionBoxes)):u.hasPattern&&(u instanceof t.LineBucket||u instanceof t.FillBucket||u instanceof t.FillExtrusionBucket)&&(a(u.layers,this.zoom,n),u.addFeatures(g,r.patternPositions))}this.status="done",s(null,{buckets:t.values(A).filter((function(t){return!t.isEmpty()})),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}}C.length?o.send("getImages",{icons:C,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,d=e,I.call(u))})):d={},I.call(this)};var s="undefined"!=typeof performance,u={getEntriesByName:function(t){return!!(s&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(s&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(s&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(s&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(s&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},c=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},u.mark(this._marks.start)};function l(e,r){var n=t.getArrayBuffer(e.request,(function(e,n,i,o){e?r(e):n&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:i,expires:o})}));return function(){n.cancel(),r()}}c.prototype.finish=function(){u.mark(this._marks.end);var t=u.getEntriesByName(this._marks.measure);return 0===t.length&&(u.measure(this._marks.measure,this._marks.start,this._marks.end),t=u.getEntriesByName(this._marks.measure),u.clearMarks(this._marks.start),u.clearMarks(this._marks.end),u.clearMeasures(this._marks.measure)),t},u.Performance=c;var h=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||l,this.loading={},this.loaded={}};h.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new u.Performance(e.request),s=this.loading[i]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete n.loading[i],e||!o)return s.status="done",n.loaded[i]=s,r(e);var u=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl);var l={};if(a){var h=a.finish();h&&(l.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:u.slice(0)},n,c,l))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},h.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,o=this;if(n&&n[i]){var a=n[i];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=a.reloadCallback;i&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,r.availableImages,o.actor,i)),e(t,n)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},h.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},h.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var f=function(){this.loaded={}};f.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=e.rawImageData,a=new t.DEMData(n,o,i);this.loaded=this.loaded||{},this.loaded[n]=a,r(null,a)},f.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var p=6378137;function d(t){var e=0;if(t&&t.length>0){e+=Math.abs(A(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(A(t[r]))}return e}function A(t){var e,r,n,i,o,a,s=0,u=t.length;if(u>2){for(a=0;a<u;a++)a===u-2?(n=u-2,i=u-1,o=0):a===u-1?(n=u-1,i=0,o=1):(n=a,i=a+1,o=a+2),e=t[n],r=t[i],s+=(g(t[o][0])-g(e[0]))*Math.sin(g(r[1]));s=s*p*p/2}return s}function g(t){return t*Math.PI/180}var m={geometry:function t(e){var r,n=0;switch(e.type){case"Polygon":return d(e.coordinates);case"MultiPolygon":for(r=0;r<e.coordinates.length;r++)n+=d(e.coordinates[r]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(r=0;r<e.geometries.length;r++)n+=t(e.geometries[r]);return n}},ring:A};function y(t,e){return function(r){return t(r,e)}}function v(t,e){e=!!e,t[0]=_(t[0],e);for(var r=1;r<t.length;r++)t[r]=_(t[r],!e);return t}function _(t,e){return function(t){return m.ring(t)>=0}(t)===e?t:t.reverse()}var b=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,x=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};x.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r<n.length;r+=1){var i=n[r];e.push([new t.Point$1(i[0],i[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var u=[],c=0,l=s[a];c<l.length;c+=1){var h=l[c];u.push(new t.Point$1(h[0],h[1]))}o.push(u)}return o},x.prototype.toGeoJSON=function(t,e,r){return b.call(this,t,e,r)};var w=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};w.prototype.feature=function(t){return new x(this._features[t])};var E=t.vectorTile.VectorTileFeature,S=O;function O(t,e){this.options=e||{},this.features=t,this.length=t.length}function T(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}O.prototype.feature=function(t){return new T(this.features[t],this.options.extent)},T.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var n=e[r],i=[],o=0;o<n.length;o++)i.push(new t.Point$1(n[o][0],n[o][1]));this.geometry.push(i)}return this.geometry},T.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var u=a[s];e=Math.min(e,u.x),r=Math.max(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.y)}return[e,n,r,i]},T.prototype.toGeoJSON=E.prototype.toGeoJSON;var P=I,M=I,C=S;function I(e){var r=new t.pbf;return function(t,e){for(var r in t.layers)e.writeMessage(3,k,t.layers[r])}(e,r),r.finish()}function k(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,R,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,F,o[r])}function R(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,L,t),e.writeVarintField(3,r.type),e.writeMessage(4,B,r)}function L(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var u=o[s];void 0===u&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=r.properties[s],l=typeof c;"string"!==l&&"boolean"!==l&&"number"!==l&&(c=JSON.stringify(c));var h=l+":"+c,f=a[h];void 0===f&&(i.push(c),f=i.length-1,a[h]=f),e.writeVarint(f)}}function j(t,e){return(e<<3)+(7&t)}function D(t){return t<<1^t>>31}function B(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var u=r[s],c=1;1===n&&(c=u.length),e.writeVarint(j(1,c));for(var l=3===n?u.length-1:u.length,h=0;h<l;h++){1===h&&1!==n&&e.writeVarint(j(2,l-1));var f=u[h].x-i,p=u[h].y-o;e.writeVarint(D(f)),e.writeVarint(D(p)),i+=f,o+=p}3===n&&e.writeVarint(j(7,1))}}function F(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function z(t,e,r,n){N(t,r,n),N(e,2*r,2*n),N(e,2*r+1,2*n+1)}function N(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function U(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}P.fromVectorTileJs=M,P.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new S(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return I({layers:r})},P.GeoJSONWrapper=C;var V=function(t){return t[0]},G=function(t){return t[1]},W=function(t,e,r,n,i){void 0===e&&(e=V),void 0===r&&(r=G),void 0===n&&(n=64),void 0===i&&(i=Float64Array),this.nodeSize=n,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new i(2*t.length),u=0;u<t.length;u++)a[u]=u,s[2*u]=e(t[u]),s[2*u+1]=r(t[u]);!function t(e,r,n,i,o,a){if(!(o-i<=n)){var s=i+o>>1;!function t(e,r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,c=Math.log(s),l=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*l*(s-l)/s)*(u-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-u*l/s+h)),Math.min(o,Math.floor(n+(s-u)*l/s+h)),a)}var f=r[2*n+a],p=i,d=o;for(z(e,r,i,n),r[2*o+a]>f&&z(e,r,i,o);p<d;){for(z(e,r,p,d),p++,d--;r[2*p+a]<f;)p++;for(;r[2*d+a]>f;)d--}r[2*i+a]===f?z(e,r,i,d):z(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}}(a,s,n,0,a.length-1,0)};W.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,o,a){for(var s,u,c=[0,t.length-1,0],l=[];c.length;){var h=c.pop(),f=c.pop(),p=c.pop();if(f-p<=a)for(var d=p;d<=f;d++)s=e[2*d],u=e[2*d+1],s>=r&&s<=i&&u>=n&&u<=o&&l.push(t[d]);else{var A=Math.floor((p+f)/2);s=e[2*A],u=e[2*A+1],s>=r&&s<=i&&u>=n&&u<=o&&l.push(t[A]);var g=(h+1)%2;(0===h?r<=s:n<=u)&&(c.push(p),c.push(A-1),c.push(g)),(0===h?i>=s:o>=u)&&(c.push(A+1),c.push(f),c.push(g))}}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)},W.prototype.within=function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],u=i*i;a.length;){var c=a.pop(),l=a.pop(),h=a.pop();if(l-h<=o)for(var f=h;f<=l;f++)U(e[2*f],e[2*f+1],r,n)<=u&&s.push(t[f]);else{var p=Math.floor((h+l)/2),d=e[2*p],A=e[2*p+1];U(d,A,r,n)<=u&&s.push(t[p]);var g=(c+1)%2;(0===c?r-i<=d:n-i<=A)&&(a.push(h),a.push(p-1),a.push(g)),(0===c?r+i>=d:n+i>=A)&&(a.push(p+1),a.push(l),a.push(g))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var H={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},q=function(t){this.options=J(Object.create(H),t),this.trees=new Array(this.options.maxZoom+1)};function Z(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function X(t,e){var r=t.geometry.coordinates,n=r[0],i=r[1];return{x:K(n),y:$(i),zoom:1/0,index:e,parentId:-1}}function Q(t){return{type:"Feature",id:t.id,properties:Y(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function Y(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return J(J({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function K(t){return t/360+.5}function $(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function J(t,e){for(var r in e)t[r]=e[r];return t}function tt(t){return t.x}function et(t){return t.y}function rt(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var u=((t-r)*a+(e-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return(a=t-r)*a+(s=e-n)*s}function nt(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)it(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)it(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)it(t,e[n][i])}(i),i}function it(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function ot(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],u=e.id;if(r.promoteId?u=e.properties[r.promoteId]:r.generateId&&(u=n||0),"Point"===o)at(i,s);else if("MultiPoint"===o)for(var c=0;c<i.length;c++)at(i[c],s);else if("LineString"===o)st(i,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(c=0;c<i.length;c++)s=[],st(i[c],s,a,!1),t.push(nt(u,"LineString",s,e.properties));return}ut(i,s,a,!1)}else if("Polygon"===o)ut(i,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)ot(t,{id:u,geometry:e.geometry.geometries[c],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<i.length;c++){var l=[];ut(i[c],l,a,!0),s.push(l)}}t.push(nt(u,o,s,e.properties))}}function at(t,e){e.push(ct(t[0])),e.push(lt(t[1])),e.push(0)}function st(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var u=ct(t[s][0]),c=lt(t[s][1]);e.push(u),e.push(c),e.push(0),s>0&&(a+=n?(i*c-u*o)/2:Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}var l=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=n-r>>1,u=n-r,c=e[r],l=e[r+1],h=e[n],f=e[n+1],p=r+3;p<n;p+=3){var d=rt(e[p],e[p+1],c,l,h,f);if(d>a)o=p,a=d;else if(d===a){var A=Math.abs(p-s);A<u&&(o=p,u=A)}}a>i&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,l,r),e[l+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function ut(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];st(t[i],o,r,n),e.push(o)}}function ct(t){return t/360+.5}function lt(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function ht(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a<n)return t;if(a<r||o>=n)return null;for(var u=[],c=0;c<t.length;c++){var l=t[c],h=l.geometry,f=l.type,p=0===i?l.minX:l.minY,d=0===i?l.maxX:l.maxY;if(p>=r&&d<n)u.push(l);else if(!(d<r||p>=n)){var A=[];if("Point"===f||"MultiPoint"===f)ft(h,A,r,n,i);else if("LineString"===f)pt(h,A,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===f)At(h,A,r,n,i,!1);else if("Polygon"===f)At(h,A,r,n,i,!0);else if("MultiPolygon"===f)for(var g=0;g<h.length;g++){var m=[];At(h[g],m,r,n,i,!0),m.length&&A.push(m)}if(A.length){if(s.lineMetrics&&"LineString"===f){for(g=0;g<A.length;g++)u.push(nt(l.id,f,A[g],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===A.length?(f="LineString",A=A[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===A.length?"Point":"MultiPoint"),u.push(nt(l.id,f,A,l.tags))}}}return u.length?u:null}function ft(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function pt(t,e,r,n,i,o,a){for(var s,u,c=dt(t),l=0===i?mt:yt,h=t.start,f=0;f<t.length-3;f+=3){var p=t[f],d=t[f+1],A=t[f+2],g=t[f+3],m=t[f+4],y=0===i?p:d,v=0===i?g:m,_=!1;a&&(s=Math.sqrt(Math.pow(p-g,2)+Math.pow(d-m,2))),y<r?v>r&&(u=l(c,p,d,g,m,r),a&&(c.start=h+s*u)):y>n?v<n&&(u=l(c,p,d,g,m,n),a&&(c.start=h+s*u)):gt(c,p,d,A),v<r&&y>=r&&(u=l(c,p,d,g,m,r),_=!0),v>n&&y<=n&&(u=l(c,p,d,g,m,n),_=!0),!o&&_&&(a&&(c.end=h+s*u),e.push(c),c=dt(t)),a&&(h+=s)}var b=t.length-3;p=t[b],d=t[b+1],A=t[b+2],(y=0===i?p:d)>=r&&y<=n&&gt(c,p,d,A),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&gt(c,c[0],c[1],c[2]),c.length&&e.push(c)}function dt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function At(t,e,r,n,i,o){for(var a=0;a<t.length;a++)pt(t[a],e,r,n,i,o,!1)}function gt(t,e,r,n){t.push(e),t.push(r),t.push(n)}function mt(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function yt(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function vt(t,e){for(var r=[],n=0;n<t.length;n++){var i,o=t[n],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=_t(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var s=0;s<o.geometry.length;s++)i.push(_t(o.geometry[s],e))}else if("MultiPolygon"===a)for(i=[],s=0;s<o.geometry.length;s++){for(var u=[],c=0;c<o.geometry[s].length;c++)u.push(_t(o.geometry[s][c],e));i.push(u)}r.push(nt(o.id,a,i,o.tags))}return r}function _t(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function bt(t,e){if(t.transformed)return t;var r,n,i,o=1<<t.z,a=t.x,s=t.y;for(r=0;r<t.features.length;r++){var u=t.features[r],c=u.geometry,l=u.type;if(u.geometry=[],1===l)for(n=0;n<c.length;n+=2)u.geometry.push(xt(c[n],c[n+1],e,o,a,s));else for(n=0;n<c.length;n++){var h=[];for(i=0;i<c[n].length;i+=2)h.push(xt(c[n][i],c[n][i+1],e,o,a,s));u.geometry.push(h)}}return t.transformed=!0,t}function xt(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function wt(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,Et(a,t[s],o,i);var u=t[s].minX,c=t[s].minY,l=t[s].maxX,h=t[s].maxY;u<a.minX&&(a.minX=u),c<a.minY&&(a.minY=c),l>a.maxX&&(a.maxX=l),h>a.maxY&&(a.maxY=h)}return a}function Et(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)St(a,i,t,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<i.length;s++)St(a,i[s],t,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var u=0;u<i.length;u++){var c=i[u];for(s=0;s<c.length;s++)St(a,c[s],t,r,!0,0===s)}if(a.length){var l=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var h in l={},e.tags)l[h]=e.tags[h];l.mapbox_clip_start=i.start/i.size,l.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:l};null!==e.id&&(f.id=e.id),t.features.push(f)}}function St(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],u=0;u<e.length;u+=3)(0===n||e[u+2]>a)&&(r.numSimplified++,s.push(e[u]),s.push(e[u+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}(s,o),t.push(s)}}function Ot(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)ot(r,t.features[n],e,n);else"Feature"===t.type?ot(r,t,e):ot(r,{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var r=e.buffer/e.extent,n=t,i=ht(t,1,-1-r,r,0,-1,2,e),o=ht(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=ht(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=vt(i,1).concat(n)),o&&(n=n.concat(vt(o,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Tt(t,e,r){return 32*((1<<t)*r+e)+t}function Pt(t,e){var r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);var i=new w(n.features),o=P(i);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}q.prototype.load=function(t){var e=this.options,r=e.log,n=e.minZoom,i=e.maxZoom,o=e.nodeSize;r&&console.time("total time");var a="prepare "+t.length+" points";r&&console.time(a),this.points=t;for(var s=[],u=0;u<t.length;u++)t[u].geometry&&s.push(X(t[u],u));this.trees[i+1]=new W(s,tt,et,o,Float32Array),r&&console.timeEnd(a);for(var c=i;c>=n;c--){var l=+Date.now();s=this._cluster(s,c),this.trees[c]=new W(s,tt,et,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",c,s.length,+Date.now()-l)}return r&&console.timeEnd("total time"),this},q.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var a=this.getClusters([r,n,180,o],e),s=this.getClusters([-180,n,i,o],e);return a.concat(s)}for(var u=this.trees[this._limitZoom(e)],c=[],l=0,h=u.range(K(r),$(o),K(i),$(n));l<h.length;l+=1){var f=h[l],p=u.points[f];c.push(p.numPoints?Q(p):this.points[p.index])}return c},q.prototype.getChildren=function(t){var e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);var o=i.points[e];if(!o)throw new Error(n);for(var a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=[],u=0,c=i.within(o.x,o.y,a);u<c.length;u+=1){var l=c[u],h=i.points[l];h.parentId===t&&s.push(h.numPoints?Q(h):this.points[h.index])}if(0===s.length)throw new Error(n);return s},q.prototype.getLeaves=function(t,e,r){e=e||10,r=r||0;var n=[];return this._appendLeaves(n,t,e,r,0),n},q.prototype.getTile=function(t,e,r){var n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),o=this.options,a=o.extent,s=o.radius/a,u=(r-s)/i,c=(r+1+s)/i,l={features:[]};return this._addTileFeatures(n.range((e-s)/i,u,(e+1+s)/i,c),n.points,e,r,i,l),0===e&&this._addTileFeatures(n.range(1-s/i,u,1,c),n.points,i,r,i,l),e===i-1&&this._addTileFeatures(n.range(0,u,s/i,c),n.points,-1,r,i,l),l.features.length?l:null},q.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e},q.prototype._appendLeaves=function(t,e,r,n,i){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],u=s.properties;if(u&&u.cluster?i+u.point_count<=n?i+=u.point_count:i=this._appendLeaves(t,u.cluster_id,r,n,i):i<n?i++:t.push(s),t.length===r)break}return i},q.prototype._addTileFeatures=function(t,e,r,n,i,o){for(var a=0,s=t;a<s.length;a+=1){var u=e[s[a]],c=u.numPoints,l={type:1,geometry:[[Math.round(this.options.extent*(u.x*i-r)),Math.round(this.options.extent*(u.y*i-n))]],tags:c?Y(u):this.points[u.index].properties},h=void 0;c?h=u.id:this.options.generateId?h=u.index:this.points[u.index].id&&(h=this.points[u.index].id),void 0!==h&&(l.id=h),o.features.push(l)}},q.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(t,this.options.maxZoom+1))},q.prototype._cluster=function(t,e){for(var r=[],n=this.options,i=n.radius,o=n.extent,a=n.reduce,s=i/(o*Math.pow(2,e)),u=0;u<t.length;u++){var c=t[u];if(!(c.zoom<=e)){c.zoom=e;for(var l=this.trees[e+1],h=l.within(c.x,c.y,s),f=c.numPoints||1,p=c.x*f,d=c.y*f,A=a&&f>1?this._map(c,!0):null,g=(u<<5)+(e+1)+this.points.length,m=0,y=h;m<y.length;m+=1){var v=y[m],_=l.points[v];if(!(_.zoom<=e)){_.zoom=e;var b=_.numPoints||1;p+=_.x*b,d+=_.y*b,f+=b,_.parentId=g,a&&(A||(A=this._map(c,!0)),a(A,this._map(_)))}}1===f?r.push(c):(c.parentId=g,r.push(Z(p/f,d/f,g,f,A)))}}return r},q.prototype._getOriginId=function(t){return t-this.points.length>>5},q.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},q.prototype._map=function(t,e){if(t.numPoints)return e?J({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?J({},n):n},Ot.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ot.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],u=this.options,c=u.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var l=1<<e,h=Tt(e,r,n),f=this.tiles[h];if(!f&&(c>1&&console.time("creation"),f=this.tiles[h]=wt(t,e,r,n,u),this.tileCoords.push({z:e,x:r,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(f.source=t,i){if(e===u.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(o/d)||n!==Math.floor(a/d))continue}else if(e===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue;if(f.source=null,0!==t.length){c>1&&console.time("clipping");var A,g,m,y,v,_,b=.5*u.buffer/u.extent,x=.5-b,w=.5+b,E=1+b;A=g=m=y=null,v=ht(t,l,r-b,r+w,0,f.minX,f.maxX,u),_=ht(t,l,r+x,r+E,0,f.minX,f.maxX,u),t=null,v&&(A=ht(v,l,n-b,n+w,1,f.minY,f.maxY,u),g=ht(v,l,n+x,n+E,1,f.minY,f.maxY,u),v=null),_&&(m=ht(_,l,n-b,n+w,1,f.minY,f.maxY,u),y=ht(_,l,n+x,n+E,1,f.minY,f.maxY,u),_=null),c>1&&console.timeEnd("clipping"),s.push(A||[],e+1,2*r,2*n),s.push(g||[],e+1,2*r,2*n+1),s.push(m||[],e+1,2*r+1,2*n),s.push(y||[],e+1,2*r+1,2*n+1)}}},Ot.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t,s=Tt(t,e=(e%a+a)%a,r);if(this.tiles[s])return bt(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var u,c=t,l=e,h=r;!u&&c>0;)c--,l=Math.floor(l/2),h=Math.floor(h/2),u=this.tiles[Tt(c,l,h)];return u&&u.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,l,h),o>1&&console.time("drilling down"),this.splitTile(u.source,c,l,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?bt(this.tiles[s],i):null):null};var Mt=function(e){function r(t,r,n,i){e.call(this,t,r,n,Pt),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new u.Performance(n.request);this.loadGeoJSON(n,(function(o,a){if(o||!a)return r(o);if("object"!=typeof a)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(y(t,r)),e;case"GeometryCollection":return e.geometries=e.geometries.map(y(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=v(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(y(v,e))),t}(e,r);default:return e}}(a,!0);try{e._geoJSONIndex=n.cluster?new q(function(e){var r=e.superclusterOptions,n=e.clusterProperties;if(!n||!r)return r;for(var i={},o={},a={accumulated:null,zoom:0},s={properties:null},u=Object.keys(n),c=0,l=u;c<l.length;c+=1){var h=l[c],f=n[h],p=f[0],d=f[1],A=t.createExpression(d),g=t.createExpression("string"==typeof p?[p,["accumulated"],["get",h]]:p);i[h]=A.value,o[h]=g.value}return r.map=function(t){s.properties=t;for(var e={},r=0,n=u;r<n.length;r+=1){var o=n[r];e[o]=i[o].evaluate(a,s)}return e},r.reduce=function(t,e){s.properties=e;for(var r=0,n=u;r<n.length;r+=1){var i=n[r];a.accumulated=t[i],t[i]=o[i].evaluate(a,s)}},r}(n)).load(a.features):function(t,e){return new Ot(t,e)}(a,n.geojsonVtOptions)}catch(o){return r(o)}e.loaded={};var s={};if(i){var u=i.finish();u&&(s.resourceTiming={},s.resourceTiming[n.source]=JSON.parse(JSON.stringify(u)))}r(null,s)}))}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded,i=t.uid;return n&&n[i]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r.prototype.getClusterExpansionZoom=function(t,e){e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))},r.prototype.getClusterChildren=function(t,e){e(null,this._geoJSONIndex.getChildren(t.clusterId))},r.prototype.getClusterLeaves=function(t,e){e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))},r}(h),Ct=function(e){var r=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:h,geojson:Mt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return Ct.prototype.setReferrer=function(t,e){this.referrer=e},Ct.prototype.setImages=function(t,e,r){this.availableImages[t]=e,r()},Ct.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},Ct.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},Ct.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},Ct.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},Ct.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},Ct.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},Ct.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},Ct.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},Ct.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},Ct.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},Ct.prototype.syncRTLPluginState=function(e,r,n){try{t.plugin.setState(r);var i=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=i){this.self.importScripts(i);var o=t.plugin.isParsed();n(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+i),o)}}catch(t){n(t.toString())}},Ct.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},Ct.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},Ct.prototype.getWorkerSource=function(t,e,r){var n=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){var i={send:function(e,r,i){n.actor.send(e,r,i,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](i,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][r]},Ct.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new f),this.demWorkerSources[t][e]},Ct.prototype.enforceCacheSizeLimit=function(e,r){t.enforceCacheSizeLimit(r)},"undefined"!=typeof WorkerGlobalScope&&void 0!==t.window&&t.window instanceof WorkerGlobalScope&&(t.window.worker=new Ct(t.window)),Ct})),n(0,(function(t){var e=t.createCommonjsModule((function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()&&"Uint8ClampedArray"in window&&ArrayBuffer.isView&&function(t){return void 0===r[t]&&(r[t]=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t)),r[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),r={create:function(e,r,n){var i=t.window.document.createElement(e);return void 0!==r&&(i.className=r),n&&n.appendChild(i),i},createNS:function(e,r){return t.window.document.createElementNS(e,r)}},n=t.window.document.documentElement.style;function i(t){if(!n)return t[0];for(var e=0;e<t.length;e++)if(t[e]in n)return t[e];return t[0]}var o,a=i(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){n&&a&&(o=n[a],n[a]="none")},r.enableDrag=function(){n&&a&&(n[a]=o)};var s=i(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[s]=e};var u=!1;try{var c=Object.defineProperty({},"passive",{get:function(){u=!0}});t.window.addEventListener("test",c,c),t.window.removeEventListener("test",c,c)}catch(t){u=!1}r.addEventListener=function(t,e,r,n){void 0===n&&(n={}),"passive"in n&&u?t.addEventListener(e,r,n):t.addEventListener(e,r,n.capture)},r.removeEventListener=function(t,e,r,n){void 0===n&&(n={}),"passive"in n&&u?t.removeEventListener(e,r,n):t.removeEventListener(e,r,n.capture)};var l=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",l,!0)};function h(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}r.suppressClick=function(){t.window.addEventListener("click",l,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",l,!0)}),0)},r.mousePos=function(e,r){var n=e.getBoundingClientRect(),i=t.window.TouchEvent&&r instanceof t.window.TouchEvent?r.touches[0]:r;return new t.Point(i.clientX-n.left-e.clientLeft,i.clientY-n.top-e.clientTop)},r.touchPos=function(e,r){for(var n=e.getBoundingClientRect(),i=[],o="touchend"===r.type?r.changedTouches:r.touches,a=0;a<o.length;a++)i.push(new t.Point(o[a].clientX-n.left-e.clientLeft,o[a].clientY-n.top-e.clientTop));return i},r.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var f=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e<r.length;e+=1){var n=r[e],i=n.ids,o=n.callback;this._notify(i,o)}this.requestors=[]}},r.prototype.getImage=function(t){return this.images[t]},r.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},r.prototype._validate=function(e,r){var n=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),n=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),n=!1),this._validateContent(r.content,r)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),n=!1),n},r.prototype._validateStretch=function(t,e){if(!t)return!0;for(var r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];if(o[0]<r||o[1]<o[0]||e<o[1])return!1;r=o[1]}return!0},r.prototype._validateContent=function(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))},r.prototype.updateImage=function(t,e){var r=this.images[t];e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0},r.prototype.removeImage=function(t){var e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()},r.prototype.listImages=function(){return Object.keys(this.images)},r.prototype.getImages=function(t,e){var r=!0;if(!this.isLoaded())for(var n=0,i=t;n<i.length;n+=1){var o=i[n];this.images[o]||(r=!1)}this.isLoaded()||r?this._notify(t,e):this.requestors.push({ids:t,callback:e})},r.prototype._notify=function(e,r){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];s?n[a]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:t.warnOnce('Image "'+a+'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.')}r(null,n)},r.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},r.prototype.getPattern=function(e){var r=this.patterns[e],n=this.getImage(e);if(!n)return null;if(r&&r.position.version===n.version)return r.position;if(r)r.position.version=n.version;else{var i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},o=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},r.prototype.bind=function(e){var r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)},r.prototype._updatePatternAtlas=function(){var e=[];for(var r in this.patterns)e.push(this.patterns[r].bin);var n=t.potpack(e),i=n.w,o=n.h,a=this.atlasImage;for(var s in a.resize({width:i||1,height:o||1}),this.patterns){var u=this.patterns[s].bin,c=u.x+1,l=u.y+1,h=this.images[s].data,f=h.width,p=h.height;t.RGBAImage.copy(h,a,{x:0,y:0},{x:c,y:l},{width:f,height:p}),t.RGBAImage.copy(h,a,{x:0,y:p-1},{x:c,y:l-1},{width:f,height:1}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:c,y:l+p},{width:f,height:1}),t.RGBAImage.copy(h,a,{x:f-1,y:0},{x:c-1,y:l},{width:1,height:p}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:c+f,y:l},{width:1,height:p})}this.dirty=!0},r.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},r.prototype.dispatchRenderCallbacks=function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e];if(!this.callbackDispatchedThisFrame[n]){this.callbackDispatchedThisFrame[n]=!0;var i=this.images[n];h(i)&&this.updateImage(n,i)}}},r}(t.Evented),p=g,d=g,A=1e20;function g(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function m(t,e,r,n,i,o,a){for(var s=0;s<e;s++){for(var u=0;u<r;u++)n[u]=t[u*e+s];for(y(n,i,o,a,r),u=0;u<r;u++)t[u*e+s]=i[u]}for(u=0;u<r;u++){for(s=0;s<e;s++)n[s]=t[u*e+s];for(y(n,i,o,a,e),s=0;s<e;s++)t[u*e+s]=Math.sqrt(i[s])}}function y(t,e,r,n,i){r[0]=0,n[0]=-A,n[1]=+A;for(var o=1,a=0;o<i;o++){for(var s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);s<=n[a];)a--,s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);r[++a]=o,n[a]=s,n[a+1]=+A}for(o=0,a=0;o<i;o++){for(;n[a+1]<o;)a++;e[o]=(o-r[a])*(o-r[a])+t[r[a]]}}g.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),r=new Uint8ClampedArray(this.size*this.size),n=0;n<this.size*this.size;n++){var i=e.data[4*n+3]/255;this.gridOuter[n]=1===i?0:0===i?A:Math.pow(Math.max(0,.5-i),2),this.gridInner[n]=1===i?A:0===i?0:Math.pow(Math.max(0,i-.5),2)}for(m(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),m(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),n=0;n<this.size*this.size;n++){var o=this.gridOuter[n]-this.gridInner[n];r[n]=Math.max(0,Math.min(255,Math.round(255-255*(o/this.radius+this.cutoff))))}return r},p.default=d;var v=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};v.prototype.setURL=function(t){this.url=t},v.prototype.getGlyphs=function(e,r){var n=this,i=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1){var u=s[a];i.push({stack:o,id:u})}t.asyncAll(i,(function(t,e){var r=t.stack,i=t.id,o=n.entries[r];o||(o=n.entries[r]={glyphs:{},requests:{}});var a=o.glyphs[i];if(void 0===a){if(a=n._tinySDF(o,r,i))return o.glyphs[i]=a,void e(null,{stack:r,id:i,glyph:a});var s=Math.floor(i/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else{var u=o.requests[s];u||(u=o.requests[s]=[],v.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e)for(var r in e)n._doesCharSupportLocalGlyph(+r)||(o.glyphs[+r]=e[+r]);for(var i=0,a=u;i<a.length;i+=1)(0,a[i])(t,e);delete o.requests[s]}))),u.push((function(t,n){t?e(t):n&&e(null,{stack:r,id:i,glyph:n[i]||null})}))}}else e(null,{stack:r,id:i,glyph:a})}),(function(t,e){if(t)r(t);else if(e){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.stack,u=a.id,c=a.glyph;(n[s]||(n[s]={}))[u]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics}}r(null,n)}}))},v.prototype._doesCharSupportLocalGlyph=function(e){return!!this.localIdeographFontFamily&&(t.isChar["CJK Unified Ideographs"](e)||t.isChar["Hangul Syllables"](e)||t.isChar.Hiragana(e)||t.isChar.Katakana(e))},v.prototype._tinySDF=function(e,r,n){var i=this.localIdeographFontFamily;if(i&&this._doesCharSupportLocalGlyph(n)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),o=e.tinySDF=new v.TinySDF(24,3,8,.25,i,a)}return{id:n,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(n))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},v.loadGlyphRange=function(e,r,n,i,o){var a=256*r,s=a+255,u=i.transformRequest(i.normalizeGlyphsURL(n).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(u,(function(e,r){if(e)o(e);else if(r){for(var n={},i=0,a=t.parseGlyphPBF(r);i<a.length;i+=1){var s=a[i];n[s.id]=s}o(null,n)}}))},v.TinySDF=p;var _=function(){this.specification=t.styleSpec.light.position};_.prototype.possiblyEvaluate=function(e,r){return t.sphericalToCartesian(e.expression.evaluate(r))},_.prototype.interpolate=function(e,r,n){return{x:t.number(e.x,r.x,n),y:t.number(e.y,r.y,n),z:t.number(e.z,r.z,n)}};var b=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new _,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),x=function(e){function r(r){e.call(this),this._transitionable=new t.Transitionable(b),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getLight=function(){return this._transitionable.serialize()},r.prototype.setLight=function(e,r){if(void 0===r&&(r={}),!this._validate(t.validateLight,e,r))for(var n in e){var i=e[n];t.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-"-transition".length),i):this._transitionable.setValue(n,i)}},r.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},r.prototype.hasTransition=function(){return this._transitioning.hasTransition()},r.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},r.prototype._validate=function(e,r,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},r}(t.Evented),w=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}};w.prototype.getDash=function(t,e){var r=t.join(",")+String(e);return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},w.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];for(var s=this.width/o,u=s/2,c=e.length%2==1,l=-n;l<=n;l++)for(var h=this.nextRow+n+l,f=this.width*h,p=c?-e[e.length-1]:0,d=e[0],A=1,g=0;g<this.width;g++){for(;d<g/s;)p=d,d+=e[A],c&&A===e.length-1&&(d+=e[0]),A++;var m=Math.abs(g-p*s),y=Math.abs(g-d*s),v=Math.min(m,y),_=A%2==1,b=void 0;if(r){var x=n?l/n*(u+1):0;if(_){var w=u-Math.abs(x);b=Math.sqrt(v*v+w*w)}else b=u-Math.sqrt(v*v+x*x)}else b=(_?1:-1)*v;this.data[3+4*(f+g)]=Math.max(0,Math.min(255,b+128))}var E={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=i,this.dirty=!0,E},w.prototype.bind=function(t){var e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.RGBA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,this.data))};var E=function e(r,n){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var i=this.workerPool.acquire(this.id),o=0;o<i.length;o++){var a=i[o],s=new e.Actor(a,n,this.id);s.name="Worker "+o,this.actors.push(s)}};function S(e,r,n){var i=function(i,o){if(i)return n(i);if(o){var a=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),e.url&&(a.tiles=r.canonicalizeTileset(a,e.url)),n(null,a)}};return e.url?t.getJSON(r.transformRequest(r.normalizeSourceURL(e.url),t.ResourceType.Source),i):t.browser.frame((function(){return i(null,e)}))}E.prototype.broadcast=function(e,r,n){n=n||function(){},t.asyncAll(this.actors,(function(t,n){t.send(e,r,n)}),n)},E.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},E.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},E.Actor=t.Actor;var O=function(e,r,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=r||0,this.maxzoom=n||24};O.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},O.prototype.contains=function(e){var r=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*r),i=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*r),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*r),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*r);return e.x>=n&&e.x<o&&e.y>=i&&e.y<a};var T=function(e){function r(r,n,i,o){if(e.call(this),this.id=r,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(n,["url","scheme","tileSize"])),this._options=t.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new O(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(n.tiles,e.map._getMapId(),e.map._requestManager._skuToken,e.map._requestManager._customAccessToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url,null),i={request:this.map._requestManager.transformRequest(n,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};function o(n,i){return delete e.request,e.aborted?r(null):n&&404!==n.status?r(n):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),r(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=r:e.request=e.actor.send("reloadTile",i,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,o.bind(this)))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.unloadTile=function(t){t.unloadVectorData(),t.clearMask(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.hasTransition=function(){return!1},r}(t.Evented),P=function(e){function r(r,n,i,o){e.call(this),this.id=r,this.dispatcher=i,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},n),t.extend(this,t.pick(n,["url","scheme","tileSize"]))}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new O(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles),t.postMapLoadEvent(n.tiles,e.map._getMapId(),e.map._requestManager._skuToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.loadTile=function(e,r){var n=this,i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url,this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),(function(i,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(i)e.state="errored",r(i);else if(o){n.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=n.map.painter.context,s=a.gl;e.texture=n.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(n.dispatcher),r(null)}}))},r.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},r.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),t.clearMask(),e()},r.prototype.hasTransition=function(){return!1},r}(t.Evented),M=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url,this.tileSize);function i(t,n){t&&(e.state="errored",r(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.state="loaded",r(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(n)e.state="errored",r(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=t.browser.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,i.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},r.prototype._getNeighboringTiles=function(e){var r=e.canonical,n=Math.pow(2,r.z),i=(r.x-1+n)%n,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+n)%n,s=r.x+1===n?e.wrap+1:e.wrap,u={};return u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<n&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),u},r.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.clearMask(),t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})},r}(P),C=function(e){function r(r,n,i,o){e.call(this),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(o),this._data=n.data,this._options=t.extend({},n),this._collectResourceTiming=n.collectResourceTiming,this._resourceTiming=[],void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution);var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*a,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?Math.min(n.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,extent:t.EXTENT,radius:(n.clusterRadius||50)*a,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties},n.workerOptions)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(r){if(r)e.fire(new t.ErrorEvent(r));else{var n={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor;var o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.request=this.actor.send(i,o,(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),t.clearMask(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),I=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,o){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):o&&(n.image=o,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var u=s[a];r=Math.min(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.x),o=Math.max(o,u.y)}var c=i-r,l=o-n,h=Math.max(c,l),f=Math.max(0,Math.floor(-Math.log(h)/Math.LN2)),p=Math.pow(2,f);return new t.CanonicalTileID(f,Math.floor((r+i)/2*p),Math.floor((n+o)/2*p))}(n),this.minzoom=this.maxzoom=this.tileID.z;var i=n.map((function(t){return r.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},r.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},r.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return!1},r}(t.Evented),k=function(e){function r(t,r,n,i){e.call(this,t,r,n,i),this.roundZoom=!0,this.type="video",this.options=r}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1;var r=this.options;this.urls=[];for(var n=0,i=r.urls;n<i.length;n+=1){var o=i[n];this.urls.push(this.map._requestManager.transformRequest(o,t.ResourceType.Source).url)}t.getVideo(this.urls,(function(r,n){e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(e.video=n,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},r.prototype.pause=function(){this.video&&this.video.pause()},r.prototype.play=function(){this.video&&this.video.play()},r.prototype.seek=function(e){if(this.video){var r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(I),R=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[i];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var r=e[t];if(isNaN(r)||r<=0)return!0}return!1},r}(I),L={vector:T,raster:P,"raster-dem":M,geojson:C,video:k,image:I,canvas:R};function j(e,r){var n=t.identity([]);return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(r.toUnwrapped()))}function D(t,e,r,n,i){var o=function(t,e,r){if(t)for(var n=0,i=t;n<i.length;n+=1){var o=e[i[n]];if(o&&o.source===r&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===r&&"fill-extrusion"===s.type)return!0}return!1}(n&&n.layers,e,t.id),a=i.maxPitchScaleFactor(),s=t.tilesIn(r,a,o);s.sort(B);for(var u=[],c=0,l=s;c<l.length;c+=1){var h=l[c];u.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,t._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,n,i,a,j(t.transform,h.tileID))})}var f=function(t){for(var e={},r={},n=0,i=t;n<i.length;n+=1){var o=i[n],a=o.queryResults,s=o.wrappedTileID,u=r[s]=r[s]||{};for(var c in a)for(var l=a[c],h=u[c]=u[c]||{},f=e[c]=e[c]||[],p=0,d=l;p<d.length;p+=1){var A=d[p];h[A.featureIndex]||(h[A.featureIndex]=!0,f.push(A))}}return e}(u);for(var p in f)f[p].forEach((function(e){var r=e.feature,n=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=n}));return f}function B(t,e){var r=t.tileID,n=e.tileID;return r.overscaledZ-n.overscaledZ||r.canonical.y-n.canonical.y||r.wrap-n.wrap||r.canonical.x-n.canonical.x}var F=function(t,e){this.max=t,this.onRemove=e,this.reset()};F.prototype.reset=function(){for(var t in this.data)for(var e=0,r=this.data[t];e<r.length;e+=1){var n=r[e];n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value)}return this.data={},this.order=[],this},F.prototype.add=function(t,e,r){var n=this,i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);var o={value:e,timeout:void 0};if(void 0!==r&&(o.timeout=setTimeout((function(){n.remove(t,o)}),r)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},F.prototype.has=function(t){return t.wrapped().key in this.data},F.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},F.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},F.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},F.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},F.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},F.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n<i.length;n+=1){var o=i[n];t(o.value)||e.push(o)}for(var a=0,s=e;a<s.length;a+=1){var u=s[a];this.remove(u.value.tileID,u)}};var z=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};z.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},z.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},z.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var N={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},U=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};U.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.enableAttributes=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],i=e.attributes[n.name];void 0!==i&&t.enableVertexAttribArray(i)}},U.prototype.setVertexAttribPointers=function(t,e,r){for(var n=0;n<this.attributes.length;n++){var i=this.attributes[n],o=e.attributes[i.name];void 0!==o&&t.vertexAttribPointer(o,i.components,t[N[i.type]],!1,this.itemSize,i.offset+this.itemSize*(r||0))}},U.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var V=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};V.prototype.get=function(){return this.current},V.prototype.set=function(t){},V.prototype.getDefault=function(){return this.default},V.prototype.setDefault=function(){this.set(this.default)};var G=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},r}(V),W=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.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(V),H=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.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(V),q=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.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(V),Z=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.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(V),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.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(V),Q=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.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(V),Y=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.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(V),K=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(V),$=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.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(V),J=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(V),tt=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.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(V),et=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(V),rt=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.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(V),nt=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},r}(V),it=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.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(V),ot=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(V),at=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.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(V),st=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.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(V),ut=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.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(V),ct=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.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(V),lt=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.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(V),ht=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.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(V),ft=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.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(V),pt=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.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(V),dt=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.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(V),At=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.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(V),gt=function(t){function e(e){t.call(this,e),this.vao=e.extVertexArrayObject}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(V),mt=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.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(V),yt=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(V),vt=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.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(V),_t=function(t){function e(e,r){t.call(this,e),this.context=e,this.parent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e}(V),bt=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.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(_t),xt=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.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(_t),wt=function(t,e,r){this.context=t,this.width=e,this.height=r;var n=t.gl,i=this.framebuffer=n.createFramebuffer();this.colorAttachment=new bt(t,i),this.depthAttachment=new xt(t,i)};wt.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();e&&t.deleteTexture(e);var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r),t.deleteFramebuffer(this.framebuffer)};var Et=function(t,e,r){this.func=t,this.mask=e,this.range=r};Et.ReadOnly=!1,Et.ReadWrite=!0,Et.disabled=new Et(519,Et.ReadOnly,[0,1]);var St=function(t,e,r,n,i,o){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=o};St.disabled=new St({func:519,mask:0},0,0,7680,7680,7680);var Ot=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};Ot.disabled=new Ot(Ot.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),Ot.unblended=new Ot(Ot.Replace,t.Color.transparent,[!0,!0,!0,!0]),Ot.alphaBlended=new Ot([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Tt=function(t,e,r){this.enable=t,this.mode=e,this.frontFace=r};Tt.disabled=new Tt(!1,1029,2305),Tt.backCCW=new Tt(!0,1029,2305);var Pt=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new G(this),this.clearDepth=new W(this),this.clearStencil=new H(this),this.colorMask=new q(this),this.depthMask=new Z(this),this.stencilMask=new X(this),this.stencilFunc=new Q(this),this.stencilOp=new Y(this),this.stencilTest=new K(this),this.depthRange=new $(this),this.depthTest=new J(this),this.depthFunc=new tt(this),this.blend=new et(this),this.blendFunc=new rt(this),this.blendColor=new nt(this),this.blendEquation=new it(this),this.cullFace=new ot(this),this.cullFaceSide=new at(this),this.frontFace=new st(this),this.program=new ut(this),this.activeTexture=new ct(this),this.viewport=new lt(this),this.bindFramebuffer=new ht(this),this.bindRenderbuffer=new ft(this),this.bindTexture=new pt(this),this.bindVertexBuffer=new dt(this),this.bindElementBuffer=new At(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new gt(this),this.pixelStoreUnpack=new mt(this),this.pixelStoreUnpackPremultiplyAlpha=new yt(this),this.pixelStoreUnpackFlipY=new vt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&t.getExtension("OES_texture_half_float_linear"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query")};Pt.prototype.setDefault=function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()},Pt.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},Pt.prototype.createIndexBuffer=function(t,e){return new z(this,t,e)},Pt.prototype.createVertexBuffer=function(t,e,r){return new U(this,t,e,r)},Pt.prototype.createRenderbuffer=function(t,e,r){var n=this.gl,i=n.createRenderbuffer();return this.bindRenderbuffer.set(i),n.renderbufferStorage(n.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),i},Pt.prototype.createFramebuffer=function(t,e){return new wt(this,t,e)},Pt.prototype.clear=function(t){var e=t.color,r=t.depth,n=this.gl,i=0;e&&(i|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(i|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),n.clear(i)},Pt.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},Pt.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},Pt.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},Pt.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,Ot.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},Pt.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Mt=function(e){function r(r,n,i){var o=this;e.call(this),this.id=r,this.dispatcher=i,this.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),this.on("error",(function(){o._sourceErrored=!0})),this._source=function(e,r,n,i){var o=new L[r.type](e,r,n,i);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(r,n,i,this),this._tiles={},this._cache=new F(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},r.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},r.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},r.prototype.getSource=function(){return this._source},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},r.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},r.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},r.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},r.prototype.serialize=function(){return this._source.serialize()},r.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}},r.prototype.getIds=function(){return Object.keys(this._tiles).map(Number).sort(Ct)},r.prototype.getRenderableIds=function(e){var r=this,n=[];for(var i in this._tiles)this._isIdRenderable(+i,e)&&n.push(+i);return e?n.sort((function(e,n){var i=r._tiles[e].tileID,o=r._tiles[n].tileID,a=new t.Point(i.canonical.x,i.canonical.y)._rotate(r.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(r.transform.angle);return i.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})):n.sort(Ct)},r.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},r.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},r.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")},r.prototype._reloadTile=function(t,e){var r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))},r.prototype._tileLoaded=function(e,r,n,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new t.ErrorEvent(i,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))},r.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),r=0;r<e.length;r++){var n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){var i=this.getTileByID(n);o(t,i),o(i,t)}}function o(t,e){t.needsHillshadePrepare=!0;var r=e.tileID.canonical.x-t.tileID.canonical.x,n=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var o=this._tiles[i];if(!(n[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var u=a;u.overscaledZ>e;)if(t[(u=u.scaledTo(u.overscaledZ-1)).key]){n[a.key]=a;break}}}},r.prototype.findLoadedParent=function(t,e){for(var r=t.overscaledZ-1;r>=e;r--){var n=t.scaledTo(r);if(!n)return;var i=String(n.key),o=this._tiles[i];if(o&&o.hasData())return o;if(this._cache.has(n))return this._cache.get(n)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var n={};for(var i in this._tiles){var o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}for(var a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var u=this._tiles[s];this._setTileReloadTimer(s,u)}}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-r.maxOverzooming,this._source.minzoom),s=Math.max(o+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,o);if(It(this._source.type)){for(var c={},l={},h=0,f=Object.keys(u);h<f.length;h+=1){var p=f[h],d=u[p],A=this._tiles[p];if(A&&!(A.fadeEndTime&&A.fadeEndTime<=t.browser.now())){var g=this.findLoadedParent(d,a);g&&(this._addTile(g.tileID),c[g.tileID.key]=g.tileID),l[p]=d}}for(var m in this._retainLoadedChildren(l,o,s,u),c)u[m]||(this._coveredTiles[m]=!0,u[m]=c[m])}for(var y in u)this._tiles[y].clearFadeHold();for(var v=0,_=t.keysDifference(this._tiles,u);v<_.length;v+=1){var b=_[v],x=this._tiles[b];x.hasSymbolBuckets&&!x.holdingForFade()?x.setHoldDuration(this.map._fadeDuration):x.hasSymbolBuckets&&!x.symbolFadeFinished()||this._removeTile(b)}}},r.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},r.prototype._updateRetainedTiles=function(t,e){for(var n={},i={},o=Math.max(e-r.maxOverzooming,this._source.minzoom),a=Math.max(e+r.maxUnderzooming,this._source.minzoom),s={},u=0,c=t;u<c.length;u+=1){var l=c[u],h=this._addTile(l);n[l.key]=l,h.hasData()||e<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,e,a,n);for(var f=0,p=t;f<p.length;f+=1){var d=p[f],A=this._tiles[d.key];if(!A.hasData()){if(e+1>this._source.maxzoom){var g=d.children(this._source.maxzoom)[0],m=this.getTile(g);if(m&&m.hasData()){n[g.key]=g;continue}}else{var y=d.children(this._source.maxzoom);if(n[y[0].key]&&n[y[1].key]&&n[y[2].key]&&n[y[3].key])continue}for(var v=A.wasRequested(),_=d.overscaledZ-1;_>=o;--_){var b=d.scaledTo(_);if(i[b.key])break;if(i[b.key]=!0,!(A=this.getTile(b))&&v&&(A=this._addTile(b)),A&&(n[b.key]=b,v=A.wasRequested(),A.hasData()))break}}}return n},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout((function(){r._reloadTile(t,"expired"),delete r._timers[t]}),n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,o=[],a=this.transform;if(!a)return o;for(var s=n?a.getCameraQueryGeometry(e):e,u=e.map((function(t){return a.pointCoordinate(t)})),c=s.map((function(t){return a.pointCoordinate(t)})),l=this.getIds(),h=1/0,f=1/0,p=-1/0,d=-1/0,A=0,g=c;A<g.length;A+=1){var m=g[A];h=Math.min(h,m.x),f=Math.min(f,m.y),p=Math.max(p,m.x),d=Math.max(d,m.y)}for(var y=function(e){var n=i._tiles[l[e]];if(!n.holdingForFade()){var s=n.tileID,A=Math.pow(2,a.zoom-n.tileID.overscaledZ),g=r*n.queryPadding*t.EXTENT/n.tileSize/A,m=[s.getTilePoint(new t.MercatorCoordinate(h,f)),s.getTilePoint(new t.MercatorCoordinate(p,d))];if(m[0].x-g<t.EXTENT&&m[0].y-g<t.EXTENT&&m[1].x+g>=0&&m[1].y+g>=0){var y=u.map((function(t){return s.getTilePoint(t)})),v=c.map((function(t){return s.getTilePoint(t)}));o.push({tile:n,tileID:s,queryGeometry:y,cameraQueryGeometry:v,scale:A})}}},v=0;v<l.length;v++)y(v);return o},r.prototype.getVisibleCoordinates=function(t){for(var e=this,r=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),n=0,i=r;n<i.length;n+=1){var o=i[n];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return r},r.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(It(this._source.type))for(var e in this._tiles){var r=this._tiles[e];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.updateState(t,e,r)},r.prototype.removeFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,e,r)},r.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function Ct(t,e){return t%32-e%32||e-t}function It(t){return"raster"===t||"image"===t||"video"===t}function kt(){return new t.window.Worker(ri.workerUrl)}Mt.maxOverzooming=10,Mt.maxUnderzooming=3;var Rt=function(){this.active={}};Rt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Rt.workerCount;)this.workers.push(new kt);return this.active[t]=!0,this.workers.slice()},Rt.prototype.release=function(t){delete this.active[t],0===Object.keys(this.active).length&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)};var Lt,jt=Math.floor(t.browser.hardwareConcurrency/2);function Dt(e,r){var n={};for(var i in e)"ref"!==i&&(n[i]=e[i]);return t.refProperties.forEach((function(t){t in r&&(n[t]=r[t])})),n}function Bt(t){t=t.slice();for(var e=Object.create(null),r=0;r<t.length;r++)e[t[r].id]=t[r];for(var n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=Dt(t[n],e[t[n].ref]));return t}Rt.workerCount=Math.max(Math.min(jt,6),1);var Ft={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function zt(t,e,r){r.push({command:Ft.addSource,args:[t,e[t]]})}function Nt(t,e,r){e.push({command:Ft.removeSource,args:[t]}),r[t]=!0}function Ut(t,e,r,n){Nt(t,r,n),zt(t,e,r)}function Vt(e,r,n){var i;for(i in e[n])if(e[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;for(i in r[n])if(r[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;return!0}function Gt(e,r,n,i,o,a){var s;for(s in r=r||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}));for(s in r)r.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}))}function Wt(t){return t.id}function Ht(t,e){return t[e.id]=e,t}var qt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var o=0;o<this.xCellCount*this.yCellCount;o++)n.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};function Zt(e,r,n,i,o){var a=t.create();return r?(t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,i.angle)):t.multiply(a,i.labelPlaneMatrix,e),a}function Xt(e,r,n,i,o){if(r){var a=t.clone(e);return t.scale(a,a,[o,o,1]),n||t.rotateZ(a,a,-i.angle),a}return i.glCoordMatrix}function Qt(e,r){var n=[e.x,e.y,0,1];oe(n,n,r);var i=n[3];return{point:new t.Point(n[0]/i,n[1]/i),signedDistanceFromCamera:i}}function Yt(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function Kt(e,r,n,i,o,a,s,u){var c=i?e.textSizeData:e.iconSizeData,l=t.evaluateSizeForZoom(c,n.transform.zoom),h=[256/n.width*2+1,256/n.height*2+1],f=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();for(var p=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,A=n.transform.width/n.transform.height,g=!1,m=0;m<d.length;m++){var y=d.get(m);if(y.hidden||y.writingMode===t.WritingMode.vertical&&!g)ie(y.numGlyphs,f);else{g=!1;var v=[y.anchorX,y.anchorY,0,1];if(t.transformMat4(v,v,r),Yt(v,h)){var _=.5+v[3]/n.transform.cameraToCenterDistance*.5,b=t.evaluateSizeForFeature(c,l,y),x=s?b*_:b/_,w=new t.Point(y.anchorX,y.anchorY),E=Qt(w,o).point,S={},O=te(y,x,!1,u,r,o,a,e.glyphOffsetArray,p,f,E,w,S,A);g=O.useVertical,(O.notEnoughRoom||g||O.needsFlipping&&te(y,x,!0,u,r,o,a,e.glyphOffsetArray,p,f,E,w,S,A).notEnoughRoom)&&ie(y.numGlyphs,f)}else ie(y.numGlyphs,f)}}i?e.text.dynamicLayoutVertexBuffer.updateData(f):e.icon.dynamicLayoutVertexBuffer.updateData(f)}function $t(t,e,r,n,i,o,a,s,u,c,l,h){var f=s.glyphStartIndex+s.numGlyphs,p=s.lineStartIndex,d=s.lineStartIndex+s.lineLength,A=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(f-1),m=re(t*A,r,n,i,o,a,s.segment,p,d,u,c,l,h);if(!m)return null;var y=re(t*g,r,n,i,o,a,s.segment,p,d,u,c,l,h);return y?{first:m,last:y}:null}function Jt(e,r,n,i){return e===t.WritingMode.horizontal&&Math.abs(n.y-r.y)>Math.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.y<n.y:r.x>n.x)?{needsFlipping:!0}:null}function te(e,r,n,i,o,a,s,u,c,l,h,f,p,d){var A,g=r/24,m=e.lineOffsetX*g,y=e.lineOffsetY*g;if(e.numGlyphs>1){var v=e.glyphStartIndex+e.numGlyphs,_=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,x=$t(g,u,m,y,n,h,f,e,c,a,p,!1);if(!x)return{notEnoughRoom:!0};var w=Qt(x.first.point,s).point,E=Qt(x.last.point,s).point;if(i&&!n){var S=Jt(e.writingMode,w,E,d);if(S)return S}A=[x.first];for(var O=e.glyphStartIndex+1;O<v-1;O++)A.push(re(g*u.getoffsetX(O),m,y,n,h,f,e.segment,_,b,c,a,p,!1));A.push(x.last)}else{if(i&&!n){var T=Qt(f,o).point,P=e.lineStartIndex+e.segment+1,M=new t.Point(c.getx(P),c.gety(P)),C=Qt(M,o),I=C.signedDistanceFromCamera>0?C.point:ee(f,M,T,1,o),k=Jt(e.writingMode,T,I,d);if(k)return k}var R=re(g*u.getoffsetX(e.glyphStartIndex),m,y,n,h,f,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,p,!1);if(!R)return{notEnoughRoom:!0};A=[R]}for(var L=0,j=A;L<j.length;L+=1){var D=j[L];t.addDynamicAttributes(l,D.point,D.angle)}return{}}function ee(t,e,r,n,i){var o=Qt(t.add(t.sub(e)._unit()),i).point,a=r.sub(o);return r.add(a._mult(n/a.mag()))}function re(e,r,n,i,o,a,s,u,c,l,h,f,p){var d=i?e-r:e+r,A=d>0?1:-1,g=0;i&&(A*=-1,g=Math.PI),A<0&&(g+=Math.PI);for(var m=A>0?u+s:u+s+1,y=m,v=o,_=o,b=0,x=0,w=Math.abs(d);b+x<=w;){if((m+=A)<u||m>=c)return null;if(_=v,void 0===(v=f[m])){var E=new t.Point(l.getx(m),l.gety(m)),S=Qt(E,h);if(S.signedDistanceFromCamera>0)v=f[m]=S.point;else{var O=m-A;v=ee(0===b?a:new t.Point(l.getx(O),l.gety(O)),E,_,w-b+1,h)}}b+=x,x=_.dist(v)}var T=(w-b)/x,P=v.sub(_),M=P.mult(T)._add(_);return M._add(P._unit()._perp()._mult(n*A)),{point:M,angle:g+Math.atan2(v.y-_.y,v.x-_.x),tileDistance:p?{prevTileDistance:m-A===y?0:l.gettileUnitDistanceFromAnchor(m-A),lastSegmentViewportDistance:w-b}:null}}qt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},qt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},qt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},qt.prototype._insertBoxCell=function(t,e,r,n,i,o){this.boxCells[i].push(o)},qt.prototype._insertCircleCell=function(t,e,r,n,i,o){this.circleCells[i].push(o)},qt.prototype._query=function(t,e,r,n,i,o){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var u=0;u<this.circleKeys.length;u++){var c=this.circles[3*u],l=this.circles[3*u+1],h=this.circles[3*u+2];a.push({key:this.circleKeys[u],x1:c-h,y1:l-h,x2:c+h,y2:l+h})}return o?a.filter(o):a}var f={hitTest:i,seenUids:{box:{},circle:{}}};return this._forEachCell(t,e,r,n,this._queryCell,a,f,o),i?a.length>0:a},qt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,u=e+r;if(a<0||o>this.width||u<0||s>this.height)return!n&&[];var c=[],l={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,u,this._queryCellCircle,c,l,i),n?c.length>0:c},qt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},qt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},qt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},qt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=a.seenUids,c=this.boxCells[i];if(null!==c)for(var l=this.bboxes,h=0,f=c;h<f.length;h+=1){var p=f[h];if(!u.box[p]){u.box[p]=!0;var d=4*p;if(t<=l[d+2]&&e<=l[d+3]&&r>=l[d+0]&&n>=l[d+1]&&(!s||s(this.boxKeys[p]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[p],x1:l[d],y1:l[d+1],x2:l[d+2],y2:l[d+3]})}}}var A=this.circleCells[i];if(null!==A)for(var g=this.circles,m=0,y=A;m<y.length;m+=1){var v=y[m];if(!u.circle[v]){u.circle[v]=!0;var _=3*v;if(this._circleAndRectCollide(g[_],g[_+1],g[_+2],t,e,r,n)&&(!s||s(this.circleKeys[v]))){if(a.hitTest)return o.push(!0),!0;var b=g[_],x=g[_+1],w=g[_+2];o.push({key:this.circleKeys[v],x1:b-w,y1:x-w,x2:b+w,y2:x+w})}}}},qt.prototype._queryCellCircle=function(t,e,r,n,i,o,a,s){var u=a.circle,c=a.seenUids,l=this.boxCells[i];if(null!==l)for(var h=this.bboxes,f=0,p=l;f<p.length;f+=1){var d=p[f];if(!c.box[d]){c.box[d]=!0;var A=4*d;if(this._circleAndRectCollide(u.x,u.y,u.radius,h[A+0],h[A+1],h[A+2],h[A+3])&&(!s||s(this.boxKeys[d])))return o.push(!0),!0}}var g=this.circleCells[i];if(null!==g)for(var m=this.circles,y=0,v=g;y<v.length;y+=1){var _=v[y];if(!c.circle[_]){c.circle[_]=!0;var b=3*_;if(this._circlesCollide(m[b],m[b+1],m[b+2],u.x,u.y,u.radius)&&(!s||s(this.circleKeys[_])))return o.push(!0),!0}}},qt.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),l=this._convertToXCellCoord(r),h=this._convertToYCellCoord(n),f=u;f<=l;f++)for(var p=c;p<=h;p++){var d=this.xCellCount*p+f;if(i.call(this,t,e,r,n,d,o,a,s))return}},qt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},qt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},qt.prototype._circlesCollide=function(t,e,r,n,i,o){var a=n-t,s=i-e,u=r+o;return u*u>a*a+s*s},qt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,u=Math.abs(t-(n+s));if(u>s+r)return!1;var c=(a-i)/2,l=Math.abs(e-(i+c));if(l>c+r)return!1;if(u<=s||l<=c)return!0;var h=u-s,f=l-c;return h*h+f*f<=r*r};var ne=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ie(t,e){for(var r=0;r<t;r++){var n=e.length;e.resize(n+4),e.float32.set(ne,3*n)}}function oe(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t[3]=r[3]*n+r[7]*i+r[15],t}var ae=function(t,e,r){void 0===e&&(e=new qt(t.width+200,t.height+200,25)),void 0===r&&(r=new qt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200};function se(t,e,r){t[e+4]=r?1:0}function ue(e,r,n){return r*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}ae.prototype.placeCollisionBox=function(t,e,r,n,i){var o=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY),a=r*o.perspectiveRatio,s=t.x1*a+o.point.x,u=t.y1*a+o.point.y,c=t.x2*a+o.point.x,l=t.y2*a+o.point.y;return!this.isInsideGrid(s,u,c,l)||!e&&this.grid.hitTest(s,u,c,l,i)?{box:[],offscreen:!1}:{box:[s,u,c,l],offscreen:this.isOffscreen(s,u,c,l)}},ae.prototype.approximateTileDistance=function(t,e,r,n,i){var o=i?1:n/this.pitchfactor,a=t.lastSegmentViewportDistance*r;return t.prevTileDistance+a+(o-1)*a*Math.abs(Math.sin(e))},ae.prototype.placeCollisionCircles=function(e,r,n,i,o,a,s,u,c,l,h,f,p){var d=[],A=this.projectAnchor(c,o.anchorX,o.anchorY),g=u/24,m=o.lineOffsetX*u,y=o.lineOffsetY*u,v=new t.Point(o.anchorX,o.anchorY),_=$t(g,s,m,y,!1,Qt(v,l).point,v,o,a,l,{},!0),b=!1,x=!1,w=!0,E=A.perspectiveRatio*i,S=1/(i*n),O=0,T=0;_&&(O=this.approximateTileDistance(_.first.tileDistance,_.first.angle,S,A.cameraDistance,f),T=this.approximateTileDistance(_.last.tileDistance,_.last.angle,S,A.cameraDistance,f));for(var P=0;P<e.length;P+=5){var M=e[P],C=e[P+1],I=e[P+2],k=e[P+3];if(!_||k<-O||k>T)se(e,P,!1);else{var R=this.projectPoint(c,M,C),L=I*E;if(d.length>0){var j=R.x-d[d.length-4],D=R.y-d[d.length-3];if(L*L*2>j*j+D*D&&P+8<e.length){var B=e[P+8];if(B>-O&&B<T){se(e,P,!1);continue}}}var F=P/5;d.push(R.x,R.y,L,F),se(e,P,!0);var z=R.x-L,N=R.y-L,U=R.x+L,V=R.y+L;if(w=w&&this.isOffscreen(z,N,U,V),x=x||this.isInsideGrid(z,N,U,V),!r&&this.grid.hitTestCircle(R.x,R.y,L,p)){if(!h)return{circles:[],offscreen:!1};b=!0}}}return{circles:b||!x?[]:d,offscreen:w}},ae.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var r=[],n=1/0,i=1/0,o=-1/0,a=-1/0,s=0,u=e;s<u.length;s+=1){var c=u[s],l=new t.Point(c.x+100,c.y+100);n=Math.min(n,l.x),i=Math.min(i,l.y),o=Math.max(o,l.x),a=Math.max(a,l.y),r.push(l)}for(var h={},f={},p=0,d=this.grid.query(n,i,o,a).concat(this.ignoredGrid.query(n,i,o,a));p<d.length;p+=1){var A=d[p],g=A.key;if(void 0===h[g.bucketInstanceId]&&(h[g.bucketInstanceId]={}),!h[g.bucketInstanceId][g.featureIndex]){var m=[new t.Point(A.x1,A.y1),new t.Point(A.x2,A.y1),new t.Point(A.x2,A.y2),new t.Point(A.x1,A.y2)];t.polygonIntersectsPolygon(r,m)&&(h[g.bucketInstanceId][g.featureIndex]=!0,void 0===f[g.bucketInstanceId]&&(f[g.bucketInstanceId]=[]),f[g.bucketInstanceId].push(g.featureIndex))}}return f},ae.prototype.insertCollisionBox=function(t,e,r,n,i){var o={bucketInstanceId:r,featureIndex:n,collisionGroupID:i};(e?this.ignoredGrid:this.grid).insert(o,t[0],t[1],t[2],t[3])},ae.prototype.insertCollisionCircles=function(t,e,r,n,i){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:i},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},ae.prototype.projectAnchor=function(t,e,r){var n=[e,r,0,1];return oe(n,n,t),{perspectiveRatio:.5+this.transform.cameraToCenterDistance/n[3]*.5,cameraDistance:n[3]}},ae.prototype.projectPoint=function(e,r,n){var i=[r,n,0,1];return oe(i,i,e),new t.Point((i[0]/i[3]+1)/2*this.transform.width+100,(-i[1]/i[3]+1)/2*this.transform.height+100)},ae.prototype.projectAndGetPerspectiveRatio=function(e,r,n){var i=[r,n,0,1];return oe(i,i,e),{point:new t.Point((i[0]/i[3]+1)/2*this.transform.width+100,(-i[1]/i[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}},ae.prototype.isOffscreen=function(t,e,r,n){return r<100||t>=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},ae.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary};var ce=function(t,e,r,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&r?1:0,this.placed=r};ce.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var le=function(t,e,r,n,i){this.text=new ce(t?t.text:null,e,r,i),this.icon=new ce(t?t.icon:null,e,n,i)};le.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var he=function(t,e,r){this.text=t,this.icon=e,this.skipFade=r},fe=function(t,e,r,n,i){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=i},pe=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function de(e,r,n,i,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*r,u=-(a.verticalAlign-.5)*n,c=t.evaluateVariableOffset(e,i);return new t.Point(s+c[0]*o,u+c[1]*o)}function Ae(e,r,n,i,o,a){var s=e.x1,u=e.x2,c=e.y1,l=e.y2,h=e.anchorPointX,f=e.anchorPointY,p=new t.Point(r,n);return i&&p._rotate(o?a:-a),{x1:s+p.x,y1:c+p.y,x2:u+p.x,y2:l+p.y,anchorPointX:h,anchorPointY:f}}pe.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var ge=function(t,e,r,n){this.transform=t.clone(),this.collisionIndex=new ae(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new pe(r),this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}};function me(t,e,r,n,i){t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0)}ge.prototype.placeLayerTile=function(e,r,n,i){var o=r.getBucket(e),a=r.latestFeatureIndex;if(o&&a&&e.id===o.layerIds[0]){var s=r.collisionBoxArray,u=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),l=r.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),f=Zt(h,"map"===u.get("text-pitch-alignment"),"map"===u.get("text-rotation-alignment"),this.transform,ue(r,1,this.transform.zoom)),p=Zt(h,"map"===u.get("icon-pitch-alignment"),"map"===u.get("icon-rotation-alignment"),this.transform,ue(r,1,this.transform.zoom));this.retainedQueryData[o.bucketInstanceId]=new fe(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID),this.placeLayerBucket(o,h,f,p,c,l,n,r.holdingForFade(),i,s)}},ge.prototype.attemptAnchorPlacement=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d){var A,g=[h.textOffset0,h.textOffset1],m=de(t,r,n,g,i),y=this.collisionIndex.placeCollisionBox(Ae(e,m.x,m.y,o,a,this.transform.angle),l,s,u,c.predicate);if(!d||0!==this.collisionIndex.placeCollisionBox(Ae(d,m.x,m.y,o,a,this.transform.angle),l,s,u,c.predicate).box.length)return y.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(A=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:g,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:A},this.markUsedJustification(f,t,h,p),f.allowVerticalPlacement&&(this.markUsedOrientation(f,p,h),this.placedOrientations[h.crossTileID]=p),{shift:m,placedGlyphBoxes:y}):void 0},ge.prototype.placeLayerBucket=function(e,r,n,i,o,a,s,u,c,l){var h=this,f=e.layers[0].layout,p=t.evaluateSizeForZoom(e.textSizeData,this.transform.zoom),d=f.get("text-optional"),A=f.get("icon-optional"),g=f.get("text-allow-overlap"),m=f.get("icon-allow-overlap"),y=g&&(m||!e.hasIconData()||A),v=m&&(g||!e.hasTextData()||d),_=this.collisionGroups.get(e.sourceID),b="map"===f.get("text-rotation-alignment"),x="map"===f.get("text-pitch-alignment"),w="none"!==f.get("icon-text-fit"),E="viewport-y"===f.get("symbol-z-order");!e.collisionArrays&&l&&e.deserializeCollisionBoxes(l);var S=function(i,l){if(!c[i.crossTileID])if(u)h.placements[i.crossTileID]=new he(!1,!1,!1);else{var E,S=!1,O=!1,T=!0,P=null,M={box:null,offscreen:null},C={box:null,offscreen:null},I=null,k=null,R=0,L=0,j=0;l.textFeatureIndex&&(R=l.textFeatureIndex),l.verticalTextFeatureIndex&&(L=l.verticalTextFeatureIndex);var D=l.textBox;if(D){var B=function(r){var n=t.WritingMode.horizontal;if(e.allowVerticalPlacement&&!r&&h.prevPlacement){var o=h.prevPlacement.placedOrientations[i.crossTileID];o&&(h.placedOrientations[i.crossTileID]=o,n=o,h.markUsedOrientation(e,n,i))}return n},F=function(r,n){if(e.allowVerticalPlacement&&i.numVerticalGlyphVertices>0&&l.verticalTextBox)for(var o=0,a=e.writingModes;o<a.length&&(a[o]===t.WritingMode.vertical?(M=n(),C=M):M=r(),!(M&&M.box&&M.box.length));o+=1);else M=r()};if(f.get("text-variable-anchor")){var z=f.get("text-variable-anchor");if(h.prevPlacement&&h.prevPlacement.variableOffsets[i.crossTileID]){var N=h.prevPlacement.variableOffsets[i.crossTileID];z.indexOf(N.anchor)>0&&(z=z.filter((function(t){return t!==N.anchor}))).unshift(N.anchor)}var U=function(t,n,o){for(var s=t.x2-t.x1,u=t.y2-t.y1,c=i.textBoxScale,l=w&&!m?n:null,f={box:[],offscreen:!1},p=g?2*z.length:z.length,d=0;d<p;++d){var A=z[d%z.length],y=d>=z.length,v=h.attemptAnchorPlacement(A,t,s,u,c,b,x,a,r,_,y,i,e,o,l);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){S=!0,P=v.shift;break}}return f};F((function(){return U(D,l.iconBox,t.WritingMode.horizontal)}),(function(){var r=l.verticalTextBox,n=M&&M.box&&M.box.length;return e.allowVerticalPlacement&&!n&&i.numVerticalGlyphVertices>0&&r?U(r,l.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),M&&(S=M.box,T=M.offscreen);var V=B(M&&M.box);if(!S&&h.prevPlacement){var G=h.prevPlacement.variableOffsets[i.crossTileID];G&&(h.variableOffsets[i.crossTileID]=G,h.markUsedJustification(e,G.anchor,i,V))}}else{var W=function(t,n){var o=h.collisionIndex.placeCollisionBox(t,f.get("text-allow-overlap"),a,r,_.predicate);return o&&o.box&&o.box.length&&(h.markUsedOrientation(e,n,i),h.placedOrientations[i.crossTileID]=n),o};F((function(){return W(D,t.WritingMode.horizontal)}),(function(){var r=l.verticalTextBox;return e.allowVerticalPlacement&&i.numVerticalGlyphVertices>0&&r?W(r,t.WritingMode.vertical):{box:null,offscreen:null}})),B(M&&M.box&&M.box.length)}}S=(E=M)&&E.box&&E.box.length>0,T=E&&E.offscreen;var H=l.textCircles;if(H){var q=e.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex),Z=t.evaluateSizeForFeature(e.textSizeData,p,q);I=h.collisionIndex.placeCollisionCircles(H,f.get("text-allow-overlap"),o,a,q,e.lineVertexArray,e.glyphOffsetArray,Z,r,n,s,x,_.predicate),S=f.get("text-allow-overlap")||I.circles.length>0,T=T&&I.offscreen}if(l.iconFeatureIndex&&(j=l.iconFeatureIndex),l.iconBox){var X=function(t){var e=w&&P?Ae(t,P.x,P.y,b,x,h.transform.angle):t;return h.collisionIndex.placeCollisionBox(e,f.get("icon-allow-overlap"),a,r,_.predicate)};O=C&&C.box&&C.box.length&&l.verticalIconBox?(k=X(l.verticalIconBox)).box.length>0:(k=X(l.iconBox)).box.length>0,T=T&&k.offscreen}var Q=d||0===i.numHorizontalGlyphVertices&&0===i.numVerticalGlyphVertices,Y=A||0===i.numIconVertices;Q||Y?Y?Q||(O=O&&S):S=O&&S:O=S=O&&S,S&&E&&E.box&&(C&&C.box&&L?h.collisionIndex.insertCollisionBox(E.box,f.get("text-ignore-placement"),e.bucketInstanceId,L,_.ID):h.collisionIndex.insertCollisionBox(E.box,f.get("text-ignore-placement"),e.bucketInstanceId,R,_.ID)),O&&k&&h.collisionIndex.insertCollisionBox(k.box,f.get("icon-ignore-placement"),e.bucketInstanceId,j,_.ID),S&&I&&h.collisionIndex.insertCollisionCircles(I.circles,f.get("text-ignore-placement"),e.bucketInstanceId,R,_.ID),h.placements[i.crossTileID]=new he(S||y,O||v,T||e.justReloaded),c[i.crossTileID]=!0}};if(E)for(var O=e.getSortedSymbolIndexes(this.transform.angle),T=O.length-1;T>=0;--T){var P=O[T];S(e.symbolInstances.get(P),e.collisionArrays[P])}else for(var M=0;M<e.symbolInstances.length;++M)S(e.symbolInstances.get(M),e.collisionArrays[M]);e.justReloaded=!1},ge.prototype.markUsedJustification=function(e,r,n,i){var o,a={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex};o=i===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:a[t.getAnchorJustification(r)];for(var s=0,u=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];s<u.length;s+=1){var c=u[s];c>=0&&(e.text.placedSymbolArray.get(c).crossTileID=o>=0&&c!==o?0:n.crossTileID)}},ge.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,o=r===t.WritingMode.vertical?r:0,a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];a<s.length;a+=1){var u=s[a];e.text.placedSymbolArray.get(u).placedOrientation=i}n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)},ge.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var n=e?e.symbolFadeChange(t):1,i=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var u=this.placements[s],c=i[s];c?(this.opacities[s]=new le(c,n,u.text,u.icon),r=r||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[s]=new le(null,n,u.text,u.icon,u.skipFade),r=r||u.text||u.icon)}for(var l in i){var h=i[l];if(!this.opacities[l]){var f=new le(h,n,!1,!1);f.isHidden()||(this.opacities[l]=f,r=r||h.text.placed||h.icon.placed)}}for(var p in o)this.variableOffsets[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.variableOffsets[p]=o[p]);for(var d in a)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=a[d]);r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},ge.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n<i.length;n+=1){var o=i[n],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,r,o.collisionBoxArray)}},ge.prototype.updateBucketOpacities=function(e,r,n){var i=this;e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear(),e.hasIconCollisionCircleData()&&e.iconCollisionCircle.collisionVertexArray.clear(),e.hasTextCollisionCircleData()&&e.textCollisionCircle.collisionVertexArray.clear();var o=e.layers[0].layout,a=new le(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=o.get("text-variable-anchor"),l="map"===o.get("text-rotation-alignment"),h="map"===o.get("text-pitch-alignment"),f="none"!==o.get("icon-text-fit"),p=new le(null,0,s&&(u||!e.hasIconData()||o.get("icon-optional")),u&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasIconCollisionCircleData()||e.hasTextCollisionBoxData()||e.hasTextCollisionCircleData())&&e.deserializeCollisionBoxes(n);for(var d=function(t,e,r){for(var n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(r)},A=function(n){var o=e.symbolInstances.get(n),s=o.numHorizontalGlyphVertices,u=o.numVerticalGlyphVertices,A=o.crossTileID,g=r[A],m=i.opacities[A];g?m=a:m||(m=p,i.opacities[A]=m),r[A]=!0;var y=s>0||u>0,v=o.numIconVertices>0,_=i.placedOrientations[o.crossTileID],b=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(y){var w=Se(m.text),E=b?Oe:w;d(e.text,s,E);var S=x?Oe:w;d(e.text,u,S);var O=m.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=O||b?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=O||x?1:0);var T=i.variableOffsets[o.crossTileID];T&&i.markUsedJustification(e,T.anchor,o,_);var P=i.placedOrientations[o.crossTileID];P&&(i.markUsedJustification(e,"left",o,P),i.markUsedOrientation(e,P,o))}if(v){var M=Se(m.icon),C=!(f&&o.verticalPlacedIconSymbolIndex&&b);if(o.placedIconSymbolIndex>=0){var I=C?M:Oe;d(e.icon,o.numIconVertices,I),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=m.icon.isHidden()}if(o.verticalPlacedIconSymbolIndex>=0){var k=C?Oe:M;d(e.icon,o.numVerticalIconVertices,k),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasIconCollisionCircleData()||e.hasTextCollisionBoxData()||e.hasTextCollisionCircleData()){var R=e.collisionArrays[n];if(R){var L=new t.Point(0,0);if(R.textBox||R.verticalTextBox){var j=!0;if(c){var D=i.variableOffsets[A];D?(L=de(D.anchor,D.width,D.height,D.textOffset,D.textBoxScale),l&&L._rotate(h?i.transform.angle:-i.transform.angle)):j=!1}R.textBox&&me(e.textCollisionBox.collisionVertexArray,m.text.placed,!j||b,L.x,L.y),R.verticalTextBox&&me(e.textCollisionBox.collisionVertexArray,m.text.placed,!j||x,L.x,L.y)}var B=Boolean(!x&&R.verticalIconBox);R.iconBox&&me(e.iconCollisionBox.collisionVertexArray,m.icon.placed,B,f?L.x:0,f?L.y:0),R.verticalIconBox&&me(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!B,f?L.x:0,f?L.y:0);var F=R.textCircles;if(F&&e.hasTextCollisionCircleData())for(var z=0;z<F.length;z+=5){var N=g||0===F[z+4];me(e.textCollisionCircle.collisionVertexArray,m.text.placed,N)}}}},g=0;g<e.symbolInstances.length;g++)A(g);e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.hasIconCollisionCircleData()&&e.iconCollisionCircle.collisionVertexBuffer&&e.iconCollisionCircle.collisionVertexBuffer.updateData(e.iconCollisionCircle.collisionVertexArray),e.hasTextCollisionCircleData()&&e.textCollisionCircle.collisionVertexBuffer&&e.textCollisionCircle.collisionVertexBuffer.updateData(e.textCollisionCircle.collisionVertexArray)},ge.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},ge.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},ge.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},ge.prototype.stillRecent=function(t,e){var r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t},ge.prototype.setStale=function(){this.stale=!0};var ye=Math.pow(2,25),ve=Math.pow(2,24),_e=Math.pow(2,17),be=Math.pow(2,16),xe=Math.pow(2,9),we=Math.pow(2,8),Ee=Math.pow(2,1);function Se(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*ye+e*ve+r*_e+e*be+r*xe+e*we+r*Ee+e}var Oe=0,Te=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};Te.prototype.continuePlacement=function(t,e,r,n,i){for(;this._currentTileIndex<t.length;){var o=t[this._currentTileIndex];if(e.placeLayerTile(n,o,r,this._seenCrossTileIDs),this._currentTileIndex++,i())return!0}};var Pe=function(t,e,r,n,i,o,a){this.placement=new ge(t,i,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1};Pe.prototype.isDone=function(){return this._done},Pe.prototype.continuePlacement=function(e,r,n){for(var i=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!i._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new Te),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Pe.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Me=512/t.EXTENT/2,Ce=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<e.length;n++){var i=e.get(n),o=i.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:i.crossTileID,coord:this.getScaledCoordinates(i,t)})}};Ce.prototype.getScaledCoordinates=function(e,r){var n=r.canonical.z-this.tileID.canonical.z,i=Me/Math.pow(2,n);return{x:Math.floor((r.canonical.x*t.EXTENT+e.anchorX)*i),y:Math.floor((r.canonical.y*t.EXTENT+e.anchorY)*i)}},Ce.prototype.findMatches=function(t,e,r){for(var n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),i=0;i<t.length;i++){var o=t.get(i);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),u=0,c=a;u<c.length;u+=1){var l=c[u];if(Math.abs(l.coord.x-s.x)<=n&&Math.abs(l.coord.y-s.y)<=n&&!r[l.crossTileID]){r[l.crossTileID]=!0,o.crossTileID=l.crossTileID;break}}}}};var Ie=function(){this.maxCrossTileID=0};Ie.prototype.generate=function(){return++this.maxCrossTileID};var ke=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};ke.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var r in this.indexes){var n=this.indexes[r],i={};for(var o in n){var a=n[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),i[a.tileID.key]=a}this.indexes[r]=i}this.lng=t},ke.prototype.addBucket=function(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var i=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var u=a[s];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,i)}else{var c=a[t.scaledTo(Number(o)).key];c&&c.findMatches(e.symbolInstances,t,i)}}for(var l=0;l<e.symbolInstances.length;l++){var h=e.symbolInstances.get(l);h.crossTileID||(h.crossTileID=r.generate(),i[h.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ce(t,e.symbolInstances,e.bucketInstanceId),!0},ke.prototype.removeBucketCrossTileIDs=function(t,e){for(var r in e.indexedSymbolInstances)for(var n=0,i=e.indexedSymbolInstances[r];n<i.length;n+=1){var o=i[n];delete this.usedCrossTileIDs[t][o.crossTileID]}},ke.prototype.removeStaleBuckets=function(t){var e=!1;for(var r in this.indexes){var n=this.indexes[r];for(var i in n)t[n[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,n[i]),delete n[i],e=!0)}return e};var Re=function(){this.layerIndexes={},this.crossTileIDs=new Ie,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Re.prototype.addLayer=function(t,e,r){var n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new ke);var i=!1,o={};n.handleWrapJump(r);for(var a=0,s=e;a<s.length;a+=1){var u=s[a],c=u.getBucket(t);c&&t.id===c.layerIds[0]&&(c.bucketInstanceId||(c.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(u.tileID,c,this.crossTileIDs)&&(i=!0),o[c.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(i=!0),i},Re.prototype.pruneUnusedLayers=function(t){var e={};for(var r in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[r]||delete this.layerIndexes[r]};var Le=function(e,r){return t.emitValidationErrors(e,r&&r.filter((function(t){return"source.canvas"!==t.identifier})))},je=t.pick(Ft,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),De=t.pick(Ft,["setCenter","setZoom","setBearing","setPitch"]),Be=function(e){function r(n,i){var o=this;void 0===i&&(i={}),e.call(this),this.map=n,this.dispatcher=new E((Lt||(Lt=new Rt),Lt),this),this.imageManager=new f,this.imageManager.setEventedParent(this),this.glyphManager=new v(n._requestManager,i.localIdeographFontFamily),this.lineAtlas=new w(256,512),this.crossTileSymbolIndex=new Re,this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=r.registerForPluginStateChange((function(e){var r={pluginStatus:e.pluginStatus,pluginURL:e.pluginURL};a.dispatcher.broadcast("syncRTLPluginState",r,(function(e,r){if(t.triggerPluginCompletionEvent(e),r&&r.every((function(t){return t})))for(var n in a.sourceCaches)a.sourceCaches[n].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var r=e.getSource();if(r&&r.vectorLayerIds)for(var n in o._layers){var i=o._layers[n];i.source===r.id&&o._validateLayer(i)}}}}))}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadURL=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var i="boolean"==typeof r.validate?r.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,r.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,r){n._request=null,e?n.fire(new t.ErrorEvent(e)):r&&n._load(r,i)}))},r.prototype.loadJSON=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){n._request=null,n._load(e,!1!==r.validate)}))},r.prototype._load=function(e,r){var n=this;if(!r||!Le(this,t.validateStyle(e))){for(var i in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(i,e.sources[i],{validate:!1});e.sprite?this._spriteRequest=function(e,r,n){var i,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",u=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,a||(a=t,i=e,l())})),c=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){c=null,a||(a=t,o=e,l())}));function l(){if(a)n(a);else if(i&&o){var e=t.browser.getImageData(o),r={};for(var s in i){var u=i[s],c=u.width,l=u.height,h=u.x,f=u.y,p=u.sdf,d=u.pixelRatio,A=u.stretchX,g=u.stretchY,m=u.content,y=new t.RGBAImage({width:c,height:l});t.RGBAImage.copy(e,y,{x:h,y:f},{x:0,y:0},{width:c,height:l}),r[s]={data:y,pixelRatio:d,sdf:p,stretchX:A,stretchY:g,content:m}}n(null,r)}}return{cancel:function(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(e.sprite,this.map._requestManager,(function(e,r){if(n._spriteRequest=null,e)n.fire(new t.ErrorEvent(e));else if(r)for(var i in r)n.imageManager.addImage(i,r[i]);n.imageManager.setLoaded(!0),n.dispatcher.broadcast("setImages",n.imageManager.listImages()),n.fire(new t.Event("data",{dataType:"style"}))})):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=Bt(this.stylesheet.layers);this._order=o.map((function(t){return t.id})),this._layers={};for(var a=0,s=o;a<s.length;a+=1){var u=s[a];(u=t.createStyleLayer(u)).setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new x(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r<n.length;r+=1){var i=n[r],o=this._layers[i];"custom"!==o.type&&e.push(o.serialize())}return e},r.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},r.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},r.prototype.update=function(e){if(this._loaded){var r=this._changed;if(this._changed){var n=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(var o in(n.length||i.length)&&this._updateWorkerLayers(n,i),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}for(var u in this.sourceCaches)this.sourceCaches[u].used=!1;for(var c=0,l=this._order;c<l.length;c+=1){var h=l[c],f=this._layers[h];f.recalculate(e,this.imageManager.listImages()),!f.isHidden(e.zoom)&&f.source&&(this.sourceCaches[f.source].used=!0)}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new t.Event("data",{dataType:"style"}))}},r.prototype._updateTilesForChangedImages=function(){var t=Object.keys(this._changedImages);if(t.length){for(var e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}},r.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},r.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},r.prototype.setState=function(e){var r=this;if(this._checkLoaded(),Le(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Bt(e.layers);var n=function(e,r){if(!e)return[{command:Ft.setStyle,args:[r]}];var n=[];try{if(!t.deepEqual(e.version,r.version))return[{command:Ft.setStyle,args:[r]}];t.deepEqual(e.center,r.center)||n.push({command:Ft.setCenter,args:[r.center]}),t.deepEqual(e.zoom,r.zoom)||n.push({command:Ft.setZoom,args:[r.zoom]}),t.deepEqual(e.bearing,r.bearing)||n.push({command:Ft.setBearing,args:[r.bearing]}),t.deepEqual(e.pitch,r.pitch)||n.push({command:Ft.setPitch,args:[r.pitch]}),t.deepEqual(e.sprite,r.sprite)||n.push({command:Ft.setSprite,args:[r.sprite]}),t.deepEqual(e.glyphs,r.glyphs)||n.push({command:Ft.setGlyphs,args:[r.glyphs]}),t.deepEqual(e.transition,r.transition)||n.push({command:Ft.setTransition,args:[r.transition]}),t.deepEqual(e.light,r.light)||n.push({command:Ft.setLight,args:[r.light]});var i={},o=[];!function(e,r,n,i){var o;for(o in r=r||{},e=e||{})e.hasOwnProperty(o)&&(r.hasOwnProperty(o)||Nt(o,n,i));for(o in r)r.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],r[o])||("geojson"===e[o].type&&"geojson"===r[o].type&&Vt(e,r,o)?n.push({command:Ft.setGeoJSONSourceData,args:[o,r[o].data]}):Ut(o,r,n,i)):zt(o,r,n))}(e.sources,r.sources,o,i);var a=[];e.layers&&e.layers.forEach((function(t){i[t.source]?n.push({command:Ft.removeLayer,args:[t.id]}):a.push(t)})),n=n.concat(o),function(e,r,n){r=r||[];var i,o,a,s,u,c,l,h=(e=e||[]).map(Wt),f=r.map(Wt),p=e.reduce(Ht,{}),d=r.reduce(Ht,{}),A=h.slice(),g=Object.create(null);for(i=0,o=0;i<h.length;i++)a=h[i],d.hasOwnProperty(a)?o++:(n.push({command:Ft.removeLayer,args:[a]}),A.splice(A.indexOf(a,o),1));for(i=0,o=0;i<f.length;i++)a=f[f.length-1-i],A[A.length-1-i]!==a&&(p.hasOwnProperty(a)?(n.push({command:Ft.removeLayer,args:[a]}),A.splice(A.lastIndexOf(a,A.length-o),1)):o++,c=A[A.length-i],n.push({command:Ft.addLayer,args:[d[a],c]}),A.splice(A.length-i,0,a),g[a]=!0);for(i=0;i<f.length;i++)if(s=p[a=f[i]],u=d[a],!g[a]&&!t.deepEqual(s,u))if(t.deepEqual(s.source,u.source)&&t.deepEqual(s["source-layer"],u["source-layer"])&&t.deepEqual(s.type,u.type)){for(l in Gt(s.layout,u.layout,n,a,null,Ft.setLayoutProperty),Gt(s.paint,u.paint,n,a,null,Ft.setPaintProperty),t.deepEqual(s.filter,u.filter)||n.push({command:Ft.setFilter,args:[a,u.filter]}),t.deepEqual(s.minzoom,u.minzoom)&&t.deepEqual(s.maxzoom,u.maxzoom)||n.push({command:Ft.setLayerZoomRange,args:[a,u.minzoom,u.maxzoom]}),s)s.hasOwnProperty(l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?Gt(s[l],u[l],n,a,l.slice(6),Ft.setPaintProperty):t.deepEqual(s[l],u[l])||n.push({command:Ft.setLayerProperty,args:[a,l,u[l]]}));for(l in u)u.hasOwnProperty(l)&&!s.hasOwnProperty(l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?Gt(s[l],u[l],n,a,l.slice(6),Ft.setPaintProperty):t.deepEqual(s[l],u[l])||n.push({command:Ft.setLayerProperty,args:[a,l,u[l]]}))}else n.push({command:Ft.removeLayer,args:[a]}),c=A[A.lastIndexOf(a)+1],n.push({command:Ft.addLayer,args:[u,c]})}(a,r.layers,n)}catch(t){console.warn("Unable to compute style diff:",t),n=[{command:Ft.setStyle,args:[r]}]}return n}(this.serialize(),e).filter((function(t){return!(t.command in De)}));if(0===n.length)return!1;var i=n.filter((function(t){return!(t.command in je)}));if(i.length>0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Mt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var o;if("custom"===e.type){if(Le(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}})}var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,i),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n],a=parseInt(e.id,10);if(void 0!==o){var s=o.getSource().type;"geojson"===s&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||i?isNaN(a)||a<0?this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative."))):o.setFeatureState(i,a,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var o=i.getSource().type,a="vector"===o?e.sourceLayer:void 0,s=parseInt(e.id,10);"vector"!==o||a?void 0!==e.id&&isNaN(s)||s<0?this.fire(new t.ErrorEvent(new Error("The feature id parameter must be non-negative."))):r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):i.removeFeatureState(a,s,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r],o=parseInt(e.id,10);if(void 0!==i)if("vector"!==i.getSource().type||n){if(!(isNaN(o)||o<0))return i.getFeatureState(n,o);this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative.")))}else this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(r(a)){n[a]=o;for(var s=0,u=t;s<u.length;s+=1){var c=u[s][a];if(c)for(var l=0,h=c;l<h.length;l+=1){var f=h[l];i.push(f)}}}}i.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var p=[],d=this._order.length-1;d>=0;d--){var A=this._order[d];if(r(A))for(var g=i.length-1;g>=0;g--){var m=i[g].feature;if(n[m.layer.id]<d)break;p.push(m),i.pop()}else for(var y=0,v=t;y<v.length;y+=1){var _=v[y][A];if(_)for(var b=0,x=_;b<x.length;b+=1){var w=x[b];p.push(w.feature)}}}return p},r.prototype.queryRenderedFeatures=function(e,r,n){r&&r.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",r.filter,null,r);var i={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=r.layers;o<a.length;o+=1){var s=a[o],u=this._layers[s];if(!u)return this.fire(new t.ErrorEvent(new Error("The layer '"+s+"' does not exist in the map's style and cannot be queried for features."))),[];i[u.source]=!0}}var c=[];for(var l in this.sourceCaches)r.layers&&!i[l]||c.push(D(this.sourceCaches[l],this._layers,e,r,n));return this.placement&&c.push(function(t,e,r,n,i,o){for(var a={},s=i.queryRenderedSymbols(r),u=[],c=0,l=Object.keys(s).map(Number);c<l.length;c+=1){var h=l[c];u.push(o[h])}u.sort(B);for(var f=function(){var e=d[p],r=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,n.filter,n.layers,t);for(var i in r){var o=a[i]=a[i]||[],u=r[i];u.sort((function(t,r){var n=e.featureSortOrder;if(n){var i=n.indexOf(t.featureIndex);return n.indexOf(r.featureIndex)-i}return r.featureIndex-t.featureIndex}));for(var c=0,l=u;c<l.length;c+=1){var h=l[c];o.push(h)}}},p=0,d=u;p<d.length;p+=1)f();var A=function(r){a[r].forEach((function(n){var i=n.feature,o=t[r],a=e[o.source].getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=a}))};for(var g in a)A(g);return a}(this._layers,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)},r.prototype.querySourceFeatures=function(e,r){r&&r.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",r.filter,null,r);var n=this.sourceCaches[e];return n?function(t,e){for(var r=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),n=[],i={},o=0;o<r.length;o++){var a=r[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}(n,r):[]},r.prototype.addSourceType=function(t,e,n){return r.getSourceType(t)?n(new Error('A source type called "'+t+'" already exists.')):(r.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))},r.prototype.getLight=function(){return this.light.getLight()},r.prototype.setLight=function(e,r){void 0===r&&(r={}),this._checkLoaded();var n=this.light.getLight(),i=!1;for(var o in e)if(!t.deepEqual(e[o],n[o])){i=!0;break}if(i){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}},r.prototype._validate=function(e,r,n,i,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Le(this,e.call(t.validateStyle,t.extend({key:r,style:this.serialize(),value:n,styleSpec:t.styleSpec},i)))},r.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var r in this.sourceCaches)this.sourceCaches[r].clearTiles(),this.sourceCaches[r].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},r.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},r.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},r.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},r.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},r.prototype._updatePlacement=function(e,r,n,i){for(var o=!1,a=!1,s={},u=0,c=this._order;u<c.length;u+=1){var l=c[u],h=this._layers[l];if("symbol"===h.type){if(!s[h.source]){var f=this.sourceCaches[h.source];s[h.source]=f.getRenderableIds(!0).map((function(t){return f.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var p=this.crossTileSymbolIndex.addLayer(h,s[h.source],e.center.lng);o=o||p}}this.crossTileSymbolIndex.pruneUnusedLayers(this._order);var d=this._layerOrderChanged||0===n;if((d||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Pe(e,this._order,d,r,n,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(var A=0,g=this._order;A<g.length;A+=1){var m=g[A],y=this._layers[m];"symbol"===y.type&&this.placement.updateLayerOpacities(y,s[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},r.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},r.prototype.getImages=function(t,e,r){this.imageManager.getImages(e.icons,r),this._updateTilesForChangedImages();var n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)},r.prototype.getGlyphs=function(t,e,r){this.glyphManager.getGlyphs(e.stacks,r)},r.prototype.getResource=function(e,r,n){return t.makeRequest(r,n)},r}(t.Evented);Be.getSourceType=function(t){return L[t]},Be.setSourceType=function(t,e){L[t]=e},Be.registerForPluginStateChange=t.registerForPluginStateChange;var Fe=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),ze=hr("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),Ne=hr("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Ue=hr("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Ve=hr("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),Ge=hr("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),We=hr("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),He=hr("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),qe=hr("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Ze=hr("uniform float u_overscale_factor;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {float alpha=0.5;vec4 color=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {color=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {color*=.2;}float extrude_scale_length=length(v_extrude_scale);float extrude_length=length(v_extrude)*extrude_scale_length;float stroke_width=15.0*extrude_scale_length/u_overscale_factor;float radius=v_radius*extrude_scale_length;float distance_to_edge=abs(extrude_length-radius);float opacity_t=smoothstep(-stroke_width,0.0,-distance_to_edge);gl_FragColor=opacity_t*color;}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);highp float padding_factor=1.2;gl_Position.xy+=a_extrude*u_extrude_scale*padding_factor*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;v_radius=abs(a_extrude.y);v_extrude=a_extrude*padding_factor;v_extrude_scale=u_extrude_scale*u_camera_to_center_distance*collision_perspective_ratio;}"),Xe=hr("uniform highp vec4 u_color;void main() {gl_FragColor=u_color;}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Qe=hr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),Ye=hr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),Ke=hr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),$e=hr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),Je=hr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),tr=hr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec4 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),er=hr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),rr=hr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),nr=hr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),ir=hr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),or=hr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec4 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x,1.0);float x_b=mod(v_linesofar/pattern_size_b.x,1.0);float y_a=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_a.y+2.0)/2.0)/pattern_size_a.y);float y_b=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_b.y+2.0)/2.0)/pattern_size_b.y);vec2 pos_a=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,vec2(x_a,y_a));vec2 pos_b=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,vec2(x_b,y_b));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);}"),ar=hr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),sr=hr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),ur=hr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),cr=hr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),lr=hr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function hr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n={};return{fragmentSource:t=t.replace(r,(function(t,e,r,i,o){return n[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+r+" "+i+" "+o+";\n#else\nuniform "+r+" "+i+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n    "+r+" "+i+" "+o+" = u_"+o+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,i,o){var a="float"===i?"vec2":"vec4",s=o.match(/color/)?"color":a;return n[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+r+" "+a+" a_"+o+";\nvarying "+r+" "+i+" "+o+";\n#else\nuniform "+r+" "+i+" u_"+o+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+o+" = a_"+o+";\n#else\n    "+r+" "+i+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+o+" = unpack_mix_"+s+"(a_"+o+", u_"+o+"_t);\n#else\n    "+r+" "+i+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+r+" "+a+" a_"+o+";\n#else\nuniform "+r+" "+i+" u_"+o+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+r+" "+i+" "+o+" = a_"+o+";\n#else\n    "+r+" "+i+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n    "+r+" "+i+" "+o+" = unpack_mix_"+s+"(a_"+o+", u_"+o+"_t);\n#else\n    "+r+" "+i+" "+o+" = u_"+o+";\n#endif\n"}))}}var fr=Object.freeze({__proto__:null,prelude:ze,background:Ne,backgroundPattern:Ue,circle:Ve,clippingMask:Ge,heatmap:We,heatmapTexture:He,collisionBox:qe,collisionCircle:Ze,debug:Xe,fill:Qe,fillOutline:Ye,fillOutlinePattern:Ke,fillPattern:$e,fillExtrusion:Je,fillExtrusionPattern:tr,hillshadePrepare:er,hillshade:rr,line:nr,lineGradient:ir,linePattern:or,lineSDF:ar,raster:sr,symbolIcon:ur,symbolSDF:cr,symbolTextAndIcon:lr}),pr=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};pr.prototype.bind=function(t,e,r,n,i,o,a,s){this.context=t;for(var u=this.boundPaintVertexBuffers.length!==n.length,c=0;!u&&c<n.length;c++)this.boundPaintVertexBuffers[c]!==n[c]&&(u=!0);var l=!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==i||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s;!t.extVertexArrayObject||l?this.freshBind(e,r,n,i,o,a,s):(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),i&&i.dynamicDraw&&i.bind(),s&&s.bind())},pr.prototype.freshBind=function(t,e,r,n,i,o,a){var s,u=t.numAttributes,c=this.context,l=c.gl;if(c.extVertexArrayObject)this.vao&&this.destroy(),this.vao=c.extVertexArrayObject.createVertexArrayOES(),c.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=n,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=c.currentNumAttributes||0;for(var h=u;h<s;h++)l.disableVertexAttribArray(h)}e.enableAttributes(l,t);for(var f=0,p=r;f<p.length;f+=1)p[f].enableAttributes(l,t);o&&o.enableAttributes(l,t),a&&a.enableAttributes(l,t),e.bind(),e.setVertexAttribPointers(l,t,i);for(var d=0,A=r;d<A.length;d+=1){var g=A[d];g.bind(),g.setVertexAttribPointers(l,t,i)}o&&(o.bind(),o.setVertexAttribPointers(l,t,i)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(l,t,i)),c.currentNumAttributes=u},pr.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var dr=function(t,e,r,n,i){var o=t.gl;this.program=o.createProgram();var a=r.defines();i&&a.push("#define OVERDRAW_INSPECTOR;");var s=a.concat(ze.fragmentSource,e.fragmentSource).join("\n"),u=a.concat(ze.vertexSource,e.vertexSource).join("\n"),c=o.createShader(o.FRAGMENT_SHADER);if(o.isContextLost())this.failedToCreate=!0;else{o.shaderSource(c,s),o.compileShader(c),o.attachShader(this.program,c);var l=o.createShader(o.VERTEX_SHADER);if(o.isContextLost())this.failedToCreate=!0;else{o.shaderSource(l,u),o.compileShader(l),o.attachShader(this.program,l);for(var h=r.layoutAttributes||[],f=0;f<h.length;f++)o.bindAttribLocation(this.program,f,h[f].name);o.linkProgram(this.program),this.numAttributes=o.getProgramParameter(this.program,o.ACTIVE_ATTRIBUTES),this.attributes={};for(var p={},d=0;d<this.numAttributes;d++){var A=o.getActiveAttrib(this.program,d);A&&(this.attributes[A.name]=o.getAttribLocation(this.program,A.name))}for(var g=o.getProgramParameter(this.program,o.ACTIVE_UNIFORMS),m=0;m<g;m++){var y=o.getActiveUniform(this.program,m);y&&(p[y.name]=o.getUniformLocation(this.program,y.name))}this.fixedUniforms=n(t,p),this.binderUniforms=r.getUniforms(t,p)}}};function Ar(e,r,n){var i=1/ue(n,1,r.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),a=n.tileSize*Math.pow(2,r.transform.tileZoom)/o,s=a*(n.tileID.canonical.x+n.tileID.wrap*o),u=a*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[t.browser.devicePixelRatio,i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,u>>16],u_pixel_coord_lower:[65535&s,65535&u]}}dr.prototype.draw=function(t,e,r,n,i,o,a,s,u,c,l,h,f,p,d,A){var g,m=t.gl;if(!this.failedToCreate){for(var y in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[y].set(a[y]);p&&p.setUniforms(t,this.binderUniforms,h,{zoom:f});for(var v=(g={},g[m.LINES]=2,g[m.TRIANGLES]=3,g[m.LINE_STRIP]=1,g)[e],_=0,b=l.get();_<b.length;_+=1){var x=b[_],w=x.vaos||(x.vaos={});(w[s]||(w[s]=new pr)).bind(t,this,u,p?p.getPaintVertexBuffers():[],c,x.vertexOffset,d,A),m.drawElements(e,x.primitiveLength*v,m.UNSIGNED_SHORT,x.primitiveOffset*v*2)}}};var gr=function(e,r,n,i){var o=r.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],u=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(u,-r.transform.angle),t.transformMat3(s,s,u);var c=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:i}},mr=function(e,r,n,i,o,a,s){return t.extend(gr(e,r,n,i),Ar(a,r,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},yr=function(t){return{u_matrix:t}},vr=function(e,r,n,i){return t.extend(yr(e),Ar(n,r,i))},_r=function(t,e){return{u_matrix:t,u_world:e}},br=function(e,r,n,i,o){return t.extend(vr(e,r,n,i),{u_world:o})},xr=function(e,r,n,i){var o,a,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){var u=ue(n,1,s.zoom);o=!0,a=[u,u]}else o=!1,a=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(r.posMatrix,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},wr=function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},Er=function(t,e,r){var n=ue(r,1,e.zoom),i=Math.pow(2,e.zoom-r.tileID.overscaledZ),o=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*i),e.pixelsToGLUnits[1]/(n*i)],u_overscale_factor:o}},Sr=function(t,e){return{u_matrix:t,u_color:e}},Or=function(t){return{u_matrix:t}},Tr=function(t,e,r,n){return{u_matrix:t,u_extrude_scale:ue(e,1,r),u_intensity:n}};function Pr(e,r){var n=Math.pow(2,r.canonical.z),i=r.canonical.y;return[new t.MercatorCoordinate(0,i/n).toLngLat().lat,new t.MercatorCoordinate(0,(i+1)/n).toLngLat().lat]}var Mr=function(e,r,n){var i=e.transform;return{u_matrix:Lr(e,r,n),u_ratio:1/ue(r,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Cr=function(e,r,n){return t.extend(Mr(e,r,n),{u_image:0})},Ir=function(e,r,n,i){var o=e.transform,a=Rr(r,o);return{u_matrix:Lr(e,r,n),u_texsize:r.imageAtlasTexture.size,u_ratio:1/ue(r,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[t.browser.devicePixelRatio,a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},kr=function(e,r,n,i,o){var a=e.transform,s=e.lineAtlas,u=Rr(r,a),c="round"===n.layout.get("line-cap"),l=s.getDash(i.from,c),h=s.getDash(i.to,c),f=l.width*o.fromScale,p=h.width*o.toScale;return t.extend(Mr(e,r,n),{u_patternscale_a:[u/f,-l.height/2],u_patternscale_b:[u/p,-h.height/2],u_sdfgamma:s.width/(256*Math.min(f,p)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:l.y,u_tex_y_b:h.y,u_mix:o.t})};function Rr(t,e){return 1/ue(t,1,e.tileZoom)}function Lr(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var jr=function(t,e,r,n,i){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Dr(i.paint.get("raster-hue-rotate"))};var o,a};function Dr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var Br=function(t,e,r,n,i,o,a,s,u,c){var l=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:l.cameraToCenterDistance,u_pitch:l.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:l.width/l.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+n,u_texsize:c,u_texture:0}},Fr=function(e,r,n,i,o,a,s,u,c,l,h){var f=o.transform;return t.extend(Br(e,r,n,i,o,a,s,u,c,l),{u_gamma_scale:i?Math.cos(f._pitch)*f.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},zr=function(e,r,n,i,o,a,s,u,c,l){return t.extend(Fr(e,r,n,i,o,a,s,u,!0,c,!0),{u_texsize_icon:l,u_texture_icon:1})},Nr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Ur=function(e,r,n,i,o,a){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),a=r.imageManager.getPixelSize(),s=a.width,u=a.height,c=Math.pow(2,n.tileID.overscaledZ),l=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=l*(n.tileID.canonical.x+n.tileID.wrap*c),f=l*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,u],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/ue(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,f>>16],u_pixel_coord_lower:[65535&h,65535&f]}}(i,a,n,o),{u_matrix:e,u_opacity:r})},Vr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:wr,collisionCircle:wr,debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_maxzoom:new t.Uniform1f(e,r.u_maxzoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform4f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1f(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1f(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1f(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1f(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1f(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Gr(e,r){for(var n=e.sort((function(t,e){return t.tileID.isLessThan(e.tileID)?-1:e.tileID.isLessThan(t.tileID)?1:0})),i=0;i<n.length;i++){var o={},a=n[i],s=n.slice(i+1);Wr(a.tileID.wrapped(),a.tileID,s,new t.OverscaledTileID(0,a.tileID.wrap+1,0,0,0),o),a.setMask(o,r)}}function Wr(e,r,n,i,o){for(var a=0;a<n.length;a++){var s=n[a];if(i.isLessThan(s.tileID))break;if(r.key===s.tileID.key)return;if(s.tileID.isChildOf(r)){for(var u=r.children(1/0),c=0;c<u.length;c++)Wr(e,u[c],n.slice(a),i,o);return}}var l=r.overscaledZ-e.overscaledZ,h=new t.CanonicalTileID(l,r.canonical.x-(e.canonical.x<<l),r.canonical.y-(e.canonical.y<<l));o[h.key]=o[h.key]||h}function Hr(t,e,r,n,i,o,a,s){for(var u=t.context,c=u.gl,l=i?t.useProgram("collisionCircle"):t.useProgram("collisionBox"),h=0;h<n.length;h++){var f=n[h],p=e.getTile(f),d=p.getBucket(r);if(d){var A=i?s?d.textCollisionCircle:d.iconCollisionCircle:s?d.textCollisionBox:d.iconCollisionBox;if(A){var g=f.posMatrix;0===o[0]&&0===o[1]||(g=t.translatePosMatrix(f.posMatrix,p,o,a)),l.draw(u,i?c.TRIANGLES:c.LINES,Et.disabled,St.disabled,t.colorModeForRenderPass(),Tt.disabled,Er(g,t.transform,p),r.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,null,t.transform.zoom,null,null,A.collisionVertexBuffer)}}}}function qr(t,e,r,n,i,o,a){Hr(t,e,r,n,!1,i,o,a),Hr(t,e,r,n,!0,i,o,a)}var Zr=t.identity(new Float32Array(16));function Xr(e,r,n,i,o,a){var s=t.getAnchorAlignment(e),u=-(s.horizontalAlign-.5)*r,c=-(s.verticalAlign-.5)*n,l=t.evaluateVariableOffset(e,i);return new t.Point((u/o+l[0])*a,(c/o+l[1])*a)}function Qr(e,r,n,i,o,a,s,u,c,l,h){var f=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,A={};p.clear();for(var g=0;g<f.length;g++){var m=f.get(g),y=e.allowVerticalPlacement&&!m.placedOrientation,v=m.hidden||!m.crossTileID||y?null:i[m.crossTileID];if(v){var _=new t.Point(m.anchorX,m.anchorY),b=Qt(_,n?u:s),x=.5+a.cameraToCenterDistance/b.signedDistanceFromCamera*.5,w=o.evaluateSizeForFeature(e.textSizeData,l,m)*x/t.ONE_EM;n&&(w*=e.tilePixelRatio/c);for(var E=v.width,S=v.height,O=Xr(v.anchor,E,S,v.textOffset,v.textBoxScale,w),T=n?Qt(_.add(O),s).point:b.point.add(r?O.rotate(-a.angle):O),P=e.allowVerticalPlacement&&m.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,M=0;M<m.numGlyphs;M++)t.addDynamicAttributes(p,T,P);h&&m.associatedIconIndex>=0&&(A[m.associatedIconIndex]={shiftedAnchor:T,angle:P})}else ie(m.numGlyphs,p)}if(h){d.clear();for(var C=e.icon.placedSymbolArray,I=0;I<C.length;I++){var k=C.get(I);if(k.hidden)ie(k.numGlyphs,d);else{var R=A[I];if(R)for(var L=0;L<k.numGlyphs;L++)t.addDynamicAttributes(d,R.shiftedAnchor,R.angle);else ie(k.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function Yr(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Kr(e,r,n,i,o,a,s,u,c,l,h,f){for(var p,d,A=e.context,g=A.gl,m=e.transform,y="map"===u,v="map"===c,_=y&&"point"!==n.layout.get("symbol-placement"),b=y&&!v&&!_,x=void 0!==n.layout.get("symbol-sort-key").constantOr(1),w=e.depthModeForSublayer(0,Et.ReadOnly),E=n.layout.get("text-variable-anchor"),S=[],O=0,T=i;O<T.length;O+=1){var P=T[O],M=r.getTile(P),C=M.getBucket(n);if(C){var I=o?C.text:C.icon;if(I&&I.segments.get().length){var k=I.programConfigurations.get(n.id),R=o||C.sdfIcons,L=o?C.textSizeData:C.iconSizeData,j=v||0!==m.pitch;p||(p=e.useProgram(Yr(R,o,C),k),d=t.evaluateSizeForZoom(L,m.zoom));var D=void 0,B=[0,0],F=void 0,z=void 0,N=null,U=void 0;if(o){if(F=M.glyphAtlasTexture,z=g.LINEAR,D=M.glyphAtlasTexture.size,C.iconsInText){B=M.imageAtlasTexture.size,N=M.imageAtlasTexture;var V="composite"===L.kind||"camera"===L.kind;U=j||e.options.rotating||e.options.zooming||V?g.LINEAR:g.NEAREST}}else{var G=1!==n.layout.get("icon-size").constantOr(0)||C.iconsNeedLinear;F=M.imageAtlasTexture,z=R||e.options.rotating||e.options.zooming||G||j?g.LINEAR:g.NEAREST,D=M.imageAtlasTexture.size}var W=ue(M,1,e.transform.zoom),H=Zt(P.posMatrix,v,y,e.transform,W),q=Xt(P.posMatrix,v,y,e.transform,W),Z=E&&C.hasTextData(),X="none"!==n.layout.get("icon-text-fit")&&Z&&C.hasIconData();_&&Kt(C,P.posMatrix,e,o,H,q,v,l);var Q=e.translatePosMatrix(P.posMatrix,M,a,s),Y=_||o&&E||X?Zr:H,K=e.translatePosMatrix(q,M,a,s,!0),$=R&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),J={program:p,buffers:I,uniformValues:R?C.iconsInText?zr(L.kind,d,b,v,e,Q,Y,K,D,B):Fr(L.kind,d,b,v,e,Q,Y,K,o,D,!0):Br(L.kind,d,b,v,e,Q,Y,K,o,D),atlasTexture:F,atlasTextureIcon:N,atlasInterpolation:z,atlasInterpolationIcon:U,isSDF:R,hasHalo:$};if(x)for(var tt=0,et=I.segments.get();tt<et.length;tt+=1){var rt=et[tt];S.push({segments:new t.SegmentVector([rt]),sortKey:rt.sortKey,state:J})}else S.push({segments:I.segments,sortKey:0,state:J})}}}x&&S.sort((function(t,e){return t.sortKey-e.sortKey}));for(var nt=0,it=S;nt<it.length;nt+=1){var ot=it[nt],at=ot.state;if(A.activeTexture.set(g.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,g.CLAMP_TO_EDGE),at.atlasTextureIcon&&(A.activeTexture.set(g.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,g.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,$r(at.buffers,ot.segments,n,e,at.program,w,h,f,st)),st.u_is_halo=0}$r(at.buffers,ot.segments,n,e,at.program,w,h,f,at.uniformValues)}}function $r(t,e,r,n,i,o,a,s,u){var c=n.context,l=c.gl;i.draw(c,l.TRIANGLES,o,a,s,Tt.disabled,u,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Jr(t,e,r,n,i,o,a){var s,u,c,l,h,f=t.context.gl,p=r.paint.get("fill-pattern"),d=p&&p.constantOr(1),A=r.getCrossfadeParameters();a?(u=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=f.LINES):(u=d?"fillPattern":"fill",s=f.TRIANGLES);for(var g=0,m=n;g<m.length;g+=1){var y=m[g],v=e.getTile(y);if(!d||v.patternsLoaded()){var _=v.getBucket(r);if(_){var b=_.programConfigurations.get(r.id),x=t.useProgram(u,b);d&&(t.context.activeTexture.set(f.TEXTURE0),v.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),b.updatePatternPaintBuffers(A));var w=p.constantOr(null);if(w&&v.imageAtlas){var E=v.imageAtlas,S=E.patternPositions[w.to.toString()],O=E.patternPositions[w.from.toString()];S&&O&&b.setConstantPatternPositions(S,O)}var T=t.translatePosMatrix(y.posMatrix,v,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(a){l=_.indexBuffer2,h=_.segments2;var P=[f.drawingBufferWidth,f.drawingBufferHeight];c="fillOutlinePattern"===u&&d?br(T,t,A,v,P):_r(T,P)}else l=_.indexBuffer,h=_.segments,c=d?vr(T,t,A,v):yr(T);x.draw(t.context,s,i,t.stencilModeForClipping(y),o,Tt.disabled,c,r.id,_.layoutVertexBuffer,l,h,r.paint,t.transform.zoom,b)}}}}function tn(t,e,r,n,i,o,a){for(var s=t.context,u=s.gl,c=r.paint.get("fill-extrusion-pattern"),l=c.constantOr(1),h=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),p=0,d=n;p<d.length;p+=1){var A=d[p],g=e.getTile(A),m=g.getBucket(r);if(m){var y=m.programConfigurations.get(r.id),v=t.useProgram(l?"fillExtrusionPattern":"fillExtrusion",y);l&&(t.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),y.updatePatternPaintBuffers(h));var _=c.constantOr(null);if(_&&g.imageAtlas){var b=g.imageAtlas,x=b.patternPositions[_.to.toString()],w=b.patternPositions[_.from.toString()];x&&w&&y.setConstantPatternPositions(x,w)}var E=t.translatePosMatrix(A.posMatrix,g,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),S=r.paint.get("fill-extrusion-vertical-gradient"),O=l?mr(E,t,S,f,A,h,g):gr(E,t,S,f);v.draw(s,s.gl.TRIANGLES,i,o,a,Tt.backCCW,O,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,t.transform.zoom,y)}}}function en(t,e,r,n,i,o){var a=t.context,s=a.gl,u=e.fbo;if(u){var c=t.useProgram("hillshade");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get());var l=function(t,e,r){var n=r.paint.get("hillshade-shadow-color"),i=r.paint.get("hillshade-highlight-color"),o=r.paint.get("hillshade-accent-color"),a=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);var s=!t.options.moving;return{u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),s),u_image:0,u_latrange:Pr(0,e.tileID),u_light:[r.paint.get("hillshade-exaggeration"),a],u_shadow:n,u_highlight:i,u_accent:o}}(t,e,r);e.maskedBoundsBuffer&&e.maskedIndexBuffer&&e.segments?c.draw(a,s.TRIANGLES,n,i,o,Tt.disabled,l,r.id,e.maskedBoundsBuffer,e.maskedIndexBuffer,e.segments):c.draw(a,s.TRIANGLES,n,i,o,Tt.disabled,l,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}function rn(e,r,n,i,o,a,s){var u=e.context,c=u.gl,l=r.dem;if(l&&l.data){var h=l.dim,f=l.stride,p=l.getPixels();if(u.activeTexture.set(c.TEXTURE1),u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(f),r.demTexture){var d=r.demTexture;d.update(p,{premultiply:!1}),d.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else r.demTexture=new t.Texture(u,p,c.RGBA,{premultiply:!1}),r.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);u.activeTexture.set(c.TEXTURE0);var A=r.fbo;if(!A){var g=new t.Texture(u,{width:h,height:h,data:null},c.RGBA);g.bind(c.LINEAR,c.CLAMP_TO_EDGE),(A=r.fbo=u.createFramebuffer(h,h)).colorAttachment.set(g.texture)}u.bindFramebuffer.set(A.framebuffer),u.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(u,c.TRIANGLES,o,a,s,Tt.disabled,function(e,r,n){var i=r.stride,o=t.create();return t.ortho(o,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(o,o,[0,-t.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_maxzoom:n,u_unpack:r.getUnpackVector()}}(r.tileID,l,i),n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function nn(e,r,n,i,o){var a=i.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),u=(s-e.timeAdded)/a,c=r?(s-r.timeAdded)/a:-1,l=n.getSource(),h=o.coveringZoomLevel({tileSize:l.tileSize,roundZoom:l.roundZoom}),f=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=f&&e.refreshedUponExpiration?1:t.clamp(f?u:1-c,0,1);return e.refreshedUponExpiration&&u>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}function on(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug"),u=Et.disabled,c=St.disabled,l=e.colorModeForRenderPass(),h="$debug";s.draw(i,o.LINE_STRIP,u,c,l,Tt.disabled,Sr(a,t.Color.red),h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var f=r.getTileByID(n.key).latestRawTileData,p=f&&f.byteLength||0,d=Math.floor(p/1024),A=r.getTile(n).tileSize,g=512/Math.min(A,512),m=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(m+=" => "+n.overscaledZ);for(var y=function(t,e,r,n){n=n||1;var i,o,a,s,u,c,l,h,f=[];for(i=0,o=t.length;i<o;i++)if(u=an[t[i]]){for(h=null,a=0,s=u[1].length;a<s;a+=2)-1===u[1][a]&&-1===u[1][a+1]?h=null:(c=e+u[1][a]*n,l=r-u[1][a+1]*n,h&&f.push(h.x,h.y,c,l),h={x:c,y:l});e+=u[0]*n}return f}(m+" "+d+"kb",50,200*g,5*g),v=new t.StructArrayLayout2i4,_=new t.StructArrayLayout2ui4,b=0;b<y.length;b+=2)v.emplaceBack(y[b],y[b+1]),_.emplaceBack(b,b+1);for(var x=i.createVertexBuffer(v,Fe.members),w=i.createIndexBuffer(_),E=t.SegmentVector.simpleSegment(0,0,v.length/2,v.length/2),S=t.EXTENT/(Math.pow(2,e.transform.zoom-n.overscaledZ)*A*g),O=[],T=-1;T<=1;T++)for(var P=-1;P<=1&&(0!==T||0!==P);P++)O.push([T,P]);for(var M=0;M<O.length;M++){var C=O[M];s.draw(i,o.LINES,u,c,l,Tt.disabled,Sr(t.translate([],a,[S*C[0],S*C[1],0]),t.Color.white),h,x,w,E)}s.draw(i,o.LINES,u,c,l,Tt.disabled,Sr(a,t.Color.black),h,x,w,E),x.destroy(),w.destroy(),E.destroy()}var an={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]},sn={symbol:function(e,r,n,i,o){if("translucent"===e.renderPass){var a=St.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,o,a,s){for(var u=r.transform,c="map"===o,l="map"===a,h=0,f=e;h<f.length;h+=1){var p=f[h],d=i.getTile(p),A=d.getBucket(n);if(A&&A.text&&A.text.segments.get().length){var g=A.textSizeData,m=t.evaluateSizeForZoom(g,u.zoom),y=ue(d,1,r.transform.zoom),v=Zt(p.posMatrix,l,c,r.transform,y),_="none"!==n.layout.get("icon-text-fit")&&A.hasIconData();if(m){var b=Math.pow(2,u.zoom-d.tileID.overscaledZ);Qr(A,c,l,s,t.symbolSize,u,v,p.posMatrix,b,m,_)}}}}(i,e,n,r,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&Kr(e,r,n,i,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),a,s),0!==n.paint.get("text-opacity").constantOr(1)&&Kr(e,r,n,i,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),a,s),r.map.showCollisionBoxes&&(qr(e,r,n,i,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),qr(e,r,n,i,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))}},circle:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),u=void 0!==n.layout.get("circle-sort-key").constantOr(1);if(0!==o.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var c=e.context,l=c.gl,h=e.depthModeForSublayer(0,Et.ReadOnly),f=St.disabled,p=e.colorModeForRenderPass(),d=[],A=0;A<i.length;A++){var g=i[A],m=r.getTile(g),y=m.getBucket(n);if(y){var v=y.programConfigurations.get(n.id),_={programConfiguration:v,program:e.useProgram("circle",v),layoutVertexBuffer:y.layoutVertexBuffer,indexBuffer:y.indexBuffer,uniformValues:xr(e,g,m,n)};if(u)for(var b=0,x=y.segments.get();b<x.length;b+=1){var w=x[b];d.push({segments:new t.SegmentVector([w]),sortKey:w.sortKey,state:_})}else d.push({segments:y.segments,sortKey:0,state:_})}}u&&d.sort((function(t,e){return t.sortKey-e.sortKey}));for(var E=0,S=d;E<S.length;E+=1){var O=S[E],T=O.state,P=T.programConfiguration,M=T.program,C=T.layoutVertexBuffer,I=T.indexBuffer,k=T.uniformValues,R=O.segments;M.draw(c,l.TRIANGLES,h,f,p,Tt.disabled,k,n.id,C,I,R,n.paint,e.transform.zoom,P)}}}},heatmap:function(e,r,n,i){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=e.depthModeForSublayer(0,Et.ReadOnly),u=St.disabled,c=new Ot([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,r){var n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var i=r.heatmapFbo;if(i)n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer);else{var o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),i=r.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4),function t(e,r,n,i){var o=e.gl;o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r.width/4,r.height/4,0,o.RGBA,e.extTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:o.UNSIGNED_BYTE,null),i.colorAttachment.set(n),e.extTextureHalfFloat&&o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE&&(e.extTextureHalfFloat=null,i.colorAttachment.setDirty(),t(e,r,n,i))}(t,e,o,i)}}(o,e,n),o.clear({color:t.Color.transparent});for(var l=0;l<i.length;l++){var h=i[l];if(!r.hasRenderableParent(h)){var f=r.getTile(h),p=f.getBucket(n);if(p){var d=p.programConfigurations.get(n.id),A=e.useProgram("heatmap",d),g=e.transform.zoom;A.draw(o,a.TRIANGLES,s,u,c,Tt.disabled,Tr(h.posMatrix,f,g,n.paint.get("heatmap-intensity")),n.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,n.paint,e.transform.zoom,d)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,r){var n=e.context,i=n.gl,o=r.heatmapFbo;if(o){n.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(i.TEXTURE1);var a=r.colorRampTexture;a||(a=r.colorRampTexture=new t.Texture(n,r.colorRamp,i.RGBA)),a.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,i.TRIANGLES,Et.disabled,St.disabled,e.colorModeForRenderPass(),Tt.disabled,function(e,r,n,i){var o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);var a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:n,u_color_ramp:i,u_opacity:r.paint.get("heatmap-opacity")}}(e,r,0,1),r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom)}}(e,n))},line:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1)){var s=e.depthModeForSublayer(0,Et.ReadOnly),u=e.colorModeForRenderPass(),c=n.paint.get("line-dasharray"),l=n.paint.get("line-pattern"),h=l.constantOr(1),f=n.paint.get("line-gradient"),p=n.getCrossfadeParameters(),d=c?"lineSDF":h?"linePattern":f?"lineGradient":"line",A=e.context,g=A.gl,m=!0;if(f){A.activeTexture.set(g.TEXTURE0);var y=n.gradientTexture;if(!n.gradient)return;y||(y=n.gradientTexture=new t.Texture(A,n.gradient,g.RGBA)),y.bind(g.LINEAR,g.CLAMP_TO_EDGE)}for(var v=0,_=i;v<_.length;v+=1){var b=_[v],x=r.getTile(b);if(!h||x.patternsLoaded()){var w=x.getBucket(n);if(w){var E=w.programConfigurations.get(n.id),S=e.context.program.get(),O=e.useProgram(d,E),T=m||O.program!==S,P=l.constantOr(null);if(P&&x.imageAtlas){var M=x.imageAtlas,C=M.patternPositions[P.to.toString()],I=M.patternPositions[P.from.toString()];C&&I&&E.setConstantPatternPositions(C,I)}var k=c?kr(e,x,n,c,p):h?Ir(e,x,n,p):f?Cr(e,x,n):Mr(e,x,n);c&&(T||e.lineAtlas.dirty)?(A.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(A)):h&&(A.activeTexture.set(g.TEXTURE0),x.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),E.updatePatternPaintBuffers(p)),O.draw(A,g.TRIANGLES,s,e.stencilModeForClipping(b),u,Tt.disabled,k,n.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,n.paint,e.transform.zoom,E),m=!1}}}}}},fill:function(e,r,n,i){var o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),u=n.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){var l=e.depthModeForSublayer(1,"opaque"===e.renderPass?Et.ReadWrite:Et.ReadOnly);Jr(e,r,n,i,l,s,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){var h=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Et.ReadOnly);Jr(e,r,n,i,h,s,!0)}}},"fill-extrusion":function(t,e,r,n){var i=r.paint.get("fill-extrusion-opacity");if(0!==i&&"translucent"===t.renderPass){var o=new Et(t.context.gl.LEQUAL,Et.ReadWrite,t.depthRangeFor3D);if(1!==i||r.paint.get("fill-extrusion-pattern").constantOr(1))tn(t,e,r,n,o,St.disabled,Ot.disabled),tn(t,e,r,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();tn(t,e,r,n,o,St.disabled,a)}}},hillshade:function(t,e,r,n){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var i=t.context,o=e.getSource().maxzoom,a=t.depthModeForSublayer(0,Et.ReadOnly),s=St.disabled,u=t.colorModeForRenderPass(),c=0,l=n;c<l.length;c+=1){var h=l[c],f=e.getTile(h);f.needsHillshadePrepare&&"offscreen"===t.renderPass?rn(t,f,r,o,a,s,u):"translucent"===t.renderPass&&en(t,f,r,a,s,u)}i.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,r,n){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity"))for(var i=t.context,o=i.gl,a=e.getSource(),s=t.useProgram("raster"),u=St.disabled,c=t.colorModeForRenderPass(),l=n.length&&n[0].overscaledZ,h=!t.options.moving,f=0,p=n;f<p.length;f+=1){var d=p[f],A=t.depthModeForSublayer(d.overscaledZ-l,1===r.paint.get("raster-opacity")?Et.ReadWrite:Et.ReadOnly,o.LESS),g=e.getTile(d),m=t.transform.calculatePosMatrix(d.toUnwrapped(),h);g.registerFadeDuration(r.paint.get("raster-fade-duration"));var y=e.findLoadedParent(d,0),v=nn(g,y,e,r,t.transform),_=void 0,b=void 0,x="nearest"===r.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),g.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),y?(y.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),_=Math.pow(2,y.tileID.overscaledZ-g.tileID.overscaledZ),b=[g.tileID.canonical.x*_%1,g.tileID.canonical.y*_%1]):g.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var w=jr(m,b||[0,0],_||1,v,r);a instanceof I?s.draw(i,o.TRIANGLES,A,u,c,Tt.disabled,w,r.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):g.maskedBoundsBuffer&&g.maskedIndexBuffer&&g.segments?s.draw(i,o.TRIANGLES,A,u,c,Tt.disabled,w,r.id,g.maskedBoundsBuffer,g.maskedIndexBuffer,g.segments,r.paint,t.transform.zoom):s.draw(i,o.TRIANGLES,A,u,c,Tt.disabled,w,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,r){var n=r.paint.get("background-color"),i=r.paint.get("background-opacity");if(0!==i){var o=t.context,a=o.gl,s=t.transform,u=s.tileSize,c=r.paint.get("background-pattern");if(!t.isPatternMissing(c)){var l=!c&&1===n.a&&1===i&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===l){var h=St.disabled,f=t.depthModeForSublayer(0,"opaque"===l?Et.ReadWrite:Et.ReadOnly),p=t.colorModeForRenderPass(),d=t.useProgram(c?"backgroundPattern":"background"),A=s.coveringTiles({tileSize:u});c&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var g=r.getCrossfadeParameters(),m=0,y=A;m<y.length;m+=1){var v=y[m],_=t.transform.calculatePosMatrix(v.toUnwrapped()),b=c?Ur(_,i,t,c,{tileID:v,tileSize:u},g):Nr(_,i,n);d.draw(o,a.TRIANGLES,f,h,p,Tt.disabled,b,r.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,r){for(var n=0;n<r.length;n++)on(t,e,r[n])},custom:function(t,e,r){var n=t.context,i=r.implementation;if("offscreen"===t.renderPass){var o=i.prerender;o&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),o.call(i,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(St.disabled);var a="3d"===i.renderingMode?new Et(t.context.gl.LEQUAL,Et.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Et.ReadOnly);n.setDepthMode(a),i.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}},un=function(e,r){this.context=new Pt(e),this.transform=r,this._tileTextures={},this.setup(),this.numSublayers=Mt.maxUnderzooming+Mt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.depthRboNeedsClear=!0,this.emptyProgramConfiguration=new t.ProgramConfiguration,this.crossTileSymbolIndex=new Re,this.gpuTimers={}};function cn(t,e){if(t.y>e.y){var r=t;t=e,e=r}return{x0:t.x,y0:t.y,x1:e.x,y1:e.y,dx:e.x-t.x,dy:e.y-t.y}}function ln(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx<e.x1:t.x1-e.dy/t.dy*t.dx<e.x0){var s=t;t=e,e=s}for(var u=t.dx/t.dy,c=e.dx/e.dy,l=t.dx>0,h=e.dx<0,f=o;f<a;f++){var p=u*Math.max(0,Math.min(t.dy,f+l-t.y0))+t.x0,d=c*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(d),Math.ceil(p),f)}}function hn(t,e,r,n,i,o){var a,s=cn(t,e),u=cn(e,r),c=cn(r,t);s.dy>u.dy&&(a=s,s=u,u=a),s.dy>c.dy&&(a=s,s=c,c=a),u.dy>c.dy&&(a=u,u=c,c=a),s.dy&&ln(c,s,n,i,o),u.dy&&ln(c,u,n,i,o)}un.prototype.resize=function(e,r){var n=this.context.gl;if(this.width=e*t.browser.devicePixelRatio,this.height=r*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var i=0,o=this.style._order;i<o.length;i+=1){var a=o[i];this.style._layers[a].resize()}this.depthRbo&&(n.deleteRenderbuffer(this.depthRbo),this.depthRbo=null)},un.prototype.setup=function(){var e=this.context,r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(r,Fe.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,Fe.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var i=new t.StructArrayLayout4i8;i.emplaceBack(0,0,0,0),i.emplaceBack(t.EXTENT,0,t.EXTENT,0),i.emplaceBack(0,t.EXTENT,0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(i,t.rasterBoundsAttributes.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Fe.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);var u=this.context.gl;this.stencilClearMode=new St({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO)},un.prototype.clearStencil=function(){var e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,r.TRIANGLES,Et.disabled,this.stencilClearMode,Ot.disabled,Tt.disabled,Or(n),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},un.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var r=this.context,n=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(Ot.disabled),r.setDepthMode(Et.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o<a.length;o+=1){var s=a[o],u=this._tileClippingMaskIDs[s.key]=this.nextStencilID++;i.draw(r,n.TRIANGLES,Et.disabled,new St({func:n.ALWAYS,mask:0},u,255,n.KEEP,n.KEEP,n.REPLACE),Ot.disabled,Tt.disabled,Or(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},un.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new St({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},un.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new St({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},un.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new Ot([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?Ot.unblended:Ot.alphaBlended},un.prototype.depthModeForSublayer=function(t,e,r){if(!this.opaquePassEnabledForLayer())return Et.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Et(r||this.context.gl.LEQUAL,e,[n,n])},un.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},un.prototype.render=function(e,r){var n=this;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();var i=this.style._order,o=this.style.sourceCaches;for(var a in o){var s=o[a];s.used&&s.prepare(this.context)}var u,c,l={},h={},f={};for(var p in o){var d=o[p];l[p]=d.getVisibleCoordinates(),h[p]=l[p].slice().reverse(),f[p]=d.getVisibleCoordinates(!0).reverse()}for(var A in o){var g=o[A],m=g.getSource();if("raster"===m.type||"raster-dem"===m.type){for(var y=[],v=0,_=l[A];v<_.length;v+=1){var b=_[v];y.push(g.getTile(b))}Gr(y,this.context)}}this.opaquePassCutoff=1/0;for(var x=0;x<i.length;x++){var w=i[x];if(this.style._layers[w].is3D()){this.opaquePassCutoff=x;break}}this.renderPass="offscreen",this.depthRboNeedsClear=!0;for(var E=0,S=i;E<S.length;E+=1){var O=S[E],T=this.style._layers[O];if(T.hasOffscreenPass()&&!T.isHidden(this.transform.zoom)){var P=h[T.source];("custom"===T.type||P.length)&&this.renderLayer(this,o[T.source],T,P)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){var M=this.style._layers[i[this.currentLayer]],C=o[M.source],I=l[M.source];this._renderTileClippingMasks(M,I),this.renderLayer(this,C,M,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){var k=this.style._layers[i[this.currentLayer]],R=o[k.source],L=("symbol"===k.type?f:h)[k.source];this._renderTileClippingMasks(k,l[k.source]),this.renderLayer(this,R,k,L)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(n.transform.zoom)&&(t.source!==(c&&c.id)&&(c=n.style.sourceCaches[t.source]),(!u||u.getSource().maxzoom<c.getSource().maxzoom)&&(u=c))})),u&&sn.debug(this,u,u.getVisibleCoordinates())),this.context.setDefault()},un.prototype.setupOffscreenDepthRenderbuffer=function(){var t=this.context;this.depthRbo||(this.depthRbo=t.createRenderbuffer(t.gl.DEPTH_COMPONENT16,this.width,this.height))},un.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||n.length)&&(this.id=r.id,this.gpuTimingStart(r),sn[r.type](t,e,r,n,this.style.placement.variableOffsets),this.gpuTimingEnd())},un.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,r=this.gpuTimers[t.id];r||(r=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),r.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,r.query)}},un.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},un.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},un.prototype.queryGpuTimers=function(t){var e={};for(var r in t){var n=t[r],i=this.context.extTimerQuery,o=i.getQueryObjectEXT(n.query,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(n.query),e[r]=o}return e},un.prototype.translatePosMatrix=function(e,r,n,i,o){if(!n[0]&&!n[1])return e;var a=o?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(a){var s=Math.sin(a),u=Math.cos(a);n=[n[0]*u-n[1]*s,n[0]*s+n[1]*u]}var c=[o?n[0]:ue(r,n[0],this.transform.zoom),o?n[1]:ue(r,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,c),l},un.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},un.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},un.prototype.isPatternMissing=function(t){if(!t)return!1;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},un.prototype.useProgram=function(t,e){void 0===e&&(e=this.emptyProgramConfiguration),this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new dr(this.context,fr[t],e,Vr[t],this._showOverdrawInspector)),this.cache[r]},un.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},un.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)};var fn=function(e,r,n,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},pn={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};fn.prototype.clone=function(){var t=new fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},pn.minZoom.get=function(){return this._minZoom},pn.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},pn.maxZoom.get=function(){return this._maxZoom},pn.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},pn.minPitch.get=function(){return this._minPitch},pn.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},pn.maxPitch.get=function(){return this._maxPitch},pn.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},pn.renderWorldCopies.get=function(){return this._renderWorldCopies},pn.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},pn.worldSize.get=function(){return this.tileSize*this.scale},pn.centerPoint.get=function(){return this.size._div(2)},pn.size.get=function(){return new t.Point(this.width,this.height)},pn.bearing.get=function(){return-this.angle/Math.PI*180},pn.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},pn.pitch.get=function(){return this._pitch/Math.PI*180},pn.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},pn.fov.get=function(){return this._fov/Math.PI*180},pn.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},pn.zoom.get=function(){return this._zoom},pn.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},pn.center.get=function(){return this._center},pn.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},fn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},fn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),u=Math.floor(Math.max(n.x,i.x,o.x,a.x)),c=s-1;c<=u+1;c++)0!==c&&r.push(new t.UnwrappedTileID(c,e));return r},fn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,r),a=new t.Point(o*i.x-.5,o*i.y-.5);return function(e,r,n,i){void 0===i&&(i=!0);var o=1<<e,a={};function s(r,s,u){var c,l,h,f;if(u>=0&&u<=o)for(c=r;c<s;c++)l=Math.floor(c/o),h=(c%o+o)%o,0!==l&&!0!==i||(f=new t.OverscaledTileID(n,l,e,h,u),a[f.key]=f)}var u=r.map((function(e){return new t.Point(e.x,e.y)._mult(o)}));return hn(u[0],u[1],u[2],0,o,s),hn(u[2],u[3],u[0],0,o,s),Object.keys(a).map((function(t){return a[t]}))}(r,[this.pointCoordinate(new t.Point(0,0)),this.pointCoordinate(new t.Point(this.width,0)),this.pointCoordinate(new t.Point(this.width,this.height)),this.pointCoordinate(new t.Point(0,this.height))],e.reparseOverscaled?n:r,this._renderWorldCopies).sort((function(t,e){return a.dist(t.canonical)-a.dist(e.canonical)}))},fn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},pn.unmodified.get=function(){return this._unmodified},fn.prototype.zoomScale=function(t){return Math.pow(2,t)},fn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},fn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},fn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},pn.point.get=function(){return this.project(this.center)},fn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-i.x),o.y-(n.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},fn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},fn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},fn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},fn.prototype.coordinateLocation=function(t){return t.toLngLat()},fn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],a=r[0]/i,s=n[0]/o,u=r[1]/i,c=n[1]/o,l=r[2]/i,h=n[2]/o,f=l===h?0:(0-l)/(h-l);return new t.MercatorCoordinate(t.number(a,s,f)/this.worldSize,t.number(u,c,f)/this.worldSize)},fn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},fn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},fn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},fn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},fn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,u=t.identity(new Float64Array(16));return t.translate(u,u,[s*a,o.y*a,0]),t.scale(u,u,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(u,r?this.alignedProjMatrix:this.projMatrix,u),i[n]=new Float32Array(u),i[n]},fn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},fn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,o=-90,a=90,s=-180,u=180,c=this.size,l=this._unmodified;if(this.latRange){var h=this.latRange;o=t.mercatorYfromLat(h[1])*this.worldSize,e=(a=t.mercatorYfromLat(h[0])*this.worldSize)-o<c.y?c.y/(a-o):0}if(this.lngRange){var f=this.lngRange;s=t.mercatorXfromLng(f[0])*this.worldSize,r=(u=t.mercatorXfromLng(f[1])*this.worldSize)-s<c.x?c.x/(u-s):0}var p=this.point,d=Math.max(r||0,e||0);if(d)return this.center=this.unproject(new t.Point(r?(u+s)/2:p.x,e?(a+o)/2:p.y)),this.zoom+=this.scaleZoom(d),this._unmodified=l,void(this._constraining=!1);if(this.latRange){var A=p.y,g=c.y/2;A-g<o&&(i=o+g),A+g>a&&(i=a-g)}if(this.lngRange){var m=p.x,y=c.x/2;m-y<s&&(n=s+y),m+y>u&&(n=u-y)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:p.x,void 0!==i?i:p.y))),this._unmodified=l,this._constraining=!1}},fn.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,r=Math.PI/2+this._pitch,n=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-r-e),i=this.point,o=i.x,a=i.y,s=1.01*(Math.cos(Math.PI/2-this._pitch)*n+this.cameraToCenterDistance),u=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,s),t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-o,-a,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c;var l=this.width%2/2,h=this.height%2/2,f=Math.cos(this.angle),p=Math.sin(this.angle),d=o-Math.round(o)+f*l+p*h,A=a-Math.round(a)+f*h+p*l,g=new Float64Array(c);if(t.translate(g,g,[d>.5?d-1:d,A>.5?A-1:A,0]),this.alignedProjMatrix=g,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},fn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},fn.prototype.getCameraPoint=function(){var e=this._pitch,r=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,r))},fn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,o=r.x,a=r.y,s=0,u=e;s<u.length;s+=1){var c=u[s];n=Math.min(n,c.x),i=Math.min(i,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y)}return[new t.Point(n,i),new t.Point(o,i),new t.Point(o,a),new t.Point(n,a),new t.Point(n,i)]},Object.defineProperties(fn.prototype,pn);var dn=function(e){var r,n,i,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(r=this._updateHashUnthrottled.bind(this),n=!1,i=null,o=function(){i=null,n&&(r(),i=setTimeout(o,300),n=!1)},function(){return n=!0,i||o(),i})};dn.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},dn.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},dn.prototype.getHashString=function(e){var r=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(r.lng*o)/o,s=Math.round(r.lat*o)/o,u=this._map.getBearing(),c=this._map.getPitch(),l="";if(l+=e?"/"+a+"/"+s+"/"+n:n+"/"+s+"/"+a,(u||c)&&(l+="/"+Math.round(10*u)/10),c&&(l+="/"+Math.round(c)),this._hashName){var h=this._hashName,f=!1,p=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===h?(f=!0,e+"="+l):t})).filter((function(t){return t}));return f||p.push(h+"="+l),"#"+p.join("&")}return"#"+l},dn.prototype._getCurrentHash=function(){var e,r=this,n=t.window.location.hash.replace("#","");return this._hashName?(n.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===r._hashName&&(e=t)})),(e&&e[1]||"").split("/")):n.split("/")},dn.prototype._onHashChange=function(){var t=this._getCurrentHash();return t.length>=3&&!t.some((function(t){return isNaN(t)}))&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},dn.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var An=function(e){function n(n,i,o,a){void 0===a&&(a={});var s=r.mousePos(i.getCanvasContainer(),o),u=i.unproject(s);e.call(this,n,t.extend({point:s,lngLat:u,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),gn=function(e){function n(n,i,o){var a=r.touchPos(i.getCanvasContainer(),o),s=a.map((function(t){return i.unproject(t)})),u=a.reduce((function(t,e,r,n){return t.add(e.div(n.length))}),new t.Point(0,0)),c=i.unproject(u);e.call(this,n,{points:a,point:u,lngLats:s,lngLat:c,originalEvent:o}),this._defaultPrevented=!1}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),mn=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),yn=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};yn.prototype.setZoomRate=function(t){this._defaultZoomRate=t},yn.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},yn.prototype.isEnabled=function(){return!!this._enabled},yn.prototype.isActive=function(){return!!this._active},yn.prototype.isZooming=function(){return!!this._zooming},yn.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},yn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},yn.prototype.onWheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this.isActive()||this._start(e)),e.preventDefault()}},yn.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},yn.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e}))),this._finishTimeout&&clearTimeout(this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},yn.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a="number"==typeof this._targetZoom?this._targetZoom:r.zoom,s=this._startZoom,u=this._easing,c=!1;if("wheel"===this._type&&s&&u){var l=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=u(l);r.zoom=t.number(s,a,h),l<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):c=!0}else r.zoom=a,c=!0;r.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom}),200))}},yn.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r};var vn=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=r.clickTolerance||1,t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};vn.prototype.isEnabled=function(){return!!this._enabled},vn.prototype.isActive=function(){return!!this._active},vn.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},vn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},vn.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.window.document.addEventListener("mousemove",this._onMouseMove,!1),t.window.document.addEventListener("keydown",this._onKeyDown,!1),t.window.document.addEventListener("mouseup",this._onMouseUp,!1),r.disableDrag(),this._startPos=this._lastPos=r.mousePos(this._el,e),this._active=!0)},vn.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);if(!(this._lastPos.equals(e)||!this._box&&e.dist(this._startPos)<this._clickTolerance)){var n=this._startPos;this._lastPos=e,this._box||(this._box=r.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var i=Math.min(n.x,e.x),o=Math.max(n.x,e.x),a=Math.min(n.y,e.y),s=Math.max(n.y,e.y);r.setTransform(this._box,"translate("+i+"px,"+a+"px)"),this._box.style.width=o-i+"px",this._box.style.height=s-a+"px"}},vn.prototype._onMouseUp=function(e){if(0===e.button){var n=this._startPos,i=r.mousePos(this._el,e);this._finish(),r.suppressClick(),n.x===i.x&&n.y===i.y?this._fireEvent("boxzoomcancel",e):this._map.fitScreenCoordinates(n,i,this._map.getBearing(),{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e}))}},vn.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},vn.prototype._finish=function(){this._active=!1,t.window.document.removeEventListener("mousemove",this._onMouseMove,!1),t.window.document.removeEventListener("keydown",this._onKeyDown,!1),t.window.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos},vn.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var _n=t.bezier(0,0,.25,1),bn=function(e,r){this._map=e,this._el=r.element||e.getCanvasContainer(),this._state="disabled",this._button=r.button||"right",this._bearingSnap=r.bearingSnap||0,this._pitchWithRotate=!1!==r.pitchWithRotate,t.bindAll(["onMouseDown","_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this)};bn.prototype.isEnabled=function(){return"disabled"!==this._state},bn.prototype.isActive=function(){return"active"===this._state},bn.prototype.enable=function(){this.isEnabled()||(this._state="enabled")},bn.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},bn.prototype.onMouseDown=function(e){if("enabled"===this._state){var n="touchstart"===e.type;if(n)this._startTime=Date.now();else if("right"===this._button){if(this._eventButton=r.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==r.mouseButton(e))return;this._eventButton=0}r.disableDrag(),n?(t.window.document.addEventListener("touchmove",this._onMouseMove,{capture:!0}),t.window.document.addEventListener("touchend",this._onMouseUp)):(t.window.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.window.document.addEventListener("mouseup",this._onMouseUp)),t.window.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[t.browser.now(),this._map.getBearing()]],this._startPos=this._prevPos=this._lastPos=r.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault()}},bn.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);this._lastPos.equals(e)||(this._lastMoveEvent=t,this._lastPos=e,"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},bn.prototype._onDragFrame=function(){this._frameId=null;var e=this._lastMoveEvent;if(e){var r=this._map.transform,n=this._prevPos,i=this._lastPos,o=.8*(n.x-i.x),a=-.5*(n.y-i.y),s=r.bearing-o,u=r.pitch-a,c=this._inertia,l=c[c.length-1];this._drainInertiaBuffer(),c.push([t.browser.now(),this._map._normalizeBearing(s,l[1])]);var h=r.bearing;if(r.bearing=s,this._pitchWithRotate){var f=r.pitch;r.pitch=u,r.pitch!==f&&this._fireEvent("pitch",e)}r.bearing!==h&&this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._prevPos=this._lastPos}},bn.prototype._onMouseUp=function(t){if("touchend"===t.type&&this._startPos===this._lastPos&&Date.now()-this._startTime<300&&this._el.click(),r.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind()}},bn.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},bn.prototype._unbind=function(){t.window.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.window.document.removeEventListener("mouseup",this._onMouseUp),t.window.document.removeEventListener("touchmove",this._onMouseMove,{capture:!0}),t.window.document.removeEventListener("touchend",this._onMouseUp),t.window.removeEventListener("blur",this._onBlur),r.enableDrag()},bn.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._prevPos,delete this._lastPos},bn.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),i=this._inertia,o=function(){Math.abs(n)<e._bearingSnap?r.resetNorth({noMoveStart:!0},{originalEvent:t}):e._fireEvent("moveend",t),e._pitchWithRotate&&e._fireEvent("pitchend",t)};if(i.length<2)o();else{var a=i[0],s=i[i.length-1],u=i[i.length-2],c=r._normalizeBearing(n,u[1]),l=s[1]-a[1],h=l<0?-1:1,f=(s[0]-a[0])/1e3;if(0!==l&&0!==f){var p=Math.abs(l*(.25/f));p>180&&(p=180);var d=p/180;c+=h*p*(d/2),Math.abs(r._normalizeBearing(c,0))<this._bearingSnap&&(c=r._normalizeBearing(0,c)),r.rotateTo(c,{duration:1e3*d,easing:_n,noMoveStart:!0},{originalEvent:t})}else o()}},bn.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},bn.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.browser.now();e.length>0&&r-e[0][0]>160;)e.shift()};var xn={linearity:.3,easing:t.bezier(0,0,.3,1),maxSpeed:1400,deceleration:2500},wn=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",this._clickTolerance=r.clickTolerance||1,this._inertiaOptions=xn,t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};wn.prototype.isEnabled=function(){return"disabled"!==this._state},wn.prototype.isActive=function(){return"active"===this._state},wn.prototype.enable=function(e){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled",this._inertiaOptions=t.extend(xn,e))},wn.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},wn.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==r.mouseButton(e)||(r.addEventListener(t.window.document,"mousemove",this._onMove,{capture:!0}),r.addEventListener(t.window.document,"mouseup",this._onMouseUp),this._start(e)))},wn.prototype.onTouchStart=function(e){this.isEnabled()&&(e.touches&&e.touches.length>1&&("pending"===this._state||"active"===this._state)||(r.addEventListener(t.window.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.addEventListener(t.window.document,"touchend",this._onTouchEnd),this._start(e)))},wn.prototype._start=function(e){t.window.addEventListener("blur",this._onBlur),this._state="pending",this._startPos=this._mouseDownPos=this._prevPos=this._lastPos=r.mousePos(this._el,e),this._startTouch=this._lastTouch=t.window.TouchEvent&&e instanceof t.window.TouchEvent?r.touchPos(this._el,e):null,this._inertia=[[t.browser.now(),this._startPos]]},wn.prototype._touchesMatch=function(t,e){return!(!t||!e||t.length!==e.length)&&t.every((function(t,r){return e[r]===t}))},wn.prototype._onMove=function(e){e.preventDefault();var n=t.window.TouchEvent&&e instanceof t.window.TouchEvent?r.touchPos(this._el,e):null,i=r.mousePos(this._el,e);(n?this._touchesMatch(this._lastTouch,n):this._lastPos.equals(i))||"pending"===this._state&&i.dist(this._mouseDownPos)<this._clickTolerance||(this._lastMoveEvent=e,this._lastPos=i,this._lastTouch=n,this._drainInertiaBuffer(),this._inertia.push([t.browser.now(),this._lastPos]),"pending"===this._state&&(this._state="active",this._shouldStart=!0),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},wn.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t)if(this._map.touchZoomRotate.isActive())this._abort(t);else if(this._shouldStart&&(this._fireEvent("dragstart",t),this._fireEvent("movestart",t),this._shouldStart=!1),this.isActive()){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._prevPos),this._lastPos),this._fireEvent("drag",t),this._fireEvent("move",t),this._prevPos=this._lastPos,delete this._lastMoveEvent}},wn.prototype._onMouseUp=function(t){if(0===r.mouseButton(t))switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},wn.prototype._onTouchEnd=function(t){if(t.touches&&0!==t.touches.length)switch(this._state){case"pending":case"active":break;case"enabled":this.onTouchStart(t)}else switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind();break;case"enabled":this._unbind()}},wn.prototype._abort=function(e){switch(this._state){case"active":this._state="enabled",this._shouldStart||(this._fireEvent("dragend",e),this._fireEvent("moveend",e)),this._unbind(),this._deactivate(),t.window.TouchEvent&&e instanceof t.window.TouchEvent&&e.touches.length>1&&r.addEventListener(t.window.document,"touchend",this._onTouchEnd);break;case"pending":this._state="enabled",this._unbind();break;case"enabled":this._unbind()}},wn.prototype._onBlur=function(t){this._abort(t)},wn.prototype._unbind=function(){r.removeEventListener(t.window.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.removeEventListener(t.window.document,"touchend",this._onTouchEnd),r.removeEventListener(t.window.document,"mousemove",this._onMove,{capture:!0}),r.removeEventListener(t.window.document,"mouseup",this._onMouseUp),r.removeEventListener(t.window,"blur",this._onBlur)},wn.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._prevPos,delete this._mouseDownPos,delete this._lastPos,delete this._startTouch,delete this._lastTouch,delete this._shouldStart},wn.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var r=e[e.length-1],n=e[0],i=r[1].sub(n[1]),o=(r[0]-n[0])/1e3;if(0===o||r[1].equals(n[1]))this._fireEvent("moveend",t);else{var a=this._inertiaOptions,s=a.linearity,u=a.easing,c=a.maxSpeed,l=a.deceleration,h=i.mult(s/o),f=h.mag();f>c&&(f=c,h._unit()._mult(f));var p=f/(l*s),d=h.mult(-p/2);this._map.panBy(d,{duration:1e3*p,easing:u,noMoveStart:!0},{originalEvent:t})}}},wn.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},wn.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.browser.now();e.length>0&&r-e[0][0]>160;)e.shift()};var En=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function Sn(t){return t*(2-t)}En.prototype.isEnabled=function(){return!!this._enabled},En.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},En.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},En.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,n=0,i=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),i=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),i=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(o=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),u={duration:300,delayEndEvents:500,easing:Sn,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*r,pitch:a.getPitch()+10*n,offset:[100*-i,100*-o],center:a.getCenter()};a.easeTo(u,{originalEvent:t})}};var On=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};On.prototype.isEnabled=function(){return!!this._enabled},On.prototype.isActive=function(){return!!this._active},On.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},On.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},On.prototype.onTouchStart=function(t){var e=this;if(this.isEnabled()&&!(t.points.length>1))if(this._tapped){var r=t.points[0],n=this._tappedPoint;if(n&&n.dist(r)<=30){t.originalEvent.preventDefault();var i=function(){e._tapped&&e._zoom(t),e._map.off("touchcancel",o),e._resetTapped()},o=function(){e._map.off("touchend",i),e._resetTapped()};this._map.once("touchend",i),this._map.once("touchcancel",o)}else this._resetTapped()}else this._tappedPoint=t.points[0],this._tapped=setTimeout((function(){e._tapped=null,e._tappedPoint=null}),300)},On.prototype._resetTapped=function(){clearTimeout(this._tapped),this._tapped=null,this._tappedPoint=null},On.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},On.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},On.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var Tn=t.bezier(0,0,.15,1),Pn=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};Pn.prototype.isEnabled=function(){return!!this._enabled},Pn.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},Pn.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},Pn.prototype.disableRotation=function(){this._rotationDisabled=!0},Pn.prototype.enableRotation=function(){this._rotationDisabled=!1},Pn.prototype.isActive=function(){return this.isEnabled()&&!!this._gestureIntent},Pn.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var n=r.mousePos(this._el,e.touches[0]),i=r.mousePos(this._el,e.touches[1]),o=n.add(i).div(2);this._startVec=n.sub(i),this._startAround=this._map.transform.pointLocation(o),this._gestureIntent=void 0,this._inertia=[],r.addEventListener(t.window.document,"touchmove",this._onMove,{passive:!1}),r.addEventListener(t.window.document,"touchend",this._onEnd)}},Pn.prototype._getTouchEventData=function(t){var e=r.mousePos(this._el,t.touches[0]),n=r.mousePos(this._el,t.touches[1]),i=e.sub(n);return{vec:i,center:e.add(n).div(2),scale:i.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*i.angleWith(this._startVec)/Math.PI}},Pn.prototype._onMove=function(e){if(2===e.touches.length){var r=this._getTouchEventData(e),n=r.vec,i=r.scale,o=r.bearing;if(!this._gestureIntent){var a=this._rotationDisabled&&1!==i||Math.abs(1-i)>.15;Math.abs(o)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=n)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},Pn.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var r=this._map.transform;this._startScale||(this._startScale=r.scale,this._startBearing=r.bearing);var n=this._getTouchEventData(this._lastTouchEvent),i=n.center,o=n.bearing,a=n.scale,s=r.pointLocation(i),u=r.locationPoint(s);"rotate"===e&&(r.bearing=this._startBearing+o),r.zoom=r.scaleZoom(this._startScale*a),r.setLocationAtPoint(this._startAround,u),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([t.browser.now(),a,i])}},Pn.prototype._onEnd=function(e){r.removeEventListener(t.window.document,"touchmove",this._onMove,{passive:!1}),r.removeEventListener(t.window.document,"touchend",this._onEnd);var n=this._gestureIntent,i=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,n){this._map.fire(new t.Event(n+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,a=this._map;if(o.length<2)a.snapToNorth({},{originalEvent:e});else{var s=o[o.length-1],u=o[0],c=a.transform.scaleZoom(i*s[1]),l=a.transform.scaleZoom(i*u[1]),h=c-l,f=(s[0]-u[0])/1e3,p=s[2];if(0!==f&&c!==l){var d=.15*h/f;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var A=1e3*Math.abs(d/(12*.15)),g=c+d*A/2e3;a.easeTo({zoom:g,duration:A,easing:Tn,around:this._aroundCenter?a.getCenter():a.unproject(p),noMoveStart:!0},{originalEvent:e})}else a.snapToNorth({},{originalEvent:e})}}},Pn.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.browser.now();e.length>2&&r-e[0][0]>160;)e.shift()};var Mn={scrollZoom:yn,boxZoom:vn,dragRotate:bn,dragPan:wn,keyboard:En,doubleClickZoom:On,touchZoomRotate:Pn},Cn=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.resetNorthPitch=function(e,r){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},r.prototype.getPitch=function(){return this.transform.pitch},r.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},r.prototype.cameraForBounds=function(e,r){return e=t.LngLatBounds.convert(e),this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),0,r)},r.prototype._cameraForBoxAndBearing=function(e,r,n,i){if("number"==typeof(i=t.extend({padding:{top:0,bottom:0,right:0,left:0},offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){var o=i.padding;i.padding={top:o,bottom:o,right:o,left:o}}if(t.deepEqual(Object.keys(i.padding).sort((function(t,e){return t<e?-1:t>e?1:0})),["bottom","left","right","top"])){var a=this.transform,s=a.project(t.LngLat.convert(e)),u=a.project(t.LngLat.convert(r)),c=s.rotate(-n*Math.PI/180),l=u.rotate(-n*Math.PI/180),h=new t.Point(Math.max(c.x,l.x),Math.max(c.y,l.y)),f=new t.Point(Math.min(c.x,l.x),Math.min(c.y,l.y)),p=h.sub(f),d=(a.width-i.padding.left-i.padding.right)/p.x,A=(a.height-i.padding.top-i.padding.bottom)/p.y;if(!(A<0||d<0)){var g=Math.min(a.scaleZoom(a.scale*Math.min(d,A)),i.maxZoom),m=t.Point.convert(i.offset),y=(i.padding.left-i.padding.right)/2,v=(i.padding.top-i.padding.bottom)/2,_=new t.Point(m.x+y,m.y+v).mult(a.scale/a.zoomScale(g));return{center:a.unproject(s.add(u).div(2).sub(_)),zoom:g,bearing:n}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'")},r.prototype.fitBounds=function(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)},r.prototype.fitScreenCoordinates=function(e,r,n,i,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(r)),n,i),i,o)},r.prototype._fitInternal=function(e,r,n){return e?(r=t.extend(e,r)).linear?this.easeTo(r,n):this.flyTo(r,n):this},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(i=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),i&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this.stop(),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),u="zoom"in e?+e.zoom:o,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,l="pitch"in e?+e.pitch:s,h=i.centerPoint.add(t.Point.convert(e.offset)),f=i.pointLocation(h),p=t.LngLat.convert(e.center||f);this._normalizeCenter(p);var d,A,g=i.project(f),m=i.project(p).sub(g),y=i.zoomScale(u-o);return e.around&&(d=t.LngLat.convert(e.around),A=i.locationPoint(d)),this._zooming=u!==o,this._rotating=a!==c,this._pitching=l!==s,this._prepareEase(r,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease((function(e){if(n._zooming&&(i.zoom=t.number(o,u,e)),n._rotating&&(i.bearing=t.number(a,c,e)),n._pitching&&(i.pitch=t.number(s,l,e)),d)i.setLocationAtPoint(d,A);else{var f=i.zoomScale(i.zoom-o),p=u>o?Math.min(2,y):Math.max(.5,y),v=Math.pow(p,1-e),_=i.unproject(g.add(m.mult(e*v)).mult(f));i.setLocationAtPoint(i.renderWorldCopies?_.wrap():_,h)}n._fireMoveEvents(r)}),(function(){e.delayEndEvents?n._easeEndTimeoutID=setTimeout((function(){return n._afterEase(r)}),e.delayEndEvents):n._afterEase(r)}),e),this},r.prototype._prepareEase=function(e,r){this._moving=!0,r||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e){var r=this._zooming,n=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),i&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),u=this.getPitch(),c="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,l="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:u,f=o.zoomScale(c-a),p=o.centerPoint.add(t.Point.convert(e.offset)),d=o.pointLocation(p),A=t.LngLat.convert(e.center||d);this._normalizeCenter(A);var g=o.project(d),m=o.project(A).sub(g),y=e.curve,v=Math.max(o.width,o.height),_=v/f,b=m.mag();if("minZoom"in e){var x=t.clamp(Math.min(e.minZoom,a,c),o.minZoom,o.maxZoom),w=v/o.zoomScale(x-a);y=Math.sqrt(w/b*2)}var E=y*y;function S(t){var e=(_*_-v*v+(t?-1:1)*E*E*b*b)/(2*(t?_:v)*E*b);return Math.log(Math.sqrt(e*e+1)-e)}function O(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}var P=S(0),M=function(t){return T(P)/T(P+y*t)},C=function(t){return v*((T(P)*(O(e=P+y*t)/T(e))-O(P))/E)/b;var e},I=(S(1)-P)/y;if(Math.abs(b)<1e-6||!isFinite(I)){if(Math.abs(v-_)<1e-6)return this.easeTo(e,r);var k=_<v?-1:1;I=Math.abs(Math.log(_/v))/y,C=function(){return 0},M=function(t){return Math.exp(k*y*t)}}if("duration"in e)e.duration=+e.duration;else{var R="screenSpeed"in e?+e.screenSpeed/y:+e.speed;e.duration=1e3*I/R}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==l,this._pitching=h!==u,this._prepareEase(r,!1),this._ease((function(e){var i=e*I,f=1/M(i);o.zoom=1===e?c:a+o.scaleZoom(f),n._rotating&&(o.bearing=t.number(s,l,e)),n._pitching&&(o.pitch=t.number(u,h,e));var d=1===e?A:o.unproject(g.add(m.mult(C(i))).mult(f));o.setLocationAtPoint(o.renderWorldCopies?d.wrap():d,p),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)<n&&(e-=360),Math.abs(e+360-r)<n&&(e+=360),e},r.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}},r}(t.Evented),In=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};In.prototype.getDefaultPosition=function(){return"bottom-right"},In.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},In.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},In.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n<r.length-1?"&":"")),t}),"?");e.href=t.config.FEEDBACK_URL+"/"+n+(this._map._hash?this._map._hash.getHashString(!0):""),e.rel="noopener nofollow"}},In.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},In.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return"string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var r=this._map.style.sourceCaches;for(var n in r){var i=r[n];if(i.used){var o=i.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,r){for(var n=r+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},In.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var kn=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};kn.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},kn.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},kn.prototype.getDefaultPosition=function(){return"bottom-left"},kn.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},kn.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},kn.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var Rn=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};Rn.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},Rn.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;r<n.length;r+=1){var i=n[r];if(i.id===t)return void(i.cancelled=!0)}},Rn.prototype.run=function(){var t=this._currentlyRunning=this._queue;this._queue=[];for(var e=0,r=t;e<r.length;e+=1){var n=r[e];if(!n.cancelled&&(n.callback(),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},Rn.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var Ln={"FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},jn=t.window.HTMLImageElement,Dn=t.window.HTMLElement,Bn={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,clickTolerance:3,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Fn=function(n){function i(e){var i=this;if(null!=(e=t.extend({},Bn,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var o=new fn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,o,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Rn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},Ln,e.locale),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof Dn))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return i._update(!1)})),this.on("moveend",(function(){return i._update(!1)})),this.on("zoom",(function(){return i._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var n=t.getCanvasContainer(),i=null,o=!1,a=null;for(var s in Mn)t[s]=new Mn[s](t,e),e.interactive&&e[s]&&t[s].enable(e[s]);r.addEventListener(n,"mouseout",(function(e){t.fire(new An("mouseout",t,e))})),r.addEventListener(n,"mousedown",(function(i){o=!0,a=r.mousePos(n,i);var s=new An("mousedown",t,i);t.fire(s),s.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(i),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(i),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(i))})),r.addEventListener(n,"mouseup",(function(e){var r=t.dragRotate.isActive();i&&!r&&t.fire(new An("contextmenu",t,i)),i=null,o=!1,t.fire(new An("mouseup",t,e))})),r.addEventListener(n,"mousemove",(function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new An("mousemove",t,e))}})),r.addEventListener(n,"mouseover",(function(e){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new An("mouseover",t,e))})),r.addEventListener(n,"touchstart",(function(r){var n=new gn("touchstart",t,r);t.fire(n),n.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(r),t.touchZoomRotate.onStart(r),t.doubleClickZoom.onTouchStart(n))}),{passive:!1}),r.addEventListener(n,"touchmove",(function(e){t.fire(new gn("touchmove",t,e))}),{passive:!1}),r.addEventListener(n,"touchend",(function(e){t.fire(new gn("touchend",t,e))})),r.addEventListener(n,"touchcancel",(function(e){t.fire(new gn("touchcancel",t,e))})),r.addEventListener(n,"click",(function(i){var o=r.mousePos(n,i);(!a||o.equals(a)||o.dist(a)<e.clickTolerance)&&t.fire(new An("click",t,i))})),r.addEventListener(n,"dblclick",(function(e){var r=new An("dblclick",t,e);t.fire(r),r.defaultPrevented||t.doubleClickZoom.onDblClick(r)})),r.addEventListener(n,"contextmenu",(function(e){var r=t.dragRotate.isActive();o||r?o&&(i=e):t.fire(new An("contextmenu",t,e)),(t.dragRotate.isEnabled()||t.listens("contextmenu"))&&e.preventDefault()})),r.addEventListener(n,"wheel",(function(r){e.interactive&&t.stop();var n=new mn("wheel",t,r);t.fire(n),n.defaultPrevented||t.scrollZoom.onWheel(r)}),{passive:!1})}(this,e);var a="string"==typeof e.hash&&e.hash||void 0;this._hash=e.hash&&new dn(a).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new In({customAttribution:e.customAttribution})),this.addControl(new kn,e.logoPosition),this.on("style.load",(function(){i.transform.unmodified&&i.jumpTo(i.style.stylesheet)})),this.on("data",(function(e){i._update("style"===e.dataType),i.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){i.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var o={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];return this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},i.prototype.getMinZoom=function(){return this.transform.minZoom},i.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},i.prototype.getMinPitch=function(){return this.transform.minPitch},i.prototype.setMaxPitch=function(t){if((t=null==t?60:t)>60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},i.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},i.prototype.on=function(t,e,r){var i=this;if(void 0===r)return n.prototype.on.call(this,t,e);var o=function(){var n;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var a=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?o||(o=!0,r.call(i,new An(t,i,n.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(i,new An(t,i,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(i,new An(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}}();for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o),o.delegates)this.on(a,o.delegates[a]);return this},i.prototype.off=function(t,e,r){if(void 0===r)return n.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var i=this._delegatedListeners[t],o=0;o<i.length;o++){var a=i[o];if(a.layer===e&&a.listener===r){for(var s in a.delegates)this.off(s,a.delegates[s]);return i.splice(o,1),this}}return this},i.prototype.queryRenderedFeatures=function(e,r){if(!this.style)return[];var n;if(void 0!==r||void 0===e||e instanceof t.Point||Array.isArray(e)||(r=e,e=void 0),r=r||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])n=[t.Point.convert(e)];else{var i=t.Point.convert(e[0]),o=t.Point.convert(e[1]);n=[i,new t.Point(o.x,i.y),o,new t.Point(i.x,o.y),i]}return this.style.queryRenderedFeatures(n,r,this.transform)},i.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},i.prototype.setStyle=function(e,r){return!1!==(r=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))},i.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},i.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new Be(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)},i.prototype._diffStyle=function(e,r){var n=this;if("string"==typeof e){var i=this._requestManager.normalizeStyleURL(e),o=this._requestManager.transformRequest(i,t.ResourceType.Style);t.getJSON(o,(function(e,i){e?n.fire(new t.ErrorEvent(e)):i&&n._updateDiff(i,r)}))}else"object"==typeof e&&this._updateDiff(e,r)},i.prototype._updateDiff=function(e,r){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce("Unable to perform style diff: "+(n.message||n.error||n)+".  Rebuilding the style from scratch."),this._updateStyle(e,r)}},i.prototype.getStyle=function(){if(this.style)return this.style.serialize()},i.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},i.prototype.addSource=function(t,e){return this.style.addSource(t,e),this._update(!0)},i.prototype.isSourceLoaded=function(e){var r=this.style&&this.style.sourceCaches[e];if(void 0!==r)return r.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},i.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var r=t[e]._tiles;for(var n in r){var i=r[n];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0},i.prototype.addSourceType=function(t,e,r){return this.style.addSourceType(t,e,r)},i.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},i.prototype.getSource=function(t){return this.style.getSource(t)},i.prototype.addImage=function(e,r,n){void 0===n&&(n={});var i=n.pixelRatio;void 0===i&&(i=1);var o=n.sdf;void 0===o&&(o=!1);var a=n.stretchX,s=n.stretchY,u=n.content;if(r instanceof jn){var c=t.browser.getImageData(r),l=c.width,h=c.height,f=c.data;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:h},f),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0})}else{if(void 0===r.width||void 0===r.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var p=r.width,d=r.height,A=r.data,g=r;this.style.addImage(e,{data:new t.RGBAImage({width:p,height:d},new Uint8Array(A)),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0,userImage:g}),g.onAdd&&g.onAdd(this,e)}},i.prototype.updateImage=function(e,r){var n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var i=r instanceof jn?t.browser.getImageData(r):r,o=i.width,a=i.height,s=i.data;if(void 0===o||void 0===a)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==n.data.width||a!==n.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));var u=!(r instanceof jn);n.data.replace(s,u),this.style.updateImage(e,n)},i.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},i.prototype.removeImage=function(t){this.style.removeImage(t)},i.prototype.loadImage=function(e,r){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),r)},i.prototype.listImages=function(){return this.style.listImages()},i.prototype.addLayer=function(t,e){return this.style.addLayer(t,e),this._update(!0)},i.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},i.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},i.prototype.getLayer=function(t){return this.style.getLayer(t)},i.prototype.setLayerZoomRange=function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)},i.prototype.setFilter=function(t,e,r){return void 0===r&&(r={}),this.style.setFilter(t,e,r),this._update(!0)},i.prototype.getFilter=function(t){return this.style.getFilter(t)},i.prototype.setPaintProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setPaintProperty(t,e,r,n),this._update(!0)},i.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},i.prototype.setLayoutProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setLayoutProperty(t,e,r,n),this._update(!0)},i.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},i.prototype.setLight=function(t,e){return void 0===e&&(e={}),this.style.setLight(t,e),this._update(!0)},i.prototype.getLight=function(){return this.style.getLight()},i.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},i.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},i.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},i.prototype.getContainer=function(){return this._container},i.prototype.getCanvasContainer=function(){return this._canvasContainer},i.prototype.getCanvas=function(){return this._canvas},i.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},i.prototype._detectMissingCSS=function(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")},i.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=r.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();var e=this._canvasContainer=r.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=r.create("canvas","mapboxgl-canvas",e),this._canvas.style.position="absolute",this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map");var n=this._containerDimensions();this._resizeCanvas(n[0],n[1]);var i=this._controlContainer=r.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(t){o[t]=r.create("div","mapboxgl-ctrl-"+t,i)}))},i.prototype._resizeCanvas=function(e,r){var n=t.window.devicePixelRatio||1;this._canvas.width=n*e,this._canvas.height=n*r,this._canvas.style.width=e+"px",this._canvas.style.height=r+"px"},i.prototype._setupPainter=function(){var r=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(this.painter=new un(n,this.transform),t.webpSupported.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},i.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},i.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},i.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},i.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},i.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},i.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},i.prototype._render=function(){var e,r=this,n=0,i=this.painter.context.extTimerQuery;this.listens("gpu-timing-frame")&&(e=i.createQueryEXT(),i.beginQueryEXT(i.TIME_ELAPSED_EXT,e),n=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run();var o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var a=this.transform.zoom,s=t.browser.now();this.style.zoomHistory.update(a,s);var u=new t.EvaluationParameters(a,{now:s,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=u.crossFadingFactor();1===c&&c===this._crossFadingFactor||(o=!0,this._crossFadingFactor=c),this.style.update(u)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),gpuTiming:!!this.listens("gpu-timing-layer"),fadeDuration:this._fadeDuration}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var l=t.browser.now()-n;i.endQueryEXT(i.TIME_ELAPSED_EXT,e),setTimeout((function(){var n=i.getQueryObjectEXT(e,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(e),r.fire(new t.Event("gpu-timing-frame",{cpuTime:l,gpuTime:n}))}),50)}if(this.listens("gpu-timing-layer")){var h=this.painter.collectGpuTimers();setTimeout((function(){var e=r.painter.queryGpuTimers(h);r.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}return this._sourcesDirty||this._repaint||this._styleDirty||this._placementDirty?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),this},i.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,r=this._controls;e<r.length;e+=1)r[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var n=this.painter.context.gl.getExtension("WEBGL_lose_context");n&&n.loseContext(),zn(this._canvasContainer),zn(this._controlContainer),zn(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this.fire(new t.Event("remove"))},i.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(){e._frame=null,e._render()})))},i.prototype._onWindowOnline=function(){this._update()},i.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},i.prototype._setCacheLimits=function(e,r){t.setCacheLimits(e,r)},o.version.get=function(){return t.version},Object.defineProperties(i.prototype,o),i}(Cn);function zn(t){t.parentNode&&t.parentNode.removeChild(t)}var Nn={showCompass:!0,showZoom:!0,visualizePitch:!1},Un=function(e){var n=this;this.options=t.extend({},Nn,e),this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(function(t){return n._map.zoomIn({},{originalEvent:t})})),r.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(function(t){return n._map.zoomOut({},{originalEvent:t})})),r.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(function(t){n.options.visualizePitch?n._map.resetNorthPitch({},{originalEvent:t}):n._map.resetNorth({},{originalEvent:t})})),this._compassIcon=r.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};function Vn(e,r,n){if(e=new t.LngLat(e.lng,e.lat),r){var i=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=n.locationPoint(e).distSqr(r);n.locationPoint(i).distSqr(r)<a?e=i:n.locationPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Un.prototype._updateZoomButtons=function(){var t=this._map.getZoom();this._zoomInButton.disabled=t===this._map.getMaxZoom(),this._zoomOutButton.disabled=t===this._map.getMinZoom()},Un.prototype._rotateCompassArrow=function(){var t=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassIcon.style.transform=t},Un.prototype.onAdd=function(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new bn(t,{button:"left",element:this._compass}),r.addEventListener(this._compass,"mousedown",this._handler.onMouseDown),r.addEventListener(this._compass,"touchstart",this._handler.onMouseDown,{passive:!1}),this._handler.enable()),this._container},Un.prototype.onRemove=function(){r.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),r.removeEventListener(this._compass,"mousedown",this._handler.onMouseDown),r.removeEventListener(this._compass,"touchstart",this._handler.onMouseDown,{passive:!1}),this._handler.disable(),delete this._handler),delete this._map},Un.prototype._createButton=function(t,e){var n=r.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n},Un.prototype._setButtonTitle=function(t,e){var r=this._map._getUIString("NavigationControl."+e);t.title=r,t.setAttribute("aria-label",r)};var Gn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Wn(t,e,r){var n=t.classList;for(var i in Gn)n.remove("mapboxgl-"+r+"-anchor-"+i);n.add("mapboxgl-"+r+"-anchor-"+e)}var Hn,qn=function(e){function n(n,i){var o=this;if(e.call(this),(n instanceof t.window.HTMLElement||i)&&(n=t.extend({element:n},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=n&&n.anchor||"center",this._color=n&&n.color||"#3FB1CE",this._draggable=n&&n.draggable||!1,this._state="inactive",this._rotation=n&&n.rotation||0,this._rotationAlignment=n&&n.rotationAlignment||"auto",this._pitchAlignment=n&&n.pitchAlignment&&"auto"!==n.pitchAlignment?n.pitchAlignment:this._rotationAlignment,n&&n.element)this._element=n.element,this._offset=t.Point.convert(n&&n.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");var a=r.createNS("http://www.w3.org/2000/svg","svg");a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height","41px"),a.setAttributeNS(null,"width","27px"),a.setAttributeNS(null,"viewBox","0 0 27 41");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"fill-rule","evenodd");var u=r.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill-rule","nonzero");var c=r.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(3.0, 29.0)"),c.setAttributeNS(null,"fill","#000000");for(var l=0,h=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];l<h.length;l+=1){var f=h[l],p=r.createNS("http://www.w3.org/2000/svg","ellipse");p.setAttributeNS(null,"opacity","0.04"),p.setAttributeNS(null,"cx","10.5"),p.setAttributeNS(null,"cy","5.80029008"),p.setAttributeNS(null,"rx",f.rx),p.setAttributeNS(null,"ry",f.ry),c.appendChild(p)}var d=r.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"fill",this._color);var A=r.createNS("http://www.w3.org/2000/svg","path");A.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),d.appendChild(A);var g=r.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"fill","#000000");var m=r.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),g.appendChild(m);var y=r.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(6.0, 7.0)"),y.setAttributeNS(null,"fill","#FFFFFF");var v=r.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(8.0, 8.0)");var _=r.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");var b=r.createNS("http://www.w3.org/2000/svg","circle");b.setAttributeNS(null,"fill","#FFFFFF"),b.setAttributeNS(null,"cx","5.5"),b.setAttributeNS(null,"cy","5.5"),b.setAttributeNS(null,"r","5.4999962"),v.appendChild(_),v.appendChild(b),u.appendChild(c),u.appendChild(d),u.appendChild(g),u.appendChild(y),u.appendChild(v),a.appendChild(u),this._element.appendChild(a),this._offset=t.Point.convert(n&&n.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),this._element.addEventListener("focus",(function(){var t=o._map.getContainer();t.scrollTop=0,t.scrollLeft=0})),Wn(this._element,this._anchor,"marker"),this._popup=null}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},n.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),r.remove(this._element),this._popup&&this._popup.remove(),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},n.prototype.getElement=function(){return this._element},n.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){var e=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[e,-1*(24.6+e)],"bottom-right":[-e,-1*(24.6+e)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},n.prototype._onKeyPress=function(t){var e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},n.prototype._onMapClick=function(t){var e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},n.prototype.getPopup=function(){return this._popup},n.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},n.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=Vn(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(e="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),r.setTransform(this._element,Gn[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+n+" "+e)}},n.prototype.getOffset=function(){return this._offset},n.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},n.prototype._onMove=function(e){this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag"))},n.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},n.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},n.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},n.prototype.isDraggable=function(){return this._draggable},n.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},n.prototype.getRotation=function(){return this._rotation},n.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},n.prototype.getRotationAlignment=function(){return this._rotationAlignment},n.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},n.prototype.getPitchAlignment=function(){return this._pitchAlignment},n}(t.Evented),Zn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0},Xn=function(e){function n(r){e.call(this),this.options=t.extend({},Zn,r),t.bindAll(["_onSuccess","_onError","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.onAdd=function(e){var n;return this._map=e,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==Hn?n(Hn):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){Hn="denied"!==t.state,n(Hn)})):(Hn=!!t.window.navigator.geolocation,n(Hn)),this._container},n.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),r.remove(this._container),this._map=void 0},n.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.latitude>e.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),o=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),o,{geolocateSource:!0})},n.prototype._updateMarker=function(t){t?this._userLocationDotMarker.setLngLat([t.coords.longitude,t.coords.latitude]).addTo(this._map):this._userLocationDotMarker.remove()},n.prototype._onError=function(e){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else this._setErrorState();"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new qn(this._dotElement),this.options.trackUserLocation&&(this._watchState="OFF")),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){var r=e.originalEvent&&"resize"===e.originalEvent.type;e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||r||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}"OFF"===this._watchState&&void 0!==this._geolocationWatchID?this._clearWatch():void 0===this._geolocationWatchID&&(this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,this.options.positionOptions))}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),Qn={maxWidth:100,unit:"metric"},Yn=function(e){this.options=t.extend({},Qn,e),t.bindAll(["_onMove","setUnit"],this)};function Kn(t,e,r){var n,i,o,a,s,u,c=r&&r.maxWidth||100,l=t._container.clientHeight/2,h=(n=t.unproject([0,l]),i=t.unproject([c,l]),o=Math.PI/180,a=n.lat*o,s=i.lat*o,u=Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos((i.lng-n.lng)*o),6371e3*Math.acos(Math.min(u,1)));if(r&&"imperial"===r.unit){var f=3.2808*h;f>5280?$n(e,c,f/5280,t._getUIString("ScaleControl.Miles")):$n(e,c,f,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?$n(e,c,h/1852,t._getUIString("ScaleControl.NauticalMiles")):h>=1e3?$n(e,c,h/1e3,t._getUIString("ScaleControl.Kilometers")):$n(e,c,h,t._getUIString("ScaleControl.Meters"))}function $n(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a))),u=s/r;t.style.width=e*u+"px",t.innerHTML=s+n}Yn.prototype.getDefaultPosition=function(){return"bottom-left"},Yn.prototype._onMove=function(){Kn(this._map,this._container,this.options)},Yn.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Yn.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Yn.prototype.setUnit=function(t){this.options.unit=t,Kn(this._map,this._container,this.options)};var Jn=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};Jn.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Jn.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Jn.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Jn.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Jn.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Jn.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Jn.prototype._isFullscreen=function(){return this._fullscreen},Jn.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Jn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var ti={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},ei=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(ti),r),t.bindAll(["_update","_onClickClose","remove"],this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.addTo=function(e){var r=this;return this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",(function(t){r._update(t.point)})),this._map.on("mouseup",(function(t){r._update(t.point)})),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),this._map.off("remove",this.remove),this._map.off("mousemove"),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove"),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){var t=this;return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",(function(e){t._update(e.point)})),this._map.on("drag",(function(e){t._update(e.point)})),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype.addClassName=function(t){this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container.classList.remove(t)},n.prototype.toggleClassName=function(t){return this._container.classList.toggle(t)},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClickClose))},n.prototype._update=function(e){var n=this,i=this._lngLat||this._trackPointer;if(this._map&&i&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Vn(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var o=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),a=this.options.anchor,s=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!a){var u,c=this._container.offsetWidth,l=this._container.offsetHeight;u=o.y+s.bottom.y<l?["top"]:o.y>this._map.transform.height-l?["bottom"]:[],o.x<c/2?u.push("left"):o.x>this._map.transform.width-c/2&&u.push("right"),a=0===u.length?"bottom":u.join("-")}var h=o.add(s[a]).round();r.setTransform(this._container,Gn[a]+" translate("+h.x+"px,"+h.y+"px)"),Wn(this._container,a,"popup")}},n.prototype._onClickClose=function(){this.remove()},n}(t.Evented),ri={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Fn,NavigationControl:Un,GeolocateControl:Xn,AttributionControl:In,ScaleControl:Yn,FullscreenControl:Jn,Popup:ei,Marker:qn,Style:Be,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Rt.workerCount},set workerCount(t){Rt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return ri})),r}()},function(t,e,r){"use strict";r.r(e);var n=r(2),i=r.n(n),o=r(5),a=r.n(o),s=r(6),u=r.n(s),c=r(1),l=r.n(c);function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var f=function(t){a()(r,t);var e=h(r);function r(){return i()(this,r),e.apply(this,arguments)}return r}(r(222).a);f.layerName="GreatCircleLayer",f.defaultProps={getHeight:{type:"accessor",value:0},greatCircle:!0};var p=r(3),d=r.n(p),A=r(0),g=r.n(A),m=r(190),y=r(215),v=r(10),_=r.n(v),b=r(118),x=r.n(b),w=180/Math.PI;function E(t,e,r){var n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function S(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function O(t){return[S(t[0]),S(t[1])]}function T(t,e){var r=_()(e,2),n=r[0],i=r[1];switch(t){case 0:return[1,n,i];case 1:return[-n,1,i];case 2:return[-n,-i,1];case 3:return[-1,-i,-n];case 4:return[i,-1,-n];case 5:return[i,n,-1];default:throw new Error("Invalid face")}}function P(t,e,r,n){if(0===n){1===r&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);var i=e[0];e[0]=e[1],e[1]=i}}function M(t){if("string"==typeof t){if(t.indexOf("/")>0)return t;t=function(t){var e=t.padEnd(16,"0");return x.a.fromString(e,16)}(t)}return function(t){for(var e=x.a.fromString(t,!0,10).toString(2);e.length<64;)e="0"+e;for(var r=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,r),o=i.length/2,a=x.a.fromString(n,!0,2).toString(10),s=x.a.fromString(i,!0,2).toString(4);s.length<o;)s="0"+s;return"".concat(a,"/").concat(s)}(t.toString())}function C(t){return function(t){for(var e,r,n,i,o,a,s=t.face,u=t.ij,c=t.level,l=[[0,0],[0,1],[1,1],[1,0],[0,0]],h=Math.max(1,Math.ceil(100*Math.pow(2,-c))),f=new Float64Array(4*h*2+2),p=0,d=0,A=0;A<4;A++)for(var g=l[A].slice(0),m=l[A+1],y=(m[0]-g[0])/h,v=(m[1]-g[1])/h,b=0;b<h;b++){g[0]+=y,g[1]+=v;var x=T(s,O(E(u,c,g))),S=(e=x,r=void 0,n=void 0,i=void 0,o=void 0,a=void 0,r=_()(e,3),n=r[0],i=r[1],o=r[2],a=Math.atan2(o,Math.sqrt(n*n+i*i)),[Math.atan2(i,n)*w,a*w]);Math.abs(S[1])>89.999&&(S[0]=d);var P=S[0]-d;S[0]+=P>180?-360:P<-180?360:0,f[p++]=S[0],f[p++]=S[1],d=S[0]}return f[p++]=f[0],f[p++]=f[1],f}(function(t){for(var e,r=t.split("/"),n=parseInt(r[0],10),i=r[1],o=i.length,a=[0,0],s=o-1;s>=0;s--){e=o-s;var u=i[s],c=0,l=0;"1"===u?l=1:"2"===u?(c=1,l=1):"3"===u&&(c=1);var h=Math.pow(2,e-1);P(h,a,c,l),a[0]+=h*c,a[1]+=h*l}if(n%2==1){var f=a[0];a[0]=a[1],a[1]=f}return{face:n,ij:a,level:e}}(M(t)))}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var L=R(R({},y.a.defaultProps),{},{getS2Token:{type:"accessor",value:function(t){return t.token}}}),j=function(t){a()(r,t);var e=I(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"renderLayers",value:function(){var t=this.props,e=t.data,r=t.getS2Token,n=this.props,i=n.elevationScale,o=n.extruded,a=n.wireframe,s=n.filled,u=n.stroked,c=n.lineWidthUnits,l=n.lineWidthScale,h=n.lineWidthMinPixels,f=n.lineWidthMaxPixels,p=n.lineJointRounded,d=n.lineMiterLimit,A=n.lineDashJustified,g=n.getElevation,m=n.getFillColor,v=n.getLineColor,_=n.getLineWidth,b=n.getLineDashArray,x=this.props,w=x.updateTriggers,E=x.material;return new(this.getSubLayerClass("cell",y.a))({filled:s,wireframe:a,extruded:o,elevationScale:i,stroked:u,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:h,lineWidthMaxPixels:f,lineJointRounded:p,lineMiterLimit:d,lineDashJustified:A,material:E,getElevation:g,getFillColor:m,getLineColor:v,getLineWidth:_,getLineDashArray:b},this.getSubLayerProps({id:"cell",updateTriggers:{getElevation:w.getElevation,getFillColor:w.getFillColor,getLineColor:w.getLineColor,getLineWidth:w.getLineWidth,getLineDashArray:w.getLineDashArray}}),{data:e,_normalize:!1,positionFormat:"XY",getPolygon:function(t,e){return C(r(t,e))}})}}]),r}(m.a);j.layerName="S2Layer",j.defaultProps=L;var D=r(66),B=r(221),F=r(43),z=r.n(F),N=r(68),U=r.n(N),V=r(18),G=function(){function t(e){var r=e.x,n=e.y,o=e.z;i()(this,t),this.x=r,this.y=n,this.z=o,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}var e;return d()(t,[{key:"_loadData",value:(e=U()(z.a.mark((function t(e){var r,n,i,o,a,s,u,c,l,h,f,p,d;return z.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.getData,n=e.requestScheduler,i=e.onLoad,o=e.onError,a=this.x,s=this.y,u=this.z,c=this.bbox,l=this._loaderId,this._abortController=new AbortController,h=this._abortController.signal,t.next=7,n.scheduleRequest(this,(function(t){return t.isSelected?1:-1}));case 7:if(f=t.sent){t.next=11;break}return this._isCancelled=!0,t.abrupt("return");case 11:if(!this._isCancelled){t.next=14;break}return f.done(),t.abrupt("return");case 14:return p=null,t.prev=15,t.next=18,r({x:a,y:s,z:u,bbox:c,signal:h});case 18:p=t.sent,t.next=24;break;case 21:t.prev=21,t.t0=t.catch(15),d=t.t0||!0;case 24:return t.prev=24,f.done(),t.finish(24);case 27:if(l===this._loaderId){t.next=29;break}return t.abrupt("return");case 29:if(this._loader=void 0,this.content=p,!this._isCancelled||p){t.next=34;break}return this._isLoaded=!1,t.abrupt("return");case 34:this._isLoaded=!0,this._isCancelled=!1,d?o(d,this):i(this);case 37:case"end":return t.stop()}}),t,this,[[15,21,24,27]])}))),function(t){return e.apply(this,arguments)})},{key:"loadData",value:function(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}},{key:"setNeedsReload",value:function(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}},{key:"abort",value:function(){this.isLoaded||(this._isCancelled=!0,this._abortController.abort())}},{key:"data",get:function(){var t=this;return this.isLoading?this._loader.then((function(){return t.data})):this.content}},{key:"isLoaded",get:function(){return this._isLoaded&&!this._needsReload}},{key:"isLoading",get:function(){return Boolean(this._loader)&&!this._isCancelled}},{key:"needsReload",get:function(){return this._needsReload||this._isCancelled}},{key:"byteLength",get:function(){var t=this.content?this.content.byteLength:0;return Number.isFinite(t)||V.a.error("byteLength not defined in tile data")(),t}}]),t}(),W=r(44),H=r.n(W);const q=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});var Z=r(147);const X=new Z.a,Q=new Z.a;class Y{constructor(t=[0,0,0],e=[0,0,0],r=null){r=r||X.copy(t).add(e).scale(.5),this.center=new Z.a(r),this.halfDiagonal=new Z.a(e).subtract(this.center),this.minimum=new Z.a(t),this.maximum=new Z.a(e)}clone(){return new Y(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){const{halfDiagonal:e}=this,r=Q.from(t.normal),n=e.x*Math.abs(r.x)+e.y*Math.abs(r.y)+e.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-n>0?q.INSIDE:i+n<0?q.OUTSIDE:q.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=X.from(t).subtract(this.center),{halfDiagonal:r}=this;let n,i=0;return n=Math.abs(e.x)-r.x,n>0&&(i+=n*n),n=Math.abs(e.y)-r.y,n>0&&(i+=n*n),n=Math.abs(e.z)-r.z,n>0&&(i+=n*n),i}}var K=r(17);const $=new Z.a,J=new Z.a;class tt{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new Z.a,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=$.from(e),this.center=(new Z.a).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new tt(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,i=t.radius,o=$.copy(n).subtract(e),a=o.magnitude();if(r>=a+i)return this.clone();if(i>=a+r)return t.clone();const s=.5*(r+a+i);return J.copy(o).scale((-r+s)/a).add(e),this.center.copy(J),this.radius=s,this}expand(t){const e=(t=$.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=K.e($,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=(t=$.from(t)).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,r=this.radius,n=t.normal.dot(e)+t.distance;return n<-r?q.OUTSIDE:n<r?q.INTERSECTING:q.INSIDE}}var et=r(216),rt=r(228);const nt=new Z.a,it=new Z.a,ot=new Z.a,at=new Z.a,st=new Z.a,ut=new Z.a,ct=new Z.a,lt=0,ht=1,ft=2,pt=3,dt=4,At=5,gt=6,mt=7,yt=8;class vt{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new Z.a).from(t),this.halfAxes=new et.a(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Z.a(t).len(),new Z.a(e).len(),new Z.a(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new Z.a(t).normalize(),i=new Z.a(e).normalize(),o=new Z.a(r).normalize();return(new rt.a).fromMatrix3(new et.a([...n,...i,...o]))}fromCenterHalfSizeQuaternion(t,e,r){const n=new rt.a(r),i=(new et.a).fromQuaternion(n);return i[0]=i[0]*e[0],i[1]=i[1]*e[0],i[2]=i[2]*e[0],i[3]=i[3]*e[1],i[4]=i[4]*e[1],i[5]=i[5]*e[1],i[6]=i[6]*e[2],i[7]=i[7]*e[2],i[8]=i[8]*e[2],this.center=(new Z.a).from(t),this.halfAxes=i,this}clone(){return new vt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new tt){const e=this.halfAxes,r=e.getColumn(0,ot),n=e.getColumn(1,at),i=e.getColumn(2,st),o=nt.copy(r).add(n).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,n=this.halfAxes,i=r.x,o=r.y,a=r.z,s=Math.abs(i*n[lt]+o*n[ht]+a*n[ft])+Math.abs(i*n[pt]+o*n[dt]+a*n[At])+Math.abs(i*n[gt]+o*n[mt]+a*n[yt]),u=r.dot(e)+t.distance;return u<=-s?q.OUTSIDE:u>=s?q.INSIDE:q.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=it.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,ot),i=r.getColumn(1,at),o=r.getColumn(2,st),a=n.magnitude(),s=i.magnitude(),u=o.magnitude();n.normalize(),i.normalize(),o.normalize();let c,l=0;return c=Math.abs(e.dot(n))-a,c>0&&(l+=c*c),c=Math.abs(e.dot(i))-s,c>0&&(l+=c*c),c=Math.abs(e.dot(o))-u,c>0&&(l+=c*c),l}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const o=this.center,a=this.halfAxes,s=a.getColumn(0,ot),u=a.getColumn(1,at),c=a.getColumn(2,st),l=ut.copy(s).add(u).add(c).add(o),h=ct.copy(l).subtract(t);let f=e.dot(h);return n=Math.min(f,n),i=Math.max(f,i),l.copy(o).add(s).add(u).subtract(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),l.copy(o).add(s).subtract(u).add(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),l.copy(o).add(s).subtract(u).subtract(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),o.copy(l).subtract(s).add(u).add(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),o.copy(l).subtract(s).add(u).subtract(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),o.copy(l).subtract(s).subtract(u).add(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),o.copy(l).subtract(s).subtract(u).subtract(c),h.copy(l).subtract(t),f=e.dot(h),n=Math.min(f,n),i=Math.max(f,i),r[0]=n,r[1]=i,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,ot);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,at);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,st);return n.transformAsPoint(t),this.halfAxes=new et.a([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}var _t=r(42),bt=r(13);const xt=new Z.a,wt=new Z.a;class Et{constructor(t=[0,0,1],e=0){this.normal=new Z.a,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Object(_t.a)(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=xt.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,n){return this.normal.set(t,e,r),Object(_t.a)(Object(bt.d)(this.normal.len(),1)),this.distance=n,this}clone(t){return new Et(this.normal,this.distance)}equals(t){return Object(bt.d)(this.distance,t.distance)&&Object(bt.d)(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=wt.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,e)}projectPointOntoPlane(t,e=[0,0,0]){t=xt.from(t);const r=this.getPointDistance(t),n=wt.copy(this.normal).scale(r);return t.subtract(n).to(e)}}const St=[new Z.a([1,0,0]),new Z.a([0,1,0]),new Z.a([0,0,1])],Ot=new Z.a,Tt=new Z.a;new Et(new Z.a(1,0,0),0);class Pt{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(t=[]){this.planes=t,Object(_t.a)(this.planes.every(t=>t instanceof Et))}fromBoundingSphere(t){this.planes.length=2*St.length;const e=t.center,r=t.radius;let n=0;for(const t of St){let i=this.planes[n],o=this.planes[n+1];i||(i=this.planes[n]=new Et),o||(o=this.planes[n+1]=new Et);const a=Ot.copy(t).scale(-r).add(e);t.dot(a);i.fromPointNormal(a,t);const s=Ot.copy(t).scale(r).add(e),u=Tt.copy(t).negate();u.dot(s);o.fromPointNormal(s,u),n+=2}return this}computeVisibility(t){Object(_t.a)(t);let e=q.INSIDE;for(const r of this.planes){switch(t.intersectPlane(r)){case q.OUTSIDE:return q.OUTSIDE;case q.INTERSECTING:e=q.INTERSECTING}}return e}computeVisibilityWithPlaneMask(t,e){if(Object(_t.a)(t,"boundingVolume is required."),Object(_t.a)(Number.isFinite(e),"parentPlaneMask is required."),e===Pt.MASK_OUTSIDE||e===Pt.MASK_INSIDE)return e;let r=Pt.MASK_INSIDE;const n=this.planes;for(let i=0;i<this.planes.length;++i){const o=i<31?1<<i:0;if(i<31&&0==(e&o))continue;const a=n[i],s=t.intersectPlane(a);if(s===q.OUTSIDE)return Pt.MASK_OUTSIDE;s===q.INTERSECTING&&(r|=o)}return r}}var Mt=r(205);new Z.a,new Z.a,new Z.a,new Z.a,new Z.a;new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,new Z.a,Math.PI;var Ct=r(217);const It=new et.a,kt=new et.a,Rt=new et.a,Lt=new et.a,jt=new et.a;function Dt(t,e={}){const r=Ct.a.EPSILON20;let n=0,i=0;const o=kt,a=Rt;o.identity(),a.copy(t);const s=r*function(t){let e=0;for(let r=0;r<9;++r){const n=t[r];e+=n*n}return Math.sqrt(e)}(a);for(;i<10&&zt(a)>s;)Nt(a,Lt),jt.copy(Lt).transpose(),a.multiplyRight(Lt),a.multiplyLeft(jt),o.multiplyRight(Lt),++n>2&&(++i,n=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}const Bt=[1,0,0],Ft=[2,2,1];function zt(t){let e=0;for(let r=0;r<3;++r){const n=t[It.getElementIndex(Ft[r],Bt[r])];e+=2*n*n}return Math.sqrt(e)}function Nt(t,e){const r=Ct.a.EPSILON15;let n=0,i=1;for(let e=0;e<3;++e){const r=Math.abs(t[It.getElementIndex(Ft[e],Bt[e])]);r>n&&(i=e,n=r)}const o=Bt[i],a=Ft[i];let s=1,u=0;if(Math.abs(t[It.getElementIndex(a,o)])>r){const e=(t[It.getElementIndex(a,a)]-t[It.getElementIndex(o,o)])/2/t[It.getElementIndex(a,o)];let r;r=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),s=1/Math.sqrt(1+r*r),u=r*s}return et.a.IDENTITY.to(e),e[It.getElementIndex(o,o)]=e[It.getElementIndex(a,a)]=s,e[It.getElementIndex(a,o)]=u,e[It.getElementIndex(o,a)]=-u,e}const Ut=new Z.a,Vt=new Z.a,Gt=new Z.a,Wt=new Z.a,Ht=new Z.a,qt=new et.a,Zt={diagonal:new et.a,unitary:new et.a};var Xt=r(22);function Qt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Yt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Kt=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],$t=Kt.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Jt=$t.concat([[.25,.5],[.75,.5]]),te=function(){function t(e,r,n){i()(this,t),this.x=e,this.y=r,this.z=n}return d()(t,[{key:"update",value:function(t){var e=t.viewport,r=t.cullingVolume,n=t.elevationBounds,i=t.minZ,o=t.maxZ,a=t.bounds,s=t.offset,u=t.project,c=this.getBoundingVolume(n,s,u);if(a&&!this.insideBounds(a))return!1;if(r.computeVisibility(c)<0)return!1;if(!this.childVisible){var l=this.z;if(l<o&&l>=i){var h=c.distanceTo(e.cameraPosition)*e.scale/e.height;l+=Math.floor(Math.log2(h))}if(l>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;var f,p=Qt(this.children);try{for(p.s();!(f=p.n()).done;){f.value.update(t)}}catch(t){p.e(t)}finally{p.f()}return!0}},{key:"getSelected",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this.selected&&t.push(this),this._children){var e,r=Qt(this._children);try{for(r.s();!(e=r.n()).done;){var n=e.value;n.getSelected(t)}}catch(t){r.e(t)}finally{r.f()}}return t}},{key:"insideBounds",value:function(t){var e=_()(t,4),r=e[0],n=e[1],i=e[2],o=e[3],a=512/Math.pow(2,this.z);return this.x*a<i&&this.y*a<o&&(this.x+1)*a>r&&(this.y+1)*a>n}},{key:"getBoundingVolume",value:function(t,e,r){if(r){var n,i=[],o=Qt(this.z<1?Jt:this.z<2?$t:Kt);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=ae(this.x+a[0],this.y+a[1],this.z);s[2]=t[0],i.push(r(s)),t[0]!==t[1]&&(s[2]=t[1],i.push(r(s)))}}catch(t){o.e(t)}finally{o.f()}return function(t,e=new vt){if(!t||0===t.length)return e.halfAxes=new et.a([0,0,0,0,0,0,0,0,0]),e.center=new Z.a,e;const r=t.length,n=new Z.a(0,0,0);for(const e of t)n.add(e);const i=1/r;n.multiplyByScalar(i);let o=0,a=0,s=0,u=0,c=0,l=0;for(const e of t){const t=Ut.copy(e).subtract(n);o+=t.x*t.x,a+=t.x*t.y,s+=t.x*t.z,u+=t.y*t.y,c+=t.y*t.z,l+=t.z*t.z}o*=i,a*=i,s*=i,u*=i,c*=i,l*=i;const h=qt;h[0]=o,h[1]=a,h[2]=s,h[3]=a,h[4]=u,h[5]=c,h[6]=s,h[7]=c,h[8]=l;const{unitary:f}=Dt(h,Zt),p=e.halfAxes.copy(f);let d=p.getColumn(0,Gt),A=p.getColumn(1,Wt),g=p.getColumn(2,Ht),m=-Number.MAX_VALUE,y=-Number.MAX_VALUE,v=-Number.MAX_VALUE,_=Number.MAX_VALUE,b=Number.MAX_VALUE,x=Number.MAX_VALUE;for(const e of t)Ut.copy(e),m=Math.max(Ut.dot(d),m),y=Math.max(Ut.dot(A),y),v=Math.max(Ut.dot(g),v),_=Math.min(Ut.dot(d),_),b=Math.min(Ut.dot(A),b),x=Math.min(Ut.dot(g),x);d=d.multiplyByScalar(.5*(_+m)),A=A.multiplyByScalar(.5*(b+y)),g=g.multiplyByScalar(.5*(x+v)),e.center.copy(d).add(A).add(g);const w=Vt.set(m-_,y-b,v-x).multiplyByScalar(.5),E=new et.a([w[0],0,0,0,w[1],0,0,0,w[2]]);return e.halfAxes.multiplyRight(E),e}(i)}var u=512/Math.pow(2,this.z),c=this.x*u+512*e,l=512-(this.y+1)*u;return new Y([c,l,t[0]],[c+u,l+u,t[1]])}},{key:"children",get:function(){if(!this._children){var e=2*this.x,r=2*this.y,n=this.z+1;this._children=[new t(e,r,n),new t(e,r+1,n),new t(e+1,r,n),new t(e+1,r+1,n)]}return this._children}}]),t}();var ee=[-1/0,-1/0,1/0,1/0],re={type:"url",value:null,validate:function(t,e){return e.optional&&null===t||"string"==typeof t||Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))},equals:function(t,e){if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}};function ne(t,e){var r=[e.transformPoint([t[0],t[1]]),e.transformPoint([t[2],t[1]]),e.transformPoint([t[0],t[3]]),e.transformPoint([t[2],t[3]])];return[Math.min.apply(Math,H()(r.map((function(t){return t[0]})))),Math.min.apply(Math,H()(r.map((function(t){return t[1]})))),Math.max.apply(Math,H()(r.map((function(t){return t[0]})))),Math.max.apply(Math,H()(r.map((function(t){return t[1]}))))]}function ie(t,e){if(!t||!t.length)return null;Array.isArray(t)&&(t=t[Math.abs(e.x+e.y)%t.length]);var r=e.x,n=e.y,i=e.z;return t.replace("{x}",r).replace("{y}",n).replace("{z}",i).replace("{-y}",Math.pow(2,i)-n-1)}function oe(t,e){return 512*Math.pow(2,t)/e}function ae(t,e,r){var n=oe(r,512),i=t/n*360-180,o=Math.PI-2*Math.PI*e/n;return[i,180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)))]}function se(t,e,r,n){var i=oe(r,n);return[t/i*512,e/i*512]}function ue(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:512;if(t.isGeospatial){var o=ae(e,r,n),a=_()(o,2),s=a[0],u=a[1],c=ae(e+1,r+1,n),l=_()(c,2),h=l[0],f=l[1];return{west:s,north:u,east:h,south:f}}var p=se(e,r,n,i),d=_()(p,2),A=d[0],g=d[1],m=se(e+1,r+1,n,i),y=_()(m,2),v=y[0],b=y[1];return{left:A,top:g,right:v,bottom:b}}function ce(t,e,r,n,i){for(var o=function(t,e,r){return r?ne(t,r).map((function(t){return t*e/512})):t.map((function(t){return t*e/512}))}(function(t,e,r){var n;if(e&&2===e.length){var i=_()(e,2),o=i[0],a=i[1],s=t.getBounds({z:o}),u=t.getBounds({z:a});n=[Math.min(s[0],u[0]),Math.min(s[1],u[1]),Math.max(s[2],u[2]),Math.max(s[3],u[3])]}else n=t.getBounds();return t.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}(t,null,n),oe(e,r),i),a=_()(o,4),s=a[0],u=a[1],c=a[2],l=a[3],h=[],f=Math.floor(s);f<c;f++)for(var p=Math.floor(u);p<l;p++)h.push({x:f,y:p,z:e});return h}function le(t){var e=t.viewport,r=t.maxZoom,n=t.minZoom,i=t.zRange,o=t.extent,a=t.tileSize,s=void 0===a?512:a,u=t.modelMatrix,c=t.modelMatrixInverse,l=t.zoomOffset,h=void 0===l?0:l,f=e.isGeospatial?Math.round(e.zoom+Math.log2(512/s))+h:Math.ceil(e.zoom)+h;if(Number.isFinite(n)&&f<n){if(!o)return[];f=n}Number.isFinite(r)&&f>r&&(f=r);var p=o;return u&&c&&o&&!e.isGeospatial&&(p=ne(o,u)),e.isGeospatial?function(t,e,r,n){var i=t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map((function(t){var e=t.normal,r=t.distance;return new Et(e.clone().negate(),r)})),a=new Pt(o),s=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*s||0,c=r&&r[1]*s||0,l=t.pitch<=60?e:0;if(n){var h=n,f=_()(h,4),p=f[0],d=f[1],A=f[2],g=f[3],m=Object(Xt.l)([p,g]),y=Object(Xt.l)([A,d]);n=[m[0],512-m[1],y[0],512-y[1]]}var v=new te(0,0,0),b={viewport:t,project:i,cullingVolume:a,elevationBounds:[u,c],minZ:l,maxZ:e,bounds:n,offset:0};if(v.update(b),t.subViewports&&t.subViewports.length>1){for(b.offset=-1;v.update(b)&&!(--b.offset<-3););for(b.offset=1;v.update(b)&&!(++b.offset>3););}return v.getSelected()}(e,f,i,o):ce(e,f,s,p||ee,c)}var he=r(211),fe=r(11);function pe(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return de(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return de(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function de(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ae=function(){function t(e){var r=this;i()(this,t),this.opts=e,this.onTileLoad=function(t){r.opts.onTileLoad(t),r.opts.maxCacheByteSize&&(r._cacheByteSize+=t.byteLength,r._resizeCache())},this._requestScheduler=new he.a({maxRequests:e.maxRequests,throttleRequests:e.maxRequests>0}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this.setOptions(e)}return d()(t,[{key:"setOptions",value:function(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}},{key:"finalize",value:function(){var t,e=pe(this._cache.values());try{for(e.s();!(t=e.n()).done;){var r=t.value;r.isLoading&&r.abort()}}catch(t){e.e(t)}finally{e.f()}this._cache.clear(),this._tiles=[],this._selectedTiles=null}},{key:"reloadAll",value:function(){var t,e=pe(this._cache.keys());try{for(e.s();!(t=e.n()).done;){var r=t.value,n=this._cache.get(r);this._selectedTiles.includes(n)?n.setNeedsReload():this._cache.delete(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"update",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.zRange,i=r.modelMatrix,o=new fe.a(i),a=!o.equals(this._modelMatrix);if(!t.equals(this._viewport)||a){a&&(this._modelMatrixInverse=i&&o.clone().invert(),this._modelMatrix=i&&o),this._viewport=t;var s=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=s.map((function(t){return e._getTile(t,!0)})),this._dirty&&this._rebuildTree()}var u=this.updateTileStates();return this._dirty&&this._resizeCache(),u&&this._frameNumber++,this._frameNumber}},{key:"getTileIndices",value:function(t){var e=t.viewport,r=t.maxZoom,n=t.minZoom,i=t.zRange,o=t.modelMatrix,a=t.modelMatrixInverse,s=this.opts;return le({viewport:e,maxZoom:r,minZoom:n,zRange:i,tileSize:s.tileSize,extent:s.extent,modelMatrix:o,modelMatrixInverse:a,zoomOffset:s.zoomOffset})}},{key:"getTileMetadata",value:function(t){var e=t.x,r=t.y,n=t.z,i=this.opts.tileSize;return{bbox:ue(this._viewport,e,r,n,i)}}},{key:"getParentIndex",value:function(t){return t.x=Math.floor(t.x/2),t.y=Math.floor(t.y/2),t.z-=1,t}},{key:"updateTileStates",value:function(){this._updateTileStates(this.selectedTiles);var t,e=this.opts.maxRequests,r=[],n=0,i=!1,o=pe(this._cache.values());try{for(o.s();!(t=o.n()).done;){var a=t.value,s=Boolean(1&a.state);a.isVisible!==s&&(i=!0,a.isVisible=s),a.isSelected=5===a.state,a.isLoading&&(n++,a.isSelected||r.push(a))}}catch(t){o.e(t)}finally{o.f()}if(e>0)for(;n>e&&r.length>0;){r.shift().abort(),n--}return i}},{key:"_rebuildTree",value:function(){var t,e=this._cache,r=pe(e.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;n.parent=null,n.children.length=0}}catch(t){r.e(t)}finally{r.f()}var i,o=pe(e.values());try{for(o.s();!(i=o.n()).done;){var a=i.value,s=this._getNearestAncestor(a.x,a.y,a.z);a.parent=s,s&&s.children.push(a)}}catch(t){o.e(t)}finally{o.f()}}},{key:"_updateTileStates",value:function(t){var e,r=this._cache,n=this.opts.refinementStrategy||"best-available",i=pe(r.values());try{for(i.s();!(e=i.n()).done;){e.value.state=0}}catch(t){i.e(t)}finally{i.f()}var o,a=pe(t);try{for(a.s();!(o=a.n()).done;){o.value.state=5}}catch(t){a.e(t)}finally{a.f()}if("never"!==n){var s,u=pe(t);try{for(u.s();!(s=u.n()).done;){me(s.value,n)}}catch(t){u.e(t)}finally{u.f()}var c,l=pe(t);try{for(l.s();!(c=l.n()).done;){var h=c.value;ge(h)&&ye(h)}}catch(t){l.e(t)}finally{l.f()}}}},{key:"_resizeCache",value:function(){var t=this._cache,e=this.opts,r=e.maxCacheSize||(e.maxCacheByteSize?1/0:5*this.selectedTiles.length),n=e.maxCacheByteSize||1/0;if(t.size>r||this._cacheByteSize>n){var i,o=pe(t);try{for(o.s();!(i=o.n()).done;){var a=_()(i.value,2),s=a[0],u=a[1];if(u.isVisible||(this._cacheByteSize-=e.maxCacheByteSize?u.byteLength:0,t.delete(s),this.opts.onTileUnload(u)),t.size<=r&&this._cacheByteSize<=n)break}}catch(t){o.e(t)}finally{o.f()}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((function(t,e){return t.z-e.z})),this._dirty=!1)}},{key:"_getTile",value:function(t,e){var r=t.x,n=t.y,i=t.z,o="".concat(r,",").concat(n,",").concat(i),a=this._cache.get(o),s=!1;return!a&&e?(a=new G({x:r,y:n,z:i}),Object.assign(a,this.getTileMetadata(a)),s=!0,this._cache.set(o,a),this._dirty=!0):a&&a.needsReload&&(s=!0),s&&a.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),a}},{key:"_getNearestAncestor",value:function(t,e,r){for(var n=this._minZoom,i=void 0===n?0:n,o={x:t,y:e,z:r};o.z>i;){o=this.getParentIndex(o);var a=this._getTile(o);if(a)return a}return null}},{key:"tiles",get:function(){return this._tiles}},{key:"selectedTiles",get:function(){return this._selectedTiles}},{key:"isLoaded",get:function(){return this._selectedTiles.every((function(t){return t.isLoaded}))}}]),t}();function ge(t){for(var e=t;e;){if(!1&e.state)return!0;if(e.isLoaded)return!1;e=e.parent}return!0}function me(t,e){for(var r,n=3;r=t.parent;){if(t.isLoaded&&(n=4,"best-available"===e))return;r.state=Math.max(r.state,n),t=r}}function ye(t){var e,r=pe(t.children);try{for(r.s();!(e=r.n()).done;){var n=e.value;n.state=Math.max(n.state,3),n.isLoaded||ye(n)}}catch(t){r.e(t)}finally{r.f()}}function ve(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _e(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ve(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var xe={data:[],dataComparator:re.equals,renderSubLayers:{type:"function",value:function(t){return new B.a(t)},compare:!1},getTileData:{type:"function",optional:!0,value:null,compare:!1},onViewportLoad:{type:"function",optional:!0,value:null,compare:!1},onTileLoad:{type:"function",value:function(t){},compare:!1},onTileUnload:{type:"function",value:function(t){},compare:!1},onTileError:{type:"function",value:function(t){return console.error(t)},compare:!1},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0},we=function(t){a()(r,t);var e=be(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"initializeState",value:function(){this.state={tileset:null,isLoaded:!1}}},{key:"finalizeState",value:function(){var t;null===(t=this.state.tileset)||void 0===t||t.finalize()}},{key:"shouldUpdateState",value:function(t){return t.changeFlags.somethingChanged}},{key:"updateState",value:function(t){var e=t.props,r=t.changeFlags,n=this.state.tileset,i=r.propsOrDataChanged||r.updateTriggersChanged,o=r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getTileData);n?i&&(n.setOptions(this._getTilesetOptions(e)),o?n.reloadAll():this.state.tileset.tiles.forEach((function(t){t.layers=null}))):(n=new Ae(this._getTilesetOptions(e)),this.setState({tileset:n})),this._updateTileset()}},{key:"_getTilesetOptions",value:function(t){var e=t.tileSize,r=t.maxCacheSize,n=t.maxCacheByteSize,i=t.refinementStrategy,o=t.extent;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:e,refinementStrategy:i,extent:o,maxRequests:t.maxRequests,zoomOffset:t.zoomOffset,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}},{key:"_updateTileset",value:function(){var t=this.state.tileset,e=this.props,r=e.zRange,n=e.modelMatrix,i=t.update(this.context.viewport,{zRange:r,modelMatrix:n}),o=t.isLoaded,a=this.state.isLoaded!==o,s=this.state.frameNumber!==i;o&&(a||s)&&this._onViewportLoad(),s&&this.setState({frameNumber:i}),this.state.isLoaded=o}},{key:"_onViewportLoad",value:function(){var t=this.state.tileset,e=this.props.onViewportLoad;e&&e(t.selectedTiles)}},{key:"_onTileLoad",value:function(t){this.props.onTileLoad(t),t.layers=null,t.isVisible&&this.setNeedsUpdate()}},{key:"_onTileError",value:function(t,e){this.props.onTileError(t),e.layers=null,e.isVisible&&this.setNeedsUpdate()}},{key:"_onTileUnload",value:function(t){this.props.onTileUnload(t)}},{key:"getTileData",value:function(t){var e=this.props,r=e.data,n=e.getTileData,i=e.fetch,o=t.signal;return t.url=ie(r,t),n?n(t):t.url?i(t.url,{propName:"data",layer:this,signal:o}):null}},{key:"renderSubLayers",value:function(t){return this.props.renderSubLayers(t)}},{key:"getHighlightedObjectIndex",value:function(){return-1}},{key:"getPickingInfo",value:function(t){var e=t.info,r=t.sourceLayer;return e.tile=r.props.tile,e}},{key:"_updateAutoHighlight",value:function(t){t.sourceLayer&&t.sourceLayer.updateAutoHighlight(t)}},{key:"renderLayers",value:function(){var t=this;return this.state.tileset.tiles.map((function(e){var r=t.getHighlightedObjectIndex(e);if(e.isLoaded||e.content)if(e.layers)e.layers[0]&&e.layers[0].props.highlightedObjectIndex!==r&&(e.layers=e.layers.map((function(t){return t.clone({highlightedObjectIndex:r})})));else{var n=t.renderSubLayers(_e(_e({},t.props),{},{id:"".concat(t.id,"-").concat(e.x,"-").concat(e.y,"-").concat(e.z),data:e.content,_offset:0,tile:e}));e.layers=Object(D.b)(n,Boolean).map((function(t){return t.clone({tile:e,highlightedObjectIndex:r})}))}else;return e.layers}))}},{key:"filterSubLayer",value:function(t){return t.layer.props.tile.isVisible}},{key:"isLoaded",get:function(){return this.state.tileset.selectedTiles.every((function(t){return t.isLoaded&&t.layers&&t.layers.every((function(t){return t.isLoaded}))}))}}]),r}(m.a);we.layerName="TileLayer",we.defaultProps=xe;var Ee=r(8),Se=r.n(Ee);function Oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Te(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Oe(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var Me=function(t){a()(r,t);var e=Pe(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"getShaders",value:function(){var t=Se()(l()(r.prototype),"getShaders",this).call(this);return t.inject={"vs:#decl":"uniform float trailLength;\nattribute float instanceTimestamps;\nattribute float instanceNextTimestamps;\nvarying float vTime;\n","vs:#main-end":"vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;\n","fs:#decl":"uniform bool fadeTrail;\nuniform float trailLength;\nuniform float currentTime;\nvarying float vTime;\n","fs:#main-start":"if(vTime > currentTime || (fadeTrail && (vTime < currentTime - trailLength))) {\n  discard;\n}\n","fs:DECKGL_FILTER_COLOR":"if(fadeTrail) {\n  color.a *= 1.0 - (currentTime - vTime) / trailLength;\n}\n"},t}},{key:"initializeState",value:function(t){Se()(l()(r.prototype),"initializeState",this).call(this,t),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}},{key:"draw",value:function(t){var e=this.props,n=e.fadeTrail,i=e.trailLength,o=e.currentTime;t.uniforms=Te(Te({},t.uniforms),{},{fadeTrail:n,trailLength:i,currentTime:o}),Se()(l()(r.prototype),"draw",this).call(this,t)}}]),r}(r(109).a);Me.layerName="TripsLayer",Me.defaultProps={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:null}};var Ce=function(t){var e,r=void 0!==(t=t||{})?t:{},n={};for(e in r)r.hasOwnProperty(e)&&(n[e]=r[e]);var i,o=[],a="";document.currentScript&&(a=document.currentScript.src),a=0!==a.indexOf("blob:")?a.substr(0,a.lastIndexOf("/")+1):"",i=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){if(200==n.status||0==n.status&&n.response)e(n.response);else{var i=Q(t);i?e(i.buffer):r()}},n.onerror=r,n.send(null)};var s=r.print||console.log.bind(console),u=r.printErr||console.warn.bind(console);for(e in n)n.hasOwnProperty(e)&&(r[e]=n[e]);n=null,r.arguments&&(o=r.arguments);var c=0,l=function(){return c};var h=!1;function f(t){var e,n=r["_"+t];return e="Cannot call unknown function "+t+", make sure it is exported",n||ut("Assertion failed: "+e),n}function p(t,e,r,n,i){var o={string:function(t){var e=0;if(null!=t&&0!==t){var r=1+(t.length<<2);(function(t,e,r){(function(t,e,r,n){if(!(n>0))return 0;for(var i=r,o=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343){var u=t.charCodeAt(++a);s=65536+((1023&s)<<10)|1023&u}if(s<=127){if(r>=o)break;e[r++]=s}else if(s<=2047){if(r+1>=o)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=o)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}e[r]=0})(t,y,e,r)})(t,e=tt(r),r)}return e},array:function(t){var e=tt(t.length);return function(t,e){m.set(t,e)}(t,e),e}};var a=f(t),s=[],u=0;if(n)for(var c=0;c<n.length;c++){var l=o[r[c]];l?(0===u&&(u=rt()),s[c]=l(n[c])):s[c]=n[c]}var h=a.apply(null,s);return h=function(t){return"string"===e?A(t):"boolean"===e?Boolean(t):t}(h),0!==u&&et(u),h}var d="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function A(t,e){return t?function(t,e,r){for(var n=e+r,i=e;t[i]&&!(i>=n);)++i;if(i-e>16&&t.subarray&&d)return d.decode(t.subarray(e,i));for(var o="";e<i;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(y,t,e):""}var g,m,y,v,_,b,x;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function w(t,e){return t%e>0&&(t+=e-t%e),t}function E(t){g=t,r.HEAP8=m=new Int8Array(t),r.HEAP16=v=new Int16Array(t),r.HEAP32=_=new Int32Array(t),r.HEAPU8=y=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=new Uint32Array(t),r.HEAPF32=b=new Float32Array(t),r.HEAPF64=x=new Float64Array(t)}var S=r.TOTAL_MEMORY||33554432;function O(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var n=e.func;"number"==typeof n?void 0===e.arg?r.dynCall_v(n):r.dynCall_vi(n,e.arg):n(void 0===e.arg?null:e.arg)}else e()}}S=(g=r.buffer?r.buffer:new ArrayBuffer(S)).byteLength,E(g),_[5916]=5266576;var T=[],P=[],M=[],C=[];var I=Math.abs,k=Math.ceil,R=Math.floor,L=Math.min,j=0,D=null,B=null;r.preloadedImages={},r.preloadedAudios={};var F,z,N=null,U="data:application/octet-stream;base64,";function V(t){return String.prototype.startsWith?t.startsWith(U):0===t.indexOf(U)}N="data:application/octet-stream;base64, ";function G(t){return t}function W(t){return t.replace(/\b__Z[\w\d_]+/g,(function(t){return t===t?t:t+" ["+t+"]"}))}function H(){var t=new Error;if(!t.stack){try{throw new Error(0)}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function q(){return m.length}function Z(t){try{var e=new ArrayBuffer(t);if(e.byteLength!=t)return;return new Int8Array(e).set(m),J(e),E(e),1}catch(t){}}var X="function"==typeof atob?atob:function(t){var e,r,n,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=s.indexOf(t.charAt(c++))<<2|(i=s.indexOf(t.charAt(c++)))>>4,r=(15&i)<<4|(o=s.indexOf(t.charAt(c++)))>>2,n=(3&o)<<6|(a=s.indexOf(t.charAt(c++))),u+=String.fromCharCode(e),64!==o&&(u+=String.fromCharCode(r)),64!==a&&(u+=String.fromCharCode(n))}while(c<t.length);return u};function Q(t){if(V(t))return function(t){try{for(var e=X(t),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}catch(t){throw new Error("Converting base64 string to bytes failed.")}}(t.slice(U.length))}var Y,K,$=function(t,e,r){var n=new t.Int8Array(r),i=new t.Int32Array(r),o=(new t.Uint8Array(r),new t.Float32Array(r),new t.Float64Array(r)),a=0|e.p,s=t.Math.floor,u=t.Math.abs,c=t.Math.sqrt,l=t.Math.pow,h=t.Math.cos,f=t.Math.sin,p=t.Math.tan,d=t.Math.acos,A=t.Math.asin,g=t.Math.atan,m=t.Math.atan2,y=t.Math.ceil,v=t.Math.imul,_=t.Math.clz32,b=e.b,x=e.c,w=e.d,E=e.e,S=e.f,O=e.g,T=e.h,P=e.i,M=23696;function C(t,e,r,n){var i,o,a;0|I(t|=0,e|=0,r|=0,n|=0,a=0|he(o=(i=1+(0|v(3*r|0,r+1|0))|0)<<2))?(xe(0|n,0,i<<3|0),xe(0|a,0,0|o),k(t,e,r,n,a,i,0),fe(a)):fe(a)}function I(t,e,r,n,o){t|=0,e|=0,r|=0,o|=0;var a,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0;if(a=M,M=M+16|0,d=a,i[(s=n|=0)>>2]=t,i[s+4>>2]=e,(s=0!=(0|o))&&(i[o>>2]=0),0|It(t,e))return M=a,0|(d=1);i[d>>2]=0;t:do{if((0|r)>=1)if(s)for(h=0,f=1,p=1,u=0,s=t;;){if(!(u|h)){if(0==(0|(s=0|R(s,e,4,d)))&0==(0|(e=0|x()))){s=2;break t}if(0|It(s,e)){s=1;break t}}if(0==(0|(s=0|R(s,e,0|i[16+(h<<2)>>2],d)))&0==(0|(e=0|x()))){s=2;break t}if(i[(t=n+(p<<3)|0)>>2]=s,i[t+4>>2]=e,i[o+(p<<2)>>2]=f,t=(0|(u=u+1|0))==(0|f),l=6==(0|(c=h+1|0)),0|It(s,e)){s=1;break t}if((0|(f=f+(l&t&1)|0))>(0|r)){s=0;break}h=t?l?0:c:h,p=p+1|0,u=t?0:u}else for(h=0,f=1,p=1,u=0,s=t;;){if(!(u|h)){if(0==(0|(s=0|R(s,e,4,d)))&0==(0|(e=0|x()))){s=2;break t}if(0|It(s,e)){s=1;break t}}if(0==(0|(s=0|R(s,e,0|i[16+(h<<2)>>2],d)))&0==(0|(e=0|x()))){s=2;break t}if(i[(t=n+(p<<3)|0)>>2]=s,i[t+4>>2]=e,t=(0|(u=u+1|0))==(0|f),l=6==(0|(c=h+1|0)),0|It(s,e)){s=1;break t}if((0|(f=f+(l&t&1)|0))>(0|r)){s=0;break}h=t?l?0:c:h,p=p+1|0,u=t?0:u}else s=0}while(0);return M=a,0|(d=s)}function k(t,e,r,n,o,a,s){r|=0,n|=0,o|=0,a|=0,s|=0;var u,c,l=0,h=0,f=0,p=0,d=0;if(c=M,M=M+16|0,u=c,0==(0|(t|=0))&0==(0|(e|=0)))M=c;else{if(l=0|me(0|t,0|e,0|a,((0|a)<0)<<31>>31|0),x(),!(0==(0|(d=0|i[(p=h=n+(l<<3)|0)>>2]))&0==(0|(p=0|i[p+4>>2]))|(f=(0|d)==(0|t)&(0|p)==(0|e))))do{f=(0|(p=0|i[(d=h=n+((l=(l+1|0)%(0|a)|0)<<3)|0)>>2]))==(0|t)&(0|(d=0|i[d+4>>2]))==(0|e)}while(!(0==(0|p)&0==(0|d)|f));l=o+(l<<2)|0,f&&(0|i[l>>2])<=(0|s)?M=c:(i[(d=h)>>2]=t,i[d+4>>2]=e,i[l>>2]=s,(0|s)>=(0|r)?M=c:(d=s+1|0,i[u>>2]=0,k(p=0|R(t,e,2,u),0|x(),r,n,o,a,d),i[u>>2]=0,k(p=0|R(t,e,3,u),0|x(),r,n,o,a,d),i[u>>2]=0,k(p=0|R(t,e,1,u),0|x(),r,n,o,a,d),i[u>>2]=0,k(p=0|R(t,e,5,u),0|x(),r,n,o,a,d),i[u>>2]=0,k(p=0|R(t,e,4,u),0|x(),r,n,o,a,d),i[u>>2]=0,k(p=0|R(t,e,6,u),0|x(),r,n,o,a,d),M=c))}}function R(t,e,r,n){t|=0,e|=0,r|=0;var o,a,s=0,u=0,c=0,l=0,h=0,f=0,p=0;if((0|i[(n|=0)>>2])>0){s=0;do{r=0|ot(r),s=s+1|0}while((0|s)<(0|i[n>>2]))}o=0|ye(0|t,0|e,45),x(),a=127&o,u=0|kt(t,e),s=0|ye(0|t,0|e,52),x(),s&=15;t:do{if(s)for(;;){if(f=0|ye(0|t,0|e,0|(h=3*(15-s|0)|0)),x(),f&=7,p=0==(0|Bt(s)),s=s+-1|0,l=0|ve(7,0,0|h),e&=~(0|x()),t=(h=0|ve(0|i[(p?464:48)+(28*f|0)+(r<<2)>>2],0,0|h))|t&~l,e|=0|x(),!(r=0|i[(p?672:256)+(28*f|0)+(r<<2)>>2])){r=0;break t}if(!s){c=6;break}}else c=6}while(0);6==(0|c)&&(t|=f=0|ve(0|(p=0|i[880+(28*a|0)+(r<<2)>>2]),0,45),e=0|x()|-1040385&e,r=0|i[4304+(28*a|0)+(r<<2)>>2],127==(127&p|0)&&(p=0|ve(0|i[880+(28*a|0)+20>>2],0,45),e=0|x()|-1040385&e,r=0|i[4304+(28*a|0)+20>>2],t=0|Lt(p|t,e),e=0|x(),i[n>>2]=1+(0|i[n>>2]))),c=0|ye(0|t,0|e,45),x(),c&=127;t:do{if(0|L(c)){e:do{if(1==(0|kt(t,e))){if((0|a)!=(0|c)){if(0|F(c,0|i[7728+(28*a|0)>>2])){t=0|Dt(t,e),u=1,e=0|x();break}t=0|Lt(t,e),u=1,e=0|x();break}switch(0|u){case 5:t=0|Dt(t,e),e=0|x(),i[n>>2]=5+(0|i[n>>2]),u=0;break e;case 3:t=0|Lt(t,e),e=0|x(),i[n>>2]=1+(0|i[n>>2]),u=0;break e;default:return p=0,b(0|(f=0)),0|p}}else u=0}while(0);if((0|r)>0){s=0;do{t=0|Rt(t,e),e=0|x(),s=s+1|0}while((0|s)!=(0|r))}if((0|a)!=(0|c)){if(!(0|j(c))){if(0!=(0|u)|5!=(0|kt(t,e)))break;i[n>>2]=1+(0|i[n>>2]);break}switch(127&o){case 8:case 118:break t}3!=(0|kt(t,e))&&(i[n>>2]=1+(0|i[n>>2]))}}else if((0|r)>0){s=0;do{t=0|Lt(t,e),e=0|x(),s=s+1|0}while((0|s)!=(0|r))}}while(0);return i[n>>2]=((0|i[n>>2])+r|0)%6|0,p=t,b(0|(f=e)),0|p}function L(t){return 0|i[7728+(28*(t|=0)|0)+16>>2]}function j(t){return 4==(0|(t|=0))|117==(0|t)|0}function D(t){return 0|i[11152+(216*(0|i[(t|=0)>>2])|0)+(72*(0|i[t+4>>2])|0)+(24*(0|i[t+8>>2])|0)+(i[t+12>>2]<<3)>>2]}function B(t){return 0|i[11152+(216*(0|i[(t|=0)>>2])|0)+(72*(0|i[t+4>>2])|0)+(24*(0|i[t+8>>2])|0)+(i[t+12>>2]<<3)+4>>2]}function F(t,e){return e|=0,(0|i[7728+(28*(t|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|i[7728+(28*t|0)+24>>2])==(0|e))}function z(t,e){return 0|i[880+(28*(t|=0)|0)+((e|=0)<<2)>>2]}function N(t,e){return e|=0,(0|i[880+(28*(t|=0)|0)>>2])==(0|e)?0|(e=0):(0|i[880+(28*t|0)+4>>2])==(0|e)?0|(e=1):(0|i[880+(28*t|0)+8>>2])==(0|e)?0|(e=2):(0|i[880+(28*t|0)+12>>2])==(0|e)?0|(e=3):(0|i[880+(28*t|0)+16>>2])==(0|e)?0|(e=4):(0|i[880+(28*t|0)+20>>2])==(0|e)?0|(e=5):0|((0|i[880+(28*t|0)+24>>2])==(0|e)?6:7)}function U(t){return+o[(t|=0)+16>>3]<+o[t+24>>3]|0}function V(t,e){t|=0;var r,n,i=0;return(i=+o[(e|=0)>>3])>=+o[t+8>>3]&&i<=+o[t>>3]?(r=+o[t+16>>3],i=+o[t+24>>3],e=(n=+o[e+8>>3])>=i,t=n<=r&1,r<i?e&&(t=1):e||(t=0),0|(e=0!=(0|t))):0|(e=0)}function G(t,e){e|=0;var r,n,i,a,s,c,l,h,f=0,p=0;return r=M,M=M+224|0,i=r+200|0,n=r+32|0,s=r,h=(t|=0)+8|0,o[(a=r+16|0)>>3]=.5*(+o[t>>3]+ +o[h>>3]),f=+o[(c=t+16|0)>>3],f=+Ot(.5*((p=+o[t+24>>3])+(f<p?f+6.283185307179586:f))),o[a+8>>3]=f,f=+o[t>>3],p=+u(+f),l=+o[h>>3],t=p>+u(+l),o[s>>3]=t?l:f,o[s+8>>3]=+o[c>>3],f=+Tt(a,s),Ut(t=0|Ft(a,e),e=0|x(),i),Vt(t,e,n),e=~~+y(+f/+Tt(i,n+8|0)),M=r,0|e}function W(t,e,r,n){e|=0,r|=0,n|=0,i[(t|=0)>>2]=e,i[t+4>>2]=r,i[t+8>>2]=n}function H(t,e){t|=0;var r,n,a,s,c=0,l=0,h=0,f=0,p=0,d=0,A=0;i[(s=(e|=0)+8|0)>>2]=0,n=+o[t>>3],f=+u(+n),a=+o[t+8>>3],f+=.5*(p=+u(+a)/.8660254037844386),f-=+(0|(c=~~f)),p-=+(0|(t=~~p));do{if(f<.5){if(f<.3333333333333333){if(i[e>>2]=c,p<.5*(f+1)){i[e+4>>2]=t;break}t=t+1|0,i[e+4>>2]=t;break}if(t=(1&!(p<(A=1-f)))+t|0,i[e+4>>2]=t,A<=p&p<2*f){c=c+1|0,i[e>>2]=c;break}i[e>>2]=c;break}if(!(f<.6666666666666666)){if(c=c+1|0,i[e>>2]=c,p<.5*f){i[e+4>>2]=t;break}t=t+1|0,i[e+4>>2]=t;break}if(p<1-f){if(i[e+4>>2]=t,2*f-1<p){i[e>>2]=c;break}}else t=t+1|0,i[e+4>>2]=t;c=c+1|0,i[e>>2]=c}while(0);do{if(n<0){if(1&t){c=~~(+(0|c)-(2*(+((d=0|de(0|c,((0|c)<0)<<31>>31|0,0|(d=(t+1|0)/2|0),((0|d)<0)<<31>>31|0))>>>0)+4294967296*+(0|x()))+1)),i[e>>2]=c;break}c=~~(+(0|c)-2*(+((d=0|de(0|c,((0|c)<0)<<31>>31|0,0|(d=(0|t)/2|0),((0|d)<0)<<31>>31|0))>>>0)+4294967296*+(0|x()))),i[e>>2]=c;break}}while(0);d=e+4|0,a<0&&(c=c-((1|t<<1)/2|0)|0,i[e>>2]=c,t=0-t|0,i[d>>2]=t),l=t-c|0,(0|c)<0?(h=0-c|0,i[d>>2]=l,i[s>>2]=h,i[e>>2]=0,t=l,c=0):h=0,(0|t)<0&&(c=c-t|0,i[e>>2]=c,h=h-t|0,i[s>>2]=h,i[d>>2]=0,t=0),r=c-h|0,l=t-h|0,(0|h)<0&&(i[e>>2]=r,i[d>>2]=l,i[s>>2]=0,t=l,c=r,h=0),(0|(l=(0|h)<(0|(l=(0|t)<(0|c)?t:c))?h:l))<=0||(i[e>>2]=c-l,i[d>>2]=t-l,i[s>>2]=h-l)}function q(t){var e,r=0,n=0,o=0,a=0,s=0;r=0|i[(t|=0)>>2],n=0|i[(e=t+4|0)>>2],(0|r)<0&&(n=n-r|0,i[e>>2]=n,i[(s=t+8|0)>>2]=(0|i[s>>2])-r,i[t>>2]=0,r=0),(0|n)<0?(r=r-n|0,i[t>>2]=r,a=(0|i[(s=t+8|0)>>2])-n|0,i[s>>2]=a,i[e>>2]=0,n=0):(s=a=t+8|0,a=0|i[a>>2]),(0|a)<0&&(r=r-a|0,i[t>>2]=r,n=n-a|0,i[e>>2]=n,i[s>>2]=0,a=0),(0|(o=(0|a)<(0|(o=(0|n)<(0|r)?n:r))?a:o))<=0||(i[t>>2]=r-o,i[e>>2]=n-o,i[s>>2]=a-o)}function Z(t,e){e|=0;var r,n;n=0|i[(t|=0)+8>>2],r=+((0|i[t+4>>2])-n|0),o[e>>3]=+((0|i[t>>2])-n|0)-.5*r,o[e+8>>3]=.8660254037844386*r}function X(t,e,r){t|=0,e|=0,i[(r|=0)>>2]=(0|i[e>>2])+(0|i[t>>2]),i[r+4>>2]=(0|i[e+4>>2])+(0|i[t+4>>2]),i[r+8>>2]=(0|i[e+8>>2])+(0|i[t+8>>2])}function Q(t,e,r){t|=0,e|=0,i[(r|=0)>>2]=(0|i[t>>2])-(0|i[e>>2]),i[r+4>>2]=(0|i[t+4>>2])-(0|i[e+4>>2]),i[r+8>>2]=(0|i[t+8>>2])-(0|i[e+8>>2])}function Y(t,e){e|=0;var r,n=0;n=0|v(0|i[(t|=0)>>2],e),i[t>>2]=n,r=0|v(0|i[(n=t+4|0)>>2],e),i[n>>2]=r,e=0|v(0|i[(t=t+8|0)>>2],e),i[t>>2]=e}function K(t){var e,r,n=0,o=0,a=0,s=0,u=0;u=(0|(r=0|i[(t|=0)>>2]))<0,t=(t=(o=(0|(s=((e=(0|(a=(0|i[t+4>>2])-(u?r:0)|0))<0)?0-a|0:0)+((0|i[t+8>>2])-(u?r:0))|0))<0)?0:s)-((a=(0|(o=(0|t)<(0|(o=(0|(n=(e?0:a)-(o?s:0)|0))<(0|(s=(u?0:r)-(e?a:0)-(o?s:0)|0))?n:s))?t:o))>0)?o:0)|0,n=n-(a?o:0)|0;t:do{switch(s-(a?o:0)|0){case 0:switch(0|n){case 0:return 0|(u=0==(0|t)?0:1==(0|t)?1:7);case 1:return 0|(u=0==(0|t)?2:1==(0|t)?3:7);default:break t}case 1:switch(0|n){case 0:return 0|(u=0==(0|t)?4:1==(0|t)?5:7);case 1:if(t)break t;return 0|(t=6);default:break t}}}while(0);return 0|(u=7)}function $(t){var e,r,n=0,o=0,a=0,s=0,u=0;o=0|i[(e=(t|=0)+8|0)>>2],a=0|le(+((3*(n=(0|i[t>>2])-o|0)|0)-(o=(0|i[(r=t+4|0)>>2])-o|0)|0)/7),i[t>>2]=a,n=0|le(+((o<<1)+n|0)/7),i[r>>2]=n,i[e>>2]=0,o=n-a|0,(0|a)<0?(u=0-a|0,i[r>>2]=o,i[e>>2]=u,i[t>>2]=0,n=o,a=0,o=u):o=0,(0|n)<0&&(a=a-n|0,i[t>>2]=a,o=o-n|0,i[e>>2]=o,i[r>>2]=0,n=0),u=a-o|0,s=n-o|0,(0|o)<0?(i[t>>2]=u,i[r>>2]=s,i[e>>2]=0,n=s,s=u,o=0):s=a,(0|(a=(0|o)<(0|(a=(0|n)<(0|s)?n:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=n-a,i[e>>2]=o-a)}function J(t){var e,r,n=0,o=0,a=0,s=0,u=0;o=0|i[(e=(t|=0)+8|0)>>2],a=0|le(+(((n=(0|i[t>>2])-o|0)<<1)+(o=(0|i[(r=t+4|0)>>2])-o|0)|0)/7),i[t>>2]=a,n=0|le(+((3*o|0)-n|0)/7),i[r>>2]=n,i[e>>2]=0,o=n-a|0,(0|a)<0?(u=0-a|0,i[r>>2]=o,i[e>>2]=u,i[t>>2]=0,n=o,a=0,o=u):o=0,(0|n)<0&&(a=a-n|0,i[t>>2]=a,o=o-n|0,i[e>>2]=o,i[r>>2]=0,n=0),u=a-o|0,s=n-o|0,(0|o)<0?(i[t>>2]=u,i[r>>2]=s,i[e>>2]=0,n=s,s=u,o=0):s=a,(0|(a=(0|o)<(0|(a=(0|n)<(0|s)?n:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=n-a,i[e>>2]=o-a)}function tt(t){var e,r,n,o=0,a=0,s=0,u=0;o=0|i[(t|=0)>>2],a=0|i[(r=t+4|0)>>2],s=0|i[(n=t+8|0)>>2],u=a+(3*o|0)|0,i[t>>2]=u,a=s+(3*a|0)|0,i[r>>2]=a,o=(3*s|0)+o|0,i[n>>2]=o,s=a-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=s,i[n>>2]=o,i[t>>2]=0,a=s,s=0):s=u,(0|a)<0&&(s=s-a|0,i[t>>2]=s,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=s-o|0,u=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=u,i[n>>2]=0,s=e,o=0):u=a,(0|(a=(0|o)<(0|(a=(0|u)<(0|s)?u:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=u-a,i[n>>2]=o-a)}function et(t){var e,r,n,o=0,a=0,s=0,u=0;u=0|i[(t|=0)>>2],s=(3*(o=0|i[(r=t+4|0)>>2])|0)+u|0,u=(a=0|i[(n=t+8|0)>>2])+(3*u|0)|0,i[t>>2]=u,i[r>>2]=s,o=(3*a|0)+o|0,i[n>>2]=o,a=s-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=a,i[n>>2]=o,i[t>>2]=0,u=0):a=s,(0|a)<0&&(u=u-a|0,i[t>>2]=u,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=u-o|0,s=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=s,i[n>>2]=0,u=e,o=0):s=a,(0|(a=(0|o)<(0|(a=(0|s)<(0|u)?s:u))?o:a))<=0||(i[t>>2]=u-a,i[r>>2]=s-a,i[n>>2]=o-a)}function rt(t,e){t|=0;var r,n,o,a=0,s=0,u=0;((e|=0)+-1|0)>>>0>=6||(u=(0|i[15472+(12*e|0)>>2])+(0|i[t>>2])|0,i[t>>2]=u,o=t+4|0,s=(0|i[15472+(12*e|0)+4>>2])+(0|i[o>>2])|0,i[o>>2]=s,n=t+8|0,e=(0|i[15472+(12*e|0)+8>>2])+(0|i[n>>2])|0,i[n>>2]=e,a=s-u|0,(0|u)<0?(e=e-u|0,i[o>>2]=a,i[n>>2]=e,i[t>>2]=0,s=0):(a=s,s=u),(0|a)<0&&(s=s-a|0,i[t>>2]=s,e=e-a|0,i[n>>2]=e,i[o>>2]=0,a=0),r=s-e|0,u=a-e|0,(0|e)<0?(i[t>>2]=r,i[o>>2]=u,i[n>>2]=0,s=r,e=0):u=a,(0|(a=(0|e)<(0|(a=(0|u)<(0|s)?u:s))?e:a))<=0||(i[t>>2]=s-a,i[o>>2]=u-a,i[n>>2]=e-a))}function nt(t){var e,r,n,o=0,a=0,s=0,u=0;u=0|i[(t|=0)>>2],s=(o=0|i[(r=t+4|0)>>2])+u|0,u=(a=0|i[(n=t+8|0)>>2])+u|0,i[t>>2]=u,i[r>>2]=s,o=a+o|0,i[n>>2]=o,a=s-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=a,i[n>>2]=o,i[t>>2]=0,s=0):(a=s,s=u),(0|a)<0&&(s=s-a|0,i[t>>2]=s,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=s-o|0,u=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=u,i[n>>2]=0,s=e,o=0):u=a,(0|(a=(0|o)<(0|(a=(0|u)<(0|s)?u:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=u-a,i[n>>2]=o-a)}function it(t){var e,r,n,o=0,a=0,s=0,u=0;o=0|i[(t|=0)>>2],s=0|i[(r=t+4|0)>>2],a=0|i[(n=t+8|0)>>2],u=s+o|0,i[t>>2]=u,s=a+s|0,i[r>>2]=s,o=a+o|0,i[n>>2]=o,a=s-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=a,i[n>>2]=o,i[t>>2]=0,s=0):(a=s,s=u),(0|a)<0&&(s=s-a|0,i[t>>2]=s,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=s-o|0,u=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=u,i[n>>2]=0,s=e,o=0):u=a,(0|(a=(0|o)<(0|(a=(0|u)<(0|s)?u:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=u-a,i[n>>2]=o-a)}function ot(t){switch(0|(t|=0)){case 1:t=5;break;case 5:t=4;break;case 4:t=6;break;case 6:t=2;break;case 2:t=3;break;case 3:t=1}return 0|t}function at(t){switch(0|(t|=0)){case 1:t=3;break;case 3:t=2;break;case 2:t=6;break;case 6:t=4;break;case 4:t=5;break;case 5:t=1}return 0|t}function st(t){var e,r,n,o=0,a=0,s=0,u=0;o=0|i[(t|=0)>>2],a=0|i[(r=t+4|0)>>2],s=0|i[(n=t+8|0)>>2],u=a+(o<<1)|0,i[t>>2]=u,a=s+(a<<1)|0,i[r>>2]=a,o=(s<<1)+o|0,i[n>>2]=o,s=a-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=s,i[n>>2]=o,i[t>>2]=0,a=s,s=0):s=u,(0|a)<0&&(s=s-a|0,i[t>>2]=s,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=s-o|0,u=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=u,i[n>>2]=0,s=e,o=0):u=a,(0|(a=(0|o)<(0|(a=(0|u)<(0|s)?u:s))?o:a))<=0||(i[t>>2]=s-a,i[r>>2]=u-a,i[n>>2]=o-a)}function ut(t){var e,r,n,o=0,a=0,s=0,u=0;u=0|i[(t|=0)>>2],s=((o=0|i[(r=t+4|0)>>2])<<1)+u|0,u=(a=0|i[(n=t+8|0)>>2])+(u<<1)|0,i[t>>2]=u,i[r>>2]=s,o=(a<<1)+o|0,i[n>>2]=o,a=s-u|0,(0|u)<0?(o=o-u|0,i[r>>2]=a,i[n>>2]=o,i[t>>2]=0,u=0):a=s,(0|a)<0&&(u=u-a|0,i[t>>2]=u,o=o-a|0,i[n>>2]=o,i[r>>2]=0,a=0),e=u-o|0,s=a-o|0,(0|o)<0?(i[t>>2]=e,i[r>>2]=s,i[n>>2]=0,u=e,o=0):s=a,(0|(a=(0|o)<(0|(a=(0|s)<(0|u)?s:u))?o:a))<=0||(i[t>>2]=u-a,i[r>>2]=s-a,i[n>>2]=o-a)}function ct(t,e){e|=0;var r,n,o,a=0,s=0,u=0;return o=(0|(n=(0|i[(t|=0)>>2])-(0|i[e>>2])|0))<0,r=(0|(s=(0|i[t+4>>2])-(0|i[e+4>>2])-(o?n:0)|0))<0,e=(e=(t=(0|(u=(o?0-n|0:0)+(0|i[t+8>>2])-(0|i[e+8>>2])+(r?0-s|0:0)|0))<0)?0:u)-((s=(0|(t=(0|e)<(0|(t=(0|(a=(r?0:s)-(t?u:0)|0))<(0|(u=(o?0:n)-(r?s:0)-(t?u:0)|0))?a:u))?e:t))>0)?t:0)|0,a=a-(s?t:0)|0,0|((0|(t=(0|(t=u-(s?t:0)|0))>-1?t:0-t|0))>(0|(e=(0|(a=(0|a)>-1?a:0-a|0))>(0|(e=(0|e)>-1?e:0-e|0))?a:e))?t:e)}function lt(t,e){e|=0;var r;r=0|i[(t|=0)+8>>2],i[e>>2]=(0|i[t>>2])-r,i[e+4>>2]=(0|i[t+4>>2])-r}function ht(t,e){e|=0;var r,n,o,a=0,s=0,u=0;s=0|i[(t|=0)>>2],i[e>>2]=s,t=0|i[t+4>>2],i[(n=e+4|0)>>2]=t,i[(o=e+8|0)>>2]=0,a=t-s|0,(0|s)<0?(t=0-s|0,i[n>>2]=a,i[o>>2]=t,i[e>>2]=0,s=0):(a=t,t=0),(0|a)<0&&(s=s-a|0,i[e>>2]=s,t=t-a|0,i[o>>2]=t,i[n>>2]=0,a=0),r=s-t|0,u=a-t|0,(0|t)<0?(i[e>>2]=r,i[n>>2]=u,i[o>>2]=0,a=u,u=r,t=0):u=s,(0|(s=(0|t)<(0|(s=(0|a)<(0|u)?a:u))?t:s))<=0||(i[e>>2]=u-s,i[n>>2]=a-s,i[o>>2]=t-s)}function ft(t){var e,r,n,o;r=(o=0|i[(e=(t|=0)+8|0)>>2])-(0|i[t>>2])|0,i[t>>2]=r,t=(0|i[(n=t+4|0)>>2])-o|0,i[n>>2]=t,i[e>>2]=0-(t+r)}function pt(t){var e,r,n=0,o=0,a=0,s=0,u=0;n=0-(o=0|i[(t|=0)>>2])|0,i[t>>2]=n,i[(e=t+8|0)>>2]=0,s=(a=0|i[(r=t+4|0)>>2])+o|0,(0|o)>0?(i[r>>2]=s,i[e>>2]=o,i[t>>2]=0,n=0,a=s):o=0,(0|a)<0?(u=n-a|0,i[t>>2]=u,o=o-a|0,i[e>>2]=o,i[r>>2]=0,s=u-o|0,n=0-o|0,(0|o)<0?(i[t>>2]=s,i[r>>2]=n,i[e>>2]=0,a=n,o=0):(a=0,s=u)):s=n,(0|(n=(0|o)<(0|(n=(0|a)<(0|s)?a:s))?o:n))<=0||(i[t>>2]=s-n,i[r>>2]=a-n,i[e>>2]=o-n)}function dt(t,e,r,n){e|=0,r|=0,n|=0;var a,s=0,u=0,c=0,l=0;if(a=M,M=M+32|0,function(t,e){e|=0;var r,n,i=0;i=+o[(t=t|0)>>3],r=+h(+i),i=+f(+i),o[e+16>>3]=i,i=+o[t+8>>3],n=r*+h(+i),o[e>>3]=n,i=r*+f(+i),o[e+8>>3]=i}(t|=0,u=a),i[r>>2]=0,s=+re(15888,u),(c=+re(15912,u))<s&&(i[r>>2]=1,s=c),(c=+re(15936,u))<s&&(i[r>>2]=2,s=c),(c=+re(15960,u))<s&&(i[r>>2]=3,s=c),(c=+re(15984,u))<s&&(i[r>>2]=4,s=c),(c=+re(16008,u))<s&&(i[r>>2]=5,s=c),(c=+re(16032,u))<s&&(i[r>>2]=6,s=c),(c=+re(16056,u))<s&&(i[r>>2]=7,s=c),(c=+re(16080,u))<s&&(i[r>>2]=8,s=c),(c=+re(16104,u))<s&&(i[r>>2]=9,s=c),(c=+re(16128,u))<s&&(i[r>>2]=10,s=c),(c=+re(16152,u))<s&&(i[r>>2]=11,s=c),(c=+re(16176,u))<s&&(i[r>>2]=12,s=c),(c=+re(16200,u))<s&&(i[r>>2]=13,s=c),(c=+re(16224,u))<s&&(i[r>>2]=14,s=c),(c=+re(16248,u))<s&&(i[r>>2]=15,s=c),(c=+re(16272,u))<s&&(i[r>>2]=16,s=c),(c=+re(16296,u))<s&&(i[r>>2]=17,s=c),(c=+re(16320,u))<s&&(i[r>>2]=18,s=c),(c=+re(16344,u))<s&&(i[r>>2]=19,s=c),(c=+d(+(1-.5*s)))<1e-16)return i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,i[n+12>>2]=0,void(M=a);if(r=0|i[r>>2],s=+xt((s=+o[16368+(24*r|0)>>3])-+xt(+function(t,e){t|=0;var r,n,i,a,s;return a=+o[(e=e|0)>>3],n=+h(+a),i=+o[e+8>>3]-+o[t+8>>3],s=n*+f(+i),r=+o[t>>3],+ +m(+s,+(+f(+a)*+h(+r)-+h(+i)*(n*+f(+r))))}(15568+(r<<4)|0,t))),l=0|Bt(e)?+xt(s+-.3334731722518321):s,s=+p(+c)/.381966011250105,(0|e)>0){u=0;do{s*=2.6457513110645907,u=u+1|0}while((0|u)!=(0|e))}c=+h(+l)*s,o[n>>3]=c,l=+f(+l)*s,o[n+8>>3]=l,M=a}function At(t,e,r,n,a){e|=0,r|=0,n|=0,a|=0;var s=0,l=0;if((s=+function(t){var e,r;return r=+o[(t=t|0)>>3],e=+o[t+8>>3],+ +c(+(r*r+e*e))}(t|=0))<1e-16)return e=15568+(e<<4)|0,i[a>>2]=i[e>>2],i[a+4>>2]=i[e+4>>2],i[a+8>>2]=i[e+8>>2],void(i[a+12>>2]=i[e+12>>2]);if(l=+m(+ +o[t+8>>3],+ +o[t>>3]),(0|r)>0){t=0;do{s/=2.6457513110645907,t=t+1|0}while((0|t)!=(0|r))}n?(s/=3,r=0==(0|Bt(r)),s=+g(.381966011250105*(r?s:s/2.6457513110645907))):(s=+g(.381966011250105*s),0|Bt(r)&&(l=+xt(l+.3334731722518321))),function(t,e,r,n){t|=0,e=+e,n|=0;var a=0,s=0,c=0,l=0;if((r=+r)<1e-16)return i[n>>2]=i[t>>2],i[n+4>>2]=i[t+4>>2],i[n+8>>2]=i[t+8>>2],void(i[n+12>>2]=i[t+12>>2]);s=e<0?e+6.283185307179586:e,s=e>=6.283185307179586?s+-6.283185307179586:s;do{if(!(s<1e-16)){if(a=+u(+(s+-3.141592653589793))<1e-16,e=+o[t>>3],a){e-=r,o[n>>3]=e,a=n;break}if(c=+h(+r),r=+f(+r),e=c*+f(+e)+ +h(+s)*(r*+h(+e)),e=+A(+((e=e>1?1:e)<-1?-1:e)),o[n>>3]=e,+u(+(e+-1.5707963267948966))<1e-16)return o[n>>3]=1.5707963267948966,void(o[n+8>>3]=0);if(+u(+(e+1.5707963267948966))<1e-16)return o[n>>3]=-1.5707963267948966,void(o[n+8>>3]=0);if(l=+h(+e),s=r*+f(+s)/l,r=+o[t>>3],e=(c-+f(+e)*+f(+r))/+h(+r)/l,c=s>1?1:s,e=e>1?1:e,(e=+o[t+8>>3]+ +m(+(c<-1?-1:c),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[n+8>>3]=e)}e=+o[t>>3]+r,o[n>>3]=e,a=n}while(0);if(+u(+(e+-1.5707963267948966))<1e-16)return o[a>>3]=1.5707963267948966,void(o[n+8>>3]=0);if(+u(+(e+1.5707963267948966))<1e-16)return o[a>>3]=-1.5707963267948966,void(o[n+8>>3]=0);if((e=+o[t+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[n+8>>3]=e}(15568+(e<<4)|0,+xt(+o[16368+(24*e|0)>>3]-l),s,a)}function gt(t,e,r){e|=0,r|=0;var n,o;n=M,M=M+16|0,Z((t|=0)+4|0,o=n),At(o,0|i[t>>2],e,0,r),M=n}function mt(t,e,r){t|=0,e|=0,r|=0;var n,o=0,a=0,s=0,u=0,c=0;n=M,M=M+128|0,a=n,u=20208,c=(s=o=n+64|0)+60|0;do{i[s>>2]=i[u>>2],s=s+4|0,u=u+4|0}while((0|s)<(0|c));u=20272,c=(s=a)+60|0;do{i[s>>2]=i[u>>2],s=s+4|0,u=u+4|0}while((0|s)<(0|c));o=(c=0==(0|Bt(0|i[e>>2])))?o:a,st(a=t+4|0),ut(a),0|Bt(0|i[e>>2])&&(et(a),i[e>>2]=1+(0|i[e>>2])),i[r>>2]=i[t>>2],X(a,o,e=r+4|0),q(e),i[r+16>>2]=i[t>>2],X(a,o+12|0,e=r+20|0),q(e),i[r+32>>2]=i[t>>2],X(a,o+24|0,e=r+36|0),q(e),i[r+48>>2]=i[t>>2],X(a,o+36|0,e=r+52|0),q(e),i[r+64>>2]=i[t>>2],X(a,o+48|0,r=r+68|0),q(r),M=n}function yt(t,e,r,n){r|=0,n|=0;var o,a,s,u,c,l,h=0,f=0,p=0,d=0,A=0;if(l=M,M=M+32|0,c=l+12|0,a=l,A=(t|=0)+4|0,d=0|i[16928+((e|=0)<<2)>>2],d=(u=0!=(0|n))?3*d|0:d,h=0|i[A>>2],o=0|i[(s=t+8|0)>>2],u){if((0|(h=o+h+(n=0|i[(f=t+12|0)>>2])|0))==(0|d))return M=l,0|(A=1);p=f}else h=o+h+(n=0|i[(p=t+12|0)>>2])|0;if((0|h)<=(0|d))return M=l,0|(A=0);do{if((0|n)>0){if(n=0|i[t>>2],(0|o)>0){f=18608+(80*n|0)+60|0,n=t;break}n=18608+(80*n|0)+40|0,r?(W(c,d,0,0),Q(A,c,a),it(a),X(a,c,A),f=n,n=t):(f=n,n=t)}else f=18608+(80*(0|i[t>>2])|0)+20|0,n=t}while(0);if(i[n>>2]=i[f>>2],(0|i[(h=f+16|0)>>2])>0){n=0;do{nt(A),n=n+1|0}while((0|n)<(0|i[h>>2]))}return t=f+4|0,i[c>>2]=i[t>>2],i[c+4>>2]=i[t+4>>2],i[c+8>>2]=i[t+8>>2],e=0|i[16848+(e<<2)>>2],Y(c,u?3*e|0:e),X(A,c,A),q(A),n=u&&((0|i[s>>2])+(0|i[A>>2])+(0|i[p>>2])|0)==(0|d)?1:2,M=l,0|(A=n)}function vt(t,e){t|=0,e|=0;var r=0;do{r=0|yt(t,e,0,1)}while(2==(0|r));return 0|r}function _t(t,e,r,n){t|=0,e|=0,n|=0;var a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x=0,E=0,S=0,O=0,T=0,P=0;if(b=M,M=M+240|0,x=b+224|0,g=b+208|0,m=b,y=b+192|0,v=b+176|0,_=b+160|0,f=b+144|0,p=b+128|0,d=b+112|0,A=b+96|0,0|(r|=0))return function(t,e,r){t|=0,e|=0,r|=0;var n,a,s,u,c,l,h,f,p,d,A,g,m,y,v,_,b,x,E,S=0,O=0,T=0,P=0,C=0,I=0,k=0,R=0;E=M,M=M+272|0,I=E+240|0,y=E,v=E+224|0,_=E+208|0,b=E+176|0,x=E+160|0,f=E+192|0,p=E+144|0,d=E+128|0,A=E+112|0,g=E+96|0,m=E+80|0,i[(C=E+256|0)>>2]=e,i[I>>2]=i[t>>2],i[I+4>>2]=i[t+4>>2],i[I+8>>2]=i[t+8>>2],i[I+12>>2]=i[t+12>>2],mt(I,C,y),i[r>>2]=0,I=v+4|0,n=b+4|0,a=16848+((C=0|i[C>>2])<<2)|0,s=16928+(C<<2)|0,u=d+8|0,c=A+8|0,l=g+8|0,h=_+4|0,P=0;t:for(;;){T=y+(((P>>>0)%5|0)<<4)|0,i[_>>2]=i[T>>2],i[_+4>>2]=i[T+4>>2],i[_+8>>2]=i[T+8>>2],i[_+12>>2]=i[T+12>>2];do{}while(2==(0|yt(_,C,0,1)));if(0!=(0|P)&0!=(0|Bt(e))){if(i[b>>2]=i[_>>2],i[b+4>>2]=i[_+4>>2],i[b+8>>2]=i[_+8>>2],i[b+12>>2]=i[_+12>>2],Z(I,x),S=0|i[b>>2],O=0|i[17008+(80*S|0)+(i[v>>2]<<2)>>2],i[b>>2]=i[18608+(80*S|0)+(20*O|0)>>2],(0|(T=0|i[18608+(80*S|0)+(20*O|0)+16>>2]))>0){t=0;do{nt(n),t=t+1|0}while((0|t)<(0|T))}switch(T=18608+(80*S|0)+(20*O|0)+4|0,i[f>>2]=i[T>>2],i[f+4>>2]=i[T+4>>2],i[f+8>>2]=i[T+8>>2],Y(f,3*(0|i[a>>2])|0),X(n,f,n),q(n),Z(n,p),k=+(0|i[s>>2]),o[d>>3]=3*k,o[u>>3]=0,R=-1.5*k,o[A>>3]=R,o[c>>3]=2.598076211353316*k,o[g>>3]=R,o[l>>3]=-2.598076211353316*k,0|i[17008+(80*(0|i[b>>2])|0)+(i[_>>2]<<2)>>2]){case 1:t=A,S=d;break;case 3:t=g,S=A;break;case 2:t=d,S=g;break;default:t=11;break t}te(x,p,S,t,m),At(m,0|i[b>>2],C,1,r+8+(i[r>>2]<<4)|0),i[r>>2]=1+(0|i[r>>2])}if(P>>>0<5&&(Z(h,b),At(b,0|i[_>>2],C,1,r+8+(i[r>>2]<<4)|0),i[r>>2]=1+(0|i[r>>2])),i[v>>2]=i[_>>2],i[v+4>>2]=i[_+4>>2],i[v+8>>2]=i[_+8>>2],i[v+12>>2]=i[_+12>>2],(P=P+1|0)>>>0>=6){t=2;break}}2!=(0|t)?11==(0|t)&&w(22113,22160,571,22170):M=E}(t,e,n),void(M=b);i[x>>2]=e,i[g>>2]=i[t>>2],i[g+4>>2]=i[t+4>>2],i[g+8>>2]=i[t+8>>2],i[g+12>>2]=i[t+12>>2],bt(g,x,m),i[n>>2]=0,s=16928+((a=0|i[x>>2])<<2)|0,u=f+8|0,c=p+8|0,l=d+8|0,h=y+4|0,E=0,S=0,r=-1;t:for(;;){if(t=m+((x=(S>>>0)%6|0)<<4)|0,i[y>>2]=i[t>>2],i[y+4>>2]=i[t+4>>2],i[y+8>>2]=i[t+8>>2],i[y+12>>2]=i[t+12>>2],t=E,E=0|yt(y,a,0,1),0!=(0|S)&0!=(0|Bt(e))&&(1!=(0|t)&&(0|i[y>>2])!=(0|r))){switch(Z(m+((((x+5|0)>>>0)%6|0)<<4)+4|0,v),Z(m+(x<<4)+4|0,_),T=+(0|i[s>>2]),o[f>>3]=3*T,o[u>>3]=0,P=-1.5*T,o[p>>3]=P,o[c>>3]=2.598076211353316*T,o[d>>3]=P,o[l>>3]=-2.598076211353316*T,x=0|i[g>>2],0|i[17008+(80*x|0)+(((0|r)==(0|x)?0|i[y>>2]:r)<<2)>>2]){case 1:t=p,r=f;break;case 3:t=d,r=p;break;case 2:t=f,r=d;break;default:O=9;break t}te(v,_,r,t,A),0|ee(v,A)||0|ee(_,A)||(At(A,0|i[g>>2],a,1,n+8+(i[n>>2]<<4)|0),i[n>>2]=1+(0|i[n>>2]))}if(S>>>0<6&&(Z(h,v),At(v,0|i[y>>2],a,1,n+8+(i[n>>2]<<4)|0),i[n>>2]=1+(0|i[n>>2])),(S=S+1|0)>>>0>=7)break;r=0|i[y>>2]}9==(0|O)&&w(22196,22160,735,22241),M=b}function bt(t,e,r){t|=0,e|=0,r|=0;var n,o=0,a=0,s=0,u=0,c=0;n=M,M=M+160|0,a=n,u=20336,c=(s=o=n+80|0)+72|0;do{i[s>>2]=i[u>>2],s=s+4|0,u=u+4|0}while((0|s)<(0|c));u=20416,c=(s=a)+72|0;do{i[s>>2]=i[u>>2],s=s+4|0,u=u+4|0}while((0|s)<(0|c));o=(c=0==(0|Bt(0|i[e>>2])))?o:a,st(a=t+4|0),ut(a),0|Bt(0|i[e>>2])&&(et(a),i[e>>2]=1+(0|i[e>>2])),i[r>>2]=i[t>>2],X(a,o,e=r+4|0),q(e),i[r+16>>2]=i[t>>2],X(a,o+12|0,e=r+20|0),q(e),i[r+32>>2]=i[t>>2],X(a,o+24|0,e=r+36|0),q(e),i[r+48>>2]=i[t>>2],X(a,o+36|0,e=r+52|0),q(e),i[r+64>>2]=i[t>>2],X(a,o+48|0,e=r+68|0),q(e),i[r+80>>2]=i[t>>2],X(a,o+60|0,r=r+84|0),q(r),M=n}function xt(t){var e;return e=(t=+t)<0?t+6.283185307179586:t,+(t>=6.283185307179586?e+-6.283185307179586:e)}function wt(t,e,r){return e|=0,r=+r,+u(+(+o[(t|=0)>>3]-+o[e>>3]))<r?0|(e=+u(+(+o[t+8>>3]-+o[e+8>>3]))<r):0|(e=0)}function Et(t,e){return e|=0,+u(+(+o[(t|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+u(+(+o[t+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function St(t){if(!((t=+t)>1.5707963267948966))return+t;do{t+=-3.141592653589793}while(t>1.5707963267948966);return+t}function Ot(t){if((t=+t)>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(!(t<-3.141592653589793))return+t;do{t+=6.283185307179586}while(t<-3.141592653589793);return+t}function Tt(t,e){t|=0;var r=0,n=0,i=0;return n=+o[(e|=0)+8>>3],i=+o[t+8>>3],(r=+u(+(n-i)))>3.141592653589793&&(r=+u(+((n<0?n+6.283185307179586:n)-(i<0?i+6.283185307179586:i)))),n=1.5707963267948966-+o[t>>3],i=1.5707963267948966-+o[e>>3],i=+h(+n)*+h(+i)+ +h(+r)*(+f(+n)*+f(+i)),6371.007180918475*+d(+((i=i>1?1:i)<-1?-1:i))}function Pt(t,e){var r=0,n=0,i=0,o=0,a=0,s=0;if(!(!0&134217728==(2013265920&(e|=0)|0)))return 0|(e=0);if(a=0|ye(0|(t|=0),0|e,45),x(),(a&=127)>>>0>121)return 0|(e=0);r=0|ye(0|t,0|e,52),x(),r&=15;do{if(0|r){for(i=1,n=0;;){if(o=0|ye(0|t,0|e,3*(15-i|0)|0),x(),0!=(0|(o&=7))&(1^n)){if(1==(0|o)&0!=(0|L(a))){s=0,n=13;break}n=1}if(7==(0|o)){s=0,n=13;break}if(!(i>>>0<r>>>0)){n=9;break}i=i+1|0}if(9==(0|n)){if(15!=(0|r))break;return 0|(s=1)}if(13==(0|n))return 0|s}}while(0);for(;;){if(s=0|ye(0|t,0|e,3*(14-r|0)|0),x(),!(7==(7&s|0)&!0)){s=0,n=13;break}if(!(r>>>0<14)){s=1,n=13;break}r=r+1|0}return 13==(0|n)?0|s:0}function Mt(t,e,r){r|=0;var n=0,i=0;if(n=0|ye(0|(t|=0),0|(e|=0),52),x(),(0|(n&=15))>=(0|r)){if((0|n)!=(0|r))if(r>>>0<=15){if(t|=i=0|ve(0|r,0,52),e=0|x()|-15728641&e,(0|n)>(0|r))do{i=0|ve(7,0,3*(14-r|0)|0),r=r+1|0,t|=i,e=0|x()|e}while((0|r)<(0|n))}else e=0,t=0}else e=0,t=0;return b(0|e),0|t}function Ct(t,e,r,n){r|=0,n|=0;var o,a=0,s=0,u=0,c=0,l=0,h=0;if(u=0|ye(0|(t|=0),0|(e|=0),52),x(),(0|r)<16&(0|(u&=15))<=(0|r)){if((0|u)==(0|r))return i[(r=n)>>2]=t,void(i[r+4>>2]=e);if(o=(0|(l=0|Yt(7,r-u|0)))/7|0,c=0|ye(0|t,0|e,45),x(),0|L(127&c)){t:do{if(u)for(s=1;;){if(a=0|ye(0|t,0|e,3*(15-s|0)|0),x(),0|(a&=7))break t;if(!(s>>>0<u>>>0)){a=0;break}s=s+1|0}else a=0}while(0);s=0==(0|a)}else s=0;if(h=0|ve(u+1|0,0,52),a=0|x()|-15728641&e,Ct(e=(h|t)&~(e=0|ve(7,0,0|(c=3*(14-u|0)|0))),u=a&~(0|x()),r,n),a=n+(o<<3)|0,!s)return Ct((h=0|ve(1,0,0|c))|e,0|x()|u,r,a),h=a+(o<<3)|0,Ct((l=0|ve(2,0,0|c))|e,0|x()|u,r,h),h=h+(o<<3)|0,Ct((l=0|ve(3,0,0|c))|e,0|x()|u,r,h),h=h+(o<<3)|0,Ct((l=0|ve(4,0,0|c))|e,0|x()|u,r,h),h=h+(o<<3)|0,Ct((l=0|ve(5,0,0|c))|e,0|x()|u,r,h),void Ct((l=0|ve(6,0,0|c))|e,0|x()|u,r,h+(o<<3)|0);s=a+(o<<3)|0,(0|l)>6&&(xe(0|a,0,(h=(s>>>0>(l=a+8|0)>>>0?s:l)+-1+(0-a)|0)+8&-8|0),a=l+(h>>>3<<3)|0),Ct((h=0|ve(2,0,0|c))|e,0|x()|u,r,a),h=a+(o<<3)|0,Ct((l=0|ve(3,0,0|c))|e,0|x()|u,r,h),h=h+(o<<3)|0,Ct((l=0|ve(4,0,0|c))|e,0|x()|u,r,h),h=h+(o<<3)|0,Ct((l=0|ve(5,0,0|c))|e,0|x()|u,r,h),Ct((l=0|ve(6,0,0|c))|e,0|x()|u,r,h+(o<<3)|0)}}function It(t,e){var r=0,n=0,i=0;if(i=0|ye(0|(t|=0),0|(e|=0),45),x(),!(0|L(127&i)))return 0|(i=0);i=0|ye(0|t,0|e,52),x(),i&=15;t:do{if(i)for(n=1;;){if(r=0|ye(0|t,0|e,3*(15-n|0)|0),x(),0|(r&=7))break t;if(!(n>>>0<i>>>0)){r=0;break}n=n+1|0}else r=0}while(0);return 0|(i=0==(0|r)&1)}function kt(t,e){var r=0,n=0,i=0;if(i=0|ye(0|(t|=0),0|(e|=0),52),x(),!(i&=15))return 0|(i=0);for(n=1;;){if(r=0|ye(0|t,0|e,3*(15-n|0)|0),x(),0|(r&=7)){n=5;break}if(!(n>>>0<i>>>0)){r=0,n=5;break}n=n+1|0}return 5==(0|n)?0|r:0}function Rt(t,e){var r=0,n=0,i=0,o=0,a=0,s=0,u=0;if(u=0|ye(0|(t|=0),0|(e|=0),52),x(),!(u&=15))return u=t,b(0|(s=e)),0|u;for(s=1,r=0;;){n=0|ve(7,0,0|(o=3*(15-s|0)|0)),i=0|x(),a=0|ye(0|t,0|e,0|o),x(),t=(o=0|ve(0|ot(7&a),0,0|o))|t&~n,e=(a=0|x())|e&~i;t:do{if(!r)if(0==(o&n|0)&0==(a&i|0))r=0;else if(n=0|ye(0|t,0|e,52),x(),n&=15){r=1;e:for(;;){switch(a=0|ye(0|t,0|e,3*(15-r|0)|0),x(),7&a){case 1:break e;case 0:break;default:r=1;break t}if(!(r>>>0<n>>>0)){r=1;break t}r=r+1|0}for(r=1;;){if(i=0|ye(0|t,0|e,0|(a=3*(15-r|0)|0)),x(),o=0|ve(7,0,0|a),e&=~(0|x()),t=t&~o|(a=0|ve(0|ot(7&i),0,0|a)),e=0|e|x(),!(r>>>0<n>>>0)){r=1;break}r=r+1|0}}else r=1}while(0);if(!(s>>>0<u>>>0))break;s=s+1|0}return b(0|e),0|t}function Lt(t,e){var r=0,n=0,i=0,o=0,a=0;if(n=0|ye(0|(t|=0),0|(e|=0),52),x(),!(n&=15))return n=t,b(0|(r=e)),0|n;for(r=1;a=0|ye(0|t,0|e,0|(o=3*(15-r|0)|0)),x(),i=0|ve(7,0,0|o),e&=~(0|x()),t=(o=0|ve(0|ot(7&a),0,0|o))|t&~i,e=0|x()|e,r>>>0<n>>>0;)r=r+1|0;return b(0|e),0|t}function jt(t,e){var r=0,n=0,i=0,o=0,a=0,s=0,u=0;if(u=0|ye(0|(t|=0),0|(e|=0),52),x(),!(u&=15))return u=t,b(0|(s=e)),0|u;for(s=1,r=0;;){n=0|ve(7,0,0|(o=3*(15-s|0)|0)),i=0|x(),a=0|ye(0|t,0|e,0|o),x(),t=(o=0|ve(0|at(7&a),0,0|o))|t&~n,e=(a=0|x())|e&~i;t:do{if(!r)if(0==(o&n|0)&0==(a&i|0))r=0;else if(n=0|ye(0|t,0|e,52),x(),n&=15){r=1;e:for(;;){switch(a=0|ye(0|t,0|e,3*(15-r|0)|0),x(),7&a){case 1:break e;case 0:break;default:r=1;break t}if(!(r>>>0<n>>>0)){r=1;break t}r=r+1|0}for(r=1;;){if(o=0|ve(7,0,0|(i=3*(15-r|0)|0)),a=e&~(0|x()),e=0|ye(0|t,0|e,0|i),x(),t=t&~o|(e=0|ve(0|at(7&e),0,0|i)),e=0|a|x(),!(r>>>0<n>>>0)){r=1;break}r=r+1|0}}else r=1}while(0);if(!(s>>>0<u>>>0))break;s=s+1|0}return b(0|e),0|t}function Dt(t,e){var r=0,n=0,i=0,o=0,a=0;if(n=0|ye(0|(t|=0),0|(e|=0),52),x(),!(n&=15))return n=t,b(0|(r=e)),0|n;for(r=1;o=0|ve(7,0,0|(a=3*(15-r|0)|0)),i=e&~(0|x()),e=0|ye(0|t,0|e,0|a),x(),t=(e=0|ve(0|at(7&e),0,0|a))|t&~o,e=0|x()|i,r>>>0<n>>>0;)r=r+1|0;return b(0|e),0|t}function Bt(t){return 0|(0|(t|=0))%2}function Ft(t,e){t|=0;var r,n;return n=M,M=M+16|0,r=n,(e|=0)>>>0<=15&&2146435072!=(2146435072&i[t+4>>2]|0)&&2146435072!=(2146435072&i[t+8+4>>2]|0)?(!function(t,e,r){var n,i;n=M,M=M+16|0,dt(t|=0,e|=0,r|=0,i=n),H(i,r+4|0),M=n}(t,e,r),e=0|function(t,e){t|=0;var r,n=0,o=0,a=0,s=0,u=0,c=0,l=0,h=0;if(r=M,M=M+64|0,c=r+40|0,o=r+24|0,a=r+12|0,s=r,ve(0|(e|=0),0,52),n=134225919|x(),!e)return(0|i[t+4>>2])>2?(c=0,b(0|(u=0)),M=r,0|c):(0|i[t+8>>2])>2?(c=0,b(0|(u=0)),M=r,0|c):(0|i[t+12>>2])>2?(c=0,b(0|(u=0)),M=r,0|c):(ve(0|D(t),0,45),u=0|x()|n,c=-1,b(0|u),M=r,0|c);if(i[c>>2]=i[t>>2],i[c+4>>2]=i[t+4>>2],i[c+8>>2]=i[t+8>>2],i[c+12>>2]=i[t+12>>2],u=c+4|0,(0|e)>0)for(t=-1;i[o>>2]=i[u>>2],i[o+4>>2]=i[u+4>>2],i[o+8>>2]=i[u+8>>2],1&e?($(u),i[a>>2]=i[u>>2],i[a+4>>2]=i[u+4>>2],i[a+8>>2]=i[u+8>>2],tt(a)):(J(u),i[a>>2]=i[u>>2],i[a+4>>2]=i[u+4>>2],i[a+8>>2]=i[u+8>>2],et(a)),Q(o,a,s),q(s),l=0|ve(7,0,0|(h=3*(15-e|0)|0)),n&=~(0|x()),t=(h=0|ve(0|K(s),0,0|h))|t&~l,n=0|x()|n,(0|e)>1;)e=e+-1|0;else t=-1;t:do{if((0|i[u>>2])<=2&&(0|i[c+8>>2])<=2&&(0|i[c+12>>2])<=2){if(e=0|ve(0|(o=0|D(c)),0,45),e|=t,t=0|x()|-1040385&n,s=0|B(c),!(0|L(o))){if((0|s)<=0)break;for(a=0;;){if(o=0|ye(0|e,0|t,52),x(),o&=15)for(n=1;c=0|ye(0|e,0|t,0|(h=3*(15-n|0)|0)),x(),l=0|ve(7,0,0|h),t&=~(0|x()),e=e&~l|(h=0|ve(0|ot(7&c),0,0|h)),t=0|t|x(),n>>>0<o>>>0;)n=n+1|0;if((0|(a=a+1|0))==(0|s))break t}}a=0|ye(0|e,0|t,52),x(),a&=15;e:do{if(a){n=1;r:for(;;){switch(h=0|ye(0|e,0|t,3*(15-n|0)|0),x(),7&h){case 1:break r;case 0:break;default:break e}if(!(n>>>0<a>>>0))break e;n=n+1|0}if(0|F(o,0|i[c>>2]))for(n=1;l=0|ve(7,0,0|(c=3*(15-n|0)|0)),h=t&~(0|x()),t=0|ye(0|e,0|t,0|c),x(),e=e&~l|(t=0|ve(0|at(7&t),0,0|c)),t=0|h|x(),n>>>0<a>>>0;)n=n+1|0;else for(n=1;c=0|ye(0|e,0|t,0|(h=3*(15-n|0)|0)),x(),l=0|ve(7,0,0|h),t&=~(0|x()),e=e&~l|(h=0|ve(0|ot(7&c),0,0|h)),t=0|t|x(),n>>>0<a>>>0;)n=n+1|0}}while(0);if((0|s)>0){n=0;do{e=0|Rt(e,t),t=0|x(),n=n+1|0}while((0|n)!=(0|s))}}else e=0,t=0}while(0);return h=e,b(0|(l=t)),M=r,0|h}(r,e),t=0|x()):(t=0,e=0),b(0|t),M=n,0|e}function zt(t,e,r){var n,o=0,a=0,s=0;if(n=(r|=0)+4|0,a=0|ye(0|(t|=0),0|(e|=0),52),x(),a&=15,s=0|ye(0|t,0|e,45),x(),o=0==(0|a),0|L(127&s)){if(o)return 0|(s=1);o=1}else{if(o)return 0|(s=0);o=0==(0|i[n>>2])&&0==(0|i[r+8>>2])?0!=(0|i[r+12>>2])&1:1}for(r=1;1&r?tt(n):et(n),s=0|ye(0|t,0|e,3*(15-r|0)|0),x(),rt(n,7&s),r>>>0<a>>>0;)r=r+1|0;return 0|o}function Nt(t,e,r){r|=0;var n,o,a=0,s=0,u=0,c=0,l=0,h=0;o=M,M=M+16|0,n=o,h=0|ye(0|(t|=0),0|(e|=0),45),x(),h&=127;t:do{if(0!=(0|L(h))&&(u=0|ye(0|t,0|e,52),x(),0!=(0|(u&=15)))){a=1;e:for(;;){switch(l=0|ye(0|t,0|e,3*(15-a|0)|0),x(),7&l){case 5:break e;case 0:break;default:a=e;break t}if(!(a>>>0<u>>>0)){a=e;break t}a=a+1|0}for(s=1,a=e;c=0|ve(7,0,0|(e=3*(15-s|0)|0)),l=a&~(0|x()),a=0|ye(0|t,0|a,0|e),x(),t=t&~c|(a=0|ve(0|at(7&a),0,0|e)),a=0|l|x(),s>>>0<u>>>0;)s=s+1|0}else a=e}while(0);if(l=7728+(28*h|0)|0,i[r>>2]=i[l>>2],i[r+4>>2]=i[l+4>>2],i[r+8>>2]=i[l+8>>2],i[r+12>>2]=i[l+12>>2],0|zt(t,a,r)){if(c=r+4|0,i[n>>2]=i[c>>2],i[n+4>>2]=i[c+4>>2],i[n+8>>2]=i[c+8>>2],u=0|ye(0|t,0|a,52),x(),l=15&u,1&u?(et(c),u=l+1|0):u=l,0|L(h)){t:do{if(l)for(e=1;;){if(s=0|ye(0|t,0|a,3*(15-e|0)|0),x(),0|(s&=7)){a=s;break t}if(!(e>>>0<l>>>0)){a=0;break}e=e+1|0}else a=0}while(0);a=4==(0|a)&1}else a=0;if(0|yt(r,u,a,0)){if(0|L(h))do{}while(0!=(0|yt(r,u,0,0)));(0|u)!=(0|l)&&J(c)}else(0|u)!=(0|l)&&(i[c>>2]=i[n>>2],i[c+4>>2]=i[n+4>>2],i[c+8>>2]=i[n+8>>2]);M=o}else M=o}function Ut(t,e,r){r|=0;var n,i;n=M,M=M+16|0,Nt(t|=0,e|=0,i=n),e=0|ye(0|t,0|e,52),x(),gt(i,15&e,r),M=n}function Vt(t,e,r){r|=0;var n,i,o=0,a=0,s=0;if(i=M,M=M+16|0,Nt(t|=0,e|=0,n=i),s=0|ye(0|t,0|e,52),x(),s&=15,a=0|ye(0|t,0|e,45),x(),!(0|L(127&a)))return _t(n,s,e=0,r),void(M=i);t:do{if(s)for(a=1;;){if(o=0|ye(0|t,0|e,3*(15-a|0)|0),x(),0|(o&=7))break t;if(!(a>>>0<s>>>0)){o=0;break}a=a+1|0}else o=0}while(0);_t(n,s,e=0==(0|o)&1,r),M=i}function Gt(t,e,r,n){var o,a=0,s=0,u=0,c=0,l=0;if(o=M,M=M+64|0,u=o,(0|(t|=0))==(0|(r|=0))&(0|(e|=0))==(0|(n|=0))|!1|134217728!=(2013265920&e|0)|!1|134217728!=(2013265920&n|0))return M=o,0|(u=0);if(a=0|ye(0|t,0|e,52),x(),a&=15,s=0|ye(0|r,0|n,52),x(),(0|a)!=(15&s|0))return M=o,0|(u=0);if(s=a+-1|0,a>>>0>1&&(l=0|Mt(t,e,s),c=0|x(),(0|l)==(0|(s=0|Mt(r,n,s)))&(0|c)==(0|x()))){if(a=0|ye(0|t,0|e,0|(s=3*(15^a)|0)),x(),a&=7,s=0|ye(0|r,0|n,0|s),x(),0==(0|a)|0==(0|(s&=7)))return M=o,0|(l=1);if((0|i[21136+(a<<2)>>2])==(0|s))return M=o,0|(l=1);if((0|i[21168+(a<<2)>>2])==(0|s))return M=o,0|(l=1)}s=(a=u)+56|0;do{i[a>>2]=0,a=a+4|0}while((0|a)<(0|s));return C(t,e,1,u),a=(0|i[(l=u)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)||(0|i[(l=u+8|0)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)||(0|i[(l=u+16|0)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)||(0|i[(l=u+24|0)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)||(0|i[(l=u+32|0)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)||(0|i[(l=u+40|0)>>2])==(0|r)&&(0|i[l+4>>2])==(0|n)?1:1&((0|i[(a=u+48|0)>>2])==(0|r)?(0|i[a+4>>2])==(0|n):0),M=o,0|(l=a)}function Wt(t){t|=0;var e,r,n=0;return(e=0|pe(1,12))||w(22330,22285,46,22343),0|(n=0|i[(r=t+4|0)>>2])?(i[(n=n+8|0)>>2]=e,i[r>>2]=e,0|e):(0|i[t>>2]&&w(22360,22285,58,22383),i[(n=t)>>2]=e,i[r>>2]=e,0|e)}function Ht(t,e){t|=0,e|=0;var r,n;return(n=0|he(24))||w(22397,22285,75,22411),i[n>>2]=i[e>>2],i[n+4>>2]=i[e+4>>2],i[n+8>>2]=i[e+8>>2],i[n+12>>2]=i[e+12>>2],i[n+16>>2]=0,0|(r=0|i[(e=t+4|0)>>2])?(i[r+16>>2]=n,i[e>>2]=n,0|n):(0|i[t>>2]&&w(22426,22285,79,22411),i[t>>2]=n,i[e>>2]=n,0|n)}function qt(t){var e,r,n=0,a=0,s=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0,x=0,E=0,S=0,O=0,T=0,P=0,M=0,C=0,I=0,k=0,R=0,L=0,j=0,D=0;if(0|i[(c=(t|=0)+8|0)>>2])return 0|(D=1);if(!(s=0|i[t>>2]))return 0|(D=0);n=s,a=0;do{a=a+1|0,n=0|i[n+8>>2]}while(0!=(0|n));if(a>>>0<2)return 0|(D=0);(r=0|he(a<<2))||w(22446,22285,312,22465),(e=0|he(a<<5))||w(22487,22285,316,22465),i[t>>2]=0,i[(P=t+4|0)>>2]=0,i[c>>2]=0,a=0,L=0,T=0,g=0;t:for(;;){if(A=0|i[s>>2]){l=0,h=A;do{if(p=+o[h+8>>3],n=h,h=0|i[h+16>>2],f=+o[(c=(d=0==(0|h))?A:h)+8>>3],+u(+(p-f))>3.141592653589793){D=14;break}l+=(f-p)*(+o[n>>3]+ +o[c>>3])}while(!d);if(14==(0|D)){D=0,l=0,n=A;do{O=+o[n+8>>3],k=0|i[(R=n+16|0)>>2],S=+o[(k=0==(0|k)?A:k)+8>>3],l+=(+o[n>>3]+ +o[k>>3])*((S<0?S+6.283185307179586:S)-(O<0?O+6.283185307179586:O)),n=0|i[(0==(0|n)?s:R)>>2]}while(0!=(0|n))}l>0?(i[r+(L<<2)>>2]=s,L=L+1|0,c=T,n=g):D=19}else D=19;if(19==(0|D)){D=0;do{if(!a){if(g){c=P,h=g+8|0,n=s,a=t;break}if(0|i[t>>2]){D=27;break t}c=P,h=t,n=s,a=t;break}if(0|i[(n=a+8|0)>>2]){D=21;break t}if(!(a=0|pe(1,12))){D=23;break t}i[n>>2]=a,c=a+4|0,h=a,n=g}while(0);if(i[h>>2]=s,i[c>>2]=s,h=e+(T<<5)|0,d=0|i[s>>2]){for(o[(A=e+(T<<5)+8|0)>>3]=17976931348623157e292,o[(g=e+(T<<5)+24|0)>>3]=17976931348623157e292,o[h>>3]=-17976931348623157e292,o[(m=e+(T<<5)+16|0)>>3]=-17976931348623157e292,x=17976931348623157e292,E=-17976931348623157e292,c=0,y=d,p=17976931348623157e292,_=17976931348623157e292,b=-17976931348623157e292,f=-17976931348623157e292;l=+o[y>>3],O=+o[y+8>>3],y=0|i[y+16>>2],S=+o[((v=0==(0|y))?d:y)+8>>3],l<p&&(o[A>>3]=l,p=l),O<_&&(o[g>>3]=O,_=O),l>b?o[h>>3]=l:l=b,O>f&&(o[m>>3]=O,f=O),x=O>0&O<x?O:x,E=O<0&O>E?O:E,c|=+u(+(O-S))>3.141592653589793,!v;)b=l;c&&(o[m>>3]=E,o[g>>3]=x)}else i[h>>2]=0,i[h+4>>2]=0,i[h+8>>2]=0,i[h+12>>2]=0,i[h+16>>2]=0,i[h+20>>2]=0,i[h+24>>2]=0,i[h+28>>2]=0;c=T+1|0}if(s=0|i[(R=s+8|0)>>2],i[R>>2]=0,!s){D=45;break}T=c,g=n}if(21==(0|D))w(22263,22285,32,22297);else if(23==(0|D))w(22317,22285,34,22297);else if(27==(0|D))w(22360,22285,58,22383);else if(45==(0|D)){t:do{if((0|L)>0){for(R=0==(0|c),I=c<<2,k=0==(0|t),C=0,n=0;;){if(M=0|i[r+(C<<2)>>2],R)D=73;else{if(!(T=0|he(I))){D=50;break}if(!(P=0|he(I))){D=52;break}e:do{if(k)a=0;else{for(c=0,a=0,h=t;s=e+(c<<5)|0,0|Zt(0|i[h>>2],s,0|i[M>>2])?(i[T+(a<<2)>>2]=h,i[P+(a<<2)>>2]=s,v=a+1|0):v=a,h=0|i[h+8>>2];)c=c+1|0,a=v;if((0|v)>0)if(s=0|i[T>>2],1==(0|v))a=s;else for(m=0,y=-1,a=s,g=s;;){for(d=0|i[g>>2],s=0,h=0;A=(0|(c=0|i[i[T+(h<<2)>>2]>>2]))==(0|d)?s:s+(1&(0|Zt(c,0|i[P+(h<<2)>>2],0|i[d>>2])))|0,(0|(h=h+1|0))!=(0|v);)s=A;if(a=(c=(0|A)>(0|y))?g:a,(0|(s=m+1|0))==(0|v))break e;m=s,y=c?A:y,g=0|i[T+(s<<2)>>2]}else a=0}}while(0);if(fe(T),fe(P),a){if(s=0|i[(c=a+4|0)>>2])a=s+8|0;else if(0|i[a>>2]){D=70;break}i[a>>2]=M,i[c>>2]=M}else D=73}if(73==(0|D)){if(D=0,0|(n=0|i[M>>2]))do{P=n,n=0|i[n+16>>2],fe(P)}while(0!=(0|n));fe(M),n=2}if((0|(C=C+1|0))>=(0|L)){j=n;break t}}50==(0|D)?w(22502,22285,246,22521):52==(0|D)?w(22540,22285,248,22521):70==(0|D)&&w(22360,22285,58,22383)}else j=0}while(0);return fe(r),fe(e),0|(D=j)}return 0}function Zt(t,e,r){t|=0;var n,a=0,s=0,u=0,c=0,l=0,h=0,f=0;if(!(0|V(e|=0,r|=0)))return 0|(t=0);if(e=0|U(e),n=+o[r>>3],a=e&(a=+o[r+8>>3])<0?a+6.283185307179586:a,!(t=0|i[t>>2]))return 0|(t=0);if(e){e=0,r=t;t:for(;;){for(;c=+o[r>>3],h=+o[r+8>>3],f=0|i[(r=r+16|0)>>2],u=+o[(f=0==(0|f)?t:f)>>3],s=+o[f+8>>3],c>u?(l=c,c=h):(l=u,u=c,c=s,s=h),n<u|n>l;)if(!(r=0|i[r>>2])){r=22;break t}if(a=(c=c<0?c+6.283185307179586:c)==a|(h=s<0?s+6.283185307179586:s)==a?a+-2220446049250313e-31:a,((h+=(n-u)/(l-u)*(c-h))<0?h+6.283185307179586:h)>a&&(e^=1),!(r=0|i[r>>2])){r=22;break}}if(22==(0|r))return 0|e}else{e=0,r=t;t:for(;;){for(;c=+o[r>>3],h=+o[r+8>>3],f=0|i[(r=r+16|0)>>2],u=+o[(f=0==(0|f)?t:f)>>3],s=+o[f+8>>3],c>u?(l=c,c=h):(l=u,u=c,c=s,s=h),n<u|n>l;)if(!(r=0|i[r>>2])){r=22;break t}if(s+(n-u)/(l-u)*(c-s)>(a=c==a|s==a?a+-2220446049250313e-31:a)&&(e^=1),!(r=0|i[r>>2])){r=22;break}}if(22==(0|r))return 0|e}return 0}function Xt(t,e,r,o,a){r|=0,o|=0,a|=0;var s,u,c,l,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0;if(l=M,M=M+32|0,_=l+16|0,c=l,h=0|ye(0|(t|=0),0|(e|=0),52),x(),h&=15,m=0|ye(0|r,0|o,52),x(),(0|h)!=(15&m|0))return M=l,0|(_=1);if(A=0|ye(0|t,0|e,45),x(),A&=127,g=0|ye(0|r,0|o,45),x(),m=(0|A)!=(0|(g&=127))){if(7==(0|(p=0|N(A,g))))return M=l,0|(_=2);7==(0|(d=0|N(g,A)))?w(22564,22588,151,22598):(y=p,f=d)}else y=0,f=0;s=0|L(A),u=0|L(g),i[_>>2]=0,i[_+4>>2]=0,i[_+8>>2]=0,i[_+12>>2]=0;do{if(y){if(p=(0|(g=0|i[4304+(28*A|0)+(y<<2)>>2]))>0,u)if(p){A=0,d=r,p=o;do{d=0|jt(d,p),p=0|x(),1==(0|(f=0|at(f)))&&(f=0|at(1)),A=A+1|0}while((0|A)!=(0|g));g=f,A=d,d=p}else g=f,A=r,d=o;else if(p){A=0,d=r,p=o;do{d=0|Dt(d,p),p=0|x(),f=0|at(f),A=A+1|0}while((0|A)!=(0|g));g=f,A=d,d=p}else g=f,A=r,d=o;if(zt(A,d,_),m||w(22611,22588,181,22598),(p=0!=(0|s))&(f=0!=(0|u))&&w(22638,22588,182,22598),p){if(f=0|kt(t,e),0|n[22032+(7*f|0)+y>>0]){h=3;break}A=d=0|i[21200+(28*f|0)+(y<<2)>>2],v=26}else if(f){if(f=0|kt(A,d),0|n[22032+(7*f|0)+g>>0]){h=4;break}A=0,d=0|i[21200+(28*g|0)+(f<<2)>>2],v=26}else f=0;if(26==(0|v))if((0|d)<=-1&&w(22669,22588,212,22598),(0|A)<=-1&&w(22692,22588,213,22598),(0|d)>0){p=_+4|0,f=0;do{it(p),f=f+1|0}while((0|f)!=(0|d));f=A}else f=A;if(i[c>>2]=0,i[c+4>>2]=0,i[c+8>>2]=0,rt(c,y),0|h)for(;0|Bt(h)?tt(c):et(c),(0|h)>1;)h=h+-1|0;if((0|f)>0){h=0;do{it(c),h=h+1|0}while((0|h)!=(0|f))}X(v=_+4|0,c,v),q(v),v=50}else if(zt(r,o,_),0!=(0|s)&0!=(0|u))if((0|g)!=(0|A)&&w(22716,22588,243,22598),f=0|kt(t,e),h=0|kt(r,o),0|n[22032+(7*f|0)+h>>0])h=5;else if((0|(f=0|i[21200+(28*f|0)+(h<<2)>>2]))>0){p=_+4|0,h=0;do{it(p),h=h+1|0}while((0|h)!=(0|f));v=50}else v=50;else v=50}while(0);return 50==(0|v)&&(h=_+4|0,i[a>>2]=i[h>>2],i[a+4>>2]=i[h+4>>2],i[a+8>>2]=i[h+8>>2],h=0),M=l,0|(_=h)}function Qt(t,e,r,n){r|=0,n|=0;var o,a,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0;if(a=M,M=M+48|0,c=a+36|0,l=a+24|0,h=a+12|0,f=a,u=0|ye(0|(t|=0),0|(e|=0),52),x(),u&=15,d=0|ye(0|t,0|e,45),x(),o=0|L(d&=127),ve(0|u,0,52),m=134225919|x(),i[(g=n)>>2]=-1,i[g+4>>2]=m,!u)return(0|i[r>>2])>1?(M=a,0|(m=1)):(0|i[r+4>>2])>1?(M=a,0|(m=1)):(0|i[r+8>>2])>1?(M=a,0|(m=1)):127==(0|(s=0|z(d,0|K(r))))?(M=a,0|(m=1)):(A=0|ve(0|s,0,45),g=0|x(),g=-1040385&i[(d=n)+4>>2]|g,i[(m=n)>>2]=i[d>>2]|A,i[m+4>>2]=g,M=a,0|(m=0));for(i[c>>2]=i[r>>2],i[c+4>>2]=i[r+4>>2],i[c+8>>2]=i[r+8>>2];i[l>>2]=i[c>>2],i[l+4>>2]=i[c+4>>2],i[l+8>>2]=i[c+8>>2],0|Bt(u)?($(c),i[h>>2]=i[c>>2],i[h+4>>2]=i[c+4>>2],i[h+8>>2]=i[c+8>>2],tt(h)):(J(c),i[h>>2]=i[c>>2],i[h+4>>2]=i[c+4>>2],i[h+8>>2]=i[c+8>>2],et(h)),Q(l,h,f),q(f),y=0|i[(g=n)>>2],g=0|i[g+4>>2],r=0|ve(7,0,0|(v=3*(15-u|0)|0)),g&=~(0|x()),v=0|ve(0|K(f),0,0|v),g=0|x()|g,i[(m=n)>>2]=v|y&~r,i[m+4>>2]=g,(0|u)>1;)u=u+-1|0;t:do{if((0|i[c>>2])<=1&&(0|i[c+4>>2])<=1&&(0|i[c+8>>2])<=1){f=127==(0|(l=0|z(d,u=0|K(c))))?0:0|L(l);e:do{if(u){if(o){if(c=21408+(28*(0|kt(t,e))|0)+(u<<2)|0,(0|(c=0|i[c>>2]))>0){r=0;do{u=0|ot(u),r=r+1|0}while((0|r)!=(0|c))}if(1==(0|u)){s=3;break t}127==(0|(r=0|z(d,u)))&&w(22743,22588,376,22773),0|L(r)?w(22786,22588,377,22773):(A=c,p=u,s=r)}else A=0,p=u,s=l;if((0|(h=0|i[4304+(28*d|0)+(p<<2)>>2]))<=-1&&w(22817,22588,384,22773),!f){if((0|A)<=-1&&w(22669,22588,417,22773),0|A){u=0,r=0|i[(c=n)>>2],c=0|i[c+4>>2];do{r=0|Lt(r,c),c=0|x(),i[(v=n)>>2]=r,i[v+4>>2]=c,u=u+1|0}while((0|u)<(0|A))}if((0|h)<=0){u=54;break}for(u=0,r=0|i[(c=n)>>2],c=0|i[c+4>>2];;)if(r=0|Lt(r,c),c=0|x(),i[(v=n)>>2]=r,i[v+4>>2]=c,(0|(u=u+1|0))==(0|h)){u=54;break e}}if(7==(0|(l=0|N(s,d)))&&w(22564,22588,393,22773),r=0|i[(u=n)>>2],u=0|i[u+4>>2],(0|h)>0){c=0;do{r=0|Lt(r,u),u=0|x(),i[(v=n)>>2]=r,i[v+4>>2]=u,c=c+1|0}while((0|c)!=(0|h))}if(r=0|kt(r,u),v=0|j(s),(0|(r=0|i[(v?21824:21616)+(28*l|0)+(r<<2)>>2]))<=-1&&w(22669,22588,412,22773),r){u=0,c=0|i[(l=n)>>2],l=0|i[l+4>>2];do{c=0|Rt(c,l),l=0|x(),i[(v=n)>>2]=c,i[v+4>>2]=l,u=u+1|0}while((0|u)<(0|r));u=54}else u=54}else if(0!=(0|o)&0!=(0|f))if(u=21408+(28*(v=0|kt(t,e))|0)+((0|kt(0|i[(u=n)>>2],0|i[u+4>>2]))<<2)|0,(0|(u=0|i[u>>2]))<=-1&&w(22840,22588,433,22773),u){s=0,r=0|i[(c=n)>>2],c=0|i[c+4>>2];do{r=0|Lt(r,c),c=0|x(),i[(v=n)>>2]=r,i[v+4>>2]=c,s=s+1|0}while((0|s)<(0|u));s=l,u=54}else s=l,u=55;else s=l,u=54}while(0);if(54==(0|u)&&f&&(u=55),55==(0|u)&&1==(0|kt(0|i[(v=n)>>2],0|i[v+4>>2]))){s=4;break}m=0|i[(v=n)>>2],v=-1040385&i[v+4>>2],y=0|ve(0|s,0,45),v=0|v|x(),i[(s=n)>>2]=m|y,i[s+4>>2]=v,s=0}else s=2}while(0);return M=a,0|(v=s)}function Yt(t,e){var r=0;if(!(e|=0))return 0|(r=1);r=t|=0,t=1;do{t=0|v(0==(1&e|0)?1:r,t),e>>=1,r=0|v(r,r)}while(0!=(0|e));return 0|t}function Kt(t,e,r){t|=0;var n,a,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0;if(!(0|V(e|=0,r|=0)))return 0|(d=0);if(e=0|U(e),a=+o[r>>3],s=e&(s=+o[r+8>>3])<0?s+6.283185307179586:s,(0|(d=0|i[t>>2]))<=0)return 0|(d=0);if(n=0|i[t+4>>2],e){e=0,r=-1,t=0;t:for(;;){for(p=t;l=+o[n+(p<<4)>>3],f=+o[n+(p<<4)+8>>3],c=+o[n+((t=(r+2|0)%(0|d)|0)<<4)>>3],u=+o[n+(t<<4)+8>>3],l>c?(h=l,l=f):(h=c,c=l,l=u,u=f),a<c|a>h;){if(!((0|(r=p+1|0))<(0|d))){r=22;break t}t=p,p=r,r=t}if(s=(l=l<0?l+6.283185307179586:l)==s|(f=u<0?u+6.283185307179586:u)==s?s+-2220446049250313e-31:s,((f+=(a-c)/(h-c)*(l-f))<0?f+6.283185307179586:f)>s&&(e^=1),(0|(t=p+1|0))>=(0|d)){r=22;break}r=p}if(22==(0|r))return 0|e}else{e=0,r=-1,t=0;t:for(;;){for(p=t;l=+o[n+(p<<4)>>3],f=+o[n+(p<<4)+8>>3],c=+o[n+((t=(r+2|0)%(0|d)|0)<<4)>>3],u=+o[n+(t<<4)+8>>3],l>c?(h=l,l=f):(h=c,c=l,l=u,u=f),a<c|a>h;){if(!((0|(r=p+1|0))<(0|d))){r=22;break t}t=p,p=r,r=t}if(u+(a-c)/(h-c)*(l-u)>(s=l==s|u==s?s+-2220446049250313e-31:s)&&(e^=1),(0|(t=p+1|0))>=(0|d)){r=22;break}r=p}if(22==(0|r))return 0|e}return 0}function $t(t,e){e|=0;var r,n,a,s,c,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0;if(!(n=0|i[(t|=0)>>2]))return i[e>>2]=0,i[e+4>>2]=0,i[e+8>>2]=0,i[e+12>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,i[e+24>>2]=0,void(i[e+28>>2]=0);if(o[(a=e+8|0)>>3]=17976931348623157e292,o[(s=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(c=e+16|0)>>3]=-17976931348623157e292,!((0|n)<=0)){for(r=0|i[t+4>>2],m=17976931348623157e292,y=-17976931348623157e292,v=0,t=-1,p=17976931348623157e292,d=17976931348623157e292,g=-17976931348623157e292,h=-17976931348623157e292,_=0;l=+o[r+(_<<4)>>3],A=+o[r+(_<<4)+8>>3],f=+o[r+(((0|(t=t+2|0))==(0|n)?0:t)<<4)+8>>3],l<p&&(o[a>>3]=l,p=l),A<d&&(o[s>>3]=A,d=A),l>g?o[e>>3]=l:l=g,A>h&&(o[c>>3]=A,h=A),m=A>0&A<m?A:m,y=A<0&A>y?A:y,v|=+u(+(A-f))>3.141592653589793,(0|(t=_+1|0))!=(0|n);)b=_,g=l,_=t,t=b;v&&(o[c>>3]=y,o[s>>3]=m)}}function Jt(t,e,r){var n=0,o=0,a=0;if(!(0|Kt(t|=0,e|=0,r|=0)))return 0|(o=0);if((0|i[(o=t+8|0)>>2])<=0)return 0|(o=1);for(n=t+12|0,t=0;;){if(a=t,t=t+1|0,0|Kt((0|i[n>>2])+(a<<3)|0,e+(t<<5)|0,r)){t=0,n=6;break}if((0|t)>=(0|i[o>>2])){t=1,n=6;break}}return 6==(0|n)?0|t:0}function te(t,e,r,n,i){e|=0,r|=0,n|=0,i|=0;var a,s,u,c,l,h,f,p=0;c=+o[(t|=0)>>3],u=+o[e>>3]-c,s=+o[t+8>>3],a=+o[e+8>>3]-s,h=+o[r>>3],p=((p=+o[n>>3]-h)*(s-(f=+o[r+8>>3]))-(c-h)*(l=+o[n+8>>3]-f))/(u*l-a*p),o[i>>3]=c+u*p,o[i+8>>3]=s+a*p}function ee(t,e){return e|=0,+o[(t|=0)>>3]!=+o[e>>3]?0|(e=0):0|(e=+o[t+8>>3]==+o[e+8>>3])}function re(t,e){e|=0;var r,n,i;return+((i=+o[(t|=0)>>3]-+o[e>>3])*i+(n=+o[t+8>>3]-+o[e+8>>3])*n+(r=+o[t+16>>3]-+o[e+16>>3])*r)}function ne(t,e,r){t|=0,r|=0;var n=0;(0|(e|=0))>0?(n=0|pe(e,4),i[t>>2]=n,n||w(22869,22892,37,22906)):i[t>>2]=0,i[t+4>>2]=e,i[t+8>>2]=0,i[t+12>>2]=r}function ie(t){var e,r,n,a=0,s=0,c=0,h=0;e=(t|=0)+4|0,r=t+12|0,n=t+8|0;t:for(;;){for(s=0|i[e>>2],a=0;;){if((0|a)>=(0|s))break t;if(c=0|i[t>>2],h=0|i[c+(a<<2)>>2])break;a=a+1|0}a=c+(~~(+u(+ +l(10,+ +(15-(0|i[r>>2])|0))*(+o[h>>3]+ +o[h+8>>3]))%+(0|s))>>>0<<2)|0,s=0|i[a>>2];e:do{if(0|s){if(c=h+32|0,(0|s)==(0|h))i[a>>2]=i[c>>2];else{if(!(a=0|i[(s=s+32|0)>>2]))break;for(;(0|a)!=(0|h);)if(!(a=0|i[(s=a+32|0)>>2]))break e;i[s>>2]=i[c>>2]}fe(h),i[n>>2]=(0|i[n>>2])-1}}while(0)}fe(0|i[t>>2])}function oe(t){var e,r=0,n=0;for(e=0|i[(t|=0)+4>>2],n=0;;){if((0|n)>=(0|e)){r=0,n=4;break}if(r=0|i[(0|i[t>>2])+(n<<2)>>2]){n=4;break}n=n+1|0}return 4==(0|n)?0|r:0}function ae(t,e){e|=0;var r=0,n=0,a=0,s=0;if(r=~~(+u(+ +l(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|i[t+4>>2]))>>>0,r=(0|i[t>>2])+(r<<2)|0,!(n=0|i[r>>2]))return 0|(s=1);s=e+32|0;do{if((0|n)!=(0|e)){if(!(r=0|i[n+32>>2]))return 0|(s=1);for(a=r;;){if((0|a)==(0|e)){a=8;break}if(!(r=0|i[a+32>>2])){r=1,a=10;break}n=a,a=r}if(8==(0|a)){i[n+32>>2]=i[s>>2];break}if(10==(0|a))return 0|r}else i[r>>2]=i[s>>2]}while(0);return fe(e),i[(s=t+8|0)>>2]=(0|i[s>>2])-1,0|(s=0)}function se(t,e,r){t|=0,e|=0,r|=0;var n,a=0,s=0,c=0;(n=0|he(40))||w(22922,22892,95,22935),i[n>>2]=i[e>>2],i[n+4>>2]=i[e+4>>2],i[n+8>>2]=i[e+8>>2],i[n+12>>2]=i[e+12>>2],i[(s=n+16|0)>>2]=i[r>>2],i[s+4>>2]=i[r+4>>2],i[s+8>>2]=i[r+8>>2],i[s+12>>2]=i[r+12>>2],i[n+32>>2]=0,s=~~(+u(+ +l(10,+ +(15-(0|i[t+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|i[t+4>>2]))>>>0,s=(0|i[t>>2])+(s<<2)|0,a=0|i[s>>2];do{if(a){for(;!(0|Et(a,e)&&0|Et(a+16|0,r));)if(s=0|i[a+32>>2],!(0|i[(a=0==(0|s)?a:s)+32>>2])){c=10;break}if(10==(0|c)){i[a+32>>2]=n;break}return fe(n),0|(c=a)}i[s>>2]=n}while(0);return i[(c=t+8|0)>>2]=1+(0|i[c>>2]),0|(c=n)}function ue(t,e,r){e|=0,r|=0;var n=0,a=0;if(a=~~(+u(+ +l(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|i[t+4>>2]))>>>0,!(a=0|i[(0|i[t>>2])+(a<<2)>>2]))return 0|(r=0);if(!r){for(t=a;;){if(0|Et(t,e)){n=10;break}if(!(t=0|i[t+32>>2])){t=0,n=10;break}}if(10==(0|n))return 0|t}for(t=a;;){if(0|Et(t,e)&&0|Et(t+16|0,r)){n=10;break}if(!(t=0|i[t+32>>2])){t=0,n=10;break}}return 10==(0|n)?0|t:0}function ce(t,e){e|=0;var r=0;if(r=~~(+u(+ +l(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|i[t+4>>2]))>>>0,!(t=0|i[(0|i[t>>2])+(r<<2)>>2]))return 0|(r=0);for(;;){if(0|Et(t,e)){e=5;break}if(!(t=0|i[t+32>>2])){t=0,e=5;break}}return 5==(0|e)?0|t:0}function le(t){return 0|~~+function(t){return+ +we(+(t=+t))}(t=+t)}function he(t){t|=0;var e,r=0,n=0,o=0,a=0,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0,x=0;e=M,M=M+16|0,d=e;do{if(t>>>0<245){if(t=(h=t>>>0<11?16:t+11&-8)>>>3,3&(n=(p=0|i[5741])>>>t)|0)return o=0|i[(n=(t=23004+((r=(1&n^1)+t|0)<<1<<2)|0)+8|0)>>2],(0|(s=0|i[(a=o+8|0)>>2]))==(0|t)?i[5741]=p&~(1<<r):(i[s+12>>2]=t,i[n>>2]=s),x=r<<3,i[o+4>>2]=3|x,i[(x=o+x+4|0)>>2]=1|i[x>>2],M=e,0|(x=a);if(h>>>0>(f=0|i[5743])>>>0){if(0|n)return r=((r=n<<t&((r=2<<t)|0-r))&0-r)-1|0,s=0|i[(t=(r=23004+((o=((n=(r>>>=c=r>>>12&16)>>>5&8)|c|(s=(r>>>=n)>>>2&4)|(t=(r>>>=s)>>>1&2)|(o=(r>>>=t)>>>1&1))+(r>>>o)|0)<<1<<2)|0)+8|0)>>2],(0|(n=0|i[(c=s+8|0)>>2]))==(0|r)?(t=p&~(1<<o),i[5741]=t):(i[n+12>>2]=r,i[t>>2]=n,t=p),u=(x=o<<3)-h|0,i[s+4>>2]=3|h,i[(a=s+h|0)+4>>2]=1|u,i[s+x>>2]=u,0|f&&(o=0|i[5746],n=23004+((r=f>>>3)<<1<<2)|0,t&(r=1<<r)?r=0|i[(t=n+8|0)>>2]:(i[5741]=t|r,r=n,t=n+8|0),i[t>>2]=o,i[r+12>>2]=o,i[o+8>>2]=r,i[o+12>>2]=n),i[5743]=u,i[5746]=a,M=e,0|(x=c);if(s=0|i[5742]){for(n=(s&0-s)-1|0,n=l=0|i[23268+(((o=(n>>>=a=n>>>12&16)>>>5&8)|a|(u=(n>>>=o)>>>2&4)|(c=(n>>>=u)>>>1&2)|(l=(n>>>=c)>>>1&1))+(n>>>l)<<2)>>2],c=l,l=(-8&i[l+4>>2])-h|0;(t=0|i[n+16>>2])||(t=0|i[n+20>>2]);)n=t,c=(a=(u=(-8&i[t+4>>2])-h|0)>>>0<l>>>0)?t:c,l=a?u:l;if((u=c+h|0)>>>0>c>>>0){a=0|i[c+24>>2],r=0|i[c+12>>2];do{if((0|r)==(0|c)){if(!(r=0|i[(t=c+20|0)>>2])&&!(r=0|i[(t=c+16|0)>>2])){n=0;break}for(;;)if(n=0|i[(o=r+20|0)>>2])r=n,t=o;else{if(!(n=0|i[(o=r+16|0)>>2]))break;r=n,t=o}i[t>>2]=0,n=r}else n=0|i[c+8>>2],i[n+12>>2]=r,i[r+8>>2]=n,n=r}while(0);do{if(0|a){if(r=0|i[c+28>>2],(0|c)==(0|i[(t=23268+(r<<2)|0)>>2])){if(i[t>>2]=n,!n){i[5742]=s&~(1<<r);break}}else if(i[((0|i[(x=a+16|0)>>2])==(0|c)?x:a+20|0)>>2]=n,!n)break;i[n+24>>2]=a,0|(r=0|i[c+16>>2])&&(i[n+16>>2]=r,i[r+24>>2]=n),0|(r=0|i[c+20>>2])&&(i[n+20>>2]=r,i[r+24>>2]=n)}}while(0);return l>>>0<16?(x=l+h|0,i[c+4>>2]=3|x,i[(x=c+x+4|0)>>2]=1|i[x>>2]):(i[c+4>>2]=3|h,i[u+4>>2]=1|l,i[u+l>>2]=l,0|f&&(o=0|i[5746],n=23004+((r=f>>>3)<<1<<2)|0,(r=1<<r)&p?r=0|i[(t=n+8|0)>>2]:(i[5741]=r|p,r=n,t=n+8|0),i[t>>2]=o,i[r+12>>2]=o,i[o+8>>2]=r,i[o+12>>2]=n),i[5743]=l,i[5746]=u),M=e,0|(x=c+8|0)}p=h}else p=h}else p=h}else if(t>>>0<=4294967231)if(h=-8&(t=t+11|0),o=0|i[5742]){a=0-h|0,l=(t>>>=8)?h>>>0>16777215?31:h>>>((l=14-((c=((m=t<<(p=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|p|(l=((m<<=c)+245760|0)>>>16&2))+(m<<l>>>15)|0)+7|0)&1|l<<1:0,n=0|i[23268+(l<<2)>>2];t:do{if(n)for(t=0,c=h<<(31==(0|l)?0:25-(l>>>1)|0),s=0;;){if((u=(-8&i[n+4>>2])-h|0)>>>0<a>>>0){if(!u){t=n,a=0,m=65;break t}t=n,a=u}if(s=0==(0|(m=0|i[n+20>>2]))|(0|m)==(0|(n=0|i[n+16+(c>>>31<<2)>>2]))?s:m,!n){n=s,m=61;break}c<<=1}else n=0,t=0,m=61}while(0);if(61==(0|m)){if(0==(0|n)&0==(0|t)){if(!(t=((t=2<<l)|0-t)&o)){p=h;break}p=(t&0-t)-1|0,t=0,n=0|i[23268+(((s=(p>>>=u=p>>>12&16)>>>5&8)|u|(c=(p>>>=s)>>>2&4)|(l=(p>>>=c)>>>1&2)|(n=(p>>>=l)>>>1&1))+(p>>>n)<<2)>>2]}n?m=65:(c=t,u=a)}if(65==(0|m))for(s=n;;){if(a=(n=(p=(-8&i[s+4>>2])-h|0)>>>0<a>>>0)?p:a,t=n?s:t,(n=0|i[s+16>>2])||(n=0|i[s+20>>2]),!n){c=t,u=a;break}s=n}if(0!=(0|c)&&u>>>0<((0|i[5743])-h|0)>>>0&&(f=c+h|0)>>>0>c>>>0){s=0|i[c+24>>2],r=0|i[c+12>>2];do{if((0|r)==(0|c)){if(!(r=0|i[(t=c+20|0)>>2])&&!(r=0|i[(t=c+16|0)>>2])){r=0;break}for(;;)if(n=0|i[(a=r+20|0)>>2])r=n,t=a;else{if(!(n=0|i[(a=r+16|0)>>2]))break;r=n,t=a}i[t>>2]=0}else x=0|i[c+8>>2],i[x+12>>2]=r,i[r+8>>2]=x}while(0);do{if(s){if(t=0|i[c+28>>2],(0|c)==(0|i[(n=23268+(t<<2)|0)>>2])){if(i[n>>2]=r,!r){o&=~(1<<t),i[5742]=o;break}}else if(i[((0|i[(x=s+16|0)>>2])==(0|c)?x:s+20|0)>>2]=r,!r)break;i[r+24>>2]=s,0|(t=0|i[c+16>>2])&&(i[r+16>>2]=t,i[t+24>>2]=r),(t=0|i[c+20>>2])&&(i[r+20>>2]=t,i[t+24>>2]=r)}}while(0);t:do{if(u>>>0<16)x=u+h|0,i[c+4>>2]=3|x,i[(x=c+x+4|0)>>2]=1|i[x>>2];else{if(i[c+4>>2]=3|h,i[f+4>>2]=1|u,i[f+u>>2]=u,r=u>>>3,u>>>0<256){n=23004+(r<<1<<2)|0,(t=0|i[5741])&(r=1<<r)?r=0|i[(t=n+8|0)>>2]:(i[5741]=t|r,r=n,t=n+8|0),i[t>>2]=f,i[r+12>>2]=f,i[f+8>>2]=r,i[f+12>>2]=n;break}if(r=23268+((n=(r=u>>>8)?u>>>0>16777215?31:u>>>((n=14-((_=((x=r<<(b=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(n=((x<<=_)+245760|0)>>>16&2))+(x<<n>>>15)|0)+7|0)&1|n<<1:0)<<2)|0,i[f+28>>2]=n,i[(t=f+16|0)+4>>2]=0,i[t>>2]=0,!(o&(t=1<<n))){i[5742]=o|t,i[r>>2]=f,i[f+24>>2]=r,i[f+12>>2]=f,i[f+8>>2]=f;break}r=0|i[r>>2];e:do{if((-8&i[r+4>>2]|0)!=(0|u)){for(o=u<<(31==(0|n)?0:25-(n>>>1)|0);t=0|i[(n=r+16+(o>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|u)){r=t;break e}o<<=1,r=t}i[n>>2]=f,i[f+24>>2]=r,i[f+12>>2]=f,i[f+8>>2]=f;break t}}while(0);x=0|i[(b=r+8|0)>>2],i[x+12>>2]=f,i[b>>2]=f,i[f+8>>2]=x,i[f+12>>2]=r,i[f+24>>2]=0}}while(0);return M=e,0|(x=c+8|0)}p=h}else p=h;else p=-1}while(0);if((n=0|i[5743])>>>0>=p>>>0)return r=n-p|0,t=0|i[5746],r>>>0>15?(x=t+p|0,i[5746]=x,i[5743]=r,i[x+4>>2]=1|r,i[t+n>>2]=r,i[t+4>>2]=3|p):(i[5743]=0,i[5746]=0,i[t+4>>2]=3|n,i[(x=t+n+4|0)>>2]=1|i[x>>2]),M=e,0|(x=t+8|0);if((u=0|i[5744])>>>0>p>>>0)return _=u-p|0,i[5744]=_,b=(x=0|i[5747])+p|0,i[5747]=b,i[b+4>>2]=1|_,i[x+4>>2]=3|p,M=e,0|(x=x+8|0);if(0|i[5859]?t=0|i[5861]:(i[5861]=4096,i[5860]=4096,i[5862]=-1,i[5863]=-1,i[5864]=0,i[5852]=0,i[5859]=-16&d^1431655768,t=4096),c=p+48|0,(h=(s=t+(l=p+47|0)|0)&(a=0-t|0))>>>0<=p>>>0)return M=e,0|(x=0);if(0|(t=0|i[5851])&&(d=(f=0|i[5849])+h|0)>>>0<=f>>>0|d>>>0>t>>>0)return M=e,0|(x=0);t:do{if(4&i[5852])r=0,m=143;else{n=0|i[5747];e:do{if(n){for(o=23412;!((d=0|i[o>>2])>>>0<=n>>>0&&(d+(0|i[o+4>>2])|0)>>>0>n>>>0);){if(!(t=0|i[o+8>>2])){m=128;break e}o=t}if((r=s-u&a)>>>0<2147483647)if((0|(t=0|Ee(0|r)))==((0|i[o>>2])+(0|i[o+4>>2])|0)){if(-1!=(0|t)){u=r,s=t,m=145;break t}}else o=t,m=136;else r=0}else m=128}while(0);do{if(128==(0|m))if(-1!=(0|(n=0|Ee(0)))&&(r=n,g=(r=(0==((g=(A=0|i[5860])+-1|0)&r|0)?0:(g+r&0-A)-r|0)+h|0)+(A=0|i[5849])|0,r>>>0>p>>>0&r>>>0<2147483647)){if(0|(d=0|i[5851])&&g>>>0<=A>>>0|g>>>0>d>>>0){r=0;break}if((0|(t=0|Ee(0|r)))==(0|n)){u=r,s=n,m=145;break t}o=t,m=136}else r=0}while(0);do{if(136==(0|m)){if(n=0-r|0,!(c>>>0>r>>>0&r>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){r=0;break}u=r,s=o,m=145;break t}if((t=l-r+(t=0|i[5861])&0-t)>>>0>=2147483647){u=r,s=o,m=145;break t}if(-1==(0|Ee(0|t))){Ee(0|n),r=0;break}u=t+r|0,s=o,m=145;break t}}while(0);i[5852]=4|i[5852],m=143}}while(0);if(143==(0|m)&&h>>>0<2147483647&&!(-1==(0|(_=0|Ee(0|h)))|1^(v=(y=(g=0|Ee(0))-_|0)>>>0>(p+40|0)>>>0)|_>>>0<g>>>0&-1!=(0|_)&-1!=(0|g)^1)&&(u=v?y:r,s=_,m=145),145==(0|m)){r=(0|i[5849])+u|0,i[5849]=r,r>>>0>(0|i[5850])>>>0&&(i[5850]=r),l=0|i[5747];t:do{if(l){for(r=23412;;){if((0|s)==((t=0|i[r>>2])+(n=0|i[r+4>>2])|0)){m=154;break}if(!(o=0|i[r+8>>2]))break;r=o}if(154==(0|m)&&(b=r+4|0,0==(8&i[r+12>>2]|0))&&s>>>0>l>>>0&t>>>0<=l>>>0){i[b>>2]=n+u,b=l+(_=0==(7&(_=l+8|0)|0)?0:0-_&7)|0,_=(x=(0|i[5744])+u|0)-_|0,i[5747]=b,i[5744]=_,i[b+4>>2]=1|_,i[l+x+4>>2]=40,i[5748]=i[5863];break}for(s>>>0<(0|i[5745])>>>0&&(i[5745]=s),n=s+u|0,r=23412;;){if((0|i[r>>2])==(0|n)){m=162;break}if(!(t=0|i[r+8>>2]))break;r=t}if(162==(0|m)&&0==(8&i[r+12>>2]|0)){i[r>>2]=s,i[(f=r+4|0)>>2]=(0|i[f>>2])+u,h=(f=s+(0==(7&(f=s+8|0)|0)?0:0-f&7)|0)+p|0,c=(r=n+(0==(7&(r=n+8|0)|0)?0:0-r&7)|0)-f-p|0,i[f+4>>2]=3|p;e:do{if((0|l)==(0|r))x=(0|i[5744])+c|0,i[5744]=x,i[5747]=h,i[h+4>>2]=1|x;else{if((0|i[5746])==(0|r)){x=(0|i[5743])+c|0,i[5743]=x,i[5746]=h,i[h+4>>2]=1|x,i[h+x>>2]=x;break}if(1==(3&(t=0|i[r+4>>2])|0)){u=-8&t,o=t>>>3;r:do{if(t>>>0<256){if(t=0|i[r+8>>2],(0|(n=0|i[r+12>>2]))==(0|t)){i[5741]=i[5741]&~(1<<o);break}i[t+12>>2]=n,i[n+8>>2]=t;break}s=0|i[r+24>>2],t=0|i[r+12>>2];do{if((0|t)==(0|r)){if(t=0|i[(o=(n=r+16|0)+4|0)>>2])n=o;else if(!(t=0|i[n>>2])){t=0;break}for(;;)if(o=0|i[(a=t+20|0)>>2])t=o,n=a;else{if(!(o=0|i[(a=t+16|0)>>2]))break;t=o,n=a}i[n>>2]=0}else x=0|i[r+8>>2],i[x+12>>2]=t,i[t+8>>2]=x}while(0);if(!s)break;o=23268+((n=0|i[r+28>>2])<<2)|0;do{if((0|i[o>>2])==(0|r)){if(i[o>>2]=t,0|t)break;i[5742]=i[5742]&~(1<<n);break r}if(i[((0|i[(x=s+16|0)>>2])==(0|r)?x:s+20|0)>>2]=t,!t)break r}while(0);if(i[t+24>>2]=s,0|(o=0|i[(n=r+16|0)>>2])&&(i[t+16>>2]=o,i[o+24>>2]=t),!(n=0|i[n+4>>2]))break;i[t+20>>2]=n,i[n+24>>2]=t}while(0);r=r+u|0,a=u+c|0}else a=c;if(i[(r=r+4|0)>>2]=-2&i[r>>2],i[h+4>>2]=1|a,i[h+a>>2]=a,r=a>>>3,a>>>0<256){n=23004+(r<<1<<2)|0,(t=0|i[5741])&(r=1<<r)?r=0|i[(t=n+8|0)>>2]:(i[5741]=t|r,r=n,t=n+8|0),i[t>>2]=h,i[r+12>>2]=h,i[h+8>>2]=r,i[h+12>>2]=n;break}r=a>>>8;do{if(r){if(a>>>0>16777215){o=31;break}o=a>>>((o=14-((_=((x=r<<(b=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(o=((x<<=_)+245760|0)>>>16&2))+(x<<o>>>15)|0)+7|0)&1|o<<1}else o=0}while(0);if(r=23268+(o<<2)|0,i[h+28>>2]=o,i[(t=h+16|0)+4>>2]=0,i[t>>2]=0,!((t=0|i[5742])&(n=1<<o))){i[5742]=t|n,i[r>>2]=h,i[h+24>>2]=r,i[h+12>>2]=h,i[h+8>>2]=h;break}r=0|i[r>>2];r:do{if((-8&i[r+4>>2]|0)!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);t=0|i[(n=r+16+(o>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|a)){r=t;break r}o<<=1,r=t}i[n>>2]=h,i[h+24>>2]=r,i[h+12>>2]=h,i[h+8>>2]=h;break e}}while(0);x=0|i[(b=r+8|0)>>2],i[x+12>>2]=h,i[b>>2]=h,i[h+8>>2]=x,i[h+12>>2]=r,i[h+24>>2]=0}}while(0);return M=e,0|(x=f+8|0)}for(r=23412;!((t=0|i[r>>2])>>>0<=l>>>0&&(x=t+(0|i[r+4>>2])|0)>>>0>l>>>0);)r=0|i[r+8>>2];r=(t=(t=(a=x+-47|0)+(0==(7&(t=a+8|0)|0)?0:0-t&7)|0)>>>0<(a=l+16|0)>>>0?l:t)+8|0,b=s+(_=0==(7&(_=s+8|0)|0)?0:0-_&7)|0,_=(n=u+-40|0)-_|0,i[5747]=b,i[5744]=_,i[b+4>>2]=1|_,i[s+n+4>>2]=40,i[5748]=i[5863],i[(n=t+4|0)>>2]=27,i[r>>2]=i[5853],i[r+4>>2]=i[5854],i[r+8>>2]=i[5855],i[r+12>>2]=i[5856],i[5853]=s,i[5854]=u,i[5856]=0,i[5855]=r,r=t+24|0;do{b=r,i[(r=r+4|0)>>2]=7}while((b+8|0)>>>0<x>>>0);if((0|t)!=(0|l)){if(s=t-l|0,i[n>>2]=-2&i[n>>2],i[l+4>>2]=1|s,i[t>>2]=s,r=s>>>3,s>>>0<256){n=23004+(r<<1<<2)|0,(t=0|i[5741])&(r=1<<r)?r=0|i[(t=n+8|0)>>2]:(i[5741]=t|r,r=n,t=n+8|0),i[t>>2]=l,i[r+12>>2]=l,i[l+8>>2]=r,i[l+12>>2]=n;break}if(n=23268+((o=(r=s>>>8)?s>>>0>16777215?31:s>>>((o=14-((_=((x=r<<(b=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(o=((x<<=_)+245760|0)>>>16&2))+(x<<o>>>15)|0)+7|0)&1|o<<1:0)<<2)|0,i[l+28>>2]=o,i[l+20>>2]=0,i[a>>2]=0,!((r=0|i[5742])&(t=1<<o))){i[5742]=r|t,i[n>>2]=l,i[l+24>>2]=n,i[l+12>>2]=l,i[l+8>>2]=l;break}r=0|i[n>>2];e:do{if((-8&i[r+4>>2]|0)!=(0|s)){for(o=s<<(31==(0|o)?0:25-(o>>>1)|0);t=0|i[(n=r+16+(o>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|s)){r=t;break e}o<<=1,r=t}i[n>>2]=l,i[l+24>>2]=r,i[l+12>>2]=l,i[l+8>>2]=l;break t}}while(0);x=0|i[(b=r+8|0)>>2],i[x+12>>2]=l,i[b>>2]=l,i[l+8>>2]=x,i[l+12>>2]=r,i[l+24>>2]=0}}else 0==(0|(x=0|i[5745]))|s>>>0<x>>>0&&(i[5745]=s),i[5853]=s,i[5854]=u,i[5856]=0,i[5750]=i[5859],i[5749]=-1,i[5754]=23004,i[5753]=23004,i[5756]=23012,i[5755]=23012,i[5758]=23020,i[5757]=23020,i[5760]=23028,i[5759]=23028,i[5762]=23036,i[5761]=23036,i[5764]=23044,i[5763]=23044,i[5766]=23052,i[5765]=23052,i[5768]=23060,i[5767]=23060,i[5770]=23068,i[5769]=23068,i[5772]=23076,i[5771]=23076,i[5774]=23084,i[5773]=23084,i[5776]=23092,i[5775]=23092,i[5778]=23100,i[5777]=23100,i[5780]=23108,i[5779]=23108,i[5782]=23116,i[5781]=23116,i[5784]=23124,i[5783]=23124,i[5786]=23132,i[5785]=23132,i[5788]=23140,i[5787]=23140,i[5790]=23148,i[5789]=23148,i[5792]=23156,i[5791]=23156,i[5794]=23164,i[5793]=23164,i[5796]=23172,i[5795]=23172,i[5798]=23180,i[5797]=23180,i[5800]=23188,i[5799]=23188,i[5802]=23196,i[5801]=23196,i[5804]=23204,i[5803]=23204,i[5806]=23212,i[5805]=23212,i[5808]=23220,i[5807]=23220,i[5810]=23228,i[5809]=23228,i[5812]=23236,i[5811]=23236,i[5814]=23244,i[5813]=23244,i[5816]=23252,i[5815]=23252,b=s+(_=0==(7&(_=s+8|0)|0)?0:0-_&7)|0,_=(x=u+-40|0)-_|0,i[5747]=b,i[5744]=_,i[b+4>>2]=1|_,i[s+x+4>>2]=40,i[5748]=i[5863]}while(0);if((r=0|i[5744])>>>0>p>>>0)return _=r-p|0,i[5744]=_,b=(x=0|i[5747])+p|0,i[5747]=b,i[b+4>>2]=1|_,i[x+4>>2]=3|p,M=e,0|(x=x+8|0)}return i[(x=22960)>>2]=12,M=e,0|(x=0)}function fe(t){var e=0,r=0,n=0,o=0,a=0,s=0,u=0,c=0;if(t|=0){r=t+-8|0,o=0|i[5745],c=r+(e=-8&(t=0|i[t+-4>>2]))|0;do{if(1&t)u=r,s=r;else{if(n=0|i[r>>2],!(3&t))return;if(a=n+e|0,(s=r+(0-n)|0)>>>0<o>>>0)return;if((0|i[5746])==(0|s)){if(3!=(3&(e=0|i[(t=c+4|0)>>2])|0)){u=s,e=a;break}return i[5743]=a,i[t>>2]=-2&e,i[s+4>>2]=1|a,void(i[s+a>>2]=a)}if(r=n>>>3,n>>>0<256){if(t=0|i[s+8>>2],(0|(e=0|i[s+12>>2]))==(0|t)){i[5741]=i[5741]&~(1<<r),u=s,e=a;break}i[t+12>>2]=e,i[e+8>>2]=t,u=s,e=a;break}o=0|i[s+24>>2],t=0|i[s+12>>2];do{if((0|t)==(0|s)){if(t=0|i[(r=(e=s+16|0)+4|0)>>2])e=r;else if(!(t=0|i[e>>2])){t=0;break}for(;;)if(r=0|i[(n=t+20|0)>>2])t=r,e=n;else{if(!(r=0|i[(n=t+16|0)>>2]))break;t=r,e=n}i[e>>2]=0}else u=0|i[s+8>>2],i[u+12>>2]=t,i[t+8>>2]=u}while(0);if(o){if(e=0|i[s+28>>2],(0|i[(r=23268+(e<<2)|0)>>2])==(0|s)){if(i[r>>2]=t,!t){i[5742]=i[5742]&~(1<<e),u=s,e=a;break}}else if(i[((0|i[(u=o+16|0)>>2])==(0|s)?u:o+20|0)>>2]=t,!t){u=s,e=a;break}i[t+24>>2]=o,0|(r=0|i[(e=s+16|0)>>2])&&(i[t+16>>2]=r,i[r+24>>2]=t),(e=0|i[e+4>>2])?(i[t+20>>2]=e,i[e+24>>2]=t,u=s,e=a):(u=s,e=a)}else u=s,e=a}}while(0);if(!(s>>>0>=c>>>0)&&1&(n=0|i[(t=c+4|0)>>2])){if(2&n)i[t>>2]=-2&n,i[u+4>>2]=1|e,i[s+e>>2]=e,o=e;else{if((0|i[5747])==(0|c)){if(c=(0|i[5744])+e|0,i[5744]=c,i[5747]=u,i[u+4>>2]=1|c,(0|u)!=(0|i[5746]))return;return i[5746]=0,void(i[5743]=0)}if((0|i[5746])==(0|c))return c=(0|i[5743])+e|0,i[5743]=c,i[5746]=s,i[u+4>>2]=1|c,void(i[s+c>>2]=c);o=(-8&n)+e|0,r=n>>>3;do{if(n>>>0<256){if(e=0|i[c+8>>2],(0|(t=0|i[c+12>>2]))==(0|e)){i[5741]=i[5741]&~(1<<r);break}i[e+12>>2]=t,i[t+8>>2]=e;break}a=0|i[c+24>>2],t=0|i[c+12>>2];do{if((0|t)==(0|c)){if(t=0|i[(r=(e=c+16|0)+4|0)>>2])e=r;else if(!(t=0|i[e>>2])){r=0;break}for(;;)if(r=0|i[(n=t+20|0)>>2])t=r,e=n;else{if(!(r=0|i[(n=t+16|0)>>2]))break;t=r,e=n}i[e>>2]=0,r=t}else r=0|i[c+8>>2],i[r+12>>2]=t,i[t+8>>2]=r,r=t}while(0);if(0|a){if(t=0|i[c+28>>2],(0|i[(e=23268+(t<<2)|0)>>2])==(0|c)){if(i[e>>2]=r,!r){i[5742]=i[5742]&~(1<<t);break}}else if(i[((0|i[(n=a+16|0)>>2])==(0|c)?n:a+20|0)>>2]=r,!r)break;i[r+24>>2]=a,0|(e=0|i[(t=c+16|0)>>2])&&(i[r+16>>2]=e,i[e+24>>2]=r),0|(t=0|i[t+4>>2])&&(i[r+20>>2]=t,i[t+24>>2]=r)}}while(0);if(i[u+4>>2]=1|o,i[s+o>>2]=o,(0|u)==(0|i[5746]))return void(i[5743]=o)}if(t=o>>>3,o>>>0<256)return r=23004+(t<<1<<2)|0,(e=0|i[5741])&(t=1<<t)?t=0|i[(e=r+8|0)>>2]:(i[5741]=e|t,t=r,e=r+8|0),i[e>>2]=u,i[t+12>>2]=u,i[u+8>>2]=t,void(i[u+12>>2]=r);t=23268+((n=(t=o>>>8)?o>>>0>16777215?31:o>>>((n=14-((a=((c=t<<(s=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(n=((c<<=a)+245760|0)>>>16&2))+(c<<n>>>15)|0)+7|0)&1|n<<1:0)<<2)|0,i[u+28>>2]=n,i[u+20>>2]=0,i[u+16>>2]=0,e=0|i[5742],r=1<<n;t:do{if(e&r){t=0|i[t>>2];e:do{if((-8&i[t+4>>2]|0)!=(0|o)){for(n=o<<(31==(0|n)?0:25-(n>>>1)|0);e=0|i[(r=t+16+(n>>>31<<2)|0)>>2];){if((-8&i[e+4>>2]|0)==(0|o)){t=e;break e}n<<=1,t=e}i[r>>2]=u,i[u+24>>2]=t,i[u+12>>2]=u,i[u+8>>2]=u;break t}}while(0);c=0|i[(s=t+8|0)>>2],i[c+12>>2]=u,i[s>>2]=u,i[u+8>>2]=c,i[u+12>>2]=t,i[u+24>>2]=0}else i[5742]=e|r,i[t>>2]=u,i[u+24>>2]=t,i[u+12>>2]=u,i[u+8>>2]=u}while(0);if(c=(0|i[5749])-1|0,i[5749]=c,!(0|c)){for(t=23420;t=0|i[t>>2];)t=t+8|0;i[5749]=-1}}}}function pe(t,e){e|=0;var r=0;return(t|=0)?(r=0|v(e,t),(e|t)>>>0>65535&&(r=(0|(r>>>0)/(t>>>0))==(0|e)?r:-1)):r=0,(t=0|he(r))&&3&i[t+-4>>2]?(xe(0|t,0,0|r),0|t):0|t}function de(t,e,r,n){return 0|(b(0|(n=(e|=0)-(n|=0)-((r|=0)>>>0>(t|=0)>>>0|0)>>>0)),t-r>>>0|0)}function Ae(t){return 0|((t|=0)?31-(0|_(t^t-1))|0:32)}function ge(t,e,r,n,o){o|=0;var a=0,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0;if(h=t|=0,s=r|=0,u=p=n|=0,!(l=c=e|=0))return a=0!=(0|o),u?a?(i[o>>2]=0|t,i[o+4>>2]=0&e,o=0,0|(b(0|(p=0)),o)):(o=0,0|(b(0|(p=0)),o)):(a&&(i[o>>2]=(h>>>0)%(s>>>0),i[o+4>>2]=0),o=(h>>>0)/(s>>>0)>>>0,0|(b(0|(p=0)),o));a=0==(0|u);do{if(s){if(!a){if((a=(0|_(0|u))-(0|_(0|l))|0)>>>0<=31){s=f=a+1|0,t=h>>>(f>>>0)&(e=a-31>>31)|l<<(u=31-a|0),e&=l>>>(f>>>0),a=0,u=h<<u;break}return o?(i[o>>2]=0|t,i[o+4>>2]=c|0&e,o=0,0|(b(0|(p=0)),o)):(o=0,0|(b(0|(p=0)),o))}if((a=s-1|0)&s|0){s=u=33+(0|_(0|s))-(0|_(0|l))|0,t=(f=32-u|0)-1>>31&l>>>((d=u-32|0)>>>0)|(l<<f|h>>>(u>>>0))&(e=d>>31),e&=l>>>(u>>>0),a=h<<(A=64-u|0)&(c=f>>31),u=(l<<A|h>>>(d>>>0))&c|h<<f&u-33>>31;break}return 0|o&&(i[o>>2]=a&h,i[o+4>>2]=0),1==(0|s)?(A=0|t,0|(b(0|(d=c|0&e)),A)):(d=l>>>((A=0|Ae(0|s))>>>0)|0,A=l<<32-A|h>>>(A>>>0)|0,0|(b(0|d),A))}if(a)return 0|o&&(i[o>>2]=(l>>>0)%(s>>>0),i[o+4>>2]=0),A=(l>>>0)/(s>>>0)>>>0,0|(b(0|(d=0)),A);if(!h)return 0|o&&(i[o>>2]=0,i[o+4>>2]=(l>>>0)%(u>>>0)),A=(l>>>0)/(u>>>0)>>>0,0|(b(0|(d=0)),A);if(!((a=u-1|0)&u))return 0|o&&(i[o>>2]=0|t,i[o+4>>2]=a&l|0&e),d=0,A=l>>>((0|Ae(0|u))>>>0),0|(b(0|d),A);if((a=(0|_(0|u))-(0|_(0|l))|0)>>>0<=30){s=e=a+1|0,t=l<<(u=31-a|0)|h>>>(e>>>0),e=l>>>(e>>>0),a=0,u=h<<u;break}return o?(i[o>>2]=0|t,i[o+4>>2]=c|0&e,A=0,0|(b(0|(d=0)),A)):(A=0,0|(b(0|(d=0)),A))}while(0);if(s){l=0|function(t,e,r,n){return 0|(b((e|=0)+(n|=0)+((r=(t|=0)+(r|=0)>>>0)>>>0<t>>>0|0)>>>0|0),0|r)}(0|(f=0|r),0|(h=p|0&n),-1,-1),r=0|x(),c=u,u=0;do{n=c,c=a>>>31|c<<1,a=u|a<<1,de(0|l,0|r,0|(n=t<<1|n>>>31|0),0|(p=t>>>31|e<<1|0)),u=1&(d=(A=0|x())>>31|((0|A)<0?-1:0)<<1),t=0|de(0|n,0|p,d&f|0,(((0|A)<0?-1:0)>>31|((0|A)<0?-1:0)<<1)&h|0),e=0|x(),s=s-1|0}while(0!=(0|s));l=c,c=0}else l=u,c=0,u=0;return s=0,0|o&&(i[o>>2]=t,i[o+4>>2]=e),A=-2&(a<<1|0)|u,0|(b(0|(d=(0|a)>>>31|(l|s)<<1|0&(s<<1|a>>>31)|c)),A)}function me(t,e,r,n){var o,a;return a=M,M=M+16|0,ge(t|=0,e|=0,r|=0,n|=0,o=0|a),M=a,0|(b(0|i[o+4>>2]),0|i[o>>2])}function ye(t,e,r){return t|=0,e|=0,(0|(r|=0))<32?(b(e>>>r|0),t>>>r|(e&(1<<r)-1)<<32-r):(b(0),e>>>r-32|0)}function ve(t,e,r){return t|=0,e|=0,(0|(r|=0))<32?(b(e<<r|(t&(1<<r)-1<<32-r)>>>32-r|0),t<<r):(b(t<<r-32|0),0)}function _e(t){return(t=+t)>=0?+s(t+.5):+y(t-.5)}function be(t,e,r){t|=0,e|=0;var o,a,s=0;if((0|(r|=0))>=8192)return O(0|t,0|e,0|r),0|t;if(a=0|t,o=t+r|0,(3&t)==(3&e)){for(;3&t;){if(!r)return 0|a;n[t>>0]=0|n[e>>0],t=t+1|0,e=e+1|0,r=r-1|0}for(s=(r=-4&o|0)-64|0;(0|t)<=(0|s);)i[t>>2]=i[e>>2],i[t+4>>2]=i[e+4>>2],i[t+8>>2]=i[e+8>>2],i[t+12>>2]=i[e+12>>2],i[t+16>>2]=i[e+16>>2],i[t+20>>2]=i[e+20>>2],i[t+24>>2]=i[e+24>>2],i[t+28>>2]=i[e+28>>2],i[t+32>>2]=i[e+32>>2],i[t+36>>2]=i[e+36>>2],i[t+40>>2]=i[e+40>>2],i[t+44>>2]=i[e+44>>2],i[t+48>>2]=i[e+48>>2],i[t+52>>2]=i[e+52>>2],i[t+56>>2]=i[e+56>>2],i[t+60>>2]=i[e+60>>2],t=t+64|0,e=e+64|0;for(;(0|t)<(0|r);)i[t>>2]=i[e>>2],t=t+4|0,e=e+4|0}else for(r=o-4|0;(0|t)<(0|r);)n[t>>0]=0|n[e>>0],n[t+1>>0]=0|n[e+1>>0],n[t+2>>0]=0|n[e+2>>0],n[t+3>>0]=0|n[e+3>>0],t=t+4|0,e=e+4|0;for(;(0|t)<(0|o);)n[t>>0]=0|n[e>>0],t=t+1|0,e=e+1|0;return 0|a}function xe(t,e,r){e|=0;var o,a=0,s=0,u=0;if(o=(t|=0)+(r|=0)|0,e&=255,(0|r)>=67){for(;3&t;)n[t>>0]=e,t=t+1|0;for(u=e|e<<8|e<<16|e<<24,s=(a=-4&o|0)-64|0;(0|t)<=(0|s);)i[t>>2]=u,i[t+4>>2]=u,i[t+8>>2]=u,i[t+12>>2]=u,i[t+16>>2]=u,i[t+20>>2]=u,i[t+24>>2]=u,i[t+28>>2]=u,i[t+32>>2]=u,i[t+36>>2]=u,i[t+40>>2]=u,i[t+44>>2]=u,i[t+48>>2]=u,i[t+52>>2]=u,i[t+56>>2]=u,i[t+60>>2]=u,t=t+64|0;for(;(0|t)<(0|a);)i[t>>2]=u,t=t+4|0}for(;(0|t)<(0|o);)n[t>>0]=e,t=t+1|0;return o-r|0}function we(t){return(t=+t)>=0?+s(t+.5):+y(t-.5)}function Ee(t){t|=0;var e,r,n;return n=0|S(),(0|t)>0&(0|(e=(r=0|i[a>>2])+t|0))<(0|r)|(0|e)<0?(P(0|e),E(12),-1):(0|e)>(0|n)&&!(0|T(0|e))?(E(12),-1):(i[a>>2]=e,0|r)}return{___uremdi3:me,_bitshift64Lshr:ye,_bitshift64Shl:ve,_calloc:pe,_compact:function(t,e,r){e|=0;var n,o=0,a=0,s=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0,w=0,E=0;if(!(r|=0))return 0|(E=0);if(o=0|i[(a=t|=0)>>2],!0&0==(15728640&(a=0|i[a+4>>2])|0)){if((0|r)<=0)return 0|(E=0);if(i[(E=e)>>2]=o,i[E+4>>2]=a,1==(0|r))return 0|(E=0);o=1;do{w=0|i[(b=t+(o<<3)|0)+4>>2],i[(E=e+(o<<3)|0)>>2]=i[b>>2],i[E+4>>2]=w,o=o+1|0}while((0|o)!=(0|r));return 0|(o=0)}be(0|(w=0|he(b=r<<3)),0|t,0|b),n=0|pe(r,8),o=r;t:for(;;){v=0|ye(0|(f=0|i[(u=w)>>2]),0|(u=0|i[u+4>>2]),52),x(),_=(v&=15)+-1|0,y=(0|o)>0;e:do{if(y){if(m=((0|o)<0)<<31>>31,A=0|ve(0|_,0,52),g=0|x(),_>>>0>15)for(a=0,t=f,r=u;;){if(!(0==(0|t)&0==(0|r))){if(s=0|ye(0|t,0|r,52),x(),c=(0|(s&=15))<(0|_),s=(0|s)==(0|_),r=0|me(0|(h=c?0:s?t:0),0|(t=c?0:s?r:0),0|o,0|m),x(),0==(0|(l=0|i[(c=s=n+(r<<3)|0)>>2]))&0==(0|(c=0|i[c+4>>2])))r=h;else for(A=0,d=r,p=l,r=h,l=s;;){if((0|A)>(0|o)){E=33;break t}if((0|p)==(0|r)&(-117440513&c|0)==(0|t)){if(s=0|ye(0|p,0|c,56),x(),7==(0|(s&=7))){E=38;break t}g=0|ve(s+1|0,0,56),t=0|x()|-117440513&t,i[l>>2]=0,i[l+4>>2]=0,l=d,r|=g}else l=(d+1|0)%(0|o)|0;if(0==(0|(p=0|i[(c=s=n+(l<<3)|0)>>2]))&0==(0|(c=0|i[c+4>>2])))break;A=A+1|0,d=l,l=s}i[(g=s)>>2]=r,i[g+4>>2]=t}if((0|(a=a+1|0))>=(0|o))break e;t=0|i[(r=w+(a<<3)|0)>>2],r=0|i[r+4>>2]}for(a=0,t=f,r=u;;){if(!(0==(0|t)&0==(0|r))){if(c=0|ye(0|t,0|r,52),x(),(0|(c&=15))>=(0|_)){if((0|c)!=(0|_)&&(t|=A,r=-15728641&r|g,c>>>0>=v>>>0)){s=_;do{d=0|ve(7,0,3*(14-s|0)|0),s=s+1|0,t|=d,r=0|x()|r}while(s>>>0<c>>>0)}}else t=0,r=0;if(c=0|me(0|t,0|r,0|o,0|m),x(),!(0==(0|(h=0|i[(l=s=n+(c<<3)|0)>>2]))&0==(0|(l=0|i[l+4>>2]))))for(d=0,p=h,h=s;;){if((0|d)>(0|o)){E=33;break t}if((0|p)==(0|t)&(-117440513&l|0)==(0|r)){if(s=0|ye(0|p,0|l,56),x(),7==(0|(s&=7))){E=38;break t}p=0|ve(s+1|0,0,56),r=0|x()|-117440513&r,i[h>>2]=0,i[h+4>>2]=0,t|=p}else c=(c+1|0)%(0|o)|0;if(0==(0|(p=0|i[(l=s=n+(c<<3)|0)>>2]))&0==(0|(l=0|i[l+4>>2])))break;d=d+1|0,h=s}i[(d=s)>>2]=t,i[d+4>>2]=r}if((0|(a=a+1|0))>=(0|o))break e;t=0|i[(r=w+(a<<3)|0)>>2],r=0|i[r+4>>2]}}}while(0);if((o+5|0)>>>0<11){E=84;break}m=0|he(((0|o)/6|0)<<3);e:do{if(y){A=0,d=0;do{if(!(0==(0|(a=0|i[(t=c=n+(A<<3)|0)>>2]))&0==(0|(t=0|i[t+4>>2])))){l=0|ye(0|a,0|t,56),x(),r=(l&=7)+1|0,h=-117440513&t,g=0|ye(0|a,0|t,45),x();r:do{if(0|L(127&g)){if(p=0|ye(0|a,0|t,52),x(),0|(p&=15))for(s=1;;){if(!(0==(a&(g=0|ve(7,0,3*(15-s|0)|0))|0)&0==(h&(0|x())|0)))break r;if(!(s>>>0<p>>>0))break;s=s+1|0}a|=t=0|ve(0|r,0,56),t=0|x()|h,i[(r=c)>>2]=a,i[r+4>>2]=t,r=l+2|0}}while(0);7==(0|r)&&(i[(g=m+(d<<3)|0)>>2]=a,i[g+4>>2]=-117440513&t,d=d+1|0)}A=A+1|0}while((0|A)!=(0|o));if(y){if(g=((0|o)<0)<<31>>31,p=0|ve(0|_,0,52),A=0|x(),_>>>0>15)for(t=0,a=0;;){do{if(!(0==(0|f)&0==(0|u))){for(l=0|ye(0|f,0|u,52),x(),s=(0|(l&=15))<(0|_),l=(0|l)==(0|_),s=0|me(0|(c=s?0:l?f:0),0|(l=s?0:l?u:0),0|o,0|g),x(),r=0;;){if((0|r)>(0|o)){E=83;break t}if((-117440513&(h=0|i[(v=n+(s<<3)|0)+4>>2])|0)==(0|l)&&(0|i[v>>2])==(0|c)){E=55;break}if((0|i[(v=n+((s=(s+1|0)%(0|o)|0)<<3)|0)>>2])==(0|c)&&(0|i[v+4>>2])==(0|l))break;r=r+1|0}if(55==(0|E)&&(E=0,!0&100663296==(117440512&h|0)))break;i[(v=e+(a<<3)|0)>>2]=f,i[v+4>>2]=u,a=a+1|0}}while(0);if((0|(t=t+1|0))>=(0|o)){o=d;break e}f=0|i[(u=w+(t<<3)|0)>>2],u=0|i[u+4>>2]}for(t=0,a=0;;){do{if(!(0==(0|f)&0==(0|u))){if(l=0|ye(0|f,0|u,52),x(),(0|(l&=15))>=(0|_))if((0|l)!=(0|_))if(r=f|p,s=-15728641&u|A,l>>>0<v>>>0)l=s;else{c=_;do{y=0|ve(7,0,3*(14-c|0)|0),c=c+1|0,r|=y,s=0|x()|s}while(c>>>0<l>>>0);l=s}else r=f,l=u;else r=0,l=0;for(c=0|me(0|r,0|l,0|o,0|g),x(),s=0;;){if((0|s)>(0|o)){E=83;break t}if((-117440513&(h=0|i[(y=n+(c<<3)|0)+4>>2])|0)==(0|l)&&(0|i[y>>2])==(0|r)){E=78;break}if((0|i[(y=n+((c=(c+1|0)%(0|o)|0)<<3)|0)>>2])==(0|r)&&(0|i[y+4>>2])==(0|l))break;s=s+1|0}if(78==(0|E)&&(E=0,!0&100663296==(117440512&h|0)))break;i[(y=e+(a<<3)|0)>>2]=f,i[y+4>>2]=u,a=a+1|0}}while(0);if((0|(t=t+1|0))>=(0|o)){o=d;break e}f=0|i[(u=w+(t<<3)|0)>>2],u=0|i[u+4>>2]}}else a=0,o=d}else a=0,o=0}while(0);if(xe(0|n,0,0|b),be(0|w,0|m,o<<3|0),fe(m),!o)break;e=e+(a<<3)|0}return 33==(0|E)?(fe(w),fe(n),0|(E=-1)):38==(0|E)?(fe(w),fe(n),0|(E=-2)):83==(0|E)?(fe(m),fe(w),fe(n),0|(E=-1)):(84==(0|E)&&be(0|e,0|w,o<<3|0),fe(w),fe(n),0|(E=0))},_destroyLinkedPolygon:function(t){var e=0,r=0,n=0,o=0;if(t|=0)for(n=1;;){if(0|(e=0|i[t>>2]))do{if(0|(r=0|i[e>>2]))do{o=r,r=0|i[r+16>>2],fe(o)}while(0!=(0|r));o=e,e=0|i[e+8>>2],fe(o)}while(0!=(0|e));if(e=t,t=0|i[t+8>>2],n||fe(e),!t)break;n=0}},_edgeLengthKm:function(t){return+ +o[20752+((t|=0)<<3)>>3]},_edgeLengthM:function(t){return+ +o[20880+((t|=0)<<3)>>3]},_emscripten_replace_memory:function(t){return n=new Int8Array(t),new Uint8Array(t),i=new Int32Array(t),new Float32Array(t),o=new Float64Array(t),r=t,!0},_experimentalH3ToLocalIj:function(t,e,r,n,i){var o,a;return i|=0,a=M,M=M+16|0,(t=0|Xt(t|=0,e|=0,r|=0,n|=0,o=a))||(lt(o,i),t=0),M=a,0|t},_experimentalLocalIjToH3:function(t,e,r,n){var i,o;return t|=0,e|=0,n|=0,i=M,M=M+16|0,ht(r|=0,o=i),n=0|Qt(t,e,o,n),M=i,0|n},_free:fe,_geoToH3:Ft,_getDestinationH3IndexFromUnidirectionalEdge:function(t,e){t|=0;var r,n,o=0;return r=M,M=M+16|0,o=r,!0&268435456==(2013265920&(e|=0)|0)?(n=0|ye(0|t,0|e,56),x(),i[o>>2]=0,o=0|R(t,-2130706433&e|134217728,7&n,o),e=0|x(),b(0|e),M=r,0|o):(o=0,b(0|(e=0)),M=r,0|o)},_getH3IndexesFromUnidirectionalEdge:function(t,e,r){t|=0;var n,o,a,s,u=0;a=M,M=M+16|0,n=a,s=!0&268435456==(2013265920&(e|=0)|0),o=-2130706433&e|134217728,i[(u=r|=0)>>2]=s?t:0,i[u+4>>2]=s?o:0,s?(e=0|ye(0|t,0|e,56),x(),i[n>>2]=0,t=0|R(t,o,7&e,n),e=0|x()):(t=0,e=0),i[(u=r+8|0)>>2]=t,i[u+4>>2]=e,M=a},_getH3UnidirectionalEdge:function(t,e,r,n){var o,a,s=0,u=0;if(a=M,M=M+16|0,o=a,!(0|Gt(t|=0,e|=0,r|=0,n|=0)))return s=0,b(0|(t=0)),M=a,0|s;if(s=-2130706433&e,i[o>>2]=0,(0|(u=0|R(t,e,1,o)))==(0|r)&(0|x())==(0|n))e=0,r=16777216;else if(i[o>>2]=0,(0|(u=0|R(t,e,2,o)))==(0|r)&(0|x())==(0|n))e=0,r=33554432;else if(i[o>>2]=0,(0|(u=0|R(t,e,3,o)))==(0|r)&(0|x())==(0|n))e=0,r=50331648;else if(i[o>>2]=0,(0|(u=0|R(t,e,4,o)))==(0|r)&(0|x())==(0|n))e=0,r=67108864;else if(i[o>>2]=0,(0|(u=0|R(t,e,5,o)))==(0|r)&(0|x())==(0|n))e=0,r=83886080;else{if(i[o>>2]=0,!((0|(u=0|R(t,e,6,o)))==(0|r)&(0|x())==(0|n)))return u=0,b(0|(s=0)),M=a,0|u;e=0,r=100663296}return u=t|e,b(0|(s=s|r|268435456)),M=a,0|u},_getH3UnidirectionalEdgeBoundary:function(t,e,r){t|=0,e|=0,r|=0;var n,o,a=0,s=0,u=0,c=0,l=0,h=0;if(o=M,M=M+368|0,s=o+352|0,l=o+16|0,h=o,xe(0|(n=o+184|0),0,168),xe(0|l,0,168),i[h>>2]=0,i[h+4>>2]=0,i[h+8>>2]=0,i[h+12>>2]=0,a=-2130706433&e|134217728,Vt((c=!0&268435456==(2013265920&e|0))?t:0,c?a:0,n),c?(e=0|ye(0|t,0|e,56),x(),i[s>>2]=0,t=0|R(t,a,7&e,s),e=0|x()):(t=0,e=0),Vt(t,e,l),(0|i[n>>2])<=0)return h=0,i[r>>2]=h,void(M=o);c=n+24|0,t=0,e=0,u=0;do{s=n+8+(u<<4)|0;t:do{if((0|i[l>>2])>0){for(a=0;!(0|wt(s,l+8+(a<<4)|0,1e-6));)if((0|(a=a+1|0))>=(0|i[l>>2]))break t;e:do{if(!u){if((0|i[l>>2])>0){a=0;do{if(0|wt(c,l+8+(a<<4)|0,1e-6))break e;a=a+1|0}while((0|a)<(0|i[l>>2]))}i[h>>2]=i[s>>2],i[h+4>>2]=i[s+4>>2],i[h+8>>2]=i[s+8>>2],i[h+12>>2]=i[s+12>>2],e=1;break t}}while(0);i[(a=r+8+(t<<4)|0)>>2]=i[s>>2],i[a+4>>2]=i[s+4>>2],i[a+8>>2]=i[s+8>>2],i[a+12>>2]=i[s+12>>2],t=t+1|0}}while(0);u=u+1|0}while((0|u)<(0|i[n>>2]));if(!e)return h=t,i[r>>2]=h,void(M=o);i[(l=r+8+(t<<4)|0)>>2]=i[h>>2],i[l+4>>2]=i[h+4>>2],i[l+8>>2]=i[h+8>>2],i[l+12>>2]=i[h+12>>2],h=t+1|0,i[r>>2]=h,M=o},_getH3UnidirectionalEdgesFromHexagon:function(t,e,r){r|=0;var n,o=0;n=0==(0|It(t|=0,e|=0)),e&=-2130706433,i[(o=r)>>2]=n?t:0,i[o+4>>2]=n?285212672|e:0,i[(o=r+8|0)>>2]=t,i[o+4>>2]=301989888|e,i[(o=r+16|0)>>2]=t,i[o+4>>2]=318767104|e,i[(o=r+24|0)>>2]=t,i[o+4>>2]=335544320|e,i[(o=r+32|0)>>2]=t,i[o+4>>2]=352321536|e,i[(r=r+40|0)>>2]=t,i[r+4>>2]=369098752|e},_getOriginH3IndexFromUnidirectionalEdge:function(t,e){var r;return t|=0,b(0|((r=!0&268435456==(2013265920&(e|=0)|0))?-2130706433&e|134217728:0)),0|(r?t:0)},_getPentagonIndexes:function(t,e){e|=0;var r,n=0,o=0,a=0,s=0,u=0,c=0;if(ve(0|(t|=0),0,52),r=134225919|x(),(0|t)<1){o=0,n=0;do{0|L(o)&&(ve(0|o,0,45),u=0|r|x(),i[(t=e+(n<<3)|0)>>2]=-1,i[t+4>>2]=u,n=n+1|0),o=o+1|0}while(122!=(0|o))}else{u=0,n=0;do{if(0|L(u)){for(ve(0|u,0,45),o=1,a=-1,s=0|r|x();a&=~(c=0|ve(7,0,3*(15-o|0)|0)),s&=~(0|x()),(0|o)!=(0|t);)o=o+1|0;i[(c=e+(n<<3)|0)>>2]=a,i[c+4>>2]=s,n=n+1|0}u=u+1|0}while(122!=(0|u))}},_getRes0Indexes:function(t){t|=0;var e=0,r=0,n=0;e=0;do{ve(0|e,0,45),n=134225919|x(),i[(r=t+(e<<3)|0)>>2]=-1,i[r+4>>2]=n,e=e+1|0}while(122!=(0|e))},_h3Distance:function(t,e,r,n){var i,o,a;return r|=0,n|=0,a=M,M=M+32|0,o=a,t=0==(0|Xt(t|=0,e|=0,t,e,i=a+12|0))&&0==(0|Xt(t,e,r,n,o))?0|ct(i,o):-1,M=a,0|t},_h3GetBaseCell:function(t,e){return e=0|ye(0|(t|=0),0|(e|=0),45),x(),127&e|0},_h3GetFaces:function t(e,r,n){n|=0;var o,a=0,s=0,u=0,c=0,l=0,h=0,f=0,p=0;o=M,M=M+128|0,f=o+112|0,u=o+96|0,p=o,s=0|ye(0|(e|=0),0|(r|=0),52),x(),l=15&s,i[f>>2]=l,c=0|ye(0|e,0|r,45),x(),c&=127;t:do{if(0|L(c)){if(0|l)for(a=1;;){if(!(0==((h=0|ve(7,0,3*(15-a|0)|0))&e|0)&0==((0|x())&r|0))){s=0;break t}if(!(a>>>0<l>>>0))break;a=a+1|0}if(!(1&s))return h=0|ve(l+1|0,0,52),p=0|x()|-15728641&r,t((h|e)&~(f=0|ve(7,0,3*(14-l|0)|0)),p&~(0|x()),n),void(M=o);s=1}else s=0}while(0);Nt(e,r,u),s?(mt(u,f,p),h=5):(bt(u,f,p),h=6);t:do{if(0|L(c))if(l)for(a=1;;){if(!(0==((c=0|ve(7,0,3*(15-a|0)|0))&e|0)&0==((0|x())&r|0))){a=8;break t}if(!(a>>>0<l>>>0)){a=20;break}a=a+1|0}else a=20;else a=8}while(0);if(xe(0|n,-1,0|a),s){s=0;do{for(vt(u=p+(s<<4)|0,0|i[f>>2]),u=0|i[u>>2],a=0;!(-1==(0|(l=0|i[(c=n+(a<<2)|0)>>2]))|(0|l)==(0|u));)a=a+1|0;i[c>>2]=u,s=s+1|0}while((0|s)!=(0|h))}else{s=0;do{for(yt(u=p+(s<<4)|0,0|i[f>>2],0,1),u=0|i[u>>2],a=0;!(-1==(0|(l=0|i[(c=n+(a<<2)|0)>>2]))|(0|l)==(0|u));)a=a+1|0;i[c>>2]=u,s=s+1|0}while((0|s)!=(0|h))}M=o},_h3IndexesAreNeighbors:Gt,_h3IsPentagon:It,_h3IsResClassIII:function(t,e){return e=0|ye(0|(t|=0),0|(e|=0),52),x(),1&e|0},_h3IsValid:Pt,_h3Line:function(t,e,r,n,o){r|=0,n|=0,o|=0;var a,s=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0,x=0,w=0,E=0;if(a=M,M=M+48|0,c=a+12|0,w=a,0==(0|Xt(t|=0,e|=0,t,e,s=a+24|0))&&0==(0|Xt(t,e,r,n,c))){if((0|(x=0|ct(s,c)))<0)return M=a,0|(w=x);for(i[s>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,i[c>>2]=0,i[c+4>>2]=0,i[c+8>>2]=0,Xt(t,e,t,e,s),Xt(t,e,r,n,c),ft(s),ft(c),x?(g=+(0|x),b=s,r=p=0|i[s>>2],n=d=0|i[(v=s+4|0)>>2],s=A=0|i[(_=s+8|0)>>2],m=+((0|i[c>>2])-p|0)/g,y=+((0|i[c+4>>2])-d|0)/g,g=+((0|i[c+8>>2])-A|0)/g):(v=n=s+4|0,_=A=s+8|0,b=s,r=0|i[s>>2],n=0|i[n>>2],s=0|i[A>>2],m=0,y=0,g=0),i[w>>2]=r,i[(A=w+4|0)>>2]=n,i[(d=w+8|0)>>2]=s,p=0;;){E=m*(h=+(0|p))+ +(0|r),l=y*h+ +(0|i[v>>2]),h=g*h+ +(0|i[_>>2]),n=~~+_e(+E),c=~~+_e(+l),r=~~+_e(+h),E=+u(+(+(0|n)-E)),l=+u(+(+(0|c)-l)),h=+u(+(+(0|r)-h));do{if(!(E>l&E>h)){if(f=0-n|0,l>h){s=f-r|0;break}s=c,r=f-c|0;break}n=0-(c+r)|0,s=c}while(0);if(i[w>>2]=n,i[A>>2]=s,i[d>>2]=r,pt(w),Qt(t,e,w,o+(p<<3)|0),(0|p)==(0|x))break;p=p+1|0,r=0|i[b>>2]}return M=a,0|(w=0)}return M=a,0|(w=-1)},_h3LineSize:function(t,e,r,n){var i,o,a;return r|=0,n|=0,a=M,M=M+32|0,o=a,t=0==(0|Xt(t|=0,e|=0,t,e,i=a+12|0))&&0==(0|Xt(t,e,r,n,o))?0|ct(i,o):-1,M=a,(t>>>31^1)+t|0},_h3SetToLinkedGeo:function(t,e,r){r|=0;var n,o,a,s=0;if(a=M,M=M+32|0,n=a,function(t,e,r){t|=0,r|=0;var n,o,a=0,s=0,u=0,c=0,l=0;if(o=M,M=M+176|0,n=o,(0|(e|=0))<1)return ne(r,0,0),void(M=o);c=0|ye(0|i[(c=t)>>2],0|i[c+4>>2],52),x(),ne(r,(0|e)>6?e:6,15&c),c=0;do{if(Vt(0|i[(a=t+(c<<3)|0)>>2],0|i[a+4>>2],n),(0|(a=0|i[n>>2]))>0){l=0;do{u=n+8+(l<<4)|0,(s=0|ue(r,a=n+8+(((0|(l=l+1|0))%(0|a)|0)<<4)|0,u))?ae(r,s):se(r,u,a),a=0|i[n>>2]}while((0|l)<(0|a))}c=c+1|0}while((0|c)!=(0|e));M=o}(t|=0,e|=0,o=a+16|0),i[r>>2]=0,i[r+4>>2]=0,i[r+8>>2]=0,!(t=0|oe(o)))return qt(r),ie(o),void(M=a);do{e=0|Wt(r);do{Ht(e,t),s=t+16|0,i[n>>2]=i[s>>2],i[n+4>>2]=i[s+4>>2],i[n+8>>2]=i[s+8>>2],i[n+12>>2]=i[s+12>>2],ae(o,t),t=0|ce(o,n)}while(0!=(0|t));t=0|oe(o)}while(0!=(0|t));qt(r),ie(o),M=a},_h3ToCenterChild:function(t,e,r){r|=0;var n=0,i=0;if(n=0|ye(0|(t|=0),0|(e|=0),52),x(),(0|r)<16&(0|(n&=15))<=(0|r)){if((0|n)!=(0|r)&&(t|=i=0|ve(0|r,0,52),e=0|x()|-15728641&e,(0|n)<(0|r)))do{i=0|ve(7,0,3*(14-n|0)|0),n=n+1|0,t&=~i,e&=~(0|x())}while((0|n)<(0|r))}else e=0,t=0;return b(0|e),0|t},_h3ToChildren:Ct,_h3ToGeo:Ut,_h3ToGeoBoundary:Vt,_h3ToParent:Mt,_h3UnidirectionalEdgeIsValid:function(t,e){var r=0;if(!(!0&268435456==(2013265920&(e|=0)|0)))return 0|(r=0);switch(r=0|ye(0|(t|=0),0|e,56),x(),7&r){case 0:case 7:return 0|(r=0)}return!0&16777216==(117440512&e|0)&0!=(0|It(t,r=-2130706433&e|134217728))?0|(r=0):0|(r=0|Pt(t,r))},_hexAreaKm2:function(t){return+ +o[20496+((t|=0)<<3)>>3]},_hexAreaM2:function(t){return+ +o[20624+((t|=0)<<3)>>3]},_hexRing:function(t,e,r,n){t|=0,e|=0,n|=0;var o,a=0,s=0,u=0,c=0,l=0,h=0,f=0;if(o=M,M=M+16|0,f=o,!(r|=0))return i[(f=n)>>2]=t,i[f+4>>2]=e,M=o,0|(f=0);i[f>>2]=0;t:do{if(0|It(t,e))t=1;else{if(s=(0|r)>0){a=0,h=t;do{if(0==(0|(h=0|R(h,e,4,f)))&0==(0|(e=0|x()))){t=2;break t}if(a=a+1|0,0|It(h,e)){t=1;break t}}while((0|a)<(0|r));if(i[(l=n)>>2]=h,i[l+4>>2]=e,l=r+-1|0,s){s=0,u=1,a=h,t=e;do{if(0==(0|(a=0|R(a,t,2,f)))&0==(0|(t=0|x()))){t=2;break t}if(i[(c=n+(u<<3)|0)>>2]=a,i[c+4>>2]=t,u=u+1|0,0|It(a,t)){t=1;break t}s=s+1|0}while((0|s)<(0|r));c=0,s=u;do{if(0==(0|(a=0|R(a,t,3,f)))&0==(0|(t=0|x()))){t=2;break t}if(i[(u=n+(s<<3)|0)>>2]=a,i[u+4>>2]=t,s=s+1|0,0|It(a,t)){t=1;break t}c=c+1|0}while((0|c)<(0|r));u=0;do{if(0==(0|(a=0|R(a,t,1,f)))&0==(0|(t=0|x()))){t=2;break t}if(i[(c=n+(s<<3)|0)>>2]=a,i[c+4>>2]=t,s=s+1|0,0|It(a,t)){t=1;break t}u=u+1|0}while((0|u)<(0|r));u=0;do{if(0==(0|(a=0|R(a,t,5,f)))&0==(0|(t=0|x()))){t=2;break t}if(i[(c=n+(s<<3)|0)>>2]=a,i[c+4>>2]=t,s=s+1|0,0|It(a,t)){t=1;break t}u=u+1|0}while((0|u)<(0|r));u=0;do{if(0==(0|(a=0|R(a,t,4,f)))&0==(0|(t=0|x()))){t=2;break t}if(i[(c=n+(s<<3)|0)>>2]=a,i[c+4>>2]=t,s=s+1|0,0|It(a,t)){t=1;break t}u=u+1|0}while((0|u)<(0|r));for(u=0;;){if(0==(0|(a=0|R(a,t,6,f)))&0==(0|(t=0|x()))){t=2;break t}if((0|u)!=(0|l)){if(i[(c=n+(s<<3)|0)>>2]=a,i[c+4>>2]=t,0|It(a,t)){t=1;break t}s=s+1|0}if((0|(u=u+1|0))>=(0|r)){u=h,s=e;break}}}else u=h,a=h,s=e,t=e}else i[(u=n)>>2]=t,i[u+4>>2]=e,u=t,a=t,s=e,t=e;t=1&((0|u)!=(0|a)|(0|s)!=(0|t))}}while(0);return M=o,0|(f=t)},_i64Subtract:de,_kRing:C,_kRingDistances:function(t,e,r,n,i){var o;t|=0,e|=0,n|=0,i|=0,o=1+(0|v(3*(r|=0)|0,r+1|0))|0,0|I(t,e,r,n,i)&&(xe(0|n,0,o<<3|0),xe(0|i,0,o<<2|0),k(t,e,r,n,i,o,0))},_llvm_round_f64:_e,_malloc:he,_maxFaceCount:function(t,e){var r=0,n=0;if(n=0|ye(0|(t|=0),0|(e|=0),45),x(),!(0|L(127&n)))return 0|(n=2);if(n=0|ye(0|t,0|e,52),x(),!(n&=15))return 0|(n=5);for(r=1;;){if(!(0==((0|ve(7,0,3*(15-r|0)|0))&t|0)&0==((0|x())&e|0))){r=2,t=6;break}if(!(r>>>0<n>>>0)){r=5,t=6;break}r=r+1|0}return 6==(0|t)?0|r:0},_maxH3ToChildrenSize:function(t,e,r){return r|=0,t=0|ye(0|(t|=0),0|(e|=0),52),x(),(0|r)<16&(0|(t&=15))<=(0|r)?0|(r=0|Yt(7,r-t|0)):0|(r=0)},_maxKringSize:function(t){return 1+(0|v(3*(t|=0)|0,t+1|0))|0},_maxPolyfillSize:function(t,e){var r,n;return e|=0,r=M,M=M+32|0,$t(t|=0,n=r),e=0|G(n,e),e=1+(0|v(3*e|0,e+1|0))|0,M=r,0|e},_maxUncompactSize:function(t,e,r){t|=0,r|=0;var n=0,o=0,a=0,s=0;if((0|(e|=0))<=0)return 0|(r=0);if((0|r)>=16){for(n=0;;){if(!(0==(0|i[(s=t+(n<<3)|0)>>2])&0==(0|i[s+4>>2]))){n=-1,o=13;break}if((0|(n=n+1|0))>=(0|e)){n=0,o=13;break}}if(13==(0|o))return 0|n}n=0,s=0;t:for(;;){a=0|i[(o=t+(s<<3)|0)>>2],o=0|i[o+4>>2];do{if(!(0==(0|a)&0==(0|o))){if(o=0|ye(0|a,0|o,52),x(),(0|(o&=15))>(0|r)){n=-1,o=13;break t}if((0|o)==(0|r)){n=n+1|0;break}n=(0|Yt(7,r-o|0))+n|0;break}}while(0);if((0|(s=s+1|0))>=(0|e)){o=13;break}}return 13==(0|o)?0|n:0},_memcpy:be,_memset:xe,_numHexagons:function(t){var e;return t=0|i[(e=21008+((t|=0)<<3)|0)>>2],b(0|i[e+4>>2]),0|t},_pentagonIndexCount:function(){return 12},_polyfill:function(t,e,r){e|=0,r|=0;var n,a,s,c,l=0,h=0,f=0,p=0,d=0,A=0;if(c=M,M=M+32|0,l=c+16|0,a=c,(s=0|he(32+(i[(t|=0)+8>>2]<<5)|0))||w(22487,22096,678,22104),function(t,e){e|=0;var r,n=0,a=0,s=0,c=0,l=0,h=0,f=0,p=0,d=0,A=0,g=0,m=0,y=0,v=0,_=0,b=0,x=0,w=0,E=0,S=0,O=0;if(y=0|i[(t=t|0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(_=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(b=e+16|0)>>3]=-17976931348623157e292,(0|y)>0){for(s=0|i[t+4>>2],g=17976931348623157e292,m=-17976931348623157e292,a=0,n=-1,f=17976931348623157e292,p=17976931348623157e292,A=-17976931348623157e292,l=-17976931348623157e292,x=0;c=+o[s+(x<<4)>>3],d=+o[s+(x<<4)+8>>3],h=+o[s+(((0|(S=n+2|0))==(0|y)?0:S)<<4)+8>>3],c<f&&(o[v>>3]=c,f=c),d<p&&(o[_>>3]=d,p=d),c>A?o[e>>3]=c:c=A,d>l&&(o[b>>3]=d,l=d),g=d>0&d<g?d:g,m=d<0&d>m?d:m,a|=+u(+(d-h))>3.141592653589793,(0|(n=x+1|0))!=(0|y);)S=x,A=c,x=n,n=S;a&&(o[b>>3]=m,o[_>>3]=g)}}else i[e>>2]=0,i[e+4>>2]=0,i[e+8>>2]=0,i[e+12>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,i[e+24>>2]=0,i[e+28>>2]=0;if((0|(n=0|i[(S=t+8|0)>>2]))<=0)return;r=t+12|0,E=0;do{if(s=0|i[r>>2],a=E,_=e+((E=E+1|0)<<5)|0,b=0|i[s+(a<<3)>>2]){if(o[(x=e+(E<<5)+8|0)>>3]=17976931348623157e292,o[(t=e+(E<<5)+24|0)>>3]=17976931348623157e292,o[_>>3]=-17976931348623157e292,o[(w=e+(E<<5)+16|0)>>3]=-17976931348623157e292,(0|b)>0){for(y=0|i[s+(a<<3)+4>>2],g=17976931348623157e292,m=-17976931348623157e292,s=0,a=-1,v=0,f=17976931348623157e292,p=17976931348623157e292,d=-17976931348623157e292,l=-17976931348623157e292;c=+o[y+(v<<4)>>3],A=+o[y+(v<<4)+8>>3],h=+o[y+(((0|(a=a+2|0))==(0|b)?0:a)<<4)+8>>3],c<f&&(o[x>>3]=c,f=c),A<p&&(o[t>>3]=A,p=A),c>d?o[_>>3]=c:c=d,A>l&&(o[w>>3]=A,l=A),g=A>0&A<g?A:g,m=A<0&A>m?A:m,s|=+u(+(A-h))>3.141592653589793,(0|(a=v+1|0))!=(0|b);)O=v,v=a,d=c,a=O;s&&(o[w>>3]=m,o[t>>3]=g)}}else i[_>>2]=0,i[_+4>>2]=0,i[_+8>>2]=0,i[_+12>>2]=0,i[_+16>>2]=0,i[_+20>>2]=0,i[_+24>>2]=0,i[_+28>>2]=0,n=0|i[S>>2]}while((0|E)<(0|n))}(t,s),p=0|G(s,e),n=(d=0|v(3*p|0,p+1|0))+1|0,function(t,e){t|=0;var r,n=0;o[(e=e|0)>>3]=.5*(+o[t>>3]+ +o[t+8>>3]),n=+o[t+16>>3],r=+o[t+24>>3],n=+Ot(.5*(r+(n<r?n+6.283185307179586:n))),o[e+8>>3]=n}(s,l),0|I(e=0|Ft(l,e),l=0|x(),p,r,f=0|he(h=n<<2))&&(xe(0|r,0,n<<3|0),xe(0|f,0,0|h),k(e,l,p,r,f,n,0)),fe(f),(0|d)<0)return fe(s),void(M=c);l=a+8|0,e=0;do{0==(0|(f=0|i[(p=h=r+(e<<3)|0)>>2]))&0==(0|(p=0|i[p+4>>2]))||(Ut(f,p,a),A=+St(+o[a>>3]),o[a>>3]=A,A=+Ot(+o[l>>3]),o[l>>3]=A,0|Jt(t,s,a))||(i[(d=h)>>2]=0,i[d+4>>2]=0),e=e+1|0}while((0|e)!=(0|n));fe(s),M=c},_res0IndexCount:function(){return 122},_round:we,_sbrk:Ee,_sizeOfCoordIJ:function(){return 8},_sizeOfGeoBoundary:function(){return 168},_sizeOfGeoCoord:function(){return 16},_sizeOfGeoPolygon:function(){return 16},_sizeOfGeofence:function(){return 8},_sizeOfH3Index:function(){return 8},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompact:function(t,e,r,n,o){t|=0,r|=0,n|=0,o|=0;var a=0,s=0,u=0,c=0,l=0,h=0;if((0|(e|=0))<=0)return 0|(o=0);if((0|o)>=16){for(a=0;;){if(!(0==(0|i[(h=t+(a<<3)|0)>>2])&0==(0|i[h+4>>2]))){a=14;break}if((0|(a=a+1|0))>=(0|e)){s=0,a=16;break}}if(14==(0|a))return 0|((0|n)>0?-2:-1);if(16==(0|a))return 0|s}a=0,h=0;t:for(;;){s=0|i[(u=l=t+(h<<3)|0)>>2],u=0|i[u+4>>2];do{if(!(0==(0|s)&0==(0|u))){if((0|a)>=(0|n)){s=-1,a=16;break t}if(c=0|ye(0|s,0|u,52),x(),(0|(c&=15))>(0|o)){s=-2,a=16;break t}if((0|c)==(0|o)){i[(l=r+(a<<3)|0)>>2]=s,i[l+4>>2]=u,a=a+1|0;break}if((0|(s=(0|Yt(7,o-c|0))+a|0))>(0|n)){s=-1,a=16;break t}Ct(0|i[l>>2],0|i[l+4>>2],o,r+(a<<3)|0),a=s}}while(0);if((0|(h=h+1|0))>=(0|e)){s=0,a=16;break}}return 16==(0|a)?0|s:0},establishStackSpace:function(t,e){M=t|=0},stackAlloc:function(t){var e;return e=M,M=(M=M+(t|=0)|0)+15&-16,0|e},stackRestore:function(t){M=t|=0},stackSave:function(){return 0|M}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{a:ut,b:function(t){c=t},c:l,d:function(t,e,r,n){ut("Assertion failed: "+A(t)+", at: "+[e?A(e):"unknown filename",r,n?A(n):"unknown function"])},e:function(t){return r.___errno_location&&(_[r.___errno_location()>>2]=t),t},f:q,g:function(t,e,r){y.set(y.subarray(e,e+r),t)},h:function(t){var e=q();if(t>2130706432)return!1;for(var r=Math.max(e,16777216);r<t;)r=r<=536870912?w(2*r,16777216):Math.min(w((3*r+2147483648)/4,16777216),2130706432);return!!Z(r)},i:function(t){ut("OOM")},j:G,k:W,l:Z,m:H,n:function(){var t=H();return r.extraStackTrace&&(t+="\n"+r.extraStackTrace()),W(t)},o:23680,p:23664},g),J=(r.___uremdi3=$.___uremdi3,r._bitshift64Lshr=$._bitshift64Lshr,r._bitshift64Shl=$._bitshift64Shl,r._calloc=$._calloc,r._compact=$._compact,r._destroyLinkedPolygon=$._destroyLinkedPolygon,r._edgeLengthKm=$._edgeLengthKm,r._edgeLengthM=$._edgeLengthM,r._emscripten_replace_memory=$._emscripten_replace_memory),tt=(r._experimentalH3ToLocalIj=$._experimentalH3ToLocalIj,r._experimentalLocalIjToH3=$._experimentalLocalIjToH3,r._free=$._free,r._geoToH3=$._geoToH3,r._getDestinationH3IndexFromUnidirectionalEdge=$._getDestinationH3IndexFromUnidirectionalEdge,r._getH3IndexesFromUnidirectionalEdge=$._getH3IndexesFromUnidirectionalEdge,r._getH3UnidirectionalEdge=$._getH3UnidirectionalEdge,r._getH3UnidirectionalEdgeBoundary=$._getH3UnidirectionalEdgeBoundary,r._getH3UnidirectionalEdgesFromHexagon=$._getH3UnidirectionalEdgesFromHexagon,r._getOriginH3IndexFromUnidirectionalEdge=$._getOriginH3IndexFromUnidirectionalEdge,r._getPentagonIndexes=$._getPentagonIndexes,r._getRes0Indexes=$._getRes0Indexes,r._h3Distance=$._h3Distance,r._h3GetBaseCell=$._h3GetBaseCell,r._h3GetFaces=$._h3GetFaces,r._h3IndexesAreNeighbors=$._h3IndexesAreNeighbors,r._h3IsPentagon=$._h3IsPentagon,r._h3IsResClassIII=$._h3IsResClassIII,r._h3IsValid=$._h3IsValid,r._h3Line=$._h3Line,r._h3LineSize=$._h3LineSize,r._h3SetToLinkedGeo=$._h3SetToLinkedGeo,r._h3ToCenterChild=$._h3ToCenterChild,r._h3ToChildren=$._h3ToChildren,r._h3ToGeo=$._h3ToGeo,r._h3ToGeoBoundary=$._h3ToGeoBoundary,r._h3ToParent=$._h3ToParent,r._h3UnidirectionalEdgeIsValid=$._h3UnidirectionalEdgeIsValid,r._hexAreaKm2=$._hexAreaKm2,r._hexAreaM2=$._hexAreaM2,r._hexRing=$._hexRing,r._i64Subtract=$._i64Subtract,r._kRing=$._kRing,r._kRingDistances=$._kRingDistances,r._llvm_round_f64=$._llvm_round_f64,r._malloc=$._malloc,r._maxFaceCount=$._maxFaceCount,r._maxH3ToChildrenSize=$._maxH3ToChildrenSize,r._maxKringSize=$._maxKringSize,r._maxPolyfillSize=$._maxPolyfillSize,r._maxUncompactSize=$._maxUncompactSize,r._memcpy=$._memcpy,r._memset=$._memset,r._numHexagons=$._numHexagons,r._pentagonIndexCount=$._pentagonIndexCount,r._polyfill=$._polyfill,r._res0IndexCount=$._res0IndexCount,r._round=$._round,r._sbrk=$._sbrk,r._sizeOfCoordIJ=$._sizeOfCoordIJ,r._sizeOfGeoBoundary=$._sizeOfGeoBoundary,r._sizeOfGeoCoord=$._sizeOfGeoCoord,r._sizeOfGeoPolygon=$._sizeOfGeoPolygon,r._sizeOfGeofence=$._sizeOfGeofence,r._sizeOfH3Index=$._sizeOfH3Index,r._sizeOfLinkedGeoPolygon=$._sizeOfLinkedGeoPolygon,r._uncompact=$._uncompact,r.establishStackSpace=$.establishStackSpace,r.stackAlloc=$.stackAlloc),et=r.stackRestore=$.stackRestore,rt=r.stackSave=$.stackSave;if(r.asm=$,r.cwrap=function(t,e,r,n){var i=(r=r||[]).every((function(t){return"number"===t}));return"string"!==e&&i&&!n?f(t):function(){return p(t,e,r,arguments)}},r.setValue=function(t,e,r,n){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":m[t>>0]=e;break;case"i16":v[t>>1]=e;break;case"i32":_[t>>2]=e;break;case"i64":z=[e>>>0,(F=e,+I(F)>=1?F>0?(0|L(+R(F/4294967296),4294967295))>>>0:~~+k((F-+(~~F>>>0))/4294967296)>>>0:0)],_[t>>2]=z[0],_[t+4>>2]=z[1];break;case"float":b[t>>2]=e;break;case"double":x[t>>3]=e;break;default:ut("invalid type for setValue: "+r)}},r.getValue=function(t,e,r){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return m[t>>0];case"i16":return v[t>>1];case"i32":case"i64":return _[t>>2];case"float":return b[t>>2];case"double":return x[t>>3];default:ut("invalid type for getValue: "+e)}return null},r.getTempRet0=l,N){V(N)||(Y=N,N=r.locateFile?r.locateFile(Y,a):a+Y),j++,r.monitorRunDependencies&&r.monitorRunDependencies(j);var nt=function(t){t.byteLength&&(t=new Uint8Array(t)),y.set(t,8),r.memoryInitializerRequest&&delete r.memoryInitializerRequest.response,function(t){if(j--,r.monitorRunDependencies&&r.monitorRunDependencies(j),0==j&&(null!==D&&(clearInterval(D),D=null),B)){var e=B;B=null,e()}}()},it=function(){i(N,nt,(function(){throw"could not load memory initializer "+N}))},ot=Q(N);if(ot)nt(ot.buffer);else if(r.memoryInitializerRequest){var at=function(){var t=r.memoryInitializerRequest,e=t.response;if(200!==t.status&&0!==t.status){var n=Q(r.memoryInitializerRequestURL);if(!n)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+t.status+", retrying "+N),void it();e=n.buffer}nt(e)};r.memoryInitializerRequest.response?setTimeout(at,0):r.memoryInitializerRequest.addEventListener("load",at)}else it()}function st(t){function e(){K||(K=!0,h||(O(P),O(M),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),C.unshift(t);var t;O(C)}()))}t=t||o,j>0||(!function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),T.unshift(t);var t;O(T)}(),j>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}function ut(t){throw r.onAbort&&r.onAbort(t),s(t+=""),u(t),h=!0,"abort("+t+"). Build with -s ASSERTIONS=1 for more info."}if(B=function t(){K||st(),K||(B=t)},r.run=st,r.abort=ut,r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return st(),t}("object"==typeof Ce?Ce:{}),Ie="number",ke={};[["sizeOfH3Index",Ie],["sizeOfGeoCoord",Ie],["sizeOfGeoBoundary",Ie],["sizeOfGeoPolygon",Ie],["sizeOfGeofence",Ie],["sizeOfLinkedGeoPolygon",Ie],["sizeOfCoordIJ",Ie],["h3IsValid","number",["number","number"]],["geoToH3","number",[Ie,Ie,"number"]],["h3ToGeo",null,["number","number",Ie]],["h3ToGeoBoundary",null,["number","number",Ie]],["maxKringSize",Ie,[Ie]],["kRing",null,["number","number",Ie,Ie]],["kRingDistances",null,["number","number",Ie,Ie,Ie]],["hexRing",null,["number","number",Ie,Ie]],["maxPolyfillSize",Ie,[Ie,"number"]],["polyfill",null,[Ie,"number",Ie]],["h3SetToLinkedGeo",null,[Ie,Ie,Ie]],["destroyLinkedPolygon",null,[Ie]],["compact",Ie,[Ie,Ie,Ie]],["uncompact",Ie,[Ie,Ie,Ie,Ie,"number"]],["maxUncompactSize",Ie,[Ie,Ie,"number"]],["h3IsPentagon","number",["number","number"]],["h3IsResClassIII","number",["number","number"]],["h3GetBaseCell",Ie,["number","number"]],["maxFaceCount",Ie,["number","number"]],["h3GetFaces",null,["number","number",Ie]],["h3ToParent","number",["number","number","number"]],["h3ToChildren",null,["number","number","number",Ie]],["h3ToCenterChild","number",["number","number","number"]],["maxH3ToChildrenSize",Ie,["number","number","number"]],["h3IndexesAreNeighbors","number",["number","number","number","number"]],["getH3UnidirectionalEdge","number",["number","number","number","number"]],["getOriginH3IndexFromUnidirectionalEdge","number",["number","number"]],["getDestinationH3IndexFromUnidirectionalEdge","number",["number","number"]],["h3UnidirectionalEdgeIsValid","number",["number","number"]],["getH3IndexesFromUnidirectionalEdge",null,["number","number",Ie]],["getH3UnidirectionalEdgesFromHexagon",null,["number","number",Ie]],["getH3UnidirectionalEdgeBoundary",null,["number","number",Ie]],["h3Distance",Ie,["number","number","number","number"]],["h3Line",Ie,["number","number","number","number",Ie]],["h3LineSize",Ie,["number","number","number","number"]],["experimentalH3ToLocalIj",Ie,["number","number","number","number",Ie]],["experimentalLocalIjToH3",Ie,["number","number",Ie,Ie]],["hexAreaM2",Ie,["number"]],["hexAreaKm2",Ie,["number"]],["edgeLengthM",Ie,["number"]],["edgeLengthKm",Ie,["number"]],["numHexagons",Ie,["number"]],["getRes0Indexes",null,[Ie]],["res0IndexCount",Ie],["getPentagonIndexes",null,[Ie,Ie]],["pentagonIndexCount",Ie]].forEach((function(t){ke[t[0]]=Ce.cwrap.apply(Ce,t)}));var Re=ke.sizeOfH3Index(),Le=ke.sizeOfGeoCoord(),je=ke.sizeOfGeoBoundary(),De=(ke.sizeOfGeoPolygon(),ke.sizeOfGeofence(),ke.sizeOfLinkedGeoPolygon()),Be=(ke.sizeOfCoordIJ(),"m"),Fe="km";function ze(t){if("number"!=typeof t||t<0||t>15||Math.floor(t)!==t)throw new Error("Invalid resolution: "+t)}function Ne(t){if("string"!=typeof t)return[0,0];var e=parseInt(t.substring(0,t.length-8),16);return[parseInt(t.substring(t.length-8),16),e]}function Ue(t){if(t>=0)return t.toString(16);var e=Ge(8,(t&=2147483647).toString(16));return e=(parseInt(e[0],16)+8).toString(16)+e.substring(1)}function Ve(t,e){return Ue(e)+Ge(8,Ue(t))}function Ge(t,e){for(var r=t-e.length,n="",i=0;i<r;i++)n+="0";return n+=e}function We(t){return[t,Ce.getTempRet0()]}function He(t){var e=We(t),r=e[0],n=e[1];return n?Ve(r,n):null}function qe(t,e,r){Ce.HEAPU32.set(Ne(t),e/4+2*r)}function Ze(t,e){for(var r=e.length,n=0;n<r;n++)qe(e[n],t,n)}function Xe(t){return 180*Ce.getValue(t,"double")/Math.PI}function Qe(t){return[Xe(t),Xe(t+8)]}function Ye(t){return[Xe(t+8),Xe(t)]}function Ke(t,e,r){for(var n=Ce.getValue(t,"i32"),i=t+8,o=[],a=e?Ye:Qe,s=0;s<2*n;s+=2)o.push(a(i+8*s));return r&&o.push(o[0]),o}function $e(t){var e=Ne(t),r=e[0],n=e[1];return Boolean(ke.h3IsPentagon(r,n))}function Je(t){var e=Ce._malloc(Le),r=Ne(t),n=r[0],i=r[1];ke.h3ToGeo(n,i,e);var o=Qe(e);return Ce._free(e),o}function tr(t,e){var r=Ce._malloc(je),n=Ne(t),i=n[0],o=n[1];ke.h3ToGeoBoundary(i,o,r);var a=Ke(r,e,e);return Ce._free(r),a}function er(t,e){if(!t||!t.length)return[];var r=t.length,n=Ce._calloc(r,Re);Ze(n,t);var i=Ce._calloc(De),o=i;ke.h3SetToLinkedGeo(n,r,i);var a=function(t,e){for(var r,n,i,o,a=[],s=e?Ye:Qe;t;){for(a.push(r=[]),n=Ce.getValue(t,"i8*");n;){for(r.push(i=[]),o=Ce.getValue(n,"i8*");o;)i.push(s(o)),o=Ce.getValue(o+16,"i8*");e&&i.push(i[0]),n=Ce.getValue(n+8,"i8*")}t=Ce.getValue(t+8,"i8*")}return a}(i,e);return ke.destroyLinkedPolygon(o),Ce._free(o),Ce._free(n),a}function rr(t,e){switch(ze(t),e){case Be:return ke.edgeLengthM(t);case Fe:return ke.edgeLengthKm(t);default:throw new Error("Unknown unit: "+e)}}function nr(t){return t*Math.PI/180}var ir=r(53);function or(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return ar(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ar(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function sr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}function ur(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function cr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ur(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var lr=cr(cr({},y.a.defaultProps),{},{getHexagons:{type:"accessor",value:function(t){return t.hexagons}}}),hr=function(t){a()(r,t);var e=sr(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"updateState",value:function(t){var e=t.props,r=(t.oldProps,t.changeFlags);if(r.dataChanged||r.updateTriggers&&r.updateTriggers.getHexagons){var n,i=e.data,o=e.getHexagons,a=[],s=Object(ir.a)(i),u=s.iterable,c=s.objectInfo,l=or(u);try{for(l.s();!(n=l.n()).done;){var h=n.value;c.index++;var f,p=or(er(o(h,c),!0));try{for(p.s();!(f=p.n()).done;){var d=f.value;a.push(this.getSubLayerRow({polygon:d},h,c.index))}}catch(t){p.e(t)}finally{p.f()}}}catch(t){l.e(t)}finally{l.f()}this.setState({polygons:a})}}},{key:"renderLayers",value:function(){var t=this.props,e=t.elevationScale,r=t.extruded,n=t.wireframe,i=t.filled,o=t.stroked,a=t.lineWidthScale,s=t.lineWidthMinPixels,u=t.lineWidthMaxPixels,c=t.lineJointRounded,l=t.lineMiterLimit,h=t.lineDashJustified,f=t.material,p=t.getFillColor,d=t.getLineColor,A=t.getLineWidth,g=t.getLineDashArray,m=t.getElevation,v=t.transitions,_=t.updateTriggers;return new(this.getSubLayerClass("cluster-region",y.a))({filled:i,wireframe:n,extruded:r,elevationScale:e,stroked:o,lineWidthScale:a,lineWidthMinPixels:s,lineWidthMaxPixels:u,lineJointRounded:c,lineMiterLimit:l,lineDashJustified:h,material:f,transitions:v,getFillColor:this.getSubLayerAccessor(p),getLineColor:this.getSubLayerAccessor(d),getLineWidth:this.getSubLayerAccessor(A),getLineDashArray:this.getSubLayerAccessor(g),getElevation:this.getSubLayerAccessor(m)},this.getSubLayerProps({id:"cluster-region",updateTriggers:_}),{data:this.state.polygons,getPolygon:function(t){return t.polygon}})}}]),r}(m.a);hr.defaultProps=lr,hr.layerName="H3ClusterLayer";var fr=r(24),pr=r.n(fr),dr=r(157);function Ar(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}function gr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function mr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gr(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function yr(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return vr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vr(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function vr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _r(t,e){e=void 0===e?t[0][0]:e;var r,n=yr(t);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=i[0]-e;o>180?i[0]-=360:o<-180&&(i[0]+=360)}}catch(t){n.e(t)}finally{n.f()}}function br(t,e,r){var n=Je(t),i=_()(n,2),o=i[0],a=i[1],s=e.length;_r(e,a);for(var u=e[0]===e[s-1]?s-1:s,c=0;c<u;c++)e[c][0]=Object(fe.f)(a,e[c][0],r),e[c][1]=Object(fe.f)(o,e[c][1],r)}function xr(t,e,r){var n=Je(t(e,r)),i=_()(n,2),o=i[0];return[i[1],o]}function wr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0,n=tr(t,!0);if(1!==e?br(t,n,e):_r(n),r){var i,o=new Float64Array(2*n.length),a=0,s=yr(n);try{for(s.s();!(i=s.n()).done;){var u=i.value;o[a++]=u[0],o[a++]=u[1]}}catch(t){s.e(t)}finally{s.f()}return o}return n}var Er=mr(mr({},y.a.defaultProps),{},{highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:function(t){return t.hexagon}},extruded:!0});delete Er.getLineDashArray;var Sr=function(t){a()(r,t);var e=Ar(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"shouldUpdateState",value:function(t){var e=t.changeFlags;return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}},{key:"updateState",value:function(t){var e=t.props,r=(t.oldProps,t.changeFlags);if(!0!==e.highPrecision&&(r.dataChanged||r.updateTriggers&&r.updateTriggers.getHexagon)){var n=this._calculateH3DataProps(e);this.setState(n)}this._updateVertices(this.context.viewport)}},{key:"_calculateH3DataProps",value:function(t){var e,r,n=-1,i=!1,o=!1,a=Object(ir.a)(t.data),s=a.iterable,u=a.objectInfo,c=yr(s);try{for(c.s();!(e=c.n()).done;){var l=e.value;u.index++;var h=t.getHexagon(l,u),f="string"!=typeof(r=h)?-1:parseInt(r.charAt(1),16);if(n<0){if(n=f,!t.highPrecision)break}else if(n!==f){o=!0;break}if($e(h)){i=!0;break}}}catch(t){c.e(t)}finally{c.f()}return{resolution:n,edgeLengthKM:n>=0?rr(n,Fe):0,hasMultipleRes:o,hasPentagon:i}}},{key:"_shouldUseHighPrecision",value:function(){if("auto"===this.props.highPrecision){var t=this.state,e=t.resolution,r=t.hasPentagon,n=t.hasMultipleRes;return this.context.viewport.resolution||n||r||e>=0&&e<=5}return this.props.highPrecision}},{key:"_updateVertices",value:function(t){if(!this._shouldUseHighPrecision()){var e=this.state,r=e.resolution,n=e.edgeLengthKM,i=e.centerHex;if(!(r<0)){var o=this.props.centerHexagon||function(t,e,r){var n=Ce._malloc(Le);Ce.HEAPF64.set([t,e].map(nr),n/8);var i=He(ke.geoToH3(n,r));return Ce._free(n),i}(t.latitude,t.longitude,r);if(i!==o){if(i){var a=(s=o,u=Ne(i),c=u[0],l=u[1],h=Ne(s),f=h[0],p=h[1],ke.h3Distance(c,l,f,p));if(a>=0&&a*n<10)return}var s,u,c,l,h,f,p,d=t.distanceScales.unitsPerMeter,A=wr(o),g=Je(o),m=_()(g,2),y=m[0],v=m[1],b=t.projectFlat([v,y]),x=_()(b,2),w=x[0],E=x[1];A=A.map((function(e){var r=t.projectFlat(e);return[(r[0]-w)/d[0],(r[1]-E)/d[1]]})),this.setState({centerHex:o,vertices:A})}}}}},{key:"renderLayers",value:function(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}},{key:"_getForwardProps",value:function(){var t=this.props,e=t.elevationScale,r=t.material,n=t.coverage,i=t.extruded,o=t.wireframe,a=t.stroked,s=t.filled,u=t.lineWidthUnits,c=t.lineWidthScale,l=t.lineWidthMinPixels,h=t.lineWidthMaxPixels,f=t.getFillColor,p=t.getElevation,d=t.getLineColor,A=t.getLineWidth,g=t.transitions,m=t.updateTriggers;return{elevationScale:e,extruded:i,coverage:n,wireframe:o,stroked:a,filled:s,lineWidthUnits:u,lineWidthScale:c,lineWidthMinPixels:l,lineWidthMaxPixels:h,material:r,getElevation:p,getFillColor:f,getLineColor:d,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:m.getFillColor,getElevation:m.getElevation,getLineColor:m.getLineColor,getLineWidth:m.getLineWidth}}}},{key:"_renderPolygonLayer",value:function(){var t=this.props,e=t.data,r=t.getHexagon,n=t.updateTriggers,i=t.coverage,o=this.getSubLayerClass("hexagon-cell-hifi",y.a),a=this._getForwardProps();return a.updateTriggers.getPolygon=function(t,e){return null==t?e:"object"===pr()(t)?mr(mr({},t),{},{coverage:e}):{getHexagon:t,coverage:e}}(n.getHexagon,i),new o(a,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:a.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:function(t,e){return wr(r(t,e),i,!0)}})}},{key:"_renderColumnLayer",value:function(){var t=this.props,e=t.data,r=t.getHexagon,n=t.updateTriggers,i=this.getSubLayerClass("hexagon-cell",dr.a),o=this._getForwardProps();return o.updateTriggers.getPosition=n.getHexagon,new i(o,this.getSubLayerProps({id:"hexagon-cell",updateTriggers:o.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:xr.bind(null,r)})}}]),r}(m.a);Sr.defaultProps=Er,Sr.layerName="H3HexagonLayer";var Or=r(62),Tr=r(14),Pr=r(224),Mr=r(220),Cr=r(239),Ir=r(295),kr=r(176),Rr=r(225);function Lr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function jr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Lr(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Dr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var Br=function(t){a()(r,t);var e=Dr(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"getShaders",value:function(){var t=Se()(l()(r.prototype),"getShaders",this).call(this);return t.modules.push(Ir.a),jr(jr({},t),{},{vs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nuniform float sizeScale;\nuniform bool composeModelMatrix;\nuniform bool u_pickFeatureIds;\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec4 uvRegions;\nin vec3 featureIdsPickingColors;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin mat3 instanceModelMatrix;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\n\nvoid main(void) {\n  vec2 uv = fract(texCoords) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;\n\n  geometry.uv = uv;\n  geometry.uv = texCoords;\n\n  if (u_pickFeatureIds) {\n    geometry.pickingColor = featureIdsPickingColors;\n  } else {\n    geometry.pickingColor = instancePickingColors;\n  }\n\n  #ifdef MODULE_PBR\n    #ifdef HAS_NORMALS\n      pbr_vNormal = project_normal(instanceModelMatrix * normals);\n      geometry.normal = pbr_vNormal;\n    #endif\n\n    #ifdef HAS_UV\n      pbr_vUV = uv;\n    #else\n      pbr_vUV = vec2(0., 0.);\n    #endif\n    geometry.uv = pbr_vUV;\n  #endif\n\n  vTexCoord = uv;\n  cameraPosition = project_uCameraPosition;\n  normals_commonspace = project_normal(instanceModelMatrix * normals);\n  vColor = vec4(colors * instanceColors.rgb, instanceColors.a);\n  geometry.normal = normals_commonspace;\n\n  vec3 pos = (instanceModelMatrix * positions) * sizeScale;\n  vec3 projectedPosition = project_position(positions);\n  position_commonspace = vec4(projectedPosition, 1.0);\n  gl_Position = project_common_position_to_clipspace(position_commonspace);\n\n  geometry.position = position_commonspace;\n\n  #ifdef MODULE_PBR\n    pbr_vPosition = geometry.position.xyz;\n  #endif\n\n  DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n  DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n  \n#ifdef MODULE_PBR\n\n  fragColor = vColor * pbr_filterColor(vec4(0));\n  geometry.uv = pbr_vUV;\n  fragColor.a *= opacity;\n\n#else\n\n  geometry.uv = vTexCoord;\n\n  vec3 normal;\n  if (flatShading) {\n#ifdef DERIVATIVES_AVAILABLE\n    normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n    normal = vec3(0.0, 0.0, 1.0);\n#endif\n  } else {\n    normal = normals_commonspace;\n  }\n\n  vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n  vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n  fragColor = vec4(lightColor, color.a * opacity);\n\n#endif\n\n  DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n"})}},{key:"initializeState",value:function(){var t=this.props.featureIds;Se()(l()(r.prototype),"initializeState",this).call(this),t&&this.state.attributeManager.add({featureIdsPickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}},{key:"updateState",value:function(t){var e=t.props,n=t.oldProps,i=t.changeFlags;Se()(l()(r.prototype),"updateState",this).call(this,{props:e,oldProps:n,changeFlags:i}),e.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(e.pbrMaterial)}},{key:"draw",value:function(t){var e=this.props.featureIds;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.getUniforms().project_uCameraPosition,u_pickFeatureIds:Boolean(e)}),Se()(l()(r.prototype),"draw",this).call(this,t))}},{key:"getModel",value:function(t){var e,r=this.props,n=r.id,i=r.pbrMaterial,o=this.parseMaterial(i,t),a=this.getShaders();return(e=t.attributes).COLOR_0||e.colors||(e.colors={constant:!0,value:new Float32Array([1,1,1])}),e.uvRegions||(e.uvRegions={constant:!0,value:new Float32Array([0,0,1,1])}),new kr.a(this.context.gl,jr(jr({},this.getShaders()),{},{id:n,geometry:t,defines:jr(jr({},a.defines),null==o?void 0:o.defines),parameters:null==o?void 0:o.parameters,isInstanced:!0}))}},{key:"updatePbrMaterialUniforms",value:function(t){var e=this.state.model;if(e){var r=this.props.mesh,n=this.parseMaterial(t,r);e.setUniforms(n.uniforms)}}},{key:"parseMaterial",value:function(t,e){var r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return new Cr.a(this.context.gl,{attributes:{NORMAL:e.attributes.normals,TEXCOORD_0:e.attributes.texCoords},material:jr({unlit:r},t),pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1})}},{key:"calculateFeatureIdsPickingColors",value:function(t){for(var e=this.props.featureIds,r=new Uint8ClampedArray(e.length*t.size),n=[],i=0;i<e.length;i++)this.encodePickingColor(e[i],n),r[3*i]=n[0],r[3*i+1]=n[1],r[3*i+2]=n[2];t.value=r}}]),r}(Rr.a);Br.layerName="_MeshLayer",Br.defaultProps={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}};var Fr=r(206),zr=r(4),Nr=r(21);Math.max(6378137,6378137,6356752.314245179);const Ur=t=>t,Vr=new Z.a;function Gr(t,e,r=Ur){return Object(bt.f)(t)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z),e}function Wr(t,e,r=Ur){return Object(bt.f)(e)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]),e}const Hr=new Z.a,qr=new Z.a,Zr=new Z.a;const Xr=new Z.a,Qr={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Yr={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Kr={east:new Z.a,north:new Z.a,up:new Z.a,west:new Z.a,south:new Z.a,down:new Z.a},$r=new Z.a,Jr=new Z.a,tn=new Z.a;function en(t,e,r,n,i,o){const a=Qr[e]&&Qr[e][r];let s,u,c;Object(_t.a)(a&&(!n||n===a));const l=Xr.copy(i);if(Object(bt.d)(l.x,0,1e-14)&&Object(bt.d)(l.y,0,1e-14)){const t=Math.sign(l.z);s=$r.fromArray(Yr[e]),"east"!==e&&"west"!==e&&s.scale(t),u=Jr.fromArray(Yr[r]),"east"!==r&&"west"!==r&&u.scale(t),c=tn.fromArray(Yr[n]),"east"!==n&&"west"!==n&&c.scale(t)}else{const{up:i,east:o,north:a}=Kr;o.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),a.copy(i).cross(o);const{down:h,west:f,south:p}=Kr;h.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(a).scale(-1),s=Kr[e],u=Kr[r],c=Kr[n]}return o[0]=s.x,o[1]=s.y,o[2]=s.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=c.x,o[9]=c.y,o[10]=c.z,o[11]=0,o[12]=l.x,o[13]=l.y,o[14]=l.z,o[15]=1,o}const rn=new Z.a,nn=new Z.a,on=new Z.a,an=new Z.a,sn=new Z.a,un=new Z.a;let cn;class ln{static get WGS84(){return cn=cn||new ln(6378137,6378137,6356752.314245179),cn}constructor(t=0,e=0,r=0){Object(_t.a)(t>=0),Object(_t.a)(e>=0),Object(_t.a)(r>=0),this.radii=new Z.a(t,e,r),this.radiiSquared=new Z.a(t*t,e*e,r*r),this.radiiToTheFourth=new Z.a(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Z.a(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Z.a(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),this.centerToleranceSquared=Ct.a.EPSILON1,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=nn,n=on,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){un.from(t);const r=this.scaleToGeodeticSurface(un,an);if(!r)return;const n=this.geodeticSurfaceNormal(r,nn),i=sn;i.copy(un).subtract(r);const o=Math.atan2(n.y,n.x),a=Math.asin(n.z),s=Math.sign(Nr.e(i,un))*Nr.h(i);return Wr([o,a,s],e,bt.b._cartographicRadians?Ur:bt.i)}eastNorthUpToFixedFrame(t,e=new Mt.a){return en(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new Mt.a){return en(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return rn.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=Vr){return Gr(t,e,bt.b._cartographicRadians?Ur:bt.j)}(t),n=r[0],i=r[1],o=Math.cos(i);return rn.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),rn.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return rn.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new Z.a){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;Hr.from(t);const a=t.x,s=t.y,u=t.z,c=n.x,l=n.y,h=n.z,f=a*a*c*c,p=s*s*l*l,d=u*u*h*h,A=f+p+d,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;const m=qr;if(m.copy(t).scale(g),A<o)return m.to(r);const y=i.x,v=i.y,_=i.z,b=Zr;b.set(m.x*y*2,m.y*v*2,m.z*_*2);let x,w,E,S,O=(1-g)*t.len()/(.5*b.len()),T=0;do{O-=T,x=1/(1+O*y),w=1/(1+O*v),E=1/(1+O*_);const t=x*x,e=w*w,r=E*E;S=f*t+p*e+d*r-1,T=S/(-2*(f*(t*x)*y+p*(e*w)*v+d*(r*E)*_))}while(Math.abs(S)>Ct.a.EPSILON12);return Hr.scale([x,w,E]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){an.from(t);const r=an.x,n=an.y,i=an.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return an.multiplyScalar(a).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return an.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return an.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){Object(_t.a)(Object(bt.d)(this.radii.x,this.radii.y,Ct.a.EPSILON15)),Object(_t.a)(this.radii.z>0),an.from(t);const n=an.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return an.set(0,0,n).to(r)}}var hn=r(137),fn=r(97),pn=r(20);class dn{constructor(t,e,r){this.item=t,this.previous=e,this.next=r}}class An{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){const e=new dn(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,++this._length}}function gn(t){return null!=t}class mn{constructor(){Object(zr.a)(this,"_list",void 0),Object(zr.a)(this,"_sentinel",void 0),Object(zr.a)(this,"_trimTiles",void 0),this._list=new An,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;gn(e)&&this._list.splice(this._sentinel,e)}add(t,e,r){gn(e._cacheNode)||(e._cacheNode=this._list.add(e),r&&r(t,e))}unloadTile(t,e,r){const n=e._cacheNode;gn(n)&&(this._list.remove(n),e._cacheNode=void 0,r&&r(t,e))}unloadTiles(t,e){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,i=1024*t.maximumMemoryUsage*1024,o=this._sentinel;let a=n.head;for(;a!==o&&(t.gpuMemoryUsageInBytes>i||r);){const r=a.item;a=a.next,this.unloadTile(t,r,e)}}trim(){this._trimTiles=!0}}const yn=new Z.a,vn=new Z.a,_n=new Pt([new Et,new Et,new Et,new Et,new Et,new Et]);function bn(t,e){const{cameraDirection:r,cameraUp:n,height:i}=t,{metersPerUnit:o}=t.distanceScales,a=[t.longitude,t.latitude,0],s=ln.WGS84.cartographicToCartesian(a,new Z.a),u=ln.WGS84.eastNorthUpToFixedFrame(s),c=t.unprojectPosition(t.cameraPosition),l=ln.WGS84.cartographicToCartesian(c,new Z.a),h=new Z.a(u.transformAsVector(new Z.a(r).scale(o))).normalize(),f=new Z.a(u.transformAsVector(new Z.a(n).scale(o))).normalize();return function(t,e){const r=t.getFrustumPlanes();let n=0;for(const i in r){const o=r[i],a=o.normal.dot(t.center);vn.copy(o.normal).scale(o.distance-a).add(t.center);const s=t.unprojectPosition(vn),u=ln.WGS84.cartographicToCartesian(s,new Z.a);_n.planes[n++].fromPointNormal(u,yn.copy(e).subtract(u))}}(t,s),{camera:{position:l,direction:h,up:f},viewport:t,height:i,cullingVolume:_n,frameNumber:e,sseDenominator:1.15}}const xn=new Z.a;function wn(t){const{halfAxes:e,radius:r,width:n,height:i}=t;if(e){const t=function(t){t.getColumn(0,xn);const e=t.getColumn(1),r=t.getColumn(2);return xn.add(e).add(r).len()}(e);return Math.log2(6356752.314245179/t)}if(r)return Math.log2(6356752.314245179/r);if(i&&n){return(Math.log2(6378137/n)+Math.log2(6378137/i))/2}return 1}const En=0,Sn=1,On=3,Tn=4,Pn=5,Mn=1,Cn=2,In="empty",kn="scenegraph",Rn="pointcloud",Ln="mesh",jn="I3S",Dn="TILES3D",Bn="geometricError",Fn=1;function zn(t){return null!=t}const Nn=new Z.a,Un=new Z.a,Vn=new Z.a;function Gn(t,e,r){if(Object(fn.a)(t,"3D Tile: boundingVolume must be defined"),t.box)return function(t,e,r){const n=new Z.a(t[0],t[1],t[2]);e.transform(n,n);let i=[];if(10===t.length){const e=t.slice(3,6),r=new rt.a;r.fromArray(t,6);const n=new Z.a([1,0,0]),o=new Z.a([0,1,0]),a=new Z.a([0,0,1]);n.transformByQuaternion(r),n.scale(e[0]),o.transformByQuaternion(r),o.scale(e[1]),a.transformByQuaternion(r),a.scale(e[2]),i=[...n.toArray(),...o.toArray(),...a.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const o=e.transformAsVector(i.slice(0,3)),a=e.transformAsVector(i.slice(3,6)),s=e.transformAsVector(i.slice(6,9)),u=new et.a([o[0],o[1],o[2],a[0],a[1],a[2],s[0],s[1],s[2]]);if(zn(r))return r.center=n,r.halfAxes=u,r;return new vt(n,u)}(t.box,e,r);if(t.region){const[e,r,n,i,o,a]=t.region,s=ln.WGS84.cartographicToCartesian([Object(bt.c)(e),Object(bt.c)(i),o],Un),u=ln.WGS84.cartographicToCartesian([Object(bt.c)(n),Object(bt.c)(r),a],Vn),c=(new Z.a).addVectors(s,u).multiplyScalar(.5),l=(new Z.a).subVectors(s,u).len()/2;return Wn([c[0],c[1],c[2],l],new Mt.a)}if(t.sphere)return Wn(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Wn(t,e,r){const n=new Z.a(t[0],t[1],t[2]);e.transform(n,n);const i=e.getScale(Nn),o=Math.max(Math.max(i[0],i[1]),i[2]),a=t[3]*o;return zn(r)?(r.center=n,r.radius=a,r):new tt(n,a)}new Z.a,new Z.a,new Mt.a,new Z.a,new Z.a,new Z.a;function Hn(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return function(t,e){const r=t*e;return 1-Math.exp(-r*r)}(e,r)*n}return 0}const qn=Math.PI/2;function Zn([t,e,r]){const n=Object(bt.j)(t),i=Object(bt.j)(e),o=1+r/6378137,a=o*Math.cos(i);return[t=a*Math.cos(n),e=a*Math.sin(n),r=o*Math.sin(i)]}function Xn(t,e){const[r,n,i=0]=t,[o,a,s=0]=e,u=Zn([o,a,s]),c=Zn([r,n,i]),l=c[0]-u[0],h=c[1]-u[1],f=c[2]-u[2];return l*l+h*h+f*f}function Qn(t,e){const r=e.viewport,n=t.header.mbs[1],i=[t.header.mbs[0],n,t.header.mbs[2]],o=t.header.mbs[3]/6378137,a=Xn(r.unprojectPosition(r.cameraPosition),i)-o*o;return a<=0?170141175e30:function(t){const{projectionMatrix:e}=t.viewport;return e[5]}(e)*o/Math.sqrt(a)*300}class Yn{constructor(t=0){this._array=new Array(t),this._map=new Map,this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Object(fn.a)(t<this._array.length),this._array[t]}set(t,e){Object(fn.a)(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Object(fn.a)(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Object(fn.a)(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Kn={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class $n{constructor(t){Object(zr.a)(this,"options",void 0),Object(zr.a)(this,"root",void 0),Object(zr.a)(this,"requestedTiles",void 0),Object(zr.a)(this,"selectedTiles",void 0),Object(zr.a)(this,"emptyTiles",void 0),Object(zr.a)(this,"_traversalStack",void 0),Object(zr.a)(this,"_emptyTraversalStack",void 0),Object(zr.a)(this,"_frameNumber",void 0),this.options={...Kn,...t},this._traversalStack=new Yn,this._emptyTraversalStack=new Yn,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(t,e,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){const t=r.pop();let n=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),n=this.updateAndPushChildren(t,e,r,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const i=t.parent,o=Boolean(!i||i._shouldRefine),a=!n;t.hasRenderContent?t.refine===Mn?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===Cn&&(this.loadTile(t,e),a&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),a&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=n&&o}this.options.onTraversalEnd(e)}updateChildTiles(t,e){const r=t.children;for(const t of r)this.updateTile(t,e);return!0}updateAndPushChildren(t,e,r,n){const{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));const s=t.refine===Cn&&t.hasRenderContent&&!o;let u=!1,c=!0;for(const t of a)if(t._selectionDepth=n,t.isVisibleAndInRequestVolume?(r.find(t)&&r.delete(t),r.push(t),u=!0):(s||i)&&(this.loadTile(t,e),this.touchTile(t,e)),s){let r;if(r=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),c=c&&r,!c)return!1}return u||(c=!1),c}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e,r=!1,n=!1){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:!(!n&&!t.isVisibleAndInRequestVolume)&&this.shouldRefine(t,e,r))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,r){let n=t._screenSpaceError;return r&&(n=t.getScreenSpaceError(e,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(t,e){const r=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap){this.options.viewportTraversersMap[t]===e.viewport.id&&r.push(t)}else r.push(e.viewport.id);t.updateVisibility(e,r)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let r=!1;for(const n of t.children)n.updateVisibility(e),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,e){let r=!0;const n=this._emptyTraversalStack;for(n.push(t);n.length>0&&r;){const t=n.pop();if(this.updateTile(t,e),t.isVisibleAndInRequestVolume||this.loadTile(t,e),this.touchTile(t,e),!t.hasRenderContent&&this.canTraverse(t,e,!1,!0)){const e=t.children;for(const t of e)n.find(t)&&n.delete(t),n.push(t)}else t.contentAvailable||(r=!1)}return r}}const Jn=new Z.a;class ti{constructor(t,e,r,n=""){Object(zr.a)(this,"tileset",void 0),Object(zr.a)(this,"header",void 0),Object(zr.a)(this,"id",void 0),Object(zr.a)(this,"url",void 0),Object(zr.a)(this,"parent",void 0),Object(zr.a)(this,"refine",void 0),Object(zr.a)(this,"type",void 0),Object(zr.a)(this,"contentUrl",void 0),Object(zr.a)(this,"lodMetricType",void 0),Object(zr.a)(this,"lodMetricValue",void 0),Object(zr.a)(this,"boundingVolume",void 0),Object(zr.a)(this,"content",void 0),Object(zr.a)(this,"contentState",void 0),Object(zr.a)(this,"gpuMemoryUsageInBytes",void 0),Object(zr.a)(this,"children",void 0),Object(zr.a)(this,"depth",void 0),Object(zr.a)(this,"viewportIds",void 0),Object(zr.a)(this,"transform",void 0),Object(zr.a)(this,"userData",void 0),Object(zr.a)(this,"computedTransform",void 0),Object(zr.a)(this,"hasEmptyContent",void 0),Object(zr.a)(this,"hasTilesetContent",void 0),Object(zr.a)(this,"traverser",void 0),Object(zr.a)(this,"_cacheNode",void 0),Object(zr.a)(this,"_frameNumber",void 0),Object(zr.a)(this,"_lodJudge",void 0),Object(zr.a)(this,"_expireDate",void 0),Object(zr.a)(this,"_expiredContent",void 0),Object(zr.a)(this,"_shouldRefine",void 0),Object(zr.a)(this,"_distanceToCamera",void 0),Object(zr.a)(this,"_centerZDepth",void 0),Object(zr.a)(this,"_screenSpaceError",void 0),Object(zr.a)(this,"_visibilityPlaneMask",void 0),Object(zr.a)(this,"_visible",void 0),Object(zr.a)(this,"_inRequestVolume",void 0),Object(zr.a)(this,"_stackLength",void 0),Object(zr.a)(this,"_selectionDepth",void 0),Object(zr.a)(this,"_touchedFrame",void 0),Object(zr.a)(this,"_visitedFrame",void 0),Object(zr.a)(this,"_selectedFrame",void 0),Object(zr.a)(this,"_requestedFrame",void 0),Object(zr.a)(this,"_priority",void 0),Object(zr.a)(this,"_contentBoundingVolume",void 0),Object(zr.a)(this,"_viewerRequestVolume",void 0),Object(zr.a)(this,"_initialTransform",void 0),this.header=e,this.tileset=t,this.id=n||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=En,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new $n({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Mt.a,this.transform=new Mt.a,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===On||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===En}get contentExpired(){return this.contentState===Tn}get contentFailed(){return this.contentState===Pn}getScreenSpaceError(t,e){switch(this.tileset.type){case jn:return Qn(this,t);case Dn:return function(t,e,r){const n=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,o=r?i:t.lodMetricValue;if(0===o)return 0;const a=Math.max(t._distanceToCamera,1e-7),{height:s,sseDenominator:u}=e,{viewDistanceScale:c}=n.options;let l=o*s*(c||1)/(a*u);return l-=Hn(n,a),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,r=this.refine===Mn||e;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===En)return-1;const n=this.parent,i=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,o=t.root?t.root._screenSpaceError:0;return Math.max(o-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Sn;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=En,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await Object(Fr.a)(e,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=On,this._onContentLoaded(),!0}catch(t){throw this.contentState=Pn,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=En,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:Pt.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,n),this._visible=this._visibilityPlaneMask!==Pt.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:r}=t,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return Jn.subVectors(e.center,t.position),t.direction.dot(Jn)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Tn,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new Mt.a(t.transform):new Mt.a;const e=this.parent,r=this.tileset,n=e&&e.computedTransform?e.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Mt.a(n).multiplyRight(this.transform);const i=e&&e._initialTransform?e._initialTransform.clone():new Mt.a;this._initialTransform=new Mt.a(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=En,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=Pt.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Cn}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(t){this.boundingVolume=Gn(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=Gn(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Gn(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new Mt.a){const e=t.clone().multiplyRight(this.transform);!e.equals(this.computedTransform)&&(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(e=this.tileset.tileset).asset&&e.asset.gltfUpAxis||"Y"}}var e}}class ei extends $n{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const r=t.children.length>0;if(t.hasTilesetContent&&r){const r=t.children[0];return this.updateTileVisibility(r,e),void(t._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const n=t.refine===Cn,i=t._optimChildrenWithinParent===Fn;n&&i&&r&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:r}=t;return!(!r||r.hasTilesetContent||r.refine!==Mn)&&!this.shouldRefine(t,e,!0)}}const ri="REQUESTED",ni="COMPLETED",ii="ERROR";class oi{constructor(){Object(zr.a)(this,"_statusMap",void 0),this._statusMap={}}add(t,e,r,n){this._statusMap[e]||(this._statusMap[e]={request:t,callback:r,key:e,frameState:n,status:ri},t().then(t=>{this._statusMap[e].status=ni,this._statusMap[e].callback(t,n)}).catch(t=>{this._statusMap[e].status=ii,r(t)}))}update(t,e){this._statusMap[t]&&(this._statusMap[t].frameState=e)}find(t){return this._statusMap[t]}}class ai extends $n{constructor(t){super(t),Object(zr.a)(this,"_tileManager",void 0),this._tileManager=new oi}shouldRefine(t,e){return t._lodJudge=function(t,e){const r=e.viewport,n=r.metersPerPixel,i=t.header.mbs[1],o=t.header.mbs[0],a=t.header.mbs[2],s=t.header.mbs[3],{height:u,width:c,latitude:l,longitude:h}=r,f=[h,l],p=[o,i,a],d=[h,i],A=[o,l],g=Math.sqrt(u*u+c*c)*n[0],m=.5*u+s/6378137,y=.5*c+s/6378137;if(Xn(f,p)>g+s/6378137)return"OUT";if(Xn(f,d)>m)return"OUT";if(Xn(f,A)>y)return"OUT";if(0===t.lodMetricValue)return"DIG";let v=Qn(t,e);return v*=qn,v<.5?"OUT":!t.header.children||v<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const r=t.header.children||[],n=t.children,i=t.tileset;for(const o of r){const r=`${o.id}-${e.viewport.id}`,a=n&&n.find(t=>t.id===r);if(a)a&&this.updateTile(a,e);else{let n=()=>this._loadTile(o.id,i);this._tileManager.find(r)?this._tileManager.update(r,e):(i.tileset.nodePages&&(n=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(n,r,e=>this._onTileLoad(e,t,r),e))}}return!1}async _loadTile(t,e){const{loader:r}=e,n=e.getTileUrl(`${e.url}/nodes/${t}`),i={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await Object(Fr.a)(n,r,i)}_onTileLoad(t,e,r){const n=new ti(e.tileset,t,e,r);e.children.push(n);const i=this._tileManager.find(n.id).frameState;this.updateTile(n,i),this._frameNumber===i.frameNumber&&this.executeTraversal(n,i)}}const si={description:"",ellipsoid:ln.WGS84,modelMatrix:new Mt.a,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}};class ui{constructor(t,e){Object(zr.a)(this,"options",void 0),Object(zr.a)(this,"loadOptions",void 0),Object(zr.a)(this,"type",void 0),Object(zr.a)(this,"tileset",void 0),Object(zr.a)(this,"loader",void 0),Object(zr.a)(this,"url",void 0),Object(zr.a)(this,"basePath",void 0),Object(zr.a)(this,"modelMatrix",void 0),Object(zr.a)(this,"ellipsoid",void 0),Object(zr.a)(this,"lodMetricType",void 0),Object(zr.a)(this,"lodMetricValue",void 0),Object(zr.a)(this,"refine",void 0),Object(zr.a)(this,"root",void 0),Object(zr.a)(this,"roots",void 0),Object(zr.a)(this,"asset",void 0),Object(zr.a)(this,"description",void 0),Object(zr.a)(this,"properties",void 0),Object(zr.a)(this,"extras",void 0),Object(zr.a)(this,"attributions",void 0),Object(zr.a)(this,"credits",void 0),Object(zr.a)(this,"stats",void 0),Object(zr.a)(this,"traverseCounter",void 0),Object(zr.a)(this,"geometricError",void 0),Object(zr.a)(this,"selectedTiles",void 0),Object(zr.a)(this,"cartographicCenter",void 0),Object(zr.a)(this,"cartesianCenter",void 0),Object(zr.a)(this,"zoom",void 0),Object(zr.a)(this,"boundingVolume",void 0),Object(zr.a)(this,"gpuMemoryUsageInBytes",void 0),Object(zr.a)(this,"dynamicScreenSpaceErrorComputedDensity",void 0),Object(zr.a)(this,"_traverser",void 0),Object(zr.a)(this,"_cache",void 0),Object(zr.a)(this,"_requestScheduler",void 0),Object(zr.a)(this,"_frameNumber",void 0),Object(zr.a)(this,"_queryParamsString",void 0),Object(zr.a)(this,"_queryParams",void 0),Object(zr.a)(this,"_extensionsUsed",void 0),Object(zr.a)(this,"_tiles",void 0),Object(zr.a)(this,"_pendingCount",void 0),Object(zr.a)(this,"lastUpdatedVieports",void 0),Object(zr.a)(this,"_requestedTiles",void 0),Object(zr.a)(this,"_emptyTiles",void 0),Object(zr.a)(this,"frameStateData",void 0),Object(zr.a)(this,"maximumMemoryUsage",void 0),Object(fn.a)(t),this.options={...si,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||pn.b.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new mn,this._requestScheduler=new he.a({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new hn.a({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(t){const e=[];for(const r of Object.keys(t))e.push(`${r}=${t[r]}`);switch(e.length){case 0:return"";case 1:return`?${e[0]}`;default:return`?${e.join("&")}`}}(this._queryParams)),this._queryParamsString}setProps(t){this.options={...this.options,...t}}setOptions(t){this.options={...this.options,...t}}getTileUrl(t){return t.startsWith("data:")?t:`${t}${this.queryParams}`}hasExtension(t){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(t)>-1)}update(t){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t instanceof Array||(t=[t]),this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const e=[];for(const r of t){const t=r.id;this._needTraverse(t)?e.push(t):this.traverseCounter--}for(const r of t){const t=r.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!e.includes(t))continue;const n=bn(r,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[e],n=Object.values(this._traverser.selectedTiles);r.selectedTiles=n,r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const r=new Set(t.map(t=>t.id)),n=new Set(e.map(t=>t.id));let i=t.filter(t=>!n.has(t.id)).length>0;return i=i||e.filter(t=>!r.has(t.id)).length>0,i}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,e)=>t._unloadTile(e))}_updateStats(){let t=0,e=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(e+=r.content.pointCount));this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=t,this.stats.get("Points").count=e}_initializeTileSet(t){this.root=this._initializeTileHeaders(t,null),this.type===Dn&&this._initializeCesiumTileset(t),this.type===jn&&this._initializeI3STileset(),this._calculateViewProps()}_calculateViewProps(){const t=this.root;Object(fn.a)(t);const{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Z.a,void(this.zoom=1);this.cartographicCenter=ln.WGS84.cartesianToCartographic(e,new Z.a),this.cartesianCenter=e,this.zoom=wn(t.boundingVolume)}_initializeStats(){this.stats.get("Tiles In Tileset(s)"),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(t,e){const r=new ti(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===Dn){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get("Tiles In Tileset(s)").incrementCount();const r=e.header.children||[];for(const n of r){const r=new ti(this,n,e);e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case Dn:t=ei;break;case jn:t=ai;break;default:t=$n}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e)}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get("Failed Tile Loads").incrementCount();const r=e.message||e.toString(),n=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,n)}_onTileLoad(t,e){e&&(t&&t.content&&function(t,e){Object(fn.a)(t),Object(fn.a)(e);const{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:i,boundingVolume:{center:o}}=t;let a=new Mt.a(i);switch(r&&a.translate(r),n){case"Z":break;case"Y":const t=(new Mt.a).rotateX(Math.PI/2);a=a.multiplyRight(t);break;case"X":const e=(new Mt.a).rotateY(-Math.PI/2);a=a.multiplyRight(e)}e.isQuantized&&a.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const s=new Z.a(o);e.cartesianModelMatrix=a,e.cartesianOrigin=s;const u=ln.WGS84.cartesianToCartographic(s,new Z.a),c=ln.WGS84.eastNorthUpToFixedFrame(s).invert();e.cartographicModelMatrix=c.multiplyRight(a),e.cartographicOrigin=u,e.modelMatrix=e.cartographicModelMatrix}(t,t.content),this._addTileToCache(t),this.options.onTileLoad(t))}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(t){this._cache.add(this,t,e=>e._updateCacheStats(t))}_updateCacheStats(t){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=t.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.content&&t.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const r of e.children)t.push(r);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,r=[];for(r.push(e);r.length>0;){t=r.pop();for(const e of t.children)r.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeCesiumTileset(t){if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed,this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}const ci={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect"};Object.keys(ci);function li(t,e,r){Object(fn.a)(t instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(t,e,r);return n.decode(i)}var hi=r(175);const fi={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},pi={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...fi},di={[fi.DOUBLE]:Float64Array,[fi.FLOAT]:Float32Array,[fi.UNSIGNED_SHORT]:Uint16Array,[fi.UNSIGNED_INT]:Uint32Array,[fi.UNSIGNED_BYTE]:Uint8Array,[fi.BYTE]:Int8Array,[fi.SHORT]:Int16Array,[fi.INT]:Int32Array},Ai={DOUBLE:fi.DOUBLE,FLOAT:fi.FLOAT,UNSIGNED_SHORT:fi.UNSIGNED_SHORT,UNSIGNED_INT:fi.UNSIGNED_INT,UNSIGNED_BYTE:fi.UNSIGNED_BYTE,BYTE:fi.BYTE,SHORT:fi.SHORT,INT:fi.INT};class gi{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in di){if(di[e]===t)return e}throw new Error("Failed to convert GL type")}static fromName(t){const e=Ai[t];if(!e)throw new Error("Failed to convert GL type");return e}static getArrayType(t){switch(t){case fi.UNSIGNED_SHORT_5_6_5:case fi.UNSIGNED_SHORT_4_4_4_4:case fi.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=di[t];if(!e)throw new Error("Failed to convert GL type");return e}}static getByteSize(t){return gi.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(gi.getArrayType(t))}static createTypedArray(t,e,r=0,n){return void 0===n&&(n=(e.byteLength-r)/gi.getByteSize(t)),new(gi.getArrayType(t))(e,r,n)}}class mi{constructor(t,e){this.json=t,this.buffer=e,this.featuresLength=0,this._cachedTypedArrays={}}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,e=pi.UNSIGNED_INT,r=1){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,e,r,1,n.byteOffset):n}getPropertyArray(t,e,r){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(e=gi.fromName(n.componentType)),this._getTypedArrayFromBinary(t,e,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,e,n)}getProperty(t,e,r,n,i){const o=this.json[t];if(!o)return o;const a=this.getPropertyArray(t,e,r);if(1===r)return a[n];for(let t=0;t<r;++t)i[t]=a[r*n+t];return i}_getTypedArrayFromBinary(t,e,r,n,i){const o=this._cachedTypedArrays;let a=o[t];return a||(a=gi.createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+i,n*r),o[t]=a),a}_getTypedArrayFromArray(t,e,r){const n=this._cachedTypedArrays;let i=n[t];return i||(i=gi.createTypedArray(e,r),n[t]=i),i}}const yi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},vi={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},_i={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};const bi=t=>void 0!==t;function xi(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?function(t,e){let r,n,i;const o=t.instancesLength,a=t.classes;let s,u=t.classIds,c=t.parentCounts,l=t.parentIds,h=o;bi(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,o));if(bi(c))for(bi(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,o)),s=new Uint16Array(o),h=0,r=0;r<o;++r)s[r]=h,h+=c[r];bi(l)&&bi(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,h));const f=a.length;for(r=0;r<f;++r){const t=a[r].length,n=a[r].instances,i=getBinaryProperties(t,n,e);a[r].instances=combine(i,n)}const p=new Array(f).fill(0),d=new Uint16Array(o);for(r=0;r<o;++r)n=u[r],d[r]=p[n],++p[n];const A={classes:a,classIds:u,classIndexes:d,parentCounts:c,parentIndexes:s,parentIds:l};return function(t){const e=t.classIds.length;for(let r=0;r<e;++r)Ei(t,r,stack)}(A),A}(n,r):null}function wi(t,e,r){if(!t)return;const n=t.parentCounts;return t.parentIds?r(t,e):n>0?function(t,e,r){const n=t.classIds,i=t.parentCounts,o=t.parentIds,a=t.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);const c=++marker,l=scratchStack;l.length=0,l.push(e);for(;l.length>0;){if(e=l.pop(),u[e]===c)continue;u[e]=c;const n=r(t,e);if(bi(n))return n;const s=i[e],h=a[e];for(let t=0;t<s;++t){const r=o[h+t];r!==e&&l.push(r)}}return null}(t,e,r):function(t,e,r){let n=!0;for(;n;){const i=r(t,e);if(bi(i))return i;const o=t.parentIds[e];n=o!==e,e=o}throw new Error("traverseHierarchySingleParent")}(t,e,r)}function Ei(t,e,r){const n=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=t.classIds.length;if(!bi(i))return;assert(e<a,`Parent index ${e} exceeds the total number of instances: ${a}`),assert(-1===r.indexOf(e),"Circular dependency detected in the batch table hierarchy."),r.push(e);const s=bi(n)?n[e]:1,u=bi(n)?o[e]:e;for(let n=0;n<s;++n){const o=i[u+n];o!==e&&Ei(t,o,r)}r.pop(e)}function Si(t){return null!=t}const Oi=(t,e)=>t,Ti={HIERARCHY:!0,extensions:!0,extras:!0};class Pi{constructor(t,e,r,n={}){var i;Object(fn.a)(r>=0),this.json=t||{},this.binary=e,this.featureCount=r,this._extensions=(null===(i=this.json)||void 0===i?void 0:i.extensions)||{},this._properties={};for(const t in this.json)Ti[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=xi(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,e){if(this._checkBatchId(t),Object(fn.a)("string"==typeof e,e),this._hierarchy){return Si(wi(this._hierarchy,t,(t,r)=>{const n=t.classIds[r];return t.classes[n].name===e}))}return!1}isExactClass(t,e){return Object(fn.a)("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),Object(fn.a)("string"==typeof e,e),Si(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Si(e)?e:[]).length=0;const r=Object.keys(this._properties);return e.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),Object(fn.a)("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(Si(r))return this._getBinaryProperty(r,t)}const r=this._properties[e];if(Si(r))return Oi(r[t]);if(this._hierarchy){const r=this._getHierarchyProperty(t,e);if(Si(r))return r}}setProperty(t,e,r){const n=this.featureCount;if(this._checkBatchId(t),Object(fn.a)("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(n)return void this._setBinaryProperty(n,t,r)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,r))return;let i=this._properties[e];Si(i)||(this._properties[e]=new Array(n),i=this._properties[e]),i[t]=Oi(r)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,e){return t.unpack(t.typedArray,e)}_setBinaryProperty(t,e,r){t.pack(r,t.typedArray,e)}_initializeBinaryProperties(){let t=null;for(const e in this._properties){const r=this._properties[e],n=this._initializeBinaryProperty(e,r);n&&(t=t||{},t[e]=n)}return t}_initializeBinaryProperty(t,e){if("byteOffset"in e){const r=e;Object(fn.a)(this.binary,`Property ${t} requires a batch table binary.`),Object(fn.a)(r.type,`Property ${t} requires a type.`);const n=function(t,e,r,n){const{componentType:i}=t;Object(fn.a)(t.componentType);const o="string"==typeof i?gi.fromName(i):i,a=yi[t.type],s=vi[t.type],u=_i[t.type];return r+=t.byteOffset,{values:gi.createTypedArray(o,e,r,a*n),type:o,size:a,unpacker:s,packer:u}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(t,e){if(!this._hierarchy)return!1;const r=wi(this._hierarchy,t,(t,r)=>{const n=t.classIds[r];return Si(t.classes[n].instances[e])});return Si(r)}_getPropertyNamesInHierarchy(t,e){wi(this._hierarchy,t,(t,r)=>{const n=t.classIds[r],i=t.classes[n].instances;for(const t in i)i.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)})}_getHierarchyProperty(t,e){return wi(this._hierarchy,t,(t,r)=>{const n=t.classIds[r],i=t.classes[n],o=t.classIndexes[r],a=i.instances[e];return Si(a)?Si(a.typedArray)?this._getBinaryProperty(a,o):Oi(a[o]):null})}_setHierarchyProperty(t,e,r,n){const i=wi(this._hierarchy,e,(t,i)=>{const o=t.classIds[i],a=t.classes[o],s=t.classIndexes[i],u=a.instances[r];return!!Si(u)&&(Object(fn.a)(i===e,`Inherited property "${r}" is read-only.`),Si(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=Oi(n),!0)});return Si(i)}}function Mi(t,e,r=0){const n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return r}function Ci(t,e,r){const n=new DataView(e);let i;t.header=t.header||{};let o=n.getUint32(r,!0);r+=4;let a=n.getUint32(r,!0);r+=4;let s=n.getUint32(r,!0);r+=4;let u=n.getUint32(r,!0);return r+=4,s>=570425344?(r-=8,i=o,s=a,u=0,o=0,a=0,console.warn("b3dm tile in legacy format.")):u>=570425344&&(r-=4,i=s,s=o,u=a,o=0,a=0,console.warn("b3dm tile in legacy format.")),t.header.featureTableJsonByteLength=o,t.header.featureTableBinaryByteLength=a,t.header.batchTableJsonByteLength=s,t.header.batchTableBinaryByteLength=u,t.header.batchLength=i,r}function Ii(t,e,r,n){return r=function(t,e,r,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:o,batchLength:a}=t.header;if(t.featureTableJson={BATCH_LENGTH:a||0},i>0){const n=li(e,r,i);t.featureTableJson=JSON.parse(n)}return r+=i,t.featureTableBinary=new Uint8Array(e,r,o),r+=o}(t,e,r),r=function(t,e,r,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:o}=t.header;if(i>0){const n=li(e,r,i);t.batchTableJson=JSON.parse(n),r+=i,o>0&&(t.batchTableBinary=new Uint8Array(e,r,o),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=o)}return r}(t,e,r)}function ki(t,e=[0,0,0]){const r=t>>11&31,n=t>>5&63,i=31&t;return e[0]=r<<3,e[1]=n<<2,e[2]=i<<3,e}function Ri(t,e,r){if(!(e||t&&t.batchIds&&r))return null;const{batchIds:n,isRGB565:i,pointCount:o}=t;if(n&&r){const t=new Uint8ClampedArray(3*o);for(let e=0;e<o;e++){const i=n[e],o=r.getProperty(i,"dimensions").map(t=>255*t);t[3*e]=o[0],t[3*e+1]=o[1],t[3*e+2]=o[2]}return{type:pi.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(i){const t=new Uint8ClampedArray(3*o);for(let r=0;r<o;r++){const n=ki(e[r]);t[3*r]=n[0],t[3*r+1]=n[1],t[3*r+2]=n[2]}return{type:pi.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}return e&&e.length===3*o?{type:pi.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:pi.UNSIGNED_BYTE,value:e,size:4,normalized:!0}}var Li=r(219);function ji(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}new Li.a,new Z.a,new Li.a,new Li.a,new Uint8Array(1);function Di(t,e=255){return Object(bt.a)(t,0,e)/e*2-1}function Bi(t){return t<0?-1:1}function Fi(t,e,r,n){if(ji(n),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=Di(t,r),n.y=Di(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const t=n.x;n.x=(1-Math.abs(n.y))*Bi(t),n.y=(1-Math.abs(t))*Bi(n.y)}return n.normalize()}function zi(t,e,r){return Fi(t,e,255,r)}const Ni=new Z.a;function Ui(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,function(t,e){const r=new Z.a,n=new Float32Array(3*t.pointCount);for(let i=0;i<t.pointCount;i++)r.set(e[3*i],e[3*i+1],e[3*i+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,3*i);return n}(t,e)):{type:pi.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}async function Vi(t,e,r,n,i){r=Ii(t,e,r=Ci(t,e,r=Mi(t,e,r))),function(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}(t);const{featureTable:o,batchTable:a}=function(t){const e=new mi(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",pi.FLOAT,3);const n=function(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",pi.UNSIGNED_SHORT,1),t.batchIds)){const n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:o}=t;r=new Pi(i,o,n)}return r}(t,e);return{featureTable:e,batchTable:n}}(t);return await async function(t,e,r,n,i){let o,a,s;const u=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);const c=e.getExtension("3DTILES_draco_point_compression");if(c){a=c.properties;const e=c.byteOffset,r=c.byteLength;if(!a||!Number.isFinite(e)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=t.featureTableBinary.slice(e,e+r),t.hasPositions=Number.isFinite(a.POSITION),t.hasColors=Number.isFinite(a.RGB)||Number.isFinite(a.RGBA),t.hasNormals=Number.isFinite(a.NORMAL),t.hasBatchIds=Number.isFinite(a.BATCH_ID),t.isTranslucent=Number.isFinite(a.RGBA)}if(!o)return!0;const l={buffer:o,properties:{...a,...s},featureTableProperties:a,batchTableProperties:s,dequantizeInShader:!1};return await async function(t,e,r,n){const{parse:i}=n,o={...r,draco:{...r.draco,extraAttributes:e.batchTableProperties||{}}};delete o["3d-tiles"];const a=await i(e.buffer,hi.a,o),s=a.attributes.POSITION&&a.attributes.POSITION.value,u=a.attributes.COLOR_0&&a.attributes.COLOR_0.value,c=a.attributes.NORMAL&&a.attributes.NORMAL.value,l=a.attributes.BATCH_ID&&a.attributes.BATCH_ID.value,h=s&&a.attributes.POSITION.value.quantization,f=c&&a.attributes.NORMAL.value.quantization;if(h){const e=a.POSITION.data.quantization,r=e.range;t.quantizedVolumeScale=new Z.a(r,r,r),t.quantizedVolumeOffset=new Z.a(e.minValues),t.quantizedRange=(1<<e.quantizationBits)-1,t.isQuantizedDraco=!0}f&&(t.octEncodedRange=(1<<a.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);const p={};if(e.batchTableProperties)for(const t of Object.keys(e.batchTableProperties))a.attributes[t]&&a.attributes[t].value&&(p[t.toLowerCase()]=a.attributes[t].value);t.attributes={positions:s,colors:Ri(t,u),normals:c,batchIds:l,...p}}(t,l,n,i)}(t,o,0,n,i),function(t,e,r){if(!t.attributes.positions)if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",pi.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",pi.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=65535,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",pi.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",pi.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=Ui(t,n,r)}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(t,o,n),function(t,e,r){if(!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",pi.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",pi.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",pi.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=Ri(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",pi.UNSIGNED_BYTE,4))}(t,o,a),function(t,e){if(!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",pi.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",pi.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=function(t,e){if(!e)return null;if(t.isOctEncoded16P){const r=new Float32Array(3*t.pointsLength);for(let n=0;n<t.pointsLength;n++)zi(e[2*n],e[2*n+1],Ni),Ni.toArray(r,3*n);return{type:pi.FLOAT,size:2,value:r}}return{type:pi.FLOAT,size:2,value:e}}(t,r)}}(t,o),r}var Gi=r(291),Wi=r(78);const Hi=0,qi=1;function Zi(t,e,r,n){t.rotateYtoZ=!0;const i=t.byteOffset+t.byteLength-r;if(0===i)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=Object(Wi.c)(e,r,i),t.gltfByteOffset=0,t.gltfByteLength=i,r%4==0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),t.byteOffset+t.byteLength}async function Xi(t,e,r,n){const i=r["3d-tiles"]||{};if(function(t,e,r){switch(e){case Hi:const e=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),r=(new TextDecoder).decode(e);t.gltfUrl=r.replace(/[\s\0]+$/,""),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case qi:break;default:throw new Error("b3dm: Illegal glTF format field")}}(t,e),i.loadGLTF){const{parse:e,fetch:i}=n;t.gltfUrl&&(t.gltfArrayBuffer=await i(t.gltfUrl,r),t.gltfByteOffset=0),t.gltfArrayBuffer&&(t.gltf=await e(t.gltfArrayBuffer,Gi.a,r,n),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength)}}async function Qi(t,e,r,n,i){var o;r=function(t,e,r,n,i){r=Mi(t,e,r),r=Ci(t,e,r),r=Ii(t,e,r),r=Zi(t,e,r,n);const o=new mi(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=o.getGlobalProperty("RTC_CENTER",pi.FLOAT,3),r}(t,e,r,n),await Xi(t,qi,n,i);const a=null==t?void 0:null===(o=t.gltf)||void 0===o?void 0:o.extensions;return a&&a.CESIUM_RTC&&(t.rtcCenter=a.CESIUM_RTC.center),r}async function Yi(t,e,r,n,i){return r=function(t,e,r,n,i){if(r=Mi(t,e,r),1!==t.version)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=Ci(t,e,r);const o=new DataView(e);if(t.gltfFormat=o.getUint32(r,!0),r=Ii(t,e,r+=4),r=Zi(t,e,r,n),0===t.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const a=new mi(t.featureTableJson,t.featureTableBinary),s=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=a.getGlobalProperty("RTC_CENTER",pi.FLOAT,3);new Pi(t.batchTableJson,t.batchTableBinary,s);return function(t,e,r,n){const i=[new Array(n),t._batchTable][0],o=new Z.a,a=new Z.a,s=new Z.a,u=new Z.a,c=new et.a,l=new rt.a,h=new Z.a,f={},p=new Mt.a,d=[],A=[],g=new Z.a,m=new Z.a;for(let r=0;r<n;r++){let n;if(e.hasProperty("POSITION"))n=e.getProperty("POSITION",pi.FLOAT,3,r,o);else if(e.hasProperty("POSITION_QUANTIZED")){n=e.getProperty("POSITION_QUANTIZED",pi.UNSIGNED_SHORT,3,r,o);const t=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",pi.FLOAT,3,g);if(!t)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",pi.FLOAT,3,m);if(!i)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const a=65535;for(let e=0;e<3;e++)n[e]=n[e]/a*i[e]+t[e]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(n),f.translation=o,t.normalUp=e.getProperty("NORMAL_UP",pi.FLOAT,3,r,d),t.normalRight=e.getProperty("NORMAL_RIGHT",pi.FLOAT,3,r,A);const y=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",pi.UNSIGNED_SHORT,2,d),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",pi.UNSIGNED_SHORT,2,A),t.octNormalUp){if(!t.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}t.eastNorthUp?(ln.WGS84.eastNorthUpToFixedFrame(o,p),p.getRotationMatrix3(c)):c.identity()}y&&(u.copy(a).cross(s).normalize(),c.setColumn(0,a),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),f.rotation=l,h.set(1,1,1);const v=e.getProperty("SCALE",pi.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const _=e.getProperty("SCALE_NON_UNIFORM",pi.FLOAT,3,r,d);_&&h.scale(_),f.scale=h;let b=e.getProperty("BATCH_ID",pi.UNSIGNED_SHORT,1,r);void 0===b&&(b=r);const x=(new Mt.a).fromQuaternion(f.rotation);p.identity(),p.translate(f.translation),p.multiplyRight(x),p.scale(f.scale);const w=p.clone();i[r]={modelMatrix:w,batchId:b}}t.instances=i}(t,a,0,s),r}(t,e,r,n),await Xi(t,t.gltfFormat,n,i),r}async function Ki(t,e=0,r,n,i={}){switch(i.byteOffset=e,i.type=function(t,e=0){const r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}(t,e),i.type){case ci.COMPOSITE:return await async function(t,e,r,n,i,o){r=Mi(t,e,r);const a=new DataView(e);for(t.tilesLength=a.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&t.byteLength-r>12;){const a={};t.tiles.push(a),r=await o(e,r,n,i,a)}return r}(i,t,e,r,n,Ki);case ci.BATCHED_3D_MODEL:return await Qi(i,t,e,r,n);case ci.INSTANCED_3D_MODEL:return await Yi(i,t,e,r,n);case ci.POINT_CLOUD:return await Vi(i,t,e,r,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}function $i(t,e){if(t.content){const r=t.content.uri||t.content.url;t.contentUrl=`${e.basePath}/${r}`}return t.id=t.contentUrl,t.lodMetricType=Bn,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,t.type=function(t){if(!t.contentUrl)return In;const e=t.contentUrl.split(".").pop();switch(e){case"pnts":return Rn;case"i3dm":case"b3dm":return kn;default:return e}}(t),t.refine=function(t){switch(t){case"REPLACE":case"replace":return Cn;case"ADD":case"add":return Mn;default:return t}}(t.refine),t}const Ji={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.0.8",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t,e,r){const n=e["3d-tiles"]||{};let i;i="auto"===n.isTileset?r.url&&-1!==r.url.indexOf(".json"):n.isTileset;t=i?await async function(t,e,r){const n=JSON.parse((new TextDecoder).decode(t));return n.loader=e.loader||Ji,n.url=r.url,n.basePath=function(t){return pn.b.dirname(t.url)}(n),n.root=function(t){const e=t.basePath,r=$i(t.root,t),n=[];for(n.push(r);n.length>0;){const t=n.pop().children||[];for(const r of t)$i(r,{basePath:e}),n.push(r)}return r}(n),n.type=Dn,n.lodMetricType=Bn,n.lodMetricValue=n.root.lodMetricValue,n}(t,e,r):await async function(t,e,r){const n={content:{featureIds:null}};return await Ki(t,0,e,r,n.content),n.content}(t,e,r);return t},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function to(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function eo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?to(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ro(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var no=[0],io={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:null,loader:Ji,onTilesetLoad:{type:"function",value:function(t){},compare:!1},onTileLoad:{type:"function",value:function(t){},compare:!1},onTileUnload:{type:"function",value:function(t){},compare:!1},onTileError:{type:"function",value:function(t,e,r){},compare:!1},_getMeshColor:{type:"function",value:function(t){return[255,255,255]},compare:!1}},oo=function(t){a()(n,t);var e,r=ro(n);function n(){return i()(this,n),r.apply(this,arguments)}return d()(n,[{key:"initializeState",value:function(){"onTileLoadFail"in this.props&&V.a.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}},{key:"shouldUpdateState",value:function(t){return t.changeFlags.somethingChanged}},{key:"updateState",value:function(t){var e=t.props,r=t.oldProps,n=t.changeFlags;if(e.data&&e.data!==r.data&&this._loadTileset(e.data),n.viewportChanged){var i=this.state.activeViewports;Object.keys(i).length&&(this._updateTileset(i),this.state.lastUpdatedViewports=i,this.state.activeViewports={})}if(n.propsChanged){var o=this.state.layerMap;for(var a in o)o[a].needsUpdate=!0}}},{key:"activateViewport",value:function(t){var e=this.state,r=e.activeViewports,n=e.lastUpdatedViewports;this.internalState.viewport=t,r[t.id]=t;var i=null==n?void 0:n[t.id];i&&t.equals(i)||(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}},{key:"getPickingInfo",value:function(t){var e=t.info,r=t.sourceLayer,n=this.state.layerMap,i=r&&r.id;if(i){var o=i.substring(this.id.length+1),a=o.substring(o.indexOf("-")+1);e.object=n[a]&&n[a].tile}return e}},{key:"filterSubLayer",value:function(t){var e=t.layer,r=t.viewport,n=e.props.tile,i=r.id;return n.selected&&n.viewportIds.includes(i)}},{key:"_updateAutoHighlight",value:function(t){t.sourceLayer&&t.sourceLayer.updateAutoHighlight(t)}},{key:"_loadTileset",value:(e=U()(z.a.mark((function t(e){var r,n,i,o,a,s,u;return z.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.props.loadOptions,n=void 0===r?{}:r,i=this.props.loader||this.props.loaders,Array.isArray(i)&&(i=i[0]),o={loadOptions:eo({},n)},!i.preload){t.next=10;break}return t.next=7,i.preload(e,n);case 7:(a=t.sent).headers&&(o.loadOptions.fetch=eo(eo({},o.loadOptions.fetch),{},{headers:a.headers})),Object.assign(o,a);case 10:return t.next=12,Object(Fr.a)(e,i,o.loadOptions);case 12:s=t.sent,u=new ui(s,eo({onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileLoadFail:this.props.onTileError},o)),this.setState({tileset3d:u,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(u);case 17:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"_onTileLoad",value:function(t){var e=this.state.lastUpdatedViewports;this.props.onTileLoad(t),this._updateTileset(e),this.setNeedsUpdate()}},{key:"_onTileUnload",value:function(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}},{key:"_updateTileset",value:function(t){var e=this.state.tileset3d,r=this.context.timeline,n=Object.keys(t).length;if(r&&n&&e){var i=e.update(Object.values(t));this.state.frameNumber!==i&&this.setState({frameNumber:i})}}},{key:"_getSubLayer",value:function(t,e){if(!t.content)return null;switch(t.type){case Rn:return this._makePointCloudLayer(t,e);case kn:return this._make3DModelLayer(t,e);case Ln:return this._makeSimpleMeshLayer(t,e);default:throw new Error("Tile3DLayer: Failed to render layer of type ".concat(t.content.type))}}},{key:"_makePointCloudLayer",value:function(t,e){var r=t.content,n=r.attributes,i=r.pointCount,o=r.constantRGBA,a=r.cartographicOrigin,s=r.modelMatrix,u=n.positions,c=n.normals,l=n.colors;if(!u)return null;var h=e&&e.props.data||{header:{vertexCount:i},attributes:{POSITION:u,NORMAL:c,COLOR_0:l}},f=this.props,p=f.pointSize,d=f.getPointColor;return new(this.getSubLayerClass("pointcloud",Pr.a))({pointSize:p},this.getSubLayerProps({id:"pointcloud"}),{id:"".concat(this.id,"-pointcloud-").concat(t.id),tile:t,data:h,coordinateSystem:Tr.a.METER_OFFSETS,coordinateOrigin:a,modelMatrix:s,getColor:o||d,_offset:0})}},{key:"_make3DModelLayer",value:function(t){var e=t.content,r=e.gltf,n=e.instances,i=e.cartographicOrigin,o=e.modelMatrix;return new(this.getSubLayerClass("scenegraph",Mr.a))({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:"".concat(this.id,"-scenegraph-").concat(t.id),tile:t,data:n||no,scenegraph:r,coordinateSystem:Tr.a.METER_OFFSETS,coordinateOrigin:i,modelMatrix:o,getTransformMatrix:function(t){return t.modelMatrix},getPosition:[0,0,0],_offset:0})}},{key:"_makeSimpleMeshLayer",value:function(t,e){var r=t.content,n=r.attributes,i=r.indices,o=r.modelMatrix,a=r.cartographicOrigin,s=r.material,u=r.featureIds,c=this.props._getMeshColor,l=e&&e.props.mesh||new Or.a({drawMode:4,attributes:ao(n),indices:i});return new(this.getSubLayerClass("mesh",Br))(this.getSubLayerProps({id:"mesh"}),{id:"".concat(this.id,"-mesh-").concat(t.id),tile:t,mesh:l,data:no,getColor:c(t),pbrMaterial:s,modelMatrix:o,coordinateOrigin:a,coordinateSystem:Tr.a.METER_OFFSETS,featureIds:u,_offset:0})}},{key:"renderLayers",value:function(){var t=this,e=this.state,r=e.tileset3d,n=e.layerMap;return r?r.tiles.map((function(e){var r=n[e.id]=n[e.id]||{tile:e},i=r.layer;return e.selected&&(i?r.needsUpdate&&(i=t._getSubLayer(e,i),r.needsUpdate=!1):i=t._getSubLayer(e)),r.layer=i,i})).filter(Boolean):null}},{key:"isLoaded",get:function(){var t=this.state.tileset3d;return t&&t.isLoaded()}}]),n}(m.a);function ao(t){var e={};return e.positions=eo(eo({},t.positions),{},{value:new Float32Array(t.positions.value)}),t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}oo.layerName="Tile3DLayer",oo.defaultProps=io;var so=r(105);const uo={name:"Terrain",id:"terrain",module:"terrain",version:"3.0.8",worker:!0,extensions:["png","pngraw"],mimeTypes:["image/png"],options:{terrain:{tesselator:"auto",bounds:null,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:null}}};function co(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}function lo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ho(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?lo(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lo(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var fo=[1],po=ho(ho({},we.defaultProps),{},{elevationData:re,texture:ho(ho({},re),{},{optional:!0}),meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:{type:"string",value:null},wireframe:!1,material:!0,loaders:[uo]});function Ao(t){return Array.isArray(t)?t.join(";"):t}var go=function(t){a()(r,t);var e=co(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"updateState",value:function(t){var e=t.props,r=t.oldProps,n=e.elevationData!==r.elevationData;if(n){var i=e.elevationData,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}var a=n||e.meshMaxError!==r.meshMaxError||e.elevationDecoder!==r.elevationDecoder||e.bounds!==r.bounds;if(!this.state.isTiled&&a){var s=this.loadTerrain(e);this.setState({terrain:s})}e.workerUrl&&V.a.removed("workerUrl","loadOptions.terrain.workerUrl")()}},{key:"loadTerrain",value:function(t){var e,r=t.elevationData,n=t.bounds,i=t.elevationDecoder,o=t.meshMaxError,a=t.signal;if(!r)return null;var s=this.getLoadOptions();return s=ho(ho({},s),{},{terrain:ho(ho({skirtHeight:this.state.isTiled?2*o:0},null===(e=s)||void 0===e?void 0:e.terrain),{},{bounds:n,meshMaxError:o,elevationDecoder:i})}),(0,this.props.fetch)(r,{propName:"elevationData",layer:this,loadOptions:s,signal:a})}},{key:"getTiledTerrainData",value:function(t){var e=this.props,r=e.elevationData,n=e.fetch,i=e.texture,o=e.elevationDecoder,a=e.meshMaxError,s=ie(r,t),u=ie(i,t),c=t.bbox,l=t.signal,h=t.z,f=new so.a({longitude:(c.west+c.east)/2,latitude:(c.north+c.south)/2,zoom:h}),p=f.projectFlat([c.west,c.south]),d=f.projectFlat([c.east,c.north]),A=[p[0],p[1],d[0],d[1]],g=this.loadTerrain({elevationData:s,bounds:A,elevationDecoder:o,meshMaxError:a,signal:l}),m=u?n(u,{propName:"texture",layer:this,loaders:[],signal:l}).catch((function(t){return null})):Promise.resolve(null);return Promise.all([g,m])}},{key:"renderSubLayers",value:function(t){var e=this.getSubLayerClass("mesh",Rr.a),r=t.data,n=t.color;if(!r)return null;var i=_()(r,2),o=i[0],a=i[1];return new e(t,{data:fo,mesh:o,texture:a,coordinateSystem:Tr.a.CARTESIAN,getPosition:function(t){return[0,0,0]},getColor:n})}},{key:"onViewportLoad",value:function(t){if(t){var e=this.state.zRange,r=t.map((function(t){return t.content})).filter(Boolean).map((function(t){return t[0].header.boundingBox.map((function(t){return t[2]}))}));if(0!==r.length){var n=Math.min.apply(Math,H()(r.map((function(t){return t[0]})))),i=Math.max.apply(Math,H()(r.map((function(t){return t[1]}))));(!e||n<e[0]||i>e[1])&&this.setState({zRange:[n,i]})}}}},{key:"renderLayers",value:function(){var t=this.props,e=t.color,r=t.material,n=t.elevationData,i=t.texture,o=t.wireframe,a=t.meshMaxError,s=t.elevationDecoder,u=t.tileSize,c=t.maxZoom,l=t.minZoom,h=t.extent,f=t.maxRequests,p=t.onTileLoad,d=t.onTileUnload,A=t.onTileError,g=t.maxCacheSize,m=t.maxCacheByteSize,y=t.refinementStrategy;return this.state.isTiled?new we(this.getSubLayerProps({id:"tiles"}),{wireframe:o,color:e,material:r,getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:Ao(n),texture:Ao(i),meshMaxError:a,elevationDecoder:s}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:u,maxZoom:c,minZoom:l,extent:h,maxRequests:f,onTileLoad:p,onTileUnload:d,onTileError:A,maxCacheSize:g,maxCacheByteSize:m,refinementStrategy:y}):new(this.getSubLayerClass("mesh",Rr.a))(this.getSubLayerProps({id:"mesh"}),{data:fo,mesh:this.state.terrain,texture:i,_instanced:!1,getPosition:function(t){return[0,0,0]},getColor:e,material:r,wireframe:o})}}]),r}(m.a);go.layerName="TerrainLayer",go.defaultProps=po;class mo{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(vo,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,n=0,i=0,o=0;const a=[];let s;for(;t.pos<e;){if(n<=0){const e=t.readVarint();7&e,e>>3}if(1===r||2===r)t.readSVarint(),t.readSVarint(),1===r&&(s&&a.push(s),[]),s.push([i,o]);else{if(7!==r)throw new Error(`unknown command ${r}`);s&&s.push(s[0].slice())}}return s&&a.push(s),a}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,c=-1/0;for(;t.pos<e;){if(n<=0){const e=t.readVarint();7&e,e>>3}if(1===r||2===r)t.readSVarint(),t.readSVarint(),i<a&&i,i>s&&i,o<u&&o,o>c&&o;else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,u,s,c]}_toGeoJSON(t){let e,r,n=this.loadGeometry(),i=mo.types[this.type];switch(this.type){case 1:var o=[];for(0;e<n.length;e++)o[e]=n[e][0];o,t(n,this);break;case 2:for(0;e<n.length;e++)t(n[e],this);break;case 3:for(function(t){const e=t.length;if(e<=1)return[t];const r=[];let n,i;for(let o=0;o<e;o++){const e=yo(t[o]);0!==e&&(void 0===i&&e<0,i===e<0?(n&&r.push(n),[t[o]]):n.push(t[o]))}n&&r.push(n);return r}(n),0;e<n.length;e++)for(0;r<n[e].length;r++)t(n[e][r],this)}1===n.length?n[0]:`Multi${i}`;const a={type:"Feature",geometry:{type:i,coordinates:n},properties:this.properties};return null!==this.id&&(a.id=this.id),a}toGeoJSON(t){if("function"==typeof t)return this._toGeoJSON(t);const{x:e,y:r,z:n}=t,i=this.extent*Math.pow(2,n),o=this.extent*e,a=this.extent*r;return this._toGeoJSON((function(t){for(let e=0;e<t.length;e++){const r=t[e];r[0]=360*(r[0]+o)/i-180;const n=180-360*(r[1]+a)/i;r[1]=360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}}))}}function yo(t){let e=0;for(let e,r,n=0,i=t.length-1;n<t.length;n++)t[n],t[i],(r[0]-e[0])*(e[1]+r[1]);return e}function vo(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}class _o{constructor(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(bo,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new mo(this._pbf,e,this.extent,this._keys,this._values)}}function bo(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const e=t.readVarint()>>3;1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return e}(r))}class xo{constructor(t,e){this.layers=t.readFields(wo,{},e)}}function wo(t,e,r){if(3===t){const t=new _o(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}var Eo=r(38);let So,Oo,To,Po,Mo,Co,Io;class ko{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,e,r,n,i,o){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,this._firstPassData=o,t.readFields(Lo,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry,t.readVarint()+t.pos,1,0,0,0,0;const e=[],r=[];for(;t.pos<So;)if(Po<=0&&(t.readVarint(),7&To,To>>3),1===Oo||2===Oo)t.readSVarint(),t.readSVarint(),1===Oo&&e.push(Io),r.push(Mo,Co),2;else{if(7!==Oo)throw new Error(`unknown command ${Oo}`);if(Io>0){const t=e[e.length-1];r.push(r[t],r[t+1]),2}}return{data:r,lines:e}}_toBinaryCoordinates(t){let e=this.loadGeometry();t(e.data,this);switch(this.type){case 1:this._firstPassData.pointFeaturesCount++,this._firstPassData.pointPositionsCount+=e.lines.length;break;case 2:this._firstPassData.lineFeaturesCount++,this._firstPassData.linePathsCount+=e.lines.length,this._firstPassData.linePositionsCount+=e.data.length/2;break;case 3:const t=Ro(e);this._firstPassData.polygonFeaturesCount++,this._firstPassData.polygonObjectsCount+=t.lines.length;for(const e of t.lines)this._firstPassData.polygonRingsCount+=e.length;this._firstPassData.polygonPositionsCount+=t.data.length/2,t}e.type=ko.types[this.type],e.lines.length>1&&(e.type=`Multi${e.type}`);const r={type:"Feature",geometry:e,properties:this.properties};return null!==this.id&&(r.id=this.id),r}toBinaryCoordinates(t){if("function"==typeof t)return this._toBinaryCoordinates(t);const{x:e,y:r,z:n}=t,i=this.extent*Math.pow(2,n),o=this.extent*e,a=this.extent*r;return this._toBinaryCoordinates((function(t){for(let e=0,r=t.length;e<r;e+=2){t[e]=360*(t[e]+o)/i-180;const r=180-360*(t[e+1]+a)/i;t[e+1]=360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90}}))}}function Ro(t){const e=t.lines.length;if(e<=1)return{data:t.data,areas:[[Object(Eo.g)(t.data)]],lines:[t.lines]};const r=[],n=[];let i,o,a,s=0;for(let u,c,l=0;l<e;l++){t.lines[l]-s,t.lines[l+1]-s||t.data.length;const e=t.data.slice(u,c),h=Object(Eo.g)(e);if(0!==h)void 0===a&&h<0,a===h<0?(o&&(r.push(i),n.push(o)),[u],[h]):(i.push(h),o.push(u));else{const e=t.data.slice(0,u),r=t.data.slice(c);t.data=e.concat(r),c-u}}return i&&r.push(i),o&&n.push(o),{areas:r,lines:n,data:t.data}}function Lo(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}class jo{constructor(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Do,this,e),this.length=this._features.length}feature(t,e){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const r=this._pbf.readVarint()+this._pbf.pos;return new ko(this._pbf,r,this.extent,this._keys,this._values,e)}}function Do(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const e=t.readVarint()>>3;1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return e}(r))}class Bo{constructor(t,e){this.layers=t.readFields(Fo,{},e)}}function Fo(t,e,r){if(3===t){const t=new jo(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}function zo(t){const e={};for(const n of t)if(n.properties)for(const t in n.properties){const i=e[t];if(i||void 0===i){const i=n.properties[t];e[t]=(i,Number.isFinite(r))}}var r;return Object.keys(e).filter(t=>e[t])}function No(t,e={},r={}){const{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:a,lineFeaturesCount:s,polygonPositionsCount:u,polygonObjectsCount:c,polygonRingsCount:l,polygonFeaturesCount:h}=e,{numericPropKeys:f,PositionDataType:p=Float32Array}=r,d=t[0]&&"id"in t[0],A=t.length>65535?Uint32Array:Uint16Array,g={positions:new p(2*n),globalFeatureIds:new A(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},m={pathIndices:o>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new p(2*o),globalFeatureIds:new A(o),featureIds:s>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},y={polygonIndices:u>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:u>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new p(2*u),triangles:[],globalFeatureIds:new A(u),featureIds:h>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]};for(const t of[g,m,y])for(const e of f)t.numericProps[e]=new Float32Array(t.positions.length/2);m.pathIndices[a]=o,y.polygonIndices[c]=u,y.primitivePolygonIndices[l]=u;const v={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,r=e.properties||{};switch(t.type){case"Point":case"MultiPoint":Uo(t,g,v,2,r),g.properties.push(qo(r,f)),d&&g.fields.push({id:e.id}),v.pointFeature++;break;case"LineString":case"MultiLineString":Vo(t,m,v,2,r),m.properties.push(qo(r,f)),d&&m.fields.push({id:e.id}),v.lineFeature++;break;case"Polygon":case"MultiPolygon":Go(t,y,v,2,r),y.properties.push(qo(r,f)),d&&y.fields.push({id:e.id}),v.polygonFeature++;break;default:throw new Error("Invalid geometry type")}v.feature++}return function(t,e,r,n){const i={points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1}},lines:{...e,pathIndices:{value:e.pathIndices,size:1},positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1}},polygons:{...r,polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},positions:{value:r.positions,size:n},triangles:{value:new Uint32Array(r.triangles),size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1}}};for(const t in i)for(const e in i[t].numericProps)i[t].numericProps[e]={value:i[t].numericProps[e],size:1};return i}(g,m,y,2)}function Uo(t,e,r,n,i){e.positions.set(t.data,r.pointPosition*n);const o=t.data.length/n;Ho(e,i,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Vo(t,e,r,n,i){e.positions.set(t.data,r.linePosition*n);const o=t.data.length/n;Ho(e,i,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let i=0,o=t.lines.length;i<o;++i){const a=t.lines[i],s=i===o-1?t.data.length:t.lines[i+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(s-a)/n}}function Go(t,e,r,n,i){e.positions.set(t.data,r.polygonPosition*n);const o=t.data.length/n;Ho(e,i,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let i=0,o=t.lines.length;i<o;++i){const o=r.polygonPosition;e.polygonIndices[r.polygonObject++]=o;const a=t.areas[i],s=t.lines[i],u=t.lines[i+1];for(let i=0,o=s.length;i<o;++i){const a=s[i],c=i===o-1?void 0===u?t.data.length:u[0]:s[i+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(c-a)/n}Wo(e,a,s,{startPosition:o,endPosition:r.polygonPosition,coordLength:n})}}function Wo(t,e,r,{startPosition:n,endPosition:i,coordLength:o}){const a=n*o,s=i*o,u=t.positions.subarray(a,s),c=r[0],l=r.slice(1).map(t=>(t-c)/o),h=Object(Eo.f)(u,l,o,e);for(let e=0,r=h.length;e<r;++e)t.triangles.push(n+h[e])}function Ho(t,e,r,n){for(const i in t.numericProps)i in e&&t.numericProps[i].fill(e[i],r,r+n)}function qo(t,e){const r={};for(const n in t)e.includes(n)||(r[n]=t[n]);return r}var Zo=r(193),Xo=r.n(Zo);function Qo(t,e){const r="binary"===function(t){const e="wgs84"==={...t,mvt:t.mvt||{},gis:t.gis||{}}.coordinates,{tileIndex:r}=t,n=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(e&&!n)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property. Check documentation.");return t}(e).gis.format,n=[],i={pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength>0){const o=r?new Bo(new Xo.a(t)):new xo(new Xo.a(t)),a=e.mvt;(Array.isArray(a.layers)?a.layers:Object.keys(o.layers)).forEach(t=>{const e=o.layers[t],s={...a,layerName:t};if(e)for(let t=0;t<e.length;t++){const o=e.feature(t,i),a=r?Ko(o,s):Yo(o,s);n.push(a)}})}if(r){const r=function(t,e,r={}){return No(t,e,{numericPropKeys:r.numericPropKeys||zo(t),PositionDataType:r.PositionDataType||Float32Array})}(n,i,e.gis);return r.byteLength=t.byteLength,r}return n}function Yo(t,e={}){const r=t.toGeoJSON("wgs84"===e.coordinates?e.tileIndex:$o);return e.layerProperty&&(r.properties[e.layerProperty]=e.layerName),r}function Ko(t,e={}){const r=t.toBinaryCoordinates("wgs84"===e.coordinates?e.tileIndex:Jo);return e.layerProperty&&(r.properties[e.layerProperty]=e.layerName),r}function $o(t,e){const{extent:r}=e;for(let e=0;e<t.length;e++){const n=t[e];n[0]/=r,n[1]/=r}}function Jo(t,e){const{extent:r}=e;for(let e=0,n=t.length;e<n;++e)t[e]/=r}const ta={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:"3.0.8",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{coordinates:"local",layerProperty:"layerName",layers:null,tileIndex:null}}};function ea(t,e){const r=null==e?void 0:e.globalFeatureId;return void 0!==r?function(t,e){const r=ia(t);for(const t of r){let r=0,n=t.featureIds.value[0];for(let i=0;i<t.featureIds.value.length;i++){const o=t.featureIds.value[i];if(o!==n){if(e===t.globalFeatureIds.value[r])return oa(t,r,i);r=i,n=o}}if(e===t.globalFeatureIds.value[r])return oa(t,r,t.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}(t,r):ra(t,null==e?void 0:e.type)}function ra(t,e){return function(t){const e=[];for(const r of t){if(0===r.featureIds.value.length)continue;let t=0,n=r.featureIds.value[0];for(let i=0;i<r.featureIds.value.length;i++){const o=r.featureIds.value[i];o!==n&&(e.push(oa(r,t,i)),t=i,n=o)}e.push(oa(r,t,r.featureIds.value.length))}return e}(ia(t,e))}function na(t,e,r){switch(t.type){case"Point":return function(t,e,r){const{positions:n}=t,i=aa(n,e,r);if(i.length>1)return{type:"MultiPoint",coordinates:i};return{type:"Point",coordinates:i[0]}}(t,e,r);case"LineString":return function(t,e=-1/0,r=1/0){const{positions:n}=t,i=t.pathIndices.value.filter(t=>t>=e&&t<=r);if(!(i.length>2)){return{type:"LineString",coordinates:aa(n,i[0],i[1])}}const o=[];for(let t=0;t<i.length-1;t++){const e=aa(n,i[t],i[t+1]);o.push(e)}return{type:"MultiLineString",coordinates:o}}(t,e,r);case"Polygon":return function t(e,r=-1/0,n=1/0){const{positions:i}=e,o=e.polygonIndices.value.filter(t=>t>=r&&t<=n),a=e.primitivePolygonIndices.value.filter(t=>t>=r&&t<=n);if(!(o.length>2)){const t=[];for(let e=0;e<a.length-1;e++){const r=a[e],n=a[e+1],o=aa(i,r,n);t.push(o)}return{type:"Polygon",coordinates:t}}const s=[];for(let r=0;r<o.length-1;r++){const n=o[r],i=o[r+1],a=t(e,n,i).coordinates;s.push(a)}return{type:"MultiPolygon",coordinates:s}}(t,e,r);default:const n=t;throw new Error(`Unsupported geometry type: ${null==n?void 0:n.type}`)}}function ia(t,e){if(!Boolean(t.points||t.lines||t.polygons))return t.type=e||function(t){if(t.pathIndices)return"LineString";if(t.polygonIndices)return"Polygon";return"Point"}(t),[t];const r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function oa(t,e,r){return{type:"Feature",geometry:na(t,e,r),properties:function(t,e=0,r){const n=Object.assign({},t.properties[t.featureIds.value[e]]);for(const r in t.numericProps)n[r]=t.numericProps[r].value[e];return n}(t,e),...function(t,e=0,r){return t.fields&&t.fields[t.featureIds.value[e]]}(t,e)}}function aa(t,e,r){e=e||0,r=r||t.value.length/t.size;const n=[];for(let i=e;i<r;i++){const e=Array();for(let r=i*t.size;r<(i+1)*t.size;r++)e.push(Number(t.value[r]));n.push(e)}return n}var sa=r(208);function ua(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var ca={clipBounds:[0,0,1,1]},la="\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n  return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n",ha={name:"clip-vs",vs:la},fa={"vs:#decl":"\nvarying float clip_isVisible;\n","vs:DECKGL_FILTER_GL_POSITION":"\n  clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n","fs:#decl":"\nvarying float clip_isVisible;\n","fs:DECKGL_FILTER_COLOR":"\n  if (clip_isVisible < 0.5) discard;\n"},pa={name:"clip-fs",fs:la},da={"vs:#decl":"\nvarying vec2 clip_commonPosition;\n","vs:DECKGL_FILTER_GL_POSITION":"\n  clip_commonPosition = geometry.position.xy;\n","fs:#decl":"\nvarying vec2 clip_commonPosition;\n","fs:DECKGL_FILTER_COLOR":"\n  if (!clip_isInBounds(clip_commonPosition)) discard;\n"},Aa=function(t){a()(r,t);var e=ua(r);function r(){return i()(this,r),e.apply(this,arguments)}return d()(r,[{key:"getShaders",value:function(){var t="instancePositions"in this.getAttributeManager().attributes;return"clipByInstance"in this.props&&(t=this.props.clipByInstance),this.state.clipByInstance=t,t?{modules:[ha],inject:fa}:{modules:[pa],inject:da}}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props.clipBounds,n=void 0===r?ca.clipBounds:r;if(this.state.clipByInstance)e.clip_bounds=n;else{var i=this.projectPosition([n[0],n[1],0]),o=this.projectPosition([n[2],n[3],0]);e.clip_bounds=[Math.min(i[0],o[0]),Math.min(i[1],o[1]),Math.max(i[0],o[0]),Math.max(i[1],o[1])]}}}]),r}(sa.a);function ga(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ma(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ga(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ga(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}Aa.extensionName="ClipExtension",Aa.defaultProps=ca;var ya={Point:va,MultiPoint:function(t,e,r){return _a(t,e,r)},LineString:ba,MultiLineString:function(t,e,r){return t.map((function(t){return ba(t,e,r)}))},Polygon:xa,MultiPolygon:function(t,e,r){return t.map((function(t){return xa(t,e,r)}))}};function va(t,e,r){var n=_()(t,2),i=n[0],o=n[1],a=_()(e,2),s=a[0],u=a[1],c=Object(fe.f)(s[0],u[0],i),l=Object(fe.f)(s[1],u[1],o);return r.unprojectFlat([c,l])}function _a(t,e,r){return t.map((function(t){return va(t,e,r)}))}function ba(t,e,r){return _a(t,e,r)}function xa(t,e,r){return t.map((function(t){return _a(t,e,r)}))}function wa(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Ea(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ea(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ea(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Sa=["points","lines","polygons"];function Oa(t,e,r,n){var i=t.featureIds.value;if(!i.length)return-1;var o=0,a=i[i.length-1]+1;if(n){var s=function(t,e){if(!t.__layers){for(var r={},n=t.properties,i=0;i<n.length;i++){var o=n[i].layerName;o&&(r[o]?r[o][1]=i:r[o]=[i,i])}t.__layers=r}return t.__layers[e]}(t,n);if(!s)return-1;o=s[0],a=s[1]+1}var u=-1;if(e in t.numericProps){var c=t.numericProps[e].value.findIndex((function(t,e){return t===r&&i[e]>=o&&i[e]<a}));return c>=0?t.globalFeatureIds.value[c]:-1}return(u=e?Ta(t.properties,(function(t){return t[e]===r}),o,a):Ta(t.fields,(function(t){return t.id===r}),o,a))>=0?function(t,e){if(!t.__ids){for(var r=[],n=t.featureIds.value,i=t.globalFeatureIds.value,o=0;o<n.length;o++)r[n[o]]=i[o];t.__ids=r}return t.__ids[e]}(t,u):-1}function Ta(t,e,r,n){for(var i=r;i<n;i++)if(e(t[i],i))return i;return-1}function Pa(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Ma(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ma(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ma(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ca(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ia(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ca(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ca(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ka(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l()(t);if(e){var i=l()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u()(this,r)}}var Ra={uniqueIdProperty:{type:"string",value:""},highlightedFeatureId:null,loaders:[ta],binary:!0},La=function(t){a()(n,t);var e,r=ka(n);function n(){return i()(this,n),r.apply(this,arguments)}return d()(n,[{key:"initializeState",value:function(){Se()(l()(n.prototype),"initializeState",this).call(this),this.setState({data:null,tileJSON:null})}},{key:"updateState",value:function(t){var e=t.props,r=t.oldProps,i=t.context,o=t.changeFlags;o.dataChanged&&this._updateTileData(),this.state.data&&(Se()(l()(n.prototype),"updateState",this).call(this,{props:e,oldProps:r,context:i,changeFlags:o}),this._setWGS84PropertyForTiles())}},{key:"_updateTileData",value:(e=U()(z.a.mark((function t(){var e,r,n,i,o;return z.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.props.data,r=null,"string"!=typeof e||/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)){t.next=18;break}return n=this.props,i=n.onDataLoad,o=n.fetch,this.setState({data:null,tileJSON:null}),t.prev=5,t.next=8,o(e,{propName:"data",layer:this,loaders:[]});case 8:r=t.sent,t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),this.raiseError(t.t0,"loading TileJSON"),e=null;case 15:i&&i(r),t.next=19;break;case 18:e.tilejson&&(r=e);case 19:r&&(e=r.tiles),this.setState({data:e,tileJSON:r});case 21:case"end":return t.stop()}}),t,this,[[5,11]])}))),function(){return e.apply(this,arguments)})},{key:"_getTilesetOptions",value:function(t){var e=Se()(l()(n.prototype),"_getTilesetOptions",this).call(this,t),r=this.state.tileJSON;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>t.minZoom&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(t.maxZoom)||r.maxzoom<t.maxZoom)&&(e.maxZoom=r.maxzoom)),e}},{key:"renderLayers",value:function(){return this.state.data?Se()(l()(n.prototype),"renderLayers",this).call(this):null}},{key:"getTileData",value:function(t){var e,r=ie(this.state.data,t);if(!r)return Promise.reject("Invalid URL");var n=this.getLoadOptions(),i=this.props,o=i.binary,a=i.fetch,s=t.signal,u=t.x,c=t.y,l=t.z;return a(r,{propName:"data",layer:this,loadOptions:n=Ia(Ia({},n),{},{mimeType:"application/x-protobuf",mvt:Ia(Ia({},null===(e=n)||void 0===e?void 0:e.mvt),{},{coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:{x:u,y:c,z:l}}),gis:o?{format:"binary"}:{}}),signal:s})}},{key:"renderSubLayers",value:function(t){var e=t.tile,r=Math.pow(2,e.z),i=512/r,o=-i,a=512*e.x/r,s=512*(1-e.y/r),u=(new fe.a).scale([i,o,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[a,s,0],t.coordinateSystem=Tr.a.CARTESIAN,t.extensions=[].concat(H()(t.extensions||[]),[new Aa]));var c=Se()(l()(n.prototype),"renderSubLayers",this).call(this,t);return!this.props.binary||c instanceof B.a||V.a.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),c}},{key:"_updateAutoHighlight",value:function(t){var e,r,n=this.props.uniqueIdProperty,i=this.state,o=i.hoveredFeatureId,a=i.hoveredFeatureLayerName,s=t.object;s&&(e=ja(s,n),r=Da(s)),o===e&&a===r||this.setState({hoveredFeatureId:e,hoveredFeatureLayerName:r})}},{key:"getPickingInfo",value:function(t){var e=Se()(l()(n.prototype),"getPickingInfo",this).call(this,t),r=this.context.viewport.resolution;if(this.props.binary&&-1!==e.index){var i=t.sourceLayer.props.data;e.object=ea(i,{globalFeatureId:e.index})}return e.object&&!r&&(e.object=Fa(e.object,e.tile.bbox,this.context.viewport)),e}},{key:"getHighlightedObjectIndex",value:function(t){var e=this.state,r=e.hoveredFeatureId,n=e.hoveredFeatureLayerName,i=this.props,o=i.uniqueIdProperty,a=i.highlightedFeatureId,s=i.binary,u=t.content,c=Ba(a);if(!(Ba(r)||c))return-1;var l=c?a:r;return Array.isArray(u)?u.findIndex((function(t){var e=ja(t,o)===l,r=c||Da(t)===n;return e&&r})):u&&s?function(t,e,r,n){var i,o=wa(Sa);try{for(o.s();!(i=o.n()).done;){var a=i.value,s=t[a]&&Oa(t[a],e,r,n);if(s>=0)return s}}catch(t){o.e(t)}finally{o.f()}return-1}(u,o,l,c?"":n):-1}},{key:"_pickObjects",value:function(t){var e=this.context,r=e.deck,n=e.viewport,i=n.width,o=n.height,a=n.x,s=n.y,u=[this.id];return r.pickObjects({x:a,y:s,width:i,height:o,layerIds:u,maxObjects:t})}},{key:"getRenderedFeatures",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=this._pickObjects(e),n=new Set,i=[],o=Pa(r);try{for(o.s();!(t=o.n()).done;){var a=t.value,s=ja(a.object,this.props.uniqueIdProperty);void 0===s?i.push(a.object):n.has(s)||(n.add(s),i.push(a.object))}}catch(t){o.e(t)}finally{o.f()}return i}},{key:"_setWGS84PropertyForTiles",value:function(){var t=this;this.state.tileset.selectedTiles.forEach((function(e){e.hasOwnProperty("dataInWGS84")||Object.defineProperty(e,"dataInWGS84",{get:function(){if(!e.content)return null;if(t.props.binary&&Array.isArray(e.content)&&!e.content.length)return[];if(void 0===e._contentWGS84){var r=t.props.binary?ea(e.content):e.content;e._contentWGS84=r.map((function(r){return Fa(r,e.bbox,t.context.viewport)}))}return e._contentWGS84}})}))}},{key:"isLoaded",get:function(){return this.state.data&&this.state.tileset&&Se()(l()(n.prototype),"isLoaded",this)}}]),n}(we);function ja(t,e){return e?t.properties[e]:"id"in t?t.id:void 0}function Da(t){var e;return(null===(e=t.properties)||void 0===e?void 0:e.layerName)||null}function Ba(t){return null!=t&&""!==t}function Fa(t,e,r){var n=Ia(Ia({},t),{},{geometry:{type:t.geometry.type}});return Object.defineProperty(n.geometry,"coordinates",{get:function(){return function(t,e,r){var n=[r.projectFlat([e.west,e.north]),r.projectFlat([e.east,e.south])];return ma(ma({},t),{},{coordinates:ya[t.type](t.coordinates,n,r)})}(t.geometry,e,r).coordinates}}),n}La.layerName="MVTLayer",La.defaultProps=Ra,r.d(e,"GreatCircleLayer",(function(){return f})),r.d(e,"S2Layer",(function(){return j})),r.d(e,"TileLayer",(function(){return we})),r.d(e,"TripsLayer",(function(){return Me})),r.d(e,"H3ClusterLayer",(function(){return hr})),r.d(e,"H3HexagonLayer",(function(){return Sr})),r.d(e,"Tile3DLayer",(function(){return oo})),r.d(e,"TerrainLayer",(function(){return go})),r.d(e,"MVTLayer",(function(){return La}))},function(t,e,r){"use strict";r.r(e);var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(8),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),p=r(1),d=r.n(p),A=r(0),g=r.n(A),m=r(18),y=r(179),v=r(240),_=r(7),b=r(197),x=r(176),w=r(294);function E(t,e=[],r=0){const n=Math.fround(t),i=t-n;return e[r]=n,e[r+1]=i,e}function S(t){return t-Math.fround(t)}function O(t){const e=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){const i=4*r+n;E(t[4*n+r],e,2*i)}return e}const T={ONE:1};const P={name:"fp64-arithmetic",vs:"uniform float ONE;\nvec2 split(float a) {\n  const float SPLIT = 4097.0;\n  float t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float a_hi = t * ONE - (t - a);\n  float a_lo = a * ONE - a_hi;\n#else\n  float a_hi = t - (t - a);\n  float a_lo = a - a_hi;\n#endif\n  return vec2(a_hi, a_lo);\n}\nvec2 split2(vec2 a) {\n  vec2 b = split(a.x);\n  b.y += a.y;\n  return b;\n}\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float sum = (a + b) * ONE;\n  float err = b - (sum - a) * ONE;\n#else\n  float sum = a + b;\n  float err = b - (sum - a);\n#endif\n  return vec2(sum, err);\n}\nvec2 twoSum(float a, float b) {\n  float s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float v = (s * ONE - a) * ONE;\n  float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\n  float v = s - a;\n  float err = (a - (s - v)) + (b - v);\n#endif\n  return vec2(s, err);\n}\n\nvec2 twoSub(float a, float b) {\n  float s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float v = (s * ONE - a) * ONE;\n  float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\n  float v = s - a;\n  float err = (a - (s - v)) - (b + v);\n#endif\n  return vec2(s, err);\n}\n\nvec2 twoSqr(float a) {\n  float prod = a * a;\n  vec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\n    a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\n  float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\n  return vec2(prod, err);\n}\n\nvec2 twoProd(float a, float b) {\n  float prod = a * b;\n  vec2 a_fp64 = split(a);\n  vec2 b_fp64 = split(b);\n  float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\n    a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\n  return vec2(prod, err);\n}\n\nvec2 sum_fp64(vec2 a, vec2 b) {\n  vec2 s, t;\n  s = twoSum(a.x, b.x);\n  t = twoSum(a.y, b.y);\n  s.y += t.x;\n  s = quickTwoSum(s.x, s.y);\n  s.y += t.y;\n  s = quickTwoSum(s.x, s.y);\n  return s;\n}\n\nvec2 sub_fp64(vec2 a, vec2 b) {\n  vec2 s, t;\n  s = twoSub(a.x, b.x);\n  t = twoSub(a.y, b.y);\n  s.y += t.x;\n  s = quickTwoSum(s.x, s.y);\n  s.y += t.y;\n  s = quickTwoSum(s.x, s.y);\n  return s;\n}\n\nvec2 mul_fp64(vec2 a, vec2 b) {\n  vec2 prod = twoProd(a.x, b.x);\n  prod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  prod = split2(prod);\n#endif\n  prod = quickTwoSum(prod.x, prod.y);\n  prod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  prod = split2(prod);\n#endif\n  prod = quickTwoSum(prod.x, prod.y);\n  return prod;\n}\n\nvec2 div_fp64(vec2 a, vec2 b) {\n  float xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  vec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\n  vec2 yn = a * xn;\n#endif\n  float diff = (sub_fp64(a, mul_fp64(b, yn))).x;\n  vec2 prod = twoProd(xn, diff);\n  return sum_fp64(yn, prod);\n}\n\nvec2 sqrt_fp64(vec2 a) {\n  if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\n  if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n\n  float x = 1.0 / sqrt(a.x);\n  float yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n  vec2 yn_sqr = twoSqr(yn) * ONE;\n#else\n  vec2 yn_sqr = twoSqr(yn);\n#endif\n  float diff = sub_fp64(a, yn_sqr).x;\n  vec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n  return sum_fp64(split(yn), prod);\n#else\n  return sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n",fs:null,getUniforms:function(){return T},fp64ify:E,fp64LowPart:S,fp64ifyMatrix4:O};var M,C,I=r(153),k=r(207),R={SUM:1,MEAN:2,MIN:3,MAX:4};function L(t,e){return t+e}function j(t,e){return e>t?e:t}function D(t,e){return e<t?e:t}function B(t,e,r){var n=R[t]||R.SUM;switch(e=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Number.isFinite(t))return t;return function(r){return e.index=r.index,t(r.source,e)}}(e,r),n){case R.MIN:return function(t){return function(t,e){if(Number.isFinite(e))return t.length?e:null;var r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(D,1/0):null}(t,e)};case R.SUM:return function(t){return function(t,e){if(Number.isFinite(e))return t.length?t.length*e:null;var r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(L,0):null}(t,e)};case R.MEAN:return function(t){return function(t,e){if(Number.isFinite(e))return t.length?e:null;var r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(L,0)/r.length:null}(t,e)};case R.MAX:return function(t){return function(t,e){if(Number.isFinite(e))return t.length?e:null;var r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(j,-1/0):null}(t,e)};default:return null}}function F(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){return e.indices=r.map((function(t){return t.index})),t(r.map((function(t){return t.source})),e)}}var z,N={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},U=[32775,32774],V=[32776,32774],G=[32776,32775],W=(M={},g()(M,R.SUM,32774),g()(M,R.MEAN,32774),g()(M,R.MIN,U),g()(M,R.MAX,V),M),H={size:1,operation:R.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},q=(C={},g()(C,10240,9728),g()(C,10241,9728),r(98)),Z=r(71),X=(z={},g()(z,10240,9728),g()(z,10241,9728),z);function Q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.width,n=void 0===r?1:r,i=e.height,o=void 0===i?1:i,a=e.data,s=void 0===a?null:a,u=e.unpackFlipY,c=void 0===u||u,l=e.parameters,h=void 0===l?X:l,f=new q.a(t,{data:s,format:Object(_.j)(t)?34836:6408,type:5126,border:0,mipmaps:!1,parameters:h,dataFormat:6408,width:n,height:o,unpackFlipY:c});return f}function Y(t,e){var r=e.id,n=e.width,i=void 0===n?1:n,o=e.height,a=void 0===o?1:o,s=e.texture;return new Z.a(t,{id:r,width:i,height:a,attachments:g()({},36064,s)})}function K(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return $(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function J(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function tt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?J(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var et=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],rt={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},nt=[y.a.WEBGL2,y.a.COLOR_ATTACHMENT_RGBA32F,y.a.BLEND_EQUATION_MINMAX,y.a.FLOAT_BLEND,y.a.TEXTURE_FLOAT],it=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,t),this.id=r.id||"gpu-grid-aggregator",this.gl=e,this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},resources:{},results:{}},this._hasGPUSupport=Object(_.j)(e)&&Object(v.c)(this.gl,y.a.BLEND_EQUATION_MINMAX,y.a.COLOR_ATTACHMENT_RGBA32F,y.a.TEXTURE_FLOAT),this._hasGPUSupport&&this._setupModels()}return a()(t,null,[{key:"getAggregationData",value:function(t){var e=t.aggregationData,r=t.maxData,n=t.minData,i=t.maxMinData,o=4*t.pixelIndex,a={};return e&&(a.cellCount=e[o+3],a.cellWeight=e[o]),i?(a.maxCellWieght=i[0],a.minCellWeight=i[3]):(r&&(a.maxCellWieght=r[0],a.totalCount=r[3]),n&&(a.minCellWeight=n[0],a.totalCount=r[3])),a}},{key:"getCellData",value:function(t){for(var e=t.countsData,r=t.size,n=void 0===r?1:r,i=e.length/4,o=new Float32Array(i*n),a=new Uint32Array(i),s=0;s<i;s++){for(var u=0;u<n;u++)o[s*n+u]=e[4*s+u];a[s]=e[4*s+3]}return{cellCounts:a,cellWeights:o}}},{key:"isSupported",value:function(t){return Object(v.c)(t,nt)}}]),a()(t,[{key:"delete",value:function(){var t=this.gridAggregationModel,e=this.allAggregationModel,r=this.meanTransform,n=this.state,i=n.textures,o=n.framebuffers,a=n.maxMinFramebuffers,s=n.minFramebuffers,u=n.maxFramebuffers,c=n.meanTextures,l=n.resources;null==t||t.delete(),null==e||e.delete(),null==r||r.delete(),function(t){(t=Array.isArray(t)?t:[t]).forEach((function(t){for(var e in t)t[e].delete()}))}([o,i,a,s,u,c,l])}},{key:"run",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState({results:{}});var e=this._normalizeAggregationParams(t);return this._hasGPUSupport||m.a.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(e)}},{key:"getData",value:function(t){var e={},r=this.state.results;for(var n in r[t].aggregationData||(r[t].aggregationData=r[t].aggregationBuffer.getData()),e.aggregationData=r[t].aggregationData,rt){var i=rt[n];(r[t][n]||r[t][i])&&(r[t][n]=r[t][n]||r[t][i].getData(),e[n]=r[t][n])}return e}},{key:"updateShaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState({shaderOptions:t,modelDirty:!0})}},{key:"_normalizeAggregationParams",value:function(t){var e=tt(tt({},N),t),r=e.weights;return r&&(e.weights=function(t){var e={};for(var r in t)e[r]=tt(tt({},H),t[r]);return e}(r)),e}},{key:"setState",value:function(t){Object.assign(this.state,t)}},{key:"_getAggregateData",value:function(t){var e={},r=this.state,n=r.textures,i=r.framebuffers,o=r.maxMinFramebuffers,a=r.minFramebuffers,s=r.maxFramebuffers,u=r.resources,c=t.weights;for(var l in c){e[l]={};var h=c[l],f=h.needMin,p=h.needMax,d=h.combineMaxMin;e[l].aggregationTexture=n[l],e[l].aggregationBuffer=Object(b.d)(i[l],{target:c[l].aggregationBuffer,sourceType:5126}),f&&p&&d?(e[l].maxMinBuffer=Object(b.d)(o[l],{target:c[l].maxMinBuffer,sourceType:5126}),e[l].maxMinTexture=u["".concat(l,"-maxMinTexture")]):(f&&(e[l].minBuffer=Object(b.d)(a[l],{target:c[l].minBuffer,sourceType:5126}),e[l].minTexture=u["".concat(l,"-minTexture")]),p&&(e[l].maxBuffer=Object(b.d)(s[l],{target:c[l].maxBuffer,sourceType:5126}),e[l].maxTexture=u["".concat(l,"-maxTexture")]))}return this._trackGPUResultBuffers(e,c),e}},{key:"_renderAggregateData",value:function(t){var e=t.cellSize,r=t.projectPoints,n=t.attributes,i=t.moduleSettings,o=t.numCol,a=t.numRow,s=t.weights,u=t.translation,c=t.scaling,l=this.state,h=l.maxMinFramebuffers,f=l.minFramebuffers,p=l.maxFramebuffers,d=[o,a],A={blend:!0,depthTest:!1,blendFunc:[1,1]},g={cellSize:e,gridSize:d,projectPoints:r,translation:u,scaling:c};for(var m in s){var y=s[m],v=y.needMin,_=y.needMax,b=v&&_&&s[m].combineMaxMin;this._renderToWeightsTexture({id:m,parameters:A,moduleSettings:i,uniforms:g,gridSize:d,attributes:n,weights:s}),b?this._renderToMaxMinTexture({id:m,parameters:tt(tt({},A),{},{blendEquation:G}),gridSize:d,minOrMaxFb:h[m],clearParams:{clearColor:[0,0,0,3402823466e29]},combineMaxMin:b}):(v&&this._renderToMaxMinTexture({id:m,parameters:tt(tt({},A),{},{blendEquation:U}),gridSize:d,minOrMaxFb:f[m],clearParams:{clearColor:[3402823466e29,3402823466e29,3402823466e29,0]},combineMaxMin:b}),_&&this._renderToMaxMinTexture({id:m,parameters:tt(tt({},A),{},{blendEquation:V}),gridSize:d,minOrMaxFb:p[m],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:b}))}}},{key:"_renderToMaxMinTexture",value:function(t){var e=t.id,r=t.parameters,n=t.gridSize,i=t.minOrMaxFb,o=t.combineMaxMin,a=t.clearParams,s=void 0===a?{}:a,u=this.state.framebuffers,c=this.gl,l=this.allAggregationModel;Object(_.o)(c,tt(tt({},s),{},{framebuffer:i,viewport:[0,0,n[0],n[1]]}),(function(){c.clear(16384),l.draw({parameters:r,uniforms:{uSampler:u[e].texture,gridSize:n,combineMaxMin:o}})}))}},{key:"_renderToWeightsTexture",value:function(t){var e=t.id,r=t.parameters,n=t.moduleSettings,i=t.uniforms,o=t.gridSize,a=t.weights,s=this.state,u=s.framebuffers,c=s.equations,l=s.weightAttributes,h=this.gl,f=this.gridAggregationModel,p=a[e].operation,d=p===R.MIN?[3402823466e29,3402823466e29,3402823466e29,0]:[0,0,0,0];if(Object(_.o)(h,{framebuffer:u[e],viewport:[0,0,o[0],o[1]],clearColor:d},(function(){h.clear(16384);var t={weights:l[e]};f.draw({parameters:tt(tt({},r),{},{blendEquation:c[e]}),moduleSettings:n,uniforms:i,attributes:t})})),p===R.MEAN){var A=this.state,m=A.meanTextures,y=A.textures,v={_sourceTextures:{aggregationValues:m[e]},_targetTexture:y[e],elementCount:y[e].width*y[e].height};this.meanTransform?this.meanTransform.update(v):this.meanTransform=function(t,e){return new w.a(t,tt({vs:"#define SHADER_NAME gpu-aggregation-transform-mean-vs\nattribute vec4 aggregationValues;\nvarying vec4 meanValues;\n\nvoid main()\n{\n  bool isCellValid = bool(aggregationValues.w > 0.);\n  meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);\n  meanValues.w = aggregationValues.w;\n  gl_PointSize = 1.0;\n}\n",_targetTextureVarying:"meanValues"},e))}(h,v),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),u[e].attach(g()({},36064,y[e]))}}},{key:"_runAggregation",value:function(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);var e=this._getAggregateData(t);return this.setState({results:e}),e}},{key:"_setupFramebuffers",value:function(t){var e=this.state,r=e.textures,n=e.framebuffers,i=e.maxMinFramebuffers,o=e.minFramebuffers,a=e.maxFramebuffers,s=e.meanTextures,u=e.equations,c=t.weights,l=t.numCol,h=t.numRow,f={width:l,height:h};for(var p in c){var d=c[p],A=d.needMin,m=d.needMax,y=d.combineMaxMin,v=d.operation;r[p]=c[p].aggregationTexture||r[p]||Q(this.gl,{id:"".concat(p,"-texture"),width:l,height:h}),r[p].resize(f);var _=r[p];v===R.MEAN&&(s[p]=s[p]||Q(this.gl,{id:"".concat(p,"-mean-texture"),width:l,height:h}),s[p].resize(f),_=s[p]),n[p]?n[p].attach(g()({},36064,_)):n[p]=Y(this.gl,{id:"".concat(p,"-fb"),width:l,height:h,texture:_}),n[p].resize(f),u[p]=W[v]||W.SUM,(A||m)&&(A&&m&&y?i[p]||(_=c[p].maxMinTexture||this._getMinMaxTexture("".concat(p,"-maxMinTexture")),i[p]=Y(this.gl,{id:"".concat(p,"-maxMinFb"),texture:_})):(A&&(o[p]||(_=c[p].minTexture||this._getMinMaxTexture("".concat(p,"-minTexture")),o[p]=Y(this.gl,{id:"".concat(p,"-minFb"),texture:_}))),m&&(a[p]||(_=c[p].maxTexture||this._getMinMaxTexture("".concat(p,"-maxTexture")),a[p]=Y(this.gl,{id:"".concat(p,"-maxFb"),texture:_})))))}}},{key:"_getMinMaxTexture",value:function(t){var e=this.state.resources;return e[t]||(e[t]=Q(this.gl,{id:"resourceName"})),e[t]}},{key:"_setupModels",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.numCol,n=void 0===r?0:r,i=e.numRow,o=void 0===i?0:i,a=this.gl,s=this.state.shaderOptions;if(null===(t=this.gridAggregationModel)||void 0===t||t.delete(),this.gridAggregationModel=ot(a,s),!this.allAggregationModel){var u=n*o;this.allAggregationModel=at(a,u)}}},{key:"_setupWeightAttributes",value:function(t){var e=this.state.weightAttributes,r=t.weights;for(var n in r)e[n]=t.attributes[n]}},{key:"_trackGPUResultBuffers",value:function(t,e){var r=this.state.resources;for(var n in t)if(t[n]){var i,o=K(et);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(t[n][a]&&e[n][a]!==t[n][a]){var s="gpu-result-".concat(n,"-").concat(a);r[s]&&r[s].delete(),r[s]=t[n][a]}}}catch(t){o.e(t)}finally{o.f()}}}},{key:"_updateModels",value:function(t){var e=t.vertexCount,r=t.attributes,n=t.numCol,i=t.numRow;this.state.modelDirty&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(e),this.gridAggregationModel.setAttributes(r),this.allAggregationModel.setInstanceCount(n*i)}}]),t}();function ot(t,e){var r=Object(I.a)({vs:"#define SHADER_NAME gpu-aggregation-to-grid-vs\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute vec3 weights;\nuniform vec2 cellSize;\nuniform vec2 gridSize;\nuniform bool projectPoints;\nuniform vec2 translation;\nuniform vec3 scaling;\n\nvarying vec3 vWeights;\n\nvec2 project_to_pixel(vec4 pos) {\n  vec4 result;\n  pos.xy = pos.xy/pos.w;\n  result = pos + vec4(translation, 0., 0.);\n  result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;\n  return result.xy;\n}\n\nvoid main(void) {\n\n  vWeights = weights;\n\n  vec4 windowPos = vec4(positions, 1.);\n  if (projectPoints) {\n    windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));\n  }\n\n  vec2 pos = project_to_pixel(windowPos);\n\n  vec2 pixelXY64[2];\n  pixelXY64[0] = vec2(pos.x, 0.);\n  pixelXY64[1] = vec2(pos.y, 0.);\n  vec2 gridXY64[2];\n  gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));\n  gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));\n  float x = floor(gridXY64[0].x);\n  float y = floor(gridXY64[1].x);\n  pos = vec2(x, y);\n  pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);\n  vec2 offset = 1.0 / gridSize;\n  pos = pos + offset;\n\n  gl_Position = vec4(pos, 0.0, 1.0);\n  gl_PointSize = 1.0;\n}\n",fs:"#define SHADER_NAME gpu-aggregation-to-grid-fs\n\nprecision highp float;\n\nvarying vec3 vWeights;\n\nvoid main(void) {\n  gl_FragColor = vec4(vWeights, 1.0);\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[P,k.a]},e);return new x.a(t,tt({id:"Gird-Aggregation-Model",vertexCount:1,drawMode:0},r))}function at(t,e){return new x.a(t,{id:"All-Aggregation-Model",vs:"#version 300 es\n#define SHADER_NAME gpu-aggregation-all-vs-64\n\nin vec2 position;\nuniform ivec2 gridSize;\nout vec2 vTextureCoord;\n\nvoid main(void) {\n  vec2 pos = vec2(-1.0, -1.0);\n  vec2 offset = 1.0 / vec2(gridSize);\n  pos = pos + offset;\n\n  gl_Position = vec4(pos, 0.0, 1.0);\n\n  int yIndex = gl_InstanceID / gridSize[0];\n  int xIndex = gl_InstanceID - (yIndex * gridSize[0]);\n\n  vec2 yIndexFP64 = vec2(float(yIndex), 0.);\n  vec2 xIndexFP64 = vec2(float(xIndex), 0.);\n  vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);\n  vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);\n\n  vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);\n  vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);\n\n  vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);\n  gl_PointSize = 1.0;\n}\n",fs:"#version 300 es\n#define SHADER_NAME gpu-aggregation-all-fs\n\nprecision highp float;\n\nin vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool combineMaxMin;\nout vec4 fragColor;\nvoid main(void) {\n  vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n  if (textureColor.a == 0.) {\n    discard;\n  }\n  fragColor.rgb = textureColor.rgb;\n  fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;\n}\n",modules:[P],vertexCount:1,drawMode:0,isInstanced:!0,instanceCount:e,attributes:{position:[0,0]}})}var st=r(62),ut=r(226),ct=r(155),lt=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function ht(t){var e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float32Array;if(Number.isFinite(t[0]))e=new n(t);else{e=new n(4*t.length);for(var i=0,o=0;o<t.length;o++){var a=t[o];e[i++]=a[0],e[i++]=a[1],e[i++]=a[2],e[i++]=Number.isFinite(a[3])?a[3]:255}}if(r)for(var s=0;s<e.length;s++)e[s]/=255;return e}function ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function pt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ft(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function dt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var At=[0,0,0,0],gt=[0,255,0,255],mt=["minColor","maxColor","colorRange","colorDomain"],yt={cellSizePixels:{value:100,min:1},cellMarginPixels:{value:2,min:0,max:5},colorDomain:null,colorRange:lt},vt=function(t){l()(r,t);var e=dt(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"getShaders",value:function(){return{vs:"#define SHADER_NAME screen-grid-layer-vertex-shader\n#define RANGE_COUNT 6\n\nattribute vec3 positions;\nattribute vec3 instancePositions;\nattribute vec4 instanceCounts;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform vec3 cellScale;\nuniform vec4 minColor;\nuniform vec4 maxColor;\nuniform vec4 colorRange[RANGE_COUNT];\nuniform vec2 colorDomain;\nuniform bool shouldUseMinMax;\nuniform sampler2D maxTexture;\n\nvarying vec4 vColor;\nvarying float vSampleCount;\n\nvec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {\n  vec4 outColor = vec4(0., 0., 0., 0.);\n  if (value >= domain.x && value <= domain.y) {\n    float domainRange = domain.y - domain.x;\n    if (domainRange <= 0.) {\n      outColor = colorRange[0];\n    } else {\n      float rangeCount = float(RANGE_COUNT);\n      float rangeStep = domainRange / rangeCount;\n      float idx = floor((value - domain.x) / rangeStep);\n      idx = clamp(idx, 0., rangeCount - 1.);\n      int intIdx = int(idx);\n      outColor = colorRange[intIdx];\n    }\n  }\n  outColor = outColor / 255.;\n  return outColor;\n}\n\nvoid main(void) {\n  vSampleCount = instanceCounts.a;\n\n  float weight = instanceCounts.r;\n  float maxWeight = texture2D(maxTexture, vec2(0.5)).r;\n\n  float step = weight / maxWeight;\n  vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;\n\n  vec2 domain = colorDomain;\n  float domainMaxValid = float(colorDomain.y != 0.);\n  domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);\n  vec4 rangeColor = quantizeScale(domain, colorRange, weight);\n\n  float rangeMinMax = float(shouldUseMinMax);\n  vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);\n  vColor = vec4(color.rgb, color.a * opacity);\n  picking_setPickingColor(instancePickingColors);\n\n  gl_Position = vec4(instancePositions + positions * cellScale, 1.);\n}\n",fs:"#define SHADER_NAME screen-grid-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying float vSampleCount;\n\nvoid main(void) {\n  if (vSampleCount <= 0.0) {\n    discard;\n  }\n  gl_FragColor = vColor;\n\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[ut.a]}}},{key:"initializeState",value:function(){var t=this.context.gl;this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel(t)})}},{key:"shouldUpdateState",value:function(t){return t.changeFlags.somethingChanged}},{key:"updateState",value:function(t){var e=t.oldProps,n=t.props,i=t.changeFlags;u()(d()(r.prototype),"updateState",this).call(this,{oldProps:e,props:n,changeFlags:i});var o=this.getAttributeManager();n.numInstances!==e.numInstances?o.invalidateAll():e.cellSizePixels!==n.cellSizePixels&&o.invalidate("instancePositions"),this._updateUniforms(e,n,i)}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.parameters,i=r.maxTexture,o=this.props.minColor||At,a=this.props.maxColor||gt,s=this.props.colorDomain||[1,0];this.state.model.setUniforms(e).setUniforms({minColor:o,maxColor:a,maxTexture:i,colorDomain:s}).draw({parameters:pt({depthTest:!1,depthMask:!1},n)})}},{key:"calculateInstancePositions",value:function(t,e){for(var r=e.numInstances,n=this.context.viewport,i=n.width,o=n.height,a=this.props.cellSizePixels,s=Math.ceil(i/a),u=t.value,c=t.size,l=0;l<r;l++){var h=l%s,f=Math.floor(l/s);u[l*c+0]=h*a/i*2-1,u[l*c+1]=1-f*a/o*2,u[l*c+2]=0}}},{key:"_getModel",value:function(t){return new x.a(t,pt(pt({},this.getShaders()),{},{id:this.props.id,geometry:new st.a({drawMode:6,attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,1,0])}}),isInstanced:!0}))}},{key:"_shouldUseMinMax",value:function(){var t=this.props,e=t.minColor,r=t.maxColor,n=t.colorDomain,i=t.colorRange;return e||r?(m.a.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!n&&!i}},{key:"_updateUniforms",value:function(t,e,r){var n=this.state.model;if(mt.some((function(r){return t[r]!==e[r]}))&&n.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==e.colorRange&&n.setUniforms({colorRange:ht(e.colorRange)}),t.cellMarginPixels!==e.cellMarginPixels||t.cellSizePixels!==e.cellSizePixels||r.viewportChanged){var i=this.context.viewport,o=i.width,a=i.height,s=this.props,u=s.cellSizePixels,c=s.cellMarginPixels,l=u>c?c:0,h=new Float32Array([(u-l)/o*2,-(u-l)/a*2,1]);n.setUniforms({cellScale:h})}}}],[{key:"isSupported",value:function(t){return Object(v.c)(t,[y.a.TEXTURE_FLOAT])}}]),r}(ct.a);vt.layerName="ScreenGridCellLayer",vt.defaultProps=yt;var _t=r(129),bt=r(156),xt=r(190);function wt(t,e){var r={};for(var n in t)e.includes(n)||(r[n]=t[n]);return r}function Et(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return St(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return St(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function St(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ot(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var Tt=function(t){l()(r,t);var e=Ot(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(t){u()(d()(r.prototype),"initializeState",this).call(this),this.setState({ignoreProps:wt(this.constructor._propTypes,t.data.props),dimensions:t})}},{key:"updateState",value:function(t){if(u()(d()(r.prototype),"updateState",this).call(this,t),t.changeFlags.extensionsChanged){var e=this.getShaders({});e&&e.defines&&(e.defines.NON_INSTANCED_MODEL=1),this.updateShaders(e)}this._updateAttributes(t.props)}},{key:"updateAttributes",value:function(t){this.setState({changedAttributes:t})}},{key:"getAttributes",value:function(){return this.getAttributeManager().getShaderAttributes()}},{key:"getModuleSettings",value:function(){var t=this.context,e=t.viewport,r=t.mousePosition,n=t.gl;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:r,pickingActive:0,devicePixelRatio:Object(_.e)(n)})}},{key:"updateShaders",value:function(t){}},{key:"isAggregationDirty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.props,n=t.oldProps,i=t.changeFlags,o=e.compareAll,a=void 0!==o&&o,s=e.dimension,u=this.state.ignoreProps,c=s.props,l=s.accessors,h=void 0===l?[]:l,f=i.updateTriggersChanged;if(i.dataChanged)return!0;if(f){if(f.all)return!0;var p,d=Et(h);try{for(d.s();!(p=d.n()).done;){var A=p.value;if(f[A])return!0}}catch(t){d.e(t)}finally{d.f()}}if(a)return!!i.extensionsChanged||Object(_t.a)({oldProps:n,newProps:r,ignoreProps:u,propTypes:this.constructor._propTypes});var g,m=Et(c);try{for(m.s();!(g=m.n()).done;){var y=g.value;if(r[y]!==n[y])return!0}}catch(t){m.e(t)}finally{m.f()}return!1}},{key:"isAttributeChanged",value:function(t){var e=this.state.changedAttributes;return t?e&&void 0!==e[t]:!function(t){var e=!0;for(var r in t){e=!1;break}return e}(e)}},{key:"_getAttributeManager",value:function(){return new bt.a(this.context.gl,{id:this.props.id,stats:this.context.stats})}}]),r}(xt.a);Tt.layerName="AggregationLayer";var Pt=r(34),Mt=r(10),Ct=r.n(Mt);function It(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return kt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Rt(t,e,r){var n=r;return n.domain=function(){return t},n.range=function(){return e},n}function Lt(t,e){return Rt(t,e,(function(r){return function(t,e,r){var n=t[1]-t[0];if(n<=0)return m.a.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];var i=n/e.length,o=Math.floor((r-t[0])/i),a=Math.max(Math.min(o,e.length-1),0);return e[a]}(t,e,r)}))}function jt(t,e){return Rt(t,e,(function(r){return function(t,e,r){return(r-t[0])/(t[1]-t[0])*(e[1]-e[0])+e[0]}(t,e,r)}))}function Dt(t,e){for(var r=t.sort(Bt),n=0,i=Math.max(1,e.length),o=new Array(i-1);++n<i;)o[n-1]=Ft(r,n/i);var a=function(t){return function(t,e,r){return e[function(t,e){var r=0,n=t.length;for(;r<n;){var i=r+n>>>1;Bt(t[i],e)>0?n=i:r=i+1}return r}(t,r)]}(o,e,t)};return a.thresholds=function(){return o},Rt(t,e,a)}function Bt(t,e){return t-e}function Ft(t,e){var r=t.length;if(e<=0||r<2)return t[0];if(e>=1)return t[r-1];var n=(r-1)*e,i=Math.floor(n),o=t[i];return o+(t[i+1]-o)*(n-i)}function zt(t,e){var r,n=new Map,i=[],o=It(t);try{for(o.s();!(r=o.n()).done;){var a=r.value,s="".concat(a);n.has(s)||n.set(s,i.push(a))}}catch(t){o.e(t)}finally{o.f()}return Rt(t,e,(function(t){return function(t,e,r,n){var i="".concat(n),o=e.get(i);return void 0===o&&(o=t.push(n),e.set(i,o)),r[(o-1)%r.length]}(i,n,e,t)}))}function Nt(t){return null!=t}function Ut(t,e){return("function"==typeof e?t.map(e):t).filter(Nt)}function Vt(t,e){return Ut(t,e)}function Gt(t,e){return r=Ut(t,e),n=[],r.forEach((function(t){!n.includes(t)&&Nt(t)&&n.push(t)})),n;var r,n}function Wt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Ht(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ht(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ht(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var qt=function(t){return t.length},Zt=function(t){return t.points},Xt=function(t){return t.index},Qt=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},Yt={getValue:qt,getPoints:Zt,getIndex:Xt,filterData:null},Kt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yt;i()(this,t),this.aggregatedBins=this.getAggregatedBins(e,r),this._updateMinMaxValues(),this.binMap=this.getBinMap()}return a()(t,[{key:"getAggregatedBins",value:function(t,e){for(var r=e.getValue,n=void 0===r?qt:r,i=e.getPoints,o=void 0===i?Zt:i,a=e.getIndex,s=void 0===a?Xt:a,u=e.filterData,c="function"==typeof u,l=t.length,h=[],f=0,p=0;p<l;p++){var d=t[p],A=o(d),g=s(d),m=c?A.filter(u):A;d.filteredPoints=c?m:null;var y=m.length?n(m):null;null!=y&&(h[f]={i:Number.isFinite(g)?g:p,value:y,counts:m.length},f++)}return h}},{key:"_percentileToIndex",value:function(t){var e=this.sortedBins.length;if(e<2)return[0,0];var r=t.map((function(t){return e=t,r=0,n=100,Math.max(r,Math.min(n,e));var e,r,n})),n=Ct()(r,2),i=n[0],o=n[1];return[Math.ceil(i/100*(e-1)),Math.floor(o/100*(e-1))]}},{key:"getBinMap",value:function(){var t,e={},r=Wt(this.aggregatedBins);try{for(r.s();!(t=r.n()).done;){var n=t.value;e[n.i]=n}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"_updateMinMaxValues",value:function(){var t,e=0,r=0,n=3402823466e29,i=0,o=Wt(this.aggregatedBins);try{for(o.s();!(t=o.n()).done;){var a=t.value;e=e>a.counts?e:a.counts,r=r>a.value?r:a.value,n=n<a.value?n:a.value,i+=a.counts}}catch(t){o.e(t)}finally{o.f()}this.maxCount=e,this.maxValue=r,this.minValue=n,this.totalCount=i}},{key:"getValueRange",value:function(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((function(t,e){return Qt(t.value,e.value)}))),!this.sortedBins.length)return[];var e=0,r=this.sortedBins.length-1;if(Array.isArray(t)){var n=this._percentileToIndex(t);e=n[0],r=n[1]}return[this.sortedBins[e].value,this.sortedBins[r].value]}},{key:"getValueDomainByScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=Ct()(e,2),n=r[0],i=void 0===n?0:n,o=r[1],a=void 0===o?100:o;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((function(t,e){return Qt(t.value,e.value)}))),!this.sortedBins.length)return[];var s=this._percentileToIndex([i,a]);return this._getScaleDomain(t,s)}},{key:"_getScaleDomain",value:function(t,e){var r=Ct()(e,2),n=r[0],i=r[1],o=this.sortedBins;switch(t){case"quantize":case"linear":return[o[n].value,o[i].value];case"quantile":return Vt(o.slice(n,i+1),(function(t){return t.value}));case"ordinal":return Gt(o,(function(t){return t.value}));default:return[o[n].value,o[i].value]}}}]),t}(),$t=r(53),Jt=r(14);function te(t){return Number.isFinite(t)?t:0}function ee(t,e){for(var r,n,i=t.positions.value,o=1/0,a=-1/0,s=1/0,u=-1/0,c=0;c<e;c++)n=i[3*c],o=(r=i[3*c+1])<o?r:o,a=r>a?r:a,s=n<s?n:s,u=n>u?n:u;return{xMin:te(s),xMax:te(u),yMin:te(o),yMax:te(a)}}function re(t,e){var r=t<0?-1:1,n=r<0?Math.abs(t)+e:Math.abs(t);return(n=Math.floor(n/e)*e)*r}function ne(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!r)return{xOffset:e,yOffset:e};var n=t.yMin,i=t.yMax,o=(n+i)/2;return oe(e,o)}function ie(t,e,r,n){var i=ne(t,e,n!==Jt.a.CARTESIAN),o=function(t,e,r,n){var i=n.width,o=n.height,a=r===Jt.a.CARTESIAN?[-i/2,-o/2]:[-180,-90];m.a.assert(r===Jt.a.CARTESIAN||r===Jt.a.LNGLAT||r===Jt.a.DEFAULT);var s=t.xMin,u=t.yMin;return[-1*(re(s-a[0],e.xOffset)+a[0]),-1*(re(u-a[1],e.yOffset)+a[1])]}(t,i,n,r),a=t.xMin,s=t.yMin,u=t.xMax,c=t.yMax,l=u-a+i.xOffset,h=c-s+i.yOffset;return{gridOffset:i,translation:o,width:l,height:h,numCol:Math.ceil(l/i.xOffset),numRow:Math.ceil(h/i.yOffset)}}function oe(t,e){var r;return{yOffset:t/6378e3*(180/Math.PI),xOffset:(r=e,t/6378e3*(180/Math.PI)/Math.cos(r*Math.PI/180))}}function ae(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function se(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ae(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ue(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return ce(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ce(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function le(t,e){var r=function(t,e){var r=t.data,n=void 0===r?[]:r,i=t.cellSize,o=e.attributes,a=e.viewport,s=e.projectPoints,u=e.numInstances,c=o.positions.value,l=o.positions.getAccessor().size,h=e.boundingBox||function(t,e){for(var r,n,i=t.value,o=t.getAccessor().size,a=1/0,s=-1/0,u=1/0,c=-1/0,l=0;l<e;l++)n=i[l*o],r=i[l*o+1],Number.isFinite(n)&&Number.isFinite(r)&&(a=r<a?r:a,s=r>s?r:s,u=n<u?n:u,c=n>c?n:c);return{xMin:u,xMax:c,yMin:a,yMax:s}}(o.positions,u),f=e.posOffset||[180,90],p=e.gridOffset||ne(h,i);if(p.xOffset<=0||p.yOffset<=0)return{gridHash:{},gridOffset:p};var d,A=a.width,g=a.height,m=Math.ceil(A/p.xOffset),y=Math.ceil(g/p.yOffset),v={},_=Object($t.a)(n),b=_.iterable,x=_.objectInfo,w=new Array(3),E=ue(b);try{for(E.s();!(d=E.n()).done;){var S=d.value;x.index++,w[0]=c[x.index*l],w[1]=c[x.index*l+1],w[2]=l>=3?c[x.index*l+2]:0;var O=s?a.project(w):w,T=Ct()(O,2),P=T[0],M=T[1];if(Number.isFinite(P)&&Number.isFinite(M)){var C=Math.floor((M+f[1])/p.yOffset),I=Math.floor((P+f[0])/p.xOffset);if(!s||I>=0&&I<m&&C>=0&&C<y){var k="".concat(C,"-").concat(I);v[k]=v[k]||{count:0,points:[],lonIdx:I,latIdx:C},v[k].count+=1,v[k].points.push({source:S,index:x.index})}}}}catch(t){E.e(t)}finally{E.f()}return{gridHash:v,gridOffset:p,offsets:[-1*f[0],-1*f[1]]}}(t,e),n=function(t){var e=t.gridHash,r=t.gridOffset,n=t.offsets,i=new Array(Object.keys(e).length),o=0;for(var a in e){var s=a.split("-"),u=parseInt(s[0],10),c=parseInt(s[1],10),l=o++;i[l]=se({index:l,position:[n[0]+r.xOffset*c,n[1]+r.yOffset*u]},e[a])}return i}(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function he(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return fe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fe(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function fe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var de=function(t){l()(r,t);var e=pe(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(t){var e=t.dimensions,n=this.context.gl;u()(d()(r.prototype),"initializeState",this).call(this,e),this.setState({layerData:{},gpuGridAggregator:new it(n,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:le})}},{key:"updateState",value:function(t){u()(d()(r.prototype),"updateState",this).call(this,t),this.updateAggregationState(t);var e=this.state,n=e.aggregationDataDirty,i=e.aggregationWeightsDirty,o=e.gpuAggregation;if(!(this.getNumInstances()<=0)){var a=!1;(n||o&&i)&&(this._updateAggregation(t),a=!0),o||!n&&!i||(this._updateWeightBins(),this._uploadAggregationResults(),a=!0),this.setState({aggregationDirty:a})}}},{key:"finalizeState",value:function(){var t,e=this.state.weights.count;e&&e.aggregationBuffer&&e.aggregationBuffer.delete(),null===(t=this.state.gpuGridAggregator)||void 0===t||t.delete(),u()(d()(r.prototype),"finalizeState",this).call(this)}},{key:"updateShaders",value:function(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}},{key:"updateAggregationState",value:function(t){m.a.assert(!1)}},{key:"allocateResources",value:function(t,e){if(this.state.numRow!==t||this.state.numCol!==e){var r=e*t*4*4,n=this.context.gl,i=this.state.weights;for(var o in i){var a=i[o];a.aggregationBuffer&&a.aggregationBuffer.delete(),a.aggregationBuffer=new Pt.a(n,{byteLength:r,accessor:{size:4,type:5126,divisor:1}})}}}},{key:"updateResults",value:function(t){var e=t.aggregationData,r=t.maxMinData,n=t.maxData,i=t.minData,o=this.state.weights.count;o&&(o.aggregationData=e,o.maxMinData=r,o.maxData=n,o.minData=i)}},{key:"_updateAggregation",value:function(t){var e=this.state,r=e.cpuGridAggregator,n=e.gpuGridAggregator,i=e.gridOffset,o=e.posOffset,a=e.translation,s=void 0===a?[0,0]:a,u=e.scaling,c=void 0===u?[0,0,0]:u,l=e.boundingBox,h=e.projectPoints,f=e.gpuAggregation,p=e.numCol,d=e.numRow,A=t.props,g=this.context.viewport,m=this.getAttributes(),y=this.getNumInstances();if(f){var v=this.state.weights;n.run({weights:v,cellSize:[i.xOffset,i.yOffset],numCol:p,numRow:d,translation:s,scaling:c,vertexCount:y,projectPoints:h,attributes:m,moduleSettings:this.getModuleSettings()})}else{var _=r(A,{gridOffset:i,projectPoints:h,attributes:m,viewport:g,posOffset:o,boundingBox:l});this.setState({layerData:_})}}},{key:"_updateWeightBins",value:function(){var t=this.state.getValue,e=new Kt(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:e})}},{key:"_uploadAggregationResults",value:function(){var t,e=this.state,r=e.numCol,n=e.numRow,i=this.state.layerData.data,o=this.state.sortedBins,a=o.aggregatedBins,s=o.minValue,u=o.maxValue,c=o.totalCount,l=new Float32Array(r*n*4).fill(0),h=he(a);try{for(h.s();!(t=h.n()).done;){var f=t.value,p=i[f.i],d=p.lonIdx,A=p.latIdx,g=f.value,m=f.counts,y=4*(d+A*r);l[y]=g,l[y+4-1]=m}}catch(t){h.e(t)}finally{h.f()}var v=new Float32Array([u,0,0,s]),_=new Float32Array([u,0,0,c]),b=new Float32Array([s,0,0,c]);this.updateResults({aggregationData:l,maxMinData:v,maxData:_,minData:b})}}]),r}(Tt);function Ae(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function ge(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function me(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ge(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}de.layerName="GridAggregationLayer";var ye=me(me({},vt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),ve={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},_e=function(t){l()(r,t);var e=Ae(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t,e=this.context.gl;if(!vt.isSupported(e))return this.setState({supported:!1}),void m.a.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();u()(d()(r.prototype),"initializeState",this).call(this,{dimensions:ve,getCellSize:function(t){return t.cellSizePixels}});var n={count:{size:1,operation:R.SUM,needMax:!0,maxTexture:Q(e,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:n,subLayerData:{attributes:{}},maxTexture:n.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add((t={},g()(t,"positions",{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),g()(t,"count",{size:3,accessor:"getWeight"}),t))}},{key:"shouldUpdateState",value:function(t){var e=t.changeFlags;return this.state.supported&&e.somethingChanged}},{key:"updateState",value:function(t){u()(d()(r.prototype),"updateState",this).call(this,t)}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var t=this.state,e=t.maxTexture,r=t.numRow,n=t.numCol,i=t.weights,o=this.props.updateTriggers,a=i.count.aggregationBuffer;return new(this.getSubLayerClass("cells",vt))(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:o}),{data:{attributes:{instanceCounts:a}},maxTexture:e,numInstances:r*n})}},{key:"finalizeState",value:function(){u()(d()(r.prototype),"finalizeState",this).call(this);var t=this.state,e=t.aggregationBuffer,n=t.maxBuffer,i=t.maxTexture;null==e||e.delete(),null==n||n.delete(),null==i||i.delete()}},{key:"getPickingInfo",value:function(t){var e=t.info,r=(t.mode,e.index);if(r>=0){var n=this.state,i=n.gpuGridAggregator,o=n.gpuAggregation,a=n.weights,s=o?i.getData("count"):a.count;e.object=it.getAggregationData(me({pixelIndex:r},s))}return e}},{key:"updateResults",value:function(t){var e=t.aggregationData,r=t.maxData,n=this.state.weights.count;n.aggregationData=e,n.aggregationBuffer.setData({data:e}),n.maxData=r,n.maxTexture.setImageData({data:r})}},{key:"updateAggregationState",value:function(t){var e=t.props.cellSizePixels,r=t.oldProps.cellSizePixels!==e,n=t.changeFlags.viewportChanged,i=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&i&&!it.isSupported(this.context.gl)&&(m.a.warn("GPU Grid Aggregation not supported, falling back to CPU")(),i=!1);var o=i!==this.state.gpuAggregation;this.setState({gpuAggregation:i});var a=this.isAttributeChanged("positions"),s=this.state.dimensions,u=s.data,c=s.weights,l=a||o||n||this.isAggregationDirty(t,{compareAll:i,dimension:u}),h=this.isAggregationDirty(t,{dimension:c});this.setState({aggregationDataDirty:l,aggregationWeightsDirty:h});var f=this.context.viewport;if(n||r){var p=f.width,d=f.height,A=Math.ceil(p/e),g=Math.ceil(d/e);this.allocateResources(g,A),this.setState({scaling:[p/2,-d/2,1],gridOffset:{xOffset:e,yOffset:e},width:p,height:d,numCol:A,numRow:g})}h&&this._updateAccessors(t),(l||h)&&this._resetResults()}},{key:"_updateAccessors",value:function(t){var e=t.props,r=e.getWeight,n=e.aggregation,i=e.data,o=this.state.weights.count;o&&(o.getWeight=r,o.operation=R[n]),this.setState({getValue:B(n,r,{data:i})})}},{key:"_resetResults",value:function(){var t=this.state.weights.count;t&&(t.aggregationData=null)}}]),r}(de);_e.layerName="ScreenGridLayer",_e.defaultProps=ye;var be=r(214),xe=r(24),we=r.n(xe);function Ee(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Se(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ee(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ee(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Oe(){}var Te=["getBins","getDomain","getScaleFunc"],Pe=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],Me=function(t){return t.cellSize},Ce=function(){function t(e){i()(this,t),this.state={layerData:{},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=e.getCellSize||Me,this._getAggregator=e.getAggregator,this._addDimension(e.dimensions||Pe)}return a()(t,[{key:"updateState",value:function(t,e){var r=t.oldProps,n=t.props,i=t.changeFlags;this.updateGetValueFuncs(r,n,i);var o=this.needsReProjectPoints(r,n,i),a=!1;i.dataChanged||o?(this.getAggregatedData(n,e),a=!0):((this.getDimensionChanges(r,n,i)||[]).forEach((function(t){return"function"==typeof t&&t()})),a=!0);return this.setState({aggregationDirty:a}),this.state}},{key:"setState",value:function(t){this.state=Se(Se({},this.state),t)}},{key:"setDimensionState",value:function(t,e){this.setState({dimensions:Se(Se({},this.state.dimensions),{},g()({},t,Se(Se({},this.state.dimensions[t]),e)))})}},{key:"normalizeResult",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.hexagons?Se({data:t.hexagons},t):t.layerData?Se({data:t.layerData},t):t}},{key:"getAggregatedData",value:function(t,e){var r=this._getAggregator(t)(t,e);this.setState({layerData:this.normalizeResult(r)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}},{key:"updateGetValueFuncs",value:function(t,e,r){for(var n in this.dimensionUpdaters){var i=this.dimensionUpdaters[n].getBins.triggers,o=i.value,a=i.weight,s=i.aggregation,u=e[o.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[n].getBins,t,e,r)&&(u=u?F(u,{data:e.data}):B(e[s.prop],e[a.prop],{data:e.data})),u&&this.setDimensionState(n,{getValue:u})}}},{key:"needsReProjectPoints",value:function(t,e,r){return this._getCellSize(t)!==this._getCellSize(e)||this._getAggregator(t)!==this._getAggregator(e)||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPosition)}},{key:"addDimension",value:function(t){this._addDimension(t)}},{key:"_addDimension",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((function(e){var r=e.key;t.dimensionUpdaters[r]=t.getDimensionUpdaters(e),t.state.dimensions[r]={getValue:null,domain:null,sortedBins:null,scaleFunc:Oe}}))}},{key:"getDimensionUpdaters",value:function(t){var e=t.key,r=t.accessor,n=t.pickingInfo,i=t.getBins,o=t.getDomain,a=t.getScaleFunc,s=t.nullValue;return{key:e,accessor:r,pickingInfo:n,getBins:Se({updater:this.getDimensionSortedBins},i),getDomain:Se({updater:this.getDimensionValueDomain},o),getScaleFunc:Se({updater:this.getDimensionScale},a),attributeAccessor:this.getSubLayerDimensionAttribute(e,s)}}},{key:"needUpdateDimensionStep",value:function(t,e,r,n){return Object.values(t.triggers).some((function(t){return t.updateTrigger?n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged[t.updateTrigger]):e[t.prop]!==r[t.prop]}))}},{key:"getDimensionChanges",value:function(t,e,r){var n=this,i=[],o=function(o){var a=Te.find((function(i){return n.needUpdateDimensionStep(n.dimensionUpdaters[o][i],t,e,r)}));a&&i.push(n.dimensionUpdaters[o][a].updater.bind(n,e,n.dimensionUpdaters[o]))};for(var a in this.dimensionUpdaters)o(a);return i.length?i:null}},{key:"getUpdateTriggers",value:function(t){var e=this,r=t.updateTriggers||{},n={},i=function(i){var o=e.dimensionUpdaters[i].accessor;n[o]={},Te.forEach((function(a){Object.values(e.dimensionUpdaters[i][a].triggers).forEach((function(e){var i=e.prop,a=e.updateTrigger;if(a){var s=r[a];"object"!==we()(s)||Array.isArray(s)?void 0!==s&&(n[o][i]=s):Object.assign(n[o],s)}else n[o][i]=t[i]}))}))};for(var o in this.dimensionUpdaters)i(o);return n}},{key:"getSortedBins",value:function(t){for(var e in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[e])}},{key:"getDimensionSortedBins",value:function(t,e){var r=e.key,n=this.state.dimensions[r].getValue,i=new Kt(this.state.layerData.data||[],{getValue:n,filterData:t._filterData});this.setDimensionState(r,{sortedBins:i}),this.getDimensionValueDomain(t,e)}},{key:"getDimensionValueDomain",value:function(t,e){var r=e.getDomain,n=e.key,i=r.triggers,o=i.lowerPercentile,a=i.upperPercentile,s=i.scaleType,u=this.state.dimensions[n].sortedBins.getValueDomainByScale(t[s.prop],[t[o.prop],t[a.prop]]);this.setDimensionState(n,{valueDomain:u}),this.getDimensionScale(t,e)}},{key:"getDimensionScale",value:function(t,e){var r=e.key,n=e.getScaleFunc,i=e.getDomain,o=n.triggers,a=o.domain,s=o.range,u=i.triggers.scaleType,c=n.onSet,l=t[s.prop],h=t[a.prop]||this.state.dimensions[r].valueDomain,f=function(t){switch(t){case"quantize":return Lt;case"linear":return jt;case"quantile":return Dt;case"ordinal":return zt;default:return Lt}}(u&&t[u.prop])(h,l);"object"===we()(c)&&"function"==typeof t[c.props]&&t[c.props](f.domain()),this.setDimensionState(r,{scaleFunc:f})}},{key:"getSubLayerDimensionAttribute",value:function(t,e){var r=this;return function(n){var i=r.state.dimensions[t],o=i.sortedBins,a=i.scaleFunc,s=o.binMap[n.index];if(s&&0===s.counts)return e;var u=s&&s.value,c=a.domain();return u>=c[0]&&u<=c[c.length-1]?a(u):e}}},{key:"getSubLayerAccessors",value:function(t){var e={};for(var r in this.dimensionUpdaters){e[this.dimensionUpdaters[r].accessor]=this.getSubLayerDimensionAttribute(t,r)}return e}},{key:"getPickingInfo",value:function(t){var e=t.info,r=null;if(e.picked&&e.index>-1){var n=this.state.layerData.data[e.index],i={};for(var o in this.dimensionUpdaters){var a=this.dimensionUpdaters[o].pickingInfo,s=this.state.dimensions[o].sortedBins,u=s.binMap[n.index]&&s.binMap[n.index].value;i[a]=u}r=Object.assign(i,n,{points:n.filteredPoints||n.points})}return e.picked=Boolean(r),e.object=r,e}},{key:"getAccessor",value:function(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:Oe}}],[{key:"defaultDimensions",value:function(){return Pe}}]),t}();function Ie(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function ke(){}var Re={colorDomain:null,colorRange:lt,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:ke,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:ke,gridAggregator:le,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Le=function(t){l()(r,t);var e=Ie(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t=new Ce({getAggregator:function(t){return t.gridAggregator},getCellSize:function(t){return t.cellSize}});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,accessor:"getPosition"}})}},{key:"updateState",value:function(t){u()(d()(r.prototype),"updateState",this).call(this,t),this.setState({aggregatorState:this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances(t.props)})})}},{key:"getPickingInfo",value:function(t){var e=t.info;return this.state.cpuAggregator.getPickingInfo({info:e})}},{key:"_onGetSublayerColor",value:function(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}},{key:"_onGetSublayerElevation",value:function(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var t=this.props,e=t.elevationScale,r=t.extruded,n=t.cellSize,i=t.coverage,o=t.material,a=t.transitions,s=this.state.cpuAggregator,u=this.getSubLayerClass("grid-cell",be.a),c=this._getSublayerUpdateTriggers();return new u({cellSize:n,coverage:i,material:o,elevationScale:e,extruded:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:a&&{getFillColor:a.getColorValue||a.getColorWeight,getElevation:a.getElevationValue||a.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:c}),{data:s.state.layerData.data})}}]),r}(Tt);Le.layerName="CPUGridLayer",Le.defaultProps=Re;var je=r(157),De=Math.PI/3,Be=[0,De,2*De,3*De,4*De,5*De];function Fe(t){return t[0]}function ze(t){return t[1]}function Ne(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Ue(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ue(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ue(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ve(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ge(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ve(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ve(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function We(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function He(){}var qe={colorDomain:null,colorRange:lt,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:He,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:He,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:function(t,e){var r,n=t.data,i=t.radius,o=e.viewport,a=e.attributes,s=n.length?function(t,e){var r,n=e.attributes,i=n.positions.value,o=n.positions.getAccessor().size,a=1/0,s=1/0,u=-1/0,c=-1/0;for(r=0;r<o*t.length;r+=o){var l=i[r],h=i[r+1];Number.isFinite(l)&&Number.isFinite(h)&&(a=Math.min(l,a),u=Math.max(l,u),s=Math.min(h,s),c=Math.max(h,c))}return[a,s,u,c].every(Number.isFinite)?[(a+u)/2,(s+c)/2]:null}(n,e):null,u=function(t,e,r){var n=e.getDistanceScales(r).unitsPerMeter;return t*n[0]}(i,o,s),c=[],l=Object($t.a)(n),h=l.iterable,f=l.objectInfo,p=a.positions.value,d=a.positions.getAccessor().size,A=Ne(h);try{for(A.s();!(r=A.n()).done;){var g=r.value;f.index++;var y=f.index*d,v=[p[y],p[y+1]];Number.isFinite(v[0])&&Number.isFinite(v[1])?c.push({screenCoord:o.projectFlat(v),source:g,index:f.index}):m.a.warn("HexagonLayer: invalid position")()}}catch(t){A.e(t)}finally{A.f()}return{hexagons:function(){var t,e,r,n=0,i=0,o=1,a=1,s=Fe,u=ze;function c(t){var n,i={},o=[],a=t.length;for(n=0;n<a;++n)if(!isNaN(l=+s.call(null,c=t[n],n,t))&&!isNaN(h=+u.call(null,c,n,t))){var c,l,h,f=Math.round(h/=r),p=Math.round(l=l/e-(1&f)/2),d=h-f;if(3*Math.abs(d)>1){var A=l-p,g=p+(l<p?-1:1)/2,m=f+(h<f?-1:1),y=l-g,v=h-m;A*A+d*d>y*y+v*v&&(p=g+(1&f?1:-1)/2,f=m)}var _=p+"-"+f,b=i[_];b?b.push(c):(o.push(b=i[_]=[c]),b.x=(p+(1&f)/2)*e,b.y=f*r)}return o}function l(t){var e=0,r=0;return Be.map((function(n){var i=Math.sin(n)*t,o=-Math.cos(n)*t,a=i-e,s=o-r;return e=i,r=o,[a,s]}))}return c.hexagon=function(e){return"m"+l(null==e?t:+e).join("l")+"z"},c.centers=function(){for(var s=[],u=Math.round(i/r),c=Math.round(n/e),l=u*r;l<a+t;l+=r,++u)for(var h=c*e+(1&u)*e/2;h<o+e/2;h+=e)s.push([h,l]);return s},c.mesh=function(){var e=l(t).slice(0,4).join("l");return c.centers().map((function(t){return"M"+t+"m"+e})).join("")},c.x=function(t){return arguments.length?(s=t,c):s},c.y=function(t){return arguments.length?(u=t,c):u},c.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(De),r=1.5*t,c):t},c.size=function(t){return arguments.length?(n=i=0,o=+t[0],a=+t[1],c):[o-n,a-i]},c.extent=function(t){return arguments.length?(n=+t[0][0],i=+t[0][1],o=+t[1][0],a=+t[1][1],c):[[n,i],[o,a]]},c.radius(1)}().radius(u).x((function(t){return t.screenCoord[0]})).y((function(t){return t.screenCoord[1]}))(c).map((function(t,e){return{position:o.unprojectFlat([t.x,t.y]),points:t,index:e}})),radiusCommon:u}},getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},Ze=function(t){l()(r,t);var e=We(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t=new Ce({getAggregator:function(t){return t.hexagonAggregator},getCellSize:function(t){return t.radius}});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,accessor:"getPosition"}})}},{key:"updateState",value:function(t){if(u()(d()(r.prototype),"updateState",this).call(this,t),t.changeFlags.propsOrDataChanged){var e=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==e.layerData){var n=(e.layerData||{}).hexagonVertices;this.setState({vertices:n&&this.convertLatLngToMeterOffset(n)})}this.setState({aggregatorState:e})}}},{key:"convertLatLngToMeterOffset",value:function(t){var e=this.context.viewport;if(Array.isArray(t)&&6===t.length){var r=t[0],n=t[3],i=[(r[0]+n[0])/2,(r[1]+n[1])/2],o=e.projectFlat(i),a=e.getDistanceScales(i).metersPerUnit;return t.map((function(t){var r=e.projectFlat(t);return[(r[0]-o[0])*a[0],(r[1]-o[1])*a[1]]}))}return m.a.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}},{key:"getPickingInfo",value:function(t){var e=t.info;return this.state.cpuAggregator.getPickingInfo({info:e})}},{key:"_onGetSublayerColor",value:function(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}},{key:"_onGetSublayerElevation",value:function(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var t=this.props,e=t.elevationScale,r=t.extruded,n=t.coverage,i=t.material,o=t.transitions,a=this.state,s=a.aggregatorState,u=a.vertices,c=this.getSubLayerClass("hexagon-cell",je.a),l=this._getSublayerUpdateTriggers();return new c(Ge(Ge({},u?{vertices:u,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90}),{},{diskResolution:6,elevationScale:e,extruded:r,coverage:n,material:i,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:o&&{getFillColor:o.getColorValue||o.getColorWeight,getElevation:o.getElevationValue||o.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:l}),{data:s.layerData.data})}}]),r}(Tt);Ze.layerName="HexagonLayer",Ze.defaultProps=qe;var Xe,Qe=r(223),Ye=r(108),Ke={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},$e=[Ke.W,Ke.SW,Ke.S],Je=[Ke.S,Ke.SE,Ke.E],tr=[Ke.E,Ke.NE,Ke.N],er=[Ke.NW,Ke.W,Ke.N],rr=[[-.5,1/6],[-.5,-1/6],[-1/6,-.5],[1/6,-.5]],nr=[[-1/6,-.5],[1/6,-.5],[.5,-1/6],[.5,1/6]],ir=[[.5,-1/6],[.5,1/6],[1/6,.5],[-1/6,.5]],or=[[-.5,1/6],[-.5,-1/6],[1/6,.5],[-1/6,.5]],ar=[Ke.W,Ke.SW,Ke.SE,Ke.E],sr=[Ke.S,Ke.SE,Ke.NE,Ke.N],ur=[Ke.NW,Ke.W,Ke.E,Ke.NE],cr=[Ke.NW,Ke.SW,Ke.S,Ke.N],lr=[[-.5,1/6],[-.5,-1/6],[.5,-1/6],[.5,1/6]],hr=[[-1/6,-.5],[1/6,-.5],[1/6,.5],[-1/6,.5]],fr=[Ke.NW,Ke.SW,Ke.SE,Ke.NE],pr=[Ke.NW,Ke.SW,Ke.SE,Ke.E,Ke.N],dr=[Ke.W,Ke.SW,Ke.SE,Ke.NE,Ke.N],Ar=[Ke.NW,Ke.W,Ke.S,Ke.SE,Ke.NE],gr=[Ke.NW,Ke.SW,Ke.S,Ke.E,Ke.NE],mr=[Ke.NW,Ke.W,[.5,-1/6],[.5,1/6],Ke.N],yr=[[-1/6,-.5],[1/6,-.5],Ke.E,Ke.NE,Ke.N],vr=[[-.5,1/6],[-.5,-1/6],Ke.S,Ke.SE,Ke.E],_r=[Ke.W,Ke.SW,Ke.S,[1/6,.5],[-1/6,.5]],br=[Ke.NW,Ke.W,[-1/6,-.5],[1/6,-.5],Ke.N],xr=[[-.5,1/6],[-.5,-1/6],Ke.E,Ke.NE,Ke.N],wr=[Ke.S,Ke.SE,Ke.E,[1/6,.5],[-1/6,.5]],Er=[Ke.W,Ke.SW,Ke.S,[.5,-1/6],[.5,1/6]],Sr=[Ke.W,Ke.SW,Ke.SE,Ke.E,[1/6,.5],[-1/6,.5]],Or=[[-.5,1/6],[-.5,-1/6],Ke.S,Ke.SE,Ke.NE,Ke.N],Tr=[Ke.NW,Ke.W,[-1/6,-.5],[1/6,-.5],Ke.E,Ke.NE],Pr=[Ke.NW,Ke.SW,Ke.S,[.5,-1/6],[.5,1/6],Ke.N],Mr=[Ke.W,Ke.SW,Ke.S,Ke.E,Ke.NE,Ke.N],Cr=[Ke.NW,Ke.W,Ke.S,Ke.SE,Ke.E,Ke.N],Ir=[[-.5,1/6],[-.5,-1/6],[-1/6,-.5],[1/6,-.5],Ke.E,Ke.NE,Ke.N],kr=[Ke.W,Ke.SW,Ke.S,[.5,-1/6],[.5,1/6],[1/6,.5],[-1/6,.5]],Rr=[Ke.NW,Ke.W,[-1/6,-.5],[1/6,-.5],[.5,-1/6],[.5,1/6],Ke.N],Lr=[[-.5,1/6],[-.5,-1/6],Ke.S,Ke.SE,Ke.E,[1/6,.5],[-1/6,.5]],jr=[[-.5,1/6],[-.5,-1/6],[-1/6,-.5],[1/6,-.5],[.5,-1/6],[.5,1/6],[1/6,.5],[-1/6,.5]],Dr={0:[],1:[[Ke.W,Ke.S]],2:[[Ke.S,Ke.E]],3:[[Ke.W,Ke.E]],4:[[Ke.N,Ke.E]],5:{0:[[Ke.W,Ke.S],[Ke.N,Ke.E]],1:[[Ke.W,Ke.N],[Ke.S,Ke.E]]},6:[[Ke.N,Ke.S]],7:[[Ke.W,Ke.N]],8:[[Ke.W,Ke.N]],9:[[Ke.N,Ke.S]],10:{0:[[Ke.W,Ke.N],[Ke.S,Ke.E]],1:[[Ke.W,Ke.S],[Ke.N,Ke.E]]},11:[[Ke.N,Ke.E]],12:[[Ke.W,Ke.E]],13:[[Ke.S,Ke.E]],14:[[Ke.W,Ke.S]],15:[]};function Br(t){return parseInt(t,4)}var Fr=(Xe={},g()(Xe,Br("0000"),[]),g()(Xe,Br("2222"),[]),g()(Xe,Br("2221"),[$e]),g()(Xe,Br("2212"),[Je]),g()(Xe,Br("2122"),[tr]),g()(Xe,Br("1222"),[er]),g()(Xe,Br("0001"),[$e]),g()(Xe,Br("0010"),[Je]),g()(Xe,Br("0100"),[tr]),g()(Xe,Br("1000"),[er]),g()(Xe,Br("2220"),[rr]),g()(Xe,Br("2202"),[nr]),g()(Xe,Br("2022"),[ir]),g()(Xe,Br("0222"),[or]),g()(Xe,Br("0002"),[rr]),g()(Xe,Br("0020"),[nr]),g()(Xe,Br("0200"),[ir]),g()(Xe,Br("2000"),[or]),g()(Xe,Br("0011"),[ar]),g()(Xe,Br("0110"),[sr]),g()(Xe,Br("1100"),[ur]),g()(Xe,Br("1001"),[cr]),g()(Xe,Br("2211"),[ar]),g()(Xe,Br("2112"),[sr]),g()(Xe,Br("1122"),[ur]),g()(Xe,Br("1221"),[cr]),g()(Xe,Br("2200"),[lr]),g()(Xe,Br("2002"),[hr]),g()(Xe,Br("0022"),[lr]),g()(Xe,Br("0220"),[hr]),g()(Xe,Br("1111"),[fr]),g()(Xe,Br("1211"),[pr]),g()(Xe,Br("2111"),[dr]),g()(Xe,Br("1112"),[Ar]),g()(Xe,Br("1121"),[gr]),g()(Xe,Br("1011"),[pr]),g()(Xe,Br("0111"),[dr]),g()(Xe,Br("1110"),[Ar]),g()(Xe,Br("1101"),[gr]),g()(Xe,Br("1200"),[mr]),g()(Xe,Br("0120"),[yr]),g()(Xe,Br("0012"),[vr]),g()(Xe,Br("2001"),[_r]),g()(Xe,Br("1022"),[mr]),g()(Xe,Br("2102"),[yr]),g()(Xe,Br("2210"),[vr]),g()(Xe,Br("0221"),[_r]),g()(Xe,Br("1002"),[br]),g()(Xe,Br("2100"),[xr]),g()(Xe,Br("0210"),[wr]),g()(Xe,Br("0021"),[Er]),g()(Xe,Br("1220"),[br]),g()(Xe,Br("0122"),[xr]),g()(Xe,Br("2012"),[wr]),g()(Xe,Br("2201"),[Er]),g()(Xe,Br("0211"),[Sr]),g()(Xe,Br("2110"),[Or]),g()(Xe,Br("1102"),[Tr]),g()(Xe,Br("1021"),[Pr]),g()(Xe,Br("2011"),[Sr]),g()(Xe,Br("0112"),[Or]),g()(Xe,Br("1120"),[Tr]),g()(Xe,Br("1201"),[Pr]),g()(Xe,Br("2101"),[Mr]),g()(Xe,Br("0121"),[Mr]),g()(Xe,Br("1012"),[Cr]),g()(Xe,Br("1210"),[Cr]),g()(Xe,Br("0101"),{0:[$e,tr],1:[Mr],2:[Mr]}),g()(Xe,Br("1010"),{0:[er,Je],1:[Cr],2:[Cr]}),g()(Xe,Br("2121"),{0:[Mr],1:[Mr],2:[$e,tr]}),g()(Xe,Br("1212"),{0:[Cr],1:[Cr],2:[er,Je]}),g()(Xe,Br("2120"),{0:[Ir],1:[Ir],2:[rr,tr]}),g()(Xe,Br("2021"),{0:[kr],1:[kr],2:[$e,ir]}),g()(Xe,Br("1202"),{0:[Rr],1:[Rr],2:[er,nr]}),g()(Xe,Br("0212"),{0:[Lr],1:[Lr],2:[Je,or]}),g()(Xe,Br("0102"),{0:[rr,tr],1:[Ir],2:[Ir]}),g()(Xe,Br("0201"),{0:[$e,ir],1:[kr],2:[kr]}),g()(Xe,Br("1020"),{0:[er,nr],1:[Rr],2:[Rr]}),g()(Xe,Br("2010"),{0:[Je,or],1:[Lr],2:[Lr]}),g()(Xe,Br("2020"),{0:[or,nr],1:[jr],2:[rr,ir]}),g()(Xe,Br("0202"),{0:[ir,rr],1:[jr],2:[or,nr]}),Xe);function zr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Nr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?zr(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Ur=1,Vr=2,Gr={zIndex:0,zOffset:.005};function Wr(t,e){return Array.isArray(e)?t<e[0]?0:t<e[1]?1:2:t>=e?1:0}function Hr(t){var e=t.cellWeights,r=t.x,n=t.y,i=t.width,o=t.height,a=t.threshold;t.thresholdValue&&(m.a.deprecated("thresholdValue","threshold")(),a=t.thresholdValue);var s=r<0,u=r>=i-1,c=n<0,l=n>=o-1,h=s||u||c||l,f={},p={};s||l?p.top=0:(f.top=e[(n+1)*i+r],p.top=Wr(f.top,a)),u||l?p.topRight=0:(f.topRight=e[(n+1)*i+r+1],p.topRight=Wr(f.topRight,a)),u||c?p.right=0:(f.right=e[n*i+r+1],p.right=Wr(f.right,a)),s||c?p.current=0:(f.current=e[n*i+r],p.current=Wr(f.current,a));var d=p.top,A=p.topRight,g=p.right,y=p.current,v=-1;Number.isFinite(a)&&(v=d<<3|A<<2|g<<1|y),Array.isArray(a)&&(v=d<<6|A<<4|g<<2|y);var _=0;return h||(_=Wr((f.top+f.topRight+f.right+f.current)/4,a)),{code:v,meanCode:_}}function qr(t){var e=t.gridOrigin,r=t.cellSize,n=t.x,i=t.y,o=t.code,a=t.meanCode,s=t.type,u=void 0===s?Ur:s,c=Nr(Nr({},Gr),t.thresholdData),l=u===Vr?Fr[o]:Dr[o];Array.isArray(l)||(l=l[a]);var h=c.zIndex*c.zOffset,f=(n+1)*r[0],p=(i+1)*r[1],d=e[0]+f,A=e[1]+p;if(u===Vr){var g=[];return l.forEach((function(t){var e=[];t.forEach((function(t){var n=d+t[0]*r[0],i=A+t[1]*r[1];e.push([n,i,h])})),g.push(e)})),g}var m=[];return l.forEach((function(t){t.forEach((function(t){var e=d+t[0]*r[0],n=A+t[1]*r[1];m.push([e,n,h])}))})),m}function Zr(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Xr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xr(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Xr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var Yr=[255,255,255,255],Kr={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM",contours:[{threshold:1}],zOffset:.005},$r={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Jr=function(t){l()(r,t);var e=Qr(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t;u()(d()(r.prototype),"initializeState",this).call(this,{dimensions:$r}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:R.SUM}}}),this.getAttributeManager().add((t={},g()(t,"positions",{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),g()(t,"count",{size:3,accessor:"getWeight"}),t))}},{key:"updateState",value:function(t){u()(d()(r.prototype),"updateState",this).call(this,t);var e=!1,n=t.oldProps,i=t.props,o=this.state.aggregationDirty;n.contours===i.contours&&n.zOffset===i.zOffset||(e=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(o||e)&&this._generateContours()}},{key:"renderLayers",value:function(){var t=this.state.contourData,e=t.contourSegments,r=t.contourPolygons,n=this.getSubLayerClass("lines",Qe.a),i=this.getSubLayerClass("bands",Ye.a);return[e&&e.length>0&&new n(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(t){return t.start},getTargetPosition:function(t){return t.end},getColor:function(t){return t.contour.color||Yr},getWidth:function(t){return t.contour.strokeWidth||1}}),r&&r.length>0&&new i(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(t){return t.vertices},getFillColor:function(t){return t.contour.color||Yr}})]}},{key:"updateAggregationState",value:function(t){var e=t.props,r=t.oldProps,n=e.cellSize,i=e.coordinateSystem,o=this.context.viewport,a=r.cellSize!==n,s=e.gpuAggregation;this.state.gpuAggregation!==e.gpuAggregation&&s&&!it.isSupported(this.context.gl)&&(m.a.warn("GPU Grid Aggregation not supported, falling back to CPU")(),s=!1);var u=s!==this.state.gpuAggregation;this.setState({gpuAggregation:s});var c=this.state.dimensions,l=this.isAttributeChanged("positions"),h=c.data,f=c.weights,p=this.state.boundingBox;if(l&&(p=ee(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:p})),l||a){var d=ie(p,n,o,i),A=d.gridOffset,g=d.translation,y=d.width,v=d.height,_=d.numCol,b=d.numRow;this.allocateResources(b,_),this.setState({gridOffset:A,boundingBox:p,translation:g,posOffset:g.slice(),gridOrigin:[-1*g[0],-1*g[1]],width:y,height:v,numCol:_,numRow:b})}var x=l||u||this.isAggregationDirty(t,{dimension:h,compareAll:s}),w=this.isAggregationDirty(t,{dimension:f});w&&this._updateAccessors(t),(x||w)&&this._resetResults(),this.setState({aggregationDataDirty:x,aggregationWeightsDirty:w})}},{key:"_updateAccessors",value:function(t){var e=t.props,r=e.getWeight,n=e.aggregation,i=e.data,o=this.state.weights.count;o&&(o.getWeight=r,o.operation=R[n]),this.setState({getValue:B(n,r,{data:i})})}},{key:"_resetResults",value:function(){var t=this.state.weights.count;t&&(t.aggregationData=null)}},{key:"_generateContours",value:function(){var t=this.state,e=t.numCol,r=t.numRow,n=t.gridOrigin,i=t.gridOffset,o=t.thresholdData,a=this.state.weights.count,s=a.aggregationData;s||(s=a.aggregationBuffer.getData(),a.aggregationData=s);var u=function(t){var e,r=t.thresholdData,n=(t.colors,t.cellWeights),i=t.gridSize,o=t.gridOrigin,a=t.cellSize,s=[],u=[],c=i[0],l=i[1],h=0,f=0,p=Zr(r);try{for(p.s();!(e=p.n()).done;)for(var d=e.value,A=d.contour,g=A.threshold,m=-1;m<c;m++)for(var y=-1;y<l;y++){var v=Hr({cellWeights:n,threshold:g,x:m,y:y,width:c,height:l}),_={gridOrigin:o,cellSize:a,x:m,y:y,width:c,height:l,code:v.code,meanCode:v.meanCode,thresholdData:d};if(Array.isArray(g)){_.type=Vr;var b,x=Zr(qr(_));try{for(x.s();!(b=x.n()).done;){var w=b.value;u[f++]={vertices:w,contour:A}}}catch(t){x.e(t)}finally{x.f()}}else{_.type=Ur;for(var E=qr(_),S=0;S<E.length;S+=2)s[h++]={start:E[S],end:E[S+1],contour:A}}}}catch(t){p.e(t)}finally{p.f()}return{contourSegments:s,contourPolygons:u}}({thresholdData:o,cellWeights:it.getCellData({countsData:s}).cellWeights,gridSize:[e,r],gridOrigin:n,cellSize:[i.xOffset,i.yOffset]});this.setState({contourData:u})}},{key:"_updateThresholdData",value:function(t){for(var e=t.contours,r=t.zOffset,n=e.length,i=new Array(n),o=0;o<n;o++){var a=e[o];i[o]={contour:a,zIndex:a.zIndex||o,zOffset:r}}this.setState({thresholdData:i})}}]),r}(de);Jr.layerName="ContourLayer",Jr.defaultProps=Kr;var tn=r(227),en=r(35),rn=r(275);function nn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function on(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nn(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function an(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var sn={colorDomain:null,colorRange:lt,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",min:0,value:[1,1]},gridOrigin:{type:"array",min:0,value:[0,0]},gridOffset:{type:"array",min:0,value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",min:0,value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},un=function(t){l()(r,t);var e=an(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"getShaders",value:function(){return u()(d()(r.prototype),"getShaders",this).call(this,{vs:"#version 300 es\n#define SHADER_NAME gpu-grid-cell-layer-vertex-shader\n#define RANGE_COUNT 6\n\nin vec3 positions;\nin vec3 normals;\n\nin vec4 colors;\nin vec4 elevations;\nin vec3 instancePickingColors;\nuniform vec2 offset;\nuniform bool extruded;\nuniform float cellSize;\nuniform float coverage;\nuniform float opacity;\nuniform float elevationScale;\n\nuniform ivec2 gridSize;\nuniform vec2 gridOrigin;\nuniform vec2 gridOriginLow;\nuniform vec2 gridOffset;\nuniform vec2 gridOffsetLow;\nuniform vec4 colorRange[RANGE_COUNT];\nuniform vec2 elevationRange;\nuniform vec2 colorDomain;\nuniform bool colorDomainValid;\nuniform vec2 elevationDomain;\nuniform bool elevationDomainValid;\n\nlayout(std140) uniform;\nuniform ColorData\n{\n  vec4 maxMinCount;\n} colorData;\nuniform ElevationData\n{\n  vec4 maxMinCount;\n} elevationData;\n\n#define EPSILON 0.00001\nout vec4 vColor;\n\nvec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {\n  vec4 outColor = vec4(0., 0., 0., 0.);\n  if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {\n    float domainRange = domain.y - domain.x;\n    if (domainRange <= 0.) {\n      outColor = colorRange[0];\n    } else {\n      float rangeCount = float(RANGE_COUNT);\n      float rangeStep = domainRange / rangeCount;\n      float idx = floor((value - domain.x) / rangeStep);\n      idx = clamp(idx, 0., rangeCount - 1.);\n      int intIdx = int(idx);\n      outColor = colorRange[intIdx];\n    }\n  }\n  return outColor;\n}\n\nfloat linearScale(vec2 domain, vec2 range, float value) {\n  if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {\n    return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;\n  }\n  return -1.;\n}\n\nvoid main(void) {\n  vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);\n  vec4 color = quantizeScale(clrDomain, colorRange, colors.r);\n\n  float elevation = 0.0;\n\n  if (extruded) {\n    vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);\n    elevation = linearScale(elvDomain, elevationRange, elevations.r);\n    elevation = elevation  * (positions.z + 1.0) / 2.0 * elevationScale;\n  }\n  float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);\n  float dotRadius = cellSize / 2. * coverage * shouldRender;\n\n  int yIndex = (gl_InstanceID / gridSize[0]);\n  int xIndex = gl_InstanceID - (yIndex * gridSize[0]);\n\n  vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));\n  instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));\n  vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));\n  instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));\n\n  vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);\n  vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);\n  geometry.worldPosition = centroidPosition;\n  vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);\n  picking_setPickingColor(instancePickingColors);\n\n  vec4 position_commonspace;\n  gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, position_commonspace);\n\n  vec3 normals_commonspace = project_normal(normals);\n\n   if (extruded) {\n    vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, position_commonspace.xyz, normals_commonspace);\n    vColor = vec4(lightColor, color.a * opacity) / 255.;\n  } else {\n    vColor = vec4(color.rgb, color.a * opacity) / 255.;\n  }\n}\n",fs:"#version 300 es\n#define SHADER_NAME gpu-grid-cell-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n  fragColor = vColor;\n  fragColor = picking_filterColor(fragColor);\n}\n",modules:[k.a,tn.a,ut.a,P]})}},{key:"initializeState",value:function(){var t=this.context.gl;this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var e=this._getModel(t);this._setupUniformBuffer(e),this.setState({model:e})}},{key:"_getModel",value:function(t){return new x.a(t,on(on({},this.getShaders()),{},{id:this.props.id,geometry:new rn.a,isInstanced:!0}))}},{key:"draw",value:function(t){var e=t.uniforms,r=this.props,n=r.cellSize,i=r.offset,o=r.extruded,a=r.elevationScale,s=r.coverage,u=r.gridSize,c=r.gridOrigin,l=r.gridOffset,h=r.elevationRange,f=r.colorMaxMinBuffer,p=r.elevationMaxMinBuffer,d=[Object(en.b)(c[0]),Object(en.b)(c[1])],A=[Object(en.b)(l[0]),Object(en.b)(l[1])],g=this.getDomainUniforms(),m=ht(this.props.colorRange);this.bindUniformBuffers(f,p),this.state.model.setUniforms(e).setUniforms(g).setUniforms({cellSize:n,offset:i,extruded:o,elevationScale:a,coverage:s,gridSize:u,gridOrigin:c,gridOriginLow:d,gridOffset:l,gridOffsetLow:A,colorRange:m,elevationRange:h}).draw(),this.unbindUniformBuffers(f,p)}},{key:"bindUniformBuffers",value:function(t,e){t.bind({target:35345,index:0}),e.bind({target:35345,index:1})}},{key:"unbindUniformBuffers",value:function(t,e){t.unbind({target:35345,index:0}),e.unbind({target:35345,index:1})}},{key:"getDomainUniforms",value:function(){var t=this.props,e=t.colorDomain,r=t.elevationDomain,n={};return null!==e?(n.colorDomainValid=!0,n.colorDomain=e):n.colorDomainValid=!1,null!==r?(n.elevationDomainValid=!0,n.elevationDomain=r):n.elevationDomainValid=!1,n}},{key:"_setupUniformBuffer",value:function(t){var e=this.context.gl,r=t.program.handle,n=e.getUniformBlockIndex(r,"ColorData"),i=e.getUniformBlockIndex(r,"ElevationData");e.uniformBlockBinding(r,n,0),e.uniformBlockBinding(r,i,1)}}]),r}(ct.a);function cn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ln(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?cn(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function hn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}un.layerName="GPUGridCellLayer",un.defaultProps=sn;var fn={colorDomain:null,colorRange:lt,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0},pn={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},dn=function(t){l()(r,t);var e=hn(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t,e=this.context.gl,n=it.isSupported(e);n||m.a.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),u()(d()(r.prototype),"initializeState",this).call(this,{dimensions:pn}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:n,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new Pt.a(e,{byteLength:16,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new Pt.a(e,{byteLength:16,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add((t={},g()(t,"positions",{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),g()(t,"color",{size:3,accessor:"getColorWeight"}),g()(t,"elevation",{size:3,accessor:"getElevationWeight"}),t))}},{key:"updateState",value:function(t){!1!==this.state.isSupported&&(u()(d()(r.prototype),"updateState",this).call(this,t),this.state.aggregationDirty&&this.setState({gridHash:null}))}},{key:"getHashKeyForIndex",value:function(t){var e=this.state,r=e.numRow,n=e.numCol,i=e.boundingBox,o=e.gridOffset,a=[n,r],s=[i.xMin,i.yMin],u=[o.xOffset,o.yOffset],c=Math.floor(t/a[0]),l=t-c*a[0],h=Math.floor((c*u[1]+s[1]+90+u[1]/2)/u[1]),f=Math.floor((l*u[0]+s[0]+180+u[0]/2)/u[0]);return"".concat(h,"-").concat(f)}},{key:"getPositionForIndex",value:function(t){var e=this.state,r=e.numRow,n=e.numCol,i=e.boundingBox,o=e.gridOffset,a=[n,r],s=[i.xMin,i.yMin],u=[o.xOffset,o.yOffset],c=Math.floor(t/a[0]);return[(t-c*a[0])*u[0]+s[0],c*u[1]+s[1]]}},{key:"getPickingInfo",value:function(t){var e=t.info,r=t.mode,n=e.index,i=null;if(n>=0){var o=this.state.gpuGridAggregator,a=this.getPositionForIndex(n),s=it.getAggregationData(ln({pixelIndex:n},o.getData("color"))),u=it.getAggregationData(ln({pixelIndex:n},o.getData("elevation")));if(i={colorValue:s.cellWeight,elevationValue:u.cellWeight,count:s.cellCount||u.cellCount,position:a,totalCount:s.totalCount||u.totalCount},"hover"!==r){var c=this.props,l=this.state.gridHash;if(!l){var h=this.state,f=h.gridOffset,p=h.translation,d=h.boundingBox,A=this.context.viewport;l=le(c,{gridOffset:f,attributes:this.getAttributes(),viewport:A,translation:p,boundingBox:d}).gridHash,this.setState({gridHash:l})}var g=l[this.getHashKeyForIndex(n)];Object.assign(i,g)}}return e.picked=Boolean(i),e.object=i,e}},{key:"renderLayers",value:function(){if(!this.state.isSupported)return null;var t=this.props,e=t.elevationScale,r=t.extruded,n=t.cellSize,i=t.coverage,o=t.material,a=t.elevationRange,s=t.colorDomain,u=t.elevationDomain,c=this.state,l=c.weights,h=c.numRow,f=c.numCol,p=c.gridOrigin,d=c.gridOffset,A=l.color,g=l.elevation,m=ht(this.props.colorRange);return new(this.getSubLayerClass("gpu-grid-cell",un))({gridSize:[f,h],gridOrigin:p,gridOffset:[d.xOffset,d.yOffset],colorRange:m,elevationRange:a,colorDomain:s,elevationDomain:u,cellSize:n,coverage:i,material:o,elevationScale:e,extruded:r},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:A.aggregationBuffer,elevations:g.aggregationBuffer}},colorMaxMinBuffer:A.maxMinBuffer,elevationMaxMinBuffer:g.maxMinBuffer,numInstances:f*h})}},{key:"finalizeState",value:function(){var t=this.state.weights;[t.color,t.elevation].forEach((function(t){var e=t.aggregationBuffer;t.maxMinBuffer.delete(),null==e||e.delete()})),u()(d()(r.prototype),"finalizeState",this).call(this)}},{key:"updateAggregationState",value:function(t){var e=t.props,r=t.oldProps,n=e.cellSize,i=e.coordinateSystem,o=this.context.viewport,a=r.cellSize!==n,s=this.state.dimensions,u=this.isAttributeChanged("positions"),c=u||this.isAttributeChanged(),l=this.state.boundingBox;if(u&&(l=ee(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:l})),u||a){var h=ie(l,n,o,i),f=h.gridOffset,p=h.translation,d=h.width,A=h.height,g=h.numCol,m=h.numRow;this.allocateResources(m,g),this.setState({gridOffset:f,translation:p,gridOrigin:[-1*p[0],-1*p[1]],width:d,height:A,numCol:g,numRow:m})}var y=c||this.isAggregationDirty(t,{dimension:s.data,compareAll:!0});y&&this._updateAccessors(t),this.setState({aggregationDataDirty:y})}},{key:"_updateAccessors",value:function(t){var e=t.props,r=e.colorAggregation,n=e.elevationAggregation,i=this.state.weights,o=i.color,a=i.elevation;o.operation=R[r],a.operation=R[n]}}]),r}(de);function An(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}function gn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function mn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gn(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}dn.layerName="GPUGridLayer",dn.defaultProps=fn;var yn=mn(mn(mn({},dn.defaultProps),Le.defaultProps),{},{gpuAggregation:!1}),vn=function(t){l()(r,t);var e=An(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){this.state={useGPUAggregation:!0}}},{key:"updateState",value:function(t){t.oldProps;var e=t.props,r=(t.changeFlags,{});r.useGPUAggregation=this.canUseGPUAggregation(e),this.setState(r)}},{key:"renderLayers",value:function(){var t=this.props,e=t.data,r=t.updateTriggers,n=this.state.useGPUAggregation?"GPU":"CPU";return new(this.state.useGPUAggregation?this.getSubLayerClass("GPU",dn):this.getSubLayerClass("CPU",Le))(this.props,this.getSubLayerProps({id:n,updateTriggers:r}),{data:e})}},{key:"canUseGPUAggregation",value:function(t){var e=t.gpuAggregation,r=t.lowerPercentile,n=t.upperPercentile,i=t.getColorValue,o=t.getElevationValue,a=t.colorScaleType;return!!e&&(!!it.isSupported(this.context.gl)&&(0===r&&100===n&&(null===i&&null===o&&("quantile"!==a&&"ordinal"!==a))))}}]),r}(xt.a);function _n(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return bn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bn(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function xn(t){var e=t.map((function(t){return t[0]})),r=t.map((function(t){return t[1]})),n=Math.min.apply(null,e),i=Math.max.apply(null,e);return[n,Math.min.apply(null,r),i,Math.max.apply(null,r)]}function wn(t,e){return e[0]>=t[0]&&e[2]<=t[2]&&e[1]>=t[1]&&e[3]<=t[3]}vn.layerName="GridLayer",vn.defaultProps=yn;var En=new Float32Array(12);function Sn(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=0,i=_n(t);try{for(i.s();!(e=i.n()).done;)for(var o=e.value,a=0;a<r;a++)En[n++]=o[a]||0}catch(t){i.e(t)}finally{i.f()}return En}function On(t,e,r){var n=Ct()(t,4),i=n[0],o=n[1],a=n[2],s=n[3],u=a-i,c=s-o,l=u,h=c;u/c<e/r?l=e/r*c:h=r/e*u,l<e&&(l=e,h=r);var f=(a+i)/2,p=(s+o)/2;return[f-l/2,p-h/2,f+l/2,p+h/2]}function Tn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Pn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Tn(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Mn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var Cn=function(t){l()(r,t);var e=Mn(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"getShaders",value:function(){return{vs:"#define SHADER_NAME heatp-map-layer-vertex-shader\n\nuniform sampler2D maxTexture;\nuniform float intensity;\nuniform vec2 colorDomain;\nuniform float threshold;\nuniform float aggregationMode;\n\nattribute vec3 positions;\nattribute vec2 texCoords;\n\nvarying vec2 vTexCoords;\nvarying float vIntensityMin;\nvarying float vIntensityMax;\n\nvoid main(void) {\n  gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));\n  vTexCoords = texCoords;\n  vec4 maxTexture = texture2D(maxTexture, vec2(0.5));\n  float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;\n  float minValue = maxValue * threshold;\n  if (colorDomain[1] > 0.) {\n    maxValue = colorDomain[1];\n    minValue = colorDomain[0];\n  }\n  vIntensityMax = intensity / maxValue;\n  vIntensityMin = intensity / minValue;\n}\n",fs:"#define SHADER_NAME triangle-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D texture;\nuniform sampler2D colorTexture;\nuniform float aggregationMode;\n\nvarying vec2 vTexCoords;\nvarying float vIntensityMin;\nvarying float vIntensityMax;\n\nvec4 getLinearColor(float value) {\n  float factor = clamp(value * vIntensityMax, 0., 1.);\n  vec4 color = texture2D(colorTexture, vec2(factor, 0.5));\n  color.a *= min(value * vIntensityMin, 1.0);\n  return color;\n}\n\nvoid main(void) {\n  vec4 weights = texture2D(texture, vTexCoords);\n  float weight = weights.r;\n\n  if (aggregationMode > 0.5) {\n    weight /= max(1.0, weights.a);\n  }\n  if (weight <= 0.) {\n     discard;\n  }\n\n  vec4 linearColor = getLinearColor(weight);\n  linearColor.a *= opacity;\n  gl_FragColor =linearColor;\n}\n",modules:[k.a]}}},{key:"initializeState",value:function(){var t=this.context.gl;this.getAttributeManager().add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(t)})}},{key:"_getModel",value:function(t){var e=this.props.vertexCount;return new x.a(t,Pn(Pn({},this.getShaders()),{},{id:this.props.id,geometry:new st.a({drawMode:6,vertexCount:e})}))}},{key:"draw",value:function(t){var e=t.uniforms,r=this.state.model,n=this.props,i=n.texture,o=n.maxTexture,a=n.colorTexture,s=n.intensity,u=n.threshold,c=n.aggregationMode,l=n.colorDomain;r.setUniforms(Pn(Pn({},e),{},{texture:i,maxTexture:o,colorTexture:a,intensity:s,threshold:u,aggregationMode:c,colorDomain:l})).draw()}}]),r}(ct.a);Cn.layerName="TriangleLayer";var In;function kn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Rn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?kn(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ln(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d()(t);if(e){var i=d()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f()(this,r)}}var jn={mipmaps:!1,parameters:(In={},g()(In,10240,9729),g()(In,10241,9729),g()(In,10242,33071),g()(In,10243,33071),In),dataFormat:6408},Dn=[0,0],Bn={SUM:0,MEAN:1},Fn={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:lt,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},zn=[y.a.BLEND_EQUATION_MINMAX,y.a.TEXTURE_FLOAT],Nn={data:{props:["radiusPixels"]}},Un=function(t){l()(r,t);var e=Ln(r);function r(){return i()(this,r),e.apply(this,arguments)}return a()(r,[{key:"initializeState",value:function(){var t=this.context.gl;if(!Object(v.c)(t,zn))return this.setState({supported:!1}),void m.a.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();u()(d()(r.prototype),"initializeState",this).call(this,Nn),this.setState({supported:!0,colorDomain:Dn}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}},{key:"shouldUpdateState",value:function(t){return t.changeFlags.somethingChanged}},{key:"updateState",value:function(t){this.state.supported&&(u()(d()(r.prototype),"updateState",this).call(this,t),this._updateHeatmapState(t))}},{key:"_updateHeatmapState",value:function(t){var e=t.props,r=t.oldProps,n=this._getChangeFlags(t);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),e.colorRange!==r.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var t=this.state,e=t.weightsTexture,r=t.triPositionBuffer,n=t.triTexCoordBuffer,i=t.maxWeightsTexture,o=t.colorTexture,a=t.colorDomain,s=this.props,u=s.updateTriggers,c=s.intensity,l=s.threshold,h=s.aggregation;return new(this.getSubLayerClass("triangle",Cn))(this.getSubLayerProps({id:"triangle-layer",updateTriggers:u}),{coordinateSystem:Jt.a.DEFAULT,data:{attributes:{positions:r,texCoords:n}},vertexCount:4,maxTexture:i,colorTexture:o,aggregationMode:Bn[h]||0,texture:e,intensity:c,threshold:l,colorDomain:a})}},{key:"finalizeState",value:function(){u()(d()(r.prototype),"finalizeState",this).call(this);var t=this.state,e=t.weightsTransform,n=t.weightsTexture,i=t.maxWeightTransform,o=t.maxWeightsTexture,a=t.triPositionBuffer,s=t.triTexCoordBuffer,c=t.colorTexture,l=t.updateTimer;null==e||e.delete(),null==n||n.delete(),null==i||i.delete(),null==o||o.delete(),null==a||a.delete(),null==s||s.delete(),null==c||c.delete(),l&&clearTimeout(l)}},{key:"_getAttributeManager",value:function(){return new bt.a(this.context.gl,{id:this.props.id,stats:this.context.stats})}},{key:"_getChangeFlags",value:function(t){var e={},r=this.state.dimensions;e.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(t,{compareAll:!0,dimension:r.data}),e.viewportChanged=t.changeFlags.viewportChanged;var n=this.state.zoom;return t.context.viewport&&t.context.viewport.zoom===n||(e.viewportZoomChanged=!0),e}},{key:"_createTextures",value:function(){var t=this.context.gl,e=this.state,r=e.textureSize,n=e.format,i=e.type;this.setState({weightsTexture:new q.a(t,Rn({width:r,height:r,format:n,type:i},jn)),maxWeightsTexture:new q.a(t,Rn({format:n,type:i},jn))})}},{key:"_setupAttributes",value:function(){this.getAttributeManager().add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}},{key:"_setupTextureParams",value:function(){var t=this.context.gl,e=this.props.weightsTextureSize,r=Math.min(e,Object(_.f)(t,3379)),n=Object(v.c)(t,y.a.COLOR_ATTACHMENT_RGBA32F),i=function(t){var e=t.gl,r=t.floatTargetSupport;return{format:Object(_.j)(e)?34836:6408,type:r?5126:5121}}({gl:t,floatTargetSupport:n}),o=i.format,a=i.type,s=n?1:1/255;this.setState({textureSize:r,format:o,type:a,weightsScale:s}),n||m.a.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()}},{key:"getShaders",value:function(t){return u()(d()(r.prototype),"getShaders",this).call(this,"max-weights-transform"===t?{vs:"attribute vec4 inTexture;\nvarying vec4 outTexture;\n\nvoid main()\n{\noutTexture = inTexture;\ngl_Position = vec4(0, 0, 0, 1.);\ngl_PointSize = 1.0;\n}\n",_fs:"varying vec4 outTexture;\nvoid main() {\n  gl_FragColor = outTexture;\n  gl_FragColor.g = outTexture.r / max(1.0, outTexture.a);\n}\n"}:{vs:"attribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float weights;\nvarying vec4 weightsTexture;\nuniform float radiusPixels;\nuniform float textureWidth;\nuniform vec4 commonBounds;\nuniform float weightsScale;\nvoid main()\n{\n  weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);\n\n  float radiusTexels  = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);\n  gl_PointSize = radiusTexels * 2.;\n\n  vec3 commonPosition = project_position(positions, positions64Low);\n  gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;\n  gl_Position.xy = (gl_Position.xy * 2.) - (1.);\n}\n",_fs:"varying vec4 weightsTexture;\nfloat gaussianKDE(float u){\n  return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);\n}\nvoid main()\n{\n  float dist = length(gl_PointCoord - vec2(0.5, 0.5));\n  if (dist > 0.5) {\n    discard;\n  }\n  gl_FragColor = weightsTexture * gaussianKDE(2. * dist);\n  DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n"})}},{key:"_createWeightsTransform",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.context.gl,n=this.state.weightsTransform,i=this.state.weightsTexture;null===(t=n)||void 0===t||t.delete(),n=new w.a(r,Rn({id:"".concat(this.id,"-weights-transform"),elementCount:1,_targetTexture:i,_targetTextureVarying:"weightsTexture"},e)),this.setState({weightsTransform:n})}},{key:"_setupResources",value:function(){var t=this.context.gl;this._createTextures();var e=this.state,r=e.textureSize,n=e.weightsTexture,i=e.maxWeightsTexture,o=this.getShaders("weights-transform");this._createWeightsTransform(o);var a=this.getShaders("max-weights-transform"),s=new w.a(t,Rn(Rn({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:n},_targetTexture:i,_targetTextureVarying:"outTexture"},a),{},{elementCount:r*r}));this.setState({weightsTexture:n,maxWeightsTexture:i,maxWeightTransform:s,zoom:null,triPositionBuffer:new Pt.a(t,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new Pt.a(t,{byteLength:48,accessor:{size:2}})})}},{key:"updateShaders",value:function(t){this._createWeightsTransform(t)}},{key:"_updateMaxWeightValue",value:function(){this.state.maxWeightTransform.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}},{key:"_updateBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.context.viewport,r=[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([e.width,e.height]),e.unproject([0,e.height])].map((function(t){return t.map(Math.fround)})),n=xn(r),i={visibleWorldBounds:n,viewportCorners:r},o=!1;if(t||!this.state.worldBounds||!wn(this.state.worldBounds,n)){var a=this._worldToCommonBounds(n),s=this._commonToWorldBounds(a);this.props.coordinateSystem===Jt.a.LNGLAT&&(s[1]=Math.max(s[1],-85.051129),s[3]=Math.min(s[3],85.051129),s[0]=Math.max(s[0],-360),s[2]=Math.min(s[2],360));var u=this._worldToCommonBounds(s);i.worldBounds=s,i.normalizedCommonBounds=u,o=!0}return this.setState(i),o}},{key:"_updateTextureRenderingBounds",value:function(){var t=this.state,e=t.triPositionBuffer,r=t.triTexCoordBuffer,n=t.normalizedCommonBounds,i=t.viewportCorners,o=this.context.viewport;e.subData(Sn(i,3));var a=i.map((function(t){return e=o.projectPosition(t),r=n,i=Ct()(r,4),a=i[0],s=i[1],u=i[2],c=i[3],[(e[0]-a)/(u-a),(e[1]-s)/(c-s)];var e,r,i,a,s,u,c}));r.subData(Sn(a,2))}},{key:"_updateColorTexture",value:function(t){var e=t.props.colorRange,r=this.state.colorTexture,n=ht(e,!1,Uint8Array);r?r.setImageData({data:n,width:e.length}):r=new q.a(this.context.gl,Rn({data:n,width:e.length,height:1},jn)),this.setState({colorTexture:r})}},{key:"_updateWeightmap",value:function(){var t,e=this.props,r=e.radiusPixels,n=e.colorDomain,i=e.aggregation,o=this.state,a=o.weightsTransform,s=o.worldBounds,u=o.textureSize,c=o.weightsTexture,l=o.weightsScale;this.state.isWeightMapDirty=!1;var h=this._worldToCommonBounds(s,{useLayerCoordinateSystem:!0});if(n&&"SUM"===i){var f=this.context.viewport.distanceScales.metersPerUnit[2]*(h[2]-h[0])/u;this.state.colorDomain=n.map((function(t){return t*f*l}))}else this.state.colorDomain=n||Dn;var p={radiusPixels:r,commonBounds:h,textureWidth:u,weightsScale:l};a.update({elementCount:this.getNumInstances()}),a.run({uniforms:p,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:this.getAttributes(),moduleSettings:this.getModuleSettings()}),this._updateMaxWeightValue(),c.setParameters((t={},g()(t,10240,9729),g()(t,10241,9729),t))}},{key:"_debouncedUpdateWeightmap",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.state.updateTimer,r=this.props.debounceTimeout;t?(e=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(e),e=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),r)),this.setState({updateTimer:e})}},{key:"_worldToCommonBounds",value:function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.useLayerCoordinateSystem,o=void 0!==i&&i,a=Ct()(t,4),s=a[0],u=a[1],c=a[2],l=a[3],h=this.context.viewport,f=this.state.textureSize,p=this.props.coordinateSystem,d=o&&(p===Jt.a.LNGLAT_OFFSETS||p===Jt.a.METER_OFFSETS),A=d?h.projectPosition(this.props.coordinateOrigin):[0,0],g=2*f/h.scale;return o&&!d?(e=this.projectPosition([s,u,0]),r=this.projectPosition([c,l,0])):(e=h.projectPosition([s,u,0]),r=h.projectPosition([c,l,0])),On([e[0]-A[0],e[1]-A[1],r[0]-A[0],r[1]-A[1]],g,g)}},{key:"_commonToWorldBounds",value:function(t){var e=Ct()(t,4),r=e[0],n=e[1],i=e[2],o=e[3],a=this.context.viewport,s=a.unprojectPosition([r,n]),u=a.unprojectPosition([i,o]);return s.slice(0,2).concat(u.slice(0,2))}}]),r}(Tt);Un.layerName="HeatmapLayer",Un.defaultProps=Fn,r.d(e,"ScreenGridLayer",(function(){return _e})),r.d(e,"CPUGridLayer",(function(){return Le})),r.d(e,"HexagonLayer",(function(){return Ze})),r.d(e,"ContourLayer",(function(){return Jr})),r.d(e,"GridLayer",(function(){return vn})),r.d(e,"GPUGridLayer",(function(){return dn})),r.d(e,"AGGREGATION_OPERATION",(function(){return R})),r.d(e,"HeatmapLayer",(function(){return Un})),r.d(e,"_GPUGridAggregator",(function(){return it})),r.d(e,"_CPUAggregator",(function(){return Ce})),r.d(e,"_AggregationLayer",(function(){return Tt})),r.d(e,"_BinSorter",(function(){return Kt}))},function(t,e,r){"use strict";r.r(e);var n=r(176),i=r(294),o=r(195),a=r(290),s=r(7),u=r(179),c=r(240),l=r(197),h=r(230),f=r(34),p=r(293),d=r(71),A=r(100),g=r(98),m=r(231),y=r(232),v=r(289),_=r(62),b=r(48);const x={x:[2,0,1],y:[0,1,2],z:[1,2,0]};class w extends _.a{constructor(t={}){const{id:e=Object(b.c)("truncated-code-geometry")}=t,{indices:r,attributes:n}=function(t){const{bottomRadius:e=0,topRadius:r=0,height:n=1,nradial:i=10,nvertical:o=10,verticalAxis:a="y",topCap:s=!1,bottomCap:u=!1}=t,c=(s?2:0)+(u?2:0),l=(i+1)*(o+1+c),h=Math.atan2(e-r,n),f=Math.sin,p=Math.cos,d=Math.PI,A=p(h),g=f(h),m=s?-2:0,y=o+(u?2:0),v=i+1,_=new Uint16Array(i*(o+c)*6),b=x[a],w=new Float32Array(3*l),E=new Float32Array(3*l),S=new Float32Array(2*l);let O=0,T=0;for(let t=m;t<=y;t++){let a,s=t/o,u=n*s;t<0?(u=0,s=1,a=e):t>o?(u=n,s=1,a=r):a=e+t/o*(r-e),-2!==t&&t!==o+2||(a=0,s=0),u-=n/2;for(let e=0;e<v;e++){const r=f(e*d*2/i),n=p(e*d*2/i);w[O+b[0]]=r*a,w[O+b[1]]=u,w[O+b[2]]=n*a,E[O+b[0]]=t<0||t>o?0:r*A,E[O+b[1]]=t<0?-1:t>o?1:g,E[O+b[2]]=t<0||t>o?0:n*A,S[T+0]=e/i,S[T+1]=s,T+=2,O+=3}}for(let t=0;t<o+c;t++)for(let e=0;e<i;e++){const r=6*(t*i+e);_[r+0]=v*(t+0)+0+e,_[r+1]=v*(t+0)+1+e,_[r+2]=v*(t+1)+1+e,_[r+3]=v*(t+0)+0+e,_[r+4]=v*(t+1)+1+e,_[r+5]=v*(t+1)+0+e}return{indices:_,attributes:{POSITION:{size:3,value:w},NORMAL:{size:3,value:E},TEXCOORD_0:{size:2,value:S}}}}(t);super({...t,id:e,indices:r,attributes:{...n,...t.attributes}})}}class E extends w{constructor(t={}){const{id:e=Object(b.c)("cone-geometry"),radius:r=1,cap:n=!0}=t;super({...t,id:e,topRadius:0,topCap:Boolean(n),bottomCap:Boolean(n),bottomRadius:r})}}var S=r(275);class O extends w{constructor(t={}){const{id:e=Object(b.c)("cylinder-geometry"),radius:r=1}=t;super({...t,id:e,bottomRadius:r,topRadius:r})}}var T=r(147);const P=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],M=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1];class C extends _.a{constructor(t={}){const{id:e=Object(b.c)("ico-sphere-geometry")}=t,{indices:r,attributes:n}=function(t){const{iterations:e=0}=t,r=Math.PI,n=2*r,i=[...P];let o=[...M];i.push(),o.push();const a=(()=>{const t={};return(e,r)=>{const n=`${(e*=3)<(r*=3)?e:r}|${e>r?e:r}`;if(n in t)return t[n];const o=i[e],a=i[e+1],s=i[e+2];let u=(o+i[r])/2,c=(a+i[r+1])/2,l=(s+i[r+2])/2;const h=Math.sqrt(u*u+c*c+l*l);return u/=h,c/=h,l/=h,i.push(u,c,l),t[n]=i.length/3-1}})();for(let t=0;t<e;t++){const t=[];for(let e=0;e<o.length;e+=3){const r=a(o[e+0],o[e+1]),n=a(o[e+1],o[e+2]),i=a(o[e+2],o[e+0]);t.push(i,o[e+0],r,r,o[e+1],n,n,o[e+2],i,r,n,i)}o=t}const s=new Array(i.length),u=new Array(i.length/3*2);for(let t=o.length-3;t>=0;t-=3){const e=o[t+0],a=o[t+1],c=o[t+2],l=3*e,h=3*a,f=3*c,p=2*e,d=2*a,A=2*c,g=i[l+0],m=i[l+1],y=i[l+2],v=Math.acos(y/Math.sqrt(g*g+m*m+y*y)),_=Math.atan2(m,g)+r,b=v/r,x=1-_/n,w=i[h+0],E=i[h+1],S=i[h+2],O=Math.acos(S/Math.sqrt(w*w+E*E+S*S)),P=Math.atan2(E,w)+r,M=O/r,C=1-P/n,I=i[f+0],k=i[f+1],R=i[f+2],L=Math.acos(R/Math.sqrt(I*I+k*k+R*R)),j=Math.atan2(k,I)+r,D=L/r,B=1-j/n,F=[I-w,k-E,R-S],z=[g-w,m-E,y-S],N=new T.a(F).cross(z).normalize();let U;(0===x||0===C||0===B)&&(0===x||x>.5)&&(0===C||C>.5)&&(0===B||B>.5)&&(i.push(i[l+0],i[l+1],i[l+2]),U=i.length/3-1,o.push(U),u[2*U+0]=1,u[2*U+1]=b,s[3*U+0]=N.x,s[3*U+1]=N.y,s[3*U+2]=N.z,i.push(i[h+0],i[h+1],i[h+2]),U=i.length/3-1,o.push(U),u[2*U+0]=1,u[2*U+1]=M,s[3*U+0]=N.x,s[3*U+1]=N.y,s[3*U+2]=N.z,i.push(i[f+0],i[f+1],i[f+2]),U=i.length/3-1,o.push(U),u[2*U+0]=1,u[2*U+1]=D,s[3*U+0]=N.x,s[3*U+1]=N.y,s[3*U+2]=N.z),s[l+0]=s[h+0]=s[f+0]=N.x,s[l+1]=s[h+1]=s[f+1]=N.y,s[l+2]=s[h+2]=s[f+2]=N.z,u[p+0]=x,u[p+1]=b,u[d+0]=C,u[d+1]=M,u[A+0]=B,u[A+1]=D}return{indices:{size:1,value:new Uint16Array(o)},attributes:{POSITION:{size:3,value:new Float32Array(i)},NORMAL:{size:3,value:new Float32Array(s)},TEXCOORD_0:{size:2,value:new Float32Array(u)}}}}(t);super({...t,id:e,indices:r,attributes:{...n,...t.attributes}})}}class I extends _.a{constructor(t={}){const{id:e=Object(b.c)("plane-geometry")}=t,{indices:r,attributes:n}=function(t){const{type:e="x,y",offset:r=0,flipCull:n=!1,unpack:i=!1}=t,o=e.split(",");let a=t[`${o[0]}len`]||1;const s=t[`${o[1]}len`]||1,u=t[`n${o[0]}`]||1,c=t[`n${o[1]}`]||1,l=(u+1)*(c+1),h=new Float32Array(3*l),f=new Float32Array(3*l),p=new Float32Array(2*l);n&&(a=-a);let d=0,A=0;for(let t=0;t<=c;t++)for(let i=0;i<=u;i++){const o=i/u,l=t/c;switch(p[d+0]=n?1-o:o,p[d+1]=l,e){case"x,y":h[A+0]=a*o-.5*a,h[A+1]=s*l-.5*s,h[A+2]=r,f[A+0]=0,f[A+1]=0,f[A+2]=n?1:-1;break;case"x,z":h[A+0]=a*o-.5*a,h[A+1]=r,h[A+2]=s*l-.5*s,f[A+0]=0,f[A+1]=n?1:-1,f[A+2]=0;break;case"y,z":h[A+0]=r,h[A+1]=a*o-.5*a,h[A+2]=s*l-.5*s,f[A+0]=n?1:-1,f[A+1]=0,f[A+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}d+=2,A+=3}const g=u+1,m=new Uint16Array(u*c*6);for(let t=0;t<c;t++)for(let e=0;e<u;e++){const r=6*(t*u+e);m[r+0]=(t+0)*g+e,m[r+1]=(t+1)*g+e,m[r+2]=(t+0)*g+e+1,m[r+3]=(t+1)*g+e,m[r+4]=(t+1)*g+e+1,m[r+5]=(t+0)*g+e+1}const y={indices:{size:1,value:m},attributes:{POSITION:{size:3,value:h},NORMAL:{size:3,value:f},TEXCOORD_0:{size:2,value:p}}};return i?function(t){const{indices:e,attributes:r}=t;if(!e)return t;const n=e.value.length,i={};for(const t in r){const o=r[t],{constant:a,value:s,size:u}=o;if(a||!u)continue;const c=new s.constructor(n*u);for(let t=0;t<n;++t){const r=e.value[t];for(let e=0;e<u;e++)c[t*u+e]=s[r*u+e]}i[t]={size:u,value:c}}return{attributes:Object.assign({},r,i)}}(y):y}(t);super({...t,id:e,indices:r,attributes:{...n,...t.attributes}})}}class k extends _.a{constructor(t={}){const{id:e=Object(b.c)("sphere-geometry")}=t,{indices:r,attributes:n}=function(t){const{nlat:e=10,nlong:r=10}=t;let{radius:n=1}=t;const i=Math.PI-0,o=2*Math.PI-0,a=(e+1)*(r+1);if("number"==typeof n){const t=n;n=(e,r,n,i,o)=>t}const s=new Float32Array(3*a),u=new Float32Array(3*a),c=new Float32Array(2*a),l=new(a>65535?Uint32Array:Uint16Array)(e*r*6);for(let t=0;t<=e;t++)for(let a=0;a<=r;a++){const l=a/r,h=t/e,f=a+t*(r+1),p=2*f,d=3*f,A=o*l,g=i*h,m=Math.sin(A),y=Math.cos(A),v=Math.sin(g),_=Math.cos(g),b=y*v,x=_,w=m*v,E=n(b,x,w,l,h);s[d+0]=E*b,s[d+1]=E*x,s[d+2]=E*w,u[d+0]=b,u[d+1]=x,u[d+2]=w,c[p+0]=l,c[p+1]=1-h}const h=r+1;for(let t=0;t<r;t++)for(let r=0;r<e;r++){const n=6*(t*e+r);l[n+0]=r*h+t,l[n+1]=r*h+t+1,l[n+2]=(r+1)*h+t,l[n+3]=(r+1)*h+t,l[n+4]=r*h+t+1,l[n+5]=(r+1)*h+t+1}return{indices:{size:1,value:l},attributes:{POSITION:{size:3,value:s},NORMAL:{size:3,value:u},TEXCOORD_0:{size:2,value:c}}}}(t);super({...t,id:e,indices:r,attributes:{...n,...t.attributes}})}}r.d(e,"Model",(function(){return n.a})),r.d(e,"Transform",(function(){return i.a})),r.d(e,"ProgramManager",(function(){return o.a})),r.d(e,"Timeline",(function(){return a.a})),r.d(e,"instrumentGLContext",(function(){return s.h})),r.d(e,"isWebGL2",(function(){return s.j})),r.d(e,"FEATURES",(function(){return u.a})),r.d(e,"hasFeatures",(function(){return c.c})),r.d(e,"getParameters",(function(){return s.f})),r.d(e,"setParameters",(function(){return s.n})),r.d(e,"withParameters",(function(){return s.o})),r.d(e,"cssToDeviceRatio",(function(){return s.e})),r.d(e,"readPixelsToBuffer",(function(){return l.d})),r.d(e,"copyToTexture",(function(){return l.b})),r.d(e,"cloneTextureFrom",(function(){return h.a})),r.d(e,"Buffer",(function(){return f.a})),r.d(e,"Program",(function(){return p.a})),r.d(e,"Framebuffer",(function(){return d.a})),r.d(e,"Renderbuffer",(function(){return A.a})),r.d(e,"Texture2D",(function(){return g.a})),r.d(e,"TextureCube",(function(){return m.a})),r.d(e,"Texture3D",(function(){return y.a})),r.d(e,"TransformFeedback",(function(){return v.a})),r.d(e,"Geometry",(function(){return _.a})),r.d(e,"ConeGeometry",(function(){return E})),r.d(e,"CubeGeometry",(function(){return S.a})),r.d(e,"CylinderGeometry",(function(){return O})),r.d(e,"IcoSphereGeometry",(function(){return C})),r.d(e,"PlaneGeometry",(function(){return I})),r.d(e,"SphereGeometry",(function(){return k})),r.d(e,"TruncatedConeGeometry",(function(){return w}))},function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(7),l=r(191),h=r(11);function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function d(t,e,r,n){if(r){if(r.props.userData._googleMap===t)return r;g(r)}var i={click:null,dblclick:null,mousemove:null,mouseout:null};r=new l.a(p(p({},n),{},{style:null,parent:A(e,n.style),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1,userData:{_googleMap:t,_eventListeners:i}}));var o=function(e){i[e]=t.addListener(e,(function(t){return function(t,e,r){var n={type:e,offsetCenter:y(r,t),srcEvent:r};switch(e){case"click":t._lastPointerDownInfo=t.pickObject(p(p({},n.offsetCenter),{},{radius:t.props.pickingRadius})),n.tapCount=1,t._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,t._onEvent(n);break;case"mousemove":n.type="pointermove",t._onPointerMove(n);break;case"mouseout":n.type="pointerleave",t._onPointerMove(n);break;default:return}}(r,e,t)}))};for(var a in i)o(a);return r}function A(t,e){var r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),t.getPanes?t.getPanes().overlayLayer.appendChild(r):t.getMap().getDiv().appendChild(r),r}function g(t){var e=t.props.userData._eventListeners;for(var r in e)e[r].remove();t.finalize()}function m(t){var e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function y(t,e){if(t.pixel)return t.pixel;var r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var b=function(){return!1},x={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774},w=function(){function t(e){a()(this,t),this.props={},this._map=null,this.setProps(e)}return u()(t,[{key:"setMap",value:function(t){var e=this;if(t!==this._map&&(this._map&&(this._overlay.setMap(null),this._map=null),t)){this._map=t;var r=google.maps.RenderingType.UNINITIALIZED;t.getRenderingType()!==r?this._createOverlay(t):t.addListener("renderingtype_changed",(function(){e._createOverlay(t)}))}}},{key:"setProps",value:function(t){Object.assign(this.props,t),this._deck&&(t.style&&(Object.assign(this._deck.canvas.parentElement.style,t.style),t.style=null),this._deck.setProps(t))}},{key:"pickObject",value:function(t){return this._deck&&this._deck.pickObject(t)}},{key:"pickMultipleObjects",value:function(t){return this._deck&&this._deck.pickMultipleObjects(t)}},{key:"pickObjects",value:function(t){return this._deck&&this._deck.pickObjects(t)}},{key:"finalize",value:function(){this.setMap(null),this._deck&&(g(this._deck),this._deck=null)}},{key:"_createOverlay",value:function(t){var e=google.maps.RenderingType,r=e.VECTOR,n=e.UNINITIALIZED,i=t.getRenderingType();if(i!==n){var o=i===r&&google.maps.WebglOverlayView,a=new(o?google.maps.WebglOverlayView:google.maps.OverlayView);o?(a.onAdd=function(){},a.onContextLost=this._onContextLost.bind(this),a.onContextRestored=this._onContextRestored.bind(this),a.onDraw=this._onDrawVector.bind(this)):(a.onAdd=this._onAdd.bind(this),a.draw=this._onDrawRaster.bind(this)),a.onRemove=this._onRemove.bind(this),this._overlay=a,this._overlay.setMap(t)}}},{key:"_onAdd",value:function(){this._deck=d(this._map,this._overlay,this._deck,this.props)}},{key:"_onContextRestored",value:function(t){var e=this,r=d(this._map,this._overlay,this._deck,_({gl:t,_customRender:function(){e._overlay.requestRedraw()}},this.props));this._deck=r,r.animationLoop._renderFrame=function(){var e=t.getParameter(34964);Object(c.o)(t,{},(function(){r.animationLoop.onRender()})),t.bindBuffer(34962,e)}}},{key:"_onContextLost",value:function(){this._deck&&(g(this._deck),this._deck=null)}},{key:"_onRemove",value:function(){this._deck.setProps({layerFilter:b})}},{key:"_onDrawRaster",value:function(){var t=this._deck,e=function(t,e){var r=m(t),n=r.width,i=r.height,o=e.getProjection(),a=t.getBounds(),s=a.getNorthEast(),u=a.getSouthWest(),c=o.fromLatLngToDivPixel(s),l=o.fromLatLngToDivPixel(u),h=new google.maps.Point(0,0),f=o.fromContainerPixelToLatLng(h),p=o.fromLatLngToDivPixel(f),d=p.x,A=p.y,g=o.getWorldWidth(),y=Math.ceil(n/g);d-=Math.floor(y/2)*g;var v=i?(l.y-c.y)/i:1,_=Math.log2(v||1)+t.getZoom()-1,b=new google.maps.Point(n/2,i/2),x=o.fromContainerPixelToLatLng(b),w=x.lat(),E=x.lng();if(Math.abs(w)>85.05113){w=w>0?85.05113:-85.05113;var S=new google.maps.LatLng(w,E);A+=(b=o.fromLatLngToContainerPixel(S)).y-i/2}return{width:n,height:i,left:d,top:A,zoom:_,pitch:t.getTilt(),latitude:w,longitude:E}}(this._map,this._overlay),r=e.width,n=e.height,i=e.left,o=e.top,a=e.zoom,s=e.pitch,u=e.latitude,c=e.longitude,l=0===s,h=t.canvas.parentElement.style;h.left="".concat(i,"px"),h.top="".concat(o,"px"),t.setProps({width:r,height:n,viewState:{latitude:u,longitude:c,zoom:a,repeat:!0},layerFilter:l?this.props.layerFilter:b}),t.redraw()}},{key:"_onDrawVector",value:function(t,e){var r=this._deck;if(r.setProps(_({},function(t,e){var r=m(t),n=r.width,i=r.height,o=e.getCameraParams(),a=o.lat,s=o.lng,u=o.heading,c=o.tilt,l=o.zoom,f=n/i,p=(new h.a).perspective({fovy:25*Math.PI/180,aspect:f,near:.75,far:3e14});return{width:!1,height:!1,viewState:{altitude:.5*p[5],bearing:u,latitude:a,longitude:s,pitch:c,projectionMatrix:p,repeat:!0,zoom:l-1}}}(this._map,e))),r.layerManager){var n=Object(c.f)(t,36006);r.setProps({_framebuffer:n}),r.needsRedraw({clearRedrawFlags:!0}),Object(c.n)(t,{viewport:[0,0,t.canvas.width,t.canvas.height],scissor:[0,0,t.canvas.width,t.canvas.height],stencilFunc:[519,0,255,519,0,255]}),Object(c.o)(t,x,(function(){r._drawLayers("google-vector",{clearCanvas:!1})}))}}}]),t}();r.d(e,"GoogleMapsOverlay",(function(){return w}))},function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n),o=r(2),a=r.n(o),s=r(3),u=r.n(s),c=r(8),l=r.n(c),h=r(5),f=r.n(h),p=r(6),d=r.n(p),A=r(1),g=r.n(A),m=r(131),y=r(117);function v(t){switch(t){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"float32":return Float32Array;case"float64":return Float64Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error("Unrecognized dtype ".concat(t))}}function _(t,e){if(!t)return null;for(var r in t){var n=t[r].attributes;for(var i in n){var o=n[i],a=o.dtype,s=o.value,u=v(a);n[i].value=new u(s.buffer)}}return t}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g()(t);if(e){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d()(this,r)}}r.d(e,"default",(function(){return E}));var E=function(t){f()(r,t);var e=w(r);function r(){return a()(this,r),e.apply(this,arguments)}return u()(r,[{key:"defaults",value:function(){return x(x({},l()(g()(r.prototype),"defaults",this).call(this)),{},{_model_name:r.model_name,_model_module:r.model_module,_model_module_version:r.model_module_version,_view_name:r.view_name,_view_module:r.view_module,_view_module_version:r.view_module_version,custom_libraries:[],json_input:null,mapbox_key:null,selected_data:[],data_buffer:null,tooltip:null,width:"100%",height:500,js_warning:!1})}}],[{key:"serializers",get:function(){return x(x({},m.DOMWidgetModel.serializers),{},{data_buffer:{deserialize:_}})}},{key:"model_name",get:function(){return"JupyterTransportModel"}},{key:"model_module",get:function(){return y.MODULE_NAME}},{key:"model_module_version",get:function(){return y.MODULE_VERSION}},{key:"view_name",get:function(){return"JupyterTransportView"}},{key:"view_module",get:function(){return y.MODULE_NAME}},{key:"view_module_version",get:function(){return y.MODULE_VERSION}}]),r}(m.DOMWidgetModel)},function(t,e,r){"use strict";r.r(e);var n=r(45),i=r(164),o=r(174),a=r(121),s=r(87);function u(){i.a.setCallbacks({onInitialize:function(t){var e=t.transport,r=function(t){var e=t.jupyterModel;if(!e)throw new Error("deck.gl playground currently only works with the Jupyter Widget Transport");return{width:e.get("width"),height:e.get("height"),customLibraries:e.get("custom_libraries"),mapboxApiKey:e.get("mapbox_key"),jsonInput:e.get("json_input"),tooltip:e.get("tooltip")}}(e),n=r.width,i=r.height,u=r.customLibraries,l=r.mapboxApiKey,h=r.jsonInput,f=r.tooltip;Object(a.b)();var p=e.getRootDOMElement(),d=Object(o.a)(n,i);p.appendChild(d);var A=JSON.parse(h),g=Object(s.createDeck)({mapboxApiKey:l,container:d,jsonInput:A,tooltip:f,handleEvent:function(t,r){return function(t,e,r){if("hover"===e&&!r.picked&&-1===r.index)return;var n=JSON.parse(JSON.stringify(r,c));t.sendJSONMessage(e,n)}(e,t,r)},customLibraries:u});e.userData.deck=g},onFinalize:function(t){t.transport.userData.deck.finalize()},onMessage:function(t){var e,r=t.transport,n=t.type,i=t.json,o=(t.binary,r.userData.deck);switch(n){case"json":e=s.jsonConverter.convert(i),o.setProps(e);break;case"json-with-binary":e=s.jsonConverter.convert(i);var a=function(t){for(var e=t.binary,r=t.convertedJson,n=0;n<r.layers.length;n++){var i=r.layers[n].id,o=r.layers[n];r.layers[n]=o.clone({data:e[i]})}return r}({binary:r.jupyterModel.get("data_buffer"),convertedJson:e});o.setProps(a)}}})}function c(t,e){return e instanceof n.Layer?e.id:e}r.d(e,"initPlayground",(function(){return u})),r.d(e,"createDeck",(function(){return s.createDeck})),r.d(e,"updateDeck",(function(){return s.updateDeck}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var n=r(62),i=r(48);const o=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),a=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,-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,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),s=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),u=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),c={POSITION:{size:3,value:new Float32Array(a)},NORMAL:{size:3,value:new Float32Array(s)},TEXCOORD_0:{size:2,value:new Float32Array(u)}};class l extends n.a{constructor(t={}){const{id:e=Object(i.c)("cube-geometry")}=t;super({...t,id:e,indices:{size:1,value:new Uint16Array(o)},attributes:{...c,...t.attributes}})}}},function(t,e,r){"use strict";var n=r(165);const i=Object(n.a)();class o{constructor(t,e,r="sessionStorage"){this.storage=function(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}(r),this.id=t,this.config={},Object.assign(this.config,e),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){return this.config={},this.updateConfiguration(t)}updateConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function a(t,e,r,n=600){const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));const o=t.width*r,a=t.height*r,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),s]}const s={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function u(t){return"string"==typeof t?s[t.toUpperCase()]||s.WHITE:t}function c(t,e){if(!t)throw new Error(e||"Assertion failed")}var l=r(59);function h(){let t;if(i&&l.b.performance)t=l.b.performance.now();else if(l.a.hrtime){const e=l.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}r.d(e,"a",(function(){return y}));const f={debug:i&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},p={enabled:!0,level:0};function d(){}const A={},g={once:!0};function m(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}class y{constructor({id:t}={id:""}){this.id=t,this.VERSION="8.6.0",this._startTs=h(),this._deltaTs=h(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new o("__probe-".concat(this.id,"__"),p),this.userData={},this.timeStamp("".concat(this.id," started")),function(t,e=["constructor"]){const r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof t[r]&&(e.find(t=>r===t)||(t[r]=t[r].bind(t)))}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((h()-this._startTs).toPrecision(10))}getDelta(){return Number((h()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}assert(t,e){c(t,e)}warn(t){return this._getLogFunction(0,t,f.warn,arguments,g)}error(t){return this._getLogFunction(0,t,f.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,f.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,f.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,f.debug||f.info,arguments,g)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||d,r&&[r],{tag:m(e)}):d}image({logLevel:t,priority:e,image:n,message:o="",scale:s=1}){return this._shouldLog(t||e)?i?function({image:t,message:e="",scale:r=1}){if("string"==typeof t){const n=new Image;return n.onload=()=>{const t=a(n,e,r);console.log(...t)},n.src=t,d}const n=t.nodeName||"";if("img"===n.toLowerCase())return console.log(...a(t,e,r)),d;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...a(n,e,r)),n.src=t.toDataURL(),d}return d}({image:n,message:o,scale:s}):function({image:t,message:e="",scale:n=1}){let i=null;try{i=r(252)}catch(t){}if(i)return()=>i(t,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(t=>console.log(t));return d}({image:n,message:o,scale:s}):d}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||d)}group(t,e,r={collapsed:!1}){r=_({logLevel:t,message:e,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e,r={}){return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||d)}withGroup(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=v(t)}_getLogFunction(t,e,r,n=[],o){if(this._shouldLog(t)){o=_({logLevel:t,message:e,args:n,opts:o}),c(r=r||o.method),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=h();const a=o.tag||o.message;if(o.once){if(A[a])return d;A[a]=h()}return e=function(t,e,r){if("string"==typeof e){const s=r.time?function(t,e=8){const r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(r.total)):"";e=r.time?"".concat(t,": ").concat(s,"  ").concat(e):"".concat(t,": ").concat(e),n=e,o=r.color,a=r.background,i||"string"!=typeof n||(o&&(o=u(o),n="[".concat(o,"m").concat(n,"[39m")),a&&(o=u(a),n="[".concat(a+10,"m").concat(n,"[49m"))),e=n}var n,o,a;return e}(this.id,o.message,o),r.bind(console,e,...o.args)}return d}}function v(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return c(Number.isFinite(e)&&e>=0),e}function _(t){const{logLevel:e,message:r}=t;t.logLevel=v(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(t.args=n,typeof e){case"string":case"function":void 0!==r&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const i=typeof t.message;return c("string"===i||"object"===i),Object.assign(t,t.opts)}y.VERSION="8.6.0"},,,,,,,,,,,,,function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(7),i=r(39),o=r(34),a=r(48);class s extends i.a{static isSupported(t){return Object(n.j)(t)}constructor(t,e={}){Object(n.a)(t),super(t,e),this.initialize(e),this.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(this)}initialize(t={}){return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Object(a.a)(this.buffers)||this.bind(()=>this._unbindBuffers()),this.setProps(t),this}setProps(t){"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"bindOnUse"in t&&(t=t.bindOnUse),"buffers"in t&&this.setBuffers(t.buffers)}setBuffers(t={}){return this.bind(()=>{for(const e in t)this.setBuffer(e,t[e])}),this}setBuffer(t,e){const r=this._getVaryingIndex(t),{buffer:i,byteSize:o,byteOffset:a}=this._getBufferParams(e);return r<0?(this.unused[t]=i,n.k.warn(()=>`${this.id} unused varying buffer ${t}`)(),this):(this.buffers[r]=e,this.bindOnUse||this._bindBuffer(r,i,a,o),this)}begin(t=0){return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let e,r,n;return t instanceof o.a==!1?(n=t.buffer,r=t.byteSize,e=t.byteOffset):n=t,void 0===e&&void 0===r||(e=e||0,r=r||n.byteLength-e),{buffer:n,byteOffset:e,byteSize:r}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;const e=Number(t);return Number.isFinite(e)?e:-1}_bindBuffers(){if(this.bindOnUse)for(const t in this.buffers){const{buffer:e,byteSize:r,byteOffset:n}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,e,n,r)}}_unbindBuffers(){if(this.bindOnUse)for(const t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,e,r=0,n){const i=e&&e.handle;return i&&void 0!==n?this.gl.bindBufferRange(35982,t,i,r,n):this.gl.bindBufferBase(35982,t,i),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));let n=1,i=1;class o{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){const{delay:e=0,duration:r=Number.POSITIVE_INFINITY,rate:i=1,repeat:o=1}=t,a=n++,s={time:0,delay:e,duration:r,rate:i,repeat:o};return this._setChannelTime(s,this.time),this.channels.set(a,s),a}removeChannel(t){this.channels.delete(t);for(const[e,r]of this.animations)r.channel===t&&this.detachAnimation(e)}isFinished(t){const e=this.channels.get(t);return void 0!==e&&this.time>=e.delay+e.duration*e.repeat}getTime(t){if(void 0===t)return this.time;const e=this.channels.get(t);return void 0===e?-1:e.time}setTime(t){this.time=Math.max(0,t);const e=this.channels.values();for(const t of e)this._setChannelTime(t,this.time);const r=this.animations.values();for(const t of r){const{animation:e,channel:r}=t;e.setTime(this.getTime(r))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){const r=i++;return this.animations.set(r,{animation:t,channel:e}),t.setTime(this.getTime(e)),r}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){const r=e-t.delay;r>=t.duration*t.repeat?t.time=t.duration*t.rate:(t.time=Math.max(0,r)%t.duration,t.time*=t.rate)}}},function(t,e,r){"use strict";var n={};r.r(n),r.d(n,"decode",(function(){return M})),r.d(n,"encode",(function(){return C}));var i={};r.r(i),r.d(i,"decode",(function(){return R})),r.d(i,"encode",(function(){return L}));var o={};r.r(o),r.d(o,"decode",(function(){return j})),r.d(o,"encode",(function(){return D}));var a={};r.r(a),r.d(a,"decode",(function(){return B})),r.d(a,"encode",(function(){return F}));var s=r(292),u=r(218),c=r(78);function l(t,e){if(!t)throw new Error(e||"assert failed: gltf")}function h(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const r=e.baseUri||e.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return r.substr(0,r.lastIndexOf("/")+1)+t}function f(t,e,r){const n=t.bufferViews[r];l(n);const i=e[n.buffer];l(i);const o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}var p=r(175),d=r(4),A=r(172),g=r(145);const m=["SCALAR","VEC2","VEC3","VEC4"],y=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],v=new Map(y),_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},b={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function w(t){return m[t-1]||m[0]}function E(t){const e=v.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function S(t,e){const r=x[t.componentType],n=_[t.type],i=b[t.componentType],o=t.count*n,a=t.count*n*i;return l(a>=0&&a<=e.byteLength),{ArrayType:r,length:o,byteLength:a}}const O={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class T{constructor(t){Object(d.a)(this,"gltf",void 0),Object(d.a)(this,"sourceBuffers",void 0),Object(d.a)(this,"byteLength",void 0),this.gltf=t||{json:{...O},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}getExtension(t){const e=this.getUsedExtensions().find(e=>e===t),r=this.json.extensions||{};return e?r[t]||!0:null}getRequiredExtension(t){return this.getRequiredExtensions().find(e=>e===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];if(!r)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return r}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,r=this.gltf.buffers[e];l(r);const n=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,{ArrayType:n,length:i}=S(t,e);return new n(r,e.byteOffset+t.byteOffset,i)}getTypedArrayForImageData(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,n=e.byteOffset||0;return new Uint8Array(r,n,e.byteLength)}addApplicationData(t,e){return this.json[t]=e,this}addExtraData(t,e){return this.json.extras=this.json.extras||{},this.json.extras[t]=e,this}addObjectExtension(t,e,r){return t.extensions=t.extensions||{},t.extensions[e]=r,this.registerUsedExtension(e),this}setObjectExtension(t,e,r){(t.extensions||{})[e]=r}removeObjectExtension(t,e){const r=t.extensions||{},n=r[e];return delete r[e],n}addExtension(t,e={}){return l(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t,e={}){return l(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(e=>e===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(e=>e===t)||this.json.extensionsRequired.push(t)}removeExtension(t){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t),this.json.extensions&&delete this.json.extensions[t]}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:r}=t;this.json.nodes=this.json.nodes||[];const n={mesh:e};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:r,material:n,mode:i=4}=t,o={primitives:[{attributes:this._addAttributes(e),mode:i}]};if(r){const t=this._addIndices(r);o.primitives[0].indices=t}return Number.isFinite(n)&&(o.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const r=Object(A.a)(t),n=e||(null==r?void 0:r.mimeType),i={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t){const e=t.byteLength;l(Number.isFinite(e)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const r={buffer:0,byteOffset:this.byteLength,byteLength:e};return this.byteLength+=Object(g.b)(e,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(t,e){const r={bufferView:t,type:w(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,e={size:3}){const r=this.addBufferView(t);let n={min:e.min,max:e.max};n.min&&n.max||(n=this._getAccessorMinMax(t,e.size));const i={size:e.size,componentType:E(t),count:Math.round(t.length/e.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(i,e))}addTexture(t){const{imageIndex:e}=t,r={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),i=new Uint8Array(n);let o=0;for(const t of this.sourceBuffers||[])o=Object(g.a)(t,i,o);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,e){let r=!0;for(;r;){const n=t.indexOf(e);n>-1?t.splice(n,1):r=!1}}_addAttributes(t={}){const e={};for(const r in t){const n=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(n.value,n);e[i]=o}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const r={min:null,max:null};if(t.length<e)return r;r.min=[],r.max=[];const n=t.subarray(0,e);for(const t of n)r.min.push(t),r.max.push(t);for(let n=e;n<t.length;n+=e)for(let i=0;i<e;i++)r.min[0+i]=Math.min(r.min[0+i],t[n+i]),r.max[0+i]=Math.max(r.max[0+i],t[n+i]);return r}}function P(t){const{buffer:e,size:r,count:n}=function(t){let e=t,r=1,n=0;t&&t.value&&(e=t.value,r=t.size||1);e&&(ArrayBuffer.isView(e)||(e=function(t,e,r=!1){if(!t)return null;if(Array.isArray(t))return new e(t);if(r&&!(t instanceof e))return new e(t);return t}(e,Float32Array)),n=e.length/r);return{buffer:e,size:r,count:n}}(t);return{value:e,size:r,byteOffset:0,count:n,type:w(r),componentType:E(e)}}async function M(t,e,r){var n;if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes)return;const i=new T(t),o=[];for(const t of function*(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}(i))i.getObjectExtension(t,"KHR_draco_mesh_compression")&&o.push(I(i,t,e,r));await Promise.all(o),i.removeExtension("KHR_draco_mesh_compression")}function C(t,e={}){const r=new T(t);for(const t of r.json.meshes||[])k(t,e),r.addRequiredExtension("KHR_draco_mesh_compression")}async function I(t,e,r,n){const i=t.getObjectExtension(e,"KHR_draco_mesh_compression");if(!i)return;const o=t.getTypedArrayForBufferView(i.bufferView),a=Object(c.c)(o.buffer,o.byteOffset),{parse:s}=n,u={...r};delete u["3d-tiles"];const l=await s(a,p.a,u,n),h=function(t){const e={};for(const r in t){const n=t[r];if("indices"!==r){const t=P(n);e[r]=t}}return e}(l.attributes);for(const[r,n]of Object.entries(h))if(r in e.attributes){const i=e.attributes[r],o=t.getAccessor(i);null!=o&&o.min&&null!=o&&o.max&&(n.min=o.min,n.max=o.max)}e.attributes=h,l.indices&&(e.indices=P(l.indices)),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function k(t,e,r=4,n,i){var o;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const a=n.DracoWriter.encodeSync({attributes:t}),s=null==i?void 0:null===(o=i.parseSync)||void 0===o?void 0:o.call(i,{attributes:t}),u=n._addFauxAttributes(s.attributes);return{primitives:[{attributes:u,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(a),attributes:u}}}]}}async function R(t){const e=new T(t),{json:r}=e;e.removeExtension("KHR_materials_unlit");for(const t of r.materials||[]){t.extensions&&t.extensions.KHR_materials_unlit&&(t.unlit=!0),e.removeObjectExtension(t,"KHR_materials_unlit")}}function L(t){const e=new T(t),{json:r}=e;if(e.materials)for(const t of r.materials||[])t.unlit&&(delete t.unlit,e.addObjectExtension(t,"KHR_materials_unlit",{}),e.addExtension("KHR_materials_unlit"))}async function j(t){const e=new T(t),{json:r}=e,n=e.getExtension("KHR_lights_punctual");n&&(e.json.lights=n.lights,e.removeExtension("KHR_lights_punctual"));for(const t of r.nodes||[]){const r=e.getObjectExtension(t,"KHR_lights_punctual");r&&(t.light=r.light),e.removeObjectExtension(t,"KHR_lights_punctual")}}async function D(t){const e=new T(t),{json:r}=e;if(r.lights){const t=e.addExtension("KHR_lights_punctual");l(!t.lights),t.lights=r.lights,delete r.lights}if(e.json.lights){for(const t of e.json.lights){const r=t.node;e.addObjectExtension(r,"KHR_lights_punctual",t)}delete e.json.lights}}async function B(t){const e=new T(t),{json:r}=e,n=e.getExtension("KHR_techniques_webgl");if(n){const t=function(t,e){const{programs:r=[],shaders:n=[],techniques:i=[]}=t,o=new TextDecoder;return n.forEach(t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=o.decode(e.getTypedArrayForBufferView(t.bufferView))}),r.forEach(t=>{t.fragmentShader=n[t.fragmentShader],t.vertexShader=n[t.vertexShader]}),i.forEach(t=>{t.program=r[t.program]}),i}(n,e);for(const n of r.materials||[]){const r=e.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,t[r.technique]),n.technique.values=z(n.technique,e)),e.removeObjectExtension(n,"KHR_techniques_webgl")}e.removeExtension("KHR_techniques_webgl")}}async function F(t,e){}function z(t,e){const r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(e=>{!t.uniforms[e].value||e in r||(r[e]=t.uniforms[e].value)}),Object.keys(r).forEach(t=>{"object"==typeof r[t]&&void 0!==r[t].index&&(r[t].texture=e.getTexture(r[t].index))}),r}const N={KHR_draco_mesh_compression:n,KHR_materials_unlit:i,KHR_lights_punctual:o,KHR_techniques_webgl:a};const U={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},V={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class G{constructor(t){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(t,e){this.json=t.json;const r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn(`glTF: Unknown version ${r.asset.version}`)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),function(t){const e=new T(t),{json:r}=e;for(const t of r.images||[]){const r=e.removeObjectExtension(t,"KHR_binary_glTF");r&&Object.assign(t,r)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension("KHR_binary_glTF")}(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in U)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const r=t[e];if(r&&!Array.isArray(r)){t[e]=[];for(const n in r){const i=r[n];i.id=i.id||n;const o=t[e].length;t[e].push(i),this.idToIndexMap[e][n]=o}}}_convertObjectIdsToArrayIndices(t){for(const e in U)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:r,material:n}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");r&&(e.indices=this._convertIdToIndex(r,"accessor")),n&&(e.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(t=>this._convertIdToIndex(t,"node"))),t.meshes&&(t.meshes=t.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(t,e){t[e]||(console.warn(`gltf v1: json doesn't contain attribute ${e}`),t[e]=[]);for(const r of t[e])for(const t in r){const e=r[t],n=this._convertIdToIndex(e,t);r[t]=n}}_convertIdToIndex(t,e){const r=V[e];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][t];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return n}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const e of t.materials){e.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=e.values&&e.values.tex,n=t.textures.findIndex(t=>t.id===r);-1!==n&&(e.pbrMetallicRoughness.baseColorTexture={index:n})}}}const W={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},H={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},q={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Z={magFilter:q.TEXTURE_MAG_FILTER,minFilter:q.TEXTURE_MIN_FILTER,wrapS:q.TEXTURE_WRAP_S,wrapT:q.TEXTURE_WRAP_T},X={[q.TEXTURE_MAG_FILTER]:q.LINEAR,[q.TEXTURE_MIN_FILTER]:q.NEAREST_MIPMAP_LINEAR,[q.TEXTURE_WRAP_S]:q.REPEAT,[q.TEXTURE_WRAP_]:q.REPEAT};class Q{postProcess(t,e={}){const{json:r,buffers:n=[],images:i=[],baseUri:o=""}=t;return l(r),this.baseUri=o,this.json=r,this.buffers=n,this.images=i,this._resolveTree(this.json,e),this.json}_resolveTree(t,e={}){t.bufferViews&&(t.bufferViews=t.bufferViews.map((t,e)=>this._resolveBufferView(t,e))),t.images&&(t.images=t.images.map((t,e)=>this._resolveImage(t,e))),t.samplers&&(t.samplers=t.samplers.map((t,e)=>this._resolveSampler(t,e))),t.textures&&(t.textures=t.textures.map((t,e)=>this._resolveTexture(t,e))),t.accessors&&(t.accessors=t.accessors.map((t,e)=>this._resolveAccessor(t,e))),t.materials&&(t.materials=t.materials.map((t,e)=>this._resolveMaterial(t,e))),t.meshes&&(t.meshes=t.meshes.map((t,e)=>this._resolveMesh(t,e))),t.nodes&&(t.nodes=t.nodes.map((t,e)=>this._resolveNode(t,e))),t.skins&&(t.skins=t.skins.map((t,e)=>this._resolveSkin(t,e))),t.scenes&&(t.scenes=t.scenes.map((t,e)=>this._resolveScene(t,e))),void 0!==t.scene&&(t.scene=t.scenes[this.json.scene])}getScene(t){return this._get("scenes",t)}getNode(t){return this._get("nodes",t)}getSkin(t){return this._get("skins",t)}getMesh(t){return this._get("meshes",t)}getMaterial(t){return this._get("materials",t)}getAccessor(t){return this._get("accessors",t)}getCamera(t){return null}getTexture(t){return this._get("textures",t)}getSampler(t){return this._get("samplers",t)}getImage(t){return this._get("images",t)}getBufferView(t){return this._get("bufferViews",t)}getBuffer(t){return this._get("buffers",t)}_get(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];return r||console.warn(`glTF file error: Could not find ${t}[${e}]`),r}_resolveScene(t,e){return t.id=t.id||`scene-${e}`,t.nodes=(t.nodes||[]).map(t=>this.getNode(t)),t}_resolveNode(t,e){return t.id=t.id||`node-${e}`,t.children&&(t.children=t.children.map(t=>this.getNode(t))),void 0!==t.mesh?t.mesh=this.getMesh(t.mesh):void 0!==t.meshes&&t.meshes.length&&(t.mesh=t.meshes.reduce((t,e)=>{const r=this.getMesh(e);return t.id=r.id,t.primitives=t.primitives.concat(r.primitives),t},{primitives:[]})),void 0!==t.camera&&(t.camera=this.getCamera(t.camera)),void 0!==t.skin&&(t.skin=this.getSkin(t.skin)),t}_resolveSkin(t,e){return t.id=t.id||`skin-${e}`,t.inverseBindMatrices=this.getAccessor(t.inverseBindMatrices),t}_resolveMesh(t,e){return t.id=t.id||`mesh-${e}`,t.primitives&&(t.primitives=t.primitives.map(t=>{const e=(t={...t}).attributes;t.attributes={};for(const r in e)t.attributes[r]=this.getAccessor(e[r]);return void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material)),t})),t}_resolveMaterial(t,e){if(t.id=t.id||`material-${e}`,t.normalTexture&&(t.normalTexture={...t.normalTexture},t.normalTexture.texture=this.getTexture(t.normalTexture.index)),t.occlusionTexture&&(t.occlustionTexture={...t.occlustionTexture},t.occlusionTexture.texture=this.getTexture(t.occlusionTexture.index)),t.emissiveTexture&&(t.emmisiveTexture={...t.emmisiveTexture},t.emissiveTexture.texture=this.getTexture(t.emissiveTexture.index)),t.emissiveFactor||(t.emissiveFactor=t.emmisiveTexture?[1,1,1]:[0,0,0]),t.pbrMetallicRoughness){t.pbrMetallicRoughness={...t.pbrMetallicRoughness};const e=t.pbrMetallicRoughness;e.baseColorTexture&&(e.baseColorTexture={...e.baseColorTexture},e.baseColorTexture.texture=this.getTexture(e.baseColorTexture.index)),e.metallicRoughnessTexture&&(e.metallicRoughnessTexture={...e.metallicRoughnessTexture},e.metallicRoughnessTexture.texture=this.getTexture(e.metallicRoughnessTexture.index))}return t}_resolveAccessor(t,e){var r,n;if(t.id=t.id||`accessor-${e}`,void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView)),t.bytesPerComponent=(r=t.componentType,H[r]),t.components=(n=t.type,W[n]),t.bytesPerElement=t.bytesPerComponent*t.components,t.bufferView){const e=t.bufferView.buffer,{ArrayType:r,byteLength:n}=S(t,t.bufferView),i=(t.bufferView.byteOffset||0)+(t.byteOffset||0)+e.byteOffset,o=e.arrayBuffer.slice(i,i+n);t.value=new r(o)}return t}_resolveTexture(t,e){return t.id=t.id||`texture-${e}`,t.sampler="sampler"in t?this.getSampler(t.sampler):X,t.source=this.getImage(t.source),t}_resolveSampler(t,e){t.id=t.id||`sampler-${e}`,t.parameters={};for(const e in t){const r=this._enumSamplerParameter(e);void 0!==r&&(t.parameters[r]=t[e])}return t}_enumSamplerParameter(t){return Z[t]}_resolveImage(t,e){t.id=t.id||`image-${e}`,void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView));const r=this.images[e];return r&&(t.image=r),t}_resolveBufferView(t,e){t.id=t.id||`bufferView-${e}`;const r=t.buffer;t.buffer=this.buffers[r];const n=this.buffers[r].arrayBuffer;let i=this.buffers[r].byteOffset||0;return"byteOffset"in t&&(i+=t.byteOffset),t.data=new Uint8Array(n,i,t.byteLength),t}_resolveCamera(t,e){return t.id=t.id||`camera-${e}`,t.perspective,t.orthographic,t}}var Y=r(97);const K=1735152710;function $(t,e=0,r={}){const n=new DataView(t),{magic:i=K}=r,o=n.getUint32(e,!1);return o===i||o===K}function J(t,e,r=0,n={}){const i=new DataView(e),o=function(t,e=0){return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}(i,r+0),a=i.getUint32(r+4,!0),s=i.getUint32(r+8,!0);switch(Object.assign(t,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:o,version:a,json:{},binChunks:[]}),r+=12,t.version){case 1:return function(t,e,r){Object(Y.a)(t.header.byteLength>20);const n=e.getUint32(r+0,!0),i=e.getUint32(r+4,!0);return r+=8,Object(Y.a)(0===i),tt(t,e,r,n),r+=n,r+=et(t,e,r,t.header.byteLength)}(t,i,r);case 2:return function(t,e,r,n){return Object(Y.a)(t.header.byteLength>20),function(t,e,r,n){for(;r+8<=t.header.byteLength;){const i=e.getUint32(r+0,!0),o=e.getUint32(r+4,!0);switch(r+=8,o){case 1313821514:tt(t,e,r,i);break;case 5130562:et(t,e,r,i);break;case 0:n.strict||tt(t,e,r,i);break;case 1:n.strict||et(t,e,r,i)}r+=Object(g.b)(i,4)}}(t,e,r,n),r+t.header.byteLength}(t,i,r,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports v1 and v2.`)}}function tt(t,e,r,n){const i=new Uint8Array(e.buffer,r,n),o=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(o),Object(g.b)(n,4)}function et(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Object(g.b)(n,4)}async function rt(t,e,r=0,n,i){var o,a,s,c;!function(t,e,r,n){n.uri&&(t.baseUri=n.uri);if(e instanceof ArrayBuffer&&!$(e,r,n)){const t=new TextDecoder;e=t.decode(e)}if("string"==typeof e)t.json=Object(u.a)(e);else if(e instanceof ArrayBuffer){const i={};r=J(i,e,r,n.glb),l("glTF"===i.type,`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else l(!1,"GLTF: must be ArrayBuffer or string");const i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const o=t.json.images||[];t.images=new Array(o.length).fill({})}(t,e,r,n),function(t,e={}){(new G).normalize(t,e)}(t,{normalize:null==n?void 0:null===(o=n.gltf)||void 0===o?void 0:o.normalize});const f=[];if(null!=n&&null!==(a=n.gltf)&&void 0!==a&&a.loadBuffers&&t.json.buffers&&await async function(t,e,r){for(let o=0;o<t.json.buffers.length;++o){const a=t.json.buffers[o];if(a.uri){var n,i;const{fetch:s}=r;l(s);const u=h(a.uri,e),c=await(null==r?void 0:null===(n=r.fetch)||void 0===n?void 0:n.call(r,u)),f=await(null==c?void 0:null===(i=c.arrayBuffer)||void 0===i?void 0:i.call(c));t.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}}}(t,n,i),null!=n&&null!==(s=n.gltf)&&void 0!==s&&s.loadImages){const e=async function(t,e,r){const n=t.json.images||[],i=[];for(let o=0;o<n.length;++o)i.push(nt(t,n[o],o,e,r));return await Promise.all(i)}(t,n,i);f.push(e)}const p=async function(t,e={},r){for(const i in N){var n;const o=(null==e?void 0:null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};if(!(i in o&&!o[i])){const n=N[i];await n.decode(t,e,r)}}}(t,n,i);return f.push(p),await Promise.all(f),null!=n&&null!==(c=n.gltf)&&void 0!==c&&c.postProcess?function(t,e){return(new Q).postProcess(t,e)}(t,n):t}async function nt(t,e,r,n,i){const{fetch:o,parse:a}=i;let u;if(e.uri){const t=h(e.uri,n),r=await o(t);u=await r.arrayBuffer()}if(Number.isFinite(e.bufferView)){const r=f(t.json,t.buffers,e.bufferView);u=Object(c.c)(r.buffer,r.byteOffset,r.byteLength)}l(u,"glTF image has no data");const p=await a(u,s.a,{},i);t.images[r]=p}r.d(e,"a",(function(){return it}));const it={name:"glTF",id:"gltf",module:"gltf",version:"3.0.8",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(t,e={},r){(e={...it.options,...e}).gltf={...it.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await rt({},t,n,e,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}}},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error(e)}var i=r(135);const{_parseImageNode:o}=i.a,a="undefined"!=typeof Image,s="undefined"!=typeof ImageBitmap,u=Boolean(o),c=!!i.b||u;function l(t){const e=f(t);if(!e)throw new Error("Not an image");return e}function h(t){switch(l(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function f(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}const p=/^data:image\/svg\+xml/,d=/\.svg((\?|#).*)?$/;function A(t){return t&&(p.test(t)||d.test(t))}function g(t,e){if(A(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function m(t,e,r){const n=function(t,e){if(A(e)){const e=(new TextDecoder).decode(t);return`data:image/svg+xml;base64,${btoa(e)}`}return g(t,e)}(t,r),i=self.URL||self.webkitURL,o="string"!=typeof n&&i.createObjectURL(n);try{return await async function(t,e){const r=new Image;if(r.src=t,e.image&&e.image.decode&&r.decode)return await r.decode(),r;return await new Promise((e,n)=>{try{r.onload=()=>e(r),r.onerror=e=>n(new Error(`Could not load image ${t}: ${e}`))}catch(t){n(t)}})}(o||n,e)}finally{o&&i.revokeObjectURL(o)}}const y={};let v=!0;async function _(t,e,r){let n;if(A(r)){n=await m(t,e,r)}else n=g(t,r);const i=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||y)return!1;return!0}(e)&&v||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),v=!1}return await createImageBitmap(t)}(n,i)}var b=r(172);r.d(e,"a",(function(){return x}));const x={id:"image",module:"images",name:"Images",version:"3.0.8",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(t,e,r){const o=((e=e||{}).image||{}).type||"auto",{url:u}=r||{};let l;switch(function(t){switch(t){case"auto":case"data":return function(){if(s)return"imagebitmap";if(a)return"image";if(c)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return s||a||c;case"imagebitmap":return s;case"image":return a;case"data":return c;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(o)){case"imagebitmap":l=await _(t,e,u);break;case"image":l=await m(t,e,u);break;case"data":l=await function(t,e){const{mimeType:r}=Object(b.a)(t)||{},{_parseImageNode:o}=i.a;return n(o),o(t,r,e)}(t,e);break;default:n(!1)}return"data"===o&&(l=h(l)),l},tests:[t=>Boolean(Object(b.a)(new DataView(t)))],options:{image:{type:"auto",decode:!0}}}},function(t,e,r){"use strict";var n=r(39),i=r(55),o=r(71),a=r(7),s=r(100),u=r(9);const c={5126:w.bind(null,"uniform1fv",A,1,E),35664:w.bind(null,"uniform2fv",A,2,E),35665:w.bind(null,"uniform3fv",A,3,E),35666:w.bind(null,"uniform4fv",A,4,E),5124:w.bind(null,"uniform1iv",g,1,E),35667:w.bind(null,"uniform2iv",g,2,E),35668:w.bind(null,"uniform3iv",g,3,E),35669:w.bind(null,"uniform4iv",g,4,E),35670:w.bind(null,"uniform1iv",g,1,E),35671:w.bind(null,"uniform2iv",g,2,E),35672:w.bind(null,"uniform3iv",g,3,E),35673:w.bind(null,"uniform4iv",g,4,E),35674:w.bind(null,"uniformMatrix2fv",A,4,S),35675:w.bind(null,"uniformMatrix3fv",A,9,S),35676:w.bind(null,"uniformMatrix4fv",A,16,S),35678:x,35680:x,5125:w.bind(null,"uniform1uiv",m,1,E),36294:w.bind(null,"uniform2uiv",m,2,E),36295:w.bind(null,"uniform3uiv",m,3,E),36296:w.bind(null,"uniform4uiv",m,4,E),35685:w.bind(null,"uniformMatrix2x3fv",A,6,S),35686:w.bind(null,"uniformMatrix2x4fv",A,8,S),35687:w.bind(null,"uniformMatrix3x2fv",A,6,S),35688:w.bind(null,"uniformMatrix3x4fv",A,12,S),35689:w.bind(null,"uniformMatrix4x2fv",A,8,S),35690:w.bind(null,"uniformMatrix4x3fv",A,12,S),35678:x,35680:x,35679:x,35682:x,36289:x,36292:x,36293:x,36298:x,36299:x,36300:x,36303:x,36306:x,36307:x,36308:x,36311:x},l={},h={},f={},p=[0];function d(t,e,r,n){1===e&&"boolean"==typeof t&&(t=t?1:0),Number.isFinite(t)&&(p[0]=t,t=p);const i=t.length;if(i%e&&a.k.warn(`Uniform size should be multiples of ${e}`,t)(),t instanceof r)return t;let o=n[i];o||(o=new r(i),n[i]=o);for(let e=0;e<i;e++)o[e]=t[e];return o}function A(t,e){return d(t,e,Float32Array,l)}function g(t,e){return d(t,e,Int32Array,h)}function m(t,e){return d(t,e,Uint32Array,f)}function y(t,e,r){const n=c[r.type];if(!n)throw new Error(`Unknown GLSL uniform type ${r.type}`);return n().bind(null,t,e)}function v(t){if("]"!==t[t.length-1])return{name:t,length:1,isArray:!1};const e=t.match(/([^[]*)(\[[0-9]+\])?/);if(!e||e.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:e[1],length:e[2]||1,isArray:Boolean(e[2])}}function _(t){return Array.isArray(t)||ArrayBuffer.isView(t)?function(t){if(0===t.length)return!1;const e=Math.min(t.length,16);for(let r=0;r<e;++r)if(!Number.isFinite(t[r]))return!1;return!0}(t):!!isFinite(t)||(!0===t||!1===t||(t instanceof i.a||(t instanceof s.a||t instanceof o.a&&Boolean(t.texture))))}function b(t,e,r){if(Array.isArray(r)||ArrayBuffer.isView(r))if(t[e]){const n=t[e];for(let t=0,e=r.length;t<e;++t)n[t]=r[t]}else t[e]=r.slice();else t[e]=r}function x(){let t=null;return(e,r,n)=>{const i=t!==n;return i&&(e.uniform1i(r,n),t=n),i}}function w(t,e,r,n){let i=null,o=null;return(a,s,c)=>{const l=e(c,r),h=l.length;let f=!1;if(null===i)i=new Float32Array(h),o=h,f=!0;else{Object(u.a)(o===h,"Uniform length cannot change.");for(let t=0;t<h;++t)if(l[t]!==i[t]){f=!0;break}}return f&&(n(a,t,s,l),i.set(l)),f}}function E(t,e,r,n){t[e](r,n)}function S(t,e,r,n){t[e](r,!1,n)}function O(t,e="unnamed"){const r=t.match(/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/);return r?r[1]:e}function T(t,e,r,n){const i=t.split(/\r?\n/),o={},a={},s=n||O(e)||"(unnamed)",u=`${function(t){switch(t){case 35632:return"fragment";case 35633:return"vertex";default:return"unknown type"}}(r)} shader ${s}`;for(let e=0;e<i.length;e++){const r=i[e];if(r.length<=1)continue;const n=r.split(":"),s=n[0],c=parseInt(n[2],10);if(isNaN(c))throw new Error(`GLSL compilation error in ${u}: ${t}`);"WARNING"!==s?o[c]=r:a[c]=r}const c=function(t,e=1,r=": "){const n=t.split(/\r?\n/),i=String(n.length+e-1).length;return n.map((t,n)=>{const o=String(n+e),a=o.length;return M(o,i-a)+r+t})}(e);return{shaderName:u,errors:P(o,c),warnings:P(a,c)}}function P(t,e){let r="";for(let n=0;n<e.length;n++){const i=e[n];if((t[n+3]||t[n+2]||t[n+1])&&(r+=`${i}\n`,t[n+1])){const e=t[n+1],i=e.split(":",3),o=i[0],a=parseInt(i[1],10)||0;r+=M(`^^^ ${o}: ${e.substring(i.join(":").length+1).trim()}\n\n`,a)}}return r}function M(t,e){let r="";for(let t=0;t<e;++t)r+=" ";return`${r}${t}`}var C=r(48);class I extends n.a{static getTypeName(t){switch(t){case 35633:return"vertex-shader";case 35632:return"fragment-shader";default:return Object(u.a)(!1),"unknown"}}constructor(t,e){Object(a.b)(t),Object(u.a)("string"==typeof e.source,"Shader: GLSL source code must be a JavaScript string"),super(t,{id:O(e.source,null)||e.id||Object(C.c)(`unnamed ${I.getTypeName(e.shaderType)}`)}),this.shaderType=e.shaderType,this.source=e.source,this.initialize(e)}initialize({source:t}){const e=O(t,null);e&&(this.id=Object(C.c)(e)),this._compile(t)}getParameter(t){return this.gl.getShaderParameter(this.handle,t)}toString(){return`${I.getTypeName(this.shaderType)}:${this.id}`}getName(){return O(this.source)||"unnamed-shader"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){const t=this.gl.getExtension("WEBGL_debug_shaders");return t?t.getTranslatedShaderSource(this.handle):"No translated source available. WEBGL_debug_shaders not implemented"}_compile(t=this.source){if(t.startsWith("#version ")||(t=`#version 100\n${t}`),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){const t=this.gl.getShaderInfoLog(this.handle),{shaderName:e,errors:r,warnings:n}=T(t,this.source,this.shaderType,this.id);throw a.k.error(`GLSL compilation errors in ${e}\n${r}`)(),a.k.warn(`GLSL compilation warnings in ${e}\n${n}`)(),new Error(`GLSL compilation errors in ${e}`)}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}}class k extends I{constructor(t,e){"string"==typeof e&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}}class R extends I{constructor(t,e){"string"==typeof e&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}}var L=r(64),j=r(81);class D{constructor(t){this.id=t.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(t),this._readVaryingsFromProgram(t)}getAttributeInfo(t){const e=Number(t);return Number.isFinite(e)?this.attributeInfosByLocation[e]:this.attributeInfosByName[t]||null}getAttributeLocation(t){const e=this.getAttributeInfo(t);return e?e.location:-1}getAttributeAccessor(t){const e=this.getAttributeInfo(t);return e?e.accessor:null}getVaryingInfo(t){const e=Number(t);return Number.isFinite(e)?this.varyingInfos[e]:this.varyingInfosByName[t]||null}getVaryingIndex(t){const e=this.getVaryingInfo();return e?e.location:-1}getVaryingAccessor(t){const e=this.getVaryingInfo();return e?e.accessor:null}_readAttributesFromProgram(t){const{gl:e}=t,r=e.getProgramParameter(t.handle,35721);for(let n=0;n<r;n++){const{name:r,type:i,size:o}=e.getActiveAttrib(t.handle,n),a=e.getAttribLocation(t.handle,r);a>=0&&this._addAttribute(a,r,i,o)}this.attributeInfos.sort((t,e)=>t.location-e.location)}_readVaryingsFromProgram(t){const{gl:e}=t;if(!Object(a.j)(e))return;const r=e.getProgramParameter(t.handle,35971);for(let n=0;n<r;n++){const{name:r,type:i,size:o}=e.getTransformFeedbackVarying(t.handle,n);this._addVarying(n,r,i,o)}this.varyingInfos.sort((t,e)=>t.location-e.location)}_addAttribute(t,e,r,n){const{type:i,components:o}=Object(j.a)(r),a={type:i,size:n*o};this._inferProperties(t,e,a);const s={location:t,name:e,accessor:new L.a(a)};this.attributeInfos.push(s),this.attributeInfosByLocation[t]=s,this.attributeInfosByName[s.name]=s}_inferProperties(t,e,r){/instance/i.test(e)&&(r.divisor=1)}_addVarying(t,e,r,n){const{type:i,components:o}=Object(j.a)(r),a={location:t,name:e,accessor:new L.a({type:i,size:n*o})};this.varyingInfos.push(a),this.varyingInfosByName[a.name]=a}}var B=r(49);r.d(e,"a",(function(){return N}));const F=35981,z=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"];class N extends n.a{constructor(t,e={}){super(t,e),this.stubRemovedMethods("Program","v6.0",z),this._isCached=!1,this.initialize(e),Object.seal(this),this._setId(e.id)}initialize(t={}){const{hash:e,vs:r,fs:n,varyings:i,bufferMode:o=F}=t;return this.hash=e||"",this.vs="string"==typeof r?new k(this.gl,{id:`${t.id}-vs`,source:r}):r,this.fs="string"==typeof n?new R(this.gl,{id:`${t.id}-fs`,source:n}):n,Object(u.a)(this.vs instanceof k),Object(u.a)(this.fs instanceof R),this.uniforms={},this._textureUniforms={},i&&i.length>0&&(Object(a.a)(this.gl),this.varyings=i,this.gl2.transformFeedbackVaryings(this.handle,i,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new D(this),this.setProps(t)}delete(t={}){return this._isCached?this:super.delete(t)}setProps(t){return"uniforms"in t&&this.setUniforms(t.uniforms),this}draw({logPriority:t,drawMode:e=4,vertexCount:r,offset:n=0,start:i,end:o,isIndexed:s=!1,indexType:c=5123,instanceCount:l=0,isInstanced:h=l>0,vertexArray:f=null,transformFeedback:p,framebuffer:d,parameters:A={},uniforms:g,samplers:m}){if((g||m)&&(a.k.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(g||{})),a.k.priority>=t){const n=d?d.id:"default",i=`mode=${Object(B.a)(this.gl,e)} verts=${r} `+`instances=${l} indexType=${Object(B.a)(this.gl,c)} `+`isInstanced=${h} isIndexed=${s} `+`Framebuffer=${n}`;a.k.log(t,i)()}return Object(u.a)(f),this.gl.useProgram(this.handle),!(!this._areTexturesRenderable()||0===r||h&&0===l)&&(f.bindForDraw(r,l,()=>{if(void 0!==d&&(A=Object.assign({},A,{framebuffer:d})),p){const t=Object(j.c)(e);p.begin(t)}this._bindTextures(),Object(a.o)(this.gl,A,()=>{s&&h?this.gl2.drawElementsInstanced(e,r,c,n,l):s&&Object(a.j)(this.gl)&&!isNaN(i)&&!isNaN(o)?this.gl2.drawRangeElements(e,i,o,r,c,n):s?this.gl.drawElements(e,r,c,n):h?this.gl2.drawArraysInstanced(e,n,r,l):this.gl.drawArrays(e,n,r)}),p&&p.end()}),!0)}setUniforms(t={}){a.k.priority>=2&&function(t,e,r){for(const n in t){const i=t[n];if((!r||Boolean(r[n]))&&!_(i))throw e=e?`${e} `:"",console.error(`${e} Bad uniform ${n}`,i),new Error(`${e} Bad uniform ${n}`)}}(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(const e in t){const r=t[e],n=this._uniformSetters[e];if(n){let t=r,a=!1;if(t instanceof o.a&&(t=t.texture),t instanceof i.a)if(a=this.uniforms[e]!==r,a){void 0===n.textureIndex&&(n.textureIndex=this._textureIndexCounter++);const r=t,{textureIndex:i}=n;r.bind(i),t=i,this._textureUniforms[e]=r}else t=n.textureIndex;else this._textureUniforms[e]&&delete this._textureUniforms[e];(n(t)||a)&&b(this.uniforms,e,r)}}return this}_areTexturesRenderable(){let t=!0;for(const e in this._textureUniforms){const r=this._textureUniforms[e];r.update(),t=t&&r.loaded}return t}_bindTextures(){for(const t in this._textureUniforms){const e=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(e)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){const e=this.gl.getAttachedShaders(t),r={};for(const t of e){switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:r.vs=new k({handle:t});break;case 35632:r.fs=new R({handle:t})}}return r}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){const t=this._getName();this.id=Object(C.c)(t)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,""),t=t?`${t}-program`:"program",t}_compileAndLink(){const{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),a.k.time(4,`linkProgram for ${this._getName()}`)(),t.linkProgram(this.handle),a.k.timeEnd(4,`linkProgram for ${this._getName()}`)(),t.debug||a.k.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}}_readUniformLocationsFromLinkedProgram(){const{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let e=0;e<this._uniformCount;e++){const r=this.gl.getActiveUniform(this.handle,e),{name:n}=v(r.name);let i=t.getUniformLocation(this.handle,n);if(this._uniformSetters[n]=y(t,i,r),r.size>1)for(let e=0;e<r.size;e++)i=t.getUniformLocation(this.handle,`${n}[${e}]`),this._uniformSetters[`${n}[${e}]`]=y(t,i,r)}this._textureIndexCounter=0}getActiveUniforms(t,e){return this.gl2.getActiveUniforms(this.handle,t,e)}getUniformBlockIndex(t){return this.gl2.getUniformBlockIndex(this.handle,t)}getActiveUniformBlockParameter(t,e){return this.gl2.getActiveUniformBlockParameter(this.handle,t,e)}uniformBlockBinding(t,e){this.gl2.uniformBlockBinding(this.handle,t,e)}}},function(t,e,r){"use strict";var n=r(177);const i="out vec4 transform_output;\nvoid main() {\n  transform_output = vec4(0);\n}",o=`#version 300 es\n${i}`;function a(t,e){e=Array.isArray(e)?e:[e];const r=t.replace(/^\s+/,"").split(/\s+/),[n,i,o]=r;return e.includes(n)&&i&&o?{qualifier:n,type:i,name:o.split(";")[0]}:null}function s(t={}){const{version:e=100,input:r,inputType:a,output:s}=t;if(!r)return 300===e?o:e>300?`#version ${e}\n${i}`:"void main() {gl_FragColor = vec4(0);}";const u=function(t,e){switch(e){case"float":return`vec4(${t}, 0.0, 0.0, 1.0)`;case"vec2":return`vec4(${t}, 0.0, 1.0)`;case"vec3":return`vec4(${t}, 1.0)`;case"vec4":return t;default:return Object(n.a)(!1),null}}(r,a);return e>=300?`#version ${e} ${300===e?"es":""}\nin ${a} ${r};\nout vec4 ${s};\nvoid main() {\n  ${s} = ${u};\n}`:`varying ${a} ${r};\nvoid main() {\n  gl_FragColor = ${u};\n}`}var u=r(7),c=r(34),l=r(289),h=r(9);class f{constructor(t,e={}){this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}setupResources(t){for(const e of this.bindings)this._setupTransformFeedback(e,t)}updateModelProps(t={}){const{varyings:e}=this;return e.length>0&&(t=Object.assign({},t,{varyings:e})),t}getDrawOptions(t={}){const e=this.bindings[this.currentIndex],{sourceBuffers:r,transformFeedback:n}=e;return{attributes:Object.assign({},r,t.attributes),transformFeedback:n}}swap(){return!!this.feedbackMap&&(this.currentIndex=this._getNextIndex(),!0)}update(t={}){this._setupBuffers(t)}getBuffer(t){const{feedbackBuffers:e}=this.bindings[this.currentIndex],r=t?e[t]:null;return r?r instanceof c.a?r:r.buffer:null}getData(t={}){const{varyingName:e}=t,r=this.getBuffer(e);return r?r.getData():null}delete(){for(const t in this.resources)this.resources[t].delete()}_initialize(t={}){this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&Object(h.a)(Object(u.j)(this.gl))}_getFeedbackBuffers(t){const{sourceBuffers:e={}}=t,r={};if(this.bindings[this.currentIndex]&&Object.assign(r,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(const t in this.feedbackMap){const n=this.feedbackMap[t];t in e&&(r[n]=t)}Object.assign(r,t.feedbackBuffers);for(const t in r){const n=r[t];if("string"==typeof n){const i=e[n],{byteLength:o,usage:a,accessor:s}=i;r[t]=this._createNewBuffer(t,{byteLength:o,usage:a,accessor:s})}}return r}_setupBuffers(t={}){const{sourceBuffers:e=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);const r=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:e,feedbackBuffers:r})}_setupTransformFeedback(t,{model:e}){const{program:r}=e;t.transformFeedback=new l.a(this.gl,{program:r,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){const{sourceBuffers:t,feedbackBuffers:e}=this._swapBuffers(this.bindings[this.currentIndex]),r=this._getNextIndex();this.bindings[r]=this._updateBinding(this.bindings[r],{sourceBuffers:t,feedbackBuffers:e})}}_updateBinding(t,e){return t?(Object.assign(t.sourceBuffers,e.sourceBuffers),Object.assign(t.feedbackBuffers,e.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},e.sourceBuffers),feedbackBuffers:Object.assign({},e.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;const e=Object.assign({},t.sourceBuffers),r=Object.assign({},t.feedbackBuffers);for(const n in this.feedbackMap){const i=this.feedbackMap[n];e[n]=t.feedbackBuffers[i],r[i]=t.sourceBuffers[n],Object(h.a)(r[i]instanceof c.a)}return{sourceBuffers:e,feedbackBuffers:r}}_createNewBuffer(t,e){const r=new c.a(this.gl,e);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=r,r}_getNextIndex(){return(this.currentIndex+1)%2}}var p=r(197),d=r(98),A=r(71),g=r(230);function m(t){let e=100;const r=t.match(/[^\s]+/g);if(r.length>=2&&"#version"===r[0]){const t=parseInt(r[1],10);Number.isFinite(t)&&(e=t)}return e}var y=r(180);const v={name:"transform",vs:"attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n  return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n  float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n  float xIndex = transform_elementID - (yIndex * texSize[0]);\n  return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n  vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n  vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n  vec2 coord = indices / size + pixelSizeHalf;\n  return coord;\n}\nvec2 transform_getPos(vec2 size) {\n  vec2 texCoord = transform_getTexCoord(size);\n  vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n  return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n  vec2 texCoord = transform_getTexCoord(size);\n  vec4 textureColor = texture2D(texSampler, texCoord);\n  return textureColor;\n}\n",fs:null};function _({vs:t,sourceTextureMap:e,targetTextureVarying:r,targetTexture:i}){let o=Object.keys(e).length,s=null;const u={};let c=t,l={};if(o>0||r){const t=c.split("\n"),f=t.slice();if(t.forEach((t,i,c)=>{if(o>0){const r=function(t,e){const r={},i=function(t){return a(t,["attribute","in"])}(t);if(!i)return null;const{type:o,name:s}=i;if(s&&e[s]){const e=`// ${t} => Replaced by Transform with a sampler`,{samplerName:i,sizeName:a,uniformDeclerations:u}=function(t){const e=`transform_uSampler_${t}`,r=`transform_uSize_${t}`;return{samplerName:e,sizeName:r,uniformDeclerations:`  uniform sampler2D ${e};\n  uniform vec2 ${r};`}}(s),c=function(t){switch(t){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:return Object(n.a)(!1),null}}(o),l=`  ${o} ${s} = transform_getInput(${i}, ${a}).${c};\n`;return r[i]=s,{updatedLine:e,inject:{"vs:#decl":u,"vs:#main-start":l},samplerTextureMap:r}}return null}(t,e);if(r){const{updatedLine:t,inject:e}=r;f[i]=t,l=Object(y.b)([l,e]),Object.assign(u,r.samplerTextureMap),o--}}r&&!s&&(s=function(t,e){const r=a(t,["varying","out"]);if(!r)return null;return r.name===e?r.type:null}(t,r))}),r){Object(h.a)(i);const t=`transform_uSize_${r}`,e={"vs:#decl":`uniform vec2 ${t};\n`,"vs:#main-start":`     vec2 transform_position = transform_getPos(${t});\n     gl_Position = vec4(transform_position, 0, 1.);\n`};l=Object(y.b)([l,e])}c=f.join("\n")}return{vs:c,targetTextureType:s,inject:l,samplerTextureMap:u}}const b={10241:9728,10240:9728,10242:33071,10243:33071};class x{constructor(t,e={}){this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}updateModelProps(t={}){const e=this._processVertexShader(t);return Object.assign({},t,e)}getDrawOptions(t={}){const{sourceBuffers:e,sourceTextures:r,framebuffer:n,targetTexture:i}=this.bindings[this.currentIndex],o=Object.assign({},e,t.attributes),a=Object.assign({},t.uniforms),s=Object.assign({},t.parameters);let u=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(const t in this.samplerTextureMap){const e=this.samplerTextureMap[t];a[t]=r[e]}this._setSourceTextureParameters();const t=function({sourceTextureMap:t,targetTextureVarying:e,targetTexture:r}){const n={};let i,o;e&&(({width:i,height:o}=r),n[`transform_uSize_${e}`]=[i,o]);for(const e in t)({width:i,height:o}=t[e]),n[`transform_uSize_${e}`]=[i,o];return n}({sourceTextureMap:r,targetTextureVarying:this.targetTextureVarying,targetTexture:i});Object.assign(a,t)}return this.hasTargetTexture&&(u=!1,s.viewport=[0,0,n.width,n.height]),{attributes:o,framebuffer:n,uniforms:a,discard:u,parameters:s}}swap(){return!!this._swapTexture&&(this.currentIndex=this._getNextIndex(),!0)}update(t={}){this._setupTextures(t)}getTargetTexture(){const{targetTexture:t}=this.bindings[this.currentIndex];return t}getData({packed:t=!1}={}){const{framebuffer:e}=this.bindings[this.currentIndex],r=Object(p.c)(e);if(!t)return r;const i=r.constructor,o=function(t){switch(t){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:return Object(n.a)(!1),null}}(this.targetTextureType),a=new i(r.length*o/4);let s=0;for(let t=0;t<r.length;t+=4)for(let e=0;e<o;e++)a[s++]=r[t+e];return a}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}delete(){this.ownTexture&&this.ownTexture.delete(),this.elementIDBuffer&&this.elementIDBuffer.delete()}_initialize(t={}){const{_targetTextureVarying:e,_swapTexture:r}=t;this._swapTexture=r,this.targetTextureVarying=e,this.hasTargetTexture=e,this._setupTextures(t)}_createTargetTexture(t){const{sourceTextures:e,textureOrReference:r}=t;if(r instanceof d.a)return r;const n=e[r];return n?(this._targetRefTexName=r,this._createNewTexture(n)):null}_setupTextures(t={}){const{sourceBuffers:e,_sourceTextures:r={},_targetTexture:n}=t,i=this._createTargetTexture({sourceTextures:r,textureOrReference:n});this.hasSourceTextures=this.hasSourceTextures||r&&Object.keys(r).length>0,this._updateBindings({sourceBuffers:e,sourceTextures:r,targetTexture:i}),"elementCount"in t&&this._updateElementIDBuffer(t.elementCount)}_updateElementIDBuffer(t){if("number"!=typeof t||this.elementCount>=t)return;const e=new Float32Array(t);e.forEach((t,e,r)=>{r[e]=e}),this.elementIDBuffer?this.elementIDBuffer.setData({data:e}):this.elementIDBuffer=new c.a(this.gl,{data:e,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){const{sourceTextures:t,targetTexture:e}=this._swapTextures(this.bindings[this.currentIndex]),r=this._getNextIndex();this.bindings[r]=this._updateBinding(this.bindings[r],{sourceTextures:t,targetTexture:e})}}_updateBinding(t,e){const{sourceBuffers:r,sourceTextures:n,targetTexture:i}=e;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,n),Object.assign(t.sourceBuffers,r),i){t.targetTexture=i;const{width:e,height:r}=i,{framebuffer:n}=t;n?(n.update({attachments:{36064:i},resizeAttachments:!1}),n.resize({width:e,height:r})):t.framebuffer=new A.a(this.gl,{id:"transform-framebuffer",width:e,height:r,attachments:{36064:i}})}return t}_setSourceTextureParameters(){const t=this.currentIndex,{sourceTextures:e}=this.bindings[t];for(const t in e)e[t].setParameters(b)}_swapTextures(t){if(!this._swapTexture)return null;const e=Object.assign({},t.sourceTextures);return e[this._swapTexture]=t.targetTexture,{sourceTextures:e,targetTexture:t.sourceTextures[this._swapTexture]}}_createNewTexture(t){const e=Object(g.a)(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=e,e}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(t={}){const{sourceTextures:e,targetTexture:r}=this.bindings[this.currentIndex],{vs:n,uniforms:i,targetTextureType:o,inject:a,samplerTextureMap:u}=_({vs:t.vs,sourceTextureMap:e,targetTextureVarying:this.targetTextureVarying,targetTexture:r}),c=Object(y.b)([t.inject||{},a]);return this.targetTextureType=o,this.samplerTextureMap=u,{vs:n,fs:t._fs||s({version:m(n),input:this.targetTextureVarying,inputType:o,output:"transform_output"}),modules:this.hasSourceTextures||this.targetTextureVarying?[v].concat(t.modules||[]):t.modules,uniforms:i,inject:c}}}var w=r(48),E=r(176);r.d(e,"a",(function(){return S}));class S{static isSupported(t){return Object(u.j)(t)}constructor(t,e={}){this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(e),Object.seal(this)}delete(){const{model:t,bufferTransform:e,textureTransform:r}=this;t&&t.delete(),e&&e.delete(),r&&r.delete()}run(t={}){const{clearRenderTarget:e=!0}=t,r=this._updateDrawOptions(t);e&&r.framebuffer&&r.framebuffer.clear({color:!0}),this.model.transform(r)}swap(){let t=!1;const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of e)t=t||r.swap();Object(h.a)(t,"Nothing to swap")}getBuffer(t=null){return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(t={}){const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of e){const e=r.getData(t);if(e)return e}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(t={}){"elementCount"in t&&this.model.setVertexCount(t.elementCount);const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of e)r.update(t)}_initialize(t={}){const{gl:e}=this;this._buildResourceTransforms(e,t),t=this._updateModelProps(t),this.model=new E.a(e,Object.assign({},t,{fs:t.fs||s({version:m(t.vs)}),id:t.id||"transform-model",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let e=Object.assign({},t);const r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const t of r)e=t.updateModelProps(e);return e}_buildResourceTransforms(t,e){(function(t){if(!Object(w.a)(t.feedbackBuffers)||!Object(w.a)(t.feedbackMap)||t.varyings&&t.varyings.length>0)return!0;return!1})(e)&&(this.bufferTransform=new f(t,e)),function(t){if(!Object(w.a)(t._sourceTextures)||t._targetTexture||t._targetTextureVarying)return!0;return!1}(e)&&(this.textureTransform=new x(t,e)),Object(h.a)(this.bufferTransform||this.textureTransform,"must provide source/feedback buffers or source/target textures")}_updateDrawOptions(t){let e=Object.assign({},t);const r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const t of r)e=Object.assign(e,t.getDrawOptions(e));return e}}},function(t,e,r){"use strict";var n=r(138);r.d(e,"a",(function(){return i}));const i={name:"pbr",vs:"uniform mat4 u_MVPMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_NormalMatrix;\n\nvarying vec3 pbr_vPosition;\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n# else\nvarying vec3 pbr_vNormal;\n# endif\n#endif\n\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\n  vec4 pos = u_ModelMatrix * position;\n  pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n  vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));\n  vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));\n  vec3 bitangentW = cross(normalW, tangentW) * tangent.w;\n  pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else\n  pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n  pbr_vUV = uv;\n#else\n  pbr_vUV = vec2(0.,0.);\n#endif\n}\n",fs:"#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)\n# error PBR fragment shader: Texture LOD is not available\n#endif\n\n#if !defined(HAS_TANGENTS) && !defined(FEATURE_GLSL_DERIVATIVES)\n# error PBR fragment shader: Derivatives are not available\n#endif\n\n\n#if (__VERSION__ < 300)\n  #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL1COND; INCR)\n#else\n  #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL2COND; INCR)\n#endif\n\nprecision highp float;\n\nuniform bool pbr_uUnlit;\n\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\nuniform vec2 u_ScaleIBLAmbient;\n#endif\n\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\nuniform float u_NormalScale;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\nuniform vec3 u_EmissiveFactor;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\nuniform float u_OcclusionStrength;\n#endif\n\n#ifdef ALPHA_CUTOFF\nuniform float u_AlphaCutoff;\n#endif\n\nuniform vec2 u_MetallicRoughnessValues;\nuniform vec4 u_BaseColorFactor;\n\nuniform vec3 u_Camera;\n#ifdef PBR_DEBUG\nuniform vec4 u_ScaleDiffBaseMR;\nuniform vec4 u_ScaleFGDSpec;\n#endif\n\nvarying vec3 pbr_vPosition;\n\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n#else\nvarying vec3 pbr_vNormal;\n#endif\n#endif\n\n\nstruct PBRInfo\n{\n  float NdotL;\n  float NdotV;\n  float NdotH;\n  float LdotH;\n  float VdotH;\n  float perceptualRoughness;\n  float metalness;\n  vec3 reflectance0;\n  vec3 reflectance90;\n  float alphaRoughness;\n  vec3 diffuseColor;\n  vec3 specularColor;\n  vec3 n;\n  vec3 v;\n};\n\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\n\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n  vec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else\n  vec3 bLess = step(vec3(0.04045),srgbIn.xyz);\n  vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif\n  return vec4(linOut,srgbIn.w);;\n#else\n  return srgbIn;\n#endif\n}\n\nvec3 getNormal()\n{\n#ifndef HAS_TANGENTS\n  vec3 pos_dx = dFdx(pbr_vPosition);\n  vec3 pos_dy = dFdy(pbr_vPosition);\n  vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\n  vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\n  vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n  vec3 ng = normalize(pbr_vNormal);\n#else\n  vec3 ng = cross(pos_dx, pos_dy);\n#endif\n\n  t = normalize(t - ng * dot(ng, t));\n  vec3 b = normalize(cross(ng, t));\n  mat3 tbn = mat3(t, b, ng);\n#else\n  mat3 tbn = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n  vec3 n = texture2D(u_NormalSampler, pbr_vUV).rgb;\n  n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));\n#else\n  vec3 n = normalize(tbn[2].xyz);\n#endif\n\n  return n;\n}\n\n\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)\n{\n  float mipCount = 9.0;\n  float lod = (pbrInputs.perceptualRoughness * mipCount);\n  vec3 brdf = SRGBtoLINEAR(texture2D(u_brdfLUT,\n    vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;\n  vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n  vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;\n#else\n  vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;\n#endif\n\n  vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;\n  vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);\n  diffuse *= u_ScaleIBLAmbient.x;\n  specular *= u_ScaleIBLAmbient.y;\n\n  return diffuse + specular;\n}\n#endif\n\n\nvec3 diffuse(PBRInfo pbrInputs)\n{\n  return pbrInputs.diffuseColor / M_PI;\n}\n\nvec3 specularReflection(PBRInfo pbrInputs)\n{\n  return pbrInputs.reflectance0 +\n    (pbrInputs.reflectance90 - pbrInputs.reflectance0) *\n    pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);\n}\n\n\n\nfloat geometricOcclusion(PBRInfo pbrInputs)\n{\n  float NdotL = pbrInputs.NdotL;\n  float NdotV = pbrInputs.NdotV;\n  float r = pbrInputs.alphaRoughness;\n\n  float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n  float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n  return attenuationL * attenuationV;\n}\n\n\n\n\n\nfloat microfacetDistribution(PBRInfo pbrInputs)\n{\n  float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;\n  float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;\n  return roughnessSq / (M_PI * f * f);\n}\n\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {\n  pbrInputs.NdotL = 1.0;\n  pbrInputs.NdotH = 0.0;\n  pbrInputs.LdotH = 0.0;\n  pbrInputs.VdotH = 1.0;\n}\n\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {\n  vec3 n = pbrInputs.n;\n  vec3 v = pbrInputs.v;\n  vec3 l = normalize(lightDirection);\n  vec3 h = normalize(l+v);\n\n  pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);\n  pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);\n  pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);\n  pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {\n  vec3 light_direction = normalize(pointLight.position - pbr_vPosition);\n  PBRInfo_setDirectionalLight(pbrInputs, light_direction);\n}\n\nvec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {\n  vec3 F = specularReflection(pbrInputs);\n  float G = geometricOcclusion(pbrInputs);\n  float D = microfacetDistribution(pbrInputs);\n  vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);\n  vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);\n  return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n#ifdef HAS_BASECOLORMAP\n  vec4 baseColor = SRGBtoLINEAR(texture2D(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;\n#else\n  vec4 baseColor = u_BaseColorFactor;\n#endif\n\n#ifdef ALPHA_CUTOFF\n  if (baseColor.a < u_AlphaCutoff) {\n    discard;\n  }\n#endif\n\n  vec3 color = vec3(0, 0, 0);\n\n  if(pbr_uUnlit){\n    color.rgb = baseColor.rgb;\n  }\n  else{\n\n\n    float perceptualRoughness = u_MetallicRoughnessValues.y;\n    float metallic = u_MetallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\n\n    vec4 mrSample = texture2D(u_MetallicRoughnessSampler, pbr_vUV);\n    perceptualRoughness = mrSample.g * perceptualRoughness;\n    metallic = mrSample.b * metallic;\n#endif\n    perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n    metallic = clamp(metallic, 0.0, 1.0);\n\n    float alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n    vec3 f0 = vec3(0.04);\n    vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n    diffuseColor *= 1.0 - metallic;\n    vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n\n\n    float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n    vec3 specularEnvironmentR0 = specularColor.rgb;\n    vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n    vec3 n = getNormal();\n    vec3 v = normalize(u_Camera - pbr_vPosition);\n\n    float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n    vec3 reflection = -normalize(reflect(v, n));\n\n    PBRInfo pbrInputs = PBRInfo(\n      0.0,\n      NdotV,\n      0.0,\n      0.0,\n      0.0,\n      perceptualRoughness,\n      metallic,\n      specularEnvironmentR0,\n      specularEnvironmentR90,\n      alphaRoughness,\n      diffuseColor,\n      specularColor,\n      n,\n      v\n    );\n\n#ifdef USE_LIGHTS\n    PBRInfo_setAmbientLight(pbrInputs);\n    color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);\n    SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uDirectionalLightCount, i++) {\n      if (i < lighting_uDirectionalLightCount) {\n        PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);\n        color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);\n      }\n    }\n    SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uPointLightCount, i++) {\n      if (i < lighting_uPointLightCount) {\n        PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);\n        float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));\n        color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);\n      }\n    }\n#endif\n#ifdef USE_IBL\n    color += getIBLContribution(pbrInputs, n, reflection);\n#endif\n#ifdef HAS_OCCLUSIONMAP\n    float ao = texture2D(u_OcclusionSampler, pbr_vUV).r;\n    color = mix(color, color * ao, u_OcclusionStrength);\n#endif\n\n#ifdef HAS_EMISSIVEMAP\n    vec3 emissive = SRGBtoLINEAR(texture2D(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;\n    color += emissive;\n#endif\n\n#ifdef PBR_DEBUG\n\n\n\n\n\n    color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);\n    color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);\n    color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);\n#endif\n\n  }\n\n  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n",defines:{LIGHTING_FRAGMENT:1},dependencies:[n.a]}}])}));
//# sourceMappingURL=index.js.map

/***/ }),

/***/ "5926":
/***/ (function(module, exports) {

var ceil = Math.ceil;
var floor = Math.floor;

// `ToIntegerOrInfinity` abstract operation
// https://tc39.es/ecma262/#sec-tointegerorinfinity
module.exports = function (argument) {
  var number = +argument;
  // eslint-disable-next-line no-self-compare -- safe
  return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
};


/***/ }),

/***/ "59ed":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var tryToString = __webpack_require__("0d51");

// `Assert: IsCallable(argument) is true`
module.exports = function (argument) {
  if (isCallable(argument)) return argument;
  throw TypeError(tryToString(argument) + ' is not a function');
};


/***/ }),

/***/ "5c6c":
/***/ (function(module, exports) {

module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};


/***/ }),

/***/ "5e2e":
/***/ (function(module, exports, __webpack_require__) {

var listCacheClear = __webpack_require__("28c9"),
    listCacheDelete = __webpack_require__("69d5"),
    listCacheGet = __webpack_require__("b4c0"),
    listCacheHas = __webpack_require__("fba5"),
    listCacheSet = __webpack_require__("67ca");

/**
 * Creates an list cache object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function ListCache(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;

module.exports = ListCache;


/***/ }),

/***/ "5e77":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var hasOwn = __webpack_require__("1a2d");

var FunctionPrototype = Function.prototype;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;

var EXISTS = hasOwn(FunctionPrototype, 'name');
// additional protection from minified / mangled / dropped function names
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));

module.exports = {
  EXISTS: EXISTS,
  PROPER: PROPER,
  CONFIGURABLE: CONFIGURABLE
};


/***/ }),

/***/ "6044":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07");

/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');

module.exports = nativeCreate;


/***/ }),

/***/ "605d":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("c6b6");
var global = __webpack_require__("da84");

module.exports = classof(global.process) == 'process';


/***/ }),

/***/ "6069":
/***/ (function(module, exports) {

module.exports = typeof window == 'object';


/***/ }),

/***/ "60ed":
/***/ (function(module, exports, __webpack_require__) {

var baseGetTag = __webpack_require__("3729"),
    getPrototype = __webpack_require__("2dcb"),
    isObjectLike = __webpack_require__("1310");

/** `Object#toString` result references. */
var objectTag = '[object Object]';

/** Used for built-in method references. */
var funcProto = Function.prototype,
    objectProto = Object.prototype;

/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);

/**
 * Checks if `value` is a plain object, that is, an object created by the
 * `Object` constructor or one with a `[[Prototype]]` of `null`.
 *
 * @static
 * @memberOf _
 * @since 0.8.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 * }
 *
 * _.isPlainObject(new Foo);
 * // => false
 *
 * _.isPlainObject([1, 2, 3]);
 * // => false
 *
 * _.isPlainObject({ 'x': 0, 'y': 0 });
 * // => true
 *
 * _.isPlainObject(Object.create(null));
 * // => true
 */
function isPlainObject(value) {
  if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
    return false;
  }
  var proto = getPrototype(value);
  if (proto === null) {
    return true;
  }
  var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  return typeof Ctor == 'function' && Ctor instanceof Ctor &&
    funcToString.call(Ctor) == objectCtorString;
}

module.exports = isPlainObject;


/***/ }),

/***/ "62e4":
/***/ (function(module, exports) {

module.exports = function(module) {
	if (!module.webpackPolyfill) {
		module.deprecate = function() {};
		module.paths = [];
		// module.parent = undefined by default
		if (!module.children) module.children = [];
		Object.defineProperty(module, "loaded", {
			enumerable: true,
			get: function() {
				return module.l;
			}
		});
		Object.defineProperty(module, "id", {
			enumerable: true,
			get: function() {
				return module.i;
			}
		});
		module.webpackPolyfill = 1;
	}
	return module;
};


/***/ }),

/***/ "63ea":
/***/ (function(module, exports, __webpack_require__) {

var baseIsEqual = __webpack_require__("c05f");

/**
 * Performs a deep comparison between two values to determine if they are
 * equivalent.
 *
 * **Note:** This method supports comparing arrays, array buffers, booleans,
 * date objects, error objects, maps, numbers, `Object` objects, regexes,
 * sets, strings, symbols, and typed arrays. `Object` objects are compared
 * by their own, not inherited, enumerable properties. Functions and DOM
 * nodes are compared by strict equality, i.e. `===`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * var object = { 'a': 1 };
 * var other = { 'a': 1 };
 *
 * _.isEqual(object, other);
 * // => true
 *
 * object === other;
 * // => false
 */
function isEqual(value, other) {
  return baseIsEqual(value, other);
}

module.exports = isEqual;


/***/ }),

/***/ "65f0":
/***/ (function(module, exports, __webpack_require__) {

var arraySpeciesConstructor = __webpack_require__("0b42");

// `ArraySpeciesCreate` abstract operation
// https://tc39.es/ecma262/#sec-arrayspeciescreate
module.exports = function (originalArray, length) {
  return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
};


/***/ }),

/***/ "6747":
/***/ (function(module, exports) {

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */
var isArray = Array.isArray;

module.exports = isArray;


/***/ }),

/***/ "67ca":
/***/ (function(module, exports, __webpack_require__) {

var assocIndexOf = __webpack_require__("cb5a");

/**
 * Sets the list cache `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf ListCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the list cache instance.
 */
function listCacheSet(key, value) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  if (index < 0) {
    ++this.size;
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }
  return this;
}

module.exports = listCacheSet;


/***/ }),

/***/ "68ee":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var isCallable = __webpack_require__("1626");
var classof = __webpack_require__("f5df");
var getBuiltIn = __webpack_require__("d066");
var inspectSource = __webpack_require__("8925");

var empty = [];
var construct = getBuiltIn('Reflect', 'construct');
var constructorRegExp = /^\s*(?:class|function)\b/;
var exec = constructorRegExp.exec;
var INCORRECT_TO_STRING = !constructorRegExp.exec(function () { /* empty */ });

var isConstructorModern = function (argument) {
  if (!isCallable(argument)) return false;
  try {
    construct(Object, empty, argument);
    return true;
  } catch (error) {
    return false;
  }
};

var isConstructorLegacy = function (argument) {
  if (!isCallable(argument)) return false;
  switch (classof(argument)) {
    case 'AsyncFunction':
    case 'GeneratorFunction':
    case 'AsyncGeneratorFunction': return false;
    // we can't check .prototype since constructors produced by .bind haven't it
  } return INCORRECT_TO_STRING || !!exec.call(constructorRegExp, inspectSource(argument));
};

// `IsConstructor` abstract operation
// https://tc39.es/ecma262/#sec-isconstructor
module.exports = !construct || fails(function () {
  var called;
  return isConstructorModern(isConstructorModern.call)
    || !isConstructorModern(Object)
    || !isConstructorModern(function () { called = true; })
    || called;
}) ? isConstructorLegacy : isConstructorModern;


/***/ }),

/***/ "69d5":
/***/ (function(module, exports, __webpack_require__) {

var assocIndexOf = __webpack_require__("cb5a");

/** Used for built-in method references. */
var arrayProto = Array.prototype;

/** Built-in value references. */
var splice = arrayProto.splice;

/**
 * Removes `key` and its value from the list cache.
 *
 * @private
 * @name delete
 * @memberOf ListCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function listCacheDelete(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  if (index < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index == lastIndex) {
    data.pop();
  } else {
    splice.call(data, index, 1);
  }
  --this.size;
  return true;
}

module.exports = listCacheDelete;


/***/ }),

/***/ "69f3":
/***/ (function(module, exports, __webpack_require__) {

var NATIVE_WEAK_MAP = __webpack_require__("7f9a");
var global = __webpack_require__("da84");
var isObject = __webpack_require__("861d");
var createNonEnumerableProperty = __webpack_require__("9112");
var hasOwn = __webpack_require__("1a2d");
var shared = __webpack_require__("c6cd");
var sharedKey = __webpack_require__("f772");
var hiddenKeys = __webpack_require__("d012");

var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var WeakMap = global.WeakMap;
var set, get, has;

var enforce = function (it) {
  return has(it) ? get(it) : set(it, {});
};

var getterFor = function (TYPE) {
  return function (it) {
    var state;
    if (!isObject(it) || (state = get(it)).type !== TYPE) {
      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
    } return state;
  };
};

if (NATIVE_WEAK_MAP || shared.state) {
  var store = shared.state || (shared.state = new WeakMap());
  var wmget = store.get;
  var wmhas = store.has;
  var wmset = store.set;
  set = function (it, metadata) {
    if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    wmset.call(store, it, metadata);
    return metadata;
  };
  get = function (it) {
    return wmget.call(store, it) || {};
  };
  has = function (it) {
    return wmhas.call(store, it);
  };
} else {
  var STATE = sharedKey('state');
  hiddenKeys[STATE] = true;
  set = function (it, metadata) {
    if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    createNonEnumerableProperty(it, STATE, metadata);
    return metadata;
  };
  get = function (it) {
    return hasOwn(it, STATE) ? it[STATE] : {};
  };
  has = function (it) {
    return hasOwn(it, STATE);
  };
}

module.exports = {
  set: set,
  get: get,
  has: has,
  enforce: enforce,
  getterFor: getterFor
};


/***/ }),

/***/ "6eeb":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var hasOwn = __webpack_require__("1a2d");
var createNonEnumerableProperty = __webpack_require__("9112");
var setGlobal = __webpack_require__("ce4e");
var inspectSource = __webpack_require__("8925");
var InternalStateModule = __webpack_require__("69f3");
var CONFIGURABLE_FUNCTION_NAME = __webpack_require__("5e77").CONFIGURABLE;

var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(String).split('String');

(module.exports = function (O, key, value, options) {
  var unsafe = options ? !!options.unsafe : false;
  var simple = options ? !!options.enumerable : false;
  var noTargetGet = options ? !!options.noTargetGet : false;
  var name = options && options.name !== undefined ? options.name : key;
  var state;
  if (isCallable(value)) {
    if (String(name).slice(0, 7) === 'Symbol(') {
      name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
    }
    if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
      createNonEnumerableProperty(value, 'name', name);
    }
    state = enforceInternalState(value);
    if (!state.source) {
      state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
    }
  }
  if (O === global) {
    if (simple) O[key] = value;
    else setGlobal(key, value);
    return;
  } else if (!unsafe) {
    delete O[key];
  } else if (!noTargetGet && O[key]) {
    simple = true;
  }
  if (simple) O[key] = value;
  else createNonEnumerableProperty(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
  return isCallable(this) && getInternalState(this).source || inspectSource(this);
});


/***/ }),

/***/ "6fcd":
/***/ (function(module, exports, __webpack_require__) {

var baseTimes = __webpack_require__("50d8"),
    isArguments = __webpack_require__("d370"),
    isArray = __webpack_require__("6747"),
    isBuffer = __webpack_require__("0d24"),
    isIndex = __webpack_require__("c098"),
    isTypedArray = __webpack_require__("73ac");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Creates an array of the enumerable property names of the array-like `value`.
 *
 * @private
 * @param {*} value The value to query.
 * @param {boolean} inherited Specify returning inherited property names.
 * @returns {Array} Returns the array of property names.
 */
function arrayLikeKeys(value, inherited) {
  var isArr = isArray(value),
      isArg = !isArr && isArguments(value),
      isBuff = !isArr && !isArg && isBuffer(value),
      isType = !isArr && !isArg && !isBuff && isTypedArray(value),
      skipIndexes = isArr || isArg || isBuff || isType,
      result = skipIndexes ? baseTimes(value.length, String) : [],
      length = result.length;

  for (var key in value) {
    if ((inherited || hasOwnProperty.call(value, key)) &&
        !(skipIndexes && (
           // Safari 9 has enumerable `arguments.length` in strict mode.
           key == 'length' ||
           // Node.js 0.10 has enumerable non-index properties on buffers.
           (isBuff && (key == 'offset' || key == 'parent')) ||
           // PhantomJS 2 has enumerable non-index properties on typed arrays.
           (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
           // Skip index properties.
           isIndex(key, length)
        ))) {
      result.push(key);
    }
  }
  return result;
}

module.exports = arrayLikeKeys;


/***/ }),

/***/ "73ac":
/***/ (function(module, exports, __webpack_require__) {

var baseIsTypedArray = __webpack_require__("743f"),
    baseUnary = __webpack_require__("b047"),
    nodeUtil = __webpack_require__("99d3");

/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;

/**
 * Checks if `value` is classified as a typed array.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
 * @example
 *
 * _.isTypedArray(new Uint8Array);
 * // => true
 *
 * _.isTypedArray([]);
 * // => false
 */
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;

module.exports = isTypedArray;


/***/ }),

/***/ "7418":
/***/ (function(module, exports) {

// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
exports.f = Object.getOwnPropertySymbols;


/***/ }),

/***/ "743f":
/***/ (function(module, exports, __webpack_require__) {

var baseGetTag = __webpack_require__("3729"),
    isLength = __webpack_require__("b218"),
    isObjectLike = __webpack_require__("1310");

/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
    arrayTag = '[object Array]',
    boolTag = '[object Boolean]',
    dateTag = '[object Date]',
    errorTag = '[object Error]',
    funcTag = '[object Function]',
    mapTag = '[object Map]',
    numberTag = '[object Number]',
    objectTag = '[object Object]',
    regexpTag = '[object RegExp]',
    setTag = '[object Set]',
    stringTag = '[object String]',
    weakMapTag = '[object WeakMap]';

var arrayBufferTag = '[object ArrayBuffer]',
    dataViewTag = '[object DataView]',
    float32Tag = '[object Float32Array]',
    float64Tag = '[object Float64Array]',
    int8Tag = '[object Int8Array]',
    int16Tag = '[object Int16Array]',
    int32Tag = '[object Int32Array]',
    uint8Tag = '[object Uint8Array]',
    uint8ClampedTag = '[object Uint8ClampedArray]',
    uint16Tag = '[object Uint16Array]',
    uint32Tag = '[object Uint32Array]';

/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;

/**
 * The base implementation of `_.isTypedArray` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
 */
function baseIsTypedArray(value) {
  return isObjectLike(value) &&
    isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}

module.exports = baseIsTypedArray;


/***/ }),

/***/ "7839":
/***/ (function(module, exports) {

// IE8- don't enum bug keys
module.exports = [
  'constructor',
  'hasOwnProperty',
  'isPrototypeOf',
  'propertyIsEnumerable',
  'toLocaleString',
  'toString',
  'valueOf'
];


/***/ }),

/***/ "785a":
/***/ (function(module, exports, __webpack_require__) {

// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
var documentCreateElement = __webpack_require__("cc12");

var classList = documentCreateElement('span').classList;
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;

module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;


/***/ }),

/***/ "79bc":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07"),
    root = __webpack_require__("2b3e");

/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');

module.exports = Map;


/***/ }),

/***/ "7a48":
/***/ (function(module, exports, __webpack_require__) {

var nativeCreate = __webpack_require__("6044");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Checks if a hash value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Hash
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
}

module.exports = hashHas;


/***/ }),

/***/ "7b0b":
/***/ (function(module, exports, __webpack_require__) {

var requireObjectCoercible = __webpack_require__("1d80");

// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
module.exports = function (argument) {
  return Object(requireObjectCoercible(argument));
};


/***/ }),

/***/ "7b83":
/***/ (function(module, exports, __webpack_require__) {

var mapCacheClear = __webpack_require__("7c64"),
    mapCacheDelete = __webpack_require__("93ed"),
    mapCacheGet = __webpack_require__("2478"),
    mapCacheHas = __webpack_require__("a524"),
    mapCacheSet = __webpack_require__("1fc8");

/**
 * Creates a map cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function MapCache(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;

module.exports = MapCache;


/***/ }),

/***/ "7b97":
/***/ (function(module, exports, __webpack_require__) {

var Stack = __webpack_require__("7e64"),
    equalArrays = __webpack_require__("a2be"),
    equalByTag = __webpack_require__("1c3c"),
    equalObjects = __webpack_require__("b1e5"),
    getTag = __webpack_require__("42a2"),
    isArray = __webpack_require__("6747"),
    isBuffer = __webpack_require__("0d24"),
    isTypedArray = __webpack_require__("73ac");

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;

/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
    arrayTag = '[object Array]',
    objectTag = '[object Object]';

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * A specialized version of `baseIsEqual` for arrays and objects which performs
 * deep comparisons and tracks traversed objects enabling objects with circular
 * references to be compared.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
 * @param {Function} customizer The function to customize comparisons.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray(object),
      othIsArr = isArray(other),
      objTag = objIsArr ? arrayTag : getTag(object),
      othTag = othIsArr ? arrayTag : getTag(other);

  objTag = objTag == argsTag ? objectTag : objTag;
  othTag = othTag == argsTag ? objectTag : othTag;

  var objIsObj = objTag == objectTag,
      othIsObj = othTag == objectTag,
      isSameTag = objTag == othTag;

  if (isSameTag && isBuffer(object)) {
    if (!isBuffer(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack);
    return (objIsArr || isTypedArray(object))
      ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
      : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
    var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
        othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');

    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object.value() : object,
          othUnwrapped = othIsWrapped ? other.value() : other;

      stack || (stack = new Stack);
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack);
  return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}

module.exports = baseIsEqualDeep;


/***/ }),

/***/ "7c64":
/***/ (function(module, exports, __webpack_require__) {

var Hash = __webpack_require__("e24b"),
    ListCache = __webpack_require__("5e2e"),
    Map = __webpack_require__("79bc");

/**
 * Removes all key-value entries from the map.
 *
 * @private
 * @name clear
 * @memberOf MapCache
 */
function mapCacheClear() {
  this.size = 0;
  this.__data__ = {
    'hash': new Hash,
    'map': new (Map || ListCache),
    'string': new Hash
  };
}

module.exports = mapCacheClear;


/***/ }),

/***/ "7d1f":
/***/ (function(module, exports, __webpack_require__) {

var arrayPush = __webpack_require__("087d"),
    isArray = __webpack_require__("6747");

/**
 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
 * symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Function} keysFunc The function to get the keys of `object`.
 * @param {Function} symbolsFunc The function to get the symbols of `object`.
 * @returns {Array} Returns the array of property names and symbols.
 */
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  var result = keysFunc(object);
  return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}

module.exports = baseGetAllKeys;


/***/ }),

/***/ "7e64":
/***/ (function(module, exports, __webpack_require__) {

var ListCache = __webpack_require__("5e2e"),
    stackClear = __webpack_require__("efb6"),
    stackDelete = __webpack_require__("2fcc"),
    stackGet = __webpack_require__("802a"),
    stackHas = __webpack_require__("55a3"),
    stackSet = __webpack_require__("d02c");

/**
 * Creates a stack cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function Stack(entries) {
  var data = this.__data__ = new ListCache(entries);
  this.size = data.size;
}

// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;

module.exports = Stack;


/***/ }),

/***/ "7ed2":
/***/ (function(module, exports) {

/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';

/**
 * Adds `value` to the array cache.
 *
 * @private
 * @name add
 * @memberOf SetCache
 * @alias push
 * @param {*} value The value to cache.
 * @returns {Object} Returns the cache instance.
 */
function setCacheAdd(value) {
  this.__data__.set(value, HASH_UNDEFINED);
  return this;
}

module.exports = setCacheAdd;


/***/ }),

/***/ "7f9a":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var inspectSource = __webpack_require__("8925");

var WeakMap = global.WeakMap;

module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));


/***/ }),

/***/ "802a":
/***/ (function(module, exports) {

/**
 * Gets the stack value for `key`.
 *
 * @private
 * @name get
 * @memberOf Stack
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function stackGet(key) {
  return this.__data__.get(key);
}

module.exports = stackGet;


/***/ }),

/***/ "825a":
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__("861d");

// `Assert: Type(argument) is Object`
module.exports = function (argument) {
  if (isObject(argument)) return argument;
  throw TypeError(String(argument) + ' is not an object');
};


/***/ }),

/***/ "83ab":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");

// Detect IE8's incomplete defineProperty implementation
module.exports = !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});


/***/ }),

/***/ "861d":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");

module.exports = function (it) {
  return typeof it === 'object' ? it !== null : isCallable(it);
};


/***/ }),

/***/ "8875":
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill

// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505

(function (root, factory) {
  if (true) {
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __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 {}
}(typeof self !== 'undefined' ? self : this, function () {
  function getCurrentScript () {
    var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
    // for chrome
    if (!descriptor && 'currentScript' in document && document.currentScript) {
      return document.currentScript
    }

    // for other browsers with native support for currentScript
    if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
      return document.currentScript
    }
  
    // IE 8-10 support script readyState
    // IE 11+ & Firefox support stack trace
    try {
      throw new Error();
    }
    catch (err) {
      // Find the second match for the "at" string to get file src url from stack.
      var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
        ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
        stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
        scriptLocation = (stackDetails && stackDetails[1]) || false,
        line = (stackDetails && stackDetails[2]) || false,
        currentLocation = document.location.href.replace(document.location.hash, ''),
        pageSource,
        inlineScriptSourceRegExp,
        inlineScriptSource,
        scripts = document.getElementsByTagName('script'); // Live NodeList collection
  
      if (scriptLocation === currentLocation) {
        pageSource = document.documentElement.outerHTML;
        inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
        inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
      }
  
      for (var i = 0; i < scripts.length; i++) {
        // If ready state is interactive, return the script tag
        if (scripts[i].readyState === 'interactive') {
          return scripts[i];
        }
  
        // If src matches, return the script tag
        if (scripts[i].src === scriptLocation) {
          return scripts[i];
        }
  
        // If inline source matches, return the script tag
        if (
          scriptLocation === currentLocation &&
          scripts[i].innerHTML &&
          scripts[i].innerHTML.trim() === inlineScriptSource
        ) {
          return scripts[i];
        }
      }
  
      // If no match, return null
      return null;
    }
  };

  return getCurrentScript
}));


/***/ }),

/***/ "8925":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var store = __webpack_require__("c6cd");

var functionToString = Function.toString;

// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
if (!isCallable(store.inspectSource)) {
  store.inspectSource = function (it) {
    return functionToString.call(it);
  };
}

module.exports = store.inspectSource;


/***/ }),

/***/ "90e3":
/***/ (function(module, exports) {

var id = 0;
var postfix = Math.random();

module.exports = function (key) {
  return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};


/***/ }),

/***/ "9112":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var definePropertyModule = __webpack_require__("9bf2");
var createPropertyDescriptor = __webpack_require__("5c6c");

module.exports = DESCRIPTORS ? function (object, key, value) {
  return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};


/***/ }),

/***/ "91e9":
/***/ (function(module, exports) {

/**
 * Creates a unary function that invokes `func` with its argument transformed.
 *
 * @private
 * @param {Function} func The function to wrap.
 * @param {Function} transform The argument transform.
 * @returns {Function} Returns the new function.
 */
function overArg(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}

module.exports = overArg;


/***/ }),

/***/ "93ed":
/***/ (function(module, exports, __webpack_require__) {

var getMapData = __webpack_require__("4245");

/**
 * Removes `key` and its value from the map.
 *
 * @private
 * @name delete
 * @memberOf MapCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function mapCacheDelete(key) {
  var result = getMapData(this, key)['delete'](key);
  this.size -= result ? 1 : 0;
  return result;
}

module.exports = mapCacheDelete;


/***/ }),

/***/ "94ca":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var isCallable = __webpack_require__("1626");

var replacement = /#|\.prototype\./;

var isForced = function (feature, detection) {
  var value = data[normalize(feature)];
  return value == POLYFILL ? true
    : value == NATIVE ? false
    : isCallable(detection) ? fails(detection)
    : !!detection;
};

var normalize = isForced.normalize = function (string) {
  return String(string).replace(replacement, '.').toLowerCase();
};

var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';

module.exports = isForced;


/***/ }),

/***/ "9520":
/***/ (function(module, exports, __webpack_require__) {

var baseGetTag = __webpack_require__("3729"),
    isObject = __webpack_require__("1a8c");

/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
    funcTag = '[object Function]',
    genTag = '[object GeneratorFunction]',
    proxyTag = '[object Proxy]';

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @example
 *
 * _.isFunction(_);
 * // => true
 *
 * _.isFunction(/abc/);
 * // => false
 */
function isFunction(value) {
  if (!isObject(value)) {
    return false;
  }
  // The use of `Object#toString` avoids issues with the `typeof` operator
  // in Safari 9 which returns 'object' for typed arrays and other constructors.
  var tag = baseGetTag(value);
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}

module.exports = isFunction;


/***/ }),

/***/ "9638":
/***/ (function(module, exports) {

/**
 * Performs a
 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * comparison between two values to determine if they are equivalent.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * var object = { 'a': 1 };
 * var other = { 'a': 1 };
 *
 * _.eq(object, object);
 * // => true
 *
 * _.eq(object, other);
 * // => false
 *
 * _.eq('a', 'a');
 * // => true
 *
 * _.eq('a', Object('a'));
 * // => false
 *
 * _.eq(NaN, NaN);
 * // => true
 */
function eq(value, other) {
  return value === other || (value !== value && other !== other);
}

module.exports = eq;


/***/ }),

/***/ "96cf":
/***/ (function(module, exports, __webpack_require__) {

/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var runtime = (function (exports) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;
  var undefined; // More compressible than void 0.
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

  function define(obj, key, value) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
    return obj[key];
  }
  try {
    // IE 8 has a broken Object.defineProperty that only works on DOM objects.
    define({}, "");
  } catch (err) {
    define = function(obj, key, value) {
      return obj[key] = value;
    };
  }

  function wrap(innerFn, outerFn, self, tryLocsList) {
    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
    var generator = Object.create(protoGenerator.prototype);
    var context = new Context(tryLocsList || []);

    // The ._invoke method unifies the implementations of the .next,
    // .throw, and .return methods.
    generator._invoke = makeInvokeMethod(innerFn, self, context);

    return generator;
  }
  exports.wrap = wrap;

  // Try/catch helper to minimize deoptimizations. Returns a completion
  // record like context.tryEntries[i].completion. This interface could
  // have been (and was previously) designed to take a closure to be
  // invoked without arguments, but in all the cases we care about we
  // already have an existing method we want to call, so there's no need
  // to create a new function object. We can even get away with assuming
  // the method takes exactly one argument, since that happens to be true
  // in every case, so we don't have to touch the arguments object. The
  // only additional allocation required is the completion record, which
  // has a stable shape and so hopefully should be cheap to allocate.
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }

  var GenStateSuspendedStart = "suspendedStart";
  var GenStateSuspendedYield = "suspendedYield";
  var GenStateExecuting = "executing";
  var GenStateCompleted = "completed";

  // Returning this object from the innerFn has the same effect as
  // breaking out of the dispatch switch statement.
  var ContinueSentinel = {};

  // Dummy constructor functions that we use as the .constructor and
  // .constructor.prototype properties for functions that return Generator
  // objects. For full spec compliance, you may wish to configure your
  // minifier not to mangle the names of these two functions.
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}

  // This is a polyfill for %IteratorPrototype% for environments that
  // don't natively support it.
  var IteratorPrototype = {};
  define(IteratorPrototype, iteratorSymbol, function () {
    return this;
  });

  var getProto = Object.getPrototypeOf;
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  if (NativeIteratorPrototype &&
      NativeIteratorPrototype !== Op &&
      hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
    // This environment has a native %IteratorPrototype%; use it instead
    // of the polyfill.
    IteratorPrototype = NativeIteratorPrototype;
  }

  var Gp = GeneratorFunctionPrototype.prototype =
    Generator.prototype = Object.create(IteratorPrototype);
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
  define(Gp, "constructor", GeneratorFunctionPrototype);
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  GeneratorFunction.displayName = define(
    GeneratorFunctionPrototype,
    toStringTagSymbol,
    "GeneratorFunction"
  );

  // Helper for defining the .next, .throw, and .return methods of the
  // Iterator interface in terms of a single ._invoke method.
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function(method) {
      define(prototype, method, function(arg) {
        return this._invoke(method, arg);
      });
    });
  }

  exports.isGeneratorFunction = function(genFun) {
    var ctor = typeof genFun === "function" && genFun.constructor;
    return ctor
      ? ctor === GeneratorFunction ||
        // For the native GeneratorFunction constructor, the best we can
        // do is to check its .name property.
        (ctor.displayName || ctor.name) === "GeneratorFunction"
      : false;
  };

  exports.mark = function(genFun) {
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
    } else {
      genFun.__proto__ = GeneratorFunctionPrototype;
      define(genFun, toStringTagSymbol, "GeneratorFunction");
    }
    genFun.prototype = Object.create(Gp);
    return genFun;
  };

  // Within the body of any async function, `await x` is transformed to
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
  // meant to be awaited.
  exports.awrap = function(arg) {
    return { __await: arg };
  };

  function AsyncIterator(generator, PromiseImpl) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
      } else {
        var result = record.arg;
        var value = result.value;
        if (value &&
            typeof value === "object" &&
            hasOwn.call(value, "__await")) {
          return PromiseImpl.resolve(value.__await).then(function(value) {
            invoke("next", value, resolve, reject);
          }, function(err) {
            invoke("throw", err, resolve, reject);
          });
        }

        return PromiseImpl.resolve(value).then(function(unwrapped) {
          // When a yielded Promise is resolved, its final value becomes
          // the .value of the Promise<{value,done}> result for the
          // current iteration.
          result.value = unwrapped;
          resolve(result);
        }, function(error) {
          // If a rejected Promise was yielded, throw the rejection back
          // into the async generator function so it can be handled there.
          return invoke("throw", error, resolve, reject);
        });
      }
    }

    var previousPromise;

    function enqueue(method, arg) {
      function callInvokeWithMethodAndArg() {
        return new PromiseImpl(function(resolve, reject) {
          invoke(method, arg, resolve, reject);
        });
      }

      return previousPromise =
        // If enqueue has been called before, then we want to wait until
        // all previous Promises have been resolved before calling invoke,
        // so that results are always delivered in the correct order. If
        // enqueue has not been called before, then it is important to
        // call invoke immediately, without waiting on a callback to fire,
        // so that the async generator function has the opportunity to do
        // any necessary setup in a predictable way. This predictability
        // is why the Promise constructor synchronously invokes its
        // executor callback, and why async functions synchronously
        // execute code before the first await. Since we implement simple
        // async functions in terms of async generators, it is especially
        // important to get this right, even though it requires care.
        previousPromise ? previousPromise.then(
          callInvokeWithMethodAndArg,
          // Avoid propagating failures to Promises returned by later
          // invocations of the iterator.
          callInvokeWithMethodAndArg
        ) : callInvokeWithMethodAndArg();
    }

    // Define the unified helper method that is used to implement .next,
    // .throw, and .return (see defineIteratorMethods).
    this._invoke = enqueue;
  }

  defineIteratorMethods(AsyncIterator.prototype);
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
    return this;
  });
  exports.AsyncIterator = AsyncIterator;

  // Note that simple async functions are implemented on top of
  // AsyncIterator objects; they just return a Promise for the value of
  // the final result produced by the iterator.
  exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
    if (PromiseImpl === void 0) PromiseImpl = Promise;

    var iter = new AsyncIterator(
      wrap(innerFn, outerFn, self, tryLocsList),
      PromiseImpl
    );

    return exports.isGeneratorFunction(outerFn)
      ? iter // If outerFn is a generator, return the full iterator.
      : iter.next().then(function(result) {
          return result.done ? result.value : iter.next();
        });
  };

  function makeInvokeMethod(innerFn, self, context) {
    var state = GenStateSuspendedStart;

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

      if (state === GenStateCompleted) {
        if (method === "throw") {
          throw arg;
        }

        // Be forgiving, per 25.3.3.3.3 of the spec:
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
        return doneResult();
      }

      context.method = method;
      context.arg = arg;

      while (true) {
        var delegate = context.delegate;
        if (delegate) {
          var delegateResult = maybeInvokeDelegate(delegate, context);
          if (delegateResult) {
            if (delegateResult === ContinueSentinel) continue;
            return delegateResult;
          }
        }

        if (context.method === "next") {
          // Setting context._sent for legacy support of Babel's
          // function.sent implementation.
          context.sent = context._sent = context.arg;

        } else if (context.method === "throw") {
          if (state === GenStateSuspendedStart) {
            state = GenStateCompleted;
            throw context.arg;
          }

          context.dispatchException(context.arg);

        } else if (context.method === "return") {
          context.abrupt("return", context.arg);
        }

        state = GenStateExecuting;

        var record = tryCatch(innerFn, self, context);
        if (record.type === "normal") {
          // If an exception is thrown from innerFn, we leave state ===
          // GenStateExecuting and loop back for another invocation.
          state = context.done
            ? GenStateCompleted
            : GenStateSuspendedYield;

          if (record.arg === ContinueSentinel) {
            continue;
          }

          return {
            value: record.arg,
            done: context.done
          };

        } else if (record.type === "throw") {
          state = GenStateCompleted;
          // Dispatch the exception by looping back around to the
          // context.dispatchException(context.arg) call above.
          context.method = "throw";
          context.arg = record.arg;
        }
      }
    };
  }

  // Call delegate.iterator[context.method](context.arg) and handle the
  // result, either by returning a { value, done } result from the
  // delegate iterator, or by modifying context.method and context.arg,
  // setting context.delegate to null, and returning the ContinueSentinel.
  function maybeInvokeDelegate(delegate, context) {
    var method = delegate.iterator[context.method];
    if (method === undefined) {
      // A .throw or .return when the delegate iterator has no .throw
      // method always terminates the yield* loop.
      context.delegate = null;

      if (context.method === "throw") {
        // Note: ["return"] must be used for ES3 parsing compatibility.
        if (delegate.iterator["return"]) {
          // If the delegate iterator has a return method, give it a
          // chance to clean up.
          context.method = "return";
          context.arg = undefined;
          maybeInvokeDelegate(delegate, context);

          if (context.method === "throw") {
            // If maybeInvokeDelegate(context) changed context.method from
            // "return" to "throw", let that override the TypeError below.
            return ContinueSentinel;
          }
        }

        context.method = "throw";
        context.arg = new TypeError(
          "The iterator does not provide a 'throw' method");
      }

      return ContinueSentinel;
    }

    var record = tryCatch(method, delegate.iterator, context.arg);

    if (record.type === "throw") {
      context.method = "throw";
      context.arg = record.arg;
      context.delegate = null;
      return ContinueSentinel;
    }

    var info = record.arg;

    if (! info) {
      context.method = "throw";
      context.arg = new TypeError("iterator result is not an object");
      context.delegate = null;
      return ContinueSentinel;
    }

    if (info.done) {
      // Assign the result of the finished delegate to the temporary
      // variable specified by delegate.resultName (see delegateYield).
      context[delegate.resultName] = info.value;

      // Resume execution at the desired location (see delegateYield).
      context.next = delegate.nextLoc;

      // If context.method was "throw" but the delegate handled the
      // exception, let the outer generator proceed normally. If
      // context.method was "next", forget context.arg since it has been
      // "consumed" by the delegate iterator. If context.method was
      // "return", allow the original .return call to continue in the
      // outer generator.
      if (context.method !== "return") {
        context.method = "next";
        context.arg = undefined;
      }

    } else {
      // Re-yield the result returned by the delegate method.
      return info;
    }

    // The delegate iterator is finished, so forget it and continue with
    // the outer generator.
    context.delegate = null;
    return ContinueSentinel;
  }

  // Define Generator.prototype.{next,throw,return} in terms of the
  // unified ._invoke helper method.
  defineIteratorMethods(Gp);

  define(Gp, toStringTagSymbol, "Generator");

  // A Generator should always return itself as the iterator object when the
  // @@iterator function is called on it. Some browsers' implementations of the
  // iterator prototype chain incorrectly implement this, causing the Generator
  // object to not be returned from this call. This ensures that doesn't happen.
  // See https://github.com/facebook/regenerator/issues/274 for more details.
  define(Gp, iteratorSymbol, function() {
    return this;
  });

  define(Gp, "toString", function() {
    return "[object Generator]";
  });

  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };

    if (1 in locs) {
      entry.catchLoc = locs[1];
    }

    if (2 in locs) {
      entry.finallyLoc = locs[2];
      entry.afterLoc = locs[3];
    }

    this.tryEntries.push(entry);
  }

  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal";
    delete record.arg;
    entry.completion = record;
  }

  function Context(tryLocsList) {
    // The root entry object (effectively a try statement without a catch
    // or a finally block) gives us a place to store values thrown from
    // locations where there is no enclosing try statement.
    this.tryEntries = [{ tryLoc: "root" }];
    tryLocsList.forEach(pushTryEntry, this);
    this.reset(true);
  }

  exports.keys = function(object) {
    var keys = [];
    for (var key in object) {
      keys.push(key);
    }
    keys.reverse();

    // Rather than returning an object with a next method, we keep
    // things simple and return the next function itself.
    return function next() {
      while (keys.length) {
        var key = keys.pop();
        if (key in object) {
          next.value = key;
          next.done = false;
          return next;
        }
      }

      // To avoid creating an additional object, we just hang the .value
      // and .done properties off the next function object itself. This
      // also ensures that the minifier will not anonymize the function.
      next.done = true;
      return next;
    };
  };

  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) {
        return iteratorMethod.call(iterable);
      }

      if (typeof iterable.next === "function") {
        return iterable;
      }

      if (!isNaN(iterable.length)) {
        var i = -1, next = function next() {
          while (++i < iterable.length) {
            if (hasOwn.call(iterable, i)) {
              next.value = iterable[i];
              next.done = false;
              return next;
            }
          }

          next.value = undefined;
          next.done = true;

          return next;
        };

        return next.next = next;
      }
    }

    // Return an iterator with no values.
    return { next: doneResult };
  }
  exports.values = values;

  function doneResult() {
    return { value: undefined, done: true };
  }

  Context.prototype = {
    constructor: Context,

    reset: function(skipTempReset) {
      this.prev = 0;
      this.next = 0;
      // Resetting context._sent for legacy support of Babel's
      // function.sent implementation.
      this.sent = this._sent = undefined;
      this.done = false;
      this.delegate = null;

      this.method = "next";
      this.arg = undefined;

      this.tryEntries.forEach(resetTryEntry);

      if (!skipTempReset) {
        for (var name in this) {
          // Not sure about the optimal order of these conditions:
          if (name.charAt(0) === "t" &&
              hasOwn.call(this, name) &&
              !isNaN(+name.slice(1))) {
            this[name] = undefined;
          }
        }
      }
    },

    stop: function() {
      this.done = true;

      var rootEntry = this.tryEntries[0];
      var rootRecord = rootEntry.completion;
      if (rootRecord.type === "throw") {
        throw rootRecord.arg;
      }

      return this.rval;
    },

    dispatchException: function(exception) {
      if (this.done) {
        throw exception;
      }

      var context = this;
      function handle(loc, caught) {
        record.type = "throw";
        record.arg = exception;
        context.next = loc;

        if (caught) {
          // If the dispatched exception was caught by a catch block,
          // then let that catch block handle the exception normally.
          context.method = "next";
          context.arg = undefined;
        }

        return !! caught;
      }

      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        var record = entry.completion;

        if (entry.tryLoc === "root") {
          // Exception thrown outside of any try block that could handle
          // it, so set the completion value of the entire function to
          // throw the exception.
          return handle("end");
        }

        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc");
          var hasFinally = hasOwn.call(entry, "finallyLoc");

          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            } else if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            }

          } else if (hasFinally) {
            if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else {
            throw new Error("try statement without catch or finally");
          }
        }
      }
    },

    abrupt: function(type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev &&
            hasOwn.call(entry, "finallyLoc") &&
            this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }

      if (finallyEntry &&
          (type === "break" ||
           type === "continue") &&
          finallyEntry.tryLoc <= arg &&
          arg <= finallyEntry.finallyLoc) {
        // Ignore the finally entry if control is not jumping to a
        // location outside the try/catch block.
        finallyEntry = null;
      }

      var record = finallyEntry ? finallyEntry.completion : {};
      record.type = type;
      record.arg = arg;

      if (finallyEntry) {
        this.method = "next";
        this.next = finallyEntry.finallyLoc;
        return ContinueSentinel;
      }

      return this.complete(record);
    },

    complete: function(record, afterLoc) {
      if (record.type === "throw") {
        throw record.arg;
      }

      if (record.type === "break" ||
          record.type === "continue") {
        this.next = record.arg;
      } else if (record.type === "return") {
        this.rval = this.arg = record.arg;
        this.method = "return";
        this.next = "end";
      } else if (record.type === "normal" && afterLoc) {
        this.next = afterLoc;
      }

      return ContinueSentinel;
    },

    finish: function(finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) {
          this.complete(entry.completion, entry.afterLoc);
          resetTryEntry(entry);
          return ContinueSentinel;
        }
      }
    },

    "catch": function(tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if (record.type === "throw") {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }

      // The context.catch method must only be called with a location
      // argument that corresponds to a known catch block.
      throw new Error("illegal catch attempt");
    },

    delegateYield: function(iterable, resultName, nextLoc) {
      this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      };

      if (this.method === "next") {
        // Deliberately forget the last sent value so that we don't
        // accidentally pass it on to the delegate.
        this.arg = undefined;
      }

      return ContinueSentinel;
    }
  };

  // Regardless of whether this script is executing as a CommonJS module
  // or not, return the runtime object so that we can declare the variable
  // regeneratorRuntime in the outer scope, which allows this module to be
  // injected easily by `bin/regenerator --include-runtime script.js`.
  return exports;

}(
  // If this script is executing as a CommonJS module, use module.exports
  // as the regeneratorRuntime namespace. Otherwise create a new empty
  // object. Either way, the resulting object will be used to initialize
  // the regeneratorRuntime variable at the top of this file.
   true ? module.exports : undefined
));

try {
  regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
  // This module should not be running in strict mode, so the above
  // assignment should always work unless something is misconfigured. Just
  // in case runtime.js accidentally runs in strict mode, in modern engines
  // we can explicitly access globalThis. In older engines we can escape
  // strict mode using a global Function call. This could conceivably fail
  // if a Content Security Policy forbids using Function, but in that case
  // the proper solution is to fix the accidental strict mode problem. If
  // you've misconfigured your bundler to force strict mode and applied a
  // CSP to forbid Function, and you're not willing to fix either of those
  // problems, please detail your unique predicament in a GitHub issue.
  if (typeof globalThis === "object") {
    globalThis.regeneratorRuntime = runtime;
  } else {
    Function("r", "regeneratorRuntime = r")(runtime);
  }
}


/***/ }),

/***/ "99d3":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__("585a");

/** Detect free variable `exports`. */
var freeExports =  true && exports && !exports.nodeType && exports;

/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;

/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;

/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;

/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
  try {
    // Use `util.types` for Node.js 10+.
    var types = freeModule && freeModule.require && freeModule.require('util').types;

    if (types) {
      return types;
    }

    // Legacy `process.binding('util')` for Node.js < 10.
    return freeProcess && freeProcess.binding && freeProcess.binding('util');
  } catch (e) {}
}());

module.exports = nodeUtil;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("62e4")(module)))

/***/ }),

/***/ "9a1f":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");
var anObject = __webpack_require__("825a");
var getIteratorMethod = __webpack_require__("35a1");

module.exports = function (argument, usingIterator) {
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  if (aCallable(iteratorMethod)) return anObject(iteratorMethod.call(argument));
  throw TypeError(String(argument) + ' is not iterable');
};


/***/ }),

/***/ "9bf2":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");
var anObject = __webpack_require__("825a");
var toPropertyKey = __webpack_require__("a04b");

// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;

// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPropertyKey(P);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return $defineProperty(O, P, Attributes);
  } catch (error) { /* empty */ }
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};


/***/ }),

/***/ "9e69":
/***/ (function(module, exports, __webpack_require__) {

var root = __webpack_require__("2b3e");

/** Built-in value references. */
var Symbol = root.Symbol;

module.exports = Symbol;


/***/ }),

/***/ "a04b":
/***/ (function(module, exports, __webpack_require__) {

var toPrimitive = __webpack_require__("c04e");
var isSymbol = __webpack_require__("d9b5");

// `ToPropertyKey` abstract operation
// https://tc39.es/ecma262/#sec-topropertykey
module.exports = function (argument) {
  var key = toPrimitive(argument, 'string');
  return isSymbol(key) ? key : String(key);
};


/***/ }),

/***/ "a2be":
/***/ (function(module, exports, __webpack_require__) {

var SetCache = __webpack_require__("d612"),
    arraySome = __webpack_require__("4284"),
    cacheHas = __webpack_require__("c584");

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
    COMPARE_UNORDERED_FLAG = 2;

/**
 * A specialized version of `baseIsEqualDeep` for arrays with support for
 * partial deep comparisons.
 *
 * @private
 * @param {Array} array The array to compare.
 * @param {Array} other The other array to compare.
 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
 * @param {Function} customizer The function to customize comparisons.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Object} stack Tracks traversed `array` and `other` objects.
 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
 */
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
      arrLength = array.length,
      othLength = other.length;

  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  // Check that cyclic values are equal.
  var arrStacked = stack.get(array);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array;
  }
  var index = -1,
      result = true,
      seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;

  stack.set(array, other);
  stack.set(other, array);

  // Ignore non-index properties.
  while (++index < arrLength) {
    var arrValue = array[index],
        othValue = other[index];

    if (customizer) {
      var compared = isPartial
        ? customizer(othValue, arrValue, index, other, array, stack)
        : customizer(arrValue, othValue, index, array, other, stack);
    }
    if (compared !== undefined) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    // Recursively compare arrays (susceptible to call stack limits).
    if (seen) {
      if (!arraySome(other, function(othValue, othIndex) {
            if (!cacheHas(seen, othIndex) &&
                (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
              return seen.push(othIndex);
            }
          })) {
        result = false;
        break;
      }
    } else if (!(
          arrValue === othValue ||
            equalFunc(arrValue, othValue, bitmask, customizer, stack)
        )) {
      result = false;
      break;
    }
  }
  stack['delete'](array);
  stack['delete'](other);
  return result;
}

module.exports = equalArrays;


/***/ }),

/***/ "a4b4":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

module.exports = /web0s(?!.*chrome)/i.test(userAgent);


/***/ }),

/***/ "a524":
/***/ (function(module, exports, __webpack_require__) {

var getMapData = __webpack_require__("4245");

/**
 * Checks if a map value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf MapCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function mapCacheHas(key) {
  return getMapData(this, key).has(key);
}

module.exports = mapCacheHas;


/***/ }),

/***/ "a640":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fails = __webpack_require__("d039");

module.exports = function (METHOD_NAME, argument) {
  var method = [][METHOD_NAME];
  return !!method && fails(function () {
    // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
    method.call(null, argument || function () { throw 1; }, 1);
  });
};


/***/ }),

/***/ "a994":
/***/ (function(module, exports, __webpack_require__) {

var baseGetAllKeys = __webpack_require__("7d1f"),
    getSymbols = __webpack_require__("32f4"),
    keys = __webpack_require__("ec69");

/**
 * Creates an array of own enumerable property names and symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names and symbols.
 */
function getAllKeys(object) {
  return baseGetAllKeys(object, keys, getSymbols);
}

module.exports = getAllKeys;


/***/ }),

/***/ "ab5c":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//     Backbone.js 1.2.3

//     (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

(function(factory) {

  // Establish the root object, `window` (`self`) in the browser, or `global` on the server.
  // We use `self` instead of `window` for `WebWorker` support.
  var root = (typeof self == 'object' && self.self == self && self) ||
            (typeof global == 'object' && global.global == global && global);

  // Set up Backbone appropriately for the environment. Start with AMD.
  if (true) {
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__("c46f"), __webpack_require__("1157"), exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function(_, $, exports) {
      // Export global even in AMD case in case this script is loaded with
      // others that may still expect a global Backbone.
      root.Backbone = factory(root, exports, _, $);
    }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));

  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
  } else { var _, $; }

}(function(root, Backbone, _, $) {

  // Initial Setup
  // -------------

  // Save the previous value of the `Backbone` variable, so that it can be
  // restored later on, if `noConflict` is used.
  var previousBackbone = root.Backbone;

  // Create a local reference to a common array method we'll want to use later.
  var slice = Array.prototype.slice;

  // Current version of the library. Keep in sync with `package.json`.
  Backbone.VERSION = '1.2.3';

  // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
  // the `$` variable.
  Backbone.$ = $;

  // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
  // to its previous owner. Returns a reference to this Backbone object.
  Backbone.noConflict = function() {
    root.Backbone = previousBackbone;
    return this;
  };

  // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
  // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
  // set a `X-Http-Method-Override` header.
  Backbone.emulateHTTP = false;

  // Turn on `emulateJSON` to support legacy servers that can't deal with direct
  // `application/json` requests ... this will encode the body as
  // `application/x-www-form-urlencoded` instead and will send the model in a
  // form param named `model`.
  Backbone.emulateJSON = false;

  // Proxy Backbone class methods to Underscore functions, wrapping the model's
  // `attributes` object or collection's `models` array behind the scenes.
  //
  // collection.filter(function(model) { return model.get('age') > 10 });
  // collection.each(this.addView);
  //
  // `Function#apply` can be slow so we use the method's arg count, if we know it.
  var addMethod = function(length, method, attribute) {
    switch (length) {
      case 1: return function() {
        return _[method](this[attribute]);
      };
      case 2: return function(value) {
        return _[method](this[attribute], value);
      };
      case 3: return function(iteratee, context) {
        return _[method](this[attribute], cb(iteratee, this), context);
      };
      case 4: return function(iteratee, defaultVal, context) {
        return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
      };
      default: return function() {
        var args = slice.call(arguments);
        args.unshift(this[attribute]);
        return _[method].apply(_, args);
      };
    }
  };
  var addUnderscoreMethods = function(Class, methods, attribute) {
    _.each(methods, function(length, method) {
      if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
    });
  };

  // Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
  var cb = function(iteratee, instance) {
    if (_.isFunction(iteratee)) return iteratee;
    if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
    if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
    return iteratee;
  };
  var modelMatcher = function(attrs) {
    var matcher = _.matches(attrs);
    return function(model) {
      return matcher(model.attributes);
    };
  };

  // Backbone.Events
  // ---------------

  // A module that can be mixed in to *any object* in order to provide it with
  // a custom event channel. You may bind a callback to an event with `on` or
  // remove with `off`; `trigger`-ing an event fires all callbacks in
  // succession.
  //
  //     var object = {};
  //     _.extend(object, Backbone.Events);
  //     object.on('expand', function(){ alert('expanded'); });
  //     object.trigger('expand');
  //
  var Events = Backbone.Events = {};

  // Regular expression used to split event strings.
  var eventSplitter = /\s+/;

  // Iterates over the standard `event, callback` (as well as the fancy multiple
  // space-separated events `"change blur", callback` and jQuery-style event
  // maps `{event: callback}`).
  var eventsApi = function(iteratee, events, name, callback, opts) {
    var i = 0, names;
    if (name && typeof name === 'object') {
      // Handle event maps.
      if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
      for (names = _.keys(name); i < names.length ; i++) {
        events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
      }
    } else if (name && eventSplitter.test(name)) {
      // Handle space separated event names by delegating them individually.
      for (names = name.split(eventSplitter); i < names.length; i++) {
        events = iteratee(events, names[i], callback, opts);
      }
    } else {
      // Finally, standard events.
      events = iteratee(events, name, callback, opts);
    }
    return events;
  };

  // Bind an event to a `callback` function. Passing `"all"` will bind
  // the callback to all events fired.
  Events.on = function(name, callback, context) {
    return internalOn(this, name, callback, context);
  };

  // Guard the `listening` argument from the public API.
  var internalOn = function(obj, name, callback, context, listening) {
    obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
        context: context,
        ctx: obj,
        listening: listening
    });

    if (listening) {
      var listeners = obj._listeners || (obj._listeners = {});
      listeners[listening.id] = listening;
    }

    return obj;
  };

  // Inversion-of-control versions of `on`. Tell *this* object to listen to
  // an event in another object... keeping track of what it's listening to
  // for easier unbinding later.
  Events.listenTo =  function(obj, name, callback) {
    if (!obj) return this;
    var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
    var listeningTo = this._listeningTo || (this._listeningTo = {});
    var listening = listeningTo[id];

    // This object is not listening to any other events on `obj` yet.
    // Setup the necessary references to track the listening callbacks.
    if (!listening) {
      var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
      listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};
    }

    // Bind callbacks on obj, and keep track of them on listening.
    internalOn(obj, name, callback, this, listening);
    return this;
  };

  // The reducing API that adds a callback to the `events` object.
  var onApi = function(events, name, callback, options) {
    if (callback) {
      var handlers = events[name] || (events[name] = []);
      var context = options.context, ctx = options.ctx, listening = options.listening;
      if (listening) listening.count++;

      handlers.push({ callback: callback, context: context, ctx: context || ctx, listening: listening });
    }
    return events;
  };

  // Remove one or many callbacks. If `context` is null, removes all
  // callbacks with that function. If `callback` is null, removes all
  // callbacks for the event. If `name` is null, removes all bound
  // callbacks for all events.
  Events.off =  function(name, callback, context) {
    if (!this._events) return this;
    this._events = eventsApi(offApi, this._events, name, callback, {
        context: context,
        listeners: this._listeners
    });
    return this;
  };

  // Tell this object to stop listening to either specific events ... or
  // to every object it's currently listening to.
  Events.stopListening =  function(obj, name, callback) {
    var listeningTo = this._listeningTo;
    if (!listeningTo) return this;

    var ids = obj ? [obj._listenId] : _.keys(listeningTo);

    for (var i = 0; i < ids.length; i++) {
      var listening = listeningTo[ids[i]];

      // If listening doesn't exist, this object is not currently
      // listening to obj. Break out early.
      if (!listening) break;

      listening.obj.off(name, callback, this);
    }
    if (_.isEmpty(listeningTo)) this._listeningTo = void 0;

    return this;
  };

  // The reducing API that removes a callback from the `events` object.
  var offApi = function(events, name, callback, options) {
    if (!events) return;

    var i = 0, listening;
    var context = options.context, listeners = options.listeners;

    // Delete all events listeners and "drop" events.
    if (!name && !callback && !context) {
      var ids = _.keys(listeners);
      for (; i < ids.length; i++) {
        listening = listeners[ids[i]];
        delete listeners[listening.id];
        delete listening.listeningTo[listening.objId];
      }
      return;
    }

    var names = name ? [name] : _.keys(events);
    for (; i < names.length; i++) {
      name = names[i];
      var handlers = events[name];

      // Bail out if there are no events stored.
      if (!handlers) break;

      // Replace events if there are any remaining.  Otherwise, clean up.
      var remaining = [];
      for (var j = 0; j < handlers.length; j++) {
        var handler = handlers[j];
        if (
          callback && callback !== handler.callback &&
            callback !== handler.callback._callback ||
              context && context !== handler.context
        ) {
          remaining.push(handler);
        } else {
          listening = handler.listening;
          if (listening && --listening.count === 0) {
            delete listeners[listening.id];
            delete listening.listeningTo[listening.objId];
          }
        }
      }

      // Update tail event if the list has any events.  Otherwise, clean up.
      if (remaining.length) {
        events[name] = remaining;
      } else {
        delete events[name];
      }
    }
    if (_.size(events)) return events;
  };

  // Bind an event to only be triggered a single time. After the first time
  // the callback is invoked, its listener will be removed. If multiple events
  // are passed in using the space-separated syntax, the handler will fire
  // once for each event, not once for a combination of all events.
  Events.once =  function(name, callback, context) {
    // Map the event into a `{event: once}` object.
    var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
    return this.on(events, void 0, context);
  };

  // Inversion-of-control versions of `once`.
  Events.listenToOnce =  function(obj, name, callback) {
    // Map the event into a `{event: once}` object.
    var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
    return this.listenTo(obj, events);
  };

  // Reduces the event callbacks into a map of `{event: onceWrapper}`.
  // `offer` unbinds the `onceWrapper` after it has been called.
  var onceMap = function(map, name, callback, offer) {
    if (callback) {
      var once = map[name] = _.once(function() {
        offer(name, once);
        callback.apply(this, arguments);
      });
      once._callback = callback;
    }
    return map;
  };

  // Trigger one or many events, firing all bound callbacks. Callbacks are
  // passed the same arguments as `trigger` is, apart from the event name
  // (unless you're listening on `"all"`, which will cause your callback to
  // receive the true name of the event as the first argument).
  Events.trigger =  function(name) {
    if (!this._events) return this;

    var length = Math.max(0, arguments.length - 1);
    var args = Array(length);
    for (var i = 0; i < length; i++) args[i] = arguments[i + 1];

    eventsApi(triggerApi, this._events, name, void 0, args);
    return this;
  };

  // Handles triggering the appropriate event callbacks.
  var triggerApi = function(objEvents, name, cb, args) {
    if (objEvents) {
      var events = objEvents[name];
      var allEvents = objEvents.all;
      if (events && allEvents) allEvents = allEvents.slice();
      if (events) triggerEvents(events, args);
      if (allEvents) triggerEvents(allEvents, [name].concat(args));
    }
    return objEvents;
  };

  // A difficult-to-believe, but optimized internal dispatch function for
  // triggering events. Tries to keep the usual cases speedy (most internal
  // Backbone events have 3 arguments).
  var triggerEvents = function(events, args) {
    var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
    switch (args.length) {
      case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
      case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
      case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
      case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
      default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
    }
  };

  // Aliases for backwards compatibility.
  Events.bind   = Events.on;
  Events.unbind = Events.off;

  // Allow the `Backbone` object to serve as a global event bus, for folks who
  // want global "pubsub" in a convenient place.
  _.extend(Backbone, Events);

  // Backbone.Model
  // --------------

  // Backbone **Models** are the basic data object in the framework --
  // frequently representing a row in a table in a database on your server.
  // A discrete chunk of data and a bunch of useful, related methods for
  // performing computations and transformations on that data.

  // Create a new model with the specified attributes. A client id (`cid`)
  // is automatically generated and assigned for you.
  var Model = Backbone.Model = function(attributes, options) {
    var attrs = attributes || {};
    options || (options = {});
    this.cid = _.uniqueId(this.cidPrefix);
    this.attributes = {};
    if (options.collection) this.collection = options.collection;
    if (options.parse) attrs = this.parse(attrs, options) || {};
    attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
    this.set(attrs, options);
    this.changed = {};
    this.initialize.apply(this, arguments);
  };

  // Attach all inheritable methods to the Model prototype.
  _.extend(Model.prototype, Events, {

    // A hash of attributes whose current and previous value differ.
    changed: null,

    // The value returned during the last failed validation.
    validationError: null,

    // The default name for the JSON `id` attribute is `"id"`. MongoDB and
    // CouchDB users may want to set this to `"_id"`.
    idAttribute: 'id',

    // The prefix is used to create the client id which is used to identify models locally.
    // You may want to override this if you're experiencing name clashes with model ids.
    cidPrefix: 'c',

    // Initialize is an empty function by default. Override it with your own
    // initialization logic.
    initialize: function(){},

    // Return a copy of the model's `attributes` object.
    toJSON: function(options) {
      return _.clone(this.attributes);
    },

    // Proxy `Backbone.sync` by default -- but override this if you need
    // custom syncing semantics for *this* particular model.
    sync: function() {
      return Backbone.sync.apply(this, arguments);
    },

    // Get the value of an attribute.
    get: function(attr) {
      return this.attributes[attr];
    },

    // Get the HTML-escaped value of an attribute.
    escape: function(attr) {
      return _.escape(this.get(attr));
    },

    // Returns `true` if the attribute contains a value that is not null
    // or undefined.
    has: function(attr) {
      return this.get(attr) != null;
    },

    // Special-cased proxy to underscore's `_.matches` method.
    matches: function(attrs) {
      return !!_.iteratee(attrs, this)(this.attributes);
    },

    // Set a hash of model attributes on the object, firing `"change"`. This is
    // the core primitive operation of a model, updating the data and notifying
    // anyone who needs to know about the change in state. The heart of the beast.
    set: function(key, val, options) {
      if (key == null) return this;

      // Handle both `"key", value` and `{key: value}` -style arguments.
      var attrs;
      if (typeof key === 'object') {
        attrs = key;
        options = val;
      } else {
        (attrs = {})[key] = val;
      }

      options || (options = {});

      // Run validation.
      if (!this._validate(attrs, options)) return false;

      // Extract attributes and options.
      var unset      = options.unset;
      var silent     = options.silent;
      var changes    = [];
      var changing   = this._changing;
      this._changing = true;

      if (!changing) {
        this._previousAttributes = _.clone(this.attributes);
        this.changed = {};
      }

      var current = this.attributes;
      var changed = this.changed;
      var prev    = this._previousAttributes;

      // For each `set` attribute, update or delete the current value.
      for (var attr in attrs) {
        val = attrs[attr];
        if (!_.isEqual(current[attr], val)) changes.push(attr);
        if (!_.isEqual(prev[attr], val)) {
          changed[attr] = val;
        } else {
          delete changed[attr];
        }
        unset ? delete current[attr] : current[attr] = val;
      }

      // Update the `id`.
      this.id = this.get(this.idAttribute);

      // Trigger all relevant attribute changes.
      if (!silent) {
        if (changes.length) this._pending = options;
        for (var i = 0; i < changes.length; i++) {
          this.trigger('change:' + changes[i], this, current[changes[i]], options);
        }
      }

      // You might be wondering why there's a `while` loop here. Changes can
      // be recursively nested within `"change"` events.
      if (changing) return this;
      if (!silent) {
        while (this._pending) {
          options = this._pending;
          this._pending = false;
          this.trigger('change', this, options);
        }
      }
      this._pending = false;
      this._changing = false;
      return this;
    },

    // Remove an attribute from the model, firing `"change"`. `unset` is a noop
    // if the attribute doesn't exist.
    unset: function(attr, options) {
      return this.set(attr, void 0, _.extend({}, options, {unset: true}));
    },

    // Clear all attributes on the model, firing `"change"`.
    clear: function(options) {
      var attrs = {};
      for (var key in this.attributes) attrs[key] = void 0;
      return this.set(attrs, _.extend({}, options, {unset: true}));
    },

    // Determine if the model has changed since the last `"change"` event.
    // If you specify an attribute name, determine if that attribute has changed.
    hasChanged: function(attr) {
      if (attr == null) return !_.isEmpty(this.changed);
      return _.has(this.changed, attr);
    },

    // Return an object containing all the attributes that have changed, or
    // false if there are no changed attributes. Useful for determining what
    // parts of a view need to be updated and/or what attributes need to be
    // persisted to the server. Unset attributes will be set to undefined.
    // You can also pass an attributes object to diff against the model,
    // determining if there *would be* a change.
    changedAttributes: function(diff) {
      if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
      var old = this._changing ? this._previousAttributes : this.attributes;
      var changed = {};
      for (var attr in diff) {
        var val = diff[attr];
        if (_.isEqual(old[attr], val)) continue;
        changed[attr] = val;
      }
      return _.size(changed) ? changed : false;
    },

    // Get the previous value of an attribute, recorded at the time the last
    // `"change"` event was fired.
    previous: function(attr) {
      if (attr == null || !this._previousAttributes) return null;
      return this._previousAttributes[attr];
    },

    // Get all of the attributes of the model at the time of the previous
    // `"change"` event.
    previousAttributes: function() {
      return _.clone(this._previousAttributes);
    },

    // Fetch the model from the server, merging the response with the model's
    // local attributes. Any changed attributes will trigger a "change" event.
    fetch: function(options) {
      options = _.extend({parse: true}, options);
      var model = this;
      var success = options.success;
      options.success = function(resp) {
        var serverAttrs = options.parse ? model.parse(resp, options) : resp;
        if (!model.set(serverAttrs, options)) return false;
        if (success) success.call(options.context, model, resp, options);
        model.trigger('sync', model, resp, options);
      };
      wrapError(this, options);
      return this.sync('read', this, options);
    },

    // Set a hash of model attributes, and sync the model to the server.
    // If the server returns an attributes hash that differs, the model's
    // state will be `set` again.
    save: function(key, val, options) {
      // Handle both `"key", value` and `{key: value}` -style arguments.
      var attrs;
      if (key == null || typeof key === 'object') {
        attrs = key;
        options = val;
      } else {
        (attrs = {})[key] = val;
      }

      options = _.extend({validate: true, parse: true}, options);
      var wait = options.wait;

      // If we're not waiting and attributes exist, save acts as
      // `set(attr).save(null, opts)` with validation. Otherwise, check if
      // the model will be valid when the attributes, if any, are set.
      if (attrs && !wait) {
        if (!this.set(attrs, options)) return false;
      } else {
        if (!this._validate(attrs, options)) return false;
      }

      // After a successful server-side save, the client is (optionally)
      // updated with the server-side state.
      var model = this;
      var success = options.success;
      var attributes = this.attributes;
      options.success = function(resp) {
        // Ensure attributes are restored during synchronous saves.
        model.attributes = attributes;
        var serverAttrs = options.parse ? model.parse(resp, options) : resp;
        if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
        if (serverAttrs && !model.set(serverAttrs, options)) return false;
        if (success) success.call(options.context, model, resp, options);
        model.trigger('sync', model, resp, options);
      };
      wrapError(this, options);

      // Set temporary attributes if `{wait: true}` to properly find new ids.
      if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);

      var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
      if (method === 'patch' && !options.attrs) options.attrs = attrs;
      var xhr = this.sync(method, this, options);

      // Restore attributes.
      this.attributes = attributes;

      return xhr;
    },

    // Destroy this model on the server if it was already persisted.
    // Optimistically removes the model from its collection, if it has one.
    // If `wait: true` is passed, waits for the server to respond before removal.
    destroy: function(options) {
      options = options ? _.clone(options) : {};
      var model = this;
      var success = options.success;
      var wait = options.wait;

      var destroy = function() {
        model.stopListening();
        model.trigger('destroy', model, model.collection, options);
      };

      options.success = function(resp) {
        if (wait) destroy();
        if (success) success.call(options.context, model, resp, options);
        if (!model.isNew()) model.trigger('sync', model, resp, options);
      };

      var xhr = false;
      if (this.isNew()) {
        _.defer(options.success);
      } else {
        wrapError(this, options);
        xhr = this.sync('delete', this, options);
      }
      if (!wait) destroy();
      return xhr;
    },

    // Default URL for the model's representation on the server -- if you're
    // using Backbone's restful methods, override this to change the endpoint
    // that will be called.
    url: function() {
      var base =
        _.result(this, 'urlRoot') ||
        _.result(this.collection, 'url') ||
        urlError();
      if (this.isNew()) return base;
      var id = this.get(this.idAttribute);
      return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
    },

    // **parse** converts a response into the hash of attributes to be `set` on
    // the model. The default implementation is just to pass the response along.
    parse: function(resp, options) {
      return resp;
    },

    // Create a new model with identical attributes to this one.
    clone: function() {
      return new this.constructor(this.attributes);
    },

    // A model is new if it has never been saved to the server, and lacks an id.
    isNew: function() {
      return !this.has(this.idAttribute);
    },

    // Check if the model is currently in a valid state.
    isValid: function(options) {
      return this._validate({}, _.defaults({validate: true}, options));
    },

    // Run validation against the next complete set of model attributes,
    // returning `true` if all is well. Otherwise, fire an `"invalid"` event.
    _validate: function(attrs, options) {
      if (!options.validate || !this.validate) return true;
      attrs = _.extend({}, this.attributes, attrs);
      var error = this.validationError = this.validate(attrs, options) || null;
      if (!error) return true;
      this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
      return false;
    }

  });

  // Underscore methods that we want to implement on the Model, mapped to the
  // number of arguments they take.
  var modelMethods = { keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
      omit: 0, chain: 1, isEmpty: 1 };

  // Mix in each Underscore method as a proxy to `Model#attributes`.
  addUnderscoreMethods(Model, modelMethods, 'attributes');

  // Backbone.Collection
  // -------------------

  // If models tend to represent a single row of data, a Backbone Collection is
  // more analogous to a table full of data ... or a small slice or page of that
  // table, or a collection of rows that belong together for a particular reason
  // -- all of the messages in this particular folder, all of the documents
  // belonging to this particular author, and so on. Collections maintain
  // indexes of their models, both in order, and for lookup by `id`.

  // Create a new **Collection**, perhaps to contain a specific type of `model`.
  // If a `comparator` is specified, the Collection will maintain
  // its models in sort order, as they're added and removed.
  var Collection = Backbone.Collection = function(models, options) {
    options || (options = {});
    if (options.model) this.model = options.model;
    if (options.comparator !== void 0) this.comparator = options.comparator;
    this._reset();
    this.initialize.apply(this, arguments);
    if (models) this.reset(models, _.extend({silent: true}, options));
  };

  // Default options for `Collection#set`.
  var setOptions = {add: true, remove: true, merge: true};
  var addOptions = {add: true, remove: false};

  // Splices `insert` into `array` at index `at`.
  var splice = function(array, insert, at) {
    at = Math.min(Math.max(at, 0), array.length);
    var tail = Array(array.length - at);
    var length = insert.length;
    for (var i = 0; i < tail.length; i++) tail[i] = array[i + at];
    for (i = 0; i < length; i++) array[i + at] = insert[i];
    for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
  };

  // Define the Collection's inheritable methods.
  _.extend(Collection.prototype, Events, {

    // The default model for a collection is just a **Backbone.Model**.
    // This should be overridden in most cases.
    model: Model,

    // Initialize is an empty function by default. Override it with your own
    // initialization logic.
    initialize: function(){},

    // The JSON representation of a Collection is an array of the
    // models' attributes.
    toJSON: function(options) {
      return this.map(function(model) { return model.toJSON(options); });
    },

    // Proxy `Backbone.sync` by default.
    sync: function() {
      return Backbone.sync.apply(this, arguments);
    },

    // Add a model, or list of models to the set. `models` may be Backbone
    // Models or raw JavaScript objects to be converted to Models, or any
    // combination of the two.
    add: function(models, options) {
      return this.set(models, _.extend({merge: false}, options, addOptions));
    },

    // Remove a model, or a list of models from the set.
    remove: function(models, options) {
      options = _.extend({}, options);
      var singular = !_.isArray(models);
      models = singular ? [models] : _.clone(models);
      var removed = this._removeModels(models, options);
      if (!options.silent && removed) this.trigger('update', this, options);
      return singular ? removed[0] : removed;
    },

    // Update a collection by `set`-ing a new list of models, adding new ones,
    // removing models that are no longer present, and merging models that
    // already exist in the collection, as necessary. Similar to **Model#set**,
    // the core operation for updating the data contained by the collection.
    set: function(models, options) {
      if (models == null) return;

      options = _.defaults({}, options, setOptions);
      if (options.parse && !this._isModel(models)) models = this.parse(models, options);

      var singular = !_.isArray(models);
      models = singular ? [models] : models.slice();

      var at = options.at;
      if (at != null) at = +at;
      if (at < 0) at += this.length + 1;

      var set = [];
      var toAdd = [];
      var toRemove = [];
      var modelMap = {};

      var add = options.add;
      var merge = options.merge;
      var remove = options.remove;

      var sort = false;
      var sortable = this.comparator && (at == null) && options.sort !== false;
      var sortAttr = _.isString(this.comparator) ? this.comparator : null;

      // Turn bare objects into model references, and prevent invalid models
      // from being added.
      var model;
      for (var i = 0; i < models.length; i++) {
        model = models[i];

        // If a duplicate is found, prevent it from being added and
        // optionally merge it into the existing model.
        var existing = this.get(model);
        if (existing) {
          if (merge && model !== existing) {
            var attrs = this._isModel(model) ? model.attributes : model;
            if (options.parse) attrs = existing.parse(attrs, options);
            existing.set(attrs, options);
            if (sortable && !sort) sort = existing.hasChanged(sortAttr);
          }
          if (!modelMap[existing.cid]) {
            modelMap[existing.cid] = true;
            set.push(existing);
          }
          models[i] = existing;

        // If this is a new, valid model, push it to the `toAdd` list.
        } else if (add) {
          model = models[i] = this._prepareModel(model, options);
          if (model) {
            toAdd.push(model);
            this._addReference(model, options);
            modelMap[model.cid] = true;
            set.push(model);
          }
        }
      }

      // Remove stale models.
      if (remove) {
        for (i = 0; i < this.length; i++) {
          model = this.models[i];
          if (!modelMap[model.cid]) toRemove.push(model);
        }
        if (toRemove.length) this._removeModels(toRemove, options);
      }

      // See if sorting is needed, update `length` and splice in new models.
      var orderChanged = false;
      var replace = !sortable && add && remove;
      if (set.length && replace) {
        orderChanged = this.length != set.length || _.some(this.models, function(model, index) {
          return model !== set[index];
        });
        this.models.length = 0;
        splice(this.models, set, 0);
        this.length = this.models.length;
      } else if (toAdd.length) {
        if (sortable) sort = true;
        splice(this.models, toAdd, at == null ? this.length : at);
        this.length = this.models.length;
      }

      // Silently sort the collection if appropriate.
      if (sort) this.sort({silent: true});

      // Unless silenced, it's time to fire all appropriate add/sort events.
      if (!options.silent) {
        for (i = 0; i < toAdd.length; i++) {
          if (at != null) options.index = at + i;
          model = toAdd[i];
          model.trigger('add', model, this, options);
        }
        if (sort || orderChanged) this.trigger('sort', this, options);
        if (toAdd.length || toRemove.length) this.trigger('update', this, options);
      }

      // Return the added (or merged) model (or models).
      return singular ? models[0] : models;
    },

    // When you have more items than you want to add or remove individually,
    // you can reset the entire set with a new list of models, without firing
    // any granular `add` or `remove` events. Fires `reset` when finished.
    // Useful for bulk operations and optimizations.
    reset: function(models, options) {
      options = options ? _.clone(options) : {};
      for (var i = 0; i < this.models.length; i++) {
        this._removeReference(this.models[i], options);
      }
      options.previousModels = this.models;
      this._reset();
      models = this.add(models, _.extend({silent: true}, options));
      if (!options.silent) this.trigger('reset', this, options);
      return models;
    },

    // Add a model to the end of the collection.
    push: function(model, options) {
      return this.add(model, _.extend({at: this.length}, options));
    },

    // Remove a model from the end of the collection.
    pop: function(options) {
      var model = this.at(this.length - 1);
      return this.remove(model, options);
    },

    // Add a model to the beginning of the collection.
    unshift: function(model, options) {
      return this.add(model, _.extend({at: 0}, options));
    },

    // Remove a model from the beginning of the collection.
    shift: function(options) {
      var model = this.at(0);
      return this.remove(model, options);
    },

    // Slice out a sub-array of models from the collection.
    slice: function() {
      return slice.apply(this.models, arguments);
    },

    // Get a model from the set by id.
    get: function(obj) {
      if (obj == null) return void 0;
      var id = this.modelId(this._isModel(obj) ? obj.attributes : obj);
      return this._byId[obj] || this._byId[id] || this._byId[obj.cid];
    },

    // Get the model at the given index.
    at: function(index) {
      if (index < 0) index += this.length;
      return this.models[index];
    },

    // Return models with matching attributes. Useful for simple cases of
    // `filter`.
    where: function(attrs, first) {
      return this[first ? 'find' : 'filter'](attrs);
    },

    // Return the first model with matching attributes. Useful for simple cases
    // of `find`.
    findWhere: function(attrs) {
      return this.where(attrs, true);
    },

    // Force the collection to re-sort itself. You don't need to call this under
    // normal circumstances, as the set will maintain sort order as each item
    // is added.
    sort: function(options) {
      var comparator = this.comparator;
      if (!comparator) throw new Error('Cannot sort a set without a comparator');
      options || (options = {});

      var length = comparator.length;
      if (_.isFunction(comparator)) comparator = _.bind(comparator, this);

      // Run sort based on type of `comparator`.
      if (length === 1 || _.isString(comparator)) {
        this.models = this.sortBy(comparator);
      } else {
        this.models.sort(comparator);
      }
      if (!options.silent) this.trigger('sort', this, options);
      return this;
    },

    // Pluck an attribute from each model in the collection.
    pluck: function(attr) {
      return _.invoke(this.models, 'get', attr);
    },

    // Fetch the default set of models for this collection, resetting the
    // collection when they arrive. If `reset: true` is passed, the response
    // data will be passed through the `reset` method instead of `set`.
    fetch: function(options) {
      options = _.extend({parse: true}, options);
      var success = options.success;
      var collection = this;
      options.success = function(resp) {
        var method = options.reset ? 'reset' : 'set';
        collection[method](resp, options);
        if (success) success.call(options.context, collection, resp, options);
        collection.trigger('sync', collection, resp, options);
      };
      wrapError(this, options);
      return this.sync('read', this, options);
    },

    // Create a new instance of a model in this collection. Add the model to the
    // collection immediately, unless `wait: true` is passed, in which case we
    // wait for the server to agree.
    create: function(model, options) {
      options = options ? _.clone(options) : {};
      var wait = options.wait;
      model = this._prepareModel(model, options);
      if (!model) return false;
      if (!wait) this.add(model, options);
      var collection = this;
      var success = options.success;
      options.success = function(model, resp, callbackOpts) {
        if (wait) collection.add(model, callbackOpts);
        if (success) success.call(callbackOpts.context, model, resp, callbackOpts);
      };
      model.save(null, options);
      return model;
    },

    // **parse** converts a response into a list of models to be added to the
    // collection. The default implementation is just to pass it through.
    parse: function(resp, options) {
      return resp;
    },

    // Create a new collection with an identical list of models as this one.
    clone: function() {
      return new this.constructor(this.models, {
        model: this.model,
        comparator: this.comparator
      });
    },

    // Define how to uniquely identify models in the collection.
    modelId: function (attrs) {
      return attrs[this.model.prototype.idAttribute || 'id'];
    },

    // Private method to reset all internal state. Called when the collection
    // is first initialized or reset.
    _reset: function() {
      this.length = 0;
      this.models = [];
      this._byId  = {};
    },

    // Prepare a hash of attributes (or other model) to be added to this
    // collection.
    _prepareModel: function(attrs, options) {
      if (this._isModel(attrs)) {
        if (!attrs.collection) attrs.collection = this;
        return attrs;
      }
      options = options ? _.clone(options) : {};
      options.collection = this;
      var model = new this.model(attrs, options);
      if (!model.validationError) return model;
      this.trigger('invalid', this, model.validationError, options);
      return false;
    },

    // Internal method called by both remove and set.
    _removeModels: function(models, options) {
      var removed = [];
      for (var i = 0; i < models.length; i++) {
        var model = this.get(models[i]);
        if (!model) continue;

        var index = this.indexOf(model);
        this.models.splice(index, 1);
        this.length--;

        if (!options.silent) {
          options.index = index;
          model.trigger('remove', model, this, options);
        }

        removed.push(model);
        this._removeReference(model, options);
      }
      return removed.length ? removed : false;
    },

    // Method for checking whether an object should be considered a model for
    // the purposes of adding to the collection.
    _isModel: function (model) {
      return model instanceof Model;
    },

    // Internal method to create a model's ties to a collection.
    _addReference: function(model, options) {
      this._byId[model.cid] = model;
      var id = this.modelId(model.attributes);
      if (id != null) this._byId[id] = model;
      model.on('all', this._onModelEvent, this);
    },

    // Internal method to sever a model's ties to a collection.
    _removeReference: function(model, options) {
      delete this._byId[model.cid];
      var id = this.modelId(model.attributes);
      if (id != null) delete this._byId[id];
      if (this === model.collection) delete model.collection;
      model.off('all', this._onModelEvent, this);
    },

    // Internal method called every time a model in the set fires an event.
    // Sets need to update their indexes when models change ids. All other
    // events simply proxy through. "add" and "remove" events that originate
    // in other collections are ignored.
    _onModelEvent: function(event, model, collection, options) {
      if ((event === 'add' || event === 'remove') && collection !== this) return;
      if (event === 'destroy') this.remove(model, options);
      if (event === 'change') {
        var prevId = this.modelId(model.previousAttributes());
        var id = this.modelId(model.attributes);
        if (prevId !== id) {
          if (prevId != null) delete this._byId[prevId];
          if (id != null) this._byId[id] = model;
        }
      }
      this.trigger.apply(this, arguments);
    }

  });

  // Underscore methods that we want to implement on the Collection.
  // 90% of the core usefulness of Backbone Collections is actually implemented
  // right here:
  var collectionMethods = { forEach: 3, each: 3, map: 3, collect: 3, reduce: 4,
      foldl: 4, inject: 4, reduceRight: 4, foldr: 4, find: 3, detect: 3, filter: 3,
      select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
      contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
      head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
      without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
      isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
      sortBy: 3, indexBy: 3};

  // Mix in each Underscore method as a proxy to `Collection#models`.
  addUnderscoreMethods(Collection, collectionMethods, 'models');

  // Backbone.View
  // -------------

  // Backbone Views are almost more convention than they are actual code. A View
  // is simply a JavaScript object that represents a logical chunk of UI in the
  // DOM. This might be a single item, an entire list, a sidebar or panel, or
  // even the surrounding frame which wraps your whole app. Defining a chunk of
  // UI as a **View** allows you to define your DOM events declaratively, without
  // having to worry about render order ... and makes it easy for the view to
  // react to specific changes in the state of your models.

  // Creating a Backbone.View creates its initial element outside of the DOM,
  // if an existing element is not provided...
  var View = Backbone.View = function(options) {
    this.cid = _.uniqueId('view');
    _.extend(this, _.pick(options, viewOptions));
    this._ensureElement();
    this.initialize.apply(this, arguments);
  };

  // Cached regex to split keys for `delegate`.
  var delegateEventSplitter = /^(\S+)\s*(.*)$/;

  // List of view options to be set as properties.
  var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];

  // Set up all inheritable **Backbone.View** properties and methods.
  _.extend(View.prototype, Events, {

    // The default `tagName` of a View's element is `"div"`.
    tagName: 'div',

    // jQuery delegate for element lookup, scoped to DOM elements within the
    // current view. This should be preferred to global lookups where possible.
    $: function(selector) {
      return this.$el.find(selector);
    },

    // Initialize is an empty function by default. Override it with your own
    // initialization logic.
    initialize: function(){},

    // **render** is the core function that your view should override, in order
    // to populate its element (`this.el`), with the appropriate HTML. The
    // convention is for **render** to always return `this`.
    render: function() {
      return this;
    },

    // Remove this view by taking the element out of the DOM, and removing any
    // applicable Backbone.Events listeners.
    remove: function() {
      this._removeElement();
      this.stopListening();
      return this;
    },

    // Remove this view's element from the document and all event listeners
    // attached to it. Exposed for subclasses using an alternative DOM
    // manipulation API.
    _removeElement: function() {
      this.$el.remove();
    },

    // Change the view's element (`this.el` property) and re-delegate the
    // view's events on the new element.
    setElement: function(element) {
      this.undelegateEvents();
      this._setElement(element);
      this.delegateEvents();
      return this;
    },

    // Creates the `this.el` and `this.$el` references for this view using the
    // given `el`. `el` can be a CSS selector or an HTML string, a jQuery
    // context or an element. Subclasses can override this to utilize an
    // alternative DOM manipulation API and are only required to set the
    // `this.el` property.
    _setElement: function(el) {
      this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
      this.el = this.$el[0];
    },

    // Set callbacks, where `this.events` is a hash of
    //
    // *{"event selector": "callback"}*
    //
    //     {
    //       'mousedown .title':  'edit',
    //       'click .button':     'save',
    //       'click .open':       function(e) { ... }
    //     }
    //
    // pairs. Callbacks will be bound to the view, with `this` set properly.
    // Uses event delegation for efficiency.
    // Omitting the selector binds the event to `this.el`.
    delegateEvents: function(events) {
      events || (events = _.result(this, 'events'));
      if (!events) return this;
      this.undelegateEvents();
      for (var key in events) {
        var method = events[key];
        if (!_.isFunction(method)) method = this[method];
        if (!method) continue;
        var match = key.match(delegateEventSplitter);
        this.delegate(match[1], match[2], _.bind(method, this));
      }
      return this;
    },

    // Add a single event listener to the view's element (or a child element
    // using `selector`). This only works for delegate-able events: not `focus`,
    // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
    delegate: function(eventName, selector, listener) {
      this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
      return this;
    },

    // Clears all callbacks previously bound to the view by `delegateEvents`.
    // You usually don't need to use this, but may wish to if you have multiple
    // Backbone views attached to the same DOM element.
    undelegateEvents: function() {
      if (this.$el) this.$el.off('.delegateEvents' + this.cid);
      return this;
    },

    // A finer-grained `undelegateEvents` for removing a single delegated event.
    // `selector` and `listener` are both optional.
    undelegate: function(eventName, selector, listener) {
      this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
      return this;
    },

    // Produces a DOM element to be assigned to your view. Exposed for
    // subclasses using an alternative DOM manipulation API.
    _createElement: function(tagName) {
      return document.createElement(tagName);
    },

    // Ensure that the View has a DOM element to render into.
    // If `this.el` is a string, pass it through `$()`, take the first
    // matching element, and re-assign it to `el`. Otherwise, create
    // an element from the `id`, `className` and `tagName` properties.
    _ensureElement: function() {
      if (!this.el) {
        var attrs = _.extend({}, _.result(this, 'attributes'));
        if (this.id) attrs.id = _.result(this, 'id');
        if (this.className) attrs['class'] = _.result(this, 'className');
        this.setElement(this._createElement(_.result(this, 'tagName')));
        this._setAttributes(attrs);
      } else {
        this.setElement(_.result(this, 'el'));
      }
    },

    // Set attributes from a hash on this view's element.  Exposed for
    // subclasses using an alternative DOM manipulation API.
    _setAttributes: function(attributes) {
      this.$el.attr(attributes);
    }

  });

  // Backbone.sync
  // -------------

  // Override this function to change the manner in which Backbone persists
  // models to the server. You will be passed the type of request, and the
  // model in question. By default, makes a RESTful Ajax request
  // to the model's `url()`. Some possible customizations could be:
  //
  // * Use `setTimeout` to batch rapid-fire updates into a single request.
  // * Send up the models as XML instead of JSON.
  // * Persist models via WebSockets instead of Ajax.
  //
  // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
  // as `POST`, with a `_method` parameter containing the true HTTP method,
  // as well as all requests with the body as `application/x-www-form-urlencoded`
  // instead of `application/json` with the model in a param named `model`.
  // Useful when interfacing with server-side languages like **PHP** that make
  // it difficult to read the body of `PUT` requests.
  Backbone.sync = function(method, model, options) {
    var type = methodMap[method];

    // Default options, unless specified.
    _.defaults(options || (options = {}), {
      emulateHTTP: Backbone.emulateHTTP,
      emulateJSON: Backbone.emulateJSON
    });

    // Default JSON-request options.
    var params = {type: type, dataType: 'json'};

    // Ensure that we have a URL.
    if (!options.url) {
      params.url = _.result(model, 'url') || urlError();
    }

    // Ensure that we have the appropriate request data.
    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
      params.contentType = 'application/json';
      params.data = JSON.stringify(options.attrs || model.toJSON(options));
    }

    // For older servers, emulate JSON by encoding the request into an HTML-form.
    if (options.emulateJSON) {
      params.contentType = 'application/x-www-form-urlencoded';
      params.data = params.data ? {model: params.data} : {};
    }

    // For older servers, emulate HTTP by mimicking the HTTP method with `_method`
    // And an `X-HTTP-Method-Override` header.
    if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
      params.type = 'POST';
      if (options.emulateJSON) params.data._method = type;
      var beforeSend = options.beforeSend;
      options.beforeSend = function(xhr) {
        xhr.setRequestHeader('X-HTTP-Method-Override', type);
        if (beforeSend) return beforeSend.apply(this, arguments);
      };
    }

    // Don't process data on a non-GET request.
    if (params.type !== 'GET' && !options.emulateJSON) {
      params.processData = false;
    }

    // Pass along `textStatus` and `errorThrown` from jQuery.
    var error = options.error;
    options.error = function(xhr, textStatus, errorThrown) {
      options.textStatus = textStatus;
      options.errorThrown = errorThrown;
      if (error) error.call(options.context, xhr, textStatus, errorThrown);
    };

    // Make the request, allowing the user to override any Ajax options.
    var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
    model.trigger('request', model, xhr, options);
    return xhr;
  };

  // Map from CRUD to HTTP for our default `Backbone.sync` implementation.
  var methodMap = {
    'create': 'POST',
    'update': 'PUT',
    'patch':  'PATCH',
    'delete': 'DELETE',
    'read':   'GET'
  };

  // Set the default implementation of `Backbone.ajax` to proxy through to `$`.
  // Override this if you'd like to use a different library.
  Backbone.ajax = function() {
    return Backbone.$.ajax.apply(Backbone.$, arguments);
  };

  // Backbone.Router
  // ---------------

  // Routers map faux-URLs to actions, and fire events when routes are
  // matched. Creating a new one sets its `routes` hash, if not set statically.
  var Router = Backbone.Router = function(options) {
    options || (options = {});
    if (options.routes) this.routes = options.routes;
    this._bindRoutes();
    this.initialize.apply(this, arguments);
  };

  // Cached regular expressions for matching named param parts and splatted
  // parts of route strings.
  var optionalParam = /\((.*?)\)/g;
  var namedParam    = /(\(\?)?:\w+/g;
  var splatParam    = /\*\w+/g;
  var escapeRegExp  = /[\-{}\[\]+?.,\\\^$|#\s]/g;

  // Set up all inheritable **Backbone.Router** properties and methods.
  _.extend(Router.prototype, Events, {

    // Initialize is an empty function by default. Override it with your own
    // initialization logic.
    initialize: function(){},

    // Manually bind a single named route to a callback. For example:
    //
    //     this.route('search/:query/p:num', 'search', function(query, num) {
    //       ...
    //     });
    //
    route: function(route, name, callback) {
      if (!_.isRegExp(route)) route = this._routeToRegExp(route);
      if (_.isFunction(name)) {
        callback = name;
        name = '';
      }
      if (!callback) callback = this[name];
      var router = this;
      Backbone.history.route(route, function(fragment) {
        var args = router._extractParameters(route, fragment);
        if (router.execute(callback, args, name) !== false) {
          router.trigger.apply(router, ['route:' + name].concat(args));
          router.trigger('route', name, args);
          Backbone.history.trigger('route', router, name, args);
        }
      });
      return this;
    },

    // Execute a route handler with the provided parameters.  This is an
    // excellent place to do pre-route setup or post-route cleanup.
    execute: function(callback, args, name) {
      if (callback) callback.apply(this, args);
    },

    // Simple proxy to `Backbone.history` to save a fragment into the history.
    navigate: function(fragment, options) {
      Backbone.history.navigate(fragment, options);
      return this;
    },

    // Bind all defined routes to `Backbone.history`. We have to reverse the
    // order of the routes here to support behavior where the most general
    // routes can be defined at the bottom of the route map.
    _bindRoutes: function() {
      if (!this.routes) return;
      this.routes = _.result(this, 'routes');
      var route, routes = _.keys(this.routes);
      while ((route = routes.pop()) != null) {
        this.route(route, this.routes[route]);
      }
    },

    // Convert a route string into a regular expression, suitable for matching
    // against the current location hash.
    _routeToRegExp: function(route) {
      route = route.replace(escapeRegExp, '\\$&')
                   .replace(optionalParam, '(?:$1)?')
                   .replace(namedParam, function(match, optional) {
                     return optional ? match : '([^/?]+)';
                   })
                   .replace(splatParam, '([^?]*?)');
      return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
    },

    // Given a route, and a URL fragment that it matches, return the array of
    // extracted decoded parameters. Empty or unmatched parameters will be
    // treated as `null` to normalize cross-browser behavior.
    _extractParameters: function(route, fragment) {
      var params = route.exec(fragment).slice(1);
      return _.map(params, function(param, i) {
        // Don't decode the search params.
        if (i === params.length - 1) return param || null;
        return param ? decodeURIComponent(param) : null;
      });
    }

  });

  // Backbone.History
  // ----------------

  // Handles cross-browser history management, based on either
  // [pushState](http://diveintohtml5.info/history.html) and real URLs, or
  // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
  // and URL fragments. If the browser supports neither (old IE, natch),
  // falls back to polling.
  var History = Backbone.History = function() {
    this.handlers = [];
    this.checkUrl = _.bind(this.checkUrl, this);

    // Ensure that `History` can be used outside of the browser.
    if (typeof window !== 'undefined') {
      this.location = window.location;
      this.history = window.history;
    }
  };

  // Cached regex for stripping a leading hash/slash and trailing space.
  var routeStripper = /^[#\/]|\s+$/g;

  // Cached regex for stripping leading and trailing slashes.
  var rootStripper = /^\/+|\/+$/g;

  // Cached regex for stripping urls of hash.
  var pathStripper = /#.*$/;

  // Has the history handling already been started?
  History.started = false;

  // Set up all inheritable **Backbone.History** properties and methods.
  _.extend(History.prototype, Events, {

    // The default interval to poll for hash changes, if necessary, is
    // twenty times a second.
    interval: 50,

    // Are we at the app root?
    atRoot: function() {
      var path = this.location.pathname.replace(/[^\/]$/, '$&/');
      return path === this.root && !this.getSearch();
    },

    // Does the pathname match the root?
    matchRoot: function() {
      var path = this.decodeFragment(this.location.pathname);
      var root = path.slice(0, this.root.length - 1) + '/';
      return root === this.root;
    },

    // Unicode characters in `location.pathname` are percent encoded so they're
    // decoded for comparison. `%25` should not be decoded since it may be part
    // of an encoded parameter.
    decodeFragment: function(fragment) {
      return decodeURI(fragment.replace(/%25/g, '%2525'));
    },

    // In IE6, the hash fragment and search params are incorrect if the
    // fragment contains `?`.
    getSearch: function() {
      var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
      return match ? match[0] : '';
    },

    // Gets the true hash value. Cannot use location.hash directly due to bug
    // in Firefox where location.hash will always be decoded.
    getHash: function(window) {
      var match = (window || this).location.href.match(/#(.*)$/);
      return match ? match[1] : '';
    },

    // Get the pathname and search params, without the root.
    getPath: function() {
      var path = this.decodeFragment(
        this.location.pathname + this.getSearch()
      ).slice(this.root.length - 1);
      return path.charAt(0) === '/' ? path.slice(1) : path;
    },

    // Get the cross-browser normalized URL fragment from the path or hash.
    getFragment: function(fragment) {
      if (fragment == null) {
        if (this._usePushState || !this._wantsHashChange) {
          fragment = this.getPath();
        } else {
          fragment = this.getHash();
        }
      }
      return fragment.replace(routeStripper, '');
    },

    // Start the hash change handling, returning `true` if the current URL matches
    // an existing route, and `false` otherwise.
    start: function(options) {
      if (History.started) throw new Error('Backbone.history has already been started');
      History.started = true;

      // Figure out the initial configuration. Do we need an iframe?
      // Is pushState desired ... is it available?
      this.options          = _.extend({root: '/'}, this.options, options);
      this.root             = this.options.root;
      this._wantsHashChange = this.options.hashChange !== false;
      this._hasHashChange   = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
      this._useHashChange   = this._wantsHashChange && this._hasHashChange;
      this._wantsPushState  = !!this.options.pushState;
      this._hasPushState    = !!(this.history && this.history.pushState);
      this._usePushState    = this._wantsPushState && this._hasPushState;
      this.fragment         = this.getFragment();

      // Normalize root to always include a leading and trailing slash.
      this.root = ('/' + this.root + '/').replace(rootStripper, '/');

      // Transition from hashChange to pushState or vice versa if both are
      // requested.
      if (this._wantsHashChange && this._wantsPushState) {

        // If we've started off with a route from a `pushState`-enabled
        // browser, but we're currently in a browser that doesn't support it...
        if (!this._hasPushState && !this.atRoot()) {
          var root = this.root.slice(0, -1) || '/';
          this.location.replace(root + '#' + this.getPath());
          // Return immediately as browser will do redirect to new url
          return true;

        // Or if we've started out with a hash-based route, but we're currently
        // in a browser where it could be `pushState`-based instead...
        } else if (this._hasPushState && this.atRoot()) {
          this.navigate(this.getHash(), {replace: true});
        }

      }

      // Proxy an iframe to handle location events if the browser doesn't
      // support the `hashchange` event, HTML5 history, or the user wants
      // `hashChange` but not `pushState`.
      if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
        this.iframe = document.createElement('iframe');
        this.iframe.src = 'javascript:0';
        this.iframe.style.display = 'none';
        this.iframe.tabIndex = -1;
        var body = document.body;
        // Using `appendChild` will throw on IE < 9 if the document is not ready.
        var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
        iWindow.document.open();
        iWindow.document.close();
        iWindow.location.hash = '#' + this.fragment;
      }

      // Add a cross-platform `addEventListener` shim for older browsers.
      var addEventListener = window.addEventListener || function (eventName, listener) {
        return attachEvent('on' + eventName, listener);
      };

      // Depending on whether we're using pushState or hashes, and whether
      // 'onhashchange' is supported, determine how we check the URL state.
      if (this._usePushState) {
        addEventListener('popstate', this.checkUrl, false);
      } else if (this._useHashChange && !this.iframe) {
        addEventListener('hashchange', this.checkUrl, false);
      } else if (this._wantsHashChange) {
        this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
      }

      if (!this.options.silent) return this.loadUrl();
    },

    // Disable Backbone.history, perhaps temporarily. Not useful in a real app,
    // but possibly useful for unit testing Routers.
    stop: function() {
      // Add a cross-platform `removeEventListener` shim for older browsers.
      var removeEventListener = window.removeEventListener || function (eventName, listener) {
        return detachEvent('on' + eventName, listener);
      };

      // Remove window listeners.
      if (this._usePushState) {
        removeEventListener('popstate', this.checkUrl, false);
      } else if (this._useHashChange && !this.iframe) {
        removeEventListener('hashchange', this.checkUrl, false);
      }

      // Clean up the iframe if necessary.
      if (this.iframe) {
        document.body.removeChild(this.iframe);
        this.iframe = null;
      }

      // Some environments will throw when clearing an undefined interval.
      if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
      History.started = false;
    },

    // Add a route to be tested when the fragment changes. Routes added later
    // may override previous routes.
    route: function(route, callback) {
      this.handlers.unshift({route: route, callback: callback});
    },

    // Checks the current URL to see if it has changed, and if it has,
    // calls `loadUrl`, normalizing across the hidden iframe.
    checkUrl: function(e) {
      var current = this.getFragment();

      // If the user pressed the back button, the iframe's hash will have
      // changed and we should use that for comparison.
      if (current === this.fragment && this.iframe) {
        current = this.getHash(this.iframe.contentWindow);
      }

      if (current === this.fragment) return false;
      if (this.iframe) this.navigate(current);
      this.loadUrl();
    },

    // Attempt to load the current URL fragment. If a route succeeds with a
    // match, returns `true`. If no defined routes matches the fragment,
    // returns `false`.
    loadUrl: function(fragment) {
      // If the root doesn't match, no routes can match either.
      if (!this.matchRoot()) return false;
      fragment = this.fragment = this.getFragment(fragment);
      return _.some(this.handlers, function(handler) {
        if (handler.route.test(fragment)) {
          handler.callback(fragment);
          return true;
        }
      });
    },

    // Save a fragment into the hash history, or replace the URL state if the
    // 'replace' option is passed. You are responsible for properly URL-encoding
    // the fragment in advance.
    //
    // The options object can contain `trigger: true` if you wish to have the
    // route callback be fired (not usually desirable), or `replace: true`, if
    // you wish to modify the current URL without adding an entry to the history.
    navigate: function(fragment, options) {
      if (!History.started) return false;
      if (!options || options === true) options = {trigger: !!options};

      // Normalize the fragment.
      fragment = this.getFragment(fragment || '');

      // Don't include a trailing slash on the root.
      var root = this.root;
      if (fragment === '' || fragment.charAt(0) === '?') {
        root = root.slice(0, -1) || '/';
      }
      var url = root + fragment;

      // Strip the hash and decode for matching.
      fragment = this.decodeFragment(fragment.replace(pathStripper, ''));

      if (this.fragment === fragment) return;
      this.fragment = fragment;

      // If pushState is available, we use it to set the fragment as a real URL.
      if (this._usePushState) {
        this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);

      // If hash changes haven't been explicitly disabled, update the hash
      // fragment to store history.
      } else if (this._wantsHashChange) {
        this._updateHash(this.location, fragment, options.replace);
        if (this.iframe && (fragment !== this.getHash(this.iframe.contentWindow))) {
          var iWindow = this.iframe.contentWindow;

          // Opening and closing the iframe tricks IE7 and earlier to push a
          // history entry on hash-tag change.  When replace is true, we don't
          // want this.
          if (!options.replace) {
            iWindow.document.open();
            iWindow.document.close();
          }

          this._updateHash(iWindow.location, fragment, options.replace);
        }

      // If you've told us that you explicitly don't want fallback hashchange-
      // based history, then `navigate` becomes a page refresh.
      } else {
        return this.location.assign(url);
      }
      if (options.trigger) return this.loadUrl(fragment);
    },

    // Update the hash location, either replacing the current entry, or adding
    // a new one to the browser history.
    _updateHash: function(location, fragment, replace) {
      if (replace) {
        var href = location.href.replace(/(javascript:|#).*$/, '');
        location.replace(href + '#' + fragment);
      } else {
        // Some browsers require that `hash` contains a leading #.
        location.hash = '#' + fragment;
      }
    }

  });

  // Create the default Backbone.history.
  Backbone.history = new History;

  // Helpers
  // -------

  // Helper function to correctly set up the prototype chain for subclasses.
  // Similar to `goog.inherits`, but uses a hash of prototype properties and
  // class properties to be extended.
  var extend = function(protoProps, staticProps) {
    var parent = this;
    var child;

    // The constructor function for the new subclass is either defined by you
    // (the "constructor" property in your `extend` definition), or defaulted
    // by us to simply call the parent constructor.
    if (protoProps && _.has(protoProps, 'constructor')) {
      child = protoProps.constructor;
    } else {
      child = function(){ return parent.apply(this, arguments); };
    }

    // Add static properties to the constructor function, if supplied.
    _.extend(child, parent, staticProps);

    // Set the prototype chain to inherit from `parent`, without calling
    // `parent` constructor function.
    var Surrogate = function(){ this.constructor = child; };
    Surrogate.prototype = parent.prototype;
    child.prototype = new Surrogate;

    // Add prototype properties (instance properties) to the subclass,
    // if supplied.
    if (protoProps) _.extend(child.prototype, protoProps);

    // Set a convenience property in case the parent's prototype is needed
    // later.
    child.__super__ = parent.prototype;

    return child;
  };

  // Set up inheritance for the model, collection, router, view and history.
  Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;

  // Throw an error when a URL is needed, and none is supplied.
  var urlError = function() {
    throw new Error('A "url" property or function must be specified');
  };

  // Wrap an optional error callback with a fallback error event.
  var wrapError = function(model, options) {
    var error = options.error;
    options.error = function(resp) {
      if (error) error.call(options.context, model, resp, options);
      model.trigger('error', model, resp, options);
    };
  };

  return Backbone;

}));

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "ac41":
/***/ (function(module, exports) {

/**
 * Converts `set` to an array of its values.
 *
 * @private
 * @param {Object} set The set to convert.
 * @returns {Array} Returns the values.
 */
function setToArray(set) {
  var index = -1,
      result = Array(set.size);

  set.forEach(function(value) {
    result[++index] = value;
  });
  return result;
}

module.exports = setToArray;


/***/ }),

/***/ "b041":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var classof = __webpack_require__("f5df");

// `Object.prototype.toString` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.tostring
module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  return '[object ' + classof(this) + ']';
};


/***/ }),

/***/ "b047":
/***/ (function(module, exports) {

/**
 * The base implementation of `_.unary` without support for storing metadata.
 *
 * @private
 * @param {Function} func The function to cap arguments for.
 * @returns {Function} Returns the new capped function.
 */
function baseUnary(func) {
  return function(value) {
    return func(value);
  };
}

module.exports = baseUnary;


/***/ }),

/***/ "b1e5":
/***/ (function(module, exports, __webpack_require__) {

var getAllKeys = __webpack_require__("a994");

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * A specialized version of `baseIsEqualDeep` for objects with support for
 * partial deep comparisons.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
 * @param {Function} customizer The function to customize comparisons.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Object} stack Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
      objProps = getAllKeys(object),
      objLength = objProps.length,
      othProps = getAllKeys(other),
      othLength = othProps.length;

  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index = objLength;
  while (index--) {
    var key = objProps[index];
    if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
      return false;
    }
  }
  // Check that cyclic values are equal.
  var objStacked = stack.get(object);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object;
  }
  var result = true;
  stack.set(object, other);
  stack.set(other, object);

  var skipCtor = isPartial;
  while (++index < objLength) {
    key = objProps[index];
    var objValue = object[key],
        othValue = other[key];

    if (customizer) {
      var compared = isPartial
        ? customizer(othValue, objValue, key, other, object, stack)
        : customizer(objValue, othValue, key, object, other, stack);
    }
    // Recursively compare objects (susceptible to call stack limits).
    if (!(compared === undefined
          ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
          : compared
        )) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == 'constructor');
  }
  if (result && !skipCtor) {
    var objCtor = object.constructor,
        othCtor = other.constructor;

    // Non `Object` object instances with different constructors are not equal.
    if (objCtor != othCtor &&
        ('constructor' in object && 'constructor' in other) &&
        !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
          typeof othCtor == 'function' && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack['delete'](object);
  stack['delete'](other);
  return result;
}

module.exports = equalObjects;


/***/ }),

/***/ "b218":
/***/ (function(module, exports) {

/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;

/**
 * Checks if `value` is a valid array-like length.
 *
 * **Note:** This method is loosely based on
 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
 * @example
 *
 * _.isLength(3);
 * // => true
 *
 * _.isLength(Number.MIN_VALUE);
 * // => false
 *
 * _.isLength(Infinity);
 * // => false
 *
 * _.isLength('3');
 * // => false
 */
function isLength(value) {
  return typeof value == 'number' &&
    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}

module.exports = isLength;


/***/ }),

/***/ "b4c0":
/***/ (function(module, exports, __webpack_require__) {

var assocIndexOf = __webpack_require__("cb5a");

/**
 * Gets the list cache value for `key`.
 *
 * @private
 * @name get
 * @memberOf ListCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function listCacheGet(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  return index < 0 ? undefined : data[index][1];
}

module.exports = listCacheGet;


/***/ }),

/***/ "b575":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var macrotask = __webpack_require__("2cf4").set;
var IS_IOS = __webpack_require__("1cdc");
var IS_IOS_PEBBLE = __webpack_require__("d4c3");
var IS_WEBOS_WEBKIT = __webpack_require__("a4b4");
var IS_NODE = __webpack_require__("605d");

var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
var document = global.document;
var process = global.process;
var Promise = global.Promise;
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;

var flush, head, last, notify, toggle, node, promise, then;

// modern engines have queueMicrotask method
if (!queueMicrotask) {
  flush = function () {
    var parent, fn;
    if (IS_NODE && (parent = process.domain)) parent.exit();
    while (head) {
      fn = head.fn;
      head = head.next;
      try {
        fn();
      } catch (error) {
        if (head) notify();
        else last = undefined;
        throw error;
      }
    } last = undefined;
    if (parent) parent.enter();
  };

  // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
    toggle = true;
    node = document.createTextNode('');
    new MutationObserver(flush).observe(node, { characterData: true });
    notify = function () {
      node.data = toggle = !toggle;
    };
  // environments with maybe non-completely correct, but existent Promise
  } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
    // Promise.resolve without an argument throws an error in LG WebOS 2
    promise = Promise.resolve(undefined);
    // workaround of WebKit ~ iOS Safari 10.1 bug
    promise.constructor = Promise;
    then = promise.then;
    notify = function () {
      then.call(promise, flush);
    };
  // Node.js without promises
  } else if (IS_NODE) {
    notify = function () {
      process.nextTick(flush);
    };
  // for other environments - macrotask based on:
  // - setImmediate
  // - MessageChannel
  // - window.postMessag
  // - onreadystatechange
  // - setTimeout
  } else {
    notify = function () {
      // strange IE + webpack dev server bug - use .call(global)
      macrotask.call(global, flush);
    };
  }
}

module.exports = queueMicrotask || function (fn) {
  var task = { fn: fn, next: undefined };
  if (last) last.next = task;
  if (!head) {
    head = task;
    notify();
  } last = task;
};


/***/ }),

/***/ "b5a7":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07"),
    root = __webpack_require__("2b3e");

/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView');

module.exports = DataView;


/***/ }),

/***/ "b622":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var shared = __webpack_require__("5692");
var hasOwn = __webpack_require__("1a2d");
var uid = __webpack_require__("90e3");
var NATIVE_SYMBOL = __webpack_require__("4930");
var USE_SYMBOL_AS_UID = __webpack_require__("fdbf");

var WellKnownSymbolsStore = shared('wks');
var Symbol = global.Symbol;
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;

module.exports = function (name) {
  if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
    if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
      WellKnownSymbolsStore[name] = Symbol[name];
    } else {
      WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
    }
  } return WellKnownSymbolsStore[name];
};


/***/ }),

/***/ "b64b":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var toObject = __webpack_require__("7b0b");
var nativeKeys = __webpack_require__("df75");
var fails = __webpack_require__("d039");

var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });

// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  keys: function keys(it) {
    return nativeKeys(toObject(it));
  }
});


/***/ }),

/***/ "b727":
/***/ (function(module, exports, __webpack_require__) {

var bind = __webpack_require__("0366");
var IndexedObject = __webpack_require__("44ad");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var arraySpeciesCreate = __webpack_require__("65f0");

var push = [].push;

// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
var createMethod = function (TYPE) {
  var IS_MAP = TYPE == 1;
  var IS_FILTER = TYPE == 2;
  var IS_SOME = TYPE == 3;
  var IS_EVERY = TYPE == 4;
  var IS_FIND_INDEX = TYPE == 6;
  var IS_FILTER_REJECT = TYPE == 7;
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  return function ($this, callbackfn, that, specificCreate) {
    var O = toObject($this);
    var self = IndexedObject(O);
    var boundFunction = bind(callbackfn, that, 3);
    var length = lengthOfArrayLike(self);
    var index = 0;
    var create = specificCreate || arraySpeciesCreate;
    var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
    var value, result;
    for (;length > index; index++) if (NO_HOLES || index in self) {
      value = self[index];
      result = boundFunction(value, index, O);
      if (TYPE) {
        if (IS_MAP) target[index] = result; // map
        else if (result) switch (TYPE) {
          case 3: return true;              // some
          case 5: return value;             // find
          case 6: return index;             // findIndex
          case 2: push.call(target, value); // filter
        } else switch (TYPE) {
          case 4: return false;             // every
          case 7: push.call(target, value); // filterReject
        }
      }
    }
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  };
};

module.exports = {
  // `Array.prototype.forEach` method
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
  forEach: createMethod(0),
  // `Array.prototype.map` method
  // https://tc39.es/ecma262/#sec-array.prototype.map
  map: createMethod(1),
  // `Array.prototype.filter` method
  // https://tc39.es/ecma262/#sec-array.prototype.filter
  filter: createMethod(2),
  // `Array.prototype.some` method
  // https://tc39.es/ecma262/#sec-array.prototype.some
  some: createMethod(3),
  // `Array.prototype.every` method
  // https://tc39.es/ecma262/#sec-array.prototype.every
  every: createMethod(4),
  // `Array.prototype.find` method
  // https://tc39.es/ecma262/#sec-array.prototype.find
  find: createMethod(5),
  // `Array.prototype.findIndex` method
  // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  findIndex: createMethod(6),
  // `Array.prototype.filterReject` method
  // https://github.com/tc39/proposal-array-filtering
  filterReject: createMethod(7)
};


/***/ }),

/***/ "bbc0":
/***/ (function(module, exports, __webpack_require__) {

var nativeCreate = __webpack_require__("6044");

/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Gets the hash value for `key`.
 *
 * @private
 * @name get
 * @memberOf Hash
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate) {
    var result = data[key];
    return result === HASH_UNDEFINED ? undefined : result;
  }
  return hasOwnProperty.call(data, key) ? data[key] : undefined;
}

module.exports = hashGet;


/***/ }),

/***/ "c04e":
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__("861d");
var isSymbol = __webpack_require__("d9b5");
var getMethod = __webpack_require__("dc4a");
var ordinaryToPrimitive = __webpack_require__("485a");
var wellKnownSymbol = __webpack_require__("b622");

var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');

// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
module.exports = function (input, pref) {
  if (!isObject(input) || isSymbol(input)) return input;
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  var result;
  if (exoticToPrim) {
    if (pref === undefined) pref = 'default';
    result = exoticToPrim.call(input, pref);
    if (!isObject(result) || isSymbol(result)) return result;
    throw TypeError("Can't convert object to primitive value");
  }
  if (pref === undefined) pref = 'number';
  return ordinaryToPrimitive(input, pref);
};


/***/ }),

/***/ "c05f":
/***/ (function(module, exports, __webpack_require__) {

var baseIsEqualDeep = __webpack_require__("7b97"),
    isObjectLike = __webpack_require__("1310");

/**
 * The base implementation of `_.isEqual` which supports partial comparisons
 * and tracks traversed objects.
 *
 * @private
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @param {boolean} bitmask The bitmask flags.
 *  1 - Unordered comparison
 *  2 - Partial comparison
 * @param {Function} [customizer] The function to customize comparisons.
 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 */
function baseIsEqual(value, other, bitmask, customizer, stack) {
  if (value === other) {
    return true;
  }
  if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
    return value !== value && other !== other;
  }
  return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}

module.exports = baseIsEqual;


/***/ }),

/***/ "c098":
/***/ (function(module, exports) {

/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;

/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;

/**
 * Checks if `value` is a valid array-like index.
 *
 * @private
 * @param {*} value The value to check.
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
 */
function isIndex(value, length) {
  var type = typeof value;
  length = length == null ? MAX_SAFE_INTEGER : length;

  return !!length &&
    (type == 'number' ||
      (type != 'symbol' && reIsUint.test(value))) &&
        (value > -1 && value % 1 == 0 && value < length);
}

module.exports = isIndex;


/***/ }),

/***/ "c430":
/***/ (function(module, exports) {

module.exports = false;


/***/ }),

/***/ "c46f":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ index_default; });
__webpack_require__.d(__webpack_exports__, "VERSION", function() { return /* reexport */ _setup["e" /* VERSION */]; });
__webpack_require__.d(__webpack_exports__, "restArguments", function() { return /* reexport */ restArguments; });
__webpack_require__.d(__webpack_exports__, "isObject", function() { return /* reexport */ isObject; });
__webpack_require__.d(__webpack_exports__, "isNull", function() { return /* reexport */ isNull; });
__webpack_require__.d(__webpack_exports__, "isUndefined", function() { return /* reexport */ isUndefined; });
__webpack_require__.d(__webpack_exports__, "isBoolean", function() { return /* reexport */ isBoolean; });
__webpack_require__.d(__webpack_exports__, "isElement", function() { return /* reexport */ isElement; });
__webpack_require__.d(__webpack_exports__, "isString", function() { return /* reexport */ isString; });
__webpack_require__.d(__webpack_exports__, "isNumber", function() { return /* reexport */ isNumber; });
__webpack_require__.d(__webpack_exports__, "isDate", function() { return /* reexport */ isDate; });
__webpack_require__.d(__webpack_exports__, "isRegExp", function() { return /* reexport */ isRegExp; });
__webpack_require__.d(__webpack_exports__, "isError", function() { return /* reexport */ isError; });
__webpack_require__.d(__webpack_exports__, "isSymbol", function() { return /* reexport */ isSymbol; });
__webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return /* reexport */ isArrayBuffer; });
__webpack_require__.d(__webpack_exports__, "isDataView", function() { return /* reexport */ modules_isDataView; });
__webpack_require__.d(__webpack_exports__, "isArray", function() { return /* reexport */ isArray; });
__webpack_require__.d(__webpack_exports__, "isFunction", function() { return /* reexport */ modules_isFunction; });
__webpack_require__.d(__webpack_exports__, "isArguments", function() { return /* reexport */ modules_isArguments; });
__webpack_require__.d(__webpack_exports__, "isFinite", function() { return /* reexport */ isFinite_isFinite; });
__webpack_require__.d(__webpack_exports__, "isNaN", function() { return /* reexport */ isNaN_isNaN; });
__webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return /* reexport */ modules_isTypedArray; });
__webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; });
__webpack_require__.d(__webpack_exports__, "isMatch", function() { return /* reexport */ isMatch; });
__webpack_require__.d(__webpack_exports__, "isEqual", function() { return /* reexport */ isEqual; });
__webpack_require__.d(__webpack_exports__, "isMap", function() { return /* reexport */ isMap; });
__webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return /* reexport */ isWeakMap; });
__webpack_require__.d(__webpack_exports__, "isSet", function() { return /* reexport */ isSet; });
__webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return /* reexport */ isWeakSet; });
__webpack_require__.d(__webpack_exports__, "keys", function() { return /* reexport */ keys_keys; });
__webpack_require__.d(__webpack_exports__, "allKeys", function() { return /* reexport */ allKeys; });
__webpack_require__.d(__webpack_exports__, "values", function() { return /* reexport */ values_values; });
__webpack_require__.d(__webpack_exports__, "pairs", function() { return /* reexport */ pairs_pairs; });
__webpack_require__.d(__webpack_exports__, "invert", function() { return /* reexport */ invert; });
__webpack_require__.d(__webpack_exports__, "functions", function() { return /* reexport */ functions; });
__webpack_require__.d(__webpack_exports__, "methods", function() { return /* reexport */ functions; });
__webpack_require__.d(__webpack_exports__, "extend", function() { return /* reexport */ extend; });
__webpack_require__.d(__webpack_exports__, "extendOwn", function() { return /* reexport */ extendOwn; });
__webpack_require__.d(__webpack_exports__, "assign", function() { return /* reexport */ extendOwn; });
__webpack_require__.d(__webpack_exports__, "defaults", function() { return /* reexport */ defaults; });
__webpack_require__.d(__webpack_exports__, "create", function() { return /* reexport */ create; });
__webpack_require__.d(__webpack_exports__, "clone", function() { return /* reexport */ clone; });
__webpack_require__.d(__webpack_exports__, "tap", function() { return /* reexport */ tap; });
__webpack_require__.d(__webpack_exports__, "get", function() { return /* reexport */ get; });
__webpack_require__.d(__webpack_exports__, "has", function() { return /* reexport */ has_has; });
__webpack_require__.d(__webpack_exports__, "mapObject", function() { return /* reexport */ mapObject; });
__webpack_require__.d(__webpack_exports__, "identity", function() { return /* reexport */ identity; });
__webpack_require__.d(__webpack_exports__, "constant", function() { return /* reexport */ constant; });
__webpack_require__.d(__webpack_exports__, "noop", function() { return /* reexport */ noop; });
__webpack_require__.d(__webpack_exports__, "toPath", function() { return /* reexport */ toPath; });
__webpack_require__.d(__webpack_exports__, "property", function() { return /* reexport */ property; });
__webpack_require__.d(__webpack_exports__, "propertyOf", function() { return /* reexport */ propertyOf; });
__webpack_require__.d(__webpack_exports__, "matcher", function() { return /* reexport */ matcher_matcher; });
__webpack_require__.d(__webpack_exports__, "matches", function() { return /* reexport */ matcher_matcher; });
__webpack_require__.d(__webpack_exports__, "times", function() { return /* reexport */ times; });
__webpack_require__.d(__webpack_exports__, "random", function() { return /* reexport */ random; });
__webpack_require__.d(__webpack_exports__, "now", function() { return /* reexport */ now; });
__webpack_require__.d(__webpack_exports__, "escape", function() { return /* reexport */ modules_escape; });
__webpack_require__.d(__webpack_exports__, "unescape", function() { return /* reexport */ modules_unescape; });
__webpack_require__.d(__webpack_exports__, "templateSettings", function() { return /* reexport */ templateSettings; });
__webpack_require__.d(__webpack_exports__, "template", function() { return /* reexport */ template_template; });
__webpack_require__.d(__webpack_exports__, "result", function() { return /* reexport */ result_result; });
__webpack_require__.d(__webpack_exports__, "uniqueId", function() { return /* reexport */ uniqueId; });
__webpack_require__.d(__webpack_exports__, "chain", function() { return /* reexport */ chain; });
__webpack_require__.d(__webpack_exports__, "iteratee", function() { return /* reexport */ iteratee_iteratee; });
__webpack_require__.d(__webpack_exports__, "partial", function() { return /* reexport */ modules_partial; });
__webpack_require__.d(__webpack_exports__, "bind", function() { return /* reexport */ bind; });
__webpack_require__.d(__webpack_exports__, "bindAll", function() { return /* reexport */ bindAll; });
__webpack_require__.d(__webpack_exports__, "memoize", function() { return /* reexport */ memoize_memoize; });
__webpack_require__.d(__webpack_exports__, "delay", function() { return /* reexport */ delay; });
__webpack_require__.d(__webpack_exports__, "defer", function() { return /* reexport */ defer; });
__webpack_require__.d(__webpack_exports__, "throttle", function() { return /* reexport */ throttle; });
__webpack_require__.d(__webpack_exports__, "debounce", function() { return /* reexport */ debounce; });
__webpack_require__.d(__webpack_exports__, "wrap", function() { return /* reexport */ wrap; });
__webpack_require__.d(__webpack_exports__, "negate", function() { return /* reexport */ negate; });
__webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; });
__webpack_require__.d(__webpack_exports__, "after", function() { return /* reexport */ after; });
__webpack_require__.d(__webpack_exports__, "before", function() { return /* reexport */ before; });
__webpack_require__.d(__webpack_exports__, "once", function() { return /* reexport */ once; });
__webpack_require__.d(__webpack_exports__, "findKey", function() { return /* reexport */ findKey; });
__webpack_require__.d(__webpack_exports__, "findIndex", function() { return /* reexport */ findIndex; });
__webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return /* reexport */ findLastIndex; });
__webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return /* reexport */ sortedIndex_sortedIndex; });
__webpack_require__.d(__webpack_exports__, "indexOf", function() { return /* reexport */ indexOf; });
__webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return /* reexport */ lastIndexOf; });
__webpack_require__.d(__webpack_exports__, "find", function() { return /* reexport */ find; });
__webpack_require__.d(__webpack_exports__, "detect", function() { return /* reexport */ find; });
__webpack_require__.d(__webpack_exports__, "findWhere", function() { return /* reexport */ findWhere; });
__webpack_require__.d(__webpack_exports__, "each", function() { return /* reexport */ each; });
__webpack_require__.d(__webpack_exports__, "forEach", function() { return /* reexport */ each; });
__webpack_require__.d(__webpack_exports__, "map", function() { return /* reexport */ map_map; });
__webpack_require__.d(__webpack_exports__, "collect", function() { return /* reexport */ map_map; });
__webpack_require__.d(__webpack_exports__, "reduce", function() { return /* reexport */ reduce; });
__webpack_require__.d(__webpack_exports__, "foldl", function() { return /* reexport */ reduce; });
__webpack_require__.d(__webpack_exports__, "inject", function() { return /* reexport */ reduce; });
__webpack_require__.d(__webpack_exports__, "reduceRight", function() { return /* reexport */ reduceRight; });
__webpack_require__.d(__webpack_exports__, "foldr", function() { return /* reexport */ reduceRight; });
__webpack_require__.d(__webpack_exports__, "filter", function() { return /* reexport */ filter; });
__webpack_require__.d(__webpack_exports__, "select", function() { return /* reexport */ filter; });
__webpack_require__.d(__webpack_exports__, "reject", function() { return /* reexport */ reject; });
__webpack_require__.d(__webpack_exports__, "every", function() { return /* reexport */ every; });
__webpack_require__.d(__webpack_exports__, "all", function() { return /* reexport */ every; });
__webpack_require__.d(__webpack_exports__, "some", function() { return /* reexport */ some; });
__webpack_require__.d(__webpack_exports__, "any", function() { return /* reexport */ some; });
__webpack_require__.d(__webpack_exports__, "contains", function() { return /* reexport */ contains; });
__webpack_require__.d(__webpack_exports__, "includes", function() { return /* reexport */ contains; });
__webpack_require__.d(__webpack_exports__, "include", function() { return /* reexport */ contains; });
__webpack_require__.d(__webpack_exports__, "invoke", function() { return /* reexport */ invoke; });
__webpack_require__.d(__webpack_exports__, "pluck", function() { return /* reexport */ pluck; });
__webpack_require__.d(__webpack_exports__, "where", function() { return /* reexport */ where; });
__webpack_require__.d(__webpack_exports__, "max", function() { return /* reexport */ max; });
__webpack_require__.d(__webpack_exports__, "min", function() { return /* reexport */ min; });
__webpack_require__.d(__webpack_exports__, "shuffle", function() { return /* reexport */ shuffle; });
__webpack_require__.d(__webpack_exports__, "sample", function() { return /* reexport */ sample_sample; });
__webpack_require__.d(__webpack_exports__, "sortBy", function() { return /* reexport */ sortBy; });
__webpack_require__.d(__webpack_exports__, "groupBy", function() { return /* reexport */ groupBy; });
__webpack_require__.d(__webpack_exports__, "indexBy", function() { return /* reexport */ indexBy; });
__webpack_require__.d(__webpack_exports__, "countBy", function() { return /* reexport */ countBy; });
__webpack_require__.d(__webpack_exports__, "partition", function() { return /* reexport */ modules_partition; });
__webpack_require__.d(__webpack_exports__, "toArray", function() { return /* reexport */ toArray; });
__webpack_require__.d(__webpack_exports__, "size", function() { return /* reexport */ size; });
__webpack_require__.d(__webpack_exports__, "pick", function() { return /* reexport */ pick; });
__webpack_require__.d(__webpack_exports__, "omit", function() { return /* reexport */ omit; });
__webpack_require__.d(__webpack_exports__, "first", function() { return /* reexport */ first; });
__webpack_require__.d(__webpack_exports__, "head", function() { return /* reexport */ first; });
__webpack_require__.d(__webpack_exports__, "take", function() { return /* reexport */ first; });
__webpack_require__.d(__webpack_exports__, "initial", function() { return /* reexport */ initial_initial; });
__webpack_require__.d(__webpack_exports__, "last", function() { return /* reexport */ last_last; });
__webpack_require__.d(__webpack_exports__, "rest", function() { return /* reexport */ rest_rest; });
__webpack_require__.d(__webpack_exports__, "tail", function() { return /* reexport */ rest_rest; });
__webpack_require__.d(__webpack_exports__, "drop", function() { return /* reexport */ rest_rest; });
__webpack_require__.d(__webpack_exports__, "compact", function() { return /* reexport */ compact; });
__webpack_require__.d(__webpack_exports__, "flatten", function() { return /* reexport */ flatten_flatten; });
__webpack_require__.d(__webpack_exports__, "without", function() { return /* reexport */ without; });
__webpack_require__.d(__webpack_exports__, "uniq", function() { return /* reexport */ uniq; });
__webpack_require__.d(__webpack_exports__, "unique", function() { return /* reexport */ uniq; });
__webpack_require__.d(__webpack_exports__, "union", function() { return /* reexport */ union; });
__webpack_require__.d(__webpack_exports__, "intersection", function() { return /* reexport */ intersection; });
__webpack_require__.d(__webpack_exports__, "difference", function() { return /* reexport */ difference; });
__webpack_require__.d(__webpack_exports__, "unzip", function() { return /* reexport */ unzip; });
__webpack_require__.d(__webpack_exports__, "transpose", function() { return /* reexport */ unzip; });
__webpack_require__.d(__webpack_exports__, "zip", function() { return /* reexport */ zip; });
__webpack_require__.d(__webpack_exports__, "object", function() { return /* reexport */ object_object; });
__webpack_require__.d(__webpack_exports__, "range", function() { return /* reexport */ range; });
__webpack_require__.d(__webpack_exports__, "chunk", function() { return /* reexport */ chunk; });
__webpack_require__.d(__webpack_exports__, "mixin", function() { return /* reexport */ mixin; });

// NAMESPACE OBJECT: ./node_modules/underscore/modules/index.js
var modules_namespaceObject = {};
__webpack_require__.r(modules_namespaceObject);
__webpack_require__.d(modules_namespaceObject, "VERSION", function() { return _setup["e" /* VERSION */]; });
__webpack_require__.d(modules_namespaceObject, "restArguments", function() { return restArguments; });
__webpack_require__.d(modules_namespaceObject, "isObject", function() { return isObject; });
__webpack_require__.d(modules_namespaceObject, "isNull", function() { return isNull; });
__webpack_require__.d(modules_namespaceObject, "isUndefined", function() { return isUndefined; });
__webpack_require__.d(modules_namespaceObject, "isBoolean", function() { return isBoolean; });
__webpack_require__.d(modules_namespaceObject, "isElement", function() { return isElement; });
__webpack_require__.d(modules_namespaceObject, "isString", function() { return isString; });
__webpack_require__.d(modules_namespaceObject, "isNumber", function() { return isNumber; });
__webpack_require__.d(modules_namespaceObject, "isDate", function() { return isDate; });
__webpack_require__.d(modules_namespaceObject, "isRegExp", function() { return isRegExp; });
__webpack_require__.d(modules_namespaceObject, "isError", function() { return isError; });
__webpack_require__.d(modules_namespaceObject, "isSymbol", function() { return isSymbol; });
__webpack_require__.d(modules_namespaceObject, "isArrayBuffer", function() { return isArrayBuffer; });
__webpack_require__.d(modules_namespaceObject, "isDataView", function() { return modules_isDataView; });
__webpack_require__.d(modules_namespaceObject, "isArray", function() { return isArray; });
__webpack_require__.d(modules_namespaceObject, "isFunction", function() { return modules_isFunction; });
__webpack_require__.d(modules_namespaceObject, "isArguments", function() { return modules_isArguments; });
__webpack_require__.d(modules_namespaceObject, "isFinite", function() { return isFinite_isFinite; });
__webpack_require__.d(modules_namespaceObject, "isNaN", function() { return isNaN_isNaN; });
__webpack_require__.d(modules_namespaceObject, "isTypedArray", function() { return modules_isTypedArray; });
__webpack_require__.d(modules_namespaceObject, "isEmpty", function() { return isEmpty; });
__webpack_require__.d(modules_namespaceObject, "isMatch", function() { return isMatch; });
__webpack_require__.d(modules_namespaceObject, "isEqual", function() { return isEqual; });
__webpack_require__.d(modules_namespaceObject, "isMap", function() { return isMap; });
__webpack_require__.d(modules_namespaceObject, "isWeakMap", function() { return isWeakMap; });
__webpack_require__.d(modules_namespaceObject, "isSet", function() { return isSet; });
__webpack_require__.d(modules_namespaceObject, "isWeakSet", function() { return isWeakSet; });
__webpack_require__.d(modules_namespaceObject, "keys", function() { return keys_keys; });
__webpack_require__.d(modules_namespaceObject, "allKeys", function() { return allKeys; });
__webpack_require__.d(modules_namespaceObject, "values", function() { return values_values; });
__webpack_require__.d(modules_namespaceObject, "pairs", function() { return pairs_pairs; });
__webpack_require__.d(modules_namespaceObject, "invert", function() { return invert; });
__webpack_require__.d(modules_namespaceObject, "functions", function() { return functions; });
__webpack_require__.d(modules_namespaceObject, "methods", function() { return functions; });
__webpack_require__.d(modules_namespaceObject, "extend", function() { return extend; });
__webpack_require__.d(modules_namespaceObject, "extendOwn", function() { return extendOwn; });
__webpack_require__.d(modules_namespaceObject, "assign", function() { return extendOwn; });
__webpack_require__.d(modules_namespaceObject, "defaults", function() { return defaults; });
__webpack_require__.d(modules_namespaceObject, "create", function() { return create; });
__webpack_require__.d(modules_namespaceObject, "clone", function() { return clone; });
__webpack_require__.d(modules_namespaceObject, "tap", function() { return tap; });
__webpack_require__.d(modules_namespaceObject, "get", function() { return get; });
__webpack_require__.d(modules_namespaceObject, "has", function() { return has_has; });
__webpack_require__.d(modules_namespaceObject, "mapObject", function() { return mapObject; });
__webpack_require__.d(modules_namespaceObject, "identity", function() { return identity; });
__webpack_require__.d(modules_namespaceObject, "constant", function() { return constant; });
__webpack_require__.d(modules_namespaceObject, "noop", function() { return noop; });
__webpack_require__.d(modules_namespaceObject, "toPath", function() { return toPath; });
__webpack_require__.d(modules_namespaceObject, "property", function() { return property; });
__webpack_require__.d(modules_namespaceObject, "propertyOf", function() { return propertyOf; });
__webpack_require__.d(modules_namespaceObject, "matcher", function() { return matcher_matcher; });
__webpack_require__.d(modules_namespaceObject, "matches", function() { return matcher_matcher; });
__webpack_require__.d(modules_namespaceObject, "times", function() { return times; });
__webpack_require__.d(modules_namespaceObject, "random", function() { return random; });
__webpack_require__.d(modules_namespaceObject, "now", function() { return now; });
__webpack_require__.d(modules_namespaceObject, "escape", function() { return modules_escape; });
__webpack_require__.d(modules_namespaceObject, "unescape", function() { return modules_unescape; });
__webpack_require__.d(modules_namespaceObject, "templateSettings", function() { return templateSettings; });
__webpack_require__.d(modules_namespaceObject, "template", function() { return template_template; });
__webpack_require__.d(modules_namespaceObject, "result", function() { return result_result; });
__webpack_require__.d(modules_namespaceObject, "uniqueId", function() { return uniqueId; });
__webpack_require__.d(modules_namespaceObject, "chain", function() { return chain; });
__webpack_require__.d(modules_namespaceObject, "iteratee", function() { return iteratee_iteratee; });
__webpack_require__.d(modules_namespaceObject, "partial", function() { return modules_partial; });
__webpack_require__.d(modules_namespaceObject, "bind", function() { return bind; });
__webpack_require__.d(modules_namespaceObject, "bindAll", function() { return bindAll; });
__webpack_require__.d(modules_namespaceObject, "memoize", function() { return memoize_memoize; });
__webpack_require__.d(modules_namespaceObject, "delay", function() { return delay; });
__webpack_require__.d(modules_namespaceObject, "defer", function() { return defer; });
__webpack_require__.d(modules_namespaceObject, "throttle", function() { return throttle; });
__webpack_require__.d(modules_namespaceObject, "debounce", function() { return debounce; });
__webpack_require__.d(modules_namespaceObject, "wrap", function() { return wrap; });
__webpack_require__.d(modules_namespaceObject, "negate", function() { return negate; });
__webpack_require__.d(modules_namespaceObject, "compose", function() { return compose; });
__webpack_require__.d(modules_namespaceObject, "after", function() { return after; });
__webpack_require__.d(modules_namespaceObject, "before", function() { return before; });
__webpack_require__.d(modules_namespaceObject, "once", function() { return once; });
__webpack_require__.d(modules_namespaceObject, "findKey", function() { return findKey; });
__webpack_require__.d(modules_namespaceObject, "findIndex", function() { return findIndex; });
__webpack_require__.d(modules_namespaceObject, "findLastIndex", function() { return findLastIndex; });
__webpack_require__.d(modules_namespaceObject, "sortedIndex", function() { return sortedIndex_sortedIndex; });
__webpack_require__.d(modules_namespaceObject, "indexOf", function() { return indexOf; });
__webpack_require__.d(modules_namespaceObject, "lastIndexOf", function() { return lastIndexOf; });
__webpack_require__.d(modules_namespaceObject, "find", function() { return find; });
__webpack_require__.d(modules_namespaceObject, "detect", function() { return find; });
__webpack_require__.d(modules_namespaceObject, "findWhere", function() { return findWhere; });
__webpack_require__.d(modules_namespaceObject, "each", function() { return each; });
__webpack_require__.d(modules_namespaceObject, "forEach", function() { return each; });
__webpack_require__.d(modules_namespaceObject, "map", function() { return map_map; });
__webpack_require__.d(modules_namespaceObject, "collect", function() { return map_map; });
__webpack_require__.d(modules_namespaceObject, "reduce", function() { return reduce; });
__webpack_require__.d(modules_namespaceObject, "foldl", function() { return reduce; });
__webpack_require__.d(modules_namespaceObject, "inject", function() { return reduce; });
__webpack_require__.d(modules_namespaceObject, "reduceRight", function() { return reduceRight; });
__webpack_require__.d(modules_namespaceObject, "foldr", function() { return reduceRight; });
__webpack_require__.d(modules_namespaceObject, "filter", function() { return filter; });
__webpack_require__.d(modules_namespaceObject, "select", function() { return filter; });
__webpack_require__.d(modules_namespaceObject, "reject", function() { return reject; });
__webpack_require__.d(modules_namespaceObject, "every", function() { return every; });
__webpack_require__.d(modules_namespaceObject, "all", function() { return every; });
__webpack_require__.d(modules_namespaceObject, "some", function() { return some; });
__webpack_require__.d(modules_namespaceObject, "any", function() { return some; });
__webpack_require__.d(modules_namespaceObject, "contains", function() { return contains; });
__webpack_require__.d(modules_namespaceObject, "includes", function() { return contains; });
__webpack_require__.d(modules_namespaceObject, "include", function() { return contains; });
__webpack_require__.d(modules_namespaceObject, "invoke", function() { return invoke; });
__webpack_require__.d(modules_namespaceObject, "pluck", function() { return pluck; });
__webpack_require__.d(modules_namespaceObject, "where", function() { return where; });
__webpack_require__.d(modules_namespaceObject, "max", function() { return max; });
__webpack_require__.d(modules_namespaceObject, "min", function() { return min; });
__webpack_require__.d(modules_namespaceObject, "shuffle", function() { return shuffle; });
__webpack_require__.d(modules_namespaceObject, "sample", function() { return sample_sample; });
__webpack_require__.d(modules_namespaceObject, "sortBy", function() { return sortBy; });
__webpack_require__.d(modules_namespaceObject, "groupBy", function() { return groupBy; });
__webpack_require__.d(modules_namespaceObject, "indexBy", function() { return indexBy; });
__webpack_require__.d(modules_namespaceObject, "countBy", function() { return countBy; });
__webpack_require__.d(modules_namespaceObject, "partition", function() { return modules_partition; });
__webpack_require__.d(modules_namespaceObject, "toArray", function() { return toArray; });
__webpack_require__.d(modules_namespaceObject, "size", function() { return size; });
__webpack_require__.d(modules_namespaceObject, "pick", function() { return pick; });
__webpack_require__.d(modules_namespaceObject, "omit", function() { return omit; });
__webpack_require__.d(modules_namespaceObject, "first", function() { return first; });
__webpack_require__.d(modules_namespaceObject, "head", function() { return first; });
__webpack_require__.d(modules_namespaceObject, "take", function() { return first; });
__webpack_require__.d(modules_namespaceObject, "initial", function() { return initial_initial; });
__webpack_require__.d(modules_namespaceObject, "last", function() { return last_last; });
__webpack_require__.d(modules_namespaceObject, "rest", function() { return rest_rest; });
__webpack_require__.d(modules_namespaceObject, "tail", function() { return rest_rest; });
__webpack_require__.d(modules_namespaceObject, "drop", function() { return rest_rest; });
__webpack_require__.d(modules_namespaceObject, "compact", function() { return compact; });
__webpack_require__.d(modules_namespaceObject, "flatten", function() { return flatten_flatten; });
__webpack_require__.d(modules_namespaceObject, "without", function() { return without; });
__webpack_require__.d(modules_namespaceObject, "uniq", function() { return uniq; });
__webpack_require__.d(modules_namespaceObject, "unique", function() { return uniq; });
__webpack_require__.d(modules_namespaceObject, "union", function() { return union; });
__webpack_require__.d(modules_namespaceObject, "intersection", function() { return intersection; });
__webpack_require__.d(modules_namespaceObject, "difference", function() { return difference; });
__webpack_require__.d(modules_namespaceObject, "unzip", function() { return unzip; });
__webpack_require__.d(modules_namespaceObject, "transpose", function() { return unzip; });
__webpack_require__.d(modules_namespaceObject, "zip", function() { return zip; });
__webpack_require__.d(modules_namespaceObject, "object", function() { return object_object; });
__webpack_require__.d(modules_namespaceObject, "range", function() { return range; });
__webpack_require__.d(modules_namespaceObject, "chunk", function() { return chunk; });
__webpack_require__.d(modules_namespaceObject, "mixin", function() { return mixin; });
__webpack_require__.d(modules_namespaceObject, "default", function() { return underscore_array_methods; });

// EXTERNAL MODULE: ./node_modules/underscore/modules/_setup.js
var _setup = __webpack_require__("2f47");

// CONCATENATED MODULE: ./node_modules/underscore/modules/restArguments.js
// Some functions take a variable number of arguments, or a few expected
// arguments at the beginning and then a variable number of values to operate
// on. This helper accumulates all remaining arguments past the function’s
// argument length (or an explicit `startIndex`), into an array that becomes
// the last argument. Similar to ES6’s "rest parameter".
function restArguments(func, startIndex) {
  startIndex = startIndex == null ? func.length - 1 : +startIndex;
  return function() {
    var length = Math.max(arguments.length - startIndex, 0),
        rest = Array(length),
        index = 0;
    for (; index < length; index++) {
      rest[index] = arguments[index + startIndex];
    }
    switch (startIndex) {
      case 0: return func.call(this, rest);
      case 1: return func.call(this, arguments[0], rest);
      case 2: return func.call(this, arguments[0], arguments[1], rest);
    }
    var args = Array(startIndex + 1);
    for (index = 0; index < startIndex; index++) {
      args[index] = arguments[index];
    }
    args[startIndex] = rest;
    return func.apply(this, args);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isObject.js
// Is a given variable an object?
function isObject(obj) {
  var type = typeof obj;
  return type === 'function' || type === 'object' && !!obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isNull.js
// Is a given value equal to null?
function isNull(obj) {
  return obj === null;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isUndefined.js
// Is a given variable undefined?
function isUndefined(obj) {
  return obj === void 0;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isBoolean.js


// Is a given value a boolean?
function isBoolean(obj) {
  return obj === true || obj === false || _setup["t" /* toString */].call(obj) === '[object Boolean]';
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isElement.js
// Is a given value a DOM element?
function isElement(obj) {
  return !!(obj && obj.nodeType === 1);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_tagTester.js


// Internal function for creating a `toString`-based type tester.
function tagTester(name) {
  var tag = '[object ' + name + ']';
  return function(obj) {
    return _setup["t" /* toString */].call(obj) === tag;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isString.js


/* harmony default export */ var isString = (tagTester('String'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isNumber.js


/* harmony default export */ var isNumber = (tagTester('Number'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isDate.js


/* harmony default export */ var isDate = (tagTester('Date'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isRegExp.js


/* harmony default export */ var isRegExp = (tagTester('RegExp'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isError.js


/* harmony default export */ var isError = (tagTester('Error'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isSymbol.js


/* harmony default export */ var isSymbol = (tagTester('Symbol'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isArrayBuffer.js


/* harmony default export */ var isArrayBuffer = (tagTester('ArrayBuffer'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isFunction.js



var isFunction = tagTester('Function');

// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
var nodelist = _setup["p" /* root */].document && _setup["p" /* root */].document.childNodes;
if ( true && typeof Int8Array != 'object' && typeof nodelist != 'function') {
  isFunction = function(obj) {
    return typeof obj == 'function' || false;
  };
}

/* harmony default export */ var modules_isFunction = (isFunction);

// CONCATENATED MODULE: ./node_modules/underscore/modules/_hasObjectTag.js


/* harmony default export */ var _hasObjectTag = (tagTester('Object'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_stringTagBug.js



// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
// In IE 11, the most common among them, this problem also applies to
// `Map`, `WeakMap` and `Set`.
var hasStringTagBug = (
      _setup["s" /* supportsDataView */] && _hasObjectTag(new DataView(new ArrayBuffer(8)))
    ),
    isIE11 = (typeof Map !== 'undefined' && _hasObjectTag(new Map));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isDataView.js





var isDataView = tagTester('DataView');

// In IE 10 - Edge 13, we need a different heuristic
// to determine whether an object is a `DataView`.
function ie10IsDataView(obj) {
  return obj != null && modules_isFunction(obj.getInt8) && isArrayBuffer(obj.buffer);
}

/* harmony default export */ var modules_isDataView = (hasStringTagBug ? ie10IsDataView : isDataView);

// CONCATENATED MODULE: ./node_modules/underscore/modules/isArray.js



// Is a given value an array?
// Delegates to ECMA5's native `Array.isArray`.
/* harmony default export */ var isArray = (_setup["k" /* nativeIsArray */] || tagTester('Array'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_has.js


// Internal function to check whether `key` is an own property name of `obj`.
function has(obj, key) {
  return obj != null && _setup["i" /* hasOwnProperty */].call(obj, key);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isArguments.js



var isArguments = tagTester('Arguments');

// Define a fallback version of the method in browsers (ahem, IE < 9), where
// there isn't any inspectable "Arguments" type.
(function() {
  if (!isArguments(arguments)) {
    isArguments = function(obj) {
      return has(obj, 'callee');
    };
  }
}());

/* harmony default export */ var modules_isArguments = (isArguments);

// CONCATENATED MODULE: ./node_modules/underscore/modules/isFinite.js



// Is a given object a finite number?
function isFinite_isFinite(obj) {
  return !isSymbol(obj) && Object(_setup["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isNaN.js



// Is the given value `NaN`?
function isNaN_isNaN(obj) {
  return isNumber(obj) && Object(_setup["g" /* _isNaN */])(obj);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/constant.js
// Predicate-generating function. Often useful outside of Underscore.
function constant(value) {
  return function() {
    return value;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createSizePropertyCheck.js


// Common internal logic for `isArrayLike` and `isBufferLike`.
function createSizePropertyCheck(getSizeProperty) {
  return function(collection) {
    var sizeProperty = getSizeProperty(collection);
    return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= _setup["b" /* MAX_ARRAY_INDEX */];
  }
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_shallowProperty.js
// Internal helper to generate a function to obtain property `key` from `obj`.
function shallowProperty(key) {
  return function(obj) {
    return obj == null ? void 0 : obj[key];
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_getByteLength.js


// Internal helper to obtain the `byteLength` property of an object.
/* harmony default export */ var _getByteLength = (shallowProperty('byteLength'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_isBufferLike.js



// Internal helper to determine whether we should spend extensive checks against
// `ArrayBuffer` et al.
/* harmony default export */ var _isBufferLike = (createSizePropertyCheck(_getByteLength));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isTypedArray.js





// Is a given value a typed array?
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
function isTypedArray(obj) {
  // `ArrayBuffer.isView` is the most future-proof, so use it when available.
  // Otherwise, fall back on the above regular expression.
  return _setup["l" /* nativeIsView */] ? (Object(_setup["l" /* nativeIsView */])(obj) && !modules_isDataView(obj)) :
                _isBufferLike(obj) && typedArrayPattern.test(_setup["t" /* toString */].call(obj));
}

/* harmony default export */ var modules_isTypedArray = (_setup["r" /* supportsArrayBuffer */] ? isTypedArray : constant(false));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_getLength.js


// Internal helper to obtain the `length` property of an object.
/* harmony default export */ var _getLength = (shallowProperty('length'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_collectNonEnumProps.js




// Internal helper to create a simple lookup structure.
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
// circular imports. `emulatedSet` is a one-off solution that only works for
// arrays of strings.
function emulatedSet(keys) {
  var hash = {};
  for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
  return {
    contains: function(key) { return hash[key]; },
    push: function(key) {
      hash[key] = true;
      return keys.push(key);
    }
  };
}

// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
// needed.
function collectNonEnumProps(obj, keys) {
  keys = emulatedSet(keys);
  var nonEnumIdx = _setup["n" /* nonEnumerableProps */].length;
  var constructor = obj.constructor;
  var proto = modules_isFunction(constructor) && constructor.prototype || _setup["c" /* ObjProto */];

  // Constructor is a special case.
  var prop = 'constructor';
  if (has(obj, prop) && !keys.contains(prop)) keys.push(prop);

  while (nonEnumIdx--) {
    prop = _setup["n" /* nonEnumerableProps */][nonEnumIdx];
    if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
      keys.push(prop);
    }
  }
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/keys.js





// Retrieve the names of an object's own properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`.
function keys_keys(obj) {
  if (!isObject(obj)) return [];
  if (_setup["m" /* nativeKeys */]) return Object(_setup["m" /* nativeKeys */])(obj);
  var keys = [];
  for (var key in obj) if (has(obj, key)) keys.push(key);
  // Ahem, IE < 9.
  if (_setup["h" /* hasEnumBug */]) collectNonEnumProps(obj, keys);
  return keys;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isEmpty.js






// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
function isEmpty(obj) {
  if (obj == null) return true;
  // Skip the more expensive `toString`-based type checks if `obj` has no
  // `.length`.
  var length = _getLength(obj);
  if (typeof length == 'number' && (
    isArray(obj) || isString(obj) || modules_isArguments(obj)
  )) return length === 0;
  return _getLength(keys_keys(obj)) === 0;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isMatch.js


// Returns whether an object has a given set of `key:value` pairs.
function isMatch(object, attrs) {
  var _keys = 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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/underscore.js


// 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 functions added
// through `_.mixin`. Wrapped objects may be chained.
function _(obj) {
  if (obj instanceof _) return obj;
  if (!(this instanceof _)) return new _(obj);
  this._wrapped = obj;
}

_.VERSION = _setup["e" /* VERSION */];

// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
  return this._wrapped;
};

// Provide unwrapping proxies for some methods used in engine operations
// such as arithmetic and JSON stringification.
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;

_.prototype.toString = function() {
  return String(this._wrapped);
};

// CONCATENATED MODULE: ./node_modules/underscore/modules/_toBufferView.js


// Internal function to wrap or shallow-copy an ArrayBuffer,
// typed array or DataView to a new view, reusing the buffer.
function toBufferView(bufferSource) {
  return new Uint8Array(
    bufferSource.buffer || bufferSource,
    bufferSource.byteOffset || 0,
    _getByteLength(bufferSource)
  );
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/isEqual.js











// We use this string twice, so give it a name for minification.
var tagDataView = '[object DataView]';

// Internal recursive comparison function for `_.isEqual`.
function eq(a, b, aStack, bStack) {
  // Identical objects are equal. `0 === -0`, but they aren't identical.
  // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
  if (a === b) return a !== 0 || 1 / a === 1 / b;
  // `null` or `undefined` only equal to itself (strict comparison).
  if (a == null || b == null) return false;
  // `NaN`s are equivalent, but non-reflexive.
  if (a !== a) return b !== b;
  // Exhaust primitive checks
  var type = typeof a;
  if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
  return deepEq(a, b, aStack, bStack);
}

// Internal recursive comparison function for `_.isEqual`.
function deepEq(a, b, aStack, bStack) {
  // Unwrap any wrapped objects.
  if (a instanceof _) a = a._wrapped;
  if (b instanceof _) b = b._wrapped;
  // Compare `[[Class]]` names.
  var className = _setup["t" /* toString */].call(a);
  if (className !== _setup["t" /* toString */].call(b)) return false;
  // Work around a bug in IE 10 - Edge 13.
  if (hasStringTagBug && className == '[object Object]' && modules_isDataView(a)) {
    if (!modules_isDataView(b)) return false;
    className = tagDataView;
  }
  switch (className) {
    // These types 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;
    case '[object Symbol]':
      return _setup["d" /* SymbolProto */].valueOf.call(a) === _setup["d" /* SymbolProto */].valueOf.call(b);
    case '[object ArrayBuffer]':
    case tagDataView:
      // Coerce to typed array so we can fall through.
      return deepEq(toBufferView(a), toBufferView(b), aStack, bStack);
  }

  var areArrays = className === '[object Array]';
  if (!areArrays && modules_isTypedArray(a)) {
      var byteLength = _getByteLength(a);
      if (byteLength !== _getByteLength(b)) return false;
      if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
      areArrays = true;
  }
  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 && !(modules_isFunction(aCtor) && aCtor instanceof aCtor &&
                             modules_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_keys(a), key;
    length = _keys.length;
    // Ensure that both objects contain the same number of properties before comparing deep equality.
    if (keys_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.
function isEqual(a, b) {
  return eq(a, b);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/allKeys.js




// Retrieve all the enumerable property names of an object.
function allKeys(obj) {
  if (!isObject(obj)) return [];
  var keys = [];
  for (var key in obj) keys.push(key);
  // Ahem, IE < 9.
  if (_setup["h" /* hasEnumBug */]) collectNonEnumProps(obj, keys);
  return keys;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_methodFingerprint.js




// Since the regular `Object.prototype.toString` type tests don't work for
// some types in IE 11, we use a fingerprinting heuristic instead, based
// on the methods. It's not great, but it's the best we got.
// The fingerprint method lists are defined below.
function ie11fingerprint(methods) {
  var length = _getLength(methods);
  return function(obj) {
    if (obj == null) return false;
    // `Map`, `WeakMap` and `Set` have no enumerable keys.
    var keys = allKeys(obj);
    if (_getLength(keys)) return false;
    for (var i = 0; i < length; i++) {
      if (!modules_isFunction(obj[methods[i]])) return false;
    }
    // If we are testing against `WeakMap`, we need to ensure that
    // `obj` doesn't have a `forEach` method in order to distinguish
    // it from a regular `Map`.
    return methods !== weakMapMethods || !modules_isFunction(obj[forEachName]);
  };
}

// In the interest of compact minification, we write
// each string in the fingerprints only once.
var forEachName = 'forEach',
    hasName = 'has',
    commonInit = ['clear', 'delete'],
    mapTail = ['get', hasName, 'set'];

// `Map`, `WeakMap` and `Set` each have slightly different
// combinations of the above sublists.
var mapMethods = commonInit.concat(forEachName, mapTail),
    weakMapMethods = commonInit.concat(mapTail),
    setMethods = ['add'].concat(commonInit, forEachName, hasName);

// CONCATENATED MODULE: ./node_modules/underscore/modules/isMap.js




/* harmony default export */ var isMap = (isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isWeakMap.js




/* harmony default export */ var isWeakMap = (isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isSet.js




/* harmony default export */ var isSet = (isIE11 ? ie11fingerprint(setMethods) : tagTester('Set'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/isWeakSet.js


/* harmony default export */ var isWeakSet = (tagTester('WeakSet'));

// CONCATENATED MODULE: ./node_modules/underscore/modules/values.js


// Retrieve the values of an object's properties.
function values_values(obj) {
  var _keys = 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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/pairs.js


// Convert an object into a list of `[key, value]` pairs.
// The opposite of `_.object` with one argument.
function pairs_pairs(obj) {
  var _keys = 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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/invert.js


// Invert the keys and values of an object. The values must be serializable.
function invert(obj) {
  var result = {};
  var _keys = keys_keys(obj);
  for (var i = 0, length = _keys.length; i < length; i++) {
    result[obj[_keys[i]]] = _keys[i];
  }
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/functions.js


// Return a sorted list of the function names available on the object.
function functions(obj) {
  var names = [];
  for (var key in obj) {
    if (modules_isFunction(obj[key])) names.push(key);
  }
  return names.sort();
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createAssigner.js
// An internal function for creating assigner functions.
function createAssigner(keysFunc, defaults) {
  return function(obj) {
    var length = arguments.length;
    if (defaults) obj = Object(obj);
    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 (!defaults || obj[key] === void 0) obj[key] = source[key];
      }
    }
    return obj;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/extend.js



// Extend a given object with all the properties in passed-in object(s).
/* harmony default export */ var extend = (createAssigner(allKeys));

// CONCATENATED MODULE: ./node_modules/underscore/modules/extendOwn.js



// 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)
/* harmony default export */ var extendOwn = (createAssigner(keys_keys));

// CONCATENATED MODULE: ./node_modules/underscore/modules/defaults.js



// Fill in a given object with default properties.
/* harmony default export */ var defaults = (createAssigner(allKeys, true));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_baseCreate.js



// Create a naked function reference for surrogate-prototype-swapping.
function ctor() {
  return function(){};
}

// An internal function for creating a new object that inherits from another.
function baseCreate(prototype) {
  if (!isObject(prototype)) return {};
  if (_setup["j" /* nativeCreate */]) return Object(_setup["j" /* nativeCreate */])(prototype);
  var Ctor = ctor();
  Ctor.prototype = prototype;
  var result = new Ctor;
  Ctor.prototype = null;
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/create.js



// Creates an object that inherits from the given prototype object.
// If additional properties are provided then they will be added to the
// created object.
function create(prototype, props) {
  var result = baseCreate(prototype);
  if (props) extendOwn(result, props);
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/clone.js




// Create a (shallow-cloned) duplicate of an object.
function clone(obj) {
  if (!isObject(obj)) return obj;
  return isArray(obj) ? obj.slice() : extend({}, obj);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/tap.js
// 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.
function tap(obj, interceptor) {
  interceptor(obj);
  return obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/toPath.js



// Normalize a (deep) property `path` to array.
// Like `_.iteratee`, this function can be customized.
function toPath(path) {
  return isArray(path) ? path : [path];
}
_.toPath = toPath;

// CONCATENATED MODULE: ./node_modules/underscore/modules/_toPath.js



// Internal wrapper for `_.toPath` to enable minification.
// Similar to `cb` for `_.iteratee`.
function _toPath_toPath(path) {
  return _.toPath(path);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_deepGet.js
// Internal function to obtain a nested property in `obj` along `path`.
function deepGet(obj, path) {
  var length = path.length;
  for (var i = 0; i < length; i++) {
    if (obj == null) return void 0;
    obj = obj[path[i]];
  }
  return length ? obj : void 0;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/get.js




// Get the value of the (deep) property on `path` from `object`.
// If any property in `path` does not exist or if the value is
// `undefined`, return `defaultValue` instead.
// The `path` is normalized through `_.toPath`.
function get(object, path, defaultValue) {
  var value = deepGet(object, _toPath_toPath(path));
  return isUndefined(value) ? defaultValue : value;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/has.js



// Shortcut function for checking if an object has a given property directly on
// itself (in other words, not on a prototype). Unlike the internal `has`
// function, this public version can also traverse nested properties.
function has_has(obj, path) {
  path = _toPath_toPath(path);
  var length = path.length;
  for (var i = 0; i < length; i++) {
    var key = path[i];
    if (!has(obj, key)) return false;
    obj = obj[key];
  }
  return !!length;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/identity.js
// Keep the identity function around for default iteratees.
function identity(value) {
  return value;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/matcher.js



// Returns a predicate for checking whether an object has a given set of
// `key:value` pairs.
function matcher_matcher(attrs) {
  attrs = extendOwn({}, attrs);
  return function(obj) {
    return isMatch(obj, attrs);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/property.js



// Creates a function that, when passed an object, will traverse that object’s
// properties down the given `path`, specified as an array of keys or indices.
function property(path) {
  path = _toPath_toPath(path);
  return function(obj) {
    return deepGet(obj, path);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_optimizeCb.js
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
function optimizeCb(func, context, argCount) {
  if (context === void 0) return func;
  switch (argCount == null ? 3 : argCount) {
    case 1: return function(value) {
      return func.call(context, value);
    };
    // The 2-argument case is omitted because we’re not using it.
    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);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_baseIteratee.js








// An 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.
function baseIteratee(value, context, argCount) {
  if (value == null) return identity;
  if (modules_isFunction(value)) return optimizeCb(value, context, argCount);
  if (isObject(value) && !isArray(value)) return matcher_matcher(value);
  return property(value);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/iteratee.js



// External wrapper for our callback generator. Users may customize
// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
// This abstraction hides the internal-only `argCount` argument.
function iteratee_iteratee(value, context) {
  return baseIteratee(value, context, Infinity);
}
_.iteratee = iteratee_iteratee;

// CONCATENATED MODULE: ./node_modules/underscore/modules/_cb.js




// The function we call internally to generate a callback. It invokes
// `_.iteratee` if overridden, otherwise `baseIteratee`.
function cb(value, context, argCount) {
  if (_.iteratee !== iteratee_iteratee) return _.iteratee(value, context);
  return baseIteratee(value, context, argCount);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/mapObject.js



// Returns the results of applying the `iteratee` to each element of `obj`.
// In contrast to `_.map` it returns an object.
function mapObject(obj, iteratee, context) {
  iteratee = cb(iteratee, context);
  var _keys = keys_keys(obj),
      length = _keys.length,
      results = {};
  for (var index = 0; index < length; index++) {
    var currentKey = _keys[index];
    results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
  }
  return results;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/noop.js
// Predicate-generating function. Often useful outside of Underscore.
function noop(){}

// CONCATENATED MODULE: ./node_modules/underscore/modules/propertyOf.js



// Generates a function for a given object that returns a given property.
function propertyOf(obj) {
  if (obj == null) return noop;
  return function(path) {
    return get(obj, path);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/times.js


// Run a function **n** times.
function times(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/random.js
// Return a random integer between `min` and `max` (inclusive).
function random(min, max) {
  if (max == null) {
    max = min;
    min = 0;
  }
  return min + Math.floor(Math.random() * (max - min + 1));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/now.js
// A (possibly faster) way to get the current timestamp as an integer.
/* harmony default export */ var now = (Date.now || function() {
  return new Date().getTime();
});

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createEscaper.js


// Internal helper to generate functions for escaping and unescaping strings
// to/from HTML interpolation.
function createEscaper(map) {
  var escaper = function(match) {
    return map[match];
  };
  // Regexes for identifying a key that needs to be escaped.
  var source = '(?:' + keys_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;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_escapeMap.js
// Internal list of HTML entities for escaping.
/* harmony default export */ var _escapeMap = ({
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#x27;',
  '`': '&#x60;'
});

// CONCATENATED MODULE: ./node_modules/underscore/modules/escape.js



// Function for escaping strings to HTML interpolation.
/* harmony default export */ var modules_escape = (createEscaper(_escapeMap));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_unescapeMap.js



// Internal list of HTML entities for unescaping.
/* harmony default export */ var _unescapeMap = (invert(_escapeMap));

// CONCATENATED MODULE: ./node_modules/underscore/modules/unescape.js



// Function for unescaping strings from HTML interpolation.
/* harmony default export */ var modules_unescape = (createEscaper(_unescapeMap));

// CONCATENATED MODULE: ./node_modules/underscore/modules/templateSettings.js


// By default, Underscore uses ERB-style template delimiters. Change the
// following template settings to use alternative delimiters.
/* harmony default export */ var templateSettings = (_.templateSettings = {
  evaluate: /<%([\s\S]+?)%>/g,
  interpolate: /<%=([\s\S]+?)%>/g,
  escape: /<%-([\s\S]+?)%>/g
});

// CONCATENATED MODULE: ./node_modules/underscore/modules/template.js




// 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 escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;

function escapeChar(match) {
  return '\\' + escapes[match];
}

// In order to prevent third-party code injection through
// `_.templateSettings.variable`, we test it against the following regular
// expression. It is intentionally a bit more liberal than just matching valid
// identifiers, but still prevents possible loopholes through defaults or
// destructuring assignment.
var bareIdentifier = /^\s*(\w|\$)+\s*$/;

// 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.
function template_template(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(escapeRegExp, 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 offset.
    return match;
  });
  source += "';\n";

  var argument = settings.variable;
  if (argument) {
    // Insure against third-party code injection. (CVE-2021-23358)
    if (!bareIdentifier.test(argument)) throw new Error(
      'variable is not a bare identifier: ' + argument
    );
  } else {
    // If a variable is not specified, place data values in local scope.
    source = 'with(obj||{}){\n' + source + '}\n';
    argument = 'obj';
  }

  source = "var __t,__p='',__j=Array.prototype.join," +
    "print=function(){__p+=__j.call(arguments,'');};\n" +
    source + 'return __p;\n';

  var render;
  try {
    render = new Function(argument, '_', 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.
  template.source = 'function(' + argument + '){\n' + source + '}';

  return template;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/result.js



// Traverses the children of `obj` along `path`. If a child is a function, it
// is invoked with its parent as context. Returns the value of the final
// child, or `fallback` if any child is undefined.
function result_result(obj, path, fallback) {
  path = _toPath_toPath(path);
  var length = path.length;
  if (!length) {
    return modules_isFunction(fallback) ? fallback.call(obj) : fallback;
  }
  for (var i = 0; i < length; i++) {
    var prop = obj == null ? void 0 : obj[path[i]];
    if (prop === void 0) {
      prop = fallback;
      i = length; // Ensure we don't continue iterating.
    }
    obj = modules_isFunction(prop) ? prop.call(obj) : prop;
  }
  return obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/uniqueId.js
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
function uniqueId(prefix) {
  var id = ++idCounter + '';
  return prefix ? prefix + id : id;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/chain.js


// Start chaining a wrapped Underscore object.
function chain(obj) {
  var instance = _(obj);
  instance._chain = true;
  return instance;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_executeBound.js



// Internal function to execute `sourceFunc` bound to `context` with optional
// `args`. Determines whether to execute a function as a constructor or as a
// normal function.
function executeBound(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/partial.js




// 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 by default, allowing any combination of arguments to be
// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
var partial = restArguments(function(func, boundArgs) {
  var placeholder = partial.placeholder;
  var bound = function() {
    var position = 0, length = boundArgs.length;
    var args = Array(length);
    for (var i = 0; i < length; i++) {
      args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
    }
    while (position < arguments.length) args.push(arguments[position++]);
    return executeBound(func, bound, this, this, args);
  };
  return bound;
});

partial.placeholder = _;
/* harmony default export */ var modules_partial = (partial);

// CONCATENATED MODULE: ./node_modules/underscore/modules/bind.js




// Create a function bound to a given object (assigning `this`, and arguments,
// optionally).
/* harmony default export */ var bind = (restArguments(function(func, context, args) {
  if (!modules_isFunction(func)) throw new TypeError('Bind must be called on a function');
  var bound = restArguments(function(callArgs) {
    return executeBound(func, bound, context, this, args.concat(callArgs));
  });
  return bound;
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_isArrayLike.js



// Internal helper for collection methods to determine whether a collection
// should be iterated as an array or as an object.
// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
/* harmony default export */ var _isArrayLike = (createSizePropertyCheck(_getLength));

// CONCATENATED MODULE: ./node_modules/underscore/modules/_flatten.js





// Internal implementation of a recursive `flatten` function.
function flatten(input, depth, strict, output) {
  output = output || [];
  if (!depth && depth !== 0) {
    depth = Infinity;
  } else if (depth <= 0) {
    return output.concat(input);
  }
  var idx = output.length;
  for (var i = 0, length = _getLength(input); i < length; i++) {
    var value = input[i];
    if (_isArrayLike(value) && (isArray(value) || modules_isArguments(value))) {
      // Flatten current level of array or arguments object.
      if (depth > 1) {
        flatten(value, depth - 1, strict, output);
        idx = output.length;
      } else {
        var j = 0, len = value.length;
        while (j < len) output[idx++] = value[j++];
      }
    } else if (!strict) {
      output[idx++] = value;
    }
  }
  return output;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/bindAll.js




// 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.
/* harmony default export */ var bindAll = (restArguments(function(obj, keys) {
  keys = flatten(keys, false, false);
  var index = keys.length;
  if (index < 1) throw new Error('bindAll must be passed function names');
  while (index--) {
    var key = keys[index];
    obj[key] = bind(obj[key], obj);
  }
  return obj;
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/memoize.js


// Memoize an expensive function by storing its results.
function memoize_memoize(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/delay.js


// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
/* harmony default export */ var delay = (restArguments(function(func, wait, args) {
  return setTimeout(function() {
    return func.apply(null, args);
  }, wait);
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/defer.js




// Defers a function, scheduling it to run after the current call stack has
// cleared.
/* harmony default export */ var defer = (modules_partial(delay, _, 1));

// CONCATENATED MODULE: ./node_modules/underscore/modules/throttle.js


// 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.
function throttle(func, wait, options) {
  var timeout, context, args, result;
  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;
  };

  var throttled = 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;
  };

  throttled.cancel = function() {
    clearTimeout(timeout);
    previous = 0;
    timeout = context = args = null;
  };

  return throttled;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/debounce.js



// When a sequence of calls of the returned function ends, the argument
// function is triggered. The end of a sequence is defined by the `wait`
// parameter. If `immediate` is passed, the argument function will be
// triggered at the beginning of the sequence instead of at the end.
function debounce(func, wait, immediate) {
  var timeout, previous, args, result, context;

  var later = function() {
    var passed = now() - previous;
    if (wait > passed) {
      timeout = setTimeout(later, wait - passed);
    } else {
      timeout = null;
      if (!immediate) result = func.apply(context, args);
      // This check is needed because `func` can recursively invoke `debounced`.
      if (!timeout) args = context = null;
    }
  };

  var debounced = restArguments(function(_args) {
    context = this;
    args = _args;
    previous = now();
    if (!timeout) {
      timeout = setTimeout(later, wait);
      if (immediate) result = func.apply(context, args);
    }
    return result;
  });

  debounced.cancel = function() {
    clearTimeout(timeout);
    timeout = args = context = null;
  };

  return debounced;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/wrap.js


// 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.
function wrap(func, wrapper) {
  return modules_partial(wrapper, func);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/negate.js
// Returns a negated version of the passed-in predicate.
function negate(predicate) {
  return function() {
    return !predicate.apply(this, arguments);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/compose.js
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
function compose() {
  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;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/after.js
// Returns a function that will only be executed on and after the Nth call.
function after(times, func) {
  return function() {
    if (--times < 1) {
      return func.apply(this, arguments);
    }
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/before.js
// Returns a function that will only be executed up to (but not including) the
// Nth call.
function before(times, func) {
  var memo;
  return function() {
    if (--times > 0) {
      memo = func.apply(this, arguments);
    }
    if (times <= 1) func = null;
    return memo;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/once.js



// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
/* harmony default export */ var once = (modules_partial(before, 2));

// CONCATENATED MODULE: ./node_modules/underscore/modules/findKey.js



// Returns the first key on an object that passes a truth test.
function findKey(obj, predicate, context) {
  predicate = cb(predicate, context);
  var _keys = 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;
  }
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createPredicateIndexFinder.js



// Internal function to generate `_.findIndex` and `_.findLastIndex`.
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;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/findIndex.js


// Returns the first index on an array-like that passes a truth test.
/* harmony default export */ var findIndex = (createPredicateIndexFinder(1));

// CONCATENATED MODULE: ./node_modules/underscore/modules/findLastIndex.js


// Returns the last index on an array-like that passes a truth test.
/* harmony default export */ var findLastIndex = (createPredicateIndexFinder(-1));

// CONCATENATED MODULE: ./node_modules/underscore/modules/sortedIndex.js



// 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.
function sortedIndex_sortedIndex(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createIndexFinder.js




// Internal function to generate 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(_setup["q" /* slice */].call(array, i, length), isNaN_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;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/indexOf.js




// 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.
/* harmony default export */ var indexOf = (createIndexFinder(1, findIndex, sortedIndex_sortedIndex));

// CONCATENATED MODULE: ./node_modules/underscore/modules/lastIndexOf.js



// Return the position of the last occurrence of an item in an array,
// or -1 if the item is not included in the array.
/* harmony default export */ var lastIndexOf = (createIndexFinder(-1, findLastIndex));

// CONCATENATED MODULE: ./node_modules/underscore/modules/find.js




// Return the first value which passes a truth test.
function find(obj, predicate, context) {
  var keyFinder = _isArrayLike(obj) ? findIndex : findKey;
  var key = keyFinder(obj, predicate, context);
  if (key !== void 0 && key !== -1) return obj[key];
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/findWhere.js



// Convenience version of a common use case of `_.find`: getting the first
// object containing specific `key:value` pairs.
function findWhere(obj, attrs) {
  return find(obj, matcher_matcher(attrs));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/each.js




// The cornerstone for collection functions, an `each`
// implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
function each(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_keys(obj);
    for (i = 0, length = _keys.length; i < length; i++) {
      iteratee(obj[_keys[i]], _keys[i], obj);
    }
  }
  return obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/map.js




// Return the results of applying the iteratee to each element.
function map_map(obj, iteratee, context) {
  iteratee = cb(iteratee, context);
  var _keys = !_isArrayLike(obj) && keys_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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_createReduce.js




// Internal helper to create a reducing function, iterating left or right.
function createReduce(dir) {
  // Wrap code that reassigns argument variables in a separate function than
  // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
  var reducer = function(obj, iteratee, memo, initial) {
    var _keys = !_isArrayLike(obj) && keys_keys(obj),
        length = (_keys || obj).length,
        index = dir > 0 ? 0 : length - 1;
    if (!initial) {
      memo = obj[_keys ? _keys[index] : index];
      index += dir;
    }
    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) {
    var initial = arguments.length >= 3;
    return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/reduce.js


// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`.
/* harmony default export */ var reduce = (createReduce(1));

// CONCATENATED MODULE: ./node_modules/underscore/modules/reduceRight.js


// The right-associative version of reduce, also known as `foldr`.
/* harmony default export */ var reduceRight = (createReduce(-1));

// CONCATENATED MODULE: ./node_modules/underscore/modules/filter.js



// Return all the elements that pass a truth test.
function filter(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/reject.js




// Return all the elements for which a truth test fails.
function reject(obj, predicate, context) {
  return filter(obj, negate(cb(predicate)), context);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/every.js




// Determine whether all of the elements pass a truth test.
function every(obj, predicate, context) {
  predicate = cb(predicate, context);
  var _keys = !_isArrayLike(obj) && keys_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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/some.js




// Determine if at least one element in the object passes a truth test.
function some(obj, predicate, context) {
  predicate = cb(predicate, context);
  var _keys = !_isArrayLike(obj) && keys_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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/contains.js




// Determine if the array or object contains a given item (using `===`).
function contains(obj, item, fromIndex, guard) {
  if (!_isArrayLike(obj)) obj = values_values(obj);
  if (typeof fromIndex != 'number' || guard) fromIndex = 0;
  return indexOf(obj, item, fromIndex) >= 0;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/invoke.js






// Invoke a method (with arguments) on every item in a collection.
/* harmony default export */ var invoke = (restArguments(function(obj, path, args) {
  var contextPath, func;
  if (modules_isFunction(path)) {
    func = path;
  } else {
    path = _toPath_toPath(path);
    contextPath = path.slice(0, -1);
    path = path[path.length - 1];
  }
  return map_map(obj, function(context) {
    var method = func;
    if (!method) {
      if (contextPath && contextPath.length) {
        context = deepGet(context, contextPath);
      }
      if (context == null) return void 0;
      method = context[path];
    }
    return method == null ? method : method.apply(context, args);
  });
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/pluck.js



// Convenience version of a common use case of `_.map`: fetching a property.
function pluck(obj, key) {
  return map_map(obj, property(key));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/where.js



// Convenience version of a common use case of `_.filter`: selecting only
// objects containing specific `key:value` pairs.
function where(obj, attrs) {
  return filter(obj, matcher_matcher(attrs));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/max.js





// Return the maximum element (or element-based computation).
function max(obj, iteratee, context) {
  var result = -Infinity, lastComputed = -Infinity,
      value, computed;
  if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
    obj = _isArrayLike(obj) ? obj : values_values(obj);
    for (var i = 0, length = obj.length; i < length; i++) {
      value = obj[i];
      if (value != null && value > result) {
        result = value;
      }
    }
  } else {
    iteratee = cb(iteratee, context);
    each(obj, function(v, index, list) {
      computed = iteratee(v, index, list);
      if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
        result = v;
        lastComputed = computed;
      }
    });
  }
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/min.js





// Return the minimum element (or element-based computation).
function min(obj, iteratee, context) {
  var result = Infinity, lastComputed = Infinity,
      value, computed;
  if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
    obj = _isArrayLike(obj) ? obj : values_values(obj);
    for (var i = 0, length = obj.length; i < length; i++) {
      value = obj[i];
      if (value != null && value < result) {
        result = value;
      }
    }
  } else {
    iteratee = cb(iteratee, context);
    each(obj, function(v, index, list) {
      computed = iteratee(v, index, list);
      if (computed < lastComputed || computed === Infinity && result === Infinity) {
        result = v;
        lastComputed = computed;
      }
    });
  }
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/sample.js






// Sample **n** random values from a collection using the modern version of the
// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
// If **n** is not specified, returns a single random element.
// The internal `guard` argument allows it to work with `_.map`.
function sample_sample(obj, n, guard) {
  if (n == null || guard) {
    if (!_isArrayLike(obj)) obj = values_values(obj);
    return obj[random(obj.length - 1)];
  }
  var sample = _isArrayLike(obj) ? clone(obj) : values_values(obj);
  var length = _getLength(sample);
  n = Math.max(Math.min(n, length), 0);
  var last = length - 1;
  for (var index = 0; index < n; index++) {
    var rand = random(index, last);
    var temp = sample[index];
    sample[index] = sample[rand];
    sample[rand] = temp;
  }
  return sample.slice(0, n);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/shuffle.js


// Shuffle a collection.
function shuffle(obj) {
  return sample_sample(obj, Infinity);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/sortBy.js




// Sort the object's values by a criterion produced by an iteratee.
function sortBy(obj, iteratee, context) {
  var index = 0;
  iteratee = cb(iteratee, context);
  return pluck(map_map(obj, function(value, key, list) {
    return {
      value: value,
      index: index++,
      criteria: iteratee(value, key, 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');
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_group.js



// An internal function used for aggregate "group by" operations.
function group(behavior, partition) {
  return function(obj, iteratee, context) {
    var result = partition ? [[], []] : {};
    iteratee = cb(iteratee, context);
    each(obj, function(value, index) {
      var key = iteratee(value, index, obj);
      behavior(result, value, key);
    });
    return result;
  };
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/groupBy.js



// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
/* harmony default export */ var groupBy = (group(function(result, value, key) {
  if (has(result, key)) result[key].push(value); else result[key] = [value];
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/indexBy.js


// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
// when you know that your index values will be unique.
/* harmony default export */ var indexBy = (group(function(result, value, key) {
  result[key] = value;
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/countBy.js



// 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.
/* harmony default export */ var countBy = (group(function(result, value, key) {
  if (has(result, key)) result[key]++; else result[key] = 1;
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/partition.js


// Split a collection into two arrays: one whose elements all pass the given
// truth test, and one whose elements all do not pass the truth test.
/* harmony default export */ var modules_partition = (group(function(result, value, pass) {
  result[pass ? 0 : 1].push(value);
}, true));

// CONCATENATED MODULE: ./node_modules/underscore/modules/toArray.js








// Safely create a real, live array from anything iterable.
var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
function toArray(obj) {
  if (!obj) return [];
  if (isArray(obj)) return _setup["q" /* slice */].call(obj);
  if (isString(obj)) {
    // Keep surrogate pair characters together.
    return obj.match(reStrSymbol);
  }
  if (_isArrayLike(obj)) return map_map(obj, identity);
  return values_values(obj);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/size.js



// Return the number of elements in a collection.
function size(obj) {
  if (obj == null) return 0;
  return _isArrayLike(obj) ? obj.length : keys_keys(obj).length;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_keyInObj.js
// Internal `_.pick` helper function to determine whether `key` is an enumerable
// property name of `obj`.
function keyInObj(value, key, obj) {
  return key in obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/pick.js







// Return a copy of the object only containing the allowed properties.
/* harmony default export */ var pick = (restArguments(function(obj, keys) {
  var result = {}, iteratee = keys[0];
  if (obj == null) return result;
  if (modules_isFunction(iteratee)) {
    if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
    keys = allKeys(obj);
  } else {
    iteratee = keyInObj;
    keys = flatten(keys, false, false);
    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;
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/omit.js








// Return a copy of the object without the disallowed properties.
/* harmony default export */ var omit = (restArguments(function(obj, keys) {
  var iteratee = keys[0], context;
  if (modules_isFunction(iteratee)) {
    iteratee = negate(iteratee);
    if (keys.length > 1) context = keys[1];
  } else {
    keys = map_map(flatten(keys, false, false), String);
    iteratee = function(value, key) {
      return !contains(keys, key);
    };
  }
  return pick(obj, iteratee, context);
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/initial.js


// 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.
function initial_initial(array, n, guard) {
  return _setup["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/first.js


// Get the first element of an array. Passing **n** will return the first N
// values in the array. The **guard** check allows it to work with `_.map`.
function first(array, n, guard) {
  if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  if (n == null || guard) return array[0];
  return initial_initial(array, array.length - n);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/rest.js


// Returns everything but the first entry of the `array`. Especially useful on
// the `arguments` object. Passing an **n** will return the rest N values in the
// `array`.
function rest_rest(array, n, guard) {
  return _setup["q" /* slice */].call(array, n == null || guard ? 1 : n);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/last.js


// Get the last element of an array. Passing **n** will return the last N
// values in the array.
function last_last(array, n, guard) {
  if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  if (n == null || guard) return array[array.length - 1];
  return rest_rest(array, Math.max(0, array.length - n));
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/compact.js


// Trim out all falsy values from an array.
function compact(array) {
  return filter(array, Boolean);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/flatten.js


// Flatten out an array, either recursively (by default), or up to `depth`.
// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
function flatten_flatten(array, depth) {
  return flatten(array, depth, false);
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/difference.js





// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
/* harmony default export */ var difference = (restArguments(function(array, rest) {
  rest = flatten(rest, true, true);
  return filter(array, function(value){
    return !contains(rest, value);
  });
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/without.js



// Return a version of the array that does not contain the specified value(s).
/* harmony default export */ var without = (restArguments(function(array, otherArrays) {
  return difference(array, otherArrays);
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/uniq.js





// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// The faster algorithm will not work with an iteratee if the iteratee
// is not a one-to-one function, so providing an iteratee will disable
// the faster algorithm.
function uniq(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 && !iteratee) {
      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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/union.js




// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
/* harmony default export */ var union = (restArguments(function(arrays) {
  return uniq(flatten(arrays, true, true));
}));

// CONCATENATED MODULE: ./node_modules/underscore/modules/intersection.js



// Produce an array that contains every item shared between all the
// passed-in arrays.
function intersection(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;
    var j;
    for (j = 1; j < argsLength; j++) {
      if (!contains(arguments[j], item)) break;
    }
    if (j === argsLength) result.push(item);
  }
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/unzip.js




// Complement of zip. Unzip accepts an array of arrays and groups
// each array's elements on shared indices.
function unzip(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/zip.js



// Zip together multiple lists into a single array -- elements that share
// an index go together.
/* harmony default export */ var zip = (restArguments(unzip));

// CONCATENATED MODULE: ./node_modules/underscore/modules/object.js


// 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. Passing by pairs is the reverse of `_.pairs`.
function object_object(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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/range.js
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](https://docs.python.org/library/functions.html#range).
function range(start, stop, step) {
  if (stop == null) {
    stop = start || 0;
    start = 0;
  }
  if (!step) {
    step = stop < start ? -1 : 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;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/chunk.js


// Chunk a single array into multiple arrays, each containing `count` or fewer
// items.
function chunk(array, count) {
  if (count == null || count < 1) return [];
  var result = [];
  var i = 0, length = array.length;
  while (i < length) {
    result.push(_setup["q" /* slice */].call(array, i, i += count));
  }
  return result;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/_chainResult.js


// Helper function to continue chaining intermediate results.
function chainResult(instance, obj) {
  return instance._chain ? _(obj).chain() : obj;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/mixin.js






// Add your own custom functions to the Underscore object.
function mixin(obj) {
  each(functions(obj), function(name) {
    var func = _[name] = obj[name];
    _.prototype[name] = function() {
      var args = [this._wrapped];
      _setup["o" /* push */].apply(args, arguments);
      return chainResult(this, func.apply(_, args));
    };
  });
  return _;
}

// CONCATENATED MODULE: ./node_modules/underscore/modules/underscore-array-methods.js





// Add all mutator `Array` functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
  var method = _setup["a" /* ArrayProto */][name];
  _.prototype[name] = function() {
    var obj = this._wrapped;
    if (obj != null) {
      method.apply(obj, arguments);
      if ((name === 'shift' || name === 'splice') && obj.length === 0) {
        delete obj[0];
      }
    }
    return chainResult(this, obj);
  };
});

// Add all accessor `Array` functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
  var method = _setup["a" /* ArrayProto */][name];
  _.prototype[name] = function() {
    var obj = this._wrapped;
    if (obj != null) obj = method.apply(obj, arguments);
    return chainResult(this, obj);
  };
});

/* harmony default export */ var underscore_array_methods = (_);

// CONCATENATED MODULE: ./node_modules/underscore/modules/index.js
// Named Exports
// =============

//     Underscore.js 1.13.1
//     https://underscorejs.org
//     (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

// Baseline setup.



// Object Functions
// ----------------
// Our most fundamental functions operate on any JavaScript object.
// Most functions in Underscore depend on at least one function in this section.

// A group of functions that check the types of core JavaScript values.
// These are often informally referred to as the "isType" functions.



























// Functions that treat an object as a dictionary of key-value pairs.
















// Utility Functions
// -----------------
// A bit of a grab bag: Predicate-generating functions for use with filters and
// loops, string escaping and templating, create random numbers and unique ids,
// and functions that facilitate Underscore's chaining and iteration conventions.



















// Function (ahem) Functions
// -------------------------
// These functions take a function as an argument and return a new function
// as the result. Also known as higher-order functions.















// Finders
// -------
// Functions that extract (the position of) a single element from an object
// or array based on some criterion.









// Collection Functions
// --------------------
// Functions that work on any collection of elements: either an array, or
// an object of key-value pairs.
























// `_.pick` and `_.omit` are actually object functions, but we put
// them here in order to create a more natural reading order in the
// monolithic build as they depend on `_.contains`.



// Array Functions
// ---------------
// Functions that operate on arrays (and array-likes) only, because they’re
// expressed in terms of operations on an ordered list of values.

















// OOP
// ---
// These modules support the "object-oriented" calling style. See also
// `underscore.js` and `index-default.js`.



// CONCATENATED MODULE: ./node_modules/underscore/modules/index-default.js
// Default Export
// ==============
// In this module, we mix our bundled exports into the `_` object and export
// the result. This is analogous to setting `module.exports = _` in CommonJS.
// Hence, this module is also the entry point of our UMD bundle and the package
// entry point for CommonJS and AMD users. In other words, this is (the source
// of) the module you are interfacing with when you do any of the following:
//
// ```js
// // CommonJS
// var _ = require('underscore');
//
// // AMD
// define(['underscore'], function(_) {...});
//
// // UMD in the browser
// // _ is available as a global variable
// ```



// Add all of the Underscore functions to the wrapper object.
var index_default_ = mixin(modules_namespaceObject);
// Legacy Node.js API.
index_default_._ = index_default_;
// Export the Underscore API.
/* harmony default export */ var index_default = (index_default_);

// CONCATENATED MODULE: ./node_modules/underscore/modules/index-all.js
// ESM Exports
// ===========
// This module is the package entry point for ES module users. In other words,
// it is the module they are interfacing with when they import from the whole
// package instead of from a submodule, like this:
//
// ```js
// import { map } from 'underscore';
// ```
//
// The difference with `./index-default`, which is the package entry point for
// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
// default exports are considered to be siblings, so when you have a default
// export, its properties are not automatically available as named exports. For
// this reason, we re-export the named exports in addition to providing the same
// default export as in `./index-default`.




/***/ }),

/***/ "c584":
/***/ (function(module, exports) {

/**
 * Checks if a `cache` value for `key` exists.
 *
 * @private
 * @param {Object} cache The cache to query.
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function cacheHas(cache, key) {
  return cache.has(key);
}

module.exports = cacheHas;


/***/ }),

/***/ "c6b6":
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};


/***/ }),

/***/ "c6cd":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var setGlobal = __webpack_require__("ce4e");

var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});

module.exports = store;


/***/ }),

/***/ "c869":
/***/ (function(module, exports, __webpack_require__) {

var getNative = __webpack_require__("0b07"),
    root = __webpack_require__("2b3e");

/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');

module.exports = Set;


/***/ }),

/***/ "c8ba":
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || new Function("return this")();
} catch (e) {
	// This works if the window reference is available
	if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),

/***/ "ca84":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");
var toIndexedObject = __webpack_require__("fc6a");
var indexOf = __webpack_require__("4d64").indexOf;
var hiddenKeys = __webpack_require__("d012");

module.exports = function (object, names) {
  var O = toIndexedObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && result.push(key);
  // Don't enum bug & hidden keys
  while (names.length > i) if (hasOwn(O, key = names[i++])) {
    ~indexOf(result, key) || result.push(key);
  }
  return result;
};


/***/ }),

/***/ "cb5a":
/***/ (function(module, exports, __webpack_require__) {

var eq = __webpack_require__("9638");

/**
 * Gets the index at which the `key` is found in `array` of key-value pairs.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {*} key The key to search for.
 * @returns {number} Returns the index of the matched value, else `-1`.
 */
function assocIndexOf(array, key) {
  var length = array.length;
  while (length--) {
    if (eq(array[length][0], key)) {
      return length;
    }
  }
  return -1;
}

module.exports = assocIndexOf;


/***/ }),

/***/ "cc12":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isObject = __webpack_require__("861d");

var document = global.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document) && isObject(document.createElement);

module.exports = function (it) {
  return EXISTS ? document.createElement(it) : {};
};


/***/ }),

/***/ "cdf9":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var isObject = __webpack_require__("861d");
var newPromiseCapability = __webpack_require__("f069");

module.exports = function (C, x) {
  anObject(C);
  if (isObject(x) && x.constructor === C) return x;
  var promiseCapability = newPromiseCapability.f(C);
  var resolve = promiseCapability.resolve;
  resolve(x);
  return promiseCapability.promise;
};


/***/ }),

/***/ "ce4e":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = function (key, value) {
  try {
    // eslint-disable-next-line es/no-object-defineproperty -- safe
    Object.defineProperty(global, key, { value: value, configurable: true, writable: true });
  } catch (error) {
    global[key] = value;
  } return value;
};


/***/ }),

/***/ "d012":
/***/ (function(module, exports) {

module.exports = {};


/***/ }),

/***/ "d02c":
/***/ (function(module, exports, __webpack_require__) {

var ListCache = __webpack_require__("5e2e"),
    Map = __webpack_require__("79bc"),
    MapCache = __webpack_require__("7b83");

/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;

/**
 * Sets the stack `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Stack
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the stack cache instance.
 */
function stackSet(key, value) {
  var data = this.__data__;
  if (data instanceof ListCache) {
    var pairs = data.__data__;
    if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
      pairs.push([key, value]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache(pairs);
  }
  data.set(key, value);
  this.size = data.size;
  return this;
}

module.exports = stackSet;


/***/ }),

/***/ "d039":
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return !!exec();
  } catch (error) {
    return true;
  }
};


/***/ }),

/***/ "d066":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");

var aFunction = function (argument) {
  return isCallable(argument) ? argument : undefined;
};

module.exports = function (namespace, method) {
  return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
};


/***/ }),

/***/ "d1e7":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);

// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  var descriptor = getOwnPropertyDescriptor(this, V);
  return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;


/***/ }),

/***/ "d2bb":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable no-proto -- safe */
var anObject = __webpack_require__("825a");
var aPossiblePrototype = __webpack_require__("3bbe");

// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
// eslint-disable-next-line es/no-object-setprototypeof -- safe
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  var CORRECT_SETTER = false;
  var test = {};
  var setter;
  try {
    // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
    setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
    setter.call(test, []);
    CORRECT_SETTER = test instanceof Array;
  } catch (error) { /* empty */ }
  return function setPrototypeOf(O, proto) {
    anObject(O);
    aPossiblePrototype(proto);
    if (CORRECT_SETTER) setter.call(O, proto);
    else O.__proto__ = proto;
    return O;
  };
}() : undefined);


/***/ }),

/***/ "d327":
/***/ (function(module, exports) {

/**
 * This method returns a new empty array.
 *
 * @static
 * @memberOf _
 * @since 4.13.0
 * @category Util
 * @returns {Array} Returns the new empty array.
 * @example
 *
 * var arrays = _.times(2, _.stubArray);
 *
 * console.log(arrays);
 * // => [[], []]
 *
 * console.log(arrays[0] === arrays[1]);
 * // => false
 */
function stubArray() {
  return [];
}

module.exports = stubArray;


/***/ }),

/***/ "d370":
/***/ (function(module, exports, __webpack_require__) {

var baseIsArguments = __webpack_require__("253c"),
    isObjectLike = __webpack_require__("1310");

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;

/**
 * Checks if `value` is likely an `arguments` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
 *  else `false`.
 * @example
 *
 * _.isArguments(function() { return arguments; }());
 * // => true
 *
 * _.isArguments([1, 2, 3]);
 * // => false
 */
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
    !propertyIsEnumerable.call(value, 'callee');
};

module.exports = isArguments;


/***/ }),

/***/ "d3b7":
/***/ (function(module, exports, __webpack_require__) {

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var redefine = __webpack_require__("6eeb");
var toString = __webpack_require__("b041");

// `Object.prototype.toString` method
// https://tc39.es/ecma262/#sec-object.prototype.tostring
if (!TO_STRING_TAG_SUPPORT) {
  redefine(Object.prototype, 'toString', toString, { unsafe: true });
}


/***/ }),

/***/ "d44e":
/***/ (function(module, exports, __webpack_require__) {

var defineProperty = __webpack_require__("9bf2").f;
var hasOwn = __webpack_require__("1a2d");
var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');

module.exports = function (it, TAG, STATIC) {
  if (it && !hasOwn(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
    defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
  }
};


/***/ }),

/***/ "d4c3":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");
var global = __webpack_require__("da84");

module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;


/***/ }),

/***/ "d612":
/***/ (function(module, exports, __webpack_require__) {

var MapCache = __webpack_require__("7b83"),
    setCacheAdd = __webpack_require__("7ed2"),
    setCacheHas = __webpack_require__("dc0f");

/**
 *
 * Creates an array cache object to store unique values.
 *
 * @private
 * @constructor
 * @param {Array} [values] The values to cache.
 */
function SetCache(values) {
  var index = -1,
      length = values == null ? 0 : values.length;

  this.__data__ = new MapCache;
  while (++index < length) {
    this.add(values[index]);
  }
}

// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;

module.exports = SetCache;


/***/ }),

/***/ "d9b5":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var getBuiltIn = __webpack_require__("d066");
var USE_SYMBOL_AS_UID = __webpack_require__("fdbf");

module.exports = USE_SYMBOL_AS_UID ? function (it) {
  return typeof it == 'symbol';
} : function (it) {
  var $Symbol = getBuiltIn('Symbol');
  return isCallable($Symbol) && Object(it) instanceof $Symbol;
};


/***/ }),

/***/ "da03":
/***/ (function(module, exports, __webpack_require__) {

var root = __webpack_require__("2b3e");

/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];

module.exports = coreJsData;


/***/ }),

/***/ "da84":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  return it && it.Math == Math && it;
};

// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
  // eslint-disable-next-line es/no-global-this -- safe
  check(typeof globalThis == 'object' && globalThis) ||
  check(typeof window == 'object' && window) ||
  // eslint-disable-next-line no-restricted-globals -- safe
  check(typeof self == 'object' && self) ||
  check(typeof global == 'object' && global) ||
  // eslint-disable-next-line no-new-func -- fallback
  (function () { return this; })() || Function('return this')();

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "dc0f":
/***/ (function(module, exports) {

/**
 * Checks if `value` is in the array cache.
 *
 * @private
 * @name has
 * @memberOf SetCache
 * @param {*} value The value to search for.
 * @returns {number} Returns `true` if `value` is found, else `false`.
 */
function setCacheHas(value) {
  return this.__data__.has(value);
}

module.exports = setCacheHas;


/***/ }),

/***/ "dc4a":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");

// `GetMethod` abstract operation
// https://tc39.es/ecma262/#sec-getmethod
module.exports = function (V, P) {
  var func = V[P];
  return func == null ? undefined : aCallable(func);
};


/***/ }),

/***/ "dc57":
/***/ (function(module, exports) {

/** Used for built-in method references. */
var funcProto = Function.prototype;

/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;

/**
 * Converts `func` to its source code.
 *
 * @private
 * @param {Function} func The function to convert.
 * @returns {string} Returns the source code.
 */
function toSource(func) {
  if (func != null) {
    try {
      return funcToString.call(func);
    } catch (e) {}
    try {
      return (func + '');
    } catch (e) {}
  }
  return '';
}

module.exports = toSource;


/***/ }),

/***/ "df75":
/***/ (function(module, exports, __webpack_require__) {

var internalObjectKeys = __webpack_require__("ca84");
var enumBugKeys = __webpack_require__("7839");

// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
// eslint-disable-next-line es/no-object-keys -- safe
module.exports = Object.keys || function keys(O) {
  return internalObjectKeys(O, enumBugKeys);
};


/***/ }),

/***/ "e24b":
/***/ (function(module, exports, __webpack_require__) {

var hashClear = __webpack_require__("49f4"),
    hashDelete = __webpack_require__("1efc"),
    hashGet = __webpack_require__("bbc0"),
    hashHas = __webpack_require__("7a48"),
    hashSet = __webpack_require__("2524");

/**
 * Creates a hash object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function Hash(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;

module.exports = Hash;


/***/ }),

/***/ "e2cc":
/***/ (function(module, exports, __webpack_require__) {

var redefine = __webpack_require__("6eeb");

module.exports = function (target, src, options) {
  for (var key in src) redefine(target, key, src[key], options);
  return target;
};


/***/ }),

/***/ "e667":
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return { error: false, value: exec() };
  } catch (error) {
    return { error: true, value: error };
  }
};


/***/ }),

/***/ "e6cf":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var IS_PURE = __webpack_require__("c430");
var global = __webpack_require__("da84");
var getBuiltIn = __webpack_require__("d066");
var NativePromise = __webpack_require__("fea9");
var redefine = __webpack_require__("6eeb");
var redefineAll = __webpack_require__("e2cc");
var setPrototypeOf = __webpack_require__("d2bb");
var setToStringTag = __webpack_require__("d44e");
var setSpecies = __webpack_require__("2626");
var aCallable = __webpack_require__("59ed");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var anInstance = __webpack_require__("19aa");
var inspectSource = __webpack_require__("8925");
var iterate = __webpack_require__("2266");
var checkCorrectnessOfIteration = __webpack_require__("1c7e");
var speciesConstructor = __webpack_require__("4840");
var task = __webpack_require__("2cf4").set;
var microtask = __webpack_require__("b575");
var promiseResolve = __webpack_require__("cdf9");
var hostReportErrors = __webpack_require__("44de");
var newPromiseCapabilityModule = __webpack_require__("f069");
var perform = __webpack_require__("e667");
var InternalStateModule = __webpack_require__("69f3");
var isForced = __webpack_require__("94ca");
var wellKnownSymbol = __webpack_require__("b622");
var IS_BROWSER = __webpack_require__("6069");
var IS_NODE = __webpack_require__("605d");
var V8_VERSION = __webpack_require__("2d00");

var SPECIES = wellKnownSymbol('species');
var PROMISE = 'Promise';
var getInternalState = InternalStateModule.get;
var setInternalState = InternalStateModule.set;
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
var NativePromisePrototype = NativePromise && NativePromise.prototype;
var PromiseConstructor = NativePromise;
var PromiseConstructorPrototype = NativePromisePrototype;
var TypeError = global.TypeError;
var document = global.document;
var process = global.process;
var newPromiseCapability = newPromiseCapabilityModule.f;
var newGenericPromiseCapability = newPromiseCapability;
var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
var UNHANDLED_REJECTION = 'unhandledrejection';
var REJECTION_HANDLED = 'rejectionhandled';
var PENDING = 0;
var FULFILLED = 1;
var REJECTED = 2;
var HANDLED = 1;
var UNHANDLED = 2;
var SUBCLASSING = false;
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;

var FORCED = isForced(PROMISE, function () {
  var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
  var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
  // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  // We can't detect it synchronously, so just check versions
  if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  // We need Promise#finally in the pure version for preventing prototype pollution
  if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
  // We can't use @@species feature detection in V8 since it causes
  // deoptimization and performance degradation
  // https://github.com/zloirock/core-js/issues/679
  if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
  // Detect correctness of subclassing with @@species support
  var promise = new PromiseConstructor(function (resolve) { resolve(1); });
  var FakePromise = function (exec) {
    exec(function () { /* empty */ }, function () { /* empty */ });
  };
  var constructor = promise.constructor = {};
  constructor[SPECIES] = FakePromise;
  SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  if (!SUBCLASSING) return true;
  // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
});

var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
  PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
});

// helpers
var isThenable = function (it) {
  var then;
  return isObject(it) && isCallable(then = it.then) ? then : false;
};

var notify = function (state, isReject) {
  if (state.notified) return;
  state.notified = true;
  var chain = state.reactions;
  microtask(function () {
    var value = state.value;
    var ok = state.state == FULFILLED;
    var index = 0;
    // variable length - can't use forEach
    while (chain.length > index) {
      var reaction = chain[index++];
      var handler = ok ? reaction.ok : reaction.fail;
      var resolve = reaction.resolve;
      var reject = reaction.reject;
      var domain = reaction.domain;
      var result, then, exited;
      try {
        if (handler) {
          if (!ok) {
            if (state.rejection === UNHANDLED) onHandleUnhandled(state);
            state.rejection = HANDLED;
          }
          if (handler === true) result = value;
          else {
            if (domain) domain.enter();
            result = handler(value); // can throw
            if (domain) {
              domain.exit();
              exited = true;
            }
          }
          if (result === reaction.promise) {
            reject(TypeError('Promise-chain cycle'));
          } else if (then = isThenable(result)) {
            then.call(result, resolve, reject);
          } else resolve(result);
        } else reject(value);
      } catch (error) {
        if (domain && !exited) domain.exit();
        reject(error);
      }
    }
    state.reactions = [];
    state.notified = false;
    if (isReject && !state.rejection) onUnhandled(state);
  });
};

var dispatchEvent = function (name, promise, reason) {
  var event, handler;
  if (DISPATCH_EVENT) {
    event = document.createEvent('Event');
    event.promise = promise;
    event.reason = reason;
    event.initEvent(name, false, true);
    global.dispatchEvent(event);
  } else event = { promise: promise, reason: reason };
  if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
};

var onUnhandled = function (state) {
  task.call(global, function () {
    var promise = state.facade;
    var value = state.value;
    var IS_UNHANDLED = isUnhandled(state);
    var result;
    if (IS_UNHANDLED) {
      result = perform(function () {
        if (IS_NODE) {
          process.emit('unhandledRejection', value, promise);
        } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
      });
      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
      state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
      if (result.error) throw result.value;
    }
  });
};

var isUnhandled = function (state) {
  return state.rejection !== HANDLED && !state.parent;
};

var onHandleUnhandled = function (state) {
  task.call(global, function () {
    var promise = state.facade;
    if (IS_NODE) {
      process.emit('rejectionHandled', promise);
    } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  });
};

var bind = function (fn, state, unwrap) {
  return function (value) {
    fn(state, value, unwrap);
  };
};

var internalReject = function (state, value, unwrap) {
  if (state.done) return;
  state.done = true;
  if (unwrap) state = unwrap;
  state.value = value;
  state.state = REJECTED;
  notify(state, true);
};

var internalResolve = function (state, value, unwrap) {
  if (state.done) return;
  state.done = true;
  if (unwrap) state = unwrap;
  try {
    if (state.facade === value) throw TypeError("Promise can't be resolved itself");
    var then = isThenable(value);
    if (then) {
      microtask(function () {
        var wrapper = { done: false };
        try {
          then.call(value,
            bind(internalResolve, wrapper, state),
            bind(internalReject, wrapper, state)
          );
        } catch (error) {
          internalReject(wrapper, error, state);
        }
      });
    } else {
      state.value = value;
      state.state = FULFILLED;
      notify(state, false);
    }
  } catch (error) {
    internalReject({ done: false }, error, state);
  }
};

// constructor polyfill
if (FORCED) {
  // 25.4.3.1 Promise(executor)
  PromiseConstructor = function Promise(executor) {
    anInstance(this, PromiseConstructor, PROMISE);
    aCallable(executor);
    Internal.call(this);
    var state = getInternalState(this);
    try {
      executor(bind(internalResolve, state), bind(internalReject, state));
    } catch (error) {
      internalReject(state, error);
    }
  };
  PromiseConstructorPrototype = PromiseConstructor.prototype;
  // eslint-disable-next-line no-unused-vars -- required for `.length`
  Internal = function Promise(executor) {
    setInternalState(this, {
      type: PROMISE,
      done: false,
      notified: false,
      parent: false,
      reactions: [],
      rejection: false,
      state: PENDING,
      value: undefined
    });
  };
  Internal.prototype = redefineAll(PromiseConstructorPrototype, {
    // `Promise.prototype.then` method
    // https://tc39.es/ecma262/#sec-promise.prototype.then
    then: function then(onFulfilled, onRejected) {
      var state = getInternalPromiseState(this);
      var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
      reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
      reaction.fail = isCallable(onRejected) && onRejected;
      reaction.domain = IS_NODE ? process.domain : undefined;
      state.parent = true;
      state.reactions.push(reaction);
      if (state.state != PENDING) notify(state, false);
      return reaction.promise;
    },
    // `Promise.prototype.catch` method
    // https://tc39.es/ecma262/#sec-promise.prototype.catch
    'catch': function (onRejected) {
      return this.then(undefined, onRejected);
    }
  });
  OwnPromiseCapability = function () {
    var promise = new Internal();
    var state = getInternalState(promise);
    this.promise = promise;
    this.resolve = bind(internalResolve, state);
    this.reject = bind(internalReject, state);
  };
  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
    return C === PromiseConstructor || C === PromiseWrapper
      ? new OwnPromiseCapability(C)
      : newGenericPromiseCapability(C);
  };

  if (!IS_PURE && isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) {
    nativeThen = NativePromisePrototype.then;

    if (!SUBCLASSING) {
      // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
      redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
        var that = this;
        return new PromiseConstructor(function (resolve, reject) {
          nativeThen.call(that, resolve, reject);
        }).then(onFulfilled, onRejected);
      // https://github.com/zloirock/core-js/issues/640
      }, { unsafe: true });

      // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
      redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
    }

    // make `.constructor === Promise` work for native promise-based APIs
    try {
      delete NativePromisePrototype.constructor;
    } catch (error) { /* empty */ }

    // make `instanceof Promise` work for native promise-based APIs
    if (setPrototypeOf) {
      setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
    }
  }
}

$({ global: true, wrap: true, forced: FORCED }, {
  Promise: PromiseConstructor
});

setToStringTag(PromiseConstructor, PROMISE, false, true);
setSpecies(PROMISE);

PromiseWrapper = getBuiltIn(PROMISE);

// statics
$({ target: PROMISE, stat: true, forced: FORCED }, {
  // `Promise.reject` method
  // https://tc39.es/ecma262/#sec-promise.reject
  reject: function reject(r) {
    var capability = newPromiseCapability(this);
    capability.reject.call(undefined, r);
    return capability.promise;
  }
});

$({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {
  // `Promise.resolve` method
  // https://tc39.es/ecma262/#sec-promise.resolve
  resolve: function resolve(x) {
    return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
  }
});

$({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
  // `Promise.all` method
  // https://tc39.es/ecma262/#sec-promise.all
  all: function all(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var resolve = capability.resolve;
    var reject = capability.reject;
    var result = perform(function () {
      var $promiseResolve = aCallable(C.resolve);
      var values = [];
      var counter = 0;
      var remaining = 1;
      iterate(iterable, function (promise) {
        var index = counter++;
        var alreadyCalled = false;
        values.push(undefined);
        remaining++;
        $promiseResolve.call(C, promise).then(function (value) {
          if (alreadyCalled) return;
          alreadyCalled = true;
          values[index] = value;
          --remaining || resolve(values);
        }, reject);
      });
      --remaining || resolve(values);
    });
    if (result.error) reject(result.value);
    return capability.promise;
  },
  // `Promise.race` method
  // https://tc39.es/ecma262/#sec-promise.race
  race: function race(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var reject = capability.reject;
    var result = perform(function () {
      var $promiseResolve = aCallable(C.resolve);
      iterate(iterable, function (promise) {
        $promiseResolve.call(C, promise).then(capability.resolve, reject);
      });
    });
    if (result.error) reject(result.value);
    return capability.promise;
  }
});


/***/ }),

/***/ "e893":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");
var ownKeys = __webpack_require__("56ef");
var getOwnPropertyDescriptorModule = __webpack_require__("06cf");
var definePropertyModule = __webpack_require__("9bf2");

module.exports = function (target, source) {
  var keys = ownKeys(source);
  var defineProperty = definePropertyModule.f;
  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  }
};


/***/ }),

/***/ "e8b5":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("c6b6");

// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
// eslint-disable-next-line es/no-array-isarray -- safe
module.exports = Array.isArray || function isArray(argument) {
  return classof(argument) == 'Array';
};


/***/ }),

/***/ "e95a":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");
var Iterators = __webpack_require__("3f8c");

var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;

// check on default Array iterator
module.exports = function (it) {
  return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
};


/***/ }),

/***/ "eac5":
/***/ (function(module, exports) {

/** Used for built-in method references. */
var objectProto = Object.prototype;

/**
 * Checks if `value` is likely a prototype object.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
 */
function isPrototype(value) {
  var Ctor = value && value.constructor,
      proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;

  return value === proto;
}

module.exports = isPrototype;


/***/ }),

/***/ "ec69":
/***/ (function(module, exports, __webpack_require__) {

var arrayLikeKeys = __webpack_require__("6fcd"),
    baseKeys = __webpack_require__("03dd"),
    isArrayLike = __webpack_require__("30c9");

/**
 * Creates an array of the own enumerable property names of `object`.
 *
 * **Note:** Non-object values are coerced to objects. See the
 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
 * for more details.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keys(new Foo);
 * // => ['a', 'b'] (iteration order is not guaranteed)
 *
 * _.keys('hi');
 * // => ['0', '1']
 */
function keys(object) {
  return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}

module.exports = keys;


/***/ }),

/***/ "edfa":
/***/ (function(module, exports) {

/**
 * Converts `map` to its key-value pairs.
 *
 * @private
 * @param {Object} map The map to convert.
 * @returns {Array} Returns the key-value pairs.
 */
function mapToArray(map) {
  var index = -1,
      result = Array(map.size);

  map.forEach(function(value, key) {
    result[++index] = [key, value];
  });
  return result;
}

module.exports = mapToArray;


/***/ }),

/***/ "efb6":
/***/ (function(module, exports, __webpack_require__) {

var ListCache = __webpack_require__("5e2e");

/**
 * Removes all key-value entries from the stack.
 *
 * @private
 * @name clear
 * @memberOf Stack
 */
function stackClear() {
  this.__data__ = new ListCache;
  this.size = 0;
}

module.exports = stackClear;


/***/ }),

/***/ "f069":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var aCallable = __webpack_require__("59ed");

var PromiseCapability = function (C) {
  var resolve, reject;
  this.promise = new C(function ($$resolve, $$reject) {
    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
    resolve = $$resolve;
    reject = $$reject;
  });
  this.resolve = aCallable(resolve);
  this.reject = aCallable(reject);
};

// `NewPromiseCapability` abstract operation
// https://tc39.es/ecma262/#sec-newpromisecapability
module.exports.f = function (C) {
  return new PromiseCapability(C);
};


/***/ }),

/***/ "f5df":
/***/ (function(module, exports, __webpack_require__) {

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var isCallable = __webpack_require__("1626");
var classofRaw = __webpack_require__("c6b6");
var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
  try {
    return it[key];
  } catch (error) { /* empty */ }
};

// getting tag from ES6+ `Object.prototype.toString`
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  var O, tag, result;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
    // builtinTag case
    : CORRECT_ARGUMENTS ? classofRaw(O)
    // ES3 arguments fallback
    : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
};


/***/ }),

/***/ "f772":
/***/ (function(module, exports, __webpack_require__) {

var shared = __webpack_require__("5692");
var uid = __webpack_require__("90e3");

var keys = shared('keys');

module.exports = function (key) {
  return keys[key] || (keys[key] = uid(key));
};


/***/ }),

/***/ "fb15":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.

if (typeof window !== 'undefined') {
  var currentScript = window.document.currentScript
  if (true) {
    var getCurrentScript = __webpack_require__("8875")
    currentScript = getCurrentScript()

    // for backward compatibility, because previously we directly included the polyfill
    if (!('currentScript' in document)) {
      Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
    }
  }

  var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  if (src) {
    __webpack_require__.p = src[1] // eslint-disable-line
  }
}

// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.for-each.js
var es_array_for_each = __webpack_require__("4160");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
var web_dom_collections_for_each = __webpack_require__("159b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
var es_object_keys = __webpack_require__("b64b");

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e0955234-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./src/components/Deck/template.html?vue&type=template&id=7c43e7ac&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div')}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/components/Deck/template.html?vue&type=template&id=7c43e7ac&

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__("d3b7");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
var es_promise = __webpack_require__("e6cf");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js



function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  try {
    var info = gen[key](arg);
    var value = info.value;
  } catch (error) {
    reject(error);
    return;
  }

  if (info.done) {
    resolve(value);
  } else {
    Promise.resolve(value).then(_next, _throw);
  }
}

function _asyncToGenerator(fn) {
  return function () {
    var self = this,
        args = arguments;
    return new Promise(function (resolve, reject) {
      var gen = fn.apply(self, args);

      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }

      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }

      _next(undefined);
    });
  };
}
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
var runtime = __webpack_require__("96cf");

// EXTERNAL MODULE: ./node_modules/@deck.gl/jupyter-widget/dist/index.js
var dist = __webpack_require__("590b");

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/eslint-loader??ref--13-0!./src/components/Deck/script.js?vue&type=script&lang=js&



/* harmony default export */ var scriptvue_type_script_lang_js_ = ({
  name: 'Deck',
  props: {
    mapboxApiKey: {
      type: String
    },
    jsonInput: {
      type: Object
    },
    tooltip: {
      type: Boolean,
      "default": false
    },
    customLibraries: {
      type: Object
    }
  },
  watch: {
    jsonInput: function jsonInput() {
      var _this = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
        return regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.next = 2;
                return _this.mountVis();

              case 2:
              case "end":
                return _context.stop();
            }
          }
        }, _callee);
      }))();
    },
    opt: function opt() {
      var _this2 = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
        return regeneratorRuntime.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.next = 2;
                return _this2.mountVis();

              case 2:
              case "end":
                return _context2.stop();
            }
          }
        }, _callee2);
      }))();
    }
  },
  methods: {
    mountVis: function mountVis() {
      var _this3 = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
        var container, jsonInput, tooltip, customLibraries, mapboxApiKey;
        return regeneratorRuntime.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _this3.unmoutViz();

                if (_this3.jsonInput && _this3.$el) {
                  container = _this3.$el, jsonInput = _this3.jsonInput, tooltip = _this3.tooltip, customLibraries = _this3.customLibraries, mapboxApiKey = _this3.mapboxApiKey;
                  _this3.viz = Object(dist["createDeck"])({
                    container: container,
                    jsonInput: jsonInput,
                    tooltip: tooltip,
                    customLibraries: customLibraries,
                    mapboxApiKey: mapboxApiKey
                  });
                }

              case 2:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3);
      }))();
    },
    unmoutViz: function unmoutViz() {
      if (this.viz) {
        console.log(this.viz);
        this.viz = null;
      }
    }
  },
  mounted: function mounted() {
    var _this4 = this;

    return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
      return regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              _context4.next = 2;
              return _this4.mountVis();

            case 2:
            case "end":
              return _context4.stop();
          }
        }
      }, _callee4);
    }))();
  },
  beforeDestroy: function beforeDestroy() {
    this.unmoutViz();
  }
});
// CONCATENATED MODULE: ./src/components/Deck/script.js?vue&type=script&lang=js&
 /* harmony default export */ var Deck_scriptvue_type_script_lang_js_ = (scriptvue_type_script_lang_js_); 
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent (
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier, /* server only */
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options = typeof scriptExports === 'function'
    ? scriptExports.options
    : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) { // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
        injectStyles.call(
          this,
          (options.functional ? this.parent : this).$root.$options.shadowRoot
        )
      }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection (h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing
        ? [].concat(existing, hook)
        : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}

// CONCATENATED MODULE: ./src/components/Deck/index.vue





/* normalize component */

var component = normalizeComponent(
  Deck_scriptvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var Deck = (component.exports);
// CONCATENATED MODULE: ./src/components/index.js

/* harmony default export */ var components = ({
  Deck: Deck
});
// CONCATENATED MODULE: ./src/main.js




/* harmony default export */ var main = ({
  install: function install(Vue) {
    Object.keys(components).forEach(function (name) {
      Vue.component(name, components[name]);
    });
  }
});
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js


/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (main);



/***/ }),

/***/ "fba5":
/***/ (function(module, exports, __webpack_require__) {

var assocIndexOf = __webpack_require__("cb5a");

/**
 * Checks if a list cache value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf ListCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function listCacheHas(key) {
  return assocIndexOf(this.__data__, key) > -1;
}

module.exports = listCacheHas;


/***/ }),

/***/ "fc6a":
/***/ (function(module, exports, __webpack_require__) {

// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__("44ad");
var requireObjectCoercible = __webpack_require__("1d80");

module.exports = function (it) {
  return IndexedObject(requireObjectCoercible(it));
};


/***/ }),

/***/ "fdbc":
/***/ (function(module, exports) {

// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
module.exports = {
  CSSRuleList: 0,
  CSSStyleDeclaration: 0,
  CSSValueList: 0,
  ClientRectList: 0,
  DOMRectList: 0,
  DOMStringList: 0,
  DOMTokenList: 1,
  DataTransferItemList: 0,
  FileList: 0,
  HTMLAllCollection: 0,
  HTMLCollection: 0,
  HTMLFormElement: 0,
  HTMLSelectElement: 0,
  MediaList: 0,
  MimeTypeArray: 0,
  NamedNodeMap: 0,
  NodeList: 1,
  PaintRequestList: 0,
  Plugin: 0,
  PluginArray: 0,
  SVGLengthList: 0,
  SVGNumberList: 0,
  SVGPathSegList: 0,
  SVGPointList: 0,
  SVGStringList: 0,
  SVGTransformList: 0,
  SourceBufferList: 0,
  StyleSheetList: 0,
  TextTrackCueList: 0,
  TextTrackList: 0,
  TouchList: 0
};


/***/ }),

/***/ "fdbf":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable es/no-symbol -- required for testing */
var NATIVE_SYMBOL = __webpack_require__("4930");

module.exports = NATIVE_SYMBOL
  && !Symbol.sham
  && typeof Symbol.iterator == 'symbol';


/***/ }),

/***/ "fea9":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = global.Promise;


/***/ })

/******/ })["default"];
//# sourceMappingURL=vue-deck.common.js.map