diff --git a/dist/tangram.debug.js b/dist/tangram.debug.js index 358a92b95..7ecdb8899 100644 --- a/dist/tangram.debug.js +++ b/dist/tangram.debug.js @@ -2,7 +2,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.Tangram = factory()); -}(this, function () { 'use strict'; +}(this, (function () { 'use strict'; // define() gets called for each chunk generated by the first Rollup pass. // The order the chunks are called in is controlled by the imports in bundle.js: @@ -67,7 +67,7 @@ var store = _global[SHARED] || (_global[SHARED] = {}); return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: _core.version, - mode: 'global', + mode: 'global', copyright: '© 2019 Denis Pushkarev (zloirock.ru)' }); }); @@ -519,7 +519,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC // Set @@toStringTag to native iterators _setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines - if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); + if ( typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF @@ -528,7 +528,7 @@ var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORC $default = function values() { return $native.call(this); }; } // Define iterator - if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + if ( (BUGGY || VALUES_BUG || !proto[ITERATOR])) { _hide(proto, ITERATOR, $default); } // Plug for library @@ -576,37 +576,6 @@ _addToUnscopables('keys'); _addToUnscopables('values'); _addToUnscopables('entries'); -var f$1 = {}.propertyIsEnumerable; - -var _objectPie = { - f: f$1 -}; - -var isEnum = _objectPie.f; -var _objectToArray = function (isEntries) { - return function (it) { - var O = _toIobject(it); - var keys = _objectKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) if (isEnum.call(O, key = keys[i++])) { - result.push(isEntries ? [key, O[key]] : O[key]); - } return result; - }; -}; - -// https://github.com/tc39/proposal-object-values-entries - -var $entries = _objectToArray(true); - -_export(_export.S, 'Object', { - entries: function entries(it) { - return $entries(it); - } -}); - var ITERATOR$1 = _wks('iterator'); var TO_STRING_TAG = _wks('toStringTag'); var ArrayValues = _iterators.Array; @@ -659,6 +628,71 @@ for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; } } +// getting tag from 19.1.3.6 Object.prototype.toString() + +var TAG$1 = _wks('toStringTag'); +// ES3 wrong here +var ARG = _cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +var _classof = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T + // builtinTag case + : ARG ? _cof(O) + // ES3 arguments fallback + : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +// 19.1.3.6 Object.prototype.toString() + +var test = {}; +test[_wks('toStringTag')] = 'z'; +if (test + '' != '[object z]') { + _redefine(Object.prototype, 'toString', function toString() { + return '[object ' + _classof(this) + ']'; + }, true); +} + +var f$1 = {}.propertyIsEnumerable; + +var _objectPie = { + f: f$1 +}; + +var isEnum = _objectPie.f; +var _objectToArray = function (isEntries) { + return function (it) { + var O = _toIobject(it); + var keys = _objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) if (isEnum.call(O, key = keys[i++])) { + result.push(isEntries ? [key, O[key]] : O[key]); + } return result; + }; +}; + +// https://github.com/tc39/proposal-object-values-entries + +var $entries = _objectToArray(true); + +_export(_export.S, 'Object', { + entries: function entries(it) { + return $entries(it); + } +}); + var f$2 = Object.getOwnPropertySymbols; var _objectGops = { @@ -749,30 +783,6 @@ var _advanceStringIndex = function (S, index, unicode) { return index + (unicode ? at(S, index).length : 1); }; -// getting tag from 19.1.3.6 Object.prototype.toString() - -var TAG$1 = _wks('toStringTag'); -// ES3 wrong here -var ARG = _cof(function () { return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } -}; - -var _classof = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T - // builtinTag case - : ARG ? _cof(O) - // ES3 arguments fallback - : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; - var builtinExec = RegExp.prototype.exec; // `RegExpExec` abstract operation @@ -1067,125 +1077,153 @@ _fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { } }); -var _strictMethod = function (method, arg) { - return !!method && _fails(function () { - // eslint-disable-next-line no-useless-call - arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); - }); -}; +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} -var $sort = [].sort; -var test = [1, 2, 3]; +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} -_export(_export.P + _export.F * (_fails(function () { - // IE8- - test.sort(undefined); -}) || !_fails(function () { - // V8 bug - test.sort(null); - // Old WebKit -}) || !_strictMethod($sort)), 'Array', { - // 22.1.3.25 Array.prototype.sort(comparefn) - sort: function sort(comparefn) { - return comparefn === undefined - ? $sort.call(_toObject(this)) - : $sort.call(_toObject(this), _aFunction(comparefn)); +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; } -}); +} -var _meta = createCommonjsModule(function (module) { -var META = _uid('meta'); +function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); +} -var setDesc = _objectDp.f; -var id = 0; -var isExtensible = Object.isExtensible || function () { - return true; -}; -var FREEZE = !_fails(function () { - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function (it) { - setDesc(it, META, { value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - } }); -}; -var fastKey = function (it, create) { - // return primitive with prefix - if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; -}; -var getWeak = function (it, create) { - if (!_has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; -}; -// add metadata on freeze-family methods calling -var onFreeze = function (it) { - if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); - return it; -}; -var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze -}; -}); -var _meta_1 = _meta.KEY; -var _meta_2 = _meta.NEED; -var _meta_3 = _meta.fastKey; -var _meta_4 = _meta.getWeak; -var _meta_5 = _meta.onFreeze; +function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} -// 7.2.2 IsArray(argument) +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; -var _isArray = Array.isArray || function isArray(arg) { - return _cof(arg) == 'Array'; -}; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; -// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } -var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); -var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return _objectKeysInternal(O, hiddenKeys); -}; + _cache.set(Class, Wrapper); + } -var _objectGopn = { - f: f$3 -}; + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } -var gOPD = Object.getOwnPropertyDescriptor; + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; -var f$4 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = _toIobject(O); - P = _toPrimitive(P, true); - if (_ie8DomDefine) try { - return gOPD(O, P); - } catch (e) { /* empty */ } - if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); -}; + return _wrapNativeSuper(Class); +} -var _objectGopd = { - f: f$4 -}; +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[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."); + } + + it = o[Symbol.iterator](); + return it.next.bind(it); +} var $at = _stringAt(true); @@ -1452,12 +1490,12 @@ function PromiseCapability(C) { this.reject = _aFunction(reject); } -var f$5 = function (C) { +var f$3 = function (C) { return new PromiseCapability(C); }; var _newPromiseCapability = { - f: f$5 + f: f$3 }; var _perform = function (exec) { @@ -1502,6 +1540,8 @@ var SAFE_CLOSING = false; try { var riter = [7][ITERATOR$4](); riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); } catch (e) { /* empty */ } var _iterDetect = function (exec, skipClosing) { @@ -1742,10 +1782,10 @@ _export(_export.S + _export.F * !USE_NATIVE, PROMISE, { return capability.promise; } }); -_export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, { +_export(_export.S + _export.F * ( !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x) { - return _promiseResolve(_library && this === Wrapper ? $Promise : this, x); + return _promiseResolve( this, x); } }); _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) { @@ -1831,113 +1871,7 @@ _objectSap('keys', function () { }; }); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; -} - -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) _setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); -} - -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} - -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !_isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return _construct(Class, arguments, _getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return _setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); -} - -var version = "0.21.0"; +var version = "0.21.1"; var version$1 = 'v' + version; @@ -1958,7 +1892,7 @@ var LAST_INDEX$1 = 'lastIndex'; var MAX_UINT32 = 0xffffffff; // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError -var SUPPORTS_Y = !_fails(function () { }); +var SUPPORTS_Y = !_fails(function () { RegExp(MAX_UINT32, 'y'); }); // @@split logic _fixReWks('split', 2, function (defined, SPLIT, $split, maybeCallNative) { @@ -2981,6 +2915,21 @@ function mergeDebugSettings(settings) { Object.assign(debugSettings, settings); } +var gOPD = Object.getOwnPropertyDescriptor; + +var f$4 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = _toIobject(O); + P = _toPrimitive(P, true); + if (_ie8DomDefine) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); +}; + +var _objectGopd = { + f: f$4 +}; + // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ @@ -3016,6 +2965,18 @@ var _inheritIfRequired = function (that, target, C) { } return that; }; +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + +var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); + +var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return _objectKeysInternal(O, hiddenKeys); +}; + +var _objectGopn = { + f: f$5 +}; + var dP$2 = _objectDp.f; var gOPN = _objectGopn.f; @@ -3773,6 +3734,12 @@ exports[ARRAY_BUFFER] = $ArrayBuffer; exports[DATA_VIEW] = $DataView; }); +// 7.2.2 IsArray(argument) + +var _isArray = Array.isArray || function isArray(arg) { + return _cof(arg) == 'Array'; +}; + var SPECIES$3 = _wks('species'); var _arraySpeciesConstructor = function (original) { @@ -4349,9 +4316,7 @@ _typedArray('Uint8', 1, function (init) { }; }); -var Texture = -/*#__PURE__*/ -function () { +var Texture = /*#__PURE__*/function () { function Texture(gl, name, options) { if (options === void 0) { options = {}; @@ -5299,9 +5264,7 @@ var re_pragma = /^\s*#pragma.*$/gm; // for removing unused pragmas after shader var re_continue_line = /\\\s*\n/mg; // for removing backslash line continuations -var ShaderProgram = -/*#__PURE__*/ -function () { +var ShaderProgram = /*#__PURE__*/function () { function ShaderProgram(gl, vertex_source, fragment_source, options) { options = options || {}; this.gl = gl; @@ -6072,7 +6035,7 @@ var VertexArrayObject = { log('warn', 'Vertex Array Object extension force disabled'); } }, - getExtension: function getExtension$$1(gl, ext_name) { + getExtension: function getExtension$1(gl, ext_name) { if (this.disabled !== true) { return getExtension(gl, ext_name); } @@ -6657,6 +6620,67 @@ if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { _export(_export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); +var _meta = createCommonjsModule(function (module) { +var META = _uid('meta'); + + +var setDesc = _objectDp.f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !_fails(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!_has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!_has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; +}); +var _meta_1 = _meta.KEY; +var _meta_2 = _meta.NEED; +var _meta_3 = _meta.fastKey; +var _meta_4 = _meta.getWeak; +var _meta_5 = _meta.onFreeze; + // 19.1.2.5 Object.freeze(O) var meta = _meta.onFreeze; @@ -7582,9 +7606,7 @@ _export(_export.P, 'Array', { fill: _arrayFill }); _addToUnscopables('fill'); -var FeatureSelection = -/*#__PURE__*/ -function () { +var FeatureSelection = /*#__PURE__*/function () { function FeatureSelection(gl, workers, lock_fn) { this.gl = gl; this.workers = workers; // pool of workers to request feature look-ups from, keyed by id @@ -7999,9 +8021,7 @@ _typedArray('Uint16', 2, function (init) { }; }); -var VBOMesh = -/*#__PURE__*/ -function () { +var VBOMesh = /*#__PURE__*/function () { function VBOMesh(gl, vertex_data, element_data, vertex_layout, options) { options = options || {}; this.gl = gl; @@ -8162,9 +8182,7 @@ var material_source = "/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n var material_props = ['emission', 'ambient', 'diffuse', 'specular']; -var Material = -/*#__PURE__*/ -function () { +var Material = /*#__PURE__*/function () { function Material(config) { var _this = this; @@ -8296,6 +8314,30 @@ function () { }(); Material.block = 'material'; +var quot = /"/g; +// B.2.3.2.1 CreateHTML(string, tag, attribute, value) +var createHTML = function (string, tag, attribute, value) { + var S = String(_defined(string)); + var p1 = '<' + tag; + if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; + return p1 + '>' + S + ''; +}; +var _stringHtml = function (NAME, exec) { + var O = {}; + O[NAME] = exec(createHTML); + _export(_export.P + _export.F * _fails(function () { + var test = ''[NAME]('"'); + return test !== test.toLowerCase() || test.split('"').length > 3; + }), 'String', O); +}; + +// B.2.3.13 String.prototype.sub() +_stringHtml('sub', function (createHTML) { + return function sub() { + return createHTML(this, 'sub', '', ''); + }; +}); + /*** Vector functions - vectors provided as [x, y] or [x, y, z] arrays ***/ var Vector; var Vector$1 = Vector = {}; @@ -8526,9 +8568,7 @@ var point_source = "/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/ var spot_source = "/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n"; -var Light = -/*#__PURE__*/ -function () { +var Light = /*#__PURE__*/function () { function Light(view, config) { this.name = config.name; this.view = view; @@ -8645,9 +8685,7 @@ Light.block = 'lighting'; // shader block name Light.enabled = true; // lighting can be globally enabled/disabled // Light subclasses -var AmbientLight = -/*#__PURE__*/ -function (_Light) { +var AmbientLight = /*#__PURE__*/function (_Light) { _inheritsLoose(AmbientLight, _Light); function AmbientLight(view, config) { @@ -8675,9 +8713,7 @@ function (_Light) { Light.types['ambient'] = AmbientLight; -var DirectionalLight = -/*#__PURE__*/ -function (_Light2) { +var DirectionalLight = /*#__PURE__*/function (_Light2) { _inheritsLoose(DirectionalLight, _Light2); function DirectionalLight(view, config) { @@ -8734,9 +8770,7 @@ function (_Light2) { Light.types['directional'] = DirectionalLight; -var PointLight = -/*#__PURE__*/ -function (_Light3) { +var PointLight = /*#__PURE__*/function (_Light3) { _inheritsLoose(PointLight, _Light3); function PointLight(view, config) { @@ -8842,9 +8876,7 @@ function (_Light3) { Light.types['point'] = PointLight; -var SpotLight = -/*#__PURE__*/ -function (_PointLight) { +var SpotLight = /*#__PURE__*/function (_PointLight) { _inheritsLoose(SpotLight, _PointLight); function SpotLight(view, config) { @@ -8901,9 +8933,7 @@ _export(_export.S, 'Math', { } }); -var MethodNotImplemented = -/*#__PURE__*/ -function (_Error) { +var MethodNotImplemented = /*#__PURE__*/function (_Error) { _inheritsLoose(MethodNotImplemented, _Error); function MethodNotImplemented(methodName) { @@ -8916,11 +8946,9 @@ function (_Error) { } return MethodNotImplemented; -}(_wrapNativeSuper(Error)); +}( /*#__PURE__*/_wrapNativeSuper(Error)); -var DataSource = -/*#__PURE__*/ -function () { +var DataSource = /*#__PURE__*/function () { function DataSource(config, sources) { var _this = this; @@ -9206,9 +9234,7 @@ DataSource.types = {}; // set of supported data source classes, referenced by ty var network_request_id = 0; // used to namespace URL requests -var NetworkSource = -/*#__PURE__*/ -function (_DataSource) { +var NetworkSource = /*#__PURE__*/function (_DataSource) { _inheritsLoose(NetworkSource, _DataSource); function NetworkSource(source, sources) { @@ -9306,9 +9332,7 @@ function (_DataSource) { }(DataSource); /*** Generic network tile loading - abstract class ***/ -var NetworkTileSource = -/*#__PURE__*/ -function (_NetworkSource) { +var NetworkTileSource = /*#__PURE__*/function (_NetworkSource) { _inheritsLoose(NetworkTileSource, _NetworkSource); function NetworkTileSource(source, sources) { @@ -9657,9 +9681,7 @@ var TileID = { } }; -var RasterTileSource = -/*#__PURE__*/ -function (_NetworkTileSource) { +var RasterTileSource = /*#__PURE__*/function (_NetworkTileSource) { _inheritsLoose(RasterTileSource, _NetworkTileSource); function RasterTileSource(source, sources) { @@ -9775,9 +9797,7 @@ function (_NetworkTileSource) { // Currently, only axis-aligned, rectangular North-up images are supported // TODO: add support for arbitrarily rotated images and quadrangle control points -var RasterSource = -/*#__PURE__*/ -function (_RasterTileSource) { +var RasterSource = /*#__PURE__*/function (_RasterTileSource) { _inheritsLoose(RasterSource, _RasterTileSource); function RasterSource(source, sources) { @@ -10036,9 +10056,9 @@ var Style = { this.sources = sources; // data sources for scene - this.defines = this.hasOwnProperty('defines') && this.defines || {}; // #defines to be injected into the shaders + this.defines = Object.prototype.hasOwnProperty.call(this, 'defines') && this.defines || {}; // #defines to be injected into the shaders - this.shaders = this.hasOwnProperty('shaders') && this.shaders || {}; // shader customization (uniforms, defines, blocks, etc.) + this.shaders = Object.prototype.hasOwnProperty.call(this, 'shaders') && this.shaders || {}; // shader customization (uniforms, defines, blocks, etc.) this.introspection = introspection || false; this.selection = this.selection || this.introspection || false; // flag indicating if this style supports feature selection @@ -10164,8 +10184,6 @@ var Style = { } else { return $return(null); // don't send tile data back if doesn't have geometry } - - return $return(); }.bind(this)); }, // Has mesh data for a given tile? @@ -10731,7 +10749,7 @@ var Style = { } }, $Try_3_Catch); } catch (e) { - $Try_3_Catch(e); + $Try_3_Catch(); } }.bind(this)); }, @@ -10803,12 +10821,10 @@ var Style = { // Setup shader definitions for custom attributes setupCustomAttributes: function setupCustomAttributes() { if (this.shaders.attributes) { - var _arr = Object.entries(this.shaders.attributes); - - for (var _i = 0; _i < _arr.length; _i++) { - var _arr$_i = _arr[_i], - aname = _arr$_i[0], - attrib = _arr$_i[1]; + for (var _i = 0, _Object$entries = Object.entries(this.shaders.attributes); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _Object$entries[_i], + aname = _Object$entries$_i[0], + attrib = _Object$entries$_i[1]; // alias each custom attribute to the internal attribute name in vertex shader, // and internal varying name in fragment shader (if varying is enabled) @@ -10826,12 +10842,10 @@ var Style = { // Add custom attributes to a list of attributes for initializing a vertex layout addCustomAttributesToAttributeList: function addCustomAttributesToAttributeList(attribs) { if (this.shaders.attributes) { - var _arr2 = Object.entries(this.shaders.attributes); - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var _arr2$_i = _arr2[_i2], - aname = _arr2$_i[0], - attrib = _arr2$_i[1]; + for (var _i2 = 0, _Object$entries2 = Object.entries(this.shaders.attributes); _i2 < _Object$entries2.length; _i2++) { + var _Object$entries2$_i = _Object$entries2[_i2], + aname = _Object$entries2$_i[0], + attrib = _Object$entries2$_i[1]; if (attrib.type === 'float') { attribs.push({ @@ -10968,9 +10982,7 @@ _typedArray('Float32', 4, function (init) { var MAX_VALUE = Math.pow(2, 16) - 1; var has_element_index_uint = false; -var VertexElements = -/*#__PURE__*/ -function () { +var VertexElements = /*#__PURE__*/function () { function VertexElements() { this.array = []; this.has_overflown = false; @@ -11024,9 +11036,7 @@ var _array_types; var array_types = (_array_types = {}, _array_types[gl$1.FLOAT] = Float32Array, _array_types[gl$1.BYTE] = Int8Array, _array_types[gl$1.UNSIGNED_BYTE] = Uint8Array, _array_types[gl$1.INT] = Int32Array, _array_types[gl$1.UNSIGNED_INT] = Uint32Array, _array_types[gl$1.SHORT] = Int16Array, _array_types[gl$1.UNSIGNED_SHORT] = Uint16Array, _array_types); // An intermediary object that holds vertex data in typed arrays, according to a given vertex layout // Used to construct a mesh/VBO for rendering -var VertexData = -/*#__PURE__*/ -function () { +var VertexData = /*#__PURE__*/function () { function VertexData(vertex_layout, _temp) { var _ref = _temp === void 0 ? {} : _temp, _ref$prealloc = _ref.prealloc, @@ -11116,9 +11126,7 @@ function () { }(); VertexData.array_pool = []; // pool of currently available (previously used) buffers (uint8) -var VertexLayout = -/*#__PURE__*/ -function () { +var VertexLayout = /*#__PURE__*/function () { // Attribs are an array, in layout order, of: name, size, type, normalized // ex: { name: 'position', size: 3, type: gl.FLOAT, normalized: false } function VertexLayout(attribs) { @@ -11308,9 +11316,9 @@ var tile_bounds = [{ y: 0 }, { x: Geo$1.tile_scale, - y: -Geo$1.tile_scale // TODO: correct for flipped y-axis? - -}]; + y: -Geo$1.tile_scale +} // TODO: correct for flipped y-axis? +]; var default_uvs = [0, 0, 1, 1]; // Tests if a line segment (from point A to B) is outside the tile bounds // (within a certain tolerance to account for geometry nearly on tile edges) @@ -12376,7 +12384,7 @@ Object.assign(Polygons, { this.addCustomAttributesToVertexTemplate(style, i); return this.vertex_template; }, - buildPolygons: function buildPolygons$$1(polygons, style, context) { + buildPolygons: function buildPolygons$1(polygons, style, context) { var mesh = this.getTileMesh(context.tile, this.meshVariantTypeForDraw(style)); var vertex_data = mesh.vertex_data; var vertex_layout = vertex_data.vertex_layout; @@ -12400,30 +12408,6 @@ Object.assign(Polygons, { } }); -var quot = /"/g; -// B.2.3.2.1 CreateHTML(string, tag, attribute, value) -var createHTML = function (string, tag, attribute, value) { - var S = String(_defined(string)); - var p1 = '<' + tag; - if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; - return p1 + '>' + S + ''; -}; -var _stringHtml = function (NAME, exec) { - var O = {}; - O[NAME] = exec(createHTML); - _export(_export.P + _export.F * _fails(function () { - var test = ''[NAME]('"'); - return test !== test.toLowerCase() || test.split('"').length > 3; - }), 'String', O); -}; - -// B.2.3.13 String.prototype.sub() -_stringHtml('sub', function (createHTML) { - return function sub() { - return createHTML(this, 'sub', '', ''); - }; -}); - var zero_vec2 = [0, 0]; // Build tessellated triangles for a polyline var CAP_TYPE = { @@ -13791,18 +13775,6 @@ Object.assign(Lines, { } }); -_export(_export.P + _export.F * _fails(function () { - return new Date(NaN).toJSON() !== null - || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; -}), 'Date', { - // eslint-disable-next-line no-unused-vars - toJSON: function toJSON(key) { - var O = _toObject(this); - var pv = _toPrimitive(O); - return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); - } -}); - // B.2.3.2 String.prototype.anchor(name) _stringHtml('anchor', function (createHTML) { return function anchor(name) { @@ -14001,9 +13973,7 @@ var proj_a = [], proj_b = []; var d0, d1, d2, d3; -var OBB = -/*#__PURE__*/ -function () { +var OBB = /*#__PURE__*/function () { function OBB(x, y, a, w, h) { this.dimension = [w / 2, h / 2]; // store half-dimension as that's what's needed in calculations below @@ -14117,9 +14087,7 @@ function () { return OBB; }(); -var Label = -/*#__PURE__*/ -function () { +var Label = /*#__PURE__*/function () { function Label(size, layout) { if (layout === void 0) { layout = {}; @@ -14287,9 +14255,7 @@ function textLayoutToJSON(layout) { }; } -var RepeatGroup = -/*#__PURE__*/ -function () { +var RepeatGroup = /*#__PURE__*/function () { function RepeatGroup(key, repeat_dist) { this.key = key; this.repeat_dist = repeat_dist; @@ -14352,9 +14318,7 @@ function () { }(); // Current set of repeat groups, grouped and keyed by tile RepeatGroup.groups = {}; -var CollisionGrid = -/*#__PURE__*/ -function () { +var CollisionGrid = /*#__PURE__*/function () { function CollisionGrid(anchor, span) { this.anchor = anchor; this.span = span; @@ -14661,9 +14625,7 @@ var Collision = { } }; -var LabelPoint = -/*#__PURE__*/ -function (_Label) { +var LabelPoint = /*#__PURE__*/function (_Label) { _inheritsLoose(LabelPoint, _Label); function LabelPoint(position, size, layout, angle) { @@ -15070,7 +15032,7 @@ this.f.style.cssText="max-width:none;display:inline-block;position:absolute;heig function x(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+b+";";}function y(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function z(a,b){function c(){var a=l;y(a)&&a.a.parentNode&&b(a.g);}var l=a;m(a.b,c);m(a.c,c);y(a);}function A(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal";}var B=null,C=null,E=null,F=null;function I(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif";}catch(b){}E=""!==a.style.font;}return E}function J(a,b){return [a.style,a.weight,I()?a.stretch:"","100px",b].join(" ")} A.prototype.load=function(a,b){var c=this,l=a||"BESbswy",r=0,D=b||3E3,G=(new Date).getTime();return new Promise(function(a,b){var e;null===F&&(F=!!document.fonts);if(e=F)null===C&&(C=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),e=!C;if(e){e=new Promise(function(a,b){function f(){(new Date).getTime()-G>=D?b():document.fonts.load(J(c,'"'+c.family+'"'),l).then(function(c){1<=c.length?a():setTimeout(f,25);},function(){b();});}f();});var K=new Promise(function(a, c){r=setTimeout(c,D);});Promise.race([K,e]).then(function(){clearTimeout(r);a(c);},function(){b(c);});}else n(function(){function e(){var b;if(b=-1!=g&&-1!=h||-1!=g&&-1!=k||-1!=h&&-1!=k)(b=g!=h&&g!=k&&h!=k)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(g==u&&h==u&&k==u||g==v&&h==v&&k==v||g==w&&h==w&&k==w)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(r),a(c));} -function H(){if((new Date).getTime()-G>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)g=f.a.offsetWidth,h=p.a.offsetWidth,k=q.a.offsetWidth,e();r=setTimeout(H,50);}}var f=new t(l),p=new t(l),q=new t(l),g=-1,h=-1,k=-1,u=-1,v=-1,w=-1,d=document.createElement("div");d.dir="ltr";x(f,J(c,"sans-serif"));x(p,J(c,"serif"));x(q,J(c,"monospace"));d.appendChild(f.a);d.appendChild(p.a);d.appendChild(q.a);document.body.appendChild(d);u=f.a.offsetWidth;v=p.a.offsetWidth; +function H(){if((new Date).getTime()-G>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else {var a=document.hidden;if(!0===a||void 0===a)g=f.a.offsetWidth,h=p.a.offsetWidth,k=q.a.offsetWidth,e();r=setTimeout(H,50);}}var f=new t(l),p=new t(l),q=new t(l),g=-1,h=-1,k=-1,u=-1,v=-1,w=-1,d=document.createElement("div");d.dir="ltr";x(f,J(c,"sans-serif"));x(p,J(c,"serif"));x(q,J(c,"monospace"));d.appendChild(f.a);d.appendChild(p.a);d.appendChild(q.a);document.body.appendChild(d);u=f.a.offsetWidth;v=p.a.offsetWidth; w=q.a.offsetWidth;H();z(f,function(a){g=a;e();});x(f,J(c,'"'+c.family+'",sans-serif'));z(p,function(a){h=a;e();});x(p,J(c,'"'+c.family+'",serif'));z(q,function(a){k=a;e();});x(q,J(c,'"'+c.family+'",monospace'));});})};module.exports=A;}()); }); @@ -15328,7 +15290,8 @@ var accents_and_vowels = "[\u0300-\u036F" + // Combining Diacritical Marks ']'; var combo_characters = "[\u094D\u09CD\u0A4D\u0ACD\u0B4D\u0C4D\u0CCD\u0D4D\u0F84\u1039\u17D2\u1A60\u1A7F]"; // Find the next grapheme cluster (non-Arabic) -var grapheme_match = new RegExp('^.(?:' + accents_and_vowels + '+)?' + '(' + combo_characters + '\\W(?:' + accents_and_vowels + '+)?)*'); // Scripts that cannot be curved due (due to contextual shaping and/or layout complexity) +var grapheme_match = new RegExp("^.(?:" + accents_and_vowels + "+)?(" + combo_characters + "\\W(?:" + accents_and_vowels + "+)?)*"); // eslint-disable-line no-misleading-character-class +// Scripts that cannot be curved due (due to contextual shaping and/or layout complexity) var curve_blacklist = { Mongolian: "\u1800-\u18AF" @@ -15414,9 +15377,7 @@ function splitLabelText(text, rtl, cache) { // "text wrap" and "max line" values -var MultiLine = -/*#__PURE__*/ -function () { +var MultiLine = /*#__PURE__*/function () { function MultiLine(context, max_lines, text_wrap) { if (max_lines === void 0) { max_lines = Infinity; @@ -15562,9 +15523,7 @@ function () { MultiLine.ellipsis = '...'; // A Private class used by MultiLine to contain the logic for a single line // including character count, width, height and text -var Line = -/*#__PURE__*/ -function () { +var Line = /*#__PURE__*/function () { function Line(height, text_wrap) { if (height === void 0) { height = 0; @@ -15594,9 +15553,7 @@ function () { return Line; }(); -var TextCanvas = -/*#__PURE__*/ -function () { +var TextCanvas = /*#__PURE__*/function () { function TextCanvas() { this.createCanvas(); // create initial canvas and context @@ -16520,7 +16477,7 @@ var TextLabels = { } }.bind(this), $Try_1_Catch); } catch (e) { - $Try_1_Catch(e); + $Try_1_Catch(); } }.bind(this)); }, @@ -16572,6 +16529,14 @@ var TextLabels = { } }); // second call to main thread, for rasterizing the set of texts + var $Try_2_Post = function () { + try { + return $return(); + } catch ($boundEx) { + return $error($boundEx); + } + }; + var $Try_2_Catch = function (e) { try { // error thrown if style has been removed from main thread @@ -17191,9 +17156,7 @@ var mat4 = { copy: copy_1 }; -var Camera = -/*#__PURE__*/ -function () { +var Camera = /*#__PURE__*/function () { function Camera(name, view, options) { if (options === void 0) { options = {}; @@ -17267,9 +17230,7 @@ function () { return Camera; }(); -var PerspectiveCamera = -/*#__PURE__*/ -function (_Camera) { +var PerspectiveCamera = /*#__PURE__*/function (_Camera) { _inheritsLoose(PerspectiveCamera, _Camera); function PerspectiveCamera(name, view, options) { @@ -17403,9 +17364,7 @@ function (_Camera) { // straight upwards on screen at their true height, [0, .5] would draw them up at half-height, [1, 0] would be sideways, etc. -var IsometricCamera = -/*#__PURE__*/ -function (_Camera2) { +var IsometricCamera = /*#__PURE__*/function (_Camera2) { _inheritsLoose(IsometricCamera, _Camera2); function IsometricCamera(name, view, options) { @@ -17471,9 +17430,7 @@ function (_Camera2) { }(Camera); // Flat projection (e.g. just top-down, no perspective) - a degenerate isometric camera -var FlatCamera = -/*#__PURE__*/ -function (_IsometricCamera) { +var FlatCamera = /*#__PURE__*/function (_IsometricCamera) { _inheritsLoose(FlatCamera, _IsometricCamera); function FlatCamera(name, view, options) { @@ -17503,9 +17460,7 @@ function (_IsometricCamera) { var VIEW_PAN_SNAP_TIME = 0.5; -var View = -/*#__PURE__*/ -function () { +var View = /*#__PURE__*/function () { function View(scene, options) { subscribeMixin(this); this.scene = scene; @@ -18126,7 +18081,7 @@ Object.assign(Points, { // Override endData: function endData(tile) { return new Promise(function ($return, $error) { - var _this, queue, text_objs, point_objs, _ref, _ref$, labels, texts, textures, tile_data, _tile_data$textures; + var _this, queue, text_objs, point_objs, _await$Promise$all, _await$Promise$all$, labels, texts, textures, tile_data, _tile_data$textures; _this = this; @@ -18192,7 +18147,7 @@ Object.assign(Points, { }), // Labels this.collideAndRenderTextLabels(tile, this.collision_group_text, text_objs)])).then(function ($await_2) { try { - _ref = $await_2, _ref$ = _ref[1], labels = _ref$.labels, texts = _ref$.texts, textures = _ref$.textures; + _await$Promise$all = $await_2, _await$Promise$all$ = _await$Promise$all[1], labels = _await$Promise$all$.labels, texts = _await$Promise$all$.texts, textures = _await$Promise$all$.textures; // Process labels if (labels && texts) { @@ -18890,9 +18845,7 @@ var LabelLine = { } }; -var LabelLineBase = -/*#__PURE__*/ -function () { +var LabelLineBase = /*#__PURE__*/function () { function LabelLineBase(layout) { this.id = Label.nextLabelId(); this.layout = layout; @@ -19074,9 +19027,7 @@ function () { }(); // Class for straight labels. // Extends base LabelLine class. -var LabelLineStraight = -/*#__PURE__*/ -function (_LabelLineBase) { +var LabelLineStraight = /*#__PURE__*/function (_LabelLineBase) { _inheritsLoose(LabelLineStraight, _LabelLineBase); function LabelLineStraight(size, line, layout, tolerance) { @@ -19197,9 +19148,7 @@ function (_LabelLineBase) { }(LabelLineBase); // Class for curved labels // Extends base LabelLine class to support angles, pre_angles, offsets as arrays for each segment -var LabelLineCurved = -/*#__PURE__*/ -function (_LabelLineBase2) { +var LabelLineCurved = /*#__PURE__*/function (_LabelLineBase2) { _inheritsLoose(LabelLineCurved, _LabelLineBase2); function LabelLineCurved(segment_sizes, line, layout) { @@ -19711,14 +19660,14 @@ Object.assign(TextStyle, { // Override endData: function endData(tile) { return new Promise(function ($return, $error) { - var _this2, queue, _ref, labels, texts, textures, tile_data, _tile_data$textures; + var _this2, queue, _await$this$collideAn, labels, texts, textures, tile_data, _tile_data$textures; _this2 = this; queue = this.queues[tile.id]; delete this.queues[tile.id]; return Promise.resolve(this.collideAndRenderTextLabels(tile, this.name, queue)).then(function ($await_1) { try { - _ref = $await_1, labels = _ref.labels, texts = _ref.texts, textures = _ref.textures; + _await$this$collideAn = $await_1, labels = _await$this$collideAn.labels, texts = _await$this$collideAn.texts, textures = _await$this$collideAn.textures; if (labels && texts) { this.texts[tile.id] = texts; // Build queued features @@ -19986,9 +19935,7 @@ var selection_globals_source = "// Vertex attribute + varying for feature select var selection_vertex_source = "// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"; -var StyleManager = -/*#__PURE__*/ -function () { +var StyleManager = /*#__PURE__*/function () { function StyleManager() { this.styles = {}; this.base_styles = {}; @@ -20180,12 +20127,12 @@ function () { }).pop(); if (sources.some(function (x) { - return x.hasOwnProperty('blend') && x.blend; + return Object.prototype.hasOwnProperty.call(x, 'blend') && x.blend; })) { // only mix blend if explicitly set, otherwise let base style choose blending mode // hasOwnProperty check gives preference to base style prototype style.blend = sources.map(function (x) { - return x.hasOwnProperty('blend') && x.blend; + return Object.prototype.hasOwnProperty.call(x, 'blend') && x.blend; }).filter(function (x) { return x; }).pop(); @@ -20415,11 +20362,11 @@ function () { var blends = ['opaque', 'add', 'multiply', 'overlay', 'inlay', 'translucent']; var bases = ['polygons', 'lines', 'points', 'text', 'raster']; - for (var _i = 0; _i < blends.length; _i++) { - var blend = blends[_i]; + for (var _i = 0, _blends = blends; _i < _blends.length; _i++) { + var blend = _blends[_i]; - for (var _i2 = 0; _i2 < bases.length; _i2++) { - var base = bases[_i2]; + for (var _iterator = _createForOfIteratorHelperLoose(bases), _step; !(_step = _iterator()).done;) { + var base = _step.value; var style = blend + '_' + base; if (styles[style] == null) { @@ -20685,10 +20632,10 @@ function parseFilter(filter, options) { if (value.max || value.min) { filterAST.push(rangeMatch(key, value, options)); } else if (value.includes_any || value.includes_all) { - filterAST.push(includesMatch(key, value, options)); + filterAST.push(includesMatch(key, value)); } } else if (value == null) { - filterAST.push(nullValue(key, value)); + filterAST.push(nullValue()); } else { throw new Error('Unknown Query syntax: ' + value); } @@ -20786,9 +20733,7 @@ function mergeTrees(matchingTrees, group) { } var blacklist = ['any', 'all', 'not', 'none']; -var Layer = -/*#__PURE__*/ -function () { +var Layer = /*#__PURE__*/function () { function Layer(_ref) { var layer = _ref.layer, name = _ref.name, @@ -20846,7 +20791,7 @@ function () { this.calculatedDraw = calculateDraw(this); }; - _proto.buildFilter = function buildFilter$$1() { + _proto.buildFilter = function buildFilter$1() { this.filter_original = this.filter; this.filter = compileFunctionStrings(this.filter, StyleParser.wrapFunction); var type = typeof this.filter; @@ -21020,9 +20965,7 @@ function () { }(); Layer.id = 0; -var LayerLeaf = -/*#__PURE__*/ -function (_Layer) { +var LayerLeaf = /*#__PURE__*/function (_Layer) { _inheritsLoose(LayerLeaf, _Layer); function LayerLeaf(config) { @@ -21035,9 +20978,7 @@ function (_Layer) { return LayerLeaf; }(Layer); -var LayerTree = -/*#__PURE__*/ -function (_Layer2) { +var LayerTree = /*#__PURE__*/function (_Layer2) { _inheritsLoose(LayerTree, _Layer2); function LayerTree(config) { @@ -21293,13 +21234,11 @@ function matchFeature(context, layers, collected_layers, collected_layers_ids) { return matched; } -var id$2 = 0; // unique tile id +var id$1 = 0; // unique tile id var build_id = 0; // id tracking order in which tiles were build -var Tile = -/*#__PURE__*/ -function () { +var Tile = /*#__PURE__*/function () { /** Tile @constructor @@ -21313,7 +21252,7 @@ function () { source = _ref.source, workers = _ref.workers, view = _ref.view; - this.id = id$2++; + this.id = id$1++; this.view = view; this.source = source; this.generation = null; @@ -23398,9 +23337,7 @@ var PARSE_JSON_TEST = ['{', '[']; // one-time allocated array/strings @class MVTSource */ -var MVTSource = -/*#__PURE__*/ -function (_NetworkTileSource) { +var MVTSource = /*#__PURE__*/function (_NetworkTileSource) { _inheritsLoose(MVTSource, _NetworkTileSource); function MVTSource(source, sources) { @@ -24483,9 +24420,7 @@ function extend(dest, src) { Uses geojson-vt split into tiles client-side */ -var GeoJSONSource = -/*#__PURE__*/ -function (_NetworkSource) { +var GeoJSONSource = /*#__PURE__*/function (_NetworkSource) { _inheritsLoose(GeoJSONSource, _NetworkSource); function GeoJSONSource(source, sources) { @@ -24715,9 +24650,7 @@ function (_NetworkSource) { @class GeoJSONTileSource */ -var GeoJSONTileSource = -/*#__PURE__*/ -function (_NetworkTileSource) { +var GeoJSONTileSource = /*#__PURE__*/function (_NetworkTileSource) { _inheritsLoose(GeoJSONTileSource, _NetworkTileSource); function GeoJSONTileSource(source, sources) { @@ -24876,22 +24809,12 @@ function object(topology, o) { return geometry(o); } -// export {default as bbox} from "./src/bbox"; -// export {default as mesh, meshArcs} from "./src/mesh"; -// export {default as merge, mergeArcs} from "./src/merge"; -// export {default as neighbors} from "./src/neighbors"; -// export {default as quantize} from "./src/quantize"; -// export {default as transform} from "./src/transform"; -// export {default as untransform} from "./src/untransform"; - /** TopoJSON standalone (non-tiled) source Uses geojson-vt split into tiles client-side */ -var TopoJSONSource = -/*#__PURE__*/ -function (_GeoJSONSource) { +var TopoJSONSource = /*#__PURE__*/function (_GeoJSONSource) { _inheritsLoose(TopoJSONSource, _GeoJSONSource); function TopoJSONSource() { @@ -24950,9 +24873,7 @@ function getTopoJSONFeature(topology, object) { */ -var TopoJSONTileSource = -/*#__PURE__*/ -function (_GeoJSONTileSource) { +var TopoJSONTileSource = /*#__PURE__*/function (_GeoJSONTileSource) { _inheritsLoose(TopoJSONTileSource, _GeoJSONTileSource); function TopoJSONTileSource(source, sources) { @@ -24974,99 +24895,71 @@ DataSource.register('TopoJSON', function (source) { return TopoJSONTileSource.urlHasTilePattern(source.url) ? TopoJSONTileSource : TopoJSONSource; }); -// add all data source types - -exports.require$$0 = _wks; -exports.require$$1 = _core; -exports.global = _global; -exports.require$$1$1 = _objectDp; -exports.getKeys = _objectKeys; -exports.gOPS = _objectGops; -exports.pIE = _objectPie; -exports.toIObject = _toIobject; -exports.require$$0$1 = _objectGopn; -exports.require$$0$2 = _meta; -exports.require$$0$3 = _shared; -exports.DESCRIPTORS = _descriptors; -exports.fails = _fails; -exports.require$$22 = _objectCreate; -exports.uid = _uid; -exports.redefine = _redefine; -exports.LIBRARY = _library; -exports.$export = _export; -exports.require$$17 = _has; -exports.isObject = _isObject; -exports.isArray = _isArray; -exports.hide = _hide; -exports.setToStringTag = _setToStringTag; -exports.require$$1$2 = _objectGopd; -exports.anObject = _anObject; -exports.require$$16 = _toPrimitive; -exports.require$$9 = _propertyDesc; -exports.createCommonjsModule = createCommonjsModule; -exports.commonjsRequire = commonjsRequire; -exports.Utils = Utils; -exports.isRelativeURL = isRelativeURL; -exports.addBaseURL = addBaseURL; -exports.pathForURL = pathForURL; -exports.extensionForURL = extensionForURL; -exports._inheritsLoose = _inheritsLoose; -exports.flattenRelativeURL = flattenRelativeURL; -exports.createObjectURL = createObjectURL; -exports.isLocalURL = isLocalURL; -exports.subscribeMixin = subscribeMixin; -exports.log = log; -exports.mergeObjects = mergeObjects; -exports.isReserved = isReserved; -exports.GLSL = GLSL; -exports.TileID = TileID; exports.Collision = Collision; +exports.DataSource = DataSource; +exports.FeatureSelection = FeatureSelection; +exports.FilterOptions = FilterOptions; +exports.FontManager = FontManager; +exports.GLSL = GLSL; exports.Geo = Geo$1; -exports.LabelPoint = LabelPoint; +exports.Label = Label; exports.LabelLineStraight = LabelLineStraight; +exports.LabelPoint = LabelPoint; +exports.Light = Light; +exports.Material = Material; exports.OBB = OBB; -exports.Label = Label; -exports.WorkerBroker = WorkerBroker$1; -exports.Task = Task; -exports.Tile = Tile; -exports._createClass = _createClass; -exports.require$$0$4 = _typedArray; -exports.StyleParser = StyleParser; -exports.Texture = Texture; -exports.debugSettings = debugSettings$1; -exports.debugSumLayerStats = debugSumLayerStats; exports.ShaderProgram = ShaderProgram; -exports.VertexArrayObject = VertexArrayObject; -exports.TextCanvas = TextCanvas; -exports.DataSource = DataSource; -exports.Light = Light; -exports.FontManager = FontManager; -exports.FeatureSelection = FeatureSelection; -exports.View = View; -exports.StyleManager = StyleManager; exports.Style = Style; -exports.sliceObject = sliceObject; +exports.StyleManager = StyleManager; +exports.StyleParser = StyleParser; +exports.Task = Task; +exports.TextCanvas = TextCanvas; +exports.Texture = Texture; exports.Thread = Thread; -exports.mergeDebugSettings = mergeDebugSettings; -exports.version = version$1; +exports.Tile = Tile; +exports.TileID = TileID; +exports.Utils = Utils; exports.Vector = Vector$1; +exports.VertexArrayObject = VertexArrayObject; exports.VertexData = VertexData; -exports.Material = Material; exports.VertexElements = VertexElements; -exports.compileFunctionStrings = compileFunctionStrings; -exports.parseLayers = parseLayers; +exports.View = View; +exports.WorkerBroker = WorkerBroker$1; +exports._createClass = _createClass; +exports._createForOfIteratorHelperLoose = _createForOfIteratorHelperLoose; +exports._inheritsLoose = _inheritsLoose; +exports.addBaseURL = addBaseURL; exports.buildFilter = buildFilter; -exports.FilterOptions = FilterOptions; -exports.layerCache = layerCache; exports.cache = cache; exports.clearFunctionStringCache = clearFunctionStringCache; +exports.commonjsRequire = commonjsRequire; +exports.compileFunctionStrings = compileFunctionStrings; +exports.createCommonjsModule = createCommonjsModule; +exports.createObjectURL = createObjectURL; +exports.debugSettings = debugSettings$1; +exports.debugSumLayerStats = debugSumLayerStats; +exports.extensionForURL = extensionForURL; +exports.flattenRelativeURL = flattenRelativeURL; +exports.isLocalURL = isLocalURL; +exports.isRelativeURL = isRelativeURL; +exports.isReserved = isReserved; +exports.layerCache = layerCache; +exports.log = log; +exports.mergeDebugSettings = mergeDebugSettings; +exports.mergeObjects = mergeObjects; +exports.parseLayers = parseLayers; +exports.pathForURL = pathForURL; +exports.require$$0 = _typedArray; +exports.sliceObject = sliceObject; +exports.subscribeMixin = subscribeMixin; +exports.version = version$1; }); -define(['./shared.js'], function (__chunk_1) { 'use strict'; +define(['./shared'], function (sources) { 'use strict'; var SceneWorker = Object.assign(self, { - FeatureSelection: __chunk_1.FeatureSelection, + FeatureSelection: sources.FeatureSelection, sources: {}, styles: {}, layers: {}, @@ -25076,14 +24969,14 @@ var SceneWorker = Object.assign(self, { this.scene_id = scene_id; this._worker_id = worker_id; this.num_workers = num_workers; - __chunk_1.log.setLevel(log_level); - __chunk_1.Utils.device_pixel_ratio = device_pixel_ratio; - __chunk_1.VertexElements.setElementIndexUint(has_element_index_unit); - __chunk_1.FeatureSelection.setPrefix(this._worker_id); - this.style_manager = new __chunk_1.StyleManager(); + sources.log.setLevel(log_level); + sources.Utils.device_pixel_ratio = device_pixel_ratio; + sources.VertexElements.setElementIndexUint(has_element_index_unit); + sources.FeatureSelection.setPrefix(this._worker_id); + this.style_manager = new sources.StyleManager(); this.importExternalScripts(external_scripts); - __chunk_1.Label.id_prefix = worker_id; - __chunk_1.Label.id_multiplier = num_workers; + sources.Label.id_prefix = worker_id; + sources.Label.id_multiplier = num_workers; return worker_id; }, // Import custom external scripts @@ -25094,7 +24987,7 @@ var SceneWorker = Object.assign(self, { return; } - __chunk_1.log('debug', 'loading custom data source scripts in worker:', scripts); // `window` is already shimmed to allow compatibility with some other libraries (e.g. FontFaceObserver) + sources.log('debug', 'loading custom data source scripts in worker:', scripts); // `window` is already shimmed to allow compatibility with some other libraries (e.g. FontFaceObserver) // So there's an extra dance here to look for any additional `window` properties added by these script imports, // then add them to the worker `self` scope. @@ -25112,15 +25005,15 @@ var SceneWorker = Object.assign(self, { generation = _ref.generation, introspection = _ref.introspection; config = JSON.parse(config); - __chunk_1.mergeDebugSettings(debug); + sources.mergeDebugSettings(debug); this.generation = generation; this.introspection = introspection; // Expand global properties - this.global = __chunk_1.compileFunctionStrings(config.global); // Create data sources + this.global = sources.compileFunctionStrings(config.global); // Create data sources this.createDataSources(config); // Expand styles - config.styles = __chunk_1.compileFunctionStrings(config.styles, __chunk_1.StyleParser.wrapFunction); + config.styles = sources.compileFunctionStrings(config.styles, sources.StyleParser.wrapFunction); this.styles = this.style_manager.build(config.styles); this.style_manager.initStyles({ generation: this.generation, @@ -25129,12 +25022,12 @@ var SceneWorker = Object.assign(self, { introspection: this.introspection }); // Parse each top-level layer as a separate tree - this.layers = __chunk_1.parseLayers(config.layers, this.style_manager.styles); // Sync tetxure info from main thread + this.layers = sources.parseLayers(config.layers, this.style_manager.styles); // Sync tetxure info from main thread this.syncing_textures = this.syncTextures(config.textures); // Return promise for when config refresh finishes this.configuring = this.syncing_textures.then(function () { - __chunk_1.log('debug', 'updated config'); + sources.log('debug', 'updated config'); }); return this.configuring; }, @@ -25157,11 +25050,11 @@ var SceneWorker = Object.assign(self, { } // compile any user-defined JS functions - config.sources[name] = __chunk_1.compileFunctionStrings(config.sources[name]); + config.sources[name] = sources.compileFunctionStrings(config.sources[name]); var source = void 0; try { - source = __chunk_1.DataSource.create(Object.assign({}, config.sources[name], { + source = sources.DataSource.create(Object.assign({}, config.sources[name], { name: name }), this.sources); } catch (e) { @@ -25215,36 +25108,36 @@ var SceneWorker = Object.assign(self, { _this3.loadTileSourceData(tile).then(function () { if (!_this3.getTile(tile.key)) { - __chunk_1.log('trace', "stop tile build after data source load because tile was removed: " + tile.key); + sources.log('trace', "stop tile build after data source load because tile was removed: " + tile.key); return; } // Warn and continue on data source error if (tile.source_data.error) { - __chunk_1.log('warn', "tile load error(s) for " + tile.key + ": " + tile.source_data.error); + sources.log('warn', "tile load error(s) for " + tile.key + ": " + tile.source_data.error); } tile.loading = false; tile.loaded = true; - __chunk_1.Tile.buildGeometry(tile, _this3); + sources.Tile.buildGeometry(tile, _this3); }).catch(function (error) { tile.loading = false; tile.loaded = false; tile.error = error.stack; - __chunk_1.log('error', "tile load error for " + tile.key + ": " + tile.error); // Send error to main thread + sources.log('error', "tile load error for " + tile.key + ": " + tile.error); // Send error to main thread - __chunk_1.WorkerBroker.postMessage("TileManager_" + _this3.scene_id + ".buildTileError", __chunk_1.Tile.slice(tile)); + sources.WorkerBroker.postMessage("TileManager_" + _this3.scene_id + ".buildTileError", sources.Tile.slice(tile)); }); } // Tile already loaded, just rebuild else { - __chunk_1.log('trace', "used worker cache for tile " + tile.key); // Build geometry + sources.log('trace', "used worker cache for tile " + tile.key); // Build geometry try { - __chunk_1.Tile.buildGeometry(tile, _this3); + sources.Tile.buildGeometry(tile, _this3); } catch (error) { // Send error to main thread tile.error = error.toString(); - __chunk_1.WorkerBroker.postMessage("TileManager_" + _this3.scene_id + ".buildTileError", __chunk_1.Tile.slice(tile)); + sources.WorkerBroker.postMessage("TileManager_" + _this3.scene_id + ".buildTileError", sources.Tile.slice(tile)); } } }); @@ -25280,15 +25173,15 @@ var SceneWorker = Object.assign(self, { if (tile != null) { // Cancel if loading if (tile.loading === true) { - __chunk_1.log('trace', "cancel tile load for " + key); + sources.log('trace', "cancel tile load for " + key); tile.loading = false; - __chunk_1.Tile.cancel(tile); + sources.Tile.cancel(tile); } // Remove from cache - __chunk_1.FeatureSelection.clearTile(key); + sources.FeatureSelection.clearTile(key); delete this.tiles[key]; - __chunk_1.log('trace', "remove tile from cache for " + key); + sources.log('trace', "remove tile from cache for " + key); } }, // Query features within visible tiles, with optional filter conditions @@ -25309,10 +25202,10 @@ var SceneWorker = Object.assign(self, { if (filter != null) { filter = ['{', '['].indexOf(filter[0]) > -1 ? JSON.parse(filter) : filter; // de-serialize if looks like an object - filter = __chunk_1.compileFunctionStrings(filter, __chunk_1.StyleParser.wrapFunction); + filter = sources.compileFunctionStrings(filter, sources.StyleParser.wrapFunction); } - filter = __chunk_1.buildFilter(filter, __chunk_1.FilterOptions); + filter = sources.buildFilter(filter, sources.FilterOptions); tiles.forEach(function (tile) { var _loop = function _loop(layer) { var data = tile.source_data.layers[layer]; @@ -25332,7 +25225,7 @@ var SceneWorker = Object.assign(self, { } // Apply feature filter - var context = __chunk_1.StyleParser.getFeatureParseContext(feature, tile, _this4.global); + var context = sources.StyleParser.getFeatureParseContext(feature, tile, _this4.global); context.source = tile.source; // add data source name context.layer = layer; // add data source layer name @@ -25357,8 +25250,8 @@ var SceneWorker = Object.assign(self, { if (geometry === true) { // Transform back to lat lng (copy geometry to avoid local modification) - subset.geometry = __chunk_1.Geo.copyGeometry(feature.geometry); - __chunk_1.Geo.tileSpaceToLatlng(subset.geometry, tile.coords.z, tile.min); + subset.geometry = sources.Geo.copyGeometry(feature.geometry); + sources.Geo.tileSpaceToLatlng(subset.geometry, tile.coords.z, tile.min); } features.push(subset); @@ -25379,23 +25272,23 @@ var SceneWorker = Object.assign(self, { id = _ref4.id, key = _ref4.key; - var selection = __chunk_1.FeatureSelection.map[key]; + var selection = sources.FeatureSelection.map[key]; return { id: id, feature: selection && selection.feature }; }, // Resets the feature selection state - resetFeatureSelection: function resetFeatureSelection(sources) { - if (sources === void 0) { - sources = null; + resetFeatureSelection: function resetFeatureSelection(sources$1) { + if (sources$1 === void 0) { + sources$1 = null; } - __chunk_1.FeatureSelection.reset(sources); + sources.FeatureSelection.reset(sources$1); }, // Selection map size for this worker getFeatureSelectionMapSize: function getFeatureSelectionMapSize() { - return __chunk_1.FeatureSelection.getMapSize(); + return sources.FeatureSelection.getMapSize(); }, // Texture info needs to be synced from main thread, e.g. width/height, which we only know after the texture loads syncTextures: function syncTextures(tex_config) { @@ -25405,20 +25298,20 @@ var SceneWorker = Object.assign(self, { textures.push.apply(textures, Object.keys(tex_config)); } - __chunk_1.log('trace', 'sync textures to worker:', textures); + sources.log('trace', 'sync textures to worker:', textures); if (textures.length > 0) { - return __chunk_1.Texture.syncTexturesToWorker(textures); + return sources.Texture.syncTexturesToWorker(textures); } return Promise.resolve(); }, // Sync device pixel ratio from main thread updateDevicePixelRatio: function updateDevicePixelRatio(device_pixel_ratio) { - __chunk_1.Utils.device_pixel_ratio = device_pixel_ratio; + sources.Utils.device_pixel_ratio = device_pixel_ratio; }, clearFunctionStringCache: function clearFunctionStringCache() { - __chunk_1.clearFunctionStringCache(); + sources.clearFunctionStringCache(); }, // Profiling helpers profile: function profile(name) { @@ -25428,304 +25321,16 @@ var SceneWorker = Object.assign(self, { console.profileEnd("worker " + this._worker_id + ": " + name); // eslint-disable-line no-console }, debug: { - debugSettings: __chunk_1.debugSettings, - layerCache: __chunk_1.layerCache, - functionStringCache: __chunk_1.cache - } -}); -__chunk_1.WorkerBroker.addTarget('self', SceneWorker); - -}); - -define(['./shared.js'], function (__chunk_1) { 'use strict'; - -var f = __chunk_1.require$$0; - -var _wksExt = { - f: f -}; - -var defineProperty = __chunk_1.require$$1$1.f; -var _wksDefine = function (name) { - var $Symbol = __chunk_1.require$$1.Symbol || (__chunk_1.require$$1.Symbol = __chunk_1.global.Symbol || {}); - if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); -}; - -_wksDefine('asyncIterator'); - -// all enumerable object keys, includes symbols - - - -var _enumKeys = function (it) { - var result = __chunk_1.getKeys(it); - var getSymbols = __chunk_1.gOPS.f; - if (getSymbols) { - var symbols = getSymbols(it); - var isEnum = __chunk_1.pIE.f; - var i = 0; - var key; - while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); - } return result; -}; - -// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window - -var gOPN = __chunk_1.require$$0$1.f; -var toString = {}.toString; - -var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; - -var getWindowNames = function (it) { - try { - return gOPN(it); - } catch (e) { - return windowNames.slice(); - } -}; - -var f$1 = function getOwnPropertyNames(it) { - return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(__chunk_1.toIObject(it)); -}; - -var _objectGopnExt = { - f: f$1 -}; - -// ECMAScript 6 symbols shim - - - - - -var META = __chunk_1.require$$0$2.KEY; - - - - - - - - - - - - - - - - - - - -var gOPD = __chunk_1.require$$1$2.f; -var dP = __chunk_1.require$$1$1.f; -var gOPN$1 = _objectGopnExt.f; -var $Symbol = __chunk_1.global.Symbol; -var $JSON = __chunk_1.global.JSON; -var _stringify = $JSON && $JSON.stringify; -var PROTOTYPE = 'prototype'; -var HIDDEN = __chunk_1.require$$0('_hidden'); -var TO_PRIMITIVE = __chunk_1.require$$0('toPrimitive'); -var isEnum = {}.propertyIsEnumerable; -var SymbolRegistry = __chunk_1.require$$0$3('symbol-registry'); -var AllSymbols = __chunk_1.require$$0$3('symbols'); -var OPSymbols = __chunk_1.require$$0$3('op-symbols'); -var ObjectProto = Object[PROTOTYPE]; -var USE_NATIVE = typeof $Symbol == 'function'; -var QObject = __chunk_1.global.QObject; -// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 -var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; - -// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 -var setSymbolDesc = __chunk_1.DESCRIPTORS && __chunk_1.fails(function () { - return __chunk_1.require$$22(dP({}, 'a', { - get: function () { return dP(this, 'a', { value: 7 }).a; } - })).a != 7; -}) ? function (it, key, D) { - var protoDesc = gOPD(ObjectProto, key); - if (protoDesc) delete ObjectProto[key]; - dP(it, key, D); - if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); -} : dP; - -var wrap = function (tag) { - var sym = AllSymbols[tag] = __chunk_1.require$$22($Symbol[PROTOTYPE]); - sym._k = tag; - return sym; -}; - -var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { - return typeof it == 'symbol'; -} : function (it) { - return it instanceof $Symbol; -}; - -var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectProto) $defineProperty(OPSymbols, key, D); - __chunk_1.anObject(it); - key = __chunk_1.require$$16(key, true); - __chunk_1.anObject(D); - if (__chunk_1.require$$17(AllSymbols, key)) { - if (!D.enumerable) { - if (!__chunk_1.require$$17(it, HIDDEN)) dP(it, HIDDEN, __chunk_1.require$$9(1, {})); - it[HIDDEN][key] = true; - } else { - if (__chunk_1.require$$17(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = __chunk_1.require$$22(D, { enumerable: __chunk_1.require$$9(0, false) }); - } return setSymbolDesc(it, key, D); - } return dP(it, key, D); -}; -var $defineProperties = function defineProperties(it, P) { - __chunk_1.anObject(it); - var keys = _enumKeys(P = __chunk_1.toIObject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) $defineProperty(it, key = keys[i++], P[key]); - return it; -}; -var $create = function create(it, P) { - return P === undefined ? __chunk_1.require$$22(it) : $defineProperties(__chunk_1.require$$22(it), P); -}; -var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = __chunk_1.require$$16(key, true)); - if (this === ObjectProto && __chunk_1.require$$17(AllSymbols, key) && !__chunk_1.require$$17(OPSymbols, key)) return false; - return E || !__chunk_1.require$$17(this, key) || !__chunk_1.require$$17(AllSymbols, key) || __chunk_1.require$$17(this, HIDDEN) && this[HIDDEN][key] ? E : true; -}; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = __chunk_1.toIObject(it); - key = __chunk_1.require$$16(key, true); - if (it === ObjectProto && __chunk_1.require$$17(AllSymbols, key) && !__chunk_1.require$$17(OPSymbols, key)) return; - var D = gOPD(it, key); - if (D && __chunk_1.require$$17(AllSymbols, key) && !(__chunk_1.require$$17(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; -}; -var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = gOPN$1(__chunk_1.toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!__chunk_1.require$$17(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); - } return result; -}; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectProto; - var names = gOPN$1(IS_OP ? OPSymbols : __chunk_1.toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (__chunk_1.require$$17(AllSymbols, key = names[i++]) && (IS_OP ? __chunk_1.require$$17(ObjectProto, key) : true)) result.push(AllSymbols[key]); - } return result; -}; - -// 19.4.1.1 Symbol([description]) -if (!USE_NATIVE) { - $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = __chunk_1.uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function (value) { - if (this === ObjectProto) $set.call(OPSymbols, value); - if (__chunk_1.require$$17(this, HIDDEN) && __chunk_1.require$$17(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, __chunk_1.require$$9(1, value)); - }; - if (__chunk_1.DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); - return wrap(tag); - }; - __chunk_1.redefine($Symbol[PROTOTYPE], 'toString', function toString() { - return this._k; - }); - - __chunk_1.require$$1$2.f = $getOwnPropertyDescriptor; - __chunk_1.require$$1$1.f = $defineProperty; - __chunk_1.require$$0$1.f = _objectGopnExt.f = $getOwnPropertyNames; - __chunk_1.pIE.f = $propertyIsEnumerable; - __chunk_1.gOPS.f = $getOwnPropertySymbols; - - if (__chunk_1.DESCRIPTORS && !__chunk_1.LIBRARY) { - __chunk_1.redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + debugSettings: sources.debugSettings, + layerCache: sources.layerCache, + functionStringCache: sources.cache } - - _wksExt.f = function (name) { - return wrap(__chunk_1.require$$0(name)); - }; -} - -__chunk_1.$export(__chunk_1.$export.G + __chunk_1.$export.W + __chunk_1.$export.F * !USE_NATIVE, { Symbol: $Symbol }); - -for (var es6Symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' -).split(','), j = 0; es6Symbols.length > j;)__chunk_1.require$$0(es6Symbols[j++]); - -for (var wellKnownSymbols = __chunk_1.getKeys(__chunk_1.require$$0.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); - -__chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * !USE_NATIVE, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function (key) { - return __chunk_1.require$$17(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); - for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; - }, - useSetter: function () { setter = true; }, - useSimple: function () { setter = false; } -}); - -__chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * !USE_NATIVE, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols }); +sources.WorkerBroker.addTarget('self', SceneWorker); -// 24.3.2 JSON.stringify(value [, replacer [, space]]) -$JSON && __chunk_1.$export(__chunk_1.$export.S + __chunk_1.$export.F * (!USE_NATIVE || __chunk_1.fails(function () { - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; -})), 'JSON', { - stringify: function stringify(it) { - var args = [it]; - var i = 1; - var replacer, $replacer; - while (arguments.length > i) args.push(arguments[i++]); - $replacer = replacer = args[1]; - if (!__chunk_1.isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined - if (!__chunk_1.isArray(replacer)) replacer = function (key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); - if (!isSymbol(value)) return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); - } }); -// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __chunk_1.hide($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); -// 19.4.3.5 Symbol.prototype[@@toStringTag] -__chunk_1.setToStringTag($Symbol, 'Symbol'); -// 20.2.1.9 Math[@@toStringTag] -__chunk_1.setToStringTag(Math, 'Math', true); -// 24.3.3 JSON[@@toStringTag] -__chunk_1.setToStringTag(__chunk_1.global.JSON, 'JSON', true); +define(['./shared'], function (sources) { 'use strict'; // WebGL context wrapper var Context; @@ -25781,6 +25386,156 @@ Context.resize = function (gl, width, height, device_pixel_ratio) { gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); }; +// Get a value for a nested property with path provided as an array (`a.b.c` => ['a', 'b', 'c']) +function getPropertyPath(object, path) { + var _getPropertyPathTarge; + + var prop = path[path.length - 1]; + return (_getPropertyPathTarge = getPropertyPathTarget(object, path)) == null ? void 0 : _getPropertyPathTarge[prop]; +} // Set a value for a nested property with path provided as an array (`a.b.c` => ['a', 'b', 'c']) + +function setPropertyPath(object, path, value) { + var prop = path[path.length - 1]; + var target = getPropertyPathTarget(object, path); + + if (target) { + target[prop] = value; + } +} // Get the immediate parent object for a property path name provided as an array +// e.g. for a single-depth path, this is just `object`, for path ['a', 'b'], this is `object[a]` + +function getPropertyPathTarget(object, path) { + if (path.length === 0) { + return; + } + + var target = object; + + for (var i = 0; i < path.length - 1; i++) { + var prop = path[i]; + target = target[prop]; + + if (target == null) { + return; + } + } + + return target; +} + +var GLOBAL_PREFIX = 'global.'; +var GLOBAL_PREFIX_LENGTH = GLOBAL_PREFIX.length; // name of 'hidden' (non-enumerable) property used to track global property references on an object + +var GLOBAL_REGISTRY = '__global_prop'; // Property name references a global property? + +function isGlobalReference(val) { + return (val == null ? void 0 : val.slice(0, GLOBAL_PREFIX_LENGTH)) === GLOBAL_PREFIX; +} // Has object property been substitued with a value from a global reference? +// Property provided as a single-depth string name, or nested path array (`a.b.c` => ['a', 'b', 'c']) + +function isGlobalSubstitution(object, prop_or_path) { + var _target$GLOBAL_REGIST; + + var path = Array.isArray(prop_or_path) ? prop_or_path : [prop_or_path]; + var target = getPropertyPathTarget(object, path); + var prop = path[path.length - 1]; + return (target == null ? void 0 : (_target$GLOBAL_REGIST = target[GLOBAL_REGISTRY]) == null ? void 0 : _target$GLOBAL_REGIST[prop]) !== undefined; +} // Flatten nested global properties for simpler string look-ups + +function flattenGlobalProperties(obj, prefix, globals) { + if (prefix === void 0) { + prefix = null; + } + + if (globals === void 0) { + globals = {}; + } + + prefix = prefix ? prefix + '.' : GLOBAL_PREFIX; + + for (var p in obj) { + var key = prefix + p; + var val = obj[p]; + globals[key] = val; + + if (typeof val === 'object' && !Array.isArray(val)) { + flattenGlobalProperties(val, key, globals); + } + } + + return globals; +} // Find and apply new global properties (and re-apply old ones) + +function applyGlobalProperties(globals, obj, target, key) { + var _target$GLOBAL_REGIST2; + + var prop; // Check for previously applied global substitution + + if (target == null ? void 0 : (_target$GLOBAL_REGIST2 = target[GLOBAL_REGISTRY]) == null ? void 0 : _target$GLOBAL_REGIST2[key]) { + prop = target[GLOBAL_REGISTRY][key]; + } // Check string for new global substitution + else if (typeof obj === 'string' && obj.slice(0, GLOBAL_PREFIX_LENGTH) === GLOBAL_PREFIX) { + prop = obj; + } // Found global property to substitute + + + if (prop) { + // Mark property as global substitution + if (target[GLOBAL_REGISTRY] == null) { + Object.defineProperty(target, GLOBAL_REGISTRY, { + value: {} + }); + } + + target[GLOBAL_REGISTRY][key] = prop; // Get current global value + + var val = globals[prop]; + var stack; + + while (typeof val === 'string' && val.slice(0, GLOBAL_PREFIX_LENGTH) === GLOBAL_PREFIX) { + // handle globals that refer to other globals, detecting any cyclical references + stack = stack || [prop]; + + if (stack.indexOf(val) > -1) { + sources.log({ + level: 'warn', + once: true + }, 'Global properties: cyclical reference detected', stack); + val = null; + break; + } + + stack.push(val); + val = globals[val]; + } // Create getter/setter + + + Object.defineProperty(target, key, { + enumerable: true, + get: function get() { + return val; // return substituted value + }, + set: function set(v) { + // clear the global substitution and remove the getter/setter + delete target[GLOBAL_REGISTRY][key]; + delete target[key]; + target[key] = v; // save the new value + } + }); + } // Loop through object keys or array indices + else if (Array.isArray(obj)) { + for (var p = 0; p < obj.length; p++) { + applyGlobalProperties(globals, obj[p], obj, p); + } + } else if (typeof obj === 'object') { + for (var _p in obj) { + applyGlobalProperties(globals, obj[_p], obj, _p); + } + } + + return obj; +} + var global$1 = (typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); @@ -25980,10 +25735,10 @@ function write (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128; } -var toString$1 = {}.toString; +var toString = {}.toString; var isArray = Array.isArray || function (arr) { - return toString$1.call(arr) == '[object Array]'; + return toString.call(arr) == '[object Array]'; }; var INSPECT_MAX_BYTES = 50; @@ -26685,7 +26440,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { } } - function read$$1 (buf, i) { + function read (buf, i) { if (indexSize === 1) { return buf[i] } else { @@ -26697,7 +26452,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { if (dir) { var foundIndex = -1; for (i = byteOffset; i < arrLength; i++) { - if (read$$1(arr, i) === read$$1(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i; if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { @@ -26710,7 +26465,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) { for (i = byteOffset; i >= 0; i--) { var found = true; for (var j = 0; j < valLength; j++) { - if (read$$1(arr, i + j) !== read$$1(val, j)) { + if (read(arr, i + j) !== read(val, j)) { found = false; break } @@ -26781,7 +26536,7 @@ function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } -Buffer.prototype.write = function write$$1 (string, offset, length, encoding) { +Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8'; @@ -27450,7 +27205,7 @@ function checkIEEE754 (buf, value, offset, ext, max, min) { function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38); + checkIEEE754(buf, value, offset, 4); } write(buf, value, offset, littleEndian, 23, 4); return offset + 4 @@ -27466,7 +27221,7 @@ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308); + checkIEEE754(buf, value, offset, 8); } write(buf, value, offset, littleEndian, 52, 8); return offset + 8 @@ -27759,6 +27514,7 @@ function isSlowBuffer (obj) { } var bufferEs6 = /*#__PURE__*/Object.freeze({ +__proto__: null, INSPECT_MAX_BYTES: INSPECT_MAX_BYTES, kMaxLength: _kMaxLength, Buffer: Buffer, @@ -27796,7 +27552,7 @@ EventEmitter.init = function() { this.domain = null; if (EventEmitter.usingDomains) { // if there is an active domain, then attach to it. - if (domain.active && !(this instanceof domain.Domain)) ; + if (domain.active ) ; } if (!this._events || this._events === Object.getPrototypeOf(this)._events) { @@ -28395,19 +28151,19 @@ function chdir (dir) { }function umask() { return 0; } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js -var performance$1 = global$1.performance || {}; +var performance = global$1.performance || {}; var performanceNow = - performance$1.now || - performance$1.mozNow || - performance$1.msNow || - performance$1.oNow || - performance$1.webkitNow || + performance.now || + performance.mozNow || + performance.msNow || + performance.oNow || + performance.webkitNow || function(){ return (new Date()).getTime() }; // generate timestamp or delta // see http://nodejs.org/api/process.html#process_process_hrtime function hrtime(previousTimestamp){ - var clocktime = performanceNow.call(performance$1)*1e-3; + var clocktime = performanceNow.call(performance)*1e-3; var seconds = Math.floor(clocktime); var nanoseconds = Math.floor((clocktime%1)*1e9); if (previousTimestamp) { @@ -28461,7 +28217,7 @@ var isBufferBrowser = function isBuffer(arg) { && typeof arg.readUInt8 === 'function'; }; -var inherits_browser = __chunk_1.createCommonjsModule(function (module) { +var inherits_browser = sources.createCommonjsModule(function (module) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -28487,7 +28243,7 @@ if (typeof Object.create === 'function') { } }); -var util = __chunk_1.createCommonjsModule(function (module, exports) { +var util = sources.createCommonjsModule(function (module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -28579,7 +28335,7 @@ var debugs = {}; var debugEnviron; exports.debuglog = function(set) { if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; + debugEnviron = ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { @@ -29144,7 +28900,7 @@ BufferList.prototype.concat = function (n) { return ret; }; -var safeBuffer = __chunk_1.createCommonjsModule(function (module, exports) { +var safeBuffer = sources.createCommonjsModule(function (module, exports) { /* eslint-disable node/no-deprecated-api */ var Buffer = bufferEs6.Buffer; @@ -30104,7 +29860,7 @@ Readable.prototype.on = function (ev, fn) { if (!state.reading) { nextTick(nReadingNextTick, this); } else if (state.length) { - emitReadable(this, state); + emitReadable(this); } } } @@ -31127,7 +30883,7 @@ Stream.prototype.pipe = function(dest, options) { */ var readableStreamBrowser = Stream; -var support = __chunk_1.createCommonjsModule(function (module, exports) { +var support = sources.createCommonjsModule(function (module, exports) { exports.base64 = true; exports.array = true; @@ -31335,14 +31091,14 @@ var nodejsUtils = { } }; -var _global = __chunk_1.createCommonjsModule(function (module) { +var _global = sources.createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef }); -var _core = __chunk_1.createCommonjsModule(function (module) { +var _core = sources.createCommonjsModule(function (module) { var core = module.exports = {version: '2.3.0'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef }); @@ -31420,14 +31176,14 @@ var _toPrimitive = function(it, S){ throw TypeError("Can't convert object to primitive value"); }; -var dP$1 = Object.defineProperty; +var dP = Object.defineProperty; -var f$2 = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes){ +var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes){ _anObject(O); P = _toPrimitive(P, true); _anObject(Attributes); if(_ie8DomDefine)try { - return dP$1(O, P, Attributes); + return dP(O, P, Attributes); } catch(e){ /* empty */ } if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); if('value' in Attributes)O[P] = Attributes.value; @@ -31435,7 +31191,7 @@ var f$2 = _descriptors ? Object.defineProperty : function defineProperty(O, P, A }; var _objectDp = { - f: f$2 + f: f }; var _propertyDesc = function(bitmap, value){ @@ -31454,7 +31210,7 @@ var _hide = _descriptors ? function(object, key, value){ return object; }; -var PROTOTYPE$1 = 'prototype'; +var PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F @@ -31464,8 +31220,8 @@ var $export = function(type, name, source){ , IS_BIND = type & $export.B , IS_WRAP = type & $export.W , exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}) - , expProto = exports[PROTOTYPE$1] - , target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE$1] + , expProto = exports[PROTOTYPE] + , target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE] , key, own, out; if(IS_GLOBAL)source = name; for(key in source){ @@ -31489,7 +31245,7 @@ var $export = function(type, name, source){ } return new C(a, b, c); } return C.apply(this, arguments); }; - F[PROTOTYPE$1] = C[PROTOTYPE$1]; + F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; @@ -31531,10 +31287,10 @@ var _invoke = function(fn, args, that){ var _html = _global.document && document.documentElement; -var toString$2 = {}.toString; +var toString$1 = {}.toString; var _cof = function(it){ - return toString$2.call(it).slice(8, -1); + return toString$1.call(it).slice(8, -1); }; var process$1 = _global.process @@ -31952,7 +31708,7 @@ var external = { Promise: ES6Promise }; -var utils = __chunk_1.createCommonjsModule(function (module, exports) { +var utils = sources.createCommonjsModule(function (module, exports) { @@ -32704,7 +32460,7 @@ GenericWorker.prototype = { var GenericWorker_1 = GenericWorker; -var utf8 = __chunk_1.createCommonjsModule(function (module, exports) { +var utf8 = sources.createCommonjsModule(function (module, exports) { @@ -33699,7 +33455,7 @@ for(var i = 0; i < removedMethods.length; i++) { } var zipObject = ZipObject; -var common = __chunk_1.createCommonjsModule(function (module, exports) { +var common = sources.createCommonjsModule(function (module, exports) { var TYPED_OK = (typeof Uint8Array !== 'undefined') && @@ -37296,7 +37052,7 @@ function ZStream() { var zstream = ZStream; -var toString$3 = Object.prototype.toString; +var toString$2 = Object.prototype.toString; /* Public constants ==========================================================*/ /* ===========================================================================*/ @@ -37460,7 +37216,7 @@ function Deflate(options) { if (typeof opt.dictionary === 'string') { // If we need to compress text, change encoding to utf8. dict = strings.string2buf(opt.dictionary); - } else if (toString$3.call(opt.dictionary) === '[object ArrayBuffer]') { + } else if (toString$2.call(opt.dictionary) === '[object ArrayBuffer]') { dict = new Uint8Array(opt.dictionary); } else { dict = opt.dictionary; @@ -37518,7 +37274,7 @@ Deflate.prototype.push = function (data, mode) { if (typeof data === 'string') { // If we need to compress text, change encoding to utf8. strm.input = strings.string2buf(data); - } else if (toString$3.call(data) === '[object ArrayBuffer]') { + } else if (toString$2.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; @@ -40070,7 +39826,7 @@ function GZheader() { var gzheader = GZheader; -var toString$4 = Object.prototype.toString; +var toString$3 = Object.prototype.toString; /** * class Inflate @@ -40254,7 +40010,7 @@ Inflate.prototype.push = function (data, mode) { if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); - } else if (toString$4.call(data) === '[object ArrayBuffer]') { + } else if (toString$3.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; @@ -40276,7 +40032,7 @@ Inflate.prototype.push = function (data, mode) { // Convert data if needed if (typeof dictionary === 'string') { dict = strings.string2buf(dictionary); - } else if (toString$4.call(dictionary) === '[object ArrayBuffer]') { + } else if (toString$3.call(dictionary) === '[object ArrayBuffer]') { dict = new Uint8Array(dictionary); } else { dict = dictionary; @@ -40750,7 +40506,7 @@ var generateZipParts = function(streamInfo, streamedContent, streamingEnded, off extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); } else { // DOS or other, fallback to DOS versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); + extFileAttr |= generateDosExternalFileAttr(file.dosPermissions); } // date @@ -42218,8 +41974,8 @@ ZipEntries.prototype = { checkSignature: function(expectedSignature) { if (!this.reader.readAndCheckSignature(expectedSignature)) { this.reader.index -= 4; - var signature$$1 = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature$$1) + ", expected " + utils.pretty(expectedSignature) + ")"); + var signature = this.reader.readString(4); + throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }, /** @@ -42231,8 +41987,8 @@ ZipEntries.prototype = { isSignature: function(askedIndex, expectedSignature) { var currentIndex = this.reader.index; this.reader.setIndex(askedIndex); - var signature$$1 = this.reader.readString(4); - var result = signature$$1 === expectedSignature; + var signature = this.reader.readString(4); + var result = signature === expectedSignature; this.reader.setIndex(currentIndex); return result; }, @@ -42486,12 +42242,12 @@ var load = function(data, options) { return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) .then(function(data) { - var zipEntries$$1 = new zipEntries(options); - zipEntries$$1.load(data); - return zipEntries$$1; - }).then(function checkCRC32(zipEntries$$1) { - var promises = [external.Promise.resolve(zipEntries$$1)]; - var files = zipEntries$$1.files; + var zipEntries$1 = new zipEntries(options); + zipEntries$1.load(data); + return zipEntries$1; + }).then(function checkCRC32(zipEntries) { + var promises = [external.Promise.resolve(zipEntries)]; + var files = zipEntries.files; if (options.checkCRC32) { for (var i = 0; i < files.length; i++) { promises.push(checkEntryCRC32(files[i])); @@ -42499,8 +42255,8 @@ var load = function(data, options) { } return external.Promise.all(promises); }).then(function addFiles(results) { - var zipEntries$$1 = results.shift(); - var files = zipEntries$$1.files; + var zipEntries = results.shift(); + var files = zipEntries.files; for (var i = 0; i < files.length; i++) { var input = files[i]; zip.file(input.fileNameStr, input.decompressed, { @@ -42514,8 +42270,8 @@ var load = function(data, options) { createFolders: options.createFolders }); } - if (zipEntries$$1.zipComment.length) { - zip.comment = zipEntries$$1.zipComment; + if (zipEntries.zipComment.length) { + zip.comment = zipEntries.zipComment; } return zip; @@ -42834,7 +42590,7 @@ function compileList(schema, name, result) { result.push(currentType); }); - return result.filter(function (type$$1, index) { + return result.filter(function (type, index) { return exclude.indexOf(index) === -1; }); } @@ -42843,8 +42599,8 @@ function compileList(schema, name, result) { function compileMap(/* lists... */) { var result = {}, index, length; - function collectType(type$$1) { - result[type$$1.tag] = type$$1; + function collectType(type) { + result[type.tag] = type; } for (index = 0, length = arguments.length; index < length; index += 1) { @@ -42860,8 +42616,8 @@ function Schema(definition) { this.implicit = definition.implicit || []; this.explicit = definition.explicit || []; - this.implicit.forEach(function (type$$1) { - if (type$$1.loadKind && type$$1.loadKind !== 'scalar') { + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } }); @@ -42900,7 +42656,7 @@ Schema.create = function createSchema() { throw new exception('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); } - if (!types.every(function (type$$1) { return type$$1 instanceof type; })) { + if (!types.every(function (type$1) { return type$1 instanceof type; })) { throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } @@ -43486,7 +43242,7 @@ function representYamlBinary(object /*, style*/) { } function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); + return NodeBuffer ; } var binary$1 = new type('tag:yaml.org,2002:binary', { @@ -43723,7 +43479,7 @@ var esprima; // try { // workaround to exclude package from browserify list. - var _require = __chunk_1.commonjsRequire; + var _require = sources.commonjsRequire; esprima = _require('esprima'); } catch (_) { /*global window */ @@ -45458,9 +45214,7 @@ var jsYaml = { var jsYaml$1 = jsYaml; -var SceneBundle = -/*#__PURE__*/ -function () { +var SceneBundle = /*#__PURE__*/function () { function SceneBundle(url, path, parent) { if (parent === void 0) { parent = null; @@ -45469,10 +45223,10 @@ function () { this.url = url; // If a base path was provided, use it for resolving local bundle resources only if // the base path is absolute, or this bundle's path is relative - if (path && (!__chunk_1.isRelativeURL(path) || __chunk_1.isRelativeURL(this.url))) { + if (path && (!sources.isRelativeURL(path) || sources.isRelativeURL(this.url))) { this.path = path; } else { - this.path = __chunk_1.pathForURL(this.url); + this.path = sources.pathForURL(this.url); } this.path_for_parent = path || this.path; // for resolving paths relative to a parent bundle @@ -45511,23 +45265,23 @@ function () { }; _proto.urlFor = function urlFor(url) { - if (isGlobal(url)) { + if (isGlobalReference(url)) { return url; } - if (__chunk_1.isRelativeURL(url) && this.container) { + if (sources.isRelativeURL(url) && this.container) { return this.parent.urlFor(this.path_for_parent + url); } - return __chunk_1.addBaseURL(url, this.path); + return sources.addBaseURL(url, this.path); }; _proto.pathFor = function pathFor(url) { - return __chunk_1.pathForURL(url); + return sources.pathForURL(url); }; _proto.typeFor = function typeFor(url) { - return __chunk_1.extensionForURL(url); + return sources.extensionForURL(url); }; _proto.isContainer = function isContainer() { @@ -45536,10 +45290,8 @@ function () { return SceneBundle; }(); -var ZipSceneBundle = -/*#__PURE__*/ -function (_SceneBundle) { - __chunk_1._inheritsLoose(ZipSceneBundle, _SceneBundle); +var ZipSceneBundle = /*#__PURE__*/function (_SceneBundle) { + sources._inheritsLoose(ZipSceneBundle, _SceneBundle); function ZipSceneBundle(url, path, parent) { var _this; @@ -45560,17 +45312,17 @@ function (_SceneBundle) { _proto2.load = function load() { return new Promise(function ($return, $error) { - var _ref, body; + var _await$Utils$io, body; this.zip = new lib(); if (typeof this.url === 'string') { - return Promise.resolve(__chunk_1.Utils.io(this.url, 60000, 'arraybuffer')).then(function ($await_4) { + return Promise.resolve(sources.Utils.io(this.url, 60000, 'arraybuffer')).then(function ($await_3) { try { - _ref = $await_4, body = _ref.body; - return Promise.resolve(this.zip.loadAsync(body)).then(function ($await_5) { + _await$Utils$io = $await_3, body = _await$Utils$io.body; + return Promise.resolve(this.zip.loadAsync(body)).then(function ($await_4) { try { - return Promise.resolve(this.parseZipFiles()).then(function ($await_6) { + return Promise.resolve(this.parseZipFiles()).then(function ($await_5) { try { return $return(this.loadRoot()); } catch ($boundEx) { @@ -45588,25 +45340,23 @@ function (_SceneBundle) { } else { return $return(this); } - - return $return(); }.bind(this)); }; _proto2.urlFor = function urlFor(url) { - if (isGlobal(url)) { + if (isGlobalReference(url)) { return url; } - if (__chunk_1.isRelativeURL(url)) { - return this.urlForZipFile(__chunk_1.flattenRelativeURL(url)); + if (sources.isRelativeURL(url)) { + return this.urlForZipFile(sources.flattenRelativeURL(url)); } return _SceneBundle.prototype.urlFor.call(this, url); }; _proto2.typeFor = function typeFor(url) { - if (__chunk_1.isRelativeURL(url)) { + if (sources.isRelativeURL(url)) { return this.typeForZipFile(url); } @@ -45625,7 +45375,7 @@ function (_SceneBundle) { var yamls = Object.keys(this.files).filter(function (path) { return _this2.files[path].depth === 0; }).filter(function (path) { - return __chunk_1.extensionForURL(path) === 'yaml'; + return sources.extensionForURL(path) === 'yaml'; }); if (yamls.length === 1) { @@ -45660,16 +45410,16 @@ function (_SceneBundle) { queue.push(file.async('arraybuffer')); } }); - return Promise.resolve(Promise.all(queue)).then(function ($await_7) { + return Promise.resolve(Promise.all(queue)).then(function ($await_6) { try { - data = $await_7; + data = $await_6; for (i = 0; i < data.length; i++) { path = paths[i]; depth = path.split('/').length - 1; this.files[path] = { data: data[i], - type: __chunk_1.extensionForURL(path), + type: sources.extensionForURL(path), depth: depth }; } @@ -45685,7 +45435,7 @@ function (_SceneBundle) { _proto2.urlForZipFile = function urlForZipFile(file) { if (this.files[file]) { if (!this.files[file].url) { - this.files[file].url = __chunk_1.createObjectURL(new Blob([this.files[file].data])); + this.files[file].url = sources.createObjectURL(new Blob([this.files[file].data])); } return this.files[file].url; @@ -45703,44 +45453,28 @@ function createSceneBundle(url, path, parent, type) { type = null; } - if (type != null && type === 'zip' || typeof url === 'string' && !__chunk_1.isLocalURL(url) && __chunk_1.extensionForURL(url) === 'zip') { + if (type != null && type === 'zip' || typeof url === 'string' && !sources.isLocalURL(url) && sources.extensionForURL(url) === 'zip') { return new ZipSceneBundle(url, path, parent); } return new SceneBundle(url, path, parent); -} // References a global property? - -function isGlobal(val) { - if (val && val.slice(0, 7) === 'global.') { - return true; - } - - return false; } function parseResource(body) { - var data; - - try { - // jsyaml 'json' option allows duplicate keys - // Keeping this for backwards compatibility, but should consider migrating to requiring - // unique keys, as this is YAML spec. But Tangram ES currently accepts dupe keys as well, - // so should consider how best to unify. - data = jsYaml$1.safeLoad(body, { - json: true - }); - } catch (e) { - throw e; - } - - return data; + // jsyaml 'json' option allows duplicate keys + // Keeping this for backwards compatibility, but should consider migrating to requiring + // unique keys, as this is YAML spec. But Tangram ES currently accepts dupe keys as well, + // so should consider how best to unify. + return jsYaml$1.safeLoad(body, { + json: true + }); } function loadResource(source) { return new Promise(function (resolve, reject) { if (typeof source === 'string') { - __chunk_1.Utils.io(source).then(function (_ref2) { - var body = _ref2.body; + sources.Utils.io(source).then(function (_ref) { + var body = _ref.body; try { resolve(parseResource(body)); @@ -45757,21 +45491,21 @@ function loadResource(source) { }); } -var SceneLoader; -var SceneLoader$1 = SceneLoader = { +var SceneLoader = { // Load scenes definitions from URL & proprocess loadScene: function loadScene(url, _temp) { return new Promise(function ($return, $error) { - var _this, _ref, path, type, errors, scene, _this$finalize, config, bundle; + var _this, _ref, path, type, errors, texture_nodes, scene, _this$finalize, config, bundle; _this = this; _ref = _temp === void 0 ? {} : _temp, path = _ref.path, type = _ref.type; errors = []; + texture_nodes = {}; return Promise.resolve(this.loadSceneRecursive({ url: url, path: path, type: type - }, null, errors)).then(function ($await_2) { + }, null, texture_nodes, errors)).then(function ($await_2) { try { scene = $await_2; _this$finalize = this.finalize(scene), config = _this$finalize.config, bundle = _this$finalize.bundle; @@ -45783,7 +45517,7 @@ var SceneLoader$1 = SceneLoader = { // scene loaded, but some imports had errors errors.forEach(function (error) { var message = "Failed to import scene: " + error.url; - __chunk_1.log('error', message, error); + sources.log('error', message, error); _this.trigger('error', { type: 'scene_import', @@ -45796,7 +45530,8 @@ var SceneLoader$1 = SceneLoader = { return $return({ config: config, - bundle: bundle + bundle: bundle, + texture_nodes: texture_nodes }); } catch ($boundEx) { return $error($boundEx); @@ -45808,13 +45543,17 @@ var SceneLoader$1 = SceneLoader = { // Optional *initial* path only (won't be passed to recursive 'import' calls) // Useful for loading resources in base scene file from a separate location // (e.g. in Tangram Play, when modified local scene should still refer to original resource URLs) - loadSceneRecursive: function loadSceneRecursive(_ref2, parent, errors) { + loadSceneRecursive: function loadSceneRecursive(_ref2, parent, texture_nodes, errors) { return new Promise(function ($return, $error) { var _this2, url, path, type, bundle, config, imports, queue, configs; _this2 = this; url = _ref2.url, path = _ref2.path, type = _ref2.type; + if (texture_nodes === void 0) { + texture_nodes = {}; + } + if (errors === void 0) { errors = []; } @@ -45841,9 +45580,8 @@ var SceneLoader$1 = SceneLoader = { try { config = $await_3; - // debugger if (config.import == null) { - this.normalize(config, bundle); + this.normalize(config, bundle, texture_nodes); return $return({ config: config, bundle: bundle @@ -45860,7 +45598,7 @@ var SceneLoader$1 = SceneLoader = { config.import.forEach(function (url) { // Convert scene objects to URLs if (typeof url === 'object') { - url = __chunk_1.createObjectURL(new Blob([JSON.stringify(url)])); + url = sources.createObjectURL(new Blob([JSON.stringify(url)])); } imports.push(bundle.resourceFor(url)); @@ -45869,21 +45607,22 @@ var SceneLoader$1 = SceneLoader = { // load and normalize imports queue = imports.map(function (resource) { - return _this2.loadSceneRecursive(resource, bundle, errors); + return _this2.loadSceneRecursive(resource, bundle, texture_nodes, errors); }); return Promise.resolve(Promise.all(queue)).then(function ($await_4) { try { configs = $await_4.map(function (r) { - return _this2.normalize(r.config, r.bundle); + return _this2.normalize(r.config, r.bundle, texture_nodes); }).map(function (r) { return r.config; }); - config = __chunk_1.mergeObjects.apply(void 0, configs.concat([config])); - this.normalize(config, bundle); // last normalize parent, after merge + this.normalize(config, bundle, texture_nodes); // last normalize parent + config = sources.mergeObjects.apply(void 0, configs.concat([config])); return $return({ config: config, - bundle: bundle + bundle: bundle, + texture_nodes: texture_nodes }); } catch ($boundEx) { return $Try_1_Catch($boundEx); @@ -45899,14 +45638,19 @@ var SceneLoader$1 = SceneLoader = { }.bind(this)); }, // Normalize properties that should be adjust within each local scene file (usually by path) - normalize: function normalize(config, bundle) { + normalize: function normalize(config, bundle, texture_nodes) { + if (texture_nodes === void 0) { + texture_nodes = {}; + } + this.normalizeDataSources(config, bundle); this.normalizeFonts(config, bundle); this.normalizeTextures(config, bundle); - this.hoistTextures(config, bundle); + this.collectTextures(config, bundle, texture_nodes); return { config: config, - bundle: bundle + bundle: bundle, + texture_nodes: texture_nodes }; }, // Expand paths for data source @@ -45985,10 +45729,10 @@ var SceneLoader$1 = SceneLoader = { // - in a style's `material` properties // - in a style's custom uniforms (`shaders.uniforms`) // - in a draw groups `texture` property - hoistTextures: function hoistTextures(config, bundle) { + collectTextures: function collectTextures(config, bundle, texture_nodes) { var _this3 = this; - // Resolve URLs for inline textures + // Inline textures in styles if (config.styles) { var _loop = function _loop(sn) { var style = config.styles[sn]; // Style `texture` @@ -45996,7 +45740,9 @@ var SceneLoader$1 = SceneLoader = { var tex = style.texture; if (typeof tex === 'string' && !config.textures[tex]) { - style.texture = _this3.hoistTexture(tex, config, bundle); + var path = ['styles', sn, 'texture']; + + _this3.addTextureNode(path, bundle, texture_nodes); } // Material @@ -46006,7 +45752,9 @@ var SceneLoader$1 = SceneLoader = { var tex = style.material[prop] != null && style.material[prop].texture; if (typeof tex === 'string' && !config.textures[tex]) { - style.material[prop].texture = _this3.hoistTexture(tex, config, bundle); + var _path = ['styles', sn, 'material', prop, 'texture']; + + _this3.addTextureNode(_path, bundle, texture_nodes); } }); } @@ -46015,19 +45763,42 @@ var SceneLoader$1 = SceneLoader = { for (var sn in config.styles) { _loop(sn); } - } // Special handling for shader uniforms, exclude globals because they are ambiguous: - // could later be resolved to a string value indicating a texture, but could also be a vector or other type + } // Inline textures in shader uniforms + + + if (config.styles) { + var _loop2 = function _loop2(_sn) { + var style = config.styles[_sn]; + + if (style.shaders && style.shaders.uniforms) { + sources.GLSL.parseUniforms(style.shaders.uniforms).forEach(function (_ref3) { + var type = _ref3.type, + value = _ref3.value, + key = _ref3.key; + + // Texture by URL (string-named texture not referencing existing texture definition) + if (type === 'sampler2D' && typeof value === 'string' && !config.textures[value]) { + var path = ['styles', _sn, 'shaders', 'uniforms', key]; + + _this3.addTextureNode(path, bundle, texture_nodes); + } + }); + } + }; + for (var _sn in config.styles) { + _loop2(_sn); + } + } // Inline textures in draw blocks - this.hoistStyleShaderUniformTextures(config, bundle, { - include_globals: false - }); // Resolve and hoist inline textures in draw blocks if (config.layers) { var stack = [config.layers]; + var path_stack = [['layers']]; while (stack.length > 0) { - var layer = stack.pop(); // only recurse into objects + var layer = stack.pop(); + var layer_path = path_stack.pop(); // only recurse into objects if (typeof layer !== 'object' || Array.isArray(layer)) { continue; @@ -46043,7 +45814,8 @@ var SceneLoader$1 = SceneLoader = { var tex = draws[group].texture; if (typeof tex === 'string' && !config.textures[tex]) { - draws[group].texture = this.hoistTexture(tex, config, bundle); + var path = [].concat(layer_path, [prop, 'draw', group, 'texture']); + this.addTextureNode(path, bundle, texture_nodes); } } // special handling for outlines :( @@ -46052,140 +45824,80 @@ var SceneLoader$1 = SceneLoader = { var _tex = draws[group].outline.texture; if (typeof _tex === 'string' && !config.textures[_tex]) { - draws[group].outline.texture = this.hoistTexture(_tex, config, bundle); + var _path2 = [].concat(layer_path, [prop, 'draw', group, 'outline', 'texture']); + + this.addTextureNode(_path2, bundle, texture_nodes); } } } - } else if (__chunk_1.isReserved(prop)) { + } else if (sources.isReserved(prop)) { continue; // skip reserved keyword } else { stack.push(layer[prop]); // traverse sublayer + + path_stack.push([].concat(layer_path, [prop])); } } } } }, - hoistStyleShaderUniformTextures: function hoistStyleShaderUniformTextures(config, bundle, _ref3) { - var _this4 = this; - - var include_globals = _ref3.include_globals; - - // Resolve URLs for inline textures - if (config.styles) { - for (var sn in config.styles) { - var style = config.styles[sn]; // Shader uniforms - - if (style.shaders && style.shaders.uniforms) { - __chunk_1.GLSL.parseUniforms(style.shaders.uniforms).forEach(function (_ref4) { - var type = _ref4.type, - value = _ref4.value, - key = _ref4.key, - uniforms = _ref4.uniforms; + addTextureNode: function addTextureNode(path, bundle, texture_nodes) { + var pathKey = JSON.stringify(path); + texture_nodes[pathKey] = { + path: path, + bundle: bundle + }; + }, + // Hoist any remaining inline texture nodes that don't have a corresponding named texture + // base_bundle is the bundle for the root scene, for resolving textures from global properties + hoistTextureNodes: function hoistTextureNodes(config, base_bundle, texture_nodes) { + if (texture_nodes === void 0) { + texture_nodes = {}; + } + + for (var _i = 0, _Object$values = Object.values(texture_nodes); _i < _Object$values.length; _i++) { + var _Object$values$_i = _Object$values[_i], + path = _Object$values$_i.path, + bundle = _Object$values$_i.bundle; + var curValue = getPropertyPath(config, path); // Make sure current property values is a string to account for global property substitutions + // e.g. shader uniforms are ambiguous, could be replaced with string value indicating texture, + // but could also be a float, an array indicating vector, etc. + + if (typeof curValue === 'string' && config.textures[curValue] == null) { + if (isGlobalSubstitution(config, path)) { + // global substituions are resolved against the base scene path, not the import they came from + var url = base_bundle.urlFor(curValue); + config.textures[curValue] = { + url: url + }; + } else { + // non-global textures are resolved against the import they came from + var _url = bundle.urlFor(curValue); - // Texture by URL (string-named texture not referencing existing texture definition) - if (type === 'sampler2D' && typeof value === 'string' && !config.textures[value] && (include_globals || !isGlobal(value))) { - uniforms[key] = _this4.hoistTexture(value, config, bundle); - } - }); + config.textures[_url] = { + url: _url + }; + setPropertyPath(config, path, _url); } } } }, - // Convert an inline URL texture to a global one, and return the texture's (possibly modified) name - hoistTexture: function hoistTexture(tex, config, bundle) { - var global = isGlobal(tex); - var url = global ? tex : bundle.urlFor(tex); - var name = global ? "texture-" + url : url; - config.textures[name] = { - url: url - }; - return name; - }, // Substitutes global scene properties (those defined in the `config.global` object) for any style values // of the form `global.`, for example `color: global.park_color` would be replaced with the value (if any) // defined for the `park_color` property in `config.global.park_color`. - applyGlobalProperties: function applyGlobalProperties(config) { + applyGlobalProperties: function applyGlobalProperties$1(config) { if (!config.global || Object.keys(config.global).length === 0) { return config; // no global properties to transform } - var globals = flattenProperties(config.global); // flatten nested globals for simpler string look-ups - // Find and apply new global properties (and re-apply old ones) - - function applyGlobals(obj, target, key) { - var prop; // Check for previously applied global substitution - - if (target != null && typeof target === 'object' && target._global_prop && target._global_prop[key]) { - prop = target._global_prop[key]; - } // Check string for new global substitution - else if (typeof obj === 'string' && obj.slice(0, 7) === 'global.') { - prop = obj; - } // Found global property to substitute - - - if (prop) { - // Mark property as global substitution - if (target._global_prop == null) { - Object.defineProperty(target, '_global_prop', { - value: {} - }); - } - - target._global_prop[key] = prop; // Get current global value - - var val = globals[prop]; - var stack; - - while (typeof val === 'string' && val.slice(0, 7) === 'global.') { - // handle globals that refer to other globals, detecting any cyclical references - stack = stack || [prop]; - - if (stack.indexOf(val) > -1) { - __chunk_1.log({ - level: 'warn', - once: true - }, 'Global properties: cyclical reference detected', stack); - val = null; - break; - } + var globals = flattenGlobalProperties(config.global); // flatten nested globals for simpler string look-ups - stack.push(val); - val = globals[val]; - } // Create getter/setter - - - Object.defineProperty(target, key, { - enumerable: true, - get: function get() { - return val; // return substituted value - }, - set: function set(v) { - // clear the global substitution and remove the getter/setter - delete target._global_prop[key]; - delete target[key]; - target[key] = v; // save the new value - } - }); - } // Loop through object keys or array indices - else if (Array.isArray(obj)) { - for (var p = 0; p < obj.length; p++) { - applyGlobals(obj[p], obj, p); - } - } else if (typeof obj === 'object') { - for (var _p in obj) { - applyGlobals(obj[_p], obj, _p); - } - } - - return obj; - } - - return applyGlobals(config); + return applyGlobalProperties(globals, config); }, // Normalize some scene-wide settings that apply to the final, merged scene - finalize: function finalize(_ref5) { - var config = _ref5.config, - bundle = _ref5.bundle; + finalize: function finalize(_ref4) { + var config = _ref4.config, + bundle = _ref4.bundle; if (!config) { return {}; @@ -46222,37 +45934,10 @@ var SceneLoader$1 = SceneLoader = { bundle: bundle }; } -}; // Flatten nested properties for simpler string look-ups - -function flattenProperties(obj, prefix, globals) { - if (prefix === void 0) { - prefix = null; - } - - if (globals === void 0) { - globals = {}; - } - - prefix = prefix ? prefix + '.' : 'global.'; - - for (var p in obj) { - var key = prefix + p; - var val = obj[p]; - globals[key] = val; - - if (typeof val === 'object' && !Array.isArray(val)) { - flattenProperties(val, key, globals); - } - } - - return globals; -} - -__chunk_1.subscribeMixin(SceneLoader); +}; +sources.subscribeMixin(SceneLoader); -var TilePyramid = -/*#__PURE__*/ -function () { +var TilePyramid = /*#__PURE__*/function () { function TilePyramid() { this.tiles = {}; this.max_proxy_descendant_depth = 6; // # of levels to search up/down for proxy tiles @@ -46271,7 +45956,7 @@ function () { this.tiles[tile.key].tile = tile; // Add to parents while (tile.style_z >= 0) { - tile = __chunk_1.TileID.parent(tile); + tile = sources.TileID.parent(tile); if (!tile) { return; @@ -46299,7 +45984,7 @@ function () { while (tile.style_z >= 0) { - tile = __chunk_1.TileID.parent(tile); + tile = sources.TileID.parent(tile); if (!tile) { return; @@ -46320,7 +46005,7 @@ function () { var level = 0; while (level < this.max_proxy_ancestor_depth) { - tile = __chunk_1.TileID.parent(tile); + tile = sources.TileID.parent(tile); if (!tile) { return; @@ -46345,7 +46030,7 @@ function () { var descendants = []; if (level < this.max_proxy_descendant_depth) { - var tiles = __chunk_1.TileID.children(tile, this.children_cache); + var tiles = sources.TileID.children(tile, this.children_cache); if (!tiles) { return; @@ -46390,11 +46075,11 @@ function mainThreadLabelCollisionPass(tiles, view_zoom, hide_breach) { containers = buildLabels(tiles, view_zoom); // Collide all labels in a single group // TODO: maybe rename tile and style to group/subgroup? - __chunk_1.Collision.startTile('main', { + sources.Collision.startTile('main', { apply_repeat_groups: true, return_hidden: true }); - __chunk_1.Collision.addStyle('main', 'main'); // Adaptive collision grid, using a heuristic based on the tile with the most labels + sources.Collision.addStyle('main', 'main'); // Adaptive collision grid, using a heuristic based on the tile with the most labels max_tile_label_count = Math.max.apply(Math, [0].concat(Object.values(tiles).map(function (t) { return Object.values(t.meshes); @@ -46403,11 +46088,11 @@ function mainThreadLabelCollisionPass(tiles, view_zoom, hide_breach) { return mesh.labels ? Object.keys(mesh.labels).length : 0; }))); }))); - grid_divs = Math.floor(max_tile_label_count / __chunk_1.Geo.tile_size); + grid_divs = Math.floor(max_tile_label_count / sources.Geo.tile_size); // heuristic of label density to tile size if (grid_divs > 0) { - __chunk_1.Collision.initGrid({ + sources.Collision.initGrid({ anchor: { x: Math.min.apply(Math, tiles.map(function (t) { return t.min.x; @@ -46419,10 +46104,10 @@ function mainThreadLabelCollisionPass(tiles, view_zoom, hide_breach) { span: tiles[0].span.x / grid_divs }); } else { - __chunk_1.Collision.initGrid(); + sources.Collision.initGrid(); } - return Promise.resolve(__chunk_1.Collision.collide(containers, 'main', 'main')).then(function ($await_1) { + return Promise.resolve(sources.Collision.collide(containers, 'main', 'main')).then(function ($await_1) { try { labels = $await_1; meshes = []; @@ -46495,13 +46180,13 @@ function buildLabels(tiles, view_zoom) { var containers = {}; // Collect labels from each tile and turn into new label instances tiles.forEach(function (tile) { - var units_per_meter = __chunk_1.Geo.unitsPerMeter(tile.coords.z); // scale from tile units to mercator meters + var units_per_meter = sources.Geo.unitsPerMeter(tile.coords.z); // scale from tile units to mercator meters var zoom_scale = Math.pow(2, view_zoom - tile.style_z); // adjust label size by view zoom var size_scale = units_per_meter * zoom_scale; // scale from tile units to zoom-adjusted meters - var meters_per_pixel = __chunk_1.Geo.metersPerPixel(view_zoom); // First pass: create label instances and centralize collision containers + var meters_per_pixel = sources.Geo.metersPerPixel(view_zoom); // First pass: create label instances and centralize collision containers // Combine existing (previously collided) and pending (waiting to be collided for first time) meshes var tile_meshes = Object.assign({}, tile.meshes, tile.pending_label_meshes); @@ -46541,9 +46226,9 @@ function buildLabels(tiles, view_zoom) { if (label.type === 'point') { // TODO: move to integer constants to avoid excess string copies - __chunk_1.LabelPoint.prototype.updateBBoxes.call(label); + sources.LabelPoint.prototype.updateBBoxes.call(label); } else if (label.type === 'straight') { - __chunk_1.LabelLineStraight.prototype.updateBBoxes.call(label, label.position, label.size, label.angle, label.angle, label.offset); + sources.LabelLineStraight.prototype.updateBBoxes.call(label, label.position, label.size, label.angle, label.angle, label.offset); } else if (params.obbs) { // NB: this is a very rough approximation of curved label collision at intermediate zooms, // because the position/scale of each collision box isn't correctly updated; however, @@ -46558,7 +46243,7 @@ function buildLabels(tiles, view_zoom) { y = y / units_per_meter + tile.min.y; w /= size_scale; h /= size_scale; - return new __chunk_1.OBB(x, y, a, w, h); + return new sources.OBB(x, y, a, w, h); }); label.obbs = obbs; label.aabbs = obbs.map(function (o) { @@ -46604,7 +46289,7 @@ function discard(bboxes, exclude) { if (this.obb) { // single collision box - return __chunk_1.Label.prototype.occluded.call(this, bboxes, exclude); + return sources.Label.prototype.occluded.call(this, bboxes, exclude); } else if (this.obbs) { // mutliple collision boxes for (var i = 0; i < this.obbs.length; i++) { @@ -46614,7 +46299,7 @@ function discard(bboxes, exclude) { aabb: aabb, obb: obb }; - var should_discard = __chunk_1.Label.prototype.occluded.call(obj, bboxes, exclude); + var should_discard = sources.Label.prototype.occluded.call(obj, bboxes, exclude); if (should_discard) { return true; @@ -46625,9 +46310,7 @@ function discard(bboxes, exclude) { return false; } -var TileManager = -/*#__PURE__*/ -function () { +var TileManager = /*#__PURE__*/function () { function TileManager(_ref) { var scene = _ref.scene; this.scene = scene; @@ -46646,7 +46329,7 @@ function () { }; // Provide a hook for this object to be called from worker threads this.main_thread_target = ['TileManager', this.scene.id].join('_'); - __chunk_1.WorkerBroker.addTarget(this.main_thread_target, this); + sources.WorkerBroker.addTarget(this.main_thread_target, this); } var _proto = TileManager.prototype; @@ -46660,7 +46343,7 @@ function () { this.visible_coords = {}; this.queued_coords = []; this.scene = null; - __chunk_1.WorkerBroker.removeTarget(this.main_thread_target); + sources.WorkerBroker.removeTarget(this.main_thread_target); }; _proto.keepTile = function keepTile(tile) { @@ -46684,7 +46367,7 @@ function () { ; _proto.removeTile = function removeTile(key) { - __chunk_1.log('trace', "tile unload for " + key); + sources.log('trace', "tile unload for " + key); var tile = this.tiles[key]; if (tile != null) { @@ -46808,7 +46491,7 @@ function () { _this2.collision.task = null; - __chunk_1.Task.finish(task, results); // Check if tiles changed during previous collision pass - will start new pass if so + sources.Task.finish(task, results); // Check if tiles changed during previous collision pass - will start new pass if so _this2.updateTileStates(); @@ -46821,7 +46504,7 @@ function () { }, immediate: true }; - __chunk_1.Task.add(this.collision.task); + sources.Task.add(this.collision.task); } // else { // log('debug', `Skip label layout due to on-going layout (zoom ${this.view.zoom.toFixed(2)}, tiles ${this.collision.tile_keys})`); // } @@ -46874,7 +46557,7 @@ function () { } else { // brute force for (var key in this.visible_coords) { - if (__chunk_1.TileID.isDescendant(tile.coords, this.visible_coords[key])) { + if (sources.TileID.isDescendant(tile.coords, this.visible_coords[key])) { tile.visible = true; break; } @@ -46938,11 +46621,11 @@ function () { this.queued_coords.sort(function (a, b) { var center = _this5.view.center.meters; - var half_span = __chunk_1.Geo.metersPerTile(a.z) / 2; - var ac = __chunk_1.Geo.metersForTile(a); + var half_span = sources.Geo.metersPerTile(a.z) / 2; + var ac = sources.Geo.metersForTile(a); ac.x += half_span; ac.y -= half_span; - var bc = __chunk_1.Geo.metersForTile(b); + var bc = sources.Geo.metersForTile(b); bc.x += half_span; bc.y -= half_span; var ad = Math.abs(center.x - ac.x) + Math.abs(center.y - ac.y); @@ -46972,11 +46655,11 @@ function () { continue; } - var key = __chunk_1.TileID.normalizedKey(coords, source, this.view.tile_zoom); + var key = sources.TileID.normalizedKey(coords, source, this.view.tile_zoom); if (key && !this.hasTile(key)) { - __chunk_1.log('trace', "load tile " + key + ", distance from view center: " + coords.center_dist); - var tile = new __chunk_1.Tile({ + sources.log('trace', "load tile " + key + ", distance from view center: " + coords.center_dist); + var tile = new sources.Tile({ source: source, coords: coords, workers: this.scene.workers, @@ -47003,21 +46686,21 @@ function () { // Removed this tile during load? if (this.tiles[tile.key] == null) { - __chunk_1.log('trace', "discarded tile " + tile.key + " in TileManager.buildTileStylesCompleted because previously removed"); - __chunk_1.Tile.abortBuild(tile); + sources.log('trace', "discarded tile " + tile.key + " in TileManager.buildTileStylesCompleted because previously removed"); + sources.Tile.abortBuild(tile); this.updateTileStates(); } // Built with an outdated scene configuration? else if (tile.generation !== this.scene.generation) { - __chunk_1.log('trace', "discarded tile " + tile.key + " in TileManager.buildTileStylesCompleted because built with " + ("scene config gen " + tile.generation + ", current " + this.scene.generation)); - __chunk_1.Tile.abortBuild(tile); + sources.log('trace', "discarded tile " + tile.key + " in TileManager.buildTileStylesCompleted because built with " + ("scene config gen " + tile.generation + ", current " + this.scene.generation)); + sources.Tile.abortBuild(tile); this.updateTileStates(); } else { // Update tile with properties from worker if (this.tiles[tile.key]) { // Ignore if from a previously discarded tile if (tile.id < this.tiles[tile.key].id) { - __chunk_1.log('trace', "discarded tile " + tile.key + " for id " + tile.id + " in TileManager.buildTileStylesCompleted because built for discarded tile id"); - __chunk_1.Tile.abortBuild(tile); + sources.log('trace', "discarded tile " + tile.key + " for id " + tile.id + " in TileManager.buildTileStylesCompleted because built for discarded tile id"); + sources.Tile.abortBuild(tile); return; } @@ -47040,22 +46723,22 @@ function () { ; _proto.buildTileError = function buildTileError(tile) { - __chunk_1.log('error', "Error building tile " + tile.key + ":", tile.error); + sources.log('error', "Error building tile " + tile.key + ":", tile.error); this.forgetTile(tile.key); - __chunk_1.Tile.abortBuild(tile); + sources.Tile.abortBuild(tile); } // Track tile build state ; _proto.tileBuildStart = function tileBuildStart(key) { this.building_tiles = this.building_tiles || {}; this.building_tiles[key] = true; - __chunk_1.log('trace', "tileBuildStart for " + key + ": " + Object.keys(this.building_tiles).length); + sources.log('trace', "tileBuildStart for " + key + ": " + Object.keys(this.building_tiles).length); }; _proto.tileBuildStop = function tileBuildStop(key) { // Done building? if (this.building_tiles) { - __chunk_1.log('trace', "tileBuildStop for " + key + ": " + Object.keys(this.building_tiles).length); + sources.log('trace', "tileBuildStop for " + key + ": " + Object.keys(this.building_tiles).length); delete this.building_tiles[key]; this.checkBuildQueue(); } @@ -47100,7 +46783,7 @@ function () { return this.getDebugSum(prop, filter) / Object.keys(this.tiles).length; }; - __chunk_1._createClass(TileManager, [{ + sources._createClass(TileManager, [{ key: "view", get: function get() { return this.scene.view; @@ -47137,9 +46820,7 @@ function meshSetString(tiles) { })); } -var RenderState = -/*#__PURE__*/ -function () { +var RenderState = /*#__PURE__*/function () { function RenderState(value, setup) { setup(value); this.value = value; @@ -47225,15 +46906,13 @@ var RenderStateManager = function RenderStateManager(gl) { }); }; -__chunk_1.require$$0$4('Uint8', 1, function (init) { +sources.require$$0('Uint8', 1, function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }, true); -var MediaCapture = -/*#__PURE__*/ -function () { +var MediaCapture = /*#__PURE__*/function () { function MediaCapture() { this.canvas = null; this.gl = null; @@ -47289,7 +46968,7 @@ function () { var background = this.queue_screenshot.background; if (background && background !== 'transparent') { - background = __chunk_1.StyleParser.parseColor(background).slice(0, 3).map(function (c) { + background = sources.StyleParser.parseColor(background).slice(0, 3).map(function (c) { return c * 255; }); } else { @@ -47360,10 +47039,10 @@ function () { var _this2 = this; if (typeof window.MediaRecorder !== 'function' || !this.canvas || typeof this.canvas.captureStream !== 'function') { - __chunk_1.log('warn', 'Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser'); + sources.log('warn', 'Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser'); return false; } else if (this.video_capture) { - __chunk_1.log('warn', 'Video capture already in progress, call Scene.stopVideoCapture() first'); + sources.log('warn', 'Video capture already in progress, call Scene.stopVideoCapture() first'); return false; } // Start a new capture @@ -47388,7 +47067,7 @@ function () { var blob = new Blob(cap.chunks, { type: cap.options.mimeType }); - var url = __chunk_1.createObjectURL(blob); // Explicitly remove all stream tracks, and set objects to null + var url = sources.createObjectURL(blob); // Explicitly remove all stream tracks, and set objects to null if (cap.stream) { var tracks = cap.stream.getTracks() || []; @@ -47412,7 +47091,7 @@ function () { cap.media_recorder.start(); } catch (e) { this.video_capture = null; - __chunk_1.log('error', 'Scene video capture failed', e); + sources.log('error', 'Scene video capture failed', e); return false; } @@ -47424,7 +47103,7 @@ function () { var _this3 = this; if (!this.video_capture) { - __chunk_1.log('warn', 'No scene video capture in progress, call Scene.startVideoCapture() first'); + sources.log('warn', 'No scene video capture in progress, call Scene.startVideoCapture() first'); return Promise.resolve({}); } // Promise that will resolve when final stream is available @@ -47447,12 +47126,12 @@ function setupSceneDebug(scene) { profile: function profile(name) { console.profile("main thread: " + name); // eslint-disable-line no-console - __chunk_1.WorkerBroker.postMessage(scene.workers, 'self.profile', name); + sources.WorkerBroker.postMessage(scene.workers, 'self.profile', name); }, profileEnd: function profileEnd(name) { console.profileEnd("main thread: " + name); // eslint-disable-line no-console - __chunk_1.WorkerBroker.postMessage(scene.workers, 'self.profileEnd', name); + sources.WorkerBroker.postMessage(scene.workers, 'self.profileEnd', name); }, // Rebuild geometry a given # of times and print average, min, max timings timeRebuild: function timeRebuild(num, options) { @@ -47477,7 +47156,7 @@ function setupSceneDebug(scene) { var avg = ~~(times.reduce(function (a, b) { return a + b; }) / times.length); - __chunk_1.log('info', "Profiled rebuild " + num + " times: " + avg + " avg (" + Math.min.apply(Math, times) + " min, " + Math.max.apply(Math, times) + " max)"); + sources.log('info', "Profiled rebuild " + num + " times: " + avg + " avg (" + Math.min.apply(Math, times) + " min, " + Math.max.apply(Math, times) + " max)"); } }); }; @@ -47560,17 +47239,17 @@ function setupSceneDebug(scene) { }, // Return sum of all texture memory usage textureSizeTotal: function textureSizeTotal() { - return Object.values(__chunk_1.Texture.textures).map(function (t) { + return Object.values(sources.Texture.textures).map(function (t) { return t.byteSize(); }).reduce(function (p, c) { return p + c; }); }, layerStats: function layerStats() { - if (__chunk_1.debugSettings.layer_stats) { - return __chunk_1.debugSumLayerStats(scene.tile_manager.getRenderableTiles()); + if (sources.debugSettings.layer_stats) { + return sources.debugSumLayerStats(scene.tile_manager.getRenderableTiles()); } else { - __chunk_1.log('warn', 'Enable the \'layer_stats\' debug setting to collect layer stats'); + sources.log('warn', 'Enable the \'layer_stats\' debug setting to collect layer stats'); return {}; } }, @@ -47580,35 +47259,33 @@ function setupSceneDebug(scene) { }; } -var Scene = -/*#__PURE__*/ -function () { +var Scene = /*#__PURE__*/function () { function Scene(config_source, options) { options = options || {}; - __chunk_1.subscribeMixin(this); + sources.subscribeMixin(this); this.id = Scene.id++; this.initialized = false; this.initializing = null; // will be a promise that resolves when scene is loaded this.sources = {}; - this.view = new __chunk_1.View(this, options); + this.view = new sources.View(this, options); this.tile_manager = new TileManager({ scene: this }); this.num_workers = options.numWorkers || 2; if (options.disableVertexArrayObjects === true) { - __chunk_1.VertexArrayObject.disabled = true; + sources.VertexArrayObject.disabled = true; } - __chunk_1.Utils.use_high_density_display = options.highDensityDisplay !== undefined ? options.highDensityDisplay : true; - __chunk_1.Utils.updateDevicePixelRatio(); + sources.Utils.use_high_density_display = options.highDensityDisplay !== undefined ? options.highDensityDisplay : true; + sources.Utils.updateDevicePixelRatio(); this.config = null; this.config_source = config_source; this.config_bundle = null; this.last_valid_config_source = null; this.styles = null; - this.style_manager = new __chunk_1.StyleManager(); + this.style_manager = new sources.StyleManager(); this.building = null; // tracks current scene building state (tiles being built, etc.) this.dirty = true; // request a redraw @@ -47662,8 +47339,8 @@ function () { setupSceneDebug(this); this.log_level = options.logLevel || 'warn'; - __chunk_1.log.setLevel(this.log_level); - __chunk_1.log.reset(); + sources.log.setLevel(this.log_level); + sources.log.reset(); } Scene.create = function create(config, options) { @@ -47695,7 +47372,7 @@ function () { return this.initializing; } - __chunk_1.log.reset(); + sources.log.reset(); this.updating++; this.initialized = false; this.view_complete = false; // track if a view complete event has been triggered yet @@ -47720,40 +47397,60 @@ function () { this.createCanvas(); this.prev_textures = this.config && Object.keys(this.config.textures); // save textures from last scene - this.initializing = this.loadScene(config_source, options).then(function () { - return _this.createWorkers(); - }).then(function () { - // Clean up resources from prior scene - _this.destroyFeatureSelection(); + this.initializing = this.loadScene(config_source, options).then(function (_ref) { + return new Promise(function ($return, $error) { + var texture_nodes, serialize_funcs, updating; + texture_nodes = _ref.texture_nodes; + return Promise.resolve(_this.createWorkers()).then(function ($await_5) { + try { + // Clean up resources from prior scene + _this.destroyFeatureSelection(); + + sources.WorkerBroker.postMessage(_this.workers, 'self.clearFunctionStringCache'); // Scene loaded from a JS object, or modified by a `load` event, may contain compiled JS functions + // which need to be serialized, while one loaded only from a URL does not. + + serialize_funcs = typeof _this.config_source === 'object' || _this.hasSubscribersFor('load'); + updating = _this.updateConfig({ + texture_nodes: texture_nodes, + serialize_funcs: serialize_funcs, + normalize: false, + loading: true, + fade_in: true + }); - __chunk_1.WorkerBroker.postMessage(_this.workers, 'self.clearFunctionStringCache'); // Scene loaded from a JS object, or modified by a `load` event, may contain compiled JS functions - // which need to be serialized, while one loaded only from a URL does not. + if (options.blocking === true) { + return Promise.resolve(updating).then(function ($await_6) { + try { + return $If_4.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + } - var serialize_funcs = typeof _this.config_source === 'object' || _this.hasSubscribersFor('load'); + function $If_4() { + _this.freePreviousTextures(); - var updating = _this.updateConfig({ - serialize_funcs: serialize_funcs, - normalize: false, - loading: true, - fade_in: true - }); + _this.updating--; + _this.initializing = null; + _this.initialized = true; + _this.last_valid_config_source = _this.config_source; + _this.last_valid_options = { + base_path: options.base_path, + file_type: options.file_type + }; - if (options.blocking === true) { - return updating; - } - }).then(function () { - _this.freePreviousTextures(); + _this.requestRedraw(); - _this.updating--; - _this.initializing = null; - _this.initialized = true; - _this.last_valid_config_source = _this.config_source; - _this.last_valid_options = { - base_path: options.base_path, - file_type: options.file_type - }; + return $return(); + } - _this.requestRedraw(); + return $If_4.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + }); }).catch(function (error) { _this.initializing = null; _this.updating = 0; // Report and revert to last valid config if available @@ -47778,12 +47475,12 @@ function () { message = "Scene.load() failed to load " + JSON.stringify(_this.config_source) + ": " + error.message; if (_this.last_valid_config_source) { - __chunk_1.log('warn', message, error); - __chunk_1.log('info', 'Scene.load() reverting to last valid configuration'); + sources.log('warn', message, error); + sources.log('info', 'Scene.load() reverting to last valid configuration'); return _this.load(_this.last_valid_config_source, _this.last_valid_base_path); } - __chunk_1.log('error', message, error); + sources.log('error', message, error); throw error; }); return this.initializing; @@ -47804,10 +47501,10 @@ function () { this.container = null; if (this.gl) { - __chunk_1.Texture.destroy(this.gl); + sources.Texture.destroy(this.gl); this.style_manager.destroy(this.gl); this.styles = {}; - __chunk_1.ShaderProgram.reset(); // Force context loss + sources.ShaderProgram.reset(); // Force context loss var ext = this.gl.getExtension('WEBGL_lose_context'); @@ -47822,7 +47519,7 @@ function () { this.destroyWorkers(); this.tile_manager.destroy(); this.tile_manager = null; - __chunk_1.log.reset(); + sources.log.reset(); }; _proto.createCanvas = function createCanvas() { @@ -47844,7 +47541,7 @@ function () { alpha: true, premultipliedAlpha: true, stencil: true, - device_pixel_ratio: __chunk_1.Utils.device_pixel_ratio, + device_pixel_ratio: sources.Utils.device_pixel_ratio, powerPreference: 'high-performance' }, this.contextOptions)); } catch (e) { @@ -47852,7 +47549,7 @@ function () { } this.resizeMap(this.container.clientWidth, this.container.clientHeight); - __chunk_1.VertexArrayObject.init(this.gl); + sources.VertexArrayObject.init(this.gl); this.render_states = new RenderStateManager(this.gl); this.media_capture.setCanvas(this.canvas, this.gl); } // Update list of any custom scripts (either at scene-level or data-source-level) @@ -47918,14 +47615,14 @@ function () { var worker = new Worker(Tangram.workerURL); // eslint-disable-line no-undef _this2.workers[id] = worker; - __chunk_1.WorkerBroker.addWorker(worker); - __chunk_1.log('debug', "Scene.makeWorkers: initializing worker " + id); + sources.WorkerBroker.addWorker(worker); + sources.log('debug', "Scene.makeWorkers: initializing worker " + id); var _id = id; - queue.push(__chunk_1.WorkerBroker.postMessage(worker, 'self.init', _this2.id, id, _this2.num_workers, _this2.log_level, __chunk_1.Utils.device_pixel_ratio, has_element_index_uint, _this2.external_scripts).then(function (id) { - __chunk_1.log('debug', "Scene.makeWorkers: initialized worker " + id); + queue.push(sources.WorkerBroker.postMessage(worker, 'self.init', _this2.id, id, _this2.num_workers, _this2.log_level, sources.Utils.device_pixel_ratio, has_element_index_uint, _this2.external_scripts).then(function (id) { + sources.log('debug', "Scene.makeWorkers: initialized worker " + id); return id; }, function (error) { - __chunk_1.log('error', "Scene.makeWorkers: failed to initialize worker " + _id + ":", error); + sources.log('error', "Scene.makeWorkers: failed to initialize worker " + _id + ":", error); return Promise.reject(error); })); }; @@ -47936,7 +47633,7 @@ function () { this.next_worker = 0; return Promise.all(queue).then(function () { - __chunk_1.log.setWorkers(_this2.workers); + sources.log.setWorkers(_this2.workers); }); }; @@ -47944,7 +47641,7 @@ function () { this.selection = null; // selection needs to be re-initialized when workers are if (Array.isArray(this.workers)) { - __chunk_1.log.setWorkers(null); + sources.log.setWorkers(null); this.workers.forEach(function (worker) { worker.terminate(); }); @@ -47965,8 +47662,8 @@ function () { _proto.updateDevicePixelRatio = function updateDevicePixelRatio() { var _this3 = this; - if (__chunk_1.Utils.updateDevicePixelRatio()) { - __chunk_1.WorkerBroker.postMessage(this.workers, 'self.updateDevicePixelRatio', __chunk_1.Utils.device_pixel_ratio).then(function () { + if (sources.Utils.updateDevicePixelRatio()) { + sources.WorkerBroker.postMessage(this.workers, 'self.updateDevicePixelRatio', sources.Utils.device_pixel_ratio).then(function () { return _this3.rebuild(); }).then(function () { return _this3.resizeMap(_this3.view.size.css.width, _this3.view.size.css.height); @@ -47983,7 +47680,7 @@ function () { this.view.setViewportSize(width, height); if (this.gl) { - Context$1.resize(this.gl, width, height, __chunk_1.Utils.device_pixel_ratio); + Context$1.resize(this.gl, width, height, sources.Utils.device_pixel_ratio); } } // Request scene be redrawn at next animation loop ; @@ -48006,10 +47703,10 @@ function () { this.update(); // Pending background tasks - __chunk_1.Task.setState({ + sources.Task.setState({ user_moving_view: this.view.user_input_active }); - __chunk_1.Task.processAll(); // Request the next frame if not scheduled to stop + sources.Task.processAll(); // Request the next frame if not scheduled to stop if (!this.render_loop_stop) { window.requestAnimationFrame(this.renderLoop.bind(this)); @@ -48064,16 +47761,16 @@ function () { } this.frame++; - __chunk_1.log('trace', 'Scene.render()'); + sources.log('trace', 'Scene.render()'); return true; } // Accepts flags indicating which render passes should be made ; - _proto.render = function render(_ref) { + _proto.render = function render(_ref2) { var _this5 = this; - var main = _ref.main, - selection = _ref.selection; + var main = _ref2.main, + selection = _ref2.selection; var gl = this.gl; this.updateBackground(); Object.keys(this.lights).forEach(function (i) { @@ -48091,7 +47788,7 @@ function () { this.logFirstFrame(); this.getFeatureSelectionMapSize().then(function (size) { _this5.selection_feature_count = size; - __chunk_1.log('info', "Scene: rendered " + _this5.render_count + " primitives (" + size + " features in selection map)"); + sources.log('info', "Scene: rendered " + _this5.render_count + " primitives (" + size + " features in selection map)"); }); } @@ -48137,8 +47834,8 @@ function () { program_key = 'program'; } - var _ref2 = _temp === void 0 ? {} : _temp, - allow_blend = _ref2.allow_blend; + var _ref3 = _temp === void 0 ? {} : _temp, + allow_blend = _ref3.allow_blend; // optionally force alpha off (e.g. for selection pass) allow_blend = allow_blend == null ? true : allow_blend; @@ -48150,21 +47847,10 @@ function () { var blend_orders = this.style_manager.getActiveBlendOrders(); - for (var _iterator = blend_orders, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref3; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref3 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref3 = _i.value; - } - - var _ref4 = _ref3, - blend_order = _ref4.blend_order, - styles = _ref4.styles; + for (var _iterator = sources._createForOfIteratorHelperLoose(blend_orders), _step; !(_step = _iterator()).done;) { + var _step$value = _step.value, + blend_order = _step$value.blend_order, + styles = _step$value.styles; var _loop2 = function _loop2(s) { var style = _this6.styles[styles[s]]; @@ -48175,11 +47861,11 @@ function () { if (style.blend !== last_blend) { - var state = Object.assign({}, __chunk_1.Style.render_states[style.blend], // render state for blend mode + var state = Object.assign({}, sources.Style.render_states[style.blend], // render state for blend mode { - blend: allow_blend && style.blend // enable/disable blending (e.g. no blend for selection) - - }); + blend: allow_blend && style.blend + } // enable/disable blending (e.g. no blend for selection) + ); _this6.setRenderState(state); } @@ -48306,27 +47992,18 @@ function () { // Mesh variants must be rendered in requested order across tiles, to prevent labels that cross // tile boundaries from rendering over adjacent tile features meant to be underneath - var max_mesh_order = Math.max.apply(Math, tile_meshes.map(function (_ref5) { - var meshes = _ref5[1]; + var max_mesh_order = Math.max.apply(Math, tile_meshes.map(function (_ref4) { + var meshes = _ref4[1]; return Math.max.apply(Math, meshes.map(function (m) { return m.variant.mesh_order; })); })); // One pass per mesh variant order (loop goes to max value +1 because 0 is a valid order value) var _loop3 = function _loop3(mo) { - var _loop5 = function _loop5() { - if (_isArray2) { - if (_i2 >= _iterator2.length) return "break"; - _ref6 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) return "break"; - _ref6 = _i2.value; - } - - var _ref7 = _ref6, - tile = _ref7[0], - meshes = _ref7[1]; + var _loop4 = function _loop4() { + var _step2$value = _step2.value, + tile = _step2$value[0], + meshes = _step2$value[1]; var first_for_tile = true; // Skip proxy tiles if new tiles have finished loading this style if (!tile.shouldProxyForStyle(style_name)) { @@ -48379,21 +48056,11 @@ function () { }; // Loop over tiles, with meshes pre-filtered by current blend order - _loop4: for (var _iterator2 = tile_meshes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref6; - - var _ret3 = _loop5(); - - switch (_ret3) { - case "break": - break _loop4; + for (var _iterator2 = sources._createForOfIteratorHelperLoose(tile_meshes), _step2; !(_step2 = _iterator2()).done;) { + var _ret3 = _loop4(); - case "continue": - continue; - - default: - if (typeof _ret3 === "object") return _ret3.v; - } + if (_ret3 === "continue") continue; + if (typeof _ret3 === "object") return _ret3.v; } }; @@ -48450,11 +48117,11 @@ function () { }; _proto.setRenderState = function setRenderState(_temp2) { - var _ref8 = _temp2 === void 0 ? {} : _temp2, - depth_test = _ref8.depth_test, - depth_write = _ref8.depth_write, - cull_face = _ref8.cull_face, - blend = _ref8.blend; + var _ref5 = _temp2 === void 0 ? {} : _temp2, + depth_test = _ref5.depth_test, + depth_write = _ref5.depth_write, + cull_face = _ref5.cull_face, + blend = _ref5.blend; if (!this.initialized) { return; @@ -48525,11 +48192,11 @@ function () { ; _proto.getFeatureAt = function getFeatureAt(pixel, _temp3) { - var _ref9 = _temp3 === void 0 ? {} : _temp3, - radius = _ref9.radius; + var _ref6 = _temp3 === void 0 ? {} : _temp3, + radius = _ref6.radius; if (!this.initialized) { - __chunk_1.log('debug', 'Scene.getFeatureAt() called before scene was initialized'); + sources.log('debug', 'Scene.getFeatureAt() called before scene was initialized'); return Promise.resolve(); } // skip selection if no interactive features @@ -48574,22 +48241,22 @@ function () { _proto.queryFeatures = function queryFeatures(_temp4) { return new Promise(function ($return, $error) { - var _ref10, filter, _ref10$unique, unique, _ref10$group_by, group_by, _ref10$visible, visible, _ref10$geometry, geometry, uniqueify_on_id, uniqueify, group, tile_keys, results, features, keys, groups; + var _ref7, filter, _ref7$unique, unique, _ref7$group_by, group_by, _ref7$visible, visible, _ref7$geometry, geometry, uniqueify_on_id, uniqueify, group, tile_keys, results, features, keys, groups; - _ref10 = _temp4 === void 0 ? {} : _temp4, filter = _ref10.filter, _ref10$unique = _ref10.unique, unique = _ref10$unique === void 0 ? true : _ref10$unique, _ref10$group_by = _ref10.group_by, group_by = _ref10$group_by === void 0 ? null : _ref10$group_by, _ref10$visible = _ref10.visible, visible = _ref10$visible === void 0 ? null : _ref10$visible, _ref10$geometry = _ref10.geometry, geometry = _ref10$geometry === void 0 ? false : _ref10$geometry; + _ref7 = _temp4 === void 0 ? {} : _temp4, filter = _ref7.filter, _ref7$unique = _ref7.unique, unique = _ref7$unique === void 0 ? true : _ref7$unique, _ref7$group_by = _ref7.group_by, group_by = _ref7$group_by === void 0 ? null : _ref7$group_by, _ref7$visible = _ref7.visible, visible = _ref7$visible === void 0 ? null : _ref7$visible, _ref7$geometry = _ref7.geometry, geometry = _ref7$geometry === void 0 ? false : _ref7$geometry; if (!this.initialized) { return $return([]); } - filter = __chunk_1.Utils.serializeWithFunctions(filter); // Optional uniqueify criteria + filter = sources.Utils.serializeWithFunctions(filter); // Optional uniqueify criteria // Valid values: true, false/null, single property name, or array of property names unique = typeof unique === 'string' ? [unique] : unique; uniqueify_on_id = unique === true || Array.isArray(unique) && unique.indexOf('$id') > -1; uniqueify = unique && function (obj) { - var properties = Array.isArray(unique) ? __chunk_1.sliceObject(obj.properties, unique) : obj.properties; + var properties = Array.isArray(unique) ? sources.sliceObject(obj.properties, unique) : obj.properties; var id = uniqueify_on_id ? obj.id : null; if (geometry) { @@ -48612,20 +48279,20 @@ function () { group_by = (typeof group_by === 'string' || Array.isArray(group_by)) && group_by; group = group_by && function (obj) { - return Array.isArray(group_by) ? JSON.stringify(__chunk_1.sliceObject(obj, group_by)) : obj[group_by]; + return Array.isArray(group_by) ? JSON.stringify(sources.sliceObject(obj, group_by)) : obj[group_by]; }; tile_keys = this.tile_manager.getRenderableTiles().map(function (t) { return t.key; }); - return Promise.resolve(__chunk_1.WorkerBroker.postMessage(this.workers, 'self.queryFeatures', { + return Promise.resolve(sources.WorkerBroker.postMessage(this.workers, 'self.queryFeatures', { filter: filter, visible: visible, geometry: geometry, tile_keys: tile_keys - })).then(function ($await_4) { + })).then(function ($await_7) { try { - results = $await_4; + results = $await_7; features = []; keys = {}; groups = {}; @@ -48666,18 +48333,18 @@ function () { _proto.rebuild = function rebuild(_temp5) { var _this8 = this; - var _ref11 = _temp5 === void 0 ? {} : _temp5, - _ref11$initial = _ref11.initial, - initial = _ref11$initial === void 0 ? false : _ref11$initial, - _ref11$new_generation = _ref11.new_generation, - new_generation = _ref11$new_generation === void 0 ? true : _ref11$new_generation, - _ref11$sources = _ref11.sources, - sources = _ref11$sources === void 0 ? null : _ref11$sources, - serialize_funcs = _ref11.serialize_funcs, - _ref11$profile = _ref11.profile, - profile = _ref11$profile === void 0 ? false : _ref11$profile, - _ref11$fade_in = _ref11.fade_in, - fade_in = _ref11$fade_in === void 0 ? false : _ref11$fade_in; + var _ref8 = _temp5 === void 0 ? {} : _temp5, + _ref8$initial = _ref8.initial, + initial = _ref8$initial === void 0 ? false : _ref8$initial, + _ref8$new_generation = _ref8.new_generation, + new_generation = _ref8$new_generation === void 0 ? true : _ref8$new_generation, + _ref8$sources = _ref8.sources, + sources$1 = _ref8$sources === void 0 ? null : _ref8$sources, + serialize_funcs = _ref8.serialize_funcs, + _ref8$profile = _ref8.profile, + profile = _ref8$profile === void 0 ? false : _ref8$profile, + _ref8$fade_in = _ref8.fade_in, + fade_in = _ref8$fade_in === void 0 ? false : _ref8$fade_in; return new Promise(function (resolve, reject) { // Skip rebuild if already in progress @@ -48685,7 +48352,7 @@ function () { // Queue up to one rebuild call at a time, only save last request if (_this8.building.queued && _this8.building.queued.reject) { // notify previous request that it did not complete - __chunk_1.log('debug', 'Scene.rebuild: request superceded by a newer call'); + sources.log('debug', 'Scene.rebuild: request superceded by a newer call'); _this8.building.queued.resolve(false); // false flag indicates rebuild request was superceded @@ -48695,7 +48362,7 @@ function () { var options = { initial: initial, new_generation: new_generation, - sources: sources, + sources: sources$1, serialize_funcs: serialize_funcs, profile: profile, fade_in: fade_in @@ -48705,7 +48372,7 @@ function () { reject: reject, options: options }; - __chunk_1.log('trace', 'Scene.rebuild(): queuing request'); + sources.log('trace', 'Scene.rebuild(): queuing request'); return; } // Track tile build state @@ -48735,7 +48402,7 @@ function () { serialize_funcs: serialize_funcs }); - _this8.resetWorkerFeatureSelection(sources); + _this8.resetWorkerFeatureSelection(sources$1); _this8.resetTime(); // Rebuild visible tiles @@ -48743,7 +48410,7 @@ function () { _this8.tile_manager.pruneToVisibleTiles(); _this8.tile_manager.forEachTile(function (tile) { - if (!sources || sources.indexOf(tile.source.name) > -1) { + if (!sources$1 || sources$1.indexOf(tile.source.name) > -1) { _this8.tile_manager.buildTile(tile, { fade_in: fade_in }); @@ -48766,10 +48433,10 @@ function () { ; _proto.tileManagerBuildDone = function tileManagerBuildDone() { - __chunk_1.TextCanvas.pruneTextCache(); + sources.TextCanvas.pruneTextCache(); if (this.building) { - __chunk_1.log('info', 'Scene: build geometry finished'); + sources.log('info', 'Scene: build geometry finished'); if (this.building.resolve) { this.logFirstBuild(); @@ -48781,7 +48448,7 @@ function () { this.building = null; if (queued) { - __chunk_1.log('debug', 'Scene: starting queued rebuild() request'); + sources.log('debug', 'Scene: starting queued rebuild() request'); this.rebuild(queued.options).then(queued.resolve, queued.reject); } else { this.tile_manager.updateLabels(); // refresh label if nothing to rebuild @@ -48795,37 +48462,41 @@ function () { ; _proto.loadScene = function loadScene(config_source, _temp6) { - var _this9 = this; + return new Promise(function ($return, $error) { + var _ref9, base_path, file_type, _await$SceneLoader$lo, config, bundle, texture_nodes; - if (config_source === void 0) { - config_source = null; - } + if (config_source === void 0) { + config_source = null; + } - var _ref12 = _temp6 === void 0 ? {} : _temp6, - base_path = _ref12.base_path, - file_type = _ref12.file_type; + _ref9 = _temp6 === void 0 ? {} : _temp6, base_path = _ref9.base_path, file_type = _ref9.file_type; + this.config_source = config_source || this.config_source; - this.config_source = config_source || this.config_source; + if (typeof this.config_source === 'string') { + this.base_path = sources.pathForURL(base_path || this.config_source); + } else { + this.base_path = sources.pathForURL(base_path); + } // backwards compatibility for accessing base path under previous name + // TODO: schedule for deprecation - if (typeof this.config_source === 'string') { - this.base_path = __chunk_1.pathForURL(base_path || this.config_source); - } else { - this.base_path = __chunk_1.pathForURL(base_path); - } // backwards compatibility for accessing base path under previous name - // TODO: schedule for deprecation - - - this.config_path = this.base_path; - return SceneLoader$1.loadScene(this.config_source, { - path: this.base_path, - type: file_type - }).then(function (_ref13) { - var config = _ref13.config, - bundle = _ref13.bundle; - _this9.config = config; - _this9.config_bundle = bundle; - return _this9.config; - }); + + this.config_path = this.base_path; + return Promise.resolve(SceneLoader.loadScene(this.config_source, { + path: this.base_path, + type: file_type + })).then(function ($await_8) { + try { + _await$SceneLoader$lo = $await_8, config = _await$SceneLoader$lo.config, bundle = _await$SceneLoader$lo.bundle, texture_nodes = _await$SceneLoader$lo.texture_nodes; + this.config = config; + this.config_bundle = bundle; + return $return({ + texture_nodes: texture_nodes + }); // pass along texture nodes for resolution after global property subtistution + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + }.bind(this)); } // Add source to a scene, arguments `name` and `config` need to be provided: // - If the name doesn't match a sources it will create it // - the `config` obj follow the YAML scene spec, ex: ```{type: 'TopoJSON', url: "//tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson"]}``` @@ -48843,7 +48514,7 @@ function () { _proto.setDataSource = function setDataSource(name, config) { if (!name || !config || !config.type || !config.url && !config.data) { - __chunk_1.log('error', 'No name provided or not a valid config:', name, config); + sources.log('error', 'No name provided or not a valid config:', name, config); return; } @@ -48851,7 +48522,7 @@ function () { var source = this.config.sources[name] = Object.assign({}, config); // Convert raw data into blob URL if (source.data && typeof source.data === 'object') { - source.url = __chunk_1.createObjectURL(new Blob([JSON.stringify(source.data)])); + source.url = sources.createObjectURL(new Blob([JSON.stringify(source.data)])); delete source.data; } @@ -48872,7 +48543,7 @@ function () { ; _proto.createDataSources = function createDataSources(rebuild_all) { - var _this10 = this; + var _this9 = this; if (rebuild_all === void 0) { rebuild_all = false; @@ -48892,7 +48563,7 @@ function () { name: name, id: source_id++ }); - this.sources[name] = __chunk_1.DataSource.create(config, this.sources); + this.sources[name] = sources.DataSource.create(config, this.sources); if (!this.sources[name]) { throw {}; @@ -48900,7 +48571,7 @@ function () { } catch (e) { delete this.sources[name]; var message = "Could not create data source: " + e.message; - __chunk_1.log('warn', "Scene: " + message, source); + sources.log('warn', "Scene: " + message, source); this.trigger('warning', { type: 'sources', source: source, @@ -48910,15 +48581,15 @@ function () { // If so, we'll re-calculate the tiles in view for this source and rebuild them - if (rebuild_all || __chunk_1.DataSource.tileLayoutChanged(this.sources[name], prev_source)) { + if (rebuild_all || sources.DataSource.tileLayoutChanged(this.sources[name], prev_source)) { reset.push(name); } } // Sources that were removed prev_source_names.forEach(function (s) { - if (!_this10.config.sources[s]) { - delete _this10.sources[s]; // TODO: remove from workers too? + if (!_this9.config.sources[s]) { + delete _this9.sources[s]; // TODO: remove from workers too? reset.push(s); } @@ -48942,16 +48613,16 @@ function () { ; _proto.loadTextures = function loadTextures() { - var _this11 = this; + var _this10 = this; - return __chunk_1.Texture.createFromObject(this.gl, this.config.textures).then(function () { - return __chunk_1.Texture.createDefault(_this11.gl); + return sources.Texture.createFromObject(this.gl, this.config.textures).then(function () { + return sources.Texture.createDefault(_this10.gl); }); // create a 'default' texture for placeholders } // Free textures from previously loaded scene ; _proto.freePreviousTextures = function freePreviousTextures() { - var _this12 = this; + var _this11 = this; if (!this.prev_textures) { return; @@ -48959,8 +48630,8 @@ function () { this.prev_textures.forEach(function (t) { // free textures that aren't in the new scene, but are still in the global texture set - if (!_this12.config.textures[t] && __chunk_1.Texture.textures[t]) { - __chunk_1.Texture.textures[t].destroy(); + if (!_this11.config.textures[t] && sources.Texture.textures[t]) { + sources.Texture.textures[t].destroy(); } }); this.prev_textures = null; @@ -48998,8 +48669,8 @@ function () { _proto.createLights = function createLights() { this.lights = {}; - if (__chunk_1.debugSettings.wireframe) { - __chunk_1.Light.enabled = false; // disable lighting for wireframe mode + if (sources.debugSettings.wireframe) { + sources.Light.enabled = false; // disable lighting for wireframe mode } for (var i in this.config.lights) { @@ -49013,11 +48684,11 @@ function () { light.visible = light.visible === false ? false : true; if (light.visible) { - this.lights[light.name] = __chunk_1.Light.create(this.view, light); + this.lights[light.name] = sources.Light.create(this.view, light); } } - __chunk_1.Light.inject(this.lights); + sources.Light.inject(this.lights); } // Set background color from scene config ; @@ -49026,18 +48697,18 @@ function () { this.background = {}; if (bg && bg.color) { - this.background.color = __chunk_1.StyleParser.createColorPropertyCache(bg.color); + this.background.color = sources.StyleParser.createColorPropertyCache(bg.color); } if (!this.background.color) { - this.background.color = __chunk_1.StyleParser.createColorPropertyCache([0, 0, 0, 0]); // default background TODO: vary w/scene alpha + this.background.color = sources.StyleParser.createColorPropertyCache([0, 0, 0, 0]); // default background TODO: vary w/scene alpha } } // Update background color each frame as needed (e.g. may be zoom-interpolated) ; _proto.updateBackground = function updateBackground() { var last_color = this.background.computed_color; - var color = this.background.computed_color = __chunk_1.StyleParser.evalCachedColorProperty(this.background.color, { + var color = this.background.computed_color = sources.StyleParser.evalCachedColorProperty(this.background.color, { zoom: this.view.tile_zoom }); // update GL/canvas if color has changed @@ -49061,7 +48732,7 @@ function () { ; _proto.setIntrospection = function setIntrospection(val) { - var _this13 = this; + var _this12 = this; if (val !== this.introspection) { this.introspection = val != null ? val : false; @@ -49069,7 +48740,7 @@ function () { return this.updateConfig({ normalize: false }).then(function () { - return _this13.updating--; + return _this12.updating--; }); } @@ -49079,35 +48750,32 @@ function () { ; _proto.updateConfig = function updateConfig(_temp7) { - var _this14 = this; + var _this13 = this; - var _ref14 = _temp7 === void 0 ? {} : _temp7, - _ref14$loading = _ref14.loading, - loading = _ref14$loading === void 0 ? false : _ref14$loading, - _ref14$rebuild = _ref14.rebuild, - rebuild = _ref14$rebuild === void 0 ? true : _ref14$rebuild, - serialize_funcs = _ref14.serialize_funcs, - _ref14$normalize = _ref14.normalize, - normalize = _ref14$normalize === void 0 ? true : _ref14$normalize, - _ref14$fade_in = _ref14.fade_in, - fade_in = _ref14$fade_in === void 0 ? false : _ref14$fade_in; + var _ref10 = _temp7 === void 0 ? {} : _temp7, + _ref10$loading = _ref10.loading, + loading = _ref10$loading === void 0 ? false : _ref10$loading, + _ref10$rebuild = _ref10.rebuild, + rebuild = _ref10$rebuild === void 0 ? true : _ref10$rebuild, + serialize_funcs = _ref10.serialize_funcs, + _ref10$texture_nodes = _ref10.texture_nodes, + texture_nodes = _ref10$texture_nodes === void 0 ? {} : _ref10$texture_nodes, + _ref10$normalize = _ref10.normalize, + normalize = _ref10$normalize === void 0 ? true : _ref10$normalize, + _ref10$fade_in = _ref10.fade_in, + fade_in = _ref10$fade_in === void 0 ? false : _ref10$fade_in; this.generation = ++Scene.generation; - this.updating++; - this.config = SceneLoader$1.applyGlobalProperties(this.config); + this.updating++; // Apply globals, finalize textures and other resource paths if needed - if (normalize) { - // normalize whole scene - SceneLoader$1.normalize(this.config, this.config_bundle); - } else { - // special handling for shader uniforms that are globals - SceneLoader$1.hoistStyleShaderUniformTextures(this.config, this.config_bundle, { - include_globals: true - }); // just normalize top-level textures - necessary for adding base path to globals + this.config = SceneLoader.applyGlobalProperties(this.config); - SceneLoader$1.normalizeTextures(this.config, this.config_bundle); + if (normalize) { + // normalize whole scene if requested - usually when user is making run-time updates to scene + SceneLoader.normalize(this.config, this.config_bundle, texture_nodes); } + SceneLoader.hoistTextureNodes(this.config, this.config_bundle, texture_nodes); this.trigger(loading ? 'load' : 'update', { config: this.config }); @@ -49117,7 +48785,7 @@ function () { this.createDataSources(loading); this.loadTextures(); this.setBackground(); - __chunk_1.FontManager.loadFonts(this.config.fonts); // TODO: detect changes to styles? already (currently) need to recompile anyway when camera or lights change + sources.FontManager.loadFonts(this.config.fonts); // TODO: detect changes to styles? already (currently) need to recompile anyway when camera or lights change this.updateStyles(); // Optionally rebuild geometry @@ -49135,64 +48803,64 @@ function () { this.view.updateBounds(); this.requestRedraw(); return done.then(function () { - _this14.last_render_count = 0; // force re-evaluation of selection map + _this13.last_render_count = 0; // force re-evaluation of selection map - _this14.requestRedraw(); + _this13.requestRedraw(); }); } // Serialize config and send to worker ; _proto.syncConfigToWorker = function syncConfigToWorker(_temp8) { - var _ref15 = _temp8 === void 0 ? {} : _temp8, - _ref15$serialize_func = _ref15.serialize_funcs, - serialize_funcs = _ref15$serialize_func === void 0 ? true : _ref15$serialize_func; + var _ref11 = _temp8 === void 0 ? {} : _temp8, + _ref11$serialize_func = _ref11.serialize_funcs, + serialize_funcs = _ref11$serialize_func === void 0 ? true : _ref11$serialize_func; // Tell workers we're about to rebuild (so they can update styles, etc.) - var config_serialized = serialize_funcs ? __chunk_1.Utils.serializeWithFunctions(this.config) : JSON.stringify(this.config); - return __chunk_1.WorkerBroker.postMessage(this.workers, 'self.updateConfig', { + var config_serialized = serialize_funcs ? sources.Utils.serializeWithFunctions(this.config) : JSON.stringify(this.config); + return sources.WorkerBroker.postMessage(this.workers, 'self.updateConfig', { config: config_serialized, generation: this.generation, introspection: this.introspection - }, __chunk_1.debugSettings); + }, sources.debugSettings); } // Listen to related objects ; _proto.createListeners = function createListeners() { - var _this15 = this; + var _this14 = this; this.listeners = {}; this.listeners.view = { move: function move() { - return _this15.trigger('move'); + return _this14.trigger('move'); } }; this.view.subscribe(this.listeners.view); this.listeners.texture = { update: function update() { - return _this15.dirty = true; + return _this14.dirty = true; }, warning: function warning(data) { - return _this15.trigger('warning', Object.assign({ + return _this14.trigger('warning', Object.assign({ type: 'textures' }, data)); } }; - __chunk_1.Texture.subscribe(this.listeners.texture); + sources.Texture.subscribe(this.listeners.texture); this.listeners.scene_loader = { error: function error(data) { - return _this15.trigger('error', Object.assign({ + return _this14.trigger('error', Object.assign({ type: 'scene' }, data)); } }; - SceneLoader$1.subscribe(this.listeners.scene_loader); + SceneLoader.subscribe(this.listeners.scene_loader); }; _proto.destroyListeners = function destroyListeners() { this.unsubscribeAll(); this.view.unsubscribe(this.listeners.view); - __chunk_1.Texture.unsubscribe(this.listeners.texture); - SceneLoader$1.unsubscribe(this.listeners.scene_loader); + sources.Texture.unsubscribe(this.listeners.texture); + SceneLoader.unsubscribe(this.listeners.scene_loader); this.listeners = null; }; @@ -49204,32 +48872,32 @@ function () { }; _proto.resetFeatureSelection = function resetFeatureSelection() { - var _this16 = this; + var _this15 = this; - this.selection = new __chunk_1.FeatureSelection(this.gl, this.workers, function () { - return _this16.building; + this.selection = new sources.FeatureSelection(this.gl, this.workers, function () { + return _this15.building; }); this.last_render_count = 0; // force re-evaluation of selection map }; - _proto.resetWorkerFeatureSelection = function resetWorkerFeatureSelection(sources) { - if (sources === void 0) { - sources = null; + _proto.resetWorkerFeatureSelection = function resetWorkerFeatureSelection(sources$1) { + if (sources$1 === void 0) { + sources$1 = null; } if (this.workers) { - __chunk_1.WorkerBroker.postMessage(this.workers, 'self.resetFeatureSelection', sources); + sources.WorkerBroker.postMessage(this.workers, 'self.resetFeatureSelection', sources$1); } } // Gets the current feature selection map size across all workers. Returns a promise. ; _proto.getFeatureSelectionMapSize = function getFeatureSelectionMapSize() { - var _this17 = this; + var _this16 = this; // Only allow one fetch process to run at a time if (this.fetching_selection_map == null) { - this.fetching_selection_map = __chunk_1.WorkerBroker.postMessage(this.workers, 'self.getFeatureSelectionMapSize').then(function (sizes) { - _this17.fetching_selection_map = null; + this.fetching_selection_map = sources.WorkerBroker.postMessage(this.workers, 'self.getFeatureSelectionMapSize').then(function (sizes) { + _this16.fetching_selection_map = null; return sizes.reduce(function (a, b) { return a + b; }); @@ -49264,9 +48932,9 @@ function () { ; _proto.screenshot = function screenshot(_temp9) { - var _ref16 = _temp9 === void 0 ? {} : _temp9, - _ref16$background = _ref16.background, - background = _ref16$background === void 0 ? 'white' : _ref16$background; + var _ref12 = _temp9 === void 0 ? {} : _temp9, + _ref12$background = _ref12.background, + background = _ref12$background === void 0 ? 'white' : _ref12$background; this.requestRedraw(); return this.media_capture.screenshot({ @@ -49287,7 +48955,7 @@ function () { _proto.logFirstFrame = function logFirstFrame() { if (this.last_render_count === 0 && !this.times.first_frame) { this.times.first_frame = +new Date() - this.start_time; - __chunk_1.log('debug', "Scene: initial frame time: " + this.times.first_frame); + sources.log('debug', "Scene: initial frame time: " + this.times.first_frame); } } // Log completion of first scene build ; @@ -49295,18 +48963,18 @@ function () { _proto.logFirstBuild = function logFirstBuild() { if (this.times.first_build == null) { this.times.first_build = +new Date() - this.start_time; - __chunk_1.log('debug', "Scene: initial build time: " + this.times.first_build); + sources.log('debug', "Scene: initial build time: " + this.times.first_build); } }; - __chunk_1._createClass(Scene, [{ + sources._createClass(Scene, [{ key: "animated", get: function get() { - var _this18 = this; + var _this17 = this; // Disable animation is scene flag requests it, otherwise enable animation if any animated styles are in view return this.config.scene.animated === false ? false : this.style_manager.getActiveStyles().some(function (s) { - return _this18.styles[s].animated; + return _this17.styles[s].animated; }); } }]); @@ -49354,7 +49022,7 @@ function extendLeaflet(options) { } // Leaflet layer functionality is only defined in main thread - if (__chunk_1.Thread.is_main) { + if (sources.Thread.is_main) { var L = options.leaflet || window.L; // Determine if we are extending the leaflet 0.7.x TileLayer class, or the newer // leaflet 1.x GridLayer class. @@ -49437,7 +49105,7 @@ function extendLeaflet(options) { _this.scene.view.setPanning(true); var view = map.getCenter(); - view.zoom = Math.max(Math.min(map.getZoom(), map.getMaxZoom() || __chunk_1.Geo.default_view_max_zoom), map.getMinZoom()); + view.zoom = Math.max(Math.min(map.getZoom(), map.getMaxZoom() || sources.Geo.default_view_max_zoom), map.getMinZoom()); _this.scene.view.setView(view); @@ -49502,11 +49170,9 @@ function extendLeaflet(options) { blocking: false }).then(function () { if (!_this.options.attribution) { - var _arr = Object.entries(_this.scene.config.sources); - - for (var _i = 0; _i < _arr.length; _i++) { - var _arr$_i = _arr[_i], - value = _arr$_i[1]; + for (var _i = 0, _Object$entries = Object.entries(_this.scene.config.sources); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _Object$entries[_i], + value = _Object$entries$_i[1]; if (value.attribution) { map.attributionControl.addAttribution(value.attribution); @@ -49756,7 +49422,7 @@ function extendLeaflet(options) { updateView: function updateView() { var view = this._map.getCenter(); - view.zoom = Math.max(Math.min(this._map.getZoom(), this._map.getMaxZoom() || __chunk_1.Geo.default_view_max_zoom), this._map.getMinZoom()); + view.zoom = Math.max(Math.min(this._map.getZoom(), this._map.getMaxZoom() || sources.Geo.default_view_max_zoom), this._map.getMinZoom()); this.scene.view.setView(view); }, updateSize: function updateSize() { @@ -49899,7 +49565,7 @@ function extendLeaflet(options) { this._updateMapLayerCount(); }, updateTangramDebugSettings: function updateTangramDebugSettings() { - __chunk_1.mergeDebugSettings(this.options.debug || {}); + sources.mergeDebugSettings(this.options.debug || {}); } }); // Modified version of Leaflet's setZoomAround that doesn't trigger a moveEnd event @@ -49943,33 +49609,33 @@ function extendLeaflet(options) { /*jshint worker: true*/ var debug$1 = { - log: __chunk_1.log, + log: sources.log, yaml: jsYaml$1, - Utils: __chunk_1.Utils, - Geo: __chunk_1.Geo, - Vector: __chunk_1.Vector, - DataSource: __chunk_1.DataSource, - GLSL: __chunk_1.GLSL, - ShaderProgram: __chunk_1.ShaderProgram, - VertexData: __chunk_1.VertexData, - Texture: __chunk_1.Texture, - Material: __chunk_1.Material, - Light: __chunk_1.Light, + Utils: sources.Utils, + Geo: sources.Geo, + Vector: sources.Vector, + DataSource: sources.DataSource, + GLSL: sources.GLSL, + ShaderProgram: sources.ShaderProgram, + VertexData: sources.VertexData, + Texture: sources.Texture, + Material: sources.Material, + Light: sources.Light, Scene: Scene, - WorkerBroker: __chunk_1.WorkerBroker, - Task: __chunk_1.Task, - StyleManager: __chunk_1.StyleManager, - StyleParser: __chunk_1.StyleParser, - TileID: __chunk_1.TileID, - Collision: __chunk_1.Collision, - FeatureSelection: __chunk_1.FeatureSelection, - TextCanvas: __chunk_1.TextCanvas, - debugSettings: __chunk_1.debugSettings + WorkerBroker: sources.WorkerBroker, + Task: sources.Task, + StyleManager: sources.StyleManager, + StyleParser: sources.StyleParser, + TileID: sources.TileID, + Collision: sources.Collision, + FeatureSelection: sources.FeatureSelection, + TextCanvas: sources.TextCanvas, + debugSettings: sources.debugSettings }; var index = { leafletLayer: leafletLayer, debug: debug$1, - version: __chunk_1.version + version: sources.version }; return index; @@ -49982,7 +49648,7 @@ return index; // Script modules can't expose exports try { Tangram.debug.ESM = false; // mark build as ES module - Tangram.debug.SHA = '7baed5ea035938bc9de4116ff9a1ce039ddebb47'; + Tangram.debug.SHA = '81ee5a1ddf14547d5653c42972e0a66fa999d545'; if (false === true && typeof window === 'object') { window.Tangram = Tangram; } @@ -49990,5 +49656,5 @@ try { return Tangram; -})); +}))); //# sourceMappingURL=tangram.debug.js.map diff --git a/dist/tangram.debug.js.map b/dist/tangram.debug.js.map index 5cf979f4e..167c6fff8 100644 --- a/dist/tangram.debug.js.map +++ b/dist/tangram.debug.js.map @@ -1 +1 @@ -{"version":3,"file":"tangram.debug.js","sources":["../node_modules/core-js/modules/_core.js","../node_modules/core-js/modules/_global.js","../node_modules/core-js/modules/_library.js","../node_modules/core-js/modules/_shared.js","../node_modules/core-js/modules/_uid.js","../node_modules/core-js/modules/_wks.js","../node_modules/core-js/modules/_is-object.js","../node_modules/core-js/modules/_an-object.js","../node_modules/core-js/modules/_fails.js","../node_modules/core-js/modules/_descriptors.js","../node_modules/core-js/modules/_dom-create.js","../node_modules/core-js/modules/_ie8-dom-define.js","../node_modules/core-js/modules/_to-primitive.js","../node_modules/core-js/modules/_object-dp.js","../node_modules/core-js/modules/_property-desc.js","../node_modules/core-js/modules/_hide.js","../node_modules/core-js/modules/_add-to-unscopables.js","../node_modules/core-js/modules/_iter-step.js","../node_modules/core-js/modules/_iterators.js","../node_modules/core-js/modules/_cof.js","../node_modules/core-js/modules/_iobject.js","../node_modules/core-js/modules/_defined.js","../node_modules/core-js/modules/_to-iobject.js","../node_modules/core-js/modules/_has.js","../node_modules/core-js/modules/_redefine.js","../node_modules/core-js/modules/_a-function.js","../node_modules/core-js/modules/_ctx.js","../node_modules/core-js/modules/_export.js","../node_modules/core-js/modules/_to-integer.js","../node_modules/core-js/modules/_to-length.js","../node_modules/core-js/modules/_to-absolute-index.js","../node_modules/core-js/modules/_array-includes.js","../node_modules/core-js/modules/_shared-key.js","../node_modules/core-js/modules/_object-keys-internal.js","../node_modules/core-js/modules/_enum-bug-keys.js","../node_modules/core-js/modules/_object-keys.js","../node_modules/core-js/modules/_object-dps.js","../node_modules/core-js/modules/_html.js","../node_modules/core-js/modules/_object-create.js","../node_modules/core-js/modules/_set-to-string-tag.js","../node_modules/core-js/modules/_iter-create.js","../node_modules/core-js/modules/_to-object.js","../node_modules/core-js/modules/_object-gpo.js","../node_modules/core-js/modules/_iter-define.js","../node_modules/core-js/modules/es6.array.iterator.js","../node_modules/core-js/modules/_object-pie.js","../node_modules/core-js/modules/_object-to-array.js","../node_modules/core-js/modules/es7.object.entries.js","../node_modules/core-js/modules/web.dom.iterable.js","../node_modules/core-js/modules/_object-gops.js","../node_modules/core-js/modules/_object-assign.js","../node_modules/core-js/modules/es6.object.assign.js","../src/utils/thread.js","../node_modules/core-js/modules/_string-at.js","../node_modules/core-js/modules/_advance-string-index.js","../node_modules/core-js/modules/_classof.js","../node_modules/core-js/modules/_regexp-exec-abstract.js","../node_modules/core-js/modules/_flags.js","../node_modules/core-js/modules/_regexp-exec.js","../node_modules/core-js/modules/es6.regexp.exec.js","../node_modules/core-js/modules/_fix-re-wks.js","../node_modules/core-js/modules/es6.regexp.replace.js","../node_modules/core-js/modules/_strict-method.js","../node_modules/core-js/modules/es6.array.sort.js","../node_modules/core-js/modules/_meta.js","../node_modules/core-js/modules/_is-array.js","../node_modules/core-js/modules/_object-gopn.js","../node_modules/core-js/modules/_object-gopd.js","../node_modules/core-js/modules/es6.string.iterator.js","../node_modules/core-js/modules/_an-instance.js","../node_modules/core-js/modules/_iter-call.js","../node_modules/core-js/modules/_is-array-iter.js","../node_modules/core-js/modules/core.get-iterator-method.js","../node_modules/core-js/modules/_for-of.js","../node_modules/core-js/modules/_species-constructor.js","../node_modules/core-js/modules/_invoke.js","../node_modules/core-js/modules/_task.js","../node_modules/core-js/modules/_microtask.js","../node_modules/core-js/modules/_new-promise-capability.js","../node_modules/core-js/modules/_perform.js","../node_modules/core-js/modules/_user-agent.js","../node_modules/core-js/modules/_promise-resolve.js","../node_modules/core-js/modules/_redefine-all.js","../node_modules/core-js/modules/_set-species.js","../node_modules/core-js/modules/_iter-detect.js","../node_modules/core-js/modules/es6.promise.js","../node_modules/core-js/modules/es6.function.name.js","../node_modules/core-js/modules/_object-sap.js","../node_modules/core-js/modules/es6.object.keys.js","../src/utils/version.js","../node_modules/core-js/modules/_is-regexp.js","../node_modules/core-js/modules/es6.regexp.split.js","../src/utils/worker_broker.js","../src/utils/log.js","../node_modules/core-js/modules/es6.regexp.flags.js","../node_modules/core-js/modules/es6.regexp.to-string.js","../src/utils/utils.js","../src/utils/debug_settings.js","../node_modules/core-js/modules/_set-proto.js","../node_modules/core-js/modules/_inherit-if-required.js","../node_modules/core-js/modules/es6.regexp.constructor.js","../node_modules/core-js/modules/_same-value.js","../node_modules/core-js/modules/es6.regexp.search.js","../src/utils/urls.js","../src/utils/task.js","../src/utils/subscribe.js","../src/utils/slice.js","../node_modules/core-js/modules/_string-repeat.js","../node_modules/core-js/modules/es6.string.repeat.js","../node_modules/core-js/modules/_typed.js","../node_modules/core-js/modules/_to-index.js","../node_modules/core-js/modules/_array-fill.js","../node_modules/core-js/modules/_typed-buffer.js","../node_modules/core-js/modules/_array-species-constructor.js","../node_modules/core-js/modules/_array-species-create.js","../node_modules/core-js/modules/_array-methods.js","../node_modules/core-js/modules/_array-copy-within.js","../node_modules/core-js/modules/_typed-array.js","../node_modules/core-js/modules/es6.typed.uint8-array.js","../src/gl/texture.js","../node_modules/core-js/modules/es6.regexp.match.js","../src/gl/glsl.js","../src/gl/extensions.js","../src/utils/hash.js","../node_modules/gl-shader-errors/index.js","../src/gl/shader_program.js","../src/gl/vao.js","../node_modules/core-js/modules/es7.object.values.js","../node_modules/core-js/modules/es6.array.find-index.js","../src/utils/merge.js","../src/utils/geo.js","../node_modules/core-js/modules/_string-ws.js","../node_modules/core-js/modules/_string-trim.js","../node_modules/core-js/modules/es6.number.constructor.js","../node_modules/core-js/modules/es6.number.min-safe-integer.js","../node_modules/core-js/modules/es6.object.freeze.js","../src/utils/functions.js","../node_modules/csscolorparser/csscolorparser.js","../src/styles/style_parser.js","../node_modules/core-js/modules/es6.array.fill.js","../src/selection/selection.js","../src/gl/constants.js","../node_modules/core-js/modules/es6.typed.uint16-array.js","../src/gl/vbo_mesh.js","../src/lights/material.js","../src/utils/vector.js","../src/lights/light.js","../node_modules/core-js/modules/es6.math.log2.js","../src/utils/errors.js","../src/sources/data_source.js","../src/tile/tile_id.js","../src/sources/raster.js","../src/builders/wireframe.js","../src/styles/style.js","../node_modules/core-js/modules/es6.typed.int16-array.js","../node_modules/core-js/modules/es6.typed.uint32-array.js","../node_modules/core-js/modules/es6.typed.int32-array.js","../node_modules/core-js/modules/es6.typed.int8-array.js","../node_modules/core-js/modules/es6.typed.float32-array.js","../src/gl/vertex_elements.js","../src/gl/vertex_data.js","../src/gl/vertex_layout.js","../src/builders/common.js","../node_modules/earcut/src/earcut.js","../src/builders/polygons.js","../src/styles/polygons/polygons.js","../node_modules/core-js/modules/_string-html.js","../node_modules/core-js/modules/es6.string.sub.js","../src/builders/polylines.js","../src/styles/lines/dasharray.js","../src/styles/lines/lines.js","../node_modules/core-js/modules/es6.date.to-json.js","../node_modules/core-js/modules/es6.string.anchor.js","../src/builders/points.js","../src/labels/point_anchor.js","../src/labels/intersect.js","../src/utils/obb.js","../src/labels/label.js","../src/labels/repeat_group.js","../src/labels/collision_grid.js","../src/labels/collision.js","../src/labels/label_point.js","../src/labels/point_placement.js","../src/styles/text/text_settings.js","../node_modules/fontfaceobserver/fontfaceobserver.standalone.js","../src/styles/text/font_manager.js","../src/styles/text/text_segments.js","../src/styles/text/text_wrap.js","../src/styles/text/text_canvas.js","../src/styles/text/text_labels.js","../node_modules/core-js/modules/es6.typed.float64-array.js","../node_modules/gl-mat3/normal-from-mat4.js","../node_modules/gl-mat3/invert.js","../node_modules/gl-mat4/multiply.js","../node_modules/gl-mat4/translate.js","../node_modules/gl-mat4/scale.js","../node_modules/gl-mat4/perspective.js","../node_modules/gl-mat4/identity.js","../node_modules/gl-mat4/lookAt.js","../node_modules/gl-mat4/copy.js","../src/utils/gl-matrix.js","../src/scene/camera.js","../src/scene/view.js","../src/styles/points/points.js","../node_modules/core-js/modules/es6.math.hypot.js","../src/labels/label_line.js","../src/styles/text/text.js","../src/styles/raster/raster.js","../src/styles/style_manager.js","../node_modules/core-js/modules/es6.number.max-safe-integer.js","../src/styles/filter.js","../src/styles/layer.js","../src/tile/tile.js","../node_modules/ieee754/index.js","../node_modules/pbf/index.js","../node_modules/@mapbox/point-geometry/index.js","../node_modules/@mapbox/vector-tile/lib/vectortilefeature.js","../node_modules/@mapbox/vector-tile/lib/vectortilelayer.js","../node_modules/@mapbox/vector-tile/lib/vectortile.js","../node_modules/@mapbox/vector-tile/index.js","../src/sources/mvt.js","../node_modules/geojson-vt/src/simplify.js","../node_modules/geojson-vt/src/feature.js","../node_modules/geojson-vt/src/convert.js","../node_modules/geojson-vt/src/clip.js","../node_modules/geojson-vt/src/wrap.js","../node_modules/geojson-vt/src/transform.js","../node_modules/geojson-vt/src/tile.js","../node_modules/geojson-vt/src/index.js","../src/sources/geojson.js","../node_modules/topojson-client/src/reverse.js","../node_modules/topojson-client/src/identity.js","../node_modules/topojson-client/src/transform.js","../node_modules/topojson-client/src/feature.js","../src/sources/topojson.js","../src/scene/scene_worker.js","../node_modules/core-js/modules/_wks-ext.js","../node_modules/core-js/modules/_wks-define.js","../node_modules/core-js/modules/es7.symbol.async-iterator.js","../node_modules/core-js/modules/_enum-keys.js","../node_modules/core-js/modules/_object-gopn-ext.js","../node_modules/core-js/modules/es6.symbol.js","../src/gl/context.js","../node_modules/rollup-plugin-node-globals/src/global.js","../node_modules/buffer-es6/base64.js","../node_modules/buffer-es6/ieee754.js","../node_modules/buffer-es6/isArray.js","../node_modules/buffer-es6/index.js","../node_modules/rollup-plugin-node-builtins/src/es6/events.js","../node_modules/process-es6/browser.js","../node_modules/util/support/isBufferBrowser.js","../node_modules/util/node_modules/inherits/inherits_browser.js","../node_modules/util/util.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/buffer-list.js","../node_modules/safe-buffer/index.js","../node_modules/string_decoder/lib/string_decoder.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/readable.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/writable.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/transform.js","../node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/passthrough.js","../node_modules/rollup-plugin-node-builtins/src/es6/stream.js","../node_modules/jszip/lib/readable-stream-browser.js","../node_modules/jszip/lib/support.js","../node_modules/jszip/lib/base64.js","../node_modules/jszip/lib/nodejsUtils.js","../node_modules/jszip/node_modules/core-js/library/modules/_global.js","../node_modules/jszip/node_modules/core-js/library/modules/_core.js","../node_modules/jszip/node_modules/core-js/library/modules/_a-function.js","../node_modules/jszip/node_modules/core-js/library/modules/_ctx.js","../node_modules/jszip/node_modules/core-js/library/modules/_is-object.js","../node_modules/jszip/node_modules/core-js/library/modules/_an-object.js","../node_modules/jszip/node_modules/core-js/library/modules/_fails.js","../node_modules/jszip/node_modules/core-js/library/modules/_descriptors.js","../node_modules/jszip/node_modules/core-js/library/modules/_dom-create.js","../node_modules/jszip/node_modules/core-js/library/modules/_ie8-dom-define.js","../node_modules/jszip/node_modules/core-js/library/modules/_to-primitive.js","../node_modules/jszip/node_modules/core-js/library/modules/_object-dp.js","../node_modules/jszip/node_modules/core-js/library/modules/_property-desc.js","../node_modules/jszip/node_modules/core-js/library/modules/_hide.js","../node_modules/jszip/node_modules/core-js/library/modules/_export.js","../node_modules/jszip/node_modules/core-js/library/modules/_invoke.js","../node_modules/jszip/node_modules/core-js/library/modules/_html.js","../node_modules/jszip/node_modules/core-js/library/modules/_cof.js","../node_modules/jszip/node_modules/core-js/library/modules/_task.js","../node_modules/jszip/node_modules/core-js/library/modules/web.immediate.js","../node_modules/jszip/node_modules/core-js/library/fn/set-immediate.js","../node_modules/immediate/lib/browser.js","../node_modules/lie/lib/browser.js","../node_modules/jszip/lib/external.js","../node_modules/jszip/lib/utils.js","../node_modules/jszip/lib/stream/GenericWorker.js","../node_modules/jszip/lib/utf8.js","../node_modules/jszip/lib/stream/ConvertWorker.js","../node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js","../node_modules/jszip/lib/stream/StreamHelper.js","../node_modules/jszip/lib/defaults.js","../node_modules/jszip/lib/stream/DataWorker.js","../node_modules/jszip/lib/stream/DataLengthProbe.js","../node_modules/jszip/lib/crc32.js","../node_modules/jszip/lib/stream/Crc32Probe.js","../node_modules/jszip/lib/compressedObject.js","../node_modules/jszip/lib/zipObject.js","../node_modules/pako/lib/utils/common.js","../node_modules/pako/lib/zlib/trees.js","../node_modules/pako/lib/zlib/adler32.js","../node_modules/pako/lib/zlib/crc32.js","../node_modules/pako/lib/zlib/messages.js","../node_modules/pako/lib/zlib/deflate.js","../node_modules/pako/lib/utils/strings.js","../node_modules/pako/lib/zlib/zstream.js","../node_modules/pako/lib/deflate.js","../node_modules/pako/lib/zlib/inffast.js","../node_modules/pako/lib/zlib/inftrees.js","../node_modules/pako/lib/zlib/inflate.js","../node_modules/pako/lib/zlib/constants.js","../node_modules/pako/lib/zlib/gzheader.js","../node_modules/pako/lib/inflate.js","../node_modules/pako/index.js","../node_modules/jszip/lib/flate.js","../node_modules/jszip/lib/compressions.js","../node_modules/jszip/lib/signature.js","../node_modules/jszip/lib/generate/ZipFileWorker.js","../node_modules/jszip/lib/generate/index.js","../node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js","../node_modules/jszip/lib/object.js","../node_modules/jszip/lib/reader/DataReader.js","../node_modules/jszip/lib/reader/ArrayReader.js","../node_modules/jszip/lib/reader/StringReader.js","../node_modules/jszip/lib/reader/Uint8ArrayReader.js","../node_modules/jszip/lib/reader/NodeBufferReader.js","../node_modules/jszip/lib/reader/readerFor.js","../node_modules/jszip/lib/zipEntry.js","../node_modules/jszip/lib/zipEntries.js","../node_modules/jszip/lib/load.js","../node_modules/jszip/lib/index.js","../node_modules/js-yaml/lib/js-yaml/common.js","../node_modules/js-yaml/lib/js-yaml/exception.js","../node_modules/js-yaml/lib/js-yaml/mark.js","../node_modules/js-yaml/lib/js-yaml/type.js","../node_modules/js-yaml/lib/js-yaml/schema.js","../node_modules/js-yaml/lib/js-yaml/type/str.js","../node_modules/js-yaml/lib/js-yaml/type/seq.js","../node_modules/js-yaml/lib/js-yaml/type/map.js","../node_modules/js-yaml/lib/js-yaml/schema/failsafe.js","../node_modules/js-yaml/lib/js-yaml/type/null.js","../node_modules/js-yaml/lib/js-yaml/type/bool.js","../node_modules/js-yaml/lib/js-yaml/type/int.js","../node_modules/js-yaml/lib/js-yaml/type/float.js","../node_modules/js-yaml/lib/js-yaml/schema/json.js","../node_modules/js-yaml/lib/js-yaml/schema/core.js","../node_modules/js-yaml/lib/js-yaml/type/timestamp.js","../node_modules/js-yaml/lib/js-yaml/type/merge.js","../node_modules/rollup-plugin-node-resolve/src/empty.js","../node_modules/js-yaml/lib/js-yaml/type/binary.js","../node_modules/js-yaml/lib/js-yaml/type/omap.js","../node_modules/js-yaml/lib/js-yaml/type/pairs.js","../node_modules/js-yaml/lib/js-yaml/type/set.js","../node_modules/js-yaml/lib/js-yaml/schema/default_safe.js","../node_modules/js-yaml/lib/js-yaml/type/js/undefined.js","../node_modules/js-yaml/lib/js-yaml/type/js/regexp.js","../node_modules/js-yaml/lib/js-yaml/type/js/function.js","../node_modules/js-yaml/lib/js-yaml/schema/default_full.js","../node_modules/js-yaml/lib/js-yaml/loader.js","../node_modules/js-yaml/lib/js-yaml.js","../node_modules/js-yaml/index.js","../src/scene/scene_bundle.js","../src/scene/scene_loader.js","../src/tile/tile_pyramid.js","../src/labels/main_pass.js","../src/tile/tile_manager.js","../src/gl/render_state.js","../node_modules/core-js/modules/es6.typed.uint8-clamped-array.js","../src/utils/media_capture.js","../src/scene/scene_debug.js","../src/scene/scene.js","../src/utils/debounce.js","../src/leaflet_layer.js","../src/index.js","../build/bundle.js"],"sourcesContent":["var core = module.exports = { version: '2.6.3' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","module.exports = false;\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","exports.f = {}.propertyIsEnumerable;\n","var getKeys = require('./_object-keys');\nvar toIObject = require('./_to-iobject');\nvar isEnum = require('./_object-pie').f;\nmodule.exports = function (isEntries) {\n return function (it) {\n var O = toIObject(it);\n var keys = getKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) if (isEnum.call(O, key = keys[i++])) {\n result.push(isEntries ? [key, O[key]] : O[key]);\n } return result;\n };\n};\n","// https://github.com/tc39/proposal-object-values-entries\nvar $export = require('./_export');\nvar $entries = require('./_object-to-array')(true);\n\n$export($export.S, 'Object', {\n entries: function entries(it) {\n return $entries(it);\n }\n});\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","exports.f = Object.getOwnPropertySymbols;\n","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n","// 19.1.3.1 Object.assign(target, source)\nvar $export = require('./_export');\n\n$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });\n","/*jshint worker: true*/\n\n// Mark thread as main or worker\nconst Thread = {};\n\ntry {\n if (window instanceof Window && window.document instanceof HTMLDocument) { // jshint ignore:line\n Thread.is_worker = false;\n Thread.is_main = true;\n }\n}\ncatch(e) {\n Thread.is_worker = true;\n Thread.is_main = false;\n\n // Patch for 3rd party libs that require these globals to be present. Specifically, FontFaceObserver.\n // Brittle solution but allows that library to load on worker threads.\n self.window = { document: {} };\n self.document = self.window.document;\n}\n\nexport default Thread;\n","var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n","'use strict';\nvar at = require('./_string-at')(true);\n\n // `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? at(S, index).length : 1);\n};\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","'use strict';\n\nvar classof = require('./_classof');\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw new TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n if (classof(R) !== 'RegExp') {\n throw new TypeError('RegExp#exec called on incompatible receiver');\n }\n return builtinExec.call(R, S);\n};\n","'use strict';\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = require('./_an-object');\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n","'use strict';\n\nvar regexpFlags = require('./_flags');\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar LAST_INDEX = 'lastIndex';\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/,\n re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;\n})();\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + re.source + '$(?!\\\\s)', regexpFlags.call(re));\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];\n\n match = nativeExec.call(re, str);\n\n if (UPDATES_LAST_INDEX_WRONG && match) {\n re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n // eslint-disable-next-line no-loop-func\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n","'use strict';\nvar regexpExec = require('./_regexp-exec');\nrequire('./_export')({\n target: 'RegExp',\n proto: true,\n forced: regexpExec !== /./.exec\n}, {\n exec: regexpExec\n});\n","'use strict';\nrequire('./es6.regexp.exec');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\nvar regexpExec = require('./_regexp-exec');\n\nvar SPECIES = wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n re.exec = function () { execCalled = true; return null; };\n if (KEY === 'split') {\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n }\n re[SYMBOL]('');\n return !execCalled;\n }) : undefined;\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var fns = exec(\n defined,\n SYMBOL,\n ''[KEY],\n function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }\n );\n var strfn = fns[0];\n var rxfn = fns[1];\n\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n","'use strict';\n\nvar anObject = require('./_an-object');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar toInteger = require('./_to-integer');\nvar advanceStringIndex = require('./_advance-string-index');\nvar regExpExec = require('./_regexp-exec-abstract');\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&`']|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&`']|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nrequire('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n var res = maybeCallNative($replace, regexp, this, replaceValue);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regExpExec(rx, S);\n if (result === null) break;\n results.push(result);\n if (!global) break;\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n var matched = String(result[0]);\n var position = max(min(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return $replace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar SPECIES = require('./_wks')('species');\nmodule.exports = function (O, D) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function (fn, args, that) {\n var un = that === undefined;\n switch (args.length) {\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};\n","var ctx = require('./_ctx');\nvar invoke = require('./_invoke');\nvar html = require('./_html');\nvar cel = require('./_dom-create');\nvar global = require('./_global');\nvar process = global.process;\nvar setTask = global.setImmediate;\nvar clearTask = global.clearImmediate;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (require('./_cof')(process) == 'process') {\n defer = function (id) {\n process.nextTick(ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function (id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function (id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};\n","var global = require('./_global');\nvar macrotask = require('./_task').set;\nvar Observer = global.MutationObserver || global.WebKitMutationObserver;\nvar process = global.process;\nvar Promise = global.Promise;\nvar isNode = require('./_cof')(process) == 'process';\n\nmodule.exports = function () {\n var head, last, notify;\n\n var flush = function () {\n var parent, fn;\n if (isNode && (parent = process.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (e) {\n if (head) notify();\n else last = undefined;\n throw e;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (isNode) {\n notify = function () {\n process.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339\n } else if (Observer && !(global.navigator && global.navigator.standalone)) {\n var toggle = true;\n var node = document.createTextNode('');\n new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n var promise = Promise.resolve(undefined);\n notify = function () {\n promise.then(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global, flush);\n };\n }\n\n return function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n };\n};\n","'use strict';\n// 25.4.1.5 NewPromiseCapability(C)\nvar aFunction = require('./_a-function');\n\nfunction PromiseCapability(C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve);\n this.reject = aFunction(reject);\n}\n\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","module.exports = function (exec) {\n try {\n return { e: false, v: exec() };\n } catch (e) {\n return { e: true, v: e };\n }\n};\n","var global = require('./_global');\nvar navigator = global.navigator;\n\nmodule.exports = navigator && navigator.userAgent || '';\n","var anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar newPromiseCapability = require('./_new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar global = require('./_global');\nvar ctx = require('./_ctx');\nvar classof = require('./_classof');\nvar $export = require('./_export');\nvar isObject = require('./_is-object');\nvar aFunction = require('./_a-function');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar speciesConstructor = require('./_species-constructor');\nvar task = require('./_task').set;\nvar microtask = require('./_microtask')();\nvar newPromiseCapabilityModule = require('./_new-promise-capability');\nvar perform = require('./_perform');\nvar userAgent = require('./_user-agent');\nvar promiseResolve = require('./_promise-resolve');\nvar PROMISE = 'Promise';\nvar TypeError = global.TypeError;\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8 || '';\nvar $Promise = global[PROMISE];\nvar isNode = classof(process) == 'process';\nvar empty = function () { /* empty */ };\nvar Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;\nvar newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;\n\nvar USE_NATIVE = !!function () {\n try {\n // correct subclassing with @@species support\n var promise = $Promise.resolve(1);\n var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {\n exec(empty, empty);\n };\n // unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n return (isNode || typeof PromiseRejectionEvent == 'function')\n && promise.then(empty) instanceof FakePromise\n // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // we can't detect it synchronously, so just check versions\n && v8.indexOf('6.6') !== 0\n && userAgent.indexOf('Chrome/66') === -1;\n } catch (e) { /* empty */ }\n}();\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\nvar notify = function (promise, isReject) {\n if (promise._n) return;\n promise._n = true;\n var chain = promise._c;\n microtask(function () {\n var value = promise._v;\n var ok = promise._s == 1;\n var i = 0;\n var run = function (reaction) {\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (promise._h == 2) onHandleUnhandled(promise);\n promise._h = 1;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // may throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (e) {\n if (domain && !exited) domain.exit();\n reject(e);\n }\n };\n while (chain.length > i) run(chain[i++]); // variable length - can't use forEach\n promise._c = [];\n promise._n = false;\n if (isReject && !promise._h) onUnhandled(promise);\n });\n};\nvar onUnhandled = function (promise) {\n task.call(global, function () {\n var value = promise._v;\n var unhandled = isUnhandled(promise);\n var result, handler, console;\n if (unhandled) {\n result = perform(function () {\n if (isNode) {\n process.emit('unhandledRejection', value, promise);\n } else if (handler = global.onunhandledrejection) {\n handler({ promise: promise, reason: value });\n } else if ((console = global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n promise._h = isNode || isUnhandled(promise) ? 2 : 1;\n } promise._a = undefined;\n if (unhandled && result.e) throw result.v;\n });\n};\nvar isUnhandled = function (promise) {\n return promise._h !== 1 && (promise._a || promise._c).length === 0;\n};\nvar onHandleUnhandled = function (promise) {\n task.call(global, function () {\n var handler;\n if (isNode) {\n process.emit('rejectionHandled', promise);\n } else if (handler = global.onrejectionhandled) {\n handler({ promise: promise, reason: promise._v });\n }\n });\n};\nvar $reject = function (value) {\n var promise = this;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n promise._v = value;\n promise._s = 2;\n if (!promise._a) promise._a = promise._c.slice();\n notify(promise, true);\n};\nvar $resolve = function (value) {\n var promise = this;\n var then;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n microtask(function () {\n var wrapper = { _w: promise, _d: false }; // wrap\n try {\n then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n promise._v = value;\n promise._s = 1;\n notify(promise, false);\n }\n } catch (e) {\n $reject.call({ _w: promise, _d: false }, e); // wrap\n }\n};\n\n// constructor polyfill\nif (!USE_NATIVE) {\n // 25.4.3.1 Promise(executor)\n $Promise = function Promise(executor) {\n anInstance(this, $Promise, PROMISE, '_h');\n aFunction(executor);\n Internal.call(this);\n try {\n executor(ctx($resolve, this, 1), ctx($reject, this, 1));\n } catch (err) {\n $reject.call(this, err);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n this._c = []; // <- awaiting reactions\n this._a = undefined; // <- checked in isUnhandled reactions\n this._s = 0; // <- state\n this._d = false; // <- done\n this._v = undefined; // <- value\n this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled\n this._n = false; // <- notify\n };\n Internal.prototype = require('./_redefine-all')($Promise.prototype, {\n // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)\n then: function then(onFulfilled, onRejected) {\n var reaction = newPromiseCapability(speciesConstructor(this, $Promise));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = isNode ? process.domain : undefined;\n this._c.push(reaction);\n if (this._a) this._a.push(reaction);\n if (this._s) notify(this, false);\n return reaction.promise;\n },\n // 25.4.5.1 Promise.prototype.catch(onRejected)\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n this.promise = promise;\n this.resolve = ctx($resolve, promise, 1);\n this.reject = ctx($reject, promise, 1);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === $Promise || C === Wrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });\nrequire('./_set-to-string-tag')($Promise, PROMISE);\nrequire('./_set-species')(PROMISE);\nWrapper = require('./_core')[PROMISE];\n\n// statics\n$export($export.S + $export.F * !USE_NATIVE, PROMISE, {\n // 25.4.4.5 Promise.reject(r)\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n var $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }\n});\n$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {\n // 25.4.4.6 Promise.resolve(x)\n resolve: function resolve(x) {\n return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);\n }\n});\n$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {\n $Promise.all(iter)['catch'](empty);\n})), PROMISE, {\n // 25.4.4.1 Promise.all(iterable)\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var values = [];\n var index = 0;\n var remaining = 1;\n forOf(iterable, false, function (promise) {\n var $index = index++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n C.resolve(promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[$index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.e) reject(result.v);\n return capability.promise;\n },\n // 25.4.4.4 Promise.race(iterable)\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n forOf(iterable, false, function (promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (result.e) reject(result.v);\n return capability.promise;\n }\n});\n","var dP = require('./_object-dp').f;\nvar FProto = Function.prototype;\nvar nameRE = /^\\s*function ([^ (]*)/;\nvar NAME = 'name';\n\n// 19.2.4.2 name\nNAME in FProto || require('./_descriptors') && dP(FProto, NAME, {\n configurable: true,\n get: function () {\n try {\n return ('' + this).match(nameRE)[1];\n } catch (e) {\n return '';\n }\n }\n});\n","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export');\nvar core = require('./_core');\nvar fails = require('./_fails');\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n","// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object');\nvar $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function () {\n return function keys(it) {\n return $keys(toObject(it));\n };\n});\n","import {version} from '../../package.json';\n\nexport default 'v' + version;\n","// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n","'use strict';\n\nvar isRegExp = require('./_is-regexp');\nvar anObject = require('./_an-object');\nvar speciesConstructor = require('./_species-constructor');\nvar advanceStringIndex = require('./_advance-string-index');\nvar toLength = require('./_to-length');\nvar callRegExpExec = require('./_regexp-exec-abstract');\nvar regexpExec = require('./_regexp-exec');\nvar fails = require('./_fails');\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return $split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy[LAST_INDEX];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n };\n } else {\n internalSplit = $split;\n }\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = defined(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n});\n","/*jshint worker: true*/\n\n// WorkerBroker routes messages between web workers and the main thread, allowing for simpler\n// async code via promises. Example usage:\n//\n// In web worker, register self as a callable \"target\", and define a method:\n//\n// WorkerBroker.addTarget('self', self);\n//\n// self.square = function (x) {\n// return x * x;\n// };\n//\n// In main thread, invoke that method and receive the result (if any) as a promise.\n//\n// worker = new Worker(...);\n// WorkerBroker.addWorker(worker);\n//\n// WorkerBroker.postMessage(worker, 'self.square', 5).then(function(y) {\n// console.log(y);\n// });\n//\n// -> prints 25\n//\n// Async code:\n//\n// For synchronous code that must pass a return value to the main thread, the function can simply\n// return an immediate value (see example above). For cases where the worker method needs to run\n// asynchronous code, the function can return a promise, and the resolved or rejected value will\n// be sent back to the main thread when the promise is fulfilled.\n//\n// Error handling:\n//\n// If the worker method either throws an error, or returns a promise that is rejected, it will be\n// sent back to the main thread as a promise rejection. These two examples are equivalent:\n//\n// In worker, throwing an error:\n//\n// self.broken = function () {\n// throw new Error('error in worker!');\n// };\n//\n// In worker, returning a rejected promise:\n//\n// self.broken = function () {\n// return Promise.reject(new Error('error in worker!'));\n// };\n//\n// In main thread, both errors are received as a promise rejection:\n//\n// WorkerBroker.postMessage(worker, 'self.broken').then(\n// // Promise resolved\n// function() {\n// console.log('success!');\n// },\n// // Promise rejected\n// function(error) {\n// console.log('error!', error);\n// });\n//\n// -> prints 'error! error in worker'\n//\n// Calling from worker to main thread:\n//\n// The same style of calls can be made *from* a web worker, to the main thread. The API is the same\n// with the exception that the first argument, 'worker', is not needed for WorkerBroker.postMessage(),\n// since the main thread is the implicit target.\n//\n// In main thread, define a method and register it:\n//\n// var geometry = {\n// length: function(x, y) {\n// return Math.sqrt(x * x + y * y);\n// }\n// };\n//\n// WorkerBroker.addTarget('geometry', geometry);\n//\n// In worker thread):\n//\n// WorkerBroker.postMessage('geometry.length', 3, 4).then(function(d) {\n// console.log(d);\n// });\n//\n// -> prints 5\n//\n\nimport Thread from './thread';\nimport log from './log';\n\nvar WorkerBroker;\nexport default WorkerBroker = {};\n\n// Global list of all worker messages\n// Uniquely tracks every call made between main thread and a worker\nvar message_id = 0;\nvar messages = {};\n\n// Register an object to receive calls from other thread\nWorkerBroker.targets = {};\nWorkerBroker.addTarget = function (name, target) {\n WorkerBroker.targets[name] = target;\n};\n\nWorkerBroker.removeTarget = function (name) {\n if (name) {\n delete WorkerBroker.targets[name];\n }\n};\n\n// Given a dot-notation-style method name, e.g. 'Object.object.method',\n// find the object to call the method on from the list of registered targets\nfunction findTarget (method) {\n var chain = [];\n if (typeof method === 'string') {\n chain = method.split('.');\n method = chain.pop();\n }\n\n var target = WorkerBroker.targets;\n\n for (let m=0; m < chain.length; m++) {\n if (target[chain[m]]) {\n target = target[chain[m]];\n }\n else {\n return [];\n }\n }\n\n return [method, target];\n}\n\n// Main thread:\n// - Send messages to workers, and optionally receive an async response as a promise\n// - Receive messages from workers, and optionally send an async response back as a promise\nfunction setupMainThread () {\n\n // Send a message to a worker, and optionally get an async response\n // Arguments:\n // - worker: one or more web worker instances to send the message to (single value or array)\n // - method: the method with this name, specified with dot-notation, will be invoked in the worker\n // - message: spread of arguments to call the method with\n // Returns:\n // - a promise that will be fulfilled if the worker method returns a value (could be immediately, or async)\n //\n WorkerBroker.postMessage = function (worker, method, ...message) {\n // If more than one worker specified, post to multiple\n if (Array.isArray(worker)) {\n return Promise.all(\n worker.map(w => WorkerBroker.postMessage(w, method, ...message))\n );\n }\n\n // Parse options\n let options = {};\n if (typeof method === 'object') {\n options = method;\n method = method.method;\n }\n\n // Track state of this message\n var promise = new Promise((resolve, reject) => {\n messages[message_id] = { method, message, resolve, reject };\n });\n\n\n let payload, transferables = [];\n\n if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {\n transferables = message[0].transferables;\n message = message[0].value;\n }\n\n payload = {\n type: 'main_send', // mark message as method invocation from main thread\n message_id, // unique id for this message, for life of program\n method, // will dispatch to a function of this name within the worker\n message // message payload\n };\n\n if (options.stringify) {\n payload = JSON.stringify(payload);\n }\n\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method}' transferred ${transferables.length} objects to worker thread`);\n }\n\n message_id++;\n return promise;\n };\n\n // Add a worker to communicate with - each worker must be registered from the main thread\n WorkerBroker.addWorker = function (worker) {\n if (!(worker instanceof Worker)) {\n throw Error('Worker broker could not add non-Worker object', worker);\n }\n\n worker.addEventListener('message', function WorkerBrokerMainThreadHandler(event) {\n let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);\n let id = data.message_id;\n\n // Listen for messages coming back from the worker, and fulfill that message's promise\n if (data.type === 'worker_reply') {\n // Pass the result to the promise\n if (messages[id]) {\n if (data.error) {\n messages[id].reject(data.error);\n }\n else {\n messages[id].resolve(data.message);\n }\n delete messages[id];\n }\n }\n // Listen for messages initiating a call from the worker, dispatch them,\n // and send any return value back to the worker\n // Unique id for this message & return call to main thread\n else if (data.type === 'worker_send' && id != null) {\n // Call the requested method and save the return value\n let result, error, target, method_name, method;\n try {\n [method_name, target] = findTarget(data.method);\n if (!target) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);\n }\n\n method = (typeof target[method_name] === 'function') && target[method_name];\n if (!method) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because object has no method with that name`);\n }\n\n result = method.apply(target, data.message);\n }\n catch(e) {\n // Thrown errors will be passed back (in string form) to worker\n error = e;\n\n }\n // Send return value to worker\n let payload, transferables = [];\n\n // Async result\n if (result instanceof Promise) {\n result.then((value) => {\n if (value instanceof WorkerBroker.withTransferables) {\n transferables = value.transferables;\n value = value.value[0];\n }\n\n payload = {\n type: 'main_reply',\n message_id: id,\n message: value\n };\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);\n }\n\n }, (error) => {\n worker.postMessage({\n type: 'main_reply',\n message_id: id,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n });\n });\n }\n // Immediate result\n else {\n if (result instanceof WorkerBroker.withTransferables) {\n transferables = result.transferables;\n result = result.value[0];\n }\n\n payload = {\n type: 'main_reply',\n message_id: id,\n message: result,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n };\n worker.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);\n }\n }\n }\n });\n\n };\n\n // Expose for debugging\n WorkerBroker.getMessages = function () {\n return messages;\n };\n\n WorkerBroker.getMessageId = function () {\n return message_id;\n };\n\n}\n\n// Worker threads:\n// - Receive messages from main thread, and optionally send an async response back as a promise\n// - Send messages to main thread, and optionally receive an async response as a promise\nfunction setupWorkerThread () {\n\n // Send a message to the main thread, and optionally get an async response as a promise\n // Arguments:\n // - method: the method with this name, specified with dot-notation, will be invoked on the main thread\n // - message: array of arguments to call the method with\n // Returns:\n // - a promise that will be fulfilled if the main thread method returns a value (could be immediately, or async)\n //\n WorkerBroker.postMessage = function (method, ...message) {\n // Parse options\n let options = {};\n if (typeof method === 'object') {\n options = method;\n method = method.method;\n }\n\n // Track state of this message\n var promise = new Promise((resolve, reject) => {\n messages[message_id] = { method, message, resolve, reject };\n });\n\n let payload, transferables = [];\n\n if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {\n transferables = message[0].transferables;\n message = message[0].value;\n }\n\n payload = {\n type: 'worker_send', // mark message as method invocation from worker\n message_id, // unique id for this message, for life of program\n method, // will dispatch to a method of this name on the main thread\n message // message payload\n };\n\n if (options.stringify) {\n payload = JSON.stringify(payload);\n }\n\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method}' transferred ${transferables.length} objects to main thread`);\n }\n\n message_id++;\n return promise;\n };\n\n self.addEventListener('message', function WorkerBrokerWorkerThreadHandler(event) {\n let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);\n let id = data.message_id;\n\n // Listen for messages coming back from the main thread, and fulfill that message's promise\n if (data.type === 'main_reply') {\n // Pass the result to the promise\n if (messages[id]) {\n if (data.error) {\n messages[id].reject(data.error);\n }\n else {\n messages[id].resolve(data.message);\n }\n delete messages[id];\n }\n }\n // Receive messages from main thread, dispatch them, and send back a reply\n // Unique id for this message & return call to main thread\n else if (data.type === 'main_send' && id != null) {\n // Call the requested worker method and save the return value\n let result, error, target, method_name, method;\n try {\n [method_name, target] = findTarget(data.method);\n if (!target) {\n throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);\n }\n\n method = (typeof target[method_name] === 'function') && target[method_name];\n\n if (!method) {\n throw Error(`Worker broker could not dispatch message type ${data.method} because worker has no method with that name`);\n }\n\n result = method.apply(target, data.message);\n }\n catch(e) {\n // Thrown errors will be passed back (in string form) to main thread\n error = e;\n }\n\n // Send return value to main thread\n let payload, transferables = [];\n\n // Async result\n if (result instanceof Promise) {\n result.then((value) => {\n if (value instanceof WorkerBroker.withTransferables) {\n transferables = value.transferables;\n value = value.value[0];\n }\n\n payload = {\n type: 'worker_reply',\n message_id: id,\n message: value\n };\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);\n }\n }, (error) => {\n self.postMessage({\n type: 'worker_reply',\n message_id: id,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n });\n });\n }\n // Immediate result\n else {\n if (result instanceof WorkerBroker.withTransferables) {\n transferables = result.transferables;\n result = result.value[0];\n }\n\n payload = {\n type: 'worker_reply',\n message_id: id,\n message: result,\n error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)\n };\n self.postMessage(payload, transferables.map(t => t.object));\n freeTransferables(transferables);\n if (transferables.length > 0) {\n log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);\n }\n }\n }\n });\n\n}\n\n// Special value wrapper, to indicate that we want to find and include transferable objects in the message\nWorkerBroker.withTransferables = function (...value) {\n if (!(this instanceof WorkerBroker.withTransferables)) {\n return new WorkerBroker.withTransferables(...value);\n }\n\n this.value = value;\n this.transferables = findTransferables(this.value);\n};\n\n// Build a list of transferable objects from a source object\n// Returns a list of info about each transferable:\n// - object: the actual transferable object\n// - parent: the parent object that the transferable is a property of (if any)\n// - property: the property name of the transferable on the parent object (if any)\n// TODO: add option in case you DON'T want to transfer objects\nfunction findTransferables(source, parent = null, property = null, list = []) {\n if (!source) {\n return list;\n }\n\n if (Array.isArray(source)) {\n // Check each array element\n source.forEach((x, i) => findTransferables(x, source, i, list));\n }\n else if (typeof source === 'object') {\n // Is the object a transferable array buffer?\n if (source instanceof ArrayBuffer) {\n list.push({ object: source, parent, property });\n }\n // Or looks like a typed array (has an array buffer property)?\n else if (source.buffer instanceof ArrayBuffer) {\n list.push({ object: source.buffer, parent, property });\n }\n // Otherwise check each property\n else {\n for (let prop in source) {\n findTransferables(source[prop], source, prop, list);\n }\n }\n }\n return list;\n}\n\n// Remove neutered transferables from parent objects, as they should no longer be accessed after transfer\nfunction freeTransferables(transferables) {\n if (!Array.isArray(transferables)) {\n return;\n }\n transferables.filter(t => t.parent && t.property).forEach(t => delete t.parent[t.property]);\n}\n\n// Setup this thread as appropriate\nif (Thread.is_main) {\n setupMainThread();\n}\n\nif (Thread.is_worker) {\n setupWorkerThread();\n}\n","import version from './version';\nimport Thread from './thread';\nimport WorkerBroker from './worker_broker';\n\nconst LEVELS = {\n silent: -1,\n error: 0,\n warn: 1,\n info: 2,\n debug: 3,\n trace: 4\n};\n\nconst methods = {};\nlet logged_once = {};\n\nfunction methodForLevel (level) {\n if (Thread.is_main) {\n methods[level] = methods[level] || (console[level] ? console[level] : console.log).bind(console); // eslint-disable-line no-console\n return methods[level];\n }\n}\n\n// Logs message, proxying any log requests from worker threads back to the main thread.\n// Returns (asynchronously, due to proxying) a boolean indicating if the message was logged.\n// Option `once: true` can be used to only log each unique log message once (e.g. for warnings\n// that would otherwise be repetitive or possibly logged thousands of times, such as per feature).\nexport default function log (opts, ...msg) {\n let level = (typeof opts === 'object') ? opts.level : opts;\n if (LEVELS[level] <= LEVELS[log.level]) {\n if (Thread.is_worker) {\n // Proxy to main thread\n return WorkerBroker.postMessage({ method: '_logProxy', stringify: true }, opts, ...msg);\n }\n else {\n // Only log message once?\n if (typeof opts === 'object' && opts.once === true) {\n if (logged_once[JSON.stringify(msg)]) {\n return Promise.resolve(false);\n }\n logged_once[JSON.stringify(msg)] = true;\n }\n\n // Write to console (on main thread)\n let logger = methodForLevel(level);\n if (msg.length > 1) {\n logger(`Tangram ${version} [${level}]: ${msg[0]}`, ...msg.slice(1));\n }\n else {\n logger(`Tangram ${version} [${level}]: ${msg[0]}`);\n }\n }\n return Promise.resolve(true);\n }\n return Promise.resolve(false);\n}\n\nlog.level = 'info';\nlog.workers = null;\n\nlog.setLevel = function (level) {\n log.level = level;\n\n if (Thread.is_main && Array.isArray(log.workers)) {\n WorkerBroker.postMessage(log.workers, '_logSetLevelProxy', level);\n }\n};\n\nif (Thread.is_main) {\n log.setWorkers = function (workers) {\n log.workers = workers;\n };\n\n log.reset = function () {\n logged_once = {};\n };\n}\n\nWorkerBroker.addTarget('_logProxy', log); // proxy log messages from worker to main thread\nWorkerBroker.addTarget('_logSetLevelProxy', log.setLevel); // proxy log level setting from main to worker thread\n","// 21.2.5.3 get RegExp.prototype.flags()\nif (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {\n configurable: true,\n get: require('./_flags')\n});\n","'use strict';\nrequire('./es6.regexp.flags');\nvar anObject = require('./_an-object');\nvar $flags = require('./_flags');\nvar DESCRIPTORS = require('./_descriptors');\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n define(function toString() {\n var R = anObject(this);\n return '/'.concat(R.source, '/',\n 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n define(function toString() {\n return $toString.call(this);\n });\n}\n","// Miscellaneous utilities\n/*jshint worker: true*/\n\nimport log from './log';\nimport Thread from './thread';\nimport WorkerBroker from './worker_broker';\n\nexport default Utils;\n\nconst Utils = {};\n\nWorkerBroker.addTarget('Utils', Utils);\n\n// Basic Safari detection\n// http://stackoverflow.com/questions/7944460/detect-safari-browser\nUtils.isSafari = function () {\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n};\n\n// Basic IE11 or Edge detection\nUtils.isMicrosoft = function () {\n return /(Trident\\/7.0|Edge[ /](\\d+[.\\d]+))/i.test(navigator.userAgent);\n};\n\nUtils._requests = {}; // XHR requests on current thread\nUtils._proxy_requests = {}; // XHR requests proxied to main thread\n\n// `request_key` is a user-provided key that can be later used to cancel the request\nUtils.io = function (url, timeout = 60000, responseType = 'text', method = 'GET', headers = {}, request_key = null, proxy = false) {\n if (Thread.is_worker && Utils.isMicrosoft()) {\n // Some versions of IE11 and Edge will hang web workers when performing XHR requests\n // These requests can be proxied through the main thread\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9545866/\n log('debug', 'Proxying request for URL to worker', url);\n\n if (request_key) {\n Utils._proxy_requests[request_key] = true; // mark as proxied\n }\n return WorkerBroker.postMessage('Utils.io', url, timeout, responseType, method, headers, request_key, true);\n }\n else {\n var request = new XMLHttpRequest();\n var promise = new Promise((resolve, reject) => {\n request.open(method, url, true);\n request.timeout = timeout;\n request.responseType = responseType;\n\n // Attach optional request headers\n if (headers && typeof headers === 'object') {\n for (let key in headers) {\n request.setRequestHeader(key, headers[key]);\n }\n }\n\n request.onload = () => {\n if (request.status === 200) {\n if (['text', 'json'].indexOf(request.responseType) > -1) {\n resolve({ body: request.responseText, status: request.status });\n }\n else {\n resolve({ body: request.response, status: request.status });\n }\n }\n else if (request.status === 204) { // No Content\n resolve({ body: null, status: request.status });\n }\n else {\n reject(Error('Request error with a status of ' + request.statusText));\n }\n };\n request.onerror = (evt) => {\n reject(Error('There was a network error' + evt.toString()));\n };\n request.ontimeout = (evt) => {\n reject(Error('timeout '+ evt.toString()));\n };\n request.send();\n });\n\n promise = promise.then(response => {\n if (request_key) {\n delete Utils._requests[request_key];\n }\n\n if (proxy) {\n return WorkerBroker.withTransferables(response);\n }\n return response;\n });\n\n if (request_key) {\n Utils._requests[request_key] = request;\n }\n\n return promise;\n }\n};\n\n// Çancel a pending network request by user-provided request key\nUtils.cancelRequest = function (key) {\n // Check for a request that was proxied to the main thread\n if (Thread.is_worker && Utils._proxy_requests[key]) {\n return WorkerBroker.postMessage('Utils.cancelRequest', key); // forward to main thread\n }\n\n let req = Utils._requests[key];\n if (req) {\n log('trace', `Cancelling network request key '${key}'`);\n Utils._requests[key].abort();\n delete Utils._requests[key];\n }\n else {\n log('trace', `Could not find network request key '${key}'`);\n }\n};\n\n// Stringify an object into JSON, but convert functions to strings\nUtils.serializeWithFunctions = function (obj) {\n if (typeof obj === 'function') {\n return obj.toString();\n }\n\n let serialized = JSON.stringify(obj, function(k, v) {\n // Convert functions to strings\n if (typeof v === 'function') {\n return v.toString();\n }\n return v;\n });\n\n return serialized;\n};\n\n// Default to allowing high pixel density\n// Returns true if display density changed\nUtils.use_high_density_display = true;\nUtils.updateDevicePixelRatio = function () {\n let prev = Utils.device_pixel_ratio;\n Utils.device_pixel_ratio = (Utils.use_high_density_display && window.devicePixelRatio) || 1;\n return Utils.device_pixel_ratio !== prev;\n};\n\nif (Thread.is_main) {\n Utils.updateDevicePixelRatio();\n}\n\n// Used for differentiating between power-of-2 and non-power-of-2 textures\n// Via: http://stackoverflow.com/questions/19722247/webgl-wait-for-texture-to-load\nUtils.isPowerOf2 = function(value) {\n return (value & (value - 1)) === 0;\n};\n\n// Interpolate 'x' along a series of control points\n// 'points' is an array of control points in the form [x, y]\n//\n// Example:\n// Control points:\n// [0, 5]: when x=0, y=5\n// [4, 10]: when x=4, y=10\n//\n// Utils.interpolate(2, [[0, 5], [4, 10]]);\n// -> computes x=2, halfway between x=0 and x=4: (10 - 5) / 2 +5\n// -> returns 7.5\n//\n// TODO: add other interpolation methods besides linear\n//\nUtils.interpolate = function(x, points, transform) {\n // If this doesn't resemble a list of control points, just return the original value\n if (!Array.isArray(points) || !Array.isArray(points[0])) {\n return points;\n }\n else if (points.length < 1) {\n return points;\n }\n\n var x1, x2, d, y, y1, y2;\n\n // Min bounds\n if (x <= points[0][0]) {\n y = points[0][1];\n if (typeof transform === 'function') {\n y = transform(y);\n }\n }\n // Max bounds\n else if (x >= points[points.length-1][0]) {\n y = points[points.length-1][1];\n if (typeof transform === 'function') {\n y = transform(y);\n }\n }\n // Find which control points x is between\n else {\n for (var i=0; i < points.length - 1; i++) {\n if (x >= points[i][0] && x < points[i+1][0]) {\n // Linear interpolation\n x1 = points[i][0];\n x2 = points[i+1][0];\n\n // Multiple values\n if (Array.isArray(points[i][1])) {\n y = [];\n for (var c=0; c < points[i][1].length; c++) {\n if (typeof transform === 'function') {\n y1 = transform(points[i][1][c]);\n y2 = transform(points[i+1][1][c]);\n d = y2 - y1;\n y[c] = d * (x - x1) / (x2 - x1) + y1;\n }\n else {\n d = points[i+1][1][c] - points[i][1][c];\n y[c] = d * (x - x1) / (x2 - x1) + points[i][1][c];\n }\n }\n }\n // Single value\n else {\n if (typeof transform === 'function') {\n y1 = transform(points[i][1]);\n y2 = transform(points[i+1][1]);\n d = y2 - y1;\n y = d * (x - x1) / (x2 - x1) + y1;\n }\n else {\n d = points[i+1][1] - points[i][1];\n y = d * (x - x1) / (x2 - x1) + points[i][1];\n }\n }\n break;\n }\n }\n }\n return y;\n};\n\nUtils.toCSSColor = function (color) {\n if (color != null) {\n if (color[3] === 1) { // full opacity\n return `rgb(${color.slice(0, 3).map(c => Math.round(c * 255)).join(', ')})`;\n }\n // RGB is between [0, 255] opacity is between [0, 1]\n return `rgba(${color.map((c, i) => (i < 3 && Math.round(c * 255)) || c).join(', ')})`;\n }\n};\n","let debugSettings;\n\nexport default debugSettings = {\n // draws a blue rectangle border around the collision box of a label\n draw_label_collision_boxes: false,\n\n // draws a green rectangle border within the texture box of a label\n draw_label_texture_boxes: false,\n\n // suppreses fade-in of labels\n suppress_label_fade_in: false,\n\n // suppress animaton of label snap to pixel grid\n suppress_label_snap_animation: false,\n\n // show hidden labels for debugging\n show_hidden_labels: false,\n\n // collect feature/geometry stats on styling layers\n layer_stats: false,\n\n // draw scene in wireframe mode\n wireframe: false\n};\n\nexport function mergeDebugSettings (settings) {\n Object.assign(debugSettings, settings);\n}\n","// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n","var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n","var global = require('./_global');\nvar inheritIfRequired = require('./_inherit-if-required');\nvar dP = require('./_object-dp').f;\nvar gOPN = require('./_object-gopn').f;\nvar isRegExp = require('./_is-regexp');\nvar $flags = require('./_flags');\nvar $RegExp = global.RegExp;\nvar Base = $RegExp;\nvar proto = $RegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n// \"new\" creates a new object, old webkit buggy here\nvar CORRECT_NEW = new $RegExp(re1) !== re1;\n\nif (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () {\n re2[require('./_wks')('match')] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';\n}))) {\n $RegExp = function RegExp(p, f) {\n var tiRE = this instanceof $RegExp;\n var piRE = isRegExp(p);\n var fiU = f === undefined;\n return !tiRE && piRE && p.constructor === $RegExp && fiU ? p\n : inheritIfRequired(CORRECT_NEW\n ? new Base(piRE && !fiU ? p.source : p, f)\n : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)\n , tiRE ? this : proto, $RegExp);\n };\n var proxy = function (key) {\n key in $RegExp || dP($RegExp, key, {\n configurable: true,\n get: function () { return Base[key]; },\n set: function (it) { Base[key] = it; }\n });\n };\n for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);\n proto.constructor = $RegExp;\n $RegExp.prototype = proto;\n require('./_redefine')(global, 'RegExp', $RegExp);\n}\n\nrequire('./_set-species')('RegExp');\n","// 7.2.9 SameValue(x, y)\nmodule.exports = Object.is || function is(x, y) {\n // eslint-disable-next-line no-self-compare\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};\n","'use strict';\n\nvar anObject = require('./_an-object');\nvar sameValue = require('./_same-value');\nvar regExpExec = require('./_regexp-exec-abstract');\n\n// @@search logic\nrequire('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search, maybeCallNative) {\n return [\n // `String.prototype.search` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.search\n function search(regexp) {\n var O = defined(this);\n var fn = regexp == undefined ? undefined : regexp[SEARCH];\n return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));\n },\n // `RegExp.prototype[@@search]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search\n function (regexp) {\n var res = maybeCallNative($search, regexp, this);\n if (res.done) return res.value;\n var rx = anObject(regexp);\n var S = String(this);\n var previousLastIndex = rx.lastIndex;\n if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;\n var result = regExpExec(rx, S);\n if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;\n return result === null ? -1 : result.index;\n }\n ];\n});\n","import log from './log';\n\n// Adds a base origin to relative URLs\nexport function addBaseURL (url, base) {\n if (!url || !isRelativeURL(url)) {\n return url;\n }\n\n var relative_path = (url[0] !== '/');\n var base_info;\n if (base) {\n base_info = document.createElement('a'); // use a temporary element to parse URL\n base_info.href = base;\n }\n else {\n base_info = window.location;\n }\n\n if (relative_path) {\n let path = pathForURL(base_info.href);\n url = path + url;\n }\n else {\n let origin = base_info.origin;\n if (!origin) {\n origin = base_info.protocol + '//' + base_info.host; // IE11 doesn't have origin property\n }\n url = origin + url;\n }\n\n return url;\n}\n\nexport function pathForURL (url) {\n if (typeof url === 'string' && url.search(/^(data|blob):/) === -1) {\n let qs = url.indexOf('?');\n if (qs > -1) {\n url = url.substr(0, qs);\n }\n\n let hash = url.indexOf('#');\n if (hash > -1) {\n url = url.substr(0, hash);\n }\n\n return url.substr(0, url.lastIndexOf('/') + 1) || '';\n }\n return '';\n}\n\nexport function extensionForURL (url) {\n url = url.split('/').pop();\n let last_dot = url.lastIndexOf('.');\n if (last_dot > -1) {\n return url.substring(last_dot + 1);\n }\n}\n\nexport function isLocalURL (url) {\n if (typeof url !== 'string') {\n return;\n }\n return (url.search(/^(data|blob):/) > -1);\n}\n\nexport function isRelativeURL (url) {\n if (typeof url !== 'string') {\n return;\n }\n return !(url.search(/^(http|https|data|blob):/) > -1 || url.substr(0, 2) === '//');\n}\n\n// Resolves './' and '../' components from relative path, to get a \"flattened\" path\nexport function flattenRelativeURL (url) {\n let dirs = (url || '').split('/');\n for (let d = 1; d < dirs.length; d++) {\n if (dirs[d] === '.') {\n dirs.splice(d, 1);\n d--;\n }\n else if (dirs[d] === '..') {\n d = d + 0;\n dirs.splice(d-1, 2);\n d--;\n }\n }\n return dirs.join('/');\n}\n\n// Add a set of query string params to a URL\n// params: hash of key/value pairs of query string parameters\n// returns array of: [modified URL, array of duplicate param name and values]\nexport function addParamsToURL (url, params) {\n if (!params || Object.keys(params).length === 0) {\n return [url, []];\n }\n\n var qs_index = url.indexOf('?');\n var hash_index = url.indexOf('#');\n\n // Save and trim hash\n var hash = '';\n if (hash_index > -1) {\n hash = url.slice(hash_index);\n url = url.slice(0, hash_index);\n }\n\n // Start query string\n if (qs_index === -1) {\n qs_index = url.length;\n url += '?';\n }\n qs_index++; // advanced past '?'\n\n // Build query string params\n var url_params = '';\n var dupes = [];\n for (var p in params) {\n if (getURLParameter(p, url) !== '') {\n dupes.push([p, params[p]]);\n continue;\n }\n url_params += `${p}=${params[p]}&`;\n }\n\n // Insert new query string params and restore hash\n url = url.slice(0, qs_index) + url_params + url.slice(qs_index) + hash;\n\n return [url, dupes];\n}\n\n// Polyfill (for Safari compatibility)\nlet _createObjectURL;\nexport function createObjectURL (url) {\n if (_createObjectURL === undefined) {\n _createObjectURL = (window.URL && window.URL.createObjectURL) || (window.webkitURL && window.webkitURL.createObjectURL);\n\n if (typeof _createObjectURL !== 'function') {\n _createObjectURL = null;\n log('warn', 'window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs');\n }\n }\n\n if (_createObjectURL) {\n return _createObjectURL(url);\n }\n else {\n return url;\n }\n}\n\nlet _revokeObjectURL;\nexport function revokeObjectURL (url) {\n if (_revokeObjectURL === undefined) {\n _revokeObjectURL = (window.URL && window.URL.revokeObjectURL) || (window.webkitURL && window.webkitURL.revokeObjectURL);\n\n if (typeof _revokeObjectURL !== 'function') {\n _revokeObjectURL = null;\n log('warn', 'window.URL.revokeObjectURL (or vendor prefix) not found, unable to create local blob URLs');\n }\n }\n\n if (_revokeObjectURL) {\n return _revokeObjectURL(url);\n }\n else {\n return url;\n }\n}\n\n// Get URL that the current script was loaded from\n// If currentScript is not available, loops through