diff --git a/crates/swc/tests/tsc-references/ES5For-of37_es2015.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of37_es2015.2.minified.js index 78f8394935f..03dec9c49a6 100644 --- a/crates/swc/tests/tsc-references/ES5For-of37_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of37_es2015.2.minified.js @@ -9,7 +9,7 @@ for (const i of [ 1, 2, 3 - ])if (2 === i) throw new Error('ERR'); + ])if (2 === i) throw Error('ERR'); console.log(i); } catch (err) { console.log('E %s %s', i, err); diff --git a/crates/swc/tests/tsc-references/ES5For-of37_es5.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of37_es5.2.minified.js index 355d53dc13f..85368e875b3 100644 --- a/crates/swc/tests/tsc-references/ES5For-of37_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of37_es5.2.minified.js @@ -15,7 +15,7 @@ try { 1, 2, 3 - ][Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)if (_step1.value, 2 === i) throw new Error("ERR"); + ][Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)if (_step1.value, 2 === i) throw Error("ERR"); } catch (err) { _didIteratorError1 = !0, _iteratorError1 = err; } finally{ diff --git a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es2015.2.minified.js b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es2015.2.minified.js index 510bf4de707..962879107ef 100644 --- a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es2015.2.minified.js @@ -1,5 +1,5 @@ var A; !function(A1) { var beez; - A1.beez2 = new Array(), A1.beez = beez; + A1.beez2 = Array(), A1.beez = beez; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es5.2.minified.js b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es5.2.minified.js index aea1e6a295b..ba2b3543935 100644 --- a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument_es5.2.minified.js @@ -5,5 +5,5 @@ import _class_call_check from "@swc/helpers/lib/_class_call_check.js"; "use strict"; _class_call_check(this, B); }; - A1.beez2 = new Array(), A1.beez = beez; + A1.beez2 = Array(), A1.beez = beez; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/arrayLiteral_es2015.2.minified.js b/crates/swc/tests/tsc-references/arrayLiteral_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/arrayLiteral_es5.2.minified.js b/crates/swc/tests/tsc-references/arrayLiteral_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js index ea2f3cbbf30..0ff83813be9 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js @@ -8,7 +8,7 @@ Wagon.circle = function(wagons) { }; var db = new class extends Wagon { load(files, format) { - if ("xmlolololol" === format) throw new Error("please do not use XML. It was a joke."); + if ("xmlolololol" === format) throw Error("please do not use XML. It was a joke."); super.speed(), super.weight(); } constructor(){ diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js index 040e16cc163..44866a643af 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js @@ -22,7 +22,7 @@ var Sql = function(Wagon1) { return _class_call_check(this, Sql), (_this = _super.call(this)).foonly = 12, _this; } return Sql.prototype.load = function(files, format) { - if ("xmlolololol" === format) throw new Error("please do not use XML. It was a joke."); + if ("xmlolololol" === format) throw Error("please do not use XML. It was a joke."); _get(_get_prototype_of(Sql.prototype), "speed", this).call(this), _get(_get_prototype_of(Sql.prototype), "weight", this).call(this); }, Sql; }(Wagon), db = new Sql(); diff --git a/crates/swc/tests/tsc-references/controlFlowIIFE_es2015.2.minified.js b/crates/swc/tests/tsc-references/controlFlowIIFE_es2015.2.minified.js index 73afc1eb913..07b60e85e8e 100644 --- a/crates/swc/tests/tsc-references/controlFlowIIFE_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowIIFE_es2015.2.minified.js @@ -2,5 +2,5 @@ import _async_to_generator from "@swc/helpers/lib/_async_to_generator.js"; let maybeNumber; maybeNumber = 1, ++maybeNumber, maybeNumber++; let test; -if (!test) throw new Error('Test is not defined'); +if (!test) throw Error('Test is not defined'); test.slice(1); diff --git a/crates/swc/tests/tsc-references/controlFlowIIFE_es5.2.minified.js b/crates/swc/tests/tsc-references/controlFlowIIFE_es5.2.minified.js index 3b0f0b477e5..cd1b86a0029 100644 --- a/crates/swc/tests/tsc-references/controlFlowIIFE_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowIIFE_es5.2.minified.js @@ -1,5 +1,5 @@ var maybeNumber, test; import _async_to_generator from "@swc/helpers/lib/_async_to_generator.js"; import regeneratorRuntime from "regenerator-runtime"; -if (maybeNumber = 1, ++maybeNumber, maybeNumber++, !test) throw new Error("Test is not defined"); +if (maybeNumber = 1, ++maybeNumber, maybeNumber++, !test) throw Error("Test is not defined"); test.slice(1); diff --git a/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es2015.2.minified.js b/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es2015.2.minified.js index 386b5813338..0cc9cebbb32 100644 --- a/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es2015.2.minified.js @@ -4,5 +4,5 @@ function f15(x) { f15({ value: 10 }), f15({ - error: new Error("boom") + error: Error("boom") }); diff --git a/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es5.2.minified.js b/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es5.2.minified.js index 386b5813338..0cc9cebbb32 100644 --- a/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/discriminatedUnionTypes2_es5.2.minified.js @@ -4,5 +4,5 @@ function f15(x) { f15({ value: 10 }), f15({ - error: new Error("boom") + error: Error("boom") }); diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js index 8d7046e3be6..b956a70bcf0 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js @@ -1,3 +1,3 @@ export function assertNever(x, msg) { - throw new Error("Unexpected " + msg); + throw Error("Unexpected " + msg); } diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js index 8d7046e3be6..b956a70bcf0 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js @@ -1,3 +1,3 @@ export function assertNever(x, msg) { - throw new Error("Unexpected " + msg); + throw Error("Unexpected " + msg); } diff --git a/crates/swc/tests/tsc-references/fixSignatureCaching_es2015.2.minified.js b/crates/swc/tests/tsc-references/fixSignatureCaching_es2015.2.minified.js index cb04b04f3a2..96b942eae78 100644 --- a/crates/swc/tests/tsc-references/fixSignatureCaching_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/fixSignatureCaching_es2015.2.minified.js @@ -290,7 +290,7 @@ return !1; } function convertPropsToRegExp(object) { - for(var key in object)hasOwnProp.call(object, key) && (object[key] = new RegExp(object[key], 'i')); + for(var key in object)hasOwnProp.call(object, key) && (object[key] = RegExp(object[key], 'i')); } function MobileDetect(userAgent, maxPhoneWidth) { this.ua = userAgent || '', this._cache = {}, this.maxPhoneWidth = maxPhoneWidth || 600; @@ -304,7 +304,7 @@ for(key in mobileDetectRules.props)if (hasOwnProp.call(mobileDetectRules.props, key)) { for(isArray(values = mobileDetectRules.props[key]) || (values = [ values - ]), len = values.length, i = 0; i < len; ++i)(verPos = (value = values[i]).indexOf('[VER]')) >= 0 && (value = value.substring(0, verPos) + '([\\w._\\+]+)' + value.substring(verPos + 5)), values[i] = new RegExp(value, 'i'); + ]), len = values.length, i = 0; i < len; ++i)(verPos = (value = values[i]).indexOf('[VER]')) >= 0 && (value = value.substring(0, verPos) + '([\\w._\\+]+)' + value.substring(verPos + 5)), values[i] = RegExp(value, 'i'); mobileDetectRules.props[key] = values; } convertPropsToRegExp(mobileDetectRules.oss), convertPropsToRegExp(mobileDetectRules.phones), convertPropsToRegExp(mobileDetectRules.tablets), convertPropsToRegExp(mobileDetectRules.uas), convertPropsToRegExp(mobileDetectRules.utils), mobileDetectRules.oss0 = { @@ -384,7 +384,7 @@ return containsIC(this.userAgents(), key) || equalIC(key, this.os()) || equalIC(key, this.phone()) || equalIC(key, this.tablet()) || containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key); }, match: function(pattern) { - return pattern instanceof RegExp || (pattern = new RegExp(pattern, 'i')), pattern.test(this.ua); + return pattern instanceof RegExp || (pattern = RegExp(pattern, 'i')), pattern.test(this.ua); }, isPhoneSized: function(maxPhoneWidth) { return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth); @@ -404,5 +404,5 @@ if ('undefined' != typeof window) return function(factory) { window.MobileDetect = factory(); }; - throw new Error('unknown environment'); + throw Error('unknown environment'); }()); diff --git a/crates/swc/tests/tsc-references/fixSignatureCaching_es5.2.minified.js b/crates/swc/tests/tsc-references/fixSignatureCaching_es5.2.minified.js index f6a417b5294..e14bc29040f 100644 --- a/crates/swc/tests/tsc-references/fixSignatureCaching_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/fixSignatureCaching_es5.2.minified.js @@ -10,7 +10,7 @@ import _instanceof from "@swc/helpers/lib/_instanceof.js"; for(i = 0, valueLC = value.toLowerCase(); i < len; ++i)if (valueLC === array[i].toLowerCase()) return !0; return !1; }, convertPropsToRegExp = function(object) { - for(var key in object)hasOwnProp.call(object, key) && (object[key] = new RegExp(object[key], "i")); + for(var key in object)hasOwnProp.call(object, key) && (object[key] = RegExp(object[key], "i")); }, MobileDetect = function(userAgent, maxPhoneWidth) { this.ua = userAgent || "", this._cache = {}, this.maxPhoneWidth = maxPhoneWidth || 600; }, impl = {}; @@ -301,7 +301,7 @@ import _instanceof from "@swc/helpers/lib/_instanceof.js"; for(key in mobileDetectRules.props)if (hasOwnProp.call(mobileDetectRules.props, key)) { for(isArray(values = mobileDetectRules.props[key]) || (values = [ values - ]), len = values.length, i = 0; i < len; ++i)(verPos = (value = values[i]).indexOf("[VER]")) >= 0 && (value = value.substring(0, verPos) + "([\\w._\\+]+)" + value.substring(verPos + 5)), values[i] = new RegExp(value, "i"); + ]), len = values.length, i = 0; i < len; ++i)(verPos = (value = values[i]).indexOf("[VER]")) >= 0 && (value = value.substring(0, verPos) + "([\\w._\\+]+)" + value.substring(verPos + 5)), values[i] = RegExp(value, "i"); mobileDetectRules.props[key] = values; } convertPropsToRegExp(mobileDetectRules.oss), convertPropsToRegExp(mobileDetectRules.phones), convertPropsToRegExp(mobileDetectRules.tablets), convertPropsToRegExp(mobileDetectRules.uas), convertPropsToRegExp(mobileDetectRules.utils), mobileDetectRules.oss0 = { @@ -381,7 +381,7 @@ import _instanceof from "@swc/helpers/lib/_instanceof.js"; return containsIC(this.userAgents(), key) || equalIC(key, this.os()) || equalIC(key, this.phone()) || equalIC(key, this.tablet()) || containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key); }, match: function(pattern) { - return _instanceof(pattern, RegExp) || (pattern = new RegExp(pattern, "i")), pattern.test(this.ua); + return _instanceof(pattern, RegExp) || (pattern = RegExp(pattern, "i")), pattern.test(this.ua); }, isPhoneSized: function(maxPhoneWidth) { return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth); @@ -401,5 +401,5 @@ import _instanceof from "@swc/helpers/lib/_instanceof.js"; if ("undefined" != typeof window) return function(factory) { window.MobileDetect = factory(); }; - throw new Error("unknown environment"); + throw Error("unknown environment"); }()); diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js index 57553c8aa27..bed6f88fe50 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js @@ -1,3 +1,3 @@ !function(x) { return x; -}(()=>{}, 1), new Function(); +}(()=>{}, 1), Function(); diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js index 6683d87983b..fea79646339 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js @@ -9,4 +9,4 @@ var C = function() { "use strict"; _class_call_check(this, C2); }; -new Function(); +Function(); diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js index 0230f00e5b0..1e015c5fe67 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js @@ -1 +1 @@ -new Function(); +Function(); diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js index 780a9814a9a..f1fbbe22b30 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js @@ -3,7 +3,7 @@ var C = function() { "use strict"; _class_call_check(this, C); }; -new Function(); +Function(); var C2 = function() { "use strict"; _class_call_check(this, C2); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js index 9f03032716f..b8512f21b61 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js @@ -1,9 +1,9 @@ export function Vec(len) { - this.storage = new Array(len); + this.storage = Array(len); } Vec.prototype = { dot (other) { - if (other.storage.length !== this.storage.length) throw new Error("Dot product only applicable for vectors of equal length"); + if (other.storage.length !== this.storage.length) throw Error("Dot product only applicable for vectors of equal length"); let sum = 0; for(let i = 0; i < this.storage.length; i++)sum += this.storage[i] * other.storage[i]; return sum; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js index 76e016b06bd..972329a91ba 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js @@ -1,10 +1,10 @@ import _instanceof from "@swc/helpers/lib/_instanceof.js"; export function Vec(len) { - this.storage = new Array(len); + this.storage = Array(len); } Vec.prototype = { dot: function(other) { - if (other.storage.length !== this.storage.length) throw new Error("Dot product only applicable for vectors of equal length"); + if (other.storage.length !== this.storage.length) throw Error("Dot product only applicable for vectors of equal length"); for(var sum = 0, i = 0; i < this.storage.length; i++)sum += this.storage[i] * other.storage[i]; return sum; }, diff --git a/crates/swc/tests/tsc-references/neverReturningFunctions1_es5.2.minified.js b/crates/swc/tests/tsc-references/neverReturningFunctions1_es5.2.minified.js index e9cbe898356..31e4d9e81f8 100644 --- a/crates/swc/tests/tsc-references/neverReturningFunctions1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/neverReturningFunctions1_es5.2.minified.js @@ -10,7 +10,7 @@ var Test = function() { } var _proto = Test.prototype; return _proto.fail = function(message) { - throw new Error(message); + throw Error(message); }, _proto.f1 = function(x) { void 0 === x && this.fail("undefined argument"), x.length; }, _proto.f2 = function(x) { @@ -53,7 +53,7 @@ var MyThrowable = function() { _class_call_check(this, MyThrowable); } return MyThrowable.prototype.throw = function() { - throw new Error(); + throw Error(); }, MyThrowable; }(), SuperThrowable = function(MyThrowable) { "use strict"; diff --git a/crates/swc/tests/tsc-references/neverType_es2015.2.minified.js b/crates/swc/tests/tsc-references/neverType_es2015.2.minified.js index f036025efd7..e5fceb23e6c 100644 --- a/crates/swc/tests/tsc-references/neverType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/neverType_es2015.2.minified.js @@ -1,5 +1,5 @@ function error(message) { - throw new Error(message); + throw Error(message); } (function(cb) { cb(); @@ -8,7 +8,7 @@ function error(message) { }(()=>error("Something failed")), function(cb) { cb(); }(()=>{ - throw new Error(); + throw Error(); }), function(cb) { cb(); }(()=>error("Error callback")); diff --git a/crates/swc/tests/tsc-references/neverType_es5.2.minified.js b/crates/swc/tests/tsc-references/neverType_es5.2.minified.js index b279987bb18..7ee9e22e25f 100644 --- a/crates/swc/tests/tsc-references/neverType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/neverType_es5.2.minified.js @@ -1,6 +1,6 @@ import _class_call_check from "@swc/helpers/lib/_class_call_check.js"; function error(message) { - throw new Error(message); + throw Error(message); } var C = function() { "use strict"; @@ -9,11 +9,11 @@ var C = function() { } var _proto = C.prototype; return _proto.void1 = function() { - throw new Error(); + throw Error(); }, _proto.void2 = function() { for(;;); }, _proto.never1 = function() { - throw new Error(); + throw Error(); }, _proto.never2 = function() { for(;;); }, C; @@ -29,7 +29,7 @@ var C = function() { }), function(cb) { cb(); }(function() { - throw new Error(); + throw Error(); }), function(cb) { cb(); }(function() { diff --git a/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es2015.2.minified.js index 476f5da76fd..b8e2d40f161 100644 --- a/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es2015.2.minified.js @@ -1,5 +1,5 @@ runTestCase(function() { - var a = new Array(!1, void 0, null, "0", { + var a = Array(!1, void 0, null, "0", { toString: function() { return 0; } diff --git a/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es5.2.minified.js b/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es5.2.minified.js index 476f5da76fd..b8e2d40f161 100644 --- a/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parser15.4.4.14-9-2_es5.2.minified.js @@ -1,5 +1,5 @@ runTestCase(function() { - var a = new Array(!1, void 0, null, "0", { + var a = Array(!1, void 0, null, "0", { toString: function() { return 0; } diff --git a/crates/swc/tests/tsc-references/parserObjectCreation1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserObjectCreation1_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/parserObjectCreation1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserObjectCreation1_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/parserRealSource12_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource12_es2015.2.minified.js index 9778c7d4fc9..e9eb6dfbc6d 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource12_es2015.2.minified.js @@ -36,7 +36,7 @@ var TypeScript; return options || (options = new AstWalkOptions()), new AstWalker(this.childrenWalkers, pre, post, options, state); } initChildrenWalkers() { - for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); + for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw Error("initWalkers function is not up to date with enum content!"); } constructor(){ this.childrenWalkers = [], this.initChildrenWalkers(); diff --git a/crates/swc/tests/tsc-references/parserRealSource12_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource12_es5.2.minified.js index f370fabede0..44d840baacc 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource12_es5.2.minified.js @@ -42,7 +42,7 @@ import _class_call_check from "@swc/helpers/lib/_class_call_check.js"; }, _proto.getSlowWalker = function(pre, post, options, state) { return options || (options = new AstWalkOptions()), new AstWalker(this.childrenWalkers, pre, post, options, state); }, _proto.initChildrenWalkers = function() { - for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw new Error("initWalkers function is not up to date with enum content!"); + for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers1.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers1.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers1.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers1.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers1.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers1.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers1.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers1.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers1.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers1.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers1.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers1.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers1.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers1.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers1.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers1.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers1.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers1.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers1.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers1.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers1.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers1.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers1.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers1.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers1.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers1.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers1.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers1.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers1.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers1.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers1.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers1.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw Error("initWalkers function is not up to date with enum content!"); }, AstWalkerFactory; }(); TypeScript1.AstWalkerFactory = AstWalkerFactory, TypeScript1.getAstWalkerFactory = getAstWalkerFactory, function(ChildrenWalkers) { diff --git a/crates/swc/tests/tsc-references/parserRealSource14_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource14_es2015.2.minified.js index 845e6b52cae..9ce287ea8ad 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource14_es2015.2.minified.js @@ -28,11 +28,11 @@ var TypeScript; this.top = this.asts.length, this.asts.push(ast); } up() { - if (this.top <= -1) throw new Error("Invalid call to 'up'"); + if (this.top <= -1) throw Error("Invalid call to 'up'"); this.top--; } down() { - if (this.top == this.ast.length - 1) throw new Error("Invalid call to 'down'"); + if (this.top == this.ast.length - 1) throw Error("Invalid call to 'down'"); this.top++; } nodeType() { diff --git a/crates/swc/tests/tsc-references/parserRealSource14_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource14_es5.2.minified.js index c9d3d599ffc..309e38fd684 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource14_es5.2.minified.js @@ -61,10 +61,10 @@ import _class_call_check from "@swc/helpers/lib/_class_call_check.js"; for(; this.asts.length > this.count();)this.asts.pop(); this.top = this.asts.length, this.asts.push(ast); }, _proto.up = function() { - if (this.top <= -1) throw new Error("Invalid call to 'up'"); + if (this.top <= -1) throw Error("Invalid call to 'up'"); this.top--; }, _proto.down = function() { - if (this.top == this.ast.length - 1) throw new Error("Invalid call to 'down'"); + if (this.top == this.ast.length - 1) throw Error("Invalid call to 'down'"); this.top++; }, _proto.nodeType = function() { return null == this.ast() ? TypeScript.NodeType.None : this.ast().nodeType; diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js index 38925c6fb0e..ebe8218dd3a 100644 --- a/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js @@ -9,7 +9,7 @@ var _p1 = new WeakMap(), Foo = function() { _class_call_check(this, Foo), _class_private_field_init(this, _p1, { writable: !0, value: function(v) { - if ("string" != typeof v) throw new Error(); + if ("string" != typeof v) throw Error(); } }); } @@ -26,5 +26,5 @@ var _p1 = new WeakMap(), Foo = function() { }, Foo2; }(); function p1(v) { - if ("string" != typeof v) throw new Error(); + if ("string" != typeof v) throw Error(); } diff --git a/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js b/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js index 0e8ae45f1c5..de33db5b842 100644 --- a/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js +++ b/crates/swc/tests/vercel/full-compact/react-autosuggest/1/output/index.js @@ -1 +1 @@ -"use strict";import e from"@swc/helpers/lib/_instanceof.js";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var d=function(a){if(a&&a.__esModule)return a;if(null===a||"object"!==g(a)&&"function"!=typeof a)return{default:a};var b=f();if(b&&b.has(a))return b.get(a);var c={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var e=h?Object.getOwnPropertyDescriptor(a,d):null;e&&(e.get||e.set)?Object.defineProperty(c,d,e):c[d]=a[d]}return c.default=a,b&&b.set(a,c),c}(require("react")),a=function(a){return a&&a.__esModule?a:{default:a}}(require("prop-types"));function f(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return f=function(){return a},a}function g(a){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function h(){return(h=Object.assign||function(d){for(var a=1;a 0) return function i(f) { - if ((f = String(f)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters."); + if ((f = String(f)).length > 100) throw Error("Value exceeds the maximum length of 100 characters."); var g = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f); if (!g) return NaN; var e = parseFloat(g[1]), h = (g[2] || "ms").toLowerCase(); @@ -46,14 +46,13 @@ export default function(g, i) { case "ms": return e; default: - throw new Error("The unit ".concat(h, " was matched, but no matching case exists.")); + throw Error("The unit ".concat(h, " was matched, but no matching case exists.")); } }(g); if ("number" == typeof g && isFinite(g)) return (null == i ? void 0 : i.long) ? f(g) : e(g); - throw new Error("Value is not a string or number."); + throw Error("Value is not a string or number."); } catch (j) { - var k = h(j) ? "".concat(j.message, ". value=").concat(JSON.stringify(g)) : "An unknown error has occurred."; - throw new Error(k); + throw Error(h(j) ? "".concat(j.message, ". value=").concat(JSON.stringify(g)) : "An unknown error has occurred."); } }; function e(c) { diff --git a/crates/swc/tests/vercel/full/react-autosuggest/1/output/index.js b/crates/swc/tests/vercel/full/react-autosuggest/1/output/index.js index 0ff3dbcf16e..dc9b50593fb 100644 --- a/crates/swc/tests/vercel/full/react-autosuggest/1/output/index.js +++ b/crates/swc/tests/vercel/full/react-autosuggest/1/output/index.js @@ -62,7 +62,7 @@ function _defineProperties(target, props) { } } function _assertThisInitialized(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _getPrototypeOf(o1) { @@ -85,7 +85,7 @@ function _defineProperty(obj, key, value) { } var ItemsList = function(_Component) { !function(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, @@ -113,9 +113,9 @@ var ItemsList = function(_Component) { function ItemsList1() { var _this; !function(instance, Constructor) { - if (!_instanceof(instance, Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!_instanceof(instance, Constructor)) throw TypeError("Cannot call a class as a function"); }(this, ItemsList1); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), _defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function(highlightedItem) { diff --git a/crates/swc/tests/vercel/full/regexp/1/output/index.js b/crates/swc/tests/vercel/full/regexp/1/output/index.js index e5898735021..e934424b33a 100644 --- a/crates/swc/tests/vercel/full/regexp/1/output/index.js +++ b/crates/swc/tests/vercel/full/regexp/1/output/index.js @@ -1,3 +1,3 @@ export default function() { - return new RegExp("{.[^}]+}\n*", "g"); + return RegExp("{.[^}]+}\n*", "g"); }; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index ded691a1ce1..b23737b9e9f 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -1105,7 +1105,16 @@ where fn compress_regexp(&mut self, e: &mut Expr) { let (span, args) = match e { Expr::New(NewExpr { - span, callee, args, .. + span, + callee, + args: Some(args), + .. + }) + | Expr::Call(CallExpr { + span, + callee: Callee::Expr(callee), + args, + .. }) => match &**callee { Expr::Ident(Ident { sym: js_word!("RegExp"), @@ -1116,10 +1125,6 @@ where _ => return, }; - let args = match args { - Some(v) => v, - None => return, - }; if args.is_empty() || args.len() > 2 { return; } diff --git a/crates/swc_ecma_minifier/src/compress/pure/misc.rs b/crates/swc_ecma_minifier/src/compress/pure/misc.rs index 6c6a00172f4..4370a4aa334 100644 --- a/crates/swc_ecma_minifier/src/compress/pure/misc.rs +++ b/crates/swc_ecma_minifier/src/compress/pure/misc.rs @@ -4,7 +4,7 @@ use swc_atoms::js_word; use swc_common::{iter::IdentifyLast, util::take::Take, Span, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{ - ExprExt, Type, + ExprExt, ExprFactory, Type, Value::{self, Known}, }; @@ -230,6 +230,56 @@ impl Pure<'_> { } } + /// new Array(...) -> Array(...) + pub(super) fn remove_new(&mut self, e: &mut Expr) { + if !self.options.pristine_globals { + return; + } + + match e { + Expr::New(NewExpr { + span, + callee, + args, + type_args, + }) if callee.is_one_of_global_ref_to( + &self.expr_ctx, + &[ + // https://262.ecma-international.org/12.0/#sec-array-constructor + "Array", + // https://262.ecma-international.org/12.0/#sec-function-constructor + "Function", + // https://262.ecma-international.org/12.0/#sec-regexp-constructor + "RegExp", + // https://262.ecma-international.org/12.0/#sec-error-constructor + "Error", + // https://262.ecma-international.org/12.0/#sec-aggregate-error-constructor + "AggregateError", + // https://262.ecma-international.org/12.0/#sec-nativeerror-object-structure + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError", + ], + ) => + { + self.changed = true; + report_change!( + "new operator: Compressing `new Array/RegExp/..` => `Array()/RegExp()/..`" + ); + *e = Expr::Call(CallExpr { + span: *span, + callee: callee.take().as_callee(), + args: args.take().unwrap_or_default(), + type_args: type_args.take(), + }) + } + _ => {} + } + } + /// Removes last return statement. This should be callled only if the return /// value of function is ignored. /// @@ -761,25 +811,37 @@ impl Pure<'_> { if self.options.side_effects && self.options.pristine_globals { match e { - Expr::New(NewExpr { callee, args, .. }) => { - if let Expr::Ident(i) = &**callee { - match &*i.sym { - "Map" | "Set" | "Array" | "Object" | "Boolean" | "Number" => { - if i.span.ctxt.outer() == self.marks.unresolved_mark { - report_change!("Dropping a pure new expression"); + Expr::New(NewExpr { callee, args, .. }) + if callee.is_one_of_global_ref_to( + &self.expr_ctx, + &["Map", "Set", "Array", "Object", "Boolean", "Number"], + ) => + { + report_change!("Dropping a pure new expression"); - self.changed = true; - *e = self - .make_ignored_expr( - args.iter_mut().flatten().map(|arg| arg.expr.take()), - ) - .unwrap_or(Expr::Invalid(Invalid { span: DUMMY_SP })); - return; - } - } - _ => {} - } - } + self.changed = true; + *e = self + .make_ignored_expr(args.iter_mut().flatten().map(|arg| arg.expr.take())) + .unwrap_or(Expr::Invalid(Invalid { span: DUMMY_SP })); + return; + } + + Expr::Call(CallExpr { + callee: Callee::Expr(callee), + args, + .. + }) if callee.is_one_of_global_ref_to( + &self.expr_ctx, + &["Array", "Object", "Boolean", "Number"], + ) => + { + report_change!("Dropping a pure call expression"); + + self.changed = true; + *e = self + .make_ignored_expr(args.iter_mut().map(|arg| arg.expr.take())) + .unwrap_or(Expr::Invalid(Invalid { span: DUMMY_SP })); + return; } Expr::Object(obj) => { diff --git a/crates/swc_ecma_minifier/src/compress/pure/mod.rs b/crates/swc_ecma_minifier/src/compress/pure/mod.rs index ab41485b793..184adbd3939 100644 --- a/crates/swc_ecma_minifier/src/compress/pure/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/pure/mod.rs @@ -370,6 +370,8 @@ impl VisitMut for Pure<'_> { self.compress_negated_bin_eq(e); self.compress_useless_cond_expr(e); + + self.remove_new(e); } fn visit_mut_expr_stmt(&mut self, s: &mut ExprStmt) { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2011/actual/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2011/actual/output.js index 55d21ef091c..a7128f9f325 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2011/actual/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2011/actual/output.js @@ -1,5 +1,5 @@ function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); } function _defineProperties(target, props) { for(var i = 0; i < props.length; i++){ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2044/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2044/full/output.js index 941cf9d9507..4191d3efd0c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2044/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2044/full/output.js @@ -10,7 +10,7 @@ module.exports = { findConfig: function(from) { return function(dir) { - throw new Error(""); + throw Error(""); }; } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-1/output.js index ced8f9c6058..f83e26da487 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-1/output.js @@ -10,7 +10,7 @@ createCommonjsModule(function(module, exports) { module.exports = { findConfig: function(from) { return function(dir) { - throw new Error(""); + throw Error(""); }; } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-10/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-10/output.js index dba55b753fb..e3bd904d61f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-10/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2044/pass-10/output.js @@ -10,7 +10,7 @@ createCommonjsModule(function(module, exports) { module.exports = { findConfig: function(from) { return function(dir) { - throw new Error(""); + throw Error(""); }; } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js index c507746db54..46914411b26 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js @@ -274,7 +274,7 @@ "auth", "setAuth", ])), pageConfigAuth = pageConfig.auth; - if (pageConfigAuth && !Array.isArray(pageConfigAuth)) throw new Error("pageConfig.auth must be an array"); + if (pageConfigAuth && !Array.isArray(pageConfigAuth)) throw Error("pageConfig.auth must be an array"); return Array.isArray(pageConfigAuth) && pageConfigAuth.length && !Object.keys(auth).filter(function(item) { return !!pageConfigAuth.includes(item) && auth[item]; }).length ? authConfig.NoAuthFallback ? "function" == typeof authConfig.NoAuthFallback ? _jsxRuntime.jsx(authConfig.NoAuthFallback, {}) : authConfig.NoAuthFallback : null : _jsxRuntime.jsx(PageComponent, swcHelpers.objectSpread({}, rest)); @@ -577,13 +577,13 @@ Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0, exports.default = function() { - for(var _len = arguments.length, strArray = new Array(_len), _key = 0; _key < _len; _key++)strArray[_key] = arguments[_key]; + for(var _len = arguments.length, strArray = Array(_len), _key = 0; _key < _len; _key++)strArray[_key] = arguments[_key]; if (0 === strArray.length) return ""; var resultArray = [], filterStrArray = strArray.filter(function(str) { return "" !== str; }); return filterStrArray.forEach(function(str, index) { - if ("string" != typeof str) throw new Error("Path must be a string. Received ".concat(str)); + if ("string" != typeof str) throw Error("Path must be a string. Received ".concat(str)); var routePath = str; index > 0 && (routePath = routePath.replace(/^[/]+/, "")), routePath = index < filterStrArray.length - 1 ? routePath.replace(/[/]+$/, "") : routePath.replace(/[/]+$/, "/"), resultArray.push(routePath); }), resultArray.join("/"); @@ -715,7 +715,7 @@ var _react_17_0_2_react = __webpack_require__(59301), objectWithoutPropertiesLoose = __webpack_require__(21617), esm_extends = __webpack_require__(87062), inheritsLoose = __webpack_require__(48861), _react_is_16_13_1_react_is = __webpack_require__(99234), hoist_non_react_statics_cjs = __webpack_require__(94266), hoist_non_react_statics_cjs_default = __webpack_require__.n(hoist_non_react_statics_cjs); function invariant(condition, message) { if (!condition) { - var error = new Error("loadable: " + message); + var error = Error("loadable: " + message); throw error.framesToPop = 1, error.name = "Invariant Violation", error; } } @@ -759,7 +759,7 @@ } function resolve(module, props, Loadable) { var Component = options.resolveComponent ? options.resolveComponent(module, props) : defaultResolveComponent(module); - if (options.resolveComponent && !(0, _react_is_16_13_1_react_is.isValidElementType)(Component)) throw new Error("resolveComponent returned something that is not a React component!"); + if (options.resolveComponent && !(0, _react_is_16_13_1_react_is.isValidElementType)(Component)) throw Error("resolveComponent returned something that is not a React component!"); return hoist_non_react_statics_cjs_default()(Loadable, Component, { preload: !0 }), Component; @@ -775,7 +775,7 @@ }, invariant(!props.__chunkExtractor || ctor1.requireSync, "SSR requires `@loadable/babel-plugin`, please install it"), props.__chunkExtractor) ? (!1 === options.ssr || (ctor1.requireAsync(props).catch(function() { return null; }), _this.loadSync(), props.__chunkExtractor.addChunk(ctor1.chunkName(props))), function(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; }(_this)) : (!1 !== options.ssr && (ctor1.isReady && ctor1.isReady(props) || ctor1.chunkName && LOADABLE_SHARED.initialChunks[ctor1.chunkName(props)]) && _this.loadSync(), _this); } @@ -919,7 +919,7 @@ if (extElement) JSON.parse(extElement.textContent).namedChunks.forEach(function(chunkName) { LOADABLE_SHARED.initialChunks[chunkName] = !0; }); - else throw new Error("loadable-component: @loadable/server does not match @loadable/component"); + else throw Error("loadable-component: @loadable/server does not match @loadable/component"); } } if (!requiredChunks) return warn("`loadableReady()` requires state, please use `getScriptTags` or `getScriptElements` server-side"), done(), Promise.resolve(); @@ -961,12 +961,12 @@ } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { - for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2; } } function _assertThisInitialized(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _AwaitValue(value) { @@ -1046,7 +1046,7 @@ function _asyncIterator(iterable) { var method; if ("function" == typeof Symbol && (Symbol.asyncIterator && null != (method = iterable[Symbol.asyncIterator]) || Symbol.iterator && null != (method = iterable[Symbol.iterator]))) return method.call(iterable); - throw new TypeError("Object is not async iterable"); + throw TypeError("Object is not async iterable"); } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { @@ -1076,39 +1076,39 @@ return new _AwaitValue(value); } function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); } function _classNameTDZError(name) { - throw new Error('Class "' + name + '" cannot be referenced in computed property keys.'); + throw Error('Class "' + name + '" cannot be referenced in computed property keys.'); } function _classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); + if (!privateMap.has(receiver)) throw TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver).value; } function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) throw new TypeError("attempted to use private field on non-instance"); + if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) throw TypeError("attempted to use private field on non-instance"); return receiver; } function _classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance"); + if (!privateMap.has(receiver)) throw TypeError("attempted to set private field on non-instance"); var descriptor = privateMap.get(receiver); - if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); + if (!descriptor.writable) throw TypeError("attempted to set read only private field"); return descriptor.value = value, value; } function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); + if (!privateSet.has(receiver)) throw TypeError("attempted to get private field on non-instance"); return fn; } function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); + throw TypeError("attempted to reassign private method"); } function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); + if (receiver !== classConstructor) throw TypeError("Private static access of wrong provenance"); return descriptor.value; } function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); - if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); + if (receiver !== classConstructor) throw TypeError("Private static access of wrong provenance"); + if (!descriptor.writable) throw TypeError("attempted to set read only private field"); return descriptor.value = value, value; } function construct(Parent1, args1, Class1) { @@ -1145,7 +1145,7 @@ if (Symbol.iterator in Object(iter) || "[object Arguments]" === Object.prototype.toString.call(iter)) return Array.from(iter); } function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); } function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); @@ -1159,7 +1159,7 @@ if (void 0 !== prim) { var res = prim.call(input, hint || "default"); if ("object" !== _type_of_typeof(res)) return res; - throw new TypeError("@@toPrimitive must return a primitive value."); + throw TypeError("@@toPrimitive must return a primitive value."); } return ("string" === hint ? String : Number)(input); } @@ -1214,11 +1214,11 @@ return "method" === other.kind && other.key === element.key && other.placement === element.placement; }))) { if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other1.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other1)) throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); + if (_hasDecorators(element) || _hasDecorators(other1)) throw ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); other1.descriptor = element.descriptor; } else { if (_hasDecorators(element)) { - if (_hasDecorators(other1)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + element.key + ")."); + if (_hasDecorators(other1)) throw ReferenceError("Decorators can't be placed on different accessors with for the same property (" + element.key + ")."); other1.decorators = element.decorators; } _coalesceGetterSetter(element, other1); @@ -1289,7 +1289,7 @@ } function _addElementPlacement(element, placements, silent) { var keys = placements[element.placement]; - if (!silent && -1 !== keys.indexOf(element.key)) throw new TypeError("Duplicated element (" + element.key + ")"); + if (!silent && -1 !== keys.indexOf(element.key)) throw TypeError("Duplicated element (" + element.key + ")"); keys.push(element.key); } function _decorateElement(element, placements) { @@ -1315,7 +1315,7 @@ var obj = _fromClassDescriptor(elements), elementsAndFinisher = _toClassDescriptor((0, decorators[i])(obj) || obj); if (void 0 !== elementsAndFinisher.finisher && finishers.push(elementsAndFinisher.finisher), void 0 !== elementsAndFinisher.elements) { elements = elementsAndFinisher.elements; - for(var j = 0; j < elements.length - 1; j++)for(var k = j + 1; k < elements.length; k++)if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) throw new TypeError("Duplicated element (" + elements[j].key + ")"); + for(var j = 0; j < elements.length - 1; j++)for(var k = j + 1; k < elements.length; k++)if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) throw TypeError("Duplicated element (" + elements[j].key + ")"); } } return { @@ -1343,9 +1343,9 @@ } function _toElementDescriptor(elementObject) { var kind = String(elementObject.kind); - if ("method" !== kind && "field" !== kind) throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + kind + '"'); + if ("method" !== kind && "field" !== kind) throw TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + kind + '"'); var key = _toPropertyKey(elementObject.key), placement = String(elementObject.placement); - if ("static" !== placement && "prototype" !== placement && "own" !== placement) throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + placement + '"'); + if ("static" !== placement && "prototype" !== placement && "own" !== placement) throw TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + placement + '"'); var descriptor = elementObject.descriptor; _disallowProperty(elementObject, "elements", "An element descriptor"); var element = { @@ -1376,7 +1376,7 @@ } function _toClassDescriptor(obj) { var kind = String(obj.kind); - if ("class" !== kind) throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + kind + '"'); + if ("class" !== kind) throw TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + kind + '"'); _disallowProperty(obj, "key", "A class descriptor"), _disallowProperty(obj, "placement", "A class descriptor"), _disallowProperty(obj, "descriptor", "A class descriptor"), _disallowProperty(obj, "initializer", "A class descriptor"), _disallowProperty(obj, "extras", "A class descriptor"); var finisher = _optionalCallableProperty(obj, "finisher"); return { @@ -1385,18 +1385,18 @@ }; } function _disallowProperty(obj, name, objectType) { - if (void 0 !== obj[name]) throw new TypeError(objectType + " can't have a ." + name + " property."); + if (void 0 !== obj[name]) throw TypeError(objectType + " can't have a ." + name + " property."); } function _optionalCallableProperty(obj, name) { var value = obj[name]; - if (void 0 !== value && "function" != typeof value) throw new TypeError("Expected '" + name + "' to be a function"); + if (void 0 !== value && "function" != typeof value) throw TypeError("Expected '" + name + "' to be a function"); return value; } function _runClassFinishers(constructor, finishers) { for(var i = 0; i < finishers.length; i++){ var newConstructor = (0, finishers[i])(constructor); if (void 0 !== newConstructor) { - if ("function" != typeof newConstructor) throw new TypeError("Finishers must return a constructor."); + if ("function" != typeof newConstructor) throw TypeError("Finishers must return a constructor."); constructor = newConstructor; } } @@ -1473,7 +1473,7 @@ return setPrototypeOf(o, p); } function _inherits(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, @@ -1494,7 +1494,7 @@ }); } function _initializerWarningHelper(descriptor, context) { - throw new Error("Decorating class property failed. Please ensure that proposal-class-properties is enabled and set to use loose mode. To use proposal-class-properties in spec mode with decorators, wait for the next major version of decorators in stage 2."); + throw Error("Decorating class property failed. Please ensure that proposal-class-properties is enabled and set to use loose mode. To use proposal-class-properties in spec mode with decorators, wait for the next major version of decorators in stage 2."); } function _instanceof(left, right) { return null != right && "undefined" != typeof Symbol && right[Symbol.hasInstance] ? right[Symbol.hasInstance](left) : left instanceof right; @@ -1546,7 +1546,7 @@ else props || (props = defaultProps || {}); if (1 === childrenLength) props.children = children; else if (childrenLength > 1) { - for(var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++)childArray[i] = arguments[i + 3]; + for(var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)childArray[i] = arguments[i + 3]; props.children = childArray; } return { @@ -1559,10 +1559,10 @@ }; } function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) throw new TypeError("Cannot instantiate an arrow function"); + if (innerThis !== boundThis) throw TypeError("Cannot instantiate an arrow function"); } function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw TypeError("Invalid attempt to spread non-iterable instance"); } function _objectSpread(target) { for(var i = 1; i < arguments.length; i++){ @@ -1594,7 +1594,7 @@ return call && ("object" === _type_of_typeof(call) || "function" == typeof call) ? call : _assertThisInitialized(self); } function _readOnlyError(name) { - throw new Error('"' + name + '" is read-only'); + throw Error('"' + name + '" is read-only'); } function set(target2, property2, value1, receiver2) { return (set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function(target, property, value, receiver) { @@ -1611,7 +1611,7 @@ })(target2, property2, value1, receiver2); } function _set(target, property, value, receiver, isStrict) { - if (!set(target, property, value, receiver || target) && isStrict) throw new Error("failed to set property"); + if (!set(target, property, value, receiver || target) && isStrict) throw Error("failed to set property"); return value; } function _skipFirstGeneratorNext(fn) { @@ -1651,7 +1651,7 @@ var _cache = "function" == typeof Map ? new Map() : void 0; return (wrapNativeSuper = function(Class) { if (null === Class || !_isNativeFunction(Class)) return Class; - if ("function" != typeof Class) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof Class) throw TypeError("Super expression must either be null or a function"); if (void 0 !== _cache) { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); @@ -2000,7 +2000,7 @@ "use strict"; var Cancel = __webpack_require__(69651); function CancelToken(executor) { - if ("function" != typeof executor) throw new TypeError("executor must be a function."); + if ("function" != typeof executor) throw TypeError("executor must be a function."); this.promise = new Promise(function(resolve) { resolvePromise = resolve; }); @@ -2136,7 +2136,7 @@ "use strict"; var enhanceError = __webpack_require__(16488); module.exports = function(message, config, code, request, response) { - var error = new Error(message); + var error = Error(message); return enhanceError(error, config, code, request, response); }; }, @@ -2333,7 +2333,7 @@ "use strict"; module.exports = function(fn, thisArg) { return function() { - for(var args = new Array(arguments.length), i = 0; i < args.length; i++)args[i] = arguments[i]; + for(var args = Array(arguments.length), i = 0; i < args.length; i++)args[i] = arguments[i]; return fn.apply(thisArg, args); }; }; @@ -2380,7 +2380,7 @@ cookie.push(name + "=" + encodeURIComponent(value)), utils.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()), utils.isString(path) && cookie.push("path=" + path), utils.isString(domain) && cookie.push("domain=" + domain), !0 === secure && cookie.push("secure"), document.cookie = cookie.join("; "); }, read: function(name) { - var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); + var match = document.cookie.match(RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); return match ? decodeURIComponent(match[3]) : null; }, remove: function(name) { @@ -2508,18 +2508,18 @@ return "[Axios v" + pkg.version + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); } return function(value, opt, opts) { - if (!1 === validator) throw new Error(formatMessage(opt, " has been removed in " + version)); + if (!1 === validator) throw Error(formatMessage(opt, " has been removed in " + version)); return isDeprecated && !deprecatedWarnings[opt] && (deprecatedWarnings[opt] = !0, console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"))), !validator || validator(value, opt, opts); }; }, module.exports = { isOlderVersion: isOlderVersion, assertOptions: function(options, schema, allowUnknown) { - if ("object" != typeof options) throw new TypeError("options must be an object"); + if ("object" != typeof options) throw TypeError("options must be an object"); for(var keys = Object.keys(options), i = keys.length; i-- > 0;){ var opt = keys[i], validator = schema[opt]; if (validator) { var value = options[opt], result = void 0 === value || validator(value, opt, options); - if (!0 !== result) throw new TypeError("option " + opt + " must be " + result); + if (!0 !== result) throw TypeError("option " + opt + " must be " + result); continue; } if (!0 !== allowUnknown) throw Error("Unknown option " + opt); @@ -2829,7 +2829,7 @@ anInstance(this, $ArrayBuffer, ARRAY_BUFFER); var byteLength = toIndex(length); setInternalState(this, { - bytes: arrayFill.call(new Array(byteLength), 0), + bytes: arrayFill.call(Array(byteLength), 0), byteLength: byteLength }), DESCRIPTORS || (this.byteLength = byteLength); }, $DataView = function(buffer, byteOffset, byteLength) { @@ -3862,7 +3862,7 @@ var abs = Math.abs, pow = Math.pow, floor = Math.floor, log = Math.log, LN2 = Math.LN2; module.exports = { pack: function(number, mantissaLength, bytes) { - var exponent, mantissa, c, buffer = new Array(bytes), exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, rt = 23 === mantissaLength ? pow(2, -24) - pow(2, -77) : 0, sign = number < 0 || 0 === number && 1 / number < 0 ? 1 : 0, index = 0; + var exponent, mantissa, c, buffer = Array(bytes), exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, rt = 23 === mantissaLength ? pow(2, -24) - pow(2, -77) : 0, sign = number < 0 || 0 === number && 1 / number < 0 ? 1 : 0, index = 0; for((number = abs(number)) != number || number === 1 / 0 ? (mantissa = number != number ? 1 : 0, exponent = eMax) : (exponent = floor(log(number) / LN2), number * (c = pow(2, -exponent)) < 1 && (exponent--, c *= 2), exponent + eBias >= 1 ? number += rt / c : number += rt * pow(2, 1 - eBias), number * c >= 2 && (exponent++, c /= 2), exponent + eBias >= eMax ? (mantissa = 0, exponent = eMax) : exponent + eBias >= 1 ? (mantissa = (number * c - 1) * pow(2, mantissaLength), exponent += eBias) : (mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength), exponent = 0)); mantissaLength >= 8; buffer[index++] = 255 & mantissa, mantissa /= 256, mantissaLength -= 8); for(exponent = exponent << mantissaLength | mantissa, exponentLength += mantissaLength; exponentLength > 0; buffer[index++] = 255 & exponent, exponent /= 256, exponentLength -= 8); return buffer[--index] |= 128 * sign, buffer; @@ -3957,7 +3957,7 @@ if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()), wmget = store.get, wmhas = store.has, wmset = store.set; set = function(it, metadata) { - if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); + if (wmhas.call(store, it)) throw TypeError(OBJECT_ALREADY_INITIALIZED); return metadata.facade = it, wmset.call(store, it, metadata), metadata; }, get = function(it) { return wmget.call(store, it) || {}; @@ -3967,7 +3967,7 @@ } else { var STATE = sharedKey("state"); hiddenKeys[STATE] = !0, set = function(it, metadata) { - if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); + if (objectHas(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED); return metadata.facade = it, createNonEnumerableProperty(it, STATE, metadata), metadata; }, get = function(it) { return objectHas(it, STATE) ? it[STATE] : {}; @@ -4525,7 +4525,7 @@ var result, reCopy, lastIndex, match, i, object, group, re = this, state = getInternalState(re), str = toString(string), raw = state.raw; if (raw) return raw.lastIndex = re.lastIndex, result = patchedExec.call(raw, str), re.lastIndex = raw.lastIndex, result; var groups = state.groups, sticky = UNSUPPORTED_Y && re.sticky, flags = regexpFlags.call(re), source = re.source, charsAdded = 0, strCopy = str; - if (sticky && (-1 === (flags = flags.replace("y", "")).indexOf("g") && (flags += "g"), strCopy = str.slice(re.lastIndex), re.lastIndex > 0 && (!re.multiline || re.multiline && "\n" !== str.charAt(re.lastIndex - 1)) && (source = "(?: " + source + ")", strCopy = " " + strCopy, charsAdded++), reCopy = new RegExp("^(?:" + source + ")", flags)), NPCG_INCLUDED && (reCopy = new RegExp("^" + source + "$(?!\\s)", flags)), UPDATES_LAST_INDEX_WRONG && (lastIndex = re.lastIndex), match = nativeExec.call(sticky ? reCopy : re, strCopy), sticky ? match ? (match.input = match.input.slice(charsAdded), match[0] = match[0].slice(charsAdded), match.index = re.lastIndex, re.lastIndex += match[0].length) : re.lastIndex = 0 : UPDATES_LAST_INDEX_WRONG && match && (re.lastIndex = re.global ? match.index + match[0].length : lastIndex), NPCG_INCLUDED && match && match.length > 1 && nativeReplace.call(match[0], reCopy, function() { + if (sticky && (-1 === (flags = flags.replace("y", "")).indexOf("g") && (flags += "g"), strCopy = str.slice(re.lastIndex), re.lastIndex > 0 && (!re.multiline || re.multiline && "\n" !== str.charAt(re.lastIndex - 1)) && (source = "(?: " + source + ")", strCopy = " " + strCopy, charsAdded++), reCopy = RegExp("^(?:" + source + ")", flags)), NPCG_INCLUDED && (reCopy = RegExp("^" + source + "$(?!\\s)", flags)), UPDATES_LAST_INDEX_WRONG && (lastIndex = re.lastIndex), match = nativeExec.call(sticky ? reCopy : re, strCopy), sticky ? match ? (match.input = match.input.slice(charsAdded), match[0] = match[0].slice(charsAdded), match.index = re.lastIndex, re.lastIndex += match[0].length) : re.lastIndex = 0 : UPDATES_LAST_INDEX_WRONG && match && (re.lastIndex = re.global ? match.index + match[0].length : lastIndex), NPCG_INCLUDED && match && match.length > 1 && nativeReplace.call(match[0], reCopy, function() { for(i = 1; i < arguments.length - 2; i++)void 0 === arguments[i] && (match[i] = void 0); }), match && groups) for(i = 0, match.groups = object = create(null); i < groups.length; i++)object[(group = groups[i])[0]] = match[group[1]]; return match; @@ -5035,7 +5035,7 @@ var $ = __webpack_require__(35437), getPrototypeOf = __webpack_require__(39311), setPrototypeOf = __webpack_require__(59057), create = __webpack_require__(18255), createNonEnumerableProperty = __webpack_require__(48181), createPropertyDescriptor = __webpack_require__(93608), iterate = __webpack_require__(7261), toString = __webpack_require__(72729), $AggregateError = function(errors, message) { var that = this; if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message); - setPrototypeOf && (that = setPrototypeOf(new Error(void 0), getPrototypeOf(that))), void 0 !== message && createNonEnumerableProperty(that, "message", toString(message)); + setPrototypeOf && (that = setPrototypeOf(Error(void 0), getPrototypeOf(that))), void 0 !== message && createNonEnumerableProperty(that, "message", toString(message)); var errorsArray = []; return iterate(errors, errorsArray.push, { that: errorsArray @@ -6975,7 +6975,7 @@ IS_NCG.test(string.slice(index + 1)) && (index += 2, ncg = !0), result += chr, groupid++; continue; case ">" === chr && ncg: - if ("" === groupname || has(names, groupname)) throw new SyntaxError("Invalid capture group name"); + if ("" === groupname || has(names, groupname)) throw SyntaxError("Invalid capture group name"); names[groupname] = !0, named.push([ groupname, groupid @@ -7074,7 +7074,7 @@ var exec = this.exec; if (!isCallable(exec)) return nativeTest.call(this, str); var result = exec.call(this, str); - if (null !== result && !isObject(result)) throw new Error("RegExp exec method returned something other than an Object or null"); + if (null !== result && !isObject(result)) throw Error("RegExp exec method returned something other than an Object or null"); return !!result; } }); @@ -7359,7 +7359,7 @@ if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); if (void 0 === (matcher = getMethod(regexp, MATCH_ALL)) && IS_PURE && "RegExp" == classof(regexp) && (matcher = $matchAll), matcher) return matcher.call(regexp, O); } else if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); - return S = toString(O), rx = new RegExp(regexp, "g"), IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S); + return S = toString(O), rx = RegExp(regexp, "g"), IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S); } }), IS_PURE || MATCH_ALL in RegExpPrototype || redefine(RegExpPrototype, MATCH_ALL, $matchAll); }, @@ -7370,7 +7370,7 @@ return [ function(regexp) { var O = requireObjectCoercible(this), matcher = void 0 == regexp ? void 0 : getMethod(regexp, MATCH); - return matcher ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O)); + return matcher ? matcher.call(regexp, O) : RegExp(regexp)[MATCH](toString(O)); }, function(string) { var result, rx = anObject(this), S = toString(string), res = maybeCallNative(nativeMatch, rx, S); @@ -7515,7 +7515,7 @@ return [ function(regexp) { var O = requireObjectCoercible(this), searcher = void 0 == regexp ? void 0 : getMethod(regexp, SEARCH); - return searcher ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O)); + return searcher ? searcher.call(regexp, O) : RegExp(regexp)[SEARCH](toString(O)); }, function(string) { var rx = anObject(this), S = toString(string), res = maybeCallNative(nativeSearch, rx, S); @@ -7560,7 +7560,7 @@ string ]; if (!isRegExp(separator)) return nativeSplit.call(string, separator, lim); - for(var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.unicode ? "u" : "") + (separator.sticky ? "y" : ""), lastLastIndex = 0, separatorCopy = new RegExp(separator.source, flags + "g"); (match = regexpExec.call(separatorCopy, string)) && (!((lastIndex = separatorCopy.lastIndex) > lastLastIndex) || (output.push(string.slice(lastLastIndex, match.index)), match.length > 1 && match.index < string.length && arrayPush.apply(output, match.slice(1)), lastLength = match[0].length, lastLastIndex = lastIndex, !(output.length >= lim)));)separatorCopy.lastIndex === match.index && separatorCopy.lastIndex++; + for(var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.unicode ? "u" : "") + (separator.sticky ? "y" : ""), lastLastIndex = 0, separatorCopy = RegExp(separator.source, flags + "g"); (match = regexpExec.call(separatorCopy, string)) && (!((lastIndex = separatorCopy.lastIndex) > lastLastIndex) || (output.push(string.slice(lastLastIndex, match.index)), match.length > 1 && match.index < string.length && arrayPush.apply(output, match.slice(1)), lastLength = match[0].length, lastLastIndex = lastIndex, !(output.length >= lim)));)separatorCopy.lastIndex === match.index && separatorCopy.lastIndex++; return lastLastIndex === string.length ? (lastLength || !separatorCopy.test("")) && output.push("") : output.push(string.slice(lastLastIndex)), output.length > lim ? output.slice(0, lim) : output; } : "0".split(void 0, 0).length ? function(separator, limit) { return void 0 === separator && 0 === limit ? [] : nativeSplit.call(this, separator, limit); @@ -9167,7 +9167,7 @@ for(var p in b)Object.prototype.hasOwnProperty.call(b, p) && (d[p] = b[p]); })(d1, b1); }, function(d, b) { - if ("function" != typeof b && null !== b) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + if ("function" != typeof b && null !== b) throw TypeError("Class extends value " + String(b) + " is not a constructor or null"); function __() { this.constructor = d; } @@ -9398,7 +9398,7 @@ }, 74677: function(module) { "use strict"; - var token = "%[a-f0-9]{2}", singleMatcher = new RegExp(token, "gi"), multiMatcher = new RegExp("(" + token + ")+", "gi"); + var token = "%[a-f0-9]{2}", singleMatcher = RegExp(token, "gi"), multiMatcher = RegExp("(" + token + ")+", "gi"); function decodeComponents(components, split) { try { return decodeURIComponent(components.join("")); @@ -9417,7 +9417,7 @@ } } module.exports = function(encodedURI) { - if ("string" != typeof encodedURI) throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof encodedURI + "`"); + if ("string" != typeof encodedURI) throw TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof encodedURI + "`"); try { return encodedURI = encodedURI.replace(/\+/g, " "), decodeURIComponent(encodedURI); } catch (err) { @@ -9437,7 +9437,7 @@ replaceMap["%C2"] = "\uFFFD"; for(var entries = Object.keys(replaceMap), i = 0; i < entries.length; i++){ var key = entries[i]; - input = input.replace(new RegExp(key, "g"), replaceMap[key]); + input = input.replace(RegExp(key, "g"), replaceMap[key]); } return input; }(encodedURI); @@ -9555,7 +9555,7 @@ try { location.pathname = decodeURI(location.pathname); } catch (e) { - if (e instanceof URIError) throw new URIError('Pathname "' + location.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.'); + if (e instanceof URIError) throw URIError('Pathname "' + location.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.'); throw e; } return key && (location.key = key), currentLocation ? location.pathname ? "/" !== location.pathname.charAt(0) && (location.pathname = resolve_pathname(location.pathname, currentLocation.pathname)) : location.pathname = currentLocation.pathname : location.pathname || (location.pathname = "/"), location; @@ -9589,7 +9589,7 @@ }; }, notifyListeners: function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; listeners.forEach(function(listener) { return listener.apply(void 0, args); }); @@ -10046,7 +10046,7 @@ } }() ? function(target, source) { for(var from, symbols, to = function(val) { - if (null == val) throw new TypeError("Object.assign cannot be called with null or undefined"); + if (null == val) throw TypeError("Object.assign cannot be called with null or undefined"); return Object(val); }(target), s = 1; s < arguments.length; s++){ for(var key in from = Object(arguments[s]))hasOwnProperty.call(from, key) && (to[key] = from[key]); @@ -10063,7 +10063,7 @@ module.exports = pathToRegexp, module.exports.parse = parse, module.exports.compile = function(str, options) { return tokensToFunction(parse(str, options), options); }, module.exports.tokensToFunction = tokensToFunction, module.exports.tokensToRegExp = tokensToRegExp; - var PATH_REGEXP = new RegExp("(\\\\.)|([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))", "g"); + var PATH_REGEXP = RegExp("(\\\\.)|([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))", "g"); function parse(str, options) { for(var res, tokens = [], key = 0, index = 0, path = "", defaultDelimiter = options && options.delimiter || "/"; null != (res = PATH_REGEXP.exec(str));){ var m = res[0], escaped = res[1], offset = res.index; @@ -10098,7 +10098,7 @@ }); } function tokensToFunction(tokens, options) { - for(var matches = new Array(tokens.length), i1 = 0; i1 < tokens.length; i1++)"object" == typeof tokens[i1] && (matches[i1] = new RegExp("^(?:" + tokens[i1].pattern + ")$", flags(options))); + for(var matches = Array(tokens.length), i1 = 0; i1 < tokens.length; i1++)"object" == typeof tokens[i1] && (matches[i1] = RegExp("^(?:" + tokens[i1].pattern + ")$", flags(options))); return function(obj, opts) { for(var path = "", data = obj || {}, encode = (opts || {}).pretty ? encodeURIComponentPretty : encodeURIComponent, i = 0; i < tokens.length; i++){ var segment, token = tokens[i]; @@ -10112,21 +10112,21 @@ token.partial && (path += token.prefix); continue; } - throw new TypeError('Expected "' + token.name + '" to be defined'); + throw TypeError('Expected "' + token.name + '" to be defined'); } if (isarray(value)) { - if (!token.repeat) throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + "`"); + if (!token.repeat) throw TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + "`"); if (0 === value.length) { if (token.optional) continue; - throw new TypeError('Expected "' + token.name + '" to not be empty'); + throw TypeError('Expected "' + token.name + '" to not be empty'); } for(var j = 0; j < value.length; j++){ - if (segment = encode(value[j]), !matches[i].test(segment)) throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + "`"); + if (segment = encode(value[j]), !matches[i].test(segment)) throw TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + "`"); path += (0 === j ? token.prefix : token.delimiter) + segment; } continue; } - if (segment = token.asterisk ? encodeAsterisk(value) : encode(value), !matches[i].test(segment)) throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"'); + if (segment = token.asterisk ? encodeAsterisk(value) : encode(value), !matches[i].test(segment)) throw TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"'); path += token.prefix + segment; } return path; @@ -10155,7 +10155,7 @@ } } var delimiter = escapeString(options.delimiter || "/"), endsWithDelimiter = route.slice(-delimiter.length) === delimiter; - return strict || (route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + "(?:" + delimiter + "(?=$))?"), end ? route += "$" : route += strict && endsWithDelimiter ? "" : "(?=" + delimiter + "|$)", attachKeys(new RegExp("^" + route, flags(options)), keys); + return strict || (route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + "(?:" + delimiter + "(?=$))?"), end ? route += "$" : route += strict && endsWithDelimiter ? "" : "(?=" + delimiter + "|$)", attachKeys(RegExp("^" + route, flags(options)), keys); } function pathToRegexp(path7, keys2, options2) { var path6, keys1, options1; @@ -10174,7 +10174,7 @@ return attachKeys(path, keys); }(path7, keys2) : isarray(path7) ? function(path, keys, options) { for(var parts = [], i = 0; i < path.length; i++)parts.push(pathToRegexp(path[i], keys, options).source); - var regexp = new RegExp("(?:" + parts.join("|") + ")", flags(options)); + var regexp = RegExp("(?:" + parts.join("|") + ")", flags(options)); return attachKeys(regexp, keys); }(path7, keys2, options2) : (path6 = path7, keys1 = keys2, tokensToRegExp(parse(path6, options1 = options2), keys1, options1)); } @@ -10182,10 +10182,10 @@ 97671: function(module) { var cachedSetTimeout, cachedClearTimeout, currentQueue, process = module.exports = {}; function defaultSetTimout() { - throw new Error("setTimeout has not been defined"); + throw Error("setTimeout has not been defined"); } function defaultClearTimeout() { - throw new Error("clearTimeout has not been defined"); + throw Error("clearTimeout has not been defined"); } function runTimeout(fun) { if (cachedSetTimeout === setTimeout) return setTimeout(fun, 0); @@ -10244,7 +10244,7 @@ } function noop() {} process.nextTick = function(fun) { - var args = new Array(arguments.length - 1); + var args = Array(arguments.length - 1); if (arguments.length > 1) for(var i = 1; i < arguments.length; i++)args[i - 1] = arguments[i]; queue.push(new Item(fun, args)), 1 !== queue.length || draining || runTimeout(drainQueue); }, Item.prototype.run = function() { @@ -10252,11 +10252,11 @@ }, process.title = "browser", process.browser = !0, process.env = {}, process.argv = [], process.version = "", process.versions = {}, process.on = noop, process.addListener = noop, process.once = noop, process.off = noop, process.removeListener = noop, process.removeAllListeners = noop, process.emit = noop, process.prependListener = noop, process.prependOnceListener = noop, process.listeners = function(name) { return []; }, process.binding = function(name) { - throw new Error("process.binding is not supported"); + throw Error("process.binding is not supported"); }, process.cwd = function() { return "/"; }, process.chdir = function(dir) { - throw new Error("process.chdir is not supported"); + throw Error("process.chdir is not supported"); }, process.umask = function() { return 0; }; @@ -10269,7 +10269,7 @@ emptyFunctionWithReset.resetWarningCache = emptyFunction, module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret !== ReactPropTypesSecret) { - var err = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); + var err = Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); throw err.name = "Invariant Violation", err; } } @@ -10313,7 +10313,7 @@ "use strict"; const strictUriEncode = __webpack_require__(76487), decodeComponent = __webpack_require__(74677), splitOnFirst = __webpack_require__(97044), filterObject = __webpack_require__(47560), isNullOrUndefined = (value)=>null == value; function validateArrayFormatSeparator(value) { - if ("string" != typeof value || 1 !== value.length) throw new TypeError("arrayFormatSeparator must be single character string"); + if ("string" != typeof value || 1 !== value.length) throw TypeError("arrayFormatSeparator must be single character string"); } function encode(value, options) { return options.encode ? options.strict ? strictUriEncode(value) : encodeURIComponent(value) : value; @@ -10605,7 +10605,7 @@ }; } function step(op) { - if (f) throw new TypeError("Generator is already executing."); + if (f) throw TypeError("Generator is already executing."); for(; _;)try { if (f = 1, y && (t = 2 & op[0] ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; switch(y = 0, t && (op = [ @@ -15902,7 +15902,7 @@ } var BrowserRouter = function(n) { function e7() { - for(var e, t = arguments.length, r = new Array(t), o = 0; o < t; o++)r[o] = arguments[o]; + for(var e, t = arguments.length, r = Array(t), o = 0; o < t; o++)r[o] = arguments[o]; return (e = n.call.apply(n, [ this ].concat(r)) || this).history = history.createBrowserHistory(e.props), e; @@ -15915,7 +15915,7 @@ }, e7; }(React.Component), HashRouter = function(n) { function e8() { - for(var e, t = arguments.length, r = new Array(t), o = 0; o < t; o++)r[o] = arguments[o]; + for(var e, t = arguments.length, r = Array(t), o = 0; o < t; o++)r[o] = arguments[o]; return (e = n.call.apply(n, [ this ].concat(r)) || this).history = history.createHashHistory(e.props), e; @@ -15997,7 +15997,7 @@ strict: b }) : null, i = !!(d ? d(a, t6) : a), c = "function" == typeof h ? h(i) : h, u = "function" == typeof P ? P(i) : P; i && (c = function() { - for(var e15 = arguments.length, t = new Array(e15), r = 0; r < e15; r++)t[r] = arguments[r]; + for(var e15 = arguments.length, t = Array(e15), r = 0; r < e15; r++)t[r] = arguments[r]; return t.filter(function(e) { return e; }).join(" "); @@ -16256,7 +16256,7 @@ }, Router; }(_react_17_0_2_react.Component), MemoryRouter1 = function(_React$Component) { function MemoryRouter() { - for(var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _this, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return (_this = _React$Component.call.apply(_React$Component, [ this ].concat(args)) || this).history = (0, esm_history.createMemoryHistory)(_this.props), _this; @@ -16399,7 +16399,7 @@ function noop() {} var StaticRouter1 = function(_React$Component) { function StaticRouter() { - for(var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _this, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return (_this = _React$Component.call.apply(_React$Component, [ this ].concat(args)) || this).handlePush = function(location) { @@ -16883,7 +16883,7 @@ function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function(method, arg) { - if (state === GenStateExecuting) throw new Error("Generator is already running"); + if (state === GenStateExecuting) throw Error("Generator is already running"); if (state === GenStateCompleted) { if ("throw" === method) throw arg; return doneResult(); @@ -16920,14 +16920,14 @@ if (method === undefined) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; - context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); + context.method = "throw", context.arg = TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { @@ -17029,7 +17029,7 @@ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else if (hasFinally) { if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else throw new Error("try statement without catch or finally"); + } else throw Error("try statement without catch or finally"); } } }, @@ -17067,7 +17067,7 @@ return thrown; } } - throw new Error("illegal catch attempt"); + throw Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { return this.delegate = { @@ -17312,7 +17312,7 @@ 97044: function(module) { "use strict"; module.exports = (string, separator)=>{ - if (!("string" == typeof string && "string" == typeof separator)) throw new TypeError("Expected the arguments to be of type `string`"); + if (!("string" == typeof string && "string" == typeof separator)) throw TypeError("Expected the arguments to be of type `string`"); if ("" === separator) return [ string ]; @@ -17332,7 +17332,7 @@ 87832: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__), __webpack_exports__.default = function(condition, message) { - if (!condition) throw new Error("Invariant failed"); + if (!condition) throw Error("Invariant failed"); }; }, 98009: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { @@ -17373,7 +17373,7 @@ }, __webpack_require__1.g = function() { if ("object" == typeof globalThis) return globalThis; try { - return this || new Function("return this")(); + return this || Function("return this")(); } catch (e) { if ("object" == typeof window) return window; } diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2558/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2558/1/output.js index 2ecb8391d66..141e10f1ebf 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2558/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2558/1/output.js @@ -114,7 +114,7 @@ if (isArray(search)) for(var i = 0; i < search.length; i++){ var item = search[i]; if (isArray(item) && 2 === item.length) appendTo(dict, item[0], item[1]); - else throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements"); + else throw TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements"); } else for(var key in search)search.hasOwnProperty(key) && appendTo(dict, key, search[key]); } else { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/4234/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/4234/output.js index 3fc08cfc735..822e92418e9 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/4234/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/4234/output.js @@ -1,4 +1,4 @@ -bar(new RegExp("")); -bar(new RegExp("", "u")); +bar(RegExp("")); +bar(RegExp("", "u")); bar(/a/); bar(/a/u); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/buble/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/buble/1/output.js index 55bcc69a002..2e18bc6d486 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/buble/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/buble/1/output.js @@ -1,3 +1,3 @@ export default function thrower() { - throw new Error(`Failed to recognize value \`${value}\` for property \`${property}\`.`); + throw Error(`Failed to recognize value \`${value}\` for property \`${property}\`.`); }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/1/output.js index 861b7231ca5..4efaa21083a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/1/output.js @@ -233,13 +233,13 @@ var pads = { }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; function pad(value, fill, width) { var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + return sign + (length < width ? Array(width - length + 1).join(fill) + string : string); } function requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + return RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { return new Map(names.map((name, i)=>[ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/3/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/3/output.js index de3584204a9..d838bdd9fbd 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/3/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/d3-time-format/3/output.js @@ -351,13 +351,13 @@ }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; function pad1(value, fill, width) { var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + return sign + (length < width ? Array(width - length + 1).join(fill) + string : string); } function requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + return RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { return new Map(names.map((name, i)=>[ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js index 3099a1cb9ca..35418d77b0d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js @@ -803,7 +803,7 @@ } return _arr; }(arr1, i1) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(); } exports.default = void 0; @@ -895,7 +895,7 @@ } return _arr; }(arr2, 2) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = observe(el, function(isVisible) { return isVisible && setVisible(isVisible); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js index d1563b13a16..10cb8878626 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js @@ -1762,13 +1762,13 @@ function _toConsumableArray(arr1) { return function(arr) { if (Array.isArray(arr)) { - for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2; } }(arr1) || function(iter) { if (Symbol.iterator in Object(iter) || "[object Arguments]" === Object.prototype.toString.call(iter)) return Array.from(iter); }(arr1) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw TypeError("Invalid attempt to spread non-iterable instance"); }(); } exports.default = function(_param) { @@ -1802,8 +1802,8 @@ var src1, staticSrc = ""; if ("object" == typeof (src1 = src2) && (isStaticRequire(src1) || void 0 !== src1.src)) { var staticImageData = isStaticRequire(src2) ? src2.default : src2; - if (!staticImageData.src) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(staticImageData))); - if (blurDataURL = blurDataURL || staticImageData.blurDataURL, staticSrc = staticImageData.src, (!layout || "fill" !== layout) && (height = height || staticImageData.height, width = width || staticImageData.width, !staticImageData.height || !staticImageData.width)) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(staticImageData))); + if (!staticImageData.src) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(staticImageData))); + if (blurDataURL = blurDataURL || staticImageData.blurDataURL, staticSrc = staticImageData.src, (!layout || "fill" !== layout) && (height = height || staticImageData.height, width = width || staticImageData.width, !staticImageData.height || !staticImageData.width)) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(staticImageData))); } src2 = "string" == typeof src2 ? src2 : staticSrc; var widthInt = getInt(width), heightInt = getInt(height), qualityInt = getInt(quality), isLazy = !priority && ("lazy" === loading || void 0 === loading); @@ -1828,7 +1828,7 @@ } return _arr; }(arr3, 2) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), setRef = ref2[0], isIntersected = ref2[1], isVisible = !isLazy || isIntersected, wrapperStyle = { boxSizing: "border-box", display: "block", @@ -2027,7 +2027,7 @@ "custom", function(param) { var src = param.src; - throw new Error('Image with src "'.concat(src, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); + throw Error('Image with src "'.concat(src, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); } ], ]); @@ -2123,7 +2123,7 @@ if (load) return load(_objectSpread({ root: configPath }, loaderProps)); - throw new Error('Unknown "loader" found in "next.config.js". Expected: '.concat(_imageConfig.VALID_LOADERS.join(", "), ". Received: ").concat(configLoader)); + throw Error('Unknown "loader" found in "next.config.js". Expected: '.concat(_imageConfig.VALID_LOADERS.join(", "), ". Received: ").concat(configLoader)); } function normalizeSrc(src) { return "/" === src[0] ? src.slice(1) : src; @@ -2156,7 +2156,7 @@ } return _arr; }(arr4, 2) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = observe(el, function(isVisible) { return isVisible && setVisible(isVisible); @@ -2421,14 +2421,14 @@ if (logType < instance.logLevel) return; const now = new Date().toISOString(), method = ConsoleMethod[logType]; if (method) console[method](`[${now}] ${instance.name}:`, ...args); - else throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`); + else throw Error(`Attempted to log a message with an invalid logType (value: ${logType})`); }, this._userLogHandler = null, [].push(this); } get logLevel() { return this._logLevel; } set logLevel(val) { - if (!(val in LogLevel)) throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``); + if (!(val in LogLevel)) throw TypeError(`Invalid value "${val}" assigned to \`logLevel\``); this._logLevel = val; } setLogLevel(val) { @@ -2438,7 +2438,7 @@ return this._logHandler; } set logHandler(val) { - if ("function" != typeof val) throw new TypeError("Value assigned to `logHandler` must be a function"); + if ("function" != typeof val) throw TypeError("Value assigned to `logHandler` must be a function"); this._logHandler = val; } get userLogHandler() { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js index 37f1598683f..e9e94e671cb 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js @@ -64,7 +64,7 @@ } function L(t = "Unexpected state") { const e = `FIRESTORE (${C}) INTERNAL ASSERTION FAILED: ` + t; - throw O(e), new Error(e); + throw O(e), Error(e); } const K = { OK: "ok", @@ -463,7 +463,7 @@ } } _t.EMPTY_BYTE_STRING = new _t(""); - const mt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/); + const mt = RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/); function gt(t) { if (t || L(), "string" == typeof t) { let e = 0; @@ -5831,7 +5831,7 @@ throw "an object" === s ? e.Uc(t + " a custom object") : e.Uc(t + " " + s); } } - const Au = new RegExp("[~\\*/\\[\\]]"); + const Au = RegExp("[~\\*/\\[\\]]"); function bu(t, e, n, s, i) { const r = s && !s.isEmpty(), o = void 0 !== i; let c = `Function ${e}() called with invalid data`; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js index 3fb61edaa60..292322978f8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js @@ -107,7 +107,7 @@ } else arg = arguments[i]; args.push(arg); } - warn(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack), firstTime = !1; + warn(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + Error().stack), firstTime = !1; } return fn.apply(this, arguments); }, fn); @@ -215,7 +215,7 @@ }; } function getParseRegexForToken(token, config) { - return hasOwnProp(regexes, token) ? regexes[token](config._strict, config._locale) : new RegExp(unescapeFormat(token)); + return hasOwnProp(regexes, token) ? regexes[token](config._strict, config._locale) : RegExp(unescapeFormat(token)); } function unescapeFormat(s) { return regexEscape(s.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) { @@ -309,7 +309,7 @@ ]), shortPieces.push(this.monthsShort(mom, "")), longPieces.push(this.months(mom, "")), mixedPieces.push(this.months(mom, "")), mixedPieces.push(this.monthsShort(mom, "")); for(shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), i = 0; i < 12; i++)shortPieces[i] = regexEscape(shortPieces[i]), longPieces[i] = regexEscape(longPieces[i]); for(i = 0; i < 24; i++)mixedPieces[i] = regexEscape(mixedPieces[i]); - this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"), this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i"); + this._monthsRegex = RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = RegExp("^(" + longPieces.join("|") + ")", "i"), this._monthsShortStrictRegex = RegExp("^(" + shortPieces.join("|") + ")", "i"); } function daysInYear(year) { return isLeapYear(year) ? 366 : 365; @@ -435,7 +435,7 @@ 2000, 1 ]).day(i), minp = regexEscape(this.weekdaysMin(mom, "")), shortp = regexEscape(this.weekdaysShort(mom, "")), longp = regexEscape(this.weekdays(mom, "")), minPieces.push(minp), shortPieces.push(shortp), longPieces.push(longp), mixedPieces.push(minp), mixedPieces.push(shortp), mixedPieces.push(longp); - minPieces.sort(cmpLenRev), shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"), this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i"), this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i"); + minPieces.sort(cmpLenRev), shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), this._weekdaysRegex = RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = RegExp("^(" + longPieces.join("|") + ")", "i"), this._weekdaysShortStrictRegex = RegExp("^(" + shortPieces.join("|") + ")", "i"), this._weekdaysMinStrictRegex = RegExp("^(" + minPieces.join("|") + ")", "i"); } function hFormat() { return this.hours() % 12 || 12; @@ -1026,7 +1026,7 @@ function computeErasParse() { var i, l, abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], eras = this.eras(); for(i = 0, l = eras.length; i < l; ++i)namePieces.push(regexEscape(eras[i].name)), abbrPieces.push(regexEscape(eras[i].abbr)), narrowPieces.push(regexEscape(eras[i].narrow)), mixedPieces.push(regexEscape(eras[i].name)), mixedPieces.push(regexEscape(eras[i].abbr)), mixedPieces.push(regexEscape(eras[i].narrow)); - this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i"), this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i"), this._erasNarrowRegex = new RegExp("^(" + narrowPieces.join("|") + ")", "i"); + this._erasRegex = RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._erasNameRegex = RegExp("^(" + namePieces.join("|") + ")", "i"), this._erasAbbrRegex = RegExp("^(" + abbrPieces.join("|") + ")", "i"), this._erasNarrowRegex = RegExp("^(" + narrowPieces.join("|") + ")", "i"); } function addWeekYearFormatToken(token, getter) { addFormatToken(0, [ @@ -1584,7 +1584,7 @@ }, proto$1.set = function(config) { var prop, i; for(i in config)hasOwnProp(config, i) && (isFunction(prop = config[i]) ? this[i] = prop : this["_" + i] = prop); - this._config = config, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source); + this._config = config, this._dayOfMonthOrdinalParseLenient = RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source); }, proto$1.eras = function(m, format) { var i, l, date, eras = this._eras || getLocale("en")._eras; for(i = 0, l = eras.length; i < l; ++i)switch("string" == typeof eras[i].since && (date = hooks(eras[i].since).startOf("day"), eras[i].since = date.valueOf()), typeof eras[i].until){ @@ -1633,7 +1633,7 @@ for(this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), i = 0; i < 12; i++)if (mom = createUTC([ 2000, i - ]), strict && !this._longMonthsParse[i] && (this._longMonthsParse[i] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i"), this._shortMonthsParse[i] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i")), strict || this._monthsParse[i] || (regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, ""), this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i")), strict && "MMMM" === format && this._longMonthsParse[i].test(monthName) || strict && "MMM" === format && this._shortMonthsParse[i].test(monthName) || !strict && this._monthsParse[i].test(monthName)) return i; + ]), strict && !this._longMonthsParse[i] && (this._longMonthsParse[i] = RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i"), this._shortMonthsParse[i] = RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i")), strict || this._monthsParse[i] || (regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, ""), this._monthsParse[i] = RegExp(regex.replace(".", ""), "i")), strict && "MMMM" === format && this._longMonthsParse[i].test(monthName) || strict && "MMM" === format && this._shortMonthsParse[i].test(monthName) || !strict && this._monthsParse[i].test(monthName)) return i; }, proto$1.monthsRegex = function(isStrict) { return this._monthsParseExact ? (hasOwnProp(this, "_monthsRegex") || computeMonthsParse.call(this), isStrict) ? this._monthsStrictRegex : this._monthsRegex : (hasOwnProp(this, "_monthsRegex") || (this._monthsRegex = defaultMonthsRegex), this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex); }, proto$1.monthsShortRegex = function(isStrict) { @@ -1657,7 +1657,7 @@ for(this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), i = 0; i < 7; i++)if (mom = createUTC([ 2000, 1 - ]).day(i), strict && !this._fullWeekdaysParse[i] && (this._fullWeekdaysParse[i] = new RegExp("^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i"), this._shortWeekdaysParse[i] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i"), this._minWeekdaysParse[i] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i")), this._weekdaysParse[i] || (regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, ""), this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i")), strict && "dddd" === format && this._fullWeekdaysParse[i].test(weekdayName) || strict && "ddd" === format && this._shortWeekdaysParse[i].test(weekdayName) || strict && "dd" === format && this._minWeekdaysParse[i].test(weekdayName) || !strict && this._weekdaysParse[i].test(weekdayName)) return i; + ]).day(i), strict && !this._fullWeekdaysParse[i] && (this._fullWeekdaysParse[i] = RegExp("^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i"), this._shortWeekdaysParse[i] = RegExp("^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i"), this._minWeekdaysParse[i] = RegExp("^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i")), this._weekdaysParse[i] || (regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, ""), this._weekdaysParse[i] = RegExp(regex.replace(".", ""), "i")), strict && "dddd" === format && this._fullWeekdaysParse[i].test(weekdayName) || strict && "ddd" === format && this._shortWeekdaysParse[i].test(weekdayName) || strict && "dd" === format && this._minWeekdaysParse[i].test(weekdayName) || !strict && this._weekdaysParse[i].test(weekdayName)) return i; }, proto$1.weekdaysRegex = function(isStrict) { return this._weekdaysParseExact ? (hasOwnProp(this, "_weekdaysRegex") || computeWeekdaysParse.call(this), isStrict) ? this._weekdaysStrictRegex : this._weekdaysRegex : (hasOwnProp(this, "_weekdaysRegex") || (this._weekdaysRegex = defaultWeekdaysRegex), this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex); }, proto$1.weekdaysShortRegex = function(isStrict) { @@ -1774,7 +1774,7 @@ case "millisecond": return Math.floor(864e5 * days) + milliseconds; default: - throw new Error("Unknown unit " + units); + throw Error("Unknown unit " + units); } }, proto$2.asMilliseconds = asMilliseconds, proto$2.asSeconds = asSeconds, proto$2.asMinutes = asMinutes, proto$2.asHours = asHours, proto$2.asDays = asDays, proto$2.asWeeks = asWeeks, proto$2.asMonths = asMonths, proto$2.asQuarters = asQuarters, proto$2.asYears = asYears, proto$2.valueOf = function() { return this.isValid() ? this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * toInt(this._months / 12) : NaN; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js index b4012ead44f..b825025b817 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js @@ -56,7 +56,7 @@ }, function(module, exports) { module.exports = function(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; }, module.exports.default = module.exports, module.exports.__esModule = !0; }, @@ -70,7 +70,7 @@ }, function(module, exports) { module.exports = function(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); }, module.exports.default = module.exports, module.exports.__esModule = !0; }, function(module, exports) { @@ -88,14 +88,14 @@ var _typeof = __webpack_require__(19).default, assertThisInitialized = __webpack_require__(1); module.exports = function(self, call) { if (call && ("object" === _typeof(call) || "function" == typeof call)) return call; - if (void 0 !== call) throw new TypeError("Derived constructors may only return object or undefined"); + if (void 0 !== call) throw TypeError("Derived constructors may only return object or undefined"); return assertThisInitialized(self); }, module.exports.default = module.exports, module.exports.__esModule = !0; }, function(module, exports, __webpack_require__) { var setPrototypeOf = __webpack_require__(41); module.exports = function(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, @@ -457,7 +457,7 @@ clone: gl_vec2__WEBPACK_IMPORTED_MODULE_4__.clone }; function assertNumberPositive(val) { - if (val < 0) throw new Error("expected positive number, received ".concat(val)); + if (val < 0) throw Error("expected positive number, received ".concat(val)); } var ImageWrapper1 = function() { function ImageWrapper(size, data) { @@ -551,7 +551,7 @@ key: "show", value: function(canvas) { var scale = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1.0, ctx = canvas.getContext("2d"); - if (!ctx) throw new Error("Unable to get canvas context"); + if (!ctx) throw Error("Unable to get canvas context"); var frame = ctx.getImageData(0, 0, canvas.width, canvas.height), data = this.getAsRGBA(scale); canvas.width = this.size.x, canvas.height = this.size.y; var newFrame = new ImageData(data, frame.width, frame.height); @@ -578,7 +578,7 @@ 0, 0 ], result = [], ctx = canvas.getContext("2d"); - if (!ctx) throw new Error("Unable to get canvas context"); + if (!ctx) throw Error("Unable to get canvas context"); for(var frame = ctx.getImageData(from.x, from.y, this.size.x, this.size.y), data = frame.data, length = this.data.length; length--;){ hsv[0] = this.data[length] * adjustedScale, result = hsv[0] <= 0 ? whiteRgb : hsv[0] >= 360 ? blackRgb : Object(_cv_utils__WEBPACK_IMPORTED_MODULE_5__.g)(hsv, rgb); var pos = 4 * length, _result = result, _result2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_result, 3); @@ -992,7 +992,7 @@ y: Math.floor(height * thisHalfSample) }; if (patchSize = Object(_common_cv_utils__WEBPACK_IMPORTED_MODULE_3__.a)(config.patchSize, size), console.log("Patch-Size: ".concat(JSON.stringify(patchSize))), inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / thisHalfSample) * patchSize.x)), inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / thisHalfSample) * patchSize.y)), inputStream.getWidth() % patchSize.x == 0 && inputStream.getHeight() % patchSize.y == 0) return !0; - throw new Error("Image dimensions do not comply with the current settings: Width (".concat(width, " )and height (").concat(height, ") must a multiple of ").concat(patchSize.x)); + throw Error("Image dimensions do not comply with the current settings: Width (".concat(width, " )and height (").concat(height, ") must a multiple of ").concat(patchSize.x)); } }; }).call(this, __webpack_require__(46)); @@ -1170,7 +1170,7 @@ return this; }(); try { - g = g || new Function("return this")(); + g = g || Function("return this")(); } catch (e) { "object" == typeof window && (g = window); } @@ -1276,7 +1276,7 @@ function(module, exports) { module.exports = function(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; }, module.exports.default = module.exports, module.exports.__esModule = !0; }, @@ -1460,7 +1460,7 @@ var _cache = "function" == typeof Map ? new Map() : void 0; return module.exports = _wrapNativeSuper = function(Class) { if (null === Class || !isNativeFunction(Class)) return Class; - if ("function" != typeof Class) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof Class) throw TypeError("Super expression must either be null or a function"); if (void 0 !== _cache) { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); @@ -2213,7 +2213,7 @@ return al * bl + ((a >>> 16 & 0xffff) * bl + al * (b >>> 16 & 0xffff) << 16 >>> 0) | 0; }), "function" != typeof Object.assign && (Object.assign = function(target) { "use strict"; - if (null === target) throw new TypeError("Cannot convert undefined or null to object"); + if (null === target) throw TypeError("Cannot convert undefined or null to object"); for(var to = Object(target), index = 1; index < arguments.length; index++){ var nextSource = arguments[index]; if (null !== nextSource) for(var nextKey in nextSource)Object.prototype.hasOwnProperty.call(nextSource, nextKey) && (to[nextKey] = nextSource[nextKey]); @@ -2248,7 +2248,7 @@ }, function(module, exports) { module.exports = function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }, module.exports.default = module.exports, module.exports.__esModule = !0; }, function(module, exports) { @@ -2617,7 +2617,7 @@ }, function(module, exports) { module.exports = function() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }, module.exports.default = module.exports, module.exports.__esModule = !0; }, function(module, exports, __webpack_require__) { @@ -2701,7 +2701,7 @@ function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function(method, arg) { - if (state === GenStateExecuting) throw new Error("Generator is already running"); + if (state === GenStateExecuting) throw Error("Generator is already running"); if (state === GenStateCompleted) { if ("throw" === method) throw arg; return doneResult(); @@ -2738,14 +2738,14 @@ if (method === undefined) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; - context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); + context.method = "throw", context.arg = TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { @@ -2847,7 +2847,7 @@ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else if (hasFinally) { if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else throw new Error("try statement without catch or finally"); + } else throw Error("try statement without catch or finally"); } } }, @@ -2885,7 +2885,7 @@ return thrown; } } - throw new Error("illegal catch attempt"); + throw Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { return this.delegate = { @@ -2957,7 +2957,7 @@ function(module, exports, __webpack_require__) { var MapCache = __webpack_require__(47); function memoize(func, resolver) { - if ("function" != typeof func || null != resolver && "function" != typeof resolver) throw new TypeError("Expected a function"); + if ("function" != typeof func || null != resolver && "function" != typeof resolver) throw TypeError("Expected a function"); var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) return cache.get(key); @@ -3383,7 +3383,7 @@ function Code128Reader() { var _this; classCallCheck_default()(this, Code128Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_SHIFT", 98), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_C", 99), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_B", 100), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_A", 101), defineProperty_default()(assertThisInitialized_default()(_this), "START_CODE_A", 103), defineProperty_default()(assertThisInitialized_default()(_this), "START_CODE_B", 104), defineProperty_default()(assertThisInitialized_default()(_this), "START_CODE_C", 105), defineProperty_default()(assertThisInitialized_default()(_this), "STOP_CODE", 106), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_PATTERN", [ @@ -4640,7 +4640,7 @@ { key: "_findPattern", value: function(pattern, offset, isWhite, tryHarder) { - var counter = new Array(pattern.length).fill(0), bestMatch = { + var counter = Array(pattern.length).fill(0), bestMatch = { error: Number.MAX_VALUE, start: 0, end: 0 @@ -4778,7 +4778,7 @@ { key: "decode", value: function(row, start) { - var result = new Array(), decodedCodes = new Array(), resultInfo = {}, startInfo = this._findStart(); + var result = Array(), decodedCodes = Array(), resultInfo = {}, startInfo = this._findStart(); if (!startInfo) return null; var code = { start: startInfo.start, @@ -4878,7 +4878,7 @@ function Code39Reader() { var _this; classCallCheck_default()(this, Code39Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "code_39"), _this; @@ -5008,7 +5008,7 @@ function Code39VINReader() { var _this; classCallCheck_default()(this, Code39VINReader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "code_39_vin"), _this; @@ -5098,7 +5098,7 @@ function NewCodabarReader() { var _this; classCallCheck_default()(this, NewCodabarReader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "_counters", []), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "codabar"), _this; @@ -5286,7 +5286,7 @@ function UPCReader() { var _this; classCallCheck_default()(this, UPCReader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "upc_a"), _this; @@ -5321,7 +5321,7 @@ function EAN8Reader() { var _this; classCallCheck_default()(this, EAN8Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "ean_8"), _this; @@ -5365,7 +5365,7 @@ function EAN2Reader() { var _this; classCallCheck_default()(this, EAN2Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "ean_2"), _this; @@ -5426,7 +5426,7 @@ function EAN5Reader() { var _this; classCallCheck_default()(this, EAN5Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "ean_5"), _this; @@ -5494,7 +5494,7 @@ function UPCEReader() { var _this; classCallCheck_default()(this, UPCEReader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "CODE_FREQUENCY", [ @@ -5744,7 +5744,7 @@ { key: "_findPattern", value: function(pattern, offset) { - var isWhite = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], tryHarder = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], counter = new Array(pattern.length).fill(0), counterPos = 0, bestMatch = { + var isWhite = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], tryHarder = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], counter = Array(pattern.length).fill(0), counterPos = 0, bestMatch = { error: Number.MAX_VALUE, start: 0, end: 0 @@ -5854,7 +5854,7 @@ { key: "decode", value: function(row, start) { - var result = new Array(), decodedCodes = new Array(), startInfo = this._findStart(); + var result = Array(), decodedCodes = Array(), startInfo = this._findStart(); if (!startInfo) return null; decodedCodes.push(startInfo); var endInfo = this._findEnd(); @@ -5978,7 +5978,7 @@ function TwoOfFiveReader() { var _this; classCallCheck_default()(this, TwoOfFiveReader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "barSpaceRatio", [ @@ -6174,7 +6174,7 @@ function Code93Reader() { var _this; classCallCheck_default()(this, Code93Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "code_93"), _this; @@ -6347,7 +6347,7 @@ function Code32Reader() { var _this; classCallCheck_default()(this, Code32Reader); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), defineProperty_default()(assertThisInitialized_default()(_this), "FORMAT", "code_32_reader"), _this; @@ -6536,7 +6536,7 @@ }(inputImageWrapper); }, registerReader: function(name, reader) { - if (READERS[name]) throw new Error("cannot register existing reader", name); + if (READERS[name]) throw Error("cannot register existing reader", name); READERS[name] = reader; }, setReaders: function(readers) { @@ -6562,7 +6562,7 @@ callback: callback, async: async }; - else if (!(subscription = callback).callback) throw new Error("Callback was not specified on options"); + else if (!(subscription = callback).callback) throw Error("Callback was not specified on options"); getEvent(event).subscribers.push(subscription); } return { @@ -6871,7 +6871,7 @@ }; } ImageLoader.load = function(directory, callback, offset1, size, sequence) { - var i, img, num, htmlImagesSrcArray = new Array(size), htmlImagesArray = new Array(htmlImagesSrcArray.length); + var i, img, num, htmlImagesSrcArray = Array(size), htmlImagesArray = Array(htmlImagesSrcArray.length); if (!1 === sequence) htmlImagesSrcArray[0] = directory; else for(i = 0; i < htmlImagesSrcArray.length; i++)num = offset1 + i, htmlImagesSrcArray[i] = "".concat(directory, "image-").concat("00".concat(num).slice(-3), ".jpg"); for(i = 0, htmlImagesArray.notLoaded = [], htmlImagesArray.addImage = function(image) { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/output.js index c6a4bedc0dd..0b3030fbbc9 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/output.js @@ -61,7 +61,7 @@ function _defineProperties(target, props) { } } function _assertThisInitialized(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _getPrototypeOf(o1) { @@ -84,7 +84,7 @@ function _defineProperty(obj, key, value) { } var ItemsList = function(_Component) { !function(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, @@ -112,9 +112,9 @@ var ItemsList = function(_Component) { function ItemsList1() { var _this; !function(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); }(this, ItemsList1); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), _defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function(highlightedItem) { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-autowhatever/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-autowhatever/1/output.js index d7fa1a5274c..9962a329a29 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-autowhatever/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-autowhatever/1/output.js @@ -44,16 +44,16 @@ var ItemsList = function(Component1) { function ItemsList1() { var _this, self1, call, obj; return !function(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); }(this, ItemsList1), _this = (self1 = this, call = _getPrototypeOf(ItemsList1).apply(this, arguments), call && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : function(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; }(self1)), _this.storeHighlightedItemReference = function(highlightedItem) { _this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item); }, _this; } return !function(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js index 65efbb69516..a83f95897be 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js @@ -85,13 +85,13 @@ function _toConsumableArray(arr1) { return function(arr) { if (Array.isArray(arr)) { - for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(arr.length); i < arr.length; i++)arr2[i] = arr[i]; return arr2; } }(arr1) || function(iter) { if (Symbol.iterator in Object(iter) || "[object Arguments]" === Object.prototype.toString.call(iter)) return Array.from(iter); }(arr1) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw TypeError("Invalid attempt to spread non-iterable instance"); }(); } exports.default = function(_param) { @@ -125,8 +125,8 @@ var src1, staticSrc = ""; if ("object" == typeof (src1 = src2) && (isStaticRequire(src1) || void 0 !== src1.src)) { var staticImageData = isStaticRequire(src2) ? src2.default : src2; - if (!staticImageData.src) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(staticImageData))); - if (blurDataURL = blurDataURL || staticImageData.blurDataURL, staticSrc = staticImageData.src, (!layout || "fill" !== layout) && (height = height || staticImageData.height, width = width || staticImageData.width, !staticImageData.height || !staticImageData.width)) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(staticImageData))); + if (!staticImageData.src) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(staticImageData))); + if (blurDataURL = blurDataURL || staticImageData.blurDataURL, staticSrc = staticImageData.src, (!layout || "fill" !== layout) && (height = height || staticImageData.height, width = width || staticImageData.width, !staticImageData.height || !staticImageData.width)) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(staticImageData))); } src2 = "string" == typeof src2 ? src2 : staticSrc; var widthInt = getInt(width), heightInt = getInt(height), qualityInt = getInt(quality), isLazy = !priority && ("lazy" === loading || void 0 === loading); @@ -151,7 +151,7 @@ } return _arr; }(arr3, 2) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), setRef = ref2[0], isIntersected = ref2[1], isVisible = !isLazy || isIntersected, wrapperStyle = { boxSizing: "border-box", display: "block", @@ -350,7 +350,7 @@ "custom", function(param) { var src = param.src; - throw new Error('Image with src "'.concat(src, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); + throw Error('Image with src "'.concat(src, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); } ], ]); @@ -446,7 +446,7 @@ if (load) return load(_objectSpread({ root: configPath }, loaderProps)); - throw new Error('Unknown "loader" found in "next.config.js". Expected: '.concat(_imageConfig.VALID_LOADERS.join(", "), ". Received: ").concat(configLoader)); + throw Error('Unknown "loader" found in "next.config.js". Expected: '.concat(_imageConfig.VALID_LOADERS.join(", "), ". Received: ").concat(configLoader)); } function normalizeSrc(src) { return "/" === src[0] ? src.slice(1) : src; @@ -479,7 +479,7 @@ } return _arr; }(arr4, 2) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = observe(el, function(isVisible) { return isVisible && setVisible(isVisible); @@ -649,7 +649,7 @@ return useIsomorphicLayoutEffect(function() { ref.current = fn; }), React.useCallback(function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return ref.current.apply(void 0, args); }, []); } diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js index 9041ec7dea6..b13c913d7af 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js @@ -196,12 +196,12 @@ export default function createInstantSearchManager(param1) { client._cacheHydrated = !0; var baseMethod = client.search; client.search = function(requests) { - for(var _len1 = arguments.length, methodArgs = new Array(_len1 > 1 ? _len1 - 1 : 0), _key1 = 1; _key1 < _len1; _key1++)methodArgs[_key1 - 1] = arguments[_key1]; + for(var _len1 = arguments.length, methodArgs = Array(_len1 > 1 ? _len1 - 1 : 0), _key1 = 1; _key1 < _len1; _key1++)methodArgs[_key1 - 1] = arguments[_key1]; var requestsWithSerializedParams = requests.map(function(request) { var parameters, encode; return swcHelpers.objectSpread({}, request, { params: (parameters = request.params, encode = function(format) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; var i = 0; return format.replace(/%s/g, function() { return encodeURIComponent(args[i++]); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/regexp/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/regexp/1/output.js index e5898735021..e934424b33a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/regexp/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/regexp/1/output.js @@ -1,3 +1,3 @@ export default function() { - return new RegExp("{.[^}]+}\n*", "g"); + return RegExp("{.[^}]+}\n*", "g"); }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/001/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/001/output.js index ba496751d4b..e530ff129a8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/001/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/001/output.js @@ -1 +1 @@ -new RegExp("^/(?!_next).*$"); +RegExp("^/(?!_next).*$"); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/005/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/005/output.js index 5a9b79951d4..8a0cdfe153a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/005/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/005/output.js @@ -1,7 +1,7 @@ export default function(value, options) { try { if ("string" == typeof value && value.length > 0) return function(str) { - if ((str = String(str)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters."); + if ((str = String(str)).length > 100) throw Error("Value exceeds the maximum length of 100 characters."); const match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); if (!match) return NaN; const n = parseFloat(match[1]), type = (match[2] || "ms").toLowerCase(); @@ -45,14 +45,14 @@ export default function(value, options) { case "ms": return n; default: - throw new Error(`The unit ${type} was matched, but no matching case exists.`); + throw Error(`The unit ${type} was matched, but no matching case exists.`); } }(value); if ("number" == typeof value && isFinite(value)) return options?.long ? fmtLong(value) : fmtShort(value); - throw new Error("Value is not a string or number."); + throw Error("Value is not a string or number."); } catch (error) { const message = isError(error) ? `${error.message}. value=${JSON.stringify(value)}` : "An unknown error has occured."; - throw new Error(message); + throw Error(message); } }; function fmtShort(ms) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js b/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js index 378f7dac881..d3a9874fd7b 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js @@ -471,7 +471,7 @@ return 0 == child.size || child.emptyChildAt(side); }, ViewDesc1.prototype.domAfterPos = function(pos) { var ref = this.domFromPos(pos, 0), node = ref.node, offset = ref.offset; - if (1 != node.nodeType || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos); + if (1 != node.nodeType || offset == node.childNodes.length) throw RangeError("No node after pos " + pos); return node.childNodes[offset]; }, ViewDesc1.prototype.setSelection = function(anchor, head, root, force) { for(var from = Math.min(anchor, head), to = Math.max(anchor, head), i = 0, offset = 0; i < this.children.length; i++){ @@ -654,7 +654,7 @@ }, outerDeco, innerDeco), dom = spec && spec.dom, contentDOM = spec && spec.contentDOM; if (node.isText) { if (dom) { - if (3 != dom.nodeType) throw new RangeError("Text must be rendered as a DOM text node"); + if (3 != dom.nodeType) throw RangeError("Text must be rendered as a DOM text node"); } else dom = document.createTextNode(node.text); } else dom || (dom = (assign = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMSerializer.renderSpec(document, node.type.spec.toDOM(node))).dom, contentDOM = assign.contentDOM); contentDOM || node.isText || "BR" == dom.nodeName || (dom.hasAttribute("contenteditable") || (dom.contentEditable = !1), node.type.spec.draggable && (dom.draggable = !0)); @@ -2514,7 +2514,7 @@ }), result; } function checkStateComponent(plugin) { - if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw new RangeError("Plugins passed directly to the view must not have a state component"); + if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw RangeError("Plugins passed directly to the view must not have a state component"); } prototypeAccessors$21.props.get = function() { if (this._props.state != this.state) { @@ -2696,7 +2696,7 @@ }, EditorView.prototype.posAtDOM = function(node, offset, bias) { void 0 === bias && (bias = -1); var pos = this.docView.posFromDOM(node, offset, bias); - if (null == pos) throw new RangeError("DOM position not inside the editor"); + if (null == pos) throw RangeError("DOM position not inside the editor"); return pos; }, EditorView.prototype.endOfTextblock = function(dir3, state3) { var view12, state1, dir1, view11, state2, dir2, sel3, $pos; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index 8b562416ded..3f005794cf1 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -60,11 +60,11 @@ var history = []; function createLogger$1(name) { var logByType, name1, log, level1 = "info", log1 = function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; logByType("log", level1, args); }; return logByType = (name1 = name, log = log1, function(type, level, args) { - var lvl = log.levels[level], lvlRegExp = new RegExp("^(" + lvl + ")$"); + var lvl = log.levels[level], lvlRegExp = RegExp("^(" + lvl + ")$"); if ("log" !== type && args.unshift(type.toUpperCase() + ":"), args.unshift(name1 + ":"), history) { history.push([].concat(args)); var splice = history.length - 1000; @@ -86,7 +86,7 @@ DEFAULT: level1 }, log1.level = function(lvl) { if ("string" == typeof lvl) { - if (!log1.levels.hasOwnProperty(lvl)) throw new Error('"' + lvl + '" in not a valid log level'); + if (!log1.levels.hasOwnProperty(lvl)) throw Error('"' + lvl + '" in not a valid log level'); level1 = lvl; } return level1; @@ -94,7 +94,7 @@ return history ? [].concat(history) : []; }, log1.history.filter = function(fname) { return (history || []).filter(function(historyItem) { - return new RegExp(".*" + fname + ".*").test(historyItem[0]); + return RegExp(".*" + fname + ".*").test(historyItem[0]); }); }, log1.history.clear = function() { history && (history.length = 0); @@ -103,13 +103,13 @@ }, log1.history.enable = function() { null === history && (history = []); }, log1.error = function() { - for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + for(var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; return logByType("error", level1, args); }, log1.warn = function() { - for(var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++)args[_key3] = arguments[_key3]; + for(var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++)args[_key3] = arguments[_key3]; return logByType("warn", level1, args); }, log1.debug = function() { - for(var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)args[_key4] = arguments[_key4]; + for(var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++)args[_key4] = arguments[_key4]; return logByType("debug", level1, args); }, log1; } @@ -122,7 +122,7 @@ }); } function assign(target) { - for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)sources[_key - 1] = arguments[_key]; + for(var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)sources[_key - 1] = arguments[_key]; return Object.assign ? _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_15__.Z.apply(void 0, [ target ].concat(sources)) : (sources.forEach(function(source) { @@ -179,7 +179,7 @@ return "string" == typeof str && Boolean(str.trim()); } function throwIfWhitespace(str) { - if (str.indexOf(" ") >= 0) throw new Error("class has illegal whitespace characters"); + if (str.indexOf(" ") >= 0) throw Error("class has illegal whitespace characters"); } function isReal() { return global_document__WEBPACK_IMPORTED_MODULE_1___default() === global_window__WEBPACK_IMPORTED_MODULE_0___default().document; @@ -219,8 +219,7 @@ parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child); } function hasClass(element, classToCheck) { - var className; - return (throwIfWhitespace(classToCheck), element.classList) ? element.classList.contains(classToCheck) : (className = classToCheck, new RegExp("(^|\\s)" + className + "($|\\s)")).test(element.className); + return (throwIfWhitespace(classToCheck), element.classList) ? element.classList.contains(classToCheck) : RegExp("(^|\\s)" + classToCheck + "($|\\s)").test(element.className); } function addClass(element, classToAdd) { return element.classList ? element.classList.add(classToAdd) : hasClass(element, classToAdd) || (element.className = (element.className + " " + classToAdd).trim()), element; @@ -623,11 +622,11 @@ }, isValidEventType = function(type) { return "string" == typeof type && /\S/.test(type) || Array.isArray(type) && !!type.length; }, validateTarget = function(target, obj, fnName) { - if (!target || !target.nodeName && !isEvented(target)) throw new Error("Invalid target for " + objName(obj) + "#" + fnName + "; must be a DOM node or evented object."); + if (!target || !target.nodeName && !isEvented(target)) throw Error("Invalid target for " + objName(obj) + "#" + fnName + "; must be a DOM node or evented object."); }, validateEventType = function(type, obj, fnName) { - if (!isValidEventType(type)) throw new Error("Invalid event type for " + objName(obj) + "#" + fnName + "; must be a non-empty string or array."); + if (!isValidEventType(type)) throw Error("Invalid event type for " + objName(obj) + "#" + fnName + "; must be a non-empty string or array."); }, validateListener = function(listener, obj, fnName) { - if ("function" != typeof listener) throw new Error("Invalid listener for " + objName(obj) + "#" + fnName + "; must be a function."); + if ("function" != typeof listener) throw Error("Invalid listener for " + objName(obj) + "#" + fnName + "; must be a function."); }, normalizeListenArgs = function(self, args, fnName) { var target, type, listener, isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_; return isTargetingSelf ? (target = self.eventBusEl_, args.length >= 3 && args.shift(), type = args[0], listener = args[1]) : (target = args[0], type = args[1], listener = args[2]), validateTarget(target, self, fnName), validateEventType(type, self, fnName), validateListener(listener, self, fnName), listener = bind(self, listener), { @@ -640,7 +639,7 @@ validateTarget(target, target, method), target.nodeName ? Events[method](target, type, listener) : target[method](type, listener); }, EventedMixin = { on: function() { - for(var _this = this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _this = this, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; var _normalizeListenArgs = normalizeListenArgs(this, args, "on"), isTargetingSelf = _normalizeListenArgs.isTargetingSelf, target = _normalizeListenArgs.target, type = _normalizeListenArgs.type, listener = _normalizeListenArgs.listener; if (listen(target, "on", type, listener), !isTargetingSelf) { var removeListenerOnDispose = function() { @@ -654,26 +653,26 @@ } }, one: function() { - for(var _this2 = this, _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + for(var _this2 = this, _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; var _normalizeListenArgs2 = normalizeListenArgs(this, args, "one"), isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, target = _normalizeListenArgs2.target, type = _normalizeListenArgs2.type, listener = _normalizeListenArgs2.listener; if (isTargetingSelf) listen(target, "one", type, listener); else { var wrapper1 = function wrapper() { _this2.off(target, type, wrapper); - for(var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++)largs[_key3] = arguments[_key3]; + for(var _len3 = arguments.length, largs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++)largs[_key3] = arguments[_key3]; listener.apply(null, largs); }; wrapper1.guid = listener.guid, listen(target, "one", type, wrapper1); } }, any: function() { - for(var _this3 = this, _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)args[_key4] = arguments[_key4]; + for(var _this3 = this, _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++)args[_key4] = arguments[_key4]; var _normalizeListenArgs3 = normalizeListenArgs(this, args, "any"), isTargetingSelf = _normalizeListenArgs3.isTargetingSelf, target = _normalizeListenArgs3.target, type = _normalizeListenArgs3.type, listener = _normalizeListenArgs3.listener; if (isTargetingSelf) listen(target, "any", type, listener); else { var wrapper3 = function wrapper() { _this3.off(target, type, wrapper); - for(var _len5 = arguments.length, largs = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++)largs[_key5] = arguments[_key5]; + for(var _len5 = arguments.length, largs = Array(_len5), _key5 = 0; _key5 < _len5; _key5++)largs[_key5] = arguments[_key5]; listener.apply(null, largs); }; wrapper3.guid = listener.guid, listen(target, "any", type, wrapper3); @@ -690,7 +689,7 @@ if (validateTarget(this.eventBusEl_, this, "trigger"), !isValidEventType(event && "string" != typeof event ? event.type : event)) { var error = "Invalid event type for " + objName(this) + "#trigger; must be a non-empty string or object with a type key that has a non-empty value."; if (event) (this.log || log$1).error(error); - else throw new Error(error); + else throw Error(error); } return trigger(this.eventBusEl_, event, hash); } @@ -699,7 +698,7 @@ void 0 === options && (options = {}); var eventBusKey = options.eventBusKey; if (eventBusKey) { - if (!target[eventBusKey].nodeName) throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.'); + if (!target[eventBusKey].nodeName) throw Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.'); target.eventBusEl_ = target[eventBusKey]; } else target.eventBusEl_ = createEl("span", { className: "vjs-event-bus" @@ -746,7 +745,7 @@ }); }; function mergeOptions$3() { - for(var result = {}, _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++)sources[_key] = arguments[_key]; + for(var result = {}, _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++)sources[_key] = arguments[_key]; return sources.forEach(function(source) { source && each(source, function(value, key) { if (!isPlain(value)) { @@ -836,7 +835,7 @@ }, _proto.getChild = function(name) { if (name) return this.childNameIndex_[name]; }, _proto.getDescendant = function() { - for(var _len = arguments.length, names = new Array(_len), _key = 0; _key < _len; _key++)names[_key] = arguments[_key]; + for(var _len = arguments.length, names = Array(_len), _key = 0; _key < _len; _key++)names[_key] = arguments[_key]; names = names.reduce(function(acc, n) { return acc.concat(n); }, []); @@ -848,7 +847,7 @@ var component, componentName, componentClassName = options.componentClass || componentName; options.name = componentName; var ComponentClass = Component.getComponent(componentClassName); - if (!ComponentClass) throw new Error("Component " + componentClassName + " does not exist"); + if (!ComponentClass) throw Error("Component " + componentClassName + " does not exist"); if ("function" != typeof ComponentClass) return null; component = new ComponentClass(this.player_ || this, options); } else component = child; @@ -954,7 +953,7 @@ return -1 !== pxIndex ? parseInt(val.slice(0, pxIndex), 10) : parseInt(this.el_["offset" + toTitleCase$1(widthOrHeight)], 10); }, _proto.currentDimension = function(widthOrHeight) { var computedWidthOrHeight = 0; - if ("width" !== widthOrHeight && "height" !== widthOrHeight) throw new Error("currentDimension only accepts width or height value"); + if ("width" !== widthOrHeight && "height" !== widthOrHeight) throw Error("currentDimension only accepts width or height value"); if (computedWidthOrHeight = computedStyle(this.el_, widthOrHeight), 0 === (computedWidthOrHeight = parseFloat(computedWidthOrHeight)) || isNaN(computedWidthOrHeight)) { var rule = "offset" + toTitleCase$1(widthOrHeight); computedWidthOrHeight = this.el_[rule]; @@ -1067,16 +1066,16 @@ }), _this5.clearingTimersOnDispose_ = !1; })); }, Component.registerComponent = function(name, ComponentToRegister) { - if ("string" != typeof name || !name) throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.'); - var reason, Tech = Component.getComponent("Tech"), isTech = Tech && Tech.isTech(ComponentToRegister), isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype); - if (isTech || !isComp) throw reason = isTech ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass", new Error('Illegal component, "' + name + '"; ' + reason + "."); + if ("string" != typeof name || !name) throw Error('Illegal component name, "' + name + '"; must be a non-empty string.'); + var Tech = Component.getComponent("Tech"), isTech = Tech && Tech.isTech(ComponentToRegister), isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype); + if (isTech || !isComp) throw Error('Illegal component, "' + name + '"; ' + (isTech ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass") + "."); name = toTitleCase$1(name), Component.components_ || (Component.components_ = {}); var Player = Component.getComponent("Player"); if ("Player" === name && Player && Player.players) { var players = Player.players, playerNames = Object.keys(players); if (players && playerNames.length > 0 && playerNames.map(function(pname) { return players[pname]; - }).every(Boolean)) throw new Error("Can not register Player component after player has been created."); + }).every(Boolean)) throw Error("Can not register Player component after player has been created."); } return Component.components_[name] = ComponentToRegister, Component.components_[toLowerCase(name)] = ComponentToRegister, ComponentToRegister; }, Component.getComponent = function(name) { @@ -1085,7 +1084,7 @@ }(); function getRange(fnName1, valueIndex, ranges, rangeIndex) { return !function(fnName, index, maxIndex) { - if ("number" != typeof index || index < 0 || index > maxIndex) throw new Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index + ") is non-numeric or out of bounds (0-" + maxIndex + ")."); + if ("number" != typeof index || index < 0 || index > maxIndex) throw Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index + ") is non-numeric or out of bounds (0-" + maxIndex + ")."); }(fnName1, rangeIndex, ranges.length - 1), ranges[rangeIndex][valueIndex]; } function createTimeRangesObj(ranges) { @@ -1093,10 +1092,10 @@ return timeRangesObj = void 0 === ranges || 0 === ranges.length ? { length: 0, start: function() { - throw new Error("This TimeRanges object is empty"); + throw Error("This TimeRanges object is empty"); }, end: function() { - throw new Error("This TimeRanges object is empty"); + throw Error("This TimeRanges object is empty"); } } : { length: ranges.length, @@ -1593,7 +1592,7 @@ })); }, TextTrack1 = function(_Track) { function TextTrack(options) { - if (void 0 === options && (options = {}), !options.tech) throw new Error("A tech was not provided."); + if (void 0 === options && (options = {}), !options.tech) throw Error("A tech was not provided."); var _this, settings = mergeOptions$3(options, { kind: TextTrackKind[options.kind] || "subtitles", language: options.language || options.srclang || "" @@ -1914,7 +1913,7 @@ }); }, _proto.addTextTrack = function(kind, label, language) { var self, kind1, label1, language1, options, tracks, track; - if (!kind) throw new Error("TextTrack kind is required but was not provided"); + if (!kind) throw Error("TextTrack kind is required but was not provided"); return self = this, kind1 = kind, label1 = label, language1 = language, void 0 === options && (options = {}), tracks = self.textTracks(), options.kind = kind1, label1 && (options.label = label1), language1 && (options.language = language1), options.tech = self, track = new ALL.text.TrackClass(options), tracks.addTrack(track), track; }, _proto.createRemoteTextTrack = function(options) { var track = mergeOptions$3(options, { @@ -1947,9 +1946,9 @@ }, Tech.isTech = function(component) { return component.prototype instanceof Tech || component instanceof Tech || component === Tech; }, Tech.registerTech = function(name, tech) { - if (Tech.techs_ || (Tech.techs_ = {}), !Tech.isTech(tech)) throw new Error("Tech " + name + " must be a Tech"); - if (!Tech.canPlayType) throw new Error("Techs must have a static canPlayType method on them"); - if (!Tech.canPlaySource) throw new Error("Techs must have a static canPlaySource method on them"); + if (Tech.techs_ || (Tech.techs_ = {}), !Tech.isTech(tech)) throw Error("Tech " + name + " must be a Tech"); + if (!Tech.canPlayType) throw Error("Techs must have a static canPlayType method on them"); + if (!Tech.canPlaySource) throw Error("Techs must have a static canPlaySource method on them"); return name = toTitleCase$1(name), Tech.techs_[name] = tech, Tech.techs_[toLowerCase(name)] = tech, "Tech" !== name && Tech.defaultTechOrder_.push(name), tech; }, Tech.getTech = function(name) { return name ? Tech.techs_ && Tech.techs_[name] ? Tech.techs_[name] : (name = toTitleCase$1(name), global_window__WEBPACK_IMPORTED_MODULE_0___default() && global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs && global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs[name]) ? (log$1.warn("The " + name + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"), global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs[name]) : void 0 : void 0; @@ -2238,7 +2237,7 @@ var hex; if (4 === color.length) hex = color[1] + color[1] + color[2] + color[2] + color[3] + color[3]; else if (7 === color.length) hex = color.slice(1); - else throw new Error("Invalid color code provided, " + color + "; must be formatted as e.g. #f0e or #f604e2."); + else throw Error("Invalid color code provided, " + color + "; must be formatted as e.g. #f0e or #f604e2."); return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")"; } function tryUpdateStyle(el, style, rule) { @@ -3549,10 +3548,10 @@ options.kind || _this.track.kind ]).filter(Boolean); var changeHandler = function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _this.handleTracksChange.apply((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), args); }, selectedLanguageChangeHandler = function() { - for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + for(var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; _this.handleSelectedLanguageChange.apply((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), args); }; return player.on([ @@ -3857,7 +3856,7 @@ var _this, track = options.track, tracks = player.audioTracks(); options.label = track.label || track.language || "Unknown", options.selected = track.enabled, (_this = _MenuItem.call(this, player, options) || this).track = track, _this.addClass("vjs-" + track.kind + "-menu-item"); var changeHandler = function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _this.handleTracksChange.apply((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), args); }; return tracks.addEventListener("change", changeHandler), _this.on("dispose", function() { @@ -4611,7 +4610,7 @@ innerHTMLDescriptorPolyfill, ], "innerHTML"), appendWrapper = function(appendFn) { return function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; var retval = appendFn.apply(el, args); return sourcesetLoad(tech), retval; }; @@ -4893,7 +4892,7 @@ } }, _proto.exitFullScreen = function() { if (!this.el_.webkitDisplayingFullscreen) { - this.trigger("fullscreenerror", new Error("The video is not fullscreen")); + this.trigger("fullscreenerror", Error("The video is not fullscreen")); return; } this.el_.webkitExitFullScreen(); @@ -5228,7 +5227,7 @@ return _this.handleTechTouchEnd_(e); }, _this.boundHandleTechTap_ = function(e) { return _this.handleTechTap_(e); - }, _this.isFullscreen_ = !1, _this.log = createLogger(_this.id_), _this.fsApi_ = FullscreenApi, _this.isPosterFromTech_ = !1, _this.queuedCallbacks_ = [], _this.isReady_ = !1, _this.hasStarted_ = !1, _this.userActive_ = !1, _this.debugEnabled_ = !1, !_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?"); + }, _this.isFullscreen_ = !1, _this.log = createLogger(_this.id_), _this.fsApi_ = FullscreenApi, _this.isPosterFromTech_ = !1, _this.queuedCallbacks_ = [], _this.isReady_ = !1, _this.hasStarted_ = !1, _this.userActive_ = !1, _this.debugEnabled_ = !1, !_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) throw Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?"); if (_this.tag = tag, _this.tagAttributes = tag && getAttributes(tag), _this.language(_this.options_.language), options.languages) { var languagesToLower = {}; Object.getOwnPropertyNames(options.languages).forEach(function(name) { @@ -5236,7 +5235,7 @@ }), _this.languages_ = languagesToLower; } else _this.languages_ = Player.prototype.options_.languages; _this.resetCache_(), _this.poster_ = options.poster || "", _this.controls_ = !!options.controls, tag.controls = !1, tag.removeAttribute("controls"), _this.changingSrc_ = !1, _this.playCallbacks_ = [], _this.playTerminatedQueue_ = [], tag.hasAttribute("autoplay") ? _this.autoplay(!0) : _this.autoplay(_this.options_.autoplay), options.plugins && Object.keys(options.plugins).forEach(function(name) { - if ("function" != typeof _this[name]) throw new Error('plugin "' + name + '" does not exist'); + if ("function" != typeof _this[name]) throw Error('plugin "' + name + '" does not exist'); }), _this.scrubbing_ = !1, _this.el_ = _this.createEl(), evented((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), { eventBusKey: "el_" }), _this.fsApi_.requestFullscreen && (on(global_document__WEBPACK_IMPORTED_MODULE_1___default(), _this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_), _this.on(_this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_)), _this.fluid_ && _this.on([ @@ -5332,7 +5331,7 @@ this.fill_ = !!bool, bool ? (this.addClass("vjs-fill"), this.fluid(!1)) : this.removeClass("vjs-fill"); }, _proto.aspectRatio = function(ratio) { if (void 0 === ratio) return this.aspectRatio_; - if (!/^\d+\:\d+$/.test(ratio)) throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9."); + if (!/^\d+\:\d+$/.test(ratio)) throw Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9."); this.aspectRatio_ = ratio, this.fluid(!0), this.updateStyleEl_(); }, _proto.updateStyleEl_ = function() { if (!0 === global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) { @@ -5373,7 +5372,7 @@ techOptions[props.getterName] = _this4[props.privateName]; }), assign(techOptions, this.options_[titleTechName]), assign(techOptions, this.options_[camelTechName]), assign(techOptions, this.options_[techName.toLowerCase()]), this.tag && (techOptions.tag = this.tag), source && source.src === this.cache_.src && this.cache_.currentTime > 0 && (techOptions.startTime = this.cache_.currentTime); var TechClass = Tech1.getTech(techName); - if (!TechClass) throw new Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'"); + if (!TechClass) throw Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'"); this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_), TECH_EVENTS_RETRIGGER.forEach(function(event) { _this4.on(_this4.tech_, event, function(e) { return _this4["handleTech" + toTitleCase$1(event) + "_"](e); @@ -5452,7 +5451,7 @@ _this6.playTerminatedQueue_.push(restoreMuted); var mutedPromise = _this6.play(); if (isPromise(mutedPromise)) return mutedPromise.catch(function(err) { - throw restoreMuted(), new Error("Rejection at manualAutoplay. Restoring muted value. " + (err || "")); + throw restoreMuted(), Error("Rejection at manualAutoplay. Restoring muted value. " + (err || "")); }); }; if ("any" !== type || this.muted() ? promise = "muted" !== type || this.muted() ? this.play() : resolveMuted() : isPromise(promise = this.play()) && (promise = promise.catch(resolveMuted)), isPromise(promise)) return promise.then(function() { @@ -6257,7 +6256,7 @@ plugin: PluginSubClass, instance: null }, !0); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; var instance = (0, _babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_18__.Z)(PluginSubClass, [ this ].concat(args)); @@ -6267,7 +6266,7 @@ }; }, Plugin1 = function() { function Plugin(player) { - if (this.constructor === Plugin) throw new Error("Plugin must be sub-classed; not directly instantiated."); + if (this.constructor === Plugin) throw Error("Plugin must be sub-classed; not directly instantiated."); this.player = player, this.log || (this.log = this.player.log.createLogger(this.name)), evented(this), delete this.trigger, stateful(this, this.constructor.defaultState), markPluginAsActive(player, this.name), this.dispose = this.dispose.bind(this), player.on("dispose", this.dispose); } var _proto = Plugin.prototype; @@ -6284,13 +6283,13 @@ var p = "string" == typeof plugin ? getPlugin(plugin) : plugin; return "function" == typeof p && !Plugin.prototype.isPrototypeOf(p.prototype); }, Plugin.registerPlugin = function(name, plugin) { - if ("string" != typeof name) throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + typeof name + "."); + if ("string" != typeof name) throw Error('Illegal plugin name, "' + name + '", must be a string, was ' + typeof name + "."); if (pluginExists(name)) log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!'); - else if (Player1.prototype.hasOwnProperty(name)) throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!'); - if ("function" != typeof plugin) throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + typeof plugin + "."); + else if (Player1.prototype.hasOwnProperty(name)) throw Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!'); + if ("function" != typeof plugin) throw Error('Illegal plugin for "' + name + '", must be a function, was ' + typeof plugin + "."); return pluginStorage[name] = plugin, name !== BASE_PLUGIN_NAME && (Plugin.isBasic(plugin) ? Player1.prototype[name] = createBasicPlugin(name, plugin) : Player1.prototype[name] = createPluginFactory(name, plugin)), plugin; }, Plugin.deregisterPlugin = function(name) { - if (name === BASE_PLUGIN_NAME) throw new Error("Cannot de-register base plugin."); + if (name === BASE_PLUGIN_NAME) throw Error("Cannot de-register base plugin."); pluginExists(name) && (delete pluginStorage[name], delete Player1.prototype[name]); }, Plugin.getPlugins = function(names) { var result; @@ -6315,7 +6314,7 @@ var player = videojs.getPlayer(id); if (player) return options && log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.'), ready && player.ready(ready), player; var el = "string" == typeof id ? $("#" + normalizeId(id)) : id; - if (!isEl(el)) throw new TypeError("The element or ID supplied is not valid. (videojs)"); + if (!isEl(el)) throw TypeError("The element or ID supplied is not valid. (videojs)"); return el.ownerDocument.defaultView && el.ownerDocument.body.contains(el) || log$1.warn("The element supplied is not included in the DOM"), options = options || {}, hooks("beforesetup").forEach(function(hookFunction) { var opts = hookFunction(el, mergeOptions$3(options)); if (!isObject(opts) || Array.isArray(opts)) { @@ -6923,7 +6922,7 @@ return update && lastDuration ? 1000 * lastDuration : 500 * (media.partTargetDuration || media.targetDuration || 10); }, PlaylistLoader1 = function(_EventTarget) { function PlaylistLoader(src, vhs, options) { - if (void 0 === options && (options = {}), _this = _EventTarget.call(this) || this, !src) throw new Error("A non-empty playlist URL or object is required"); + if (void 0 === options && (options = {}), _this = _EventTarget.call(this) || this, !src) throw Error("A non-empty playlist URL or object is required"); _this.logger_ = logger("PlaylistLoader"); var _this, _options = options, _options$withCredenti = _options.withCredentials, _options$handleManife = _options.handleManifestRedirects; _this.src = src, _this.vhs_ = vhs, _this.withCredentials = void 0 !== _options$withCredenti && _options$withCredenti, _this.handleManifestRedirects = void 0 !== _options$handleManife && _options$handleManife; @@ -6999,9 +6998,9 @@ }, _proto.media = function(playlist, shouldDelay) { var _this4 = this; if (!playlist) return this.media_; - if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this.state); + if ("HAVE_NOTHING" === this.state) throw Error("Cannot switch media playlist from " + this.state); if ("string" == typeof playlist) { - if (!this.master.playlists[playlist]) throw new Error("Unknown playlist URI: " + playlist); + if (!this.master.playlists[playlist]) throw Error("Unknown playlist URI: " + playlist); playlist = this.master.playlists[playlist]; } if (global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.finalRenditionTimeout), shouldDelay) { @@ -7103,7 +7102,7 @@ }, PlaylistLoader; }(EventTarget$1), videojsXHR = videojs.xhr, mergeOptions$1 = videojs.mergeOptions, callbackWrapper = function(request, error, response, callback) { var reqResponse = "arraybuffer" === request.responseType ? request.response : request.responseText; - error || !reqResponse || (request.responseTime = Date.now(), request.roundTripTime = request.responseTime - request.requestTime, request.bytesReceived = reqResponse.byteLength || reqResponse.length, request.bandwidth || (request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8000))), response.headers && (request.responseHeaders = response.headers), error && "ETIMEDOUT" === error.code && (request.timedout = !0), error || request.aborted || 200 === response.statusCode || 206 === response.statusCode || 0 === response.statusCode || (error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)))), callback(error, request); + error || !reqResponse || (request.responseTime = Date.now(), request.roundTripTime = request.responseTime - request.requestTime, request.bytesReceived = reqResponse.byteLength || reqResponse.length, request.bandwidth || (request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8000))), response.headers && (request.responseHeaders = response.headers), error && "ETIMEDOUT" === error.code && (request.timedout = !0), error || request.aborted || 200 === response.statusCode || 206 === response.statusCode || 0 === response.statusCode || (error = Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)))), callback(error, request); }, xhrFactory = function() { var xhr = function XhrFunction(options, callback) { options = mergeOptions$1({ @@ -7222,7 +7221,7 @@ return !0; }, getProgramTime = function(_ref) { var playlist = _ref.playlist, _ref$time = _ref.time, time = void 0 === _ref$time ? void 0 : _ref$time, callback = _ref.callback; - if (!callback) throw new Error("getProgramTime: callback must be provided"); + if (!callback) throw Error("getProgramTime: callback must be provided"); if (!playlist || void 0 === time) return callback({ message: "getProgramTime: playlist and time must be provided" }); @@ -7240,7 +7239,7 @@ return programTime && (programTimeObject.programDateTime = programTime.toISOString()), callback(null, programTimeObject); }, seekToProgramTime1 = function seekToProgramTime(_ref2) { var programTime = _ref2.programTime, playlist = _ref2.playlist, _ref2$retryCount = _ref2.retryCount, retryCount = void 0 === _ref2$retryCount ? 2 : _ref2$retryCount, seekTo = _ref2.seekTo, _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, pauseAfterSeek = void 0 === _ref2$pauseAfterSeek || _ref2$pauseAfterSeek, tech = _ref2.tech, callback = _ref2.callback; - if (!callback) throw new Error("seekToProgramTime: callback must be provided"); + if (!callback) throw Error("seekToProgramTime: callback must be provided"); if (void 0 === programTime || !playlist || !seekTo) return callback({ message: "seekToProgramTime: programTime, seekTo and playlist must be provided" }); @@ -7360,7 +7359,7 @@ function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) { void 0 === options && (options = {}), (_this = _EventTarget.call(this) || this).masterPlaylistLoader_ = masterPlaylistLoader || (0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), masterPlaylistLoader || (_this.isMaster_ = !0); var _this, _options = options, _options$withCredenti = _options.withCredentials, _options$handleManife = _options.handleManifestRedirects; - if (_this.vhs_ = vhs, _this.withCredentials = void 0 !== _options$withCredenti && _options$withCredenti, _this.handleManifestRedirects = void 0 !== _options$handleManife && _options$handleManife, !srcUrlOrPlaylist) throw new Error("A non-empty playlist URL or object is required"); + if (_this.vhs_ = vhs, _this.withCredentials = void 0 !== _options$withCredenti && _options$withCredenti, _this.handleManifestRedirects = void 0 !== _options$handleManife && _options$handleManife, !srcUrlOrPlaylist) throw Error("A non-empty playlist URL or object is required"); return _this.on("minimumUpdatePeriod", function() { _this.refreshXml_(); }), _this.on("mediaupdatetimeout", function() { @@ -7436,10 +7435,10 @@ }, _proto.media = function(playlist) { var _this3 = this; if (!playlist) return this.media_; - if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this.state); + if ("HAVE_NOTHING" === this.state) throw Error("Cannot switch media playlist from " + this.state); var startingState = this.state; if ("string" == typeof playlist) { - if (!this.masterPlaylistLoader_.master.playlists[playlist]) throw new Error("Unknown playlist URI: " + playlist); + if (!this.masterPlaylistLoader_.master.playlists[playlist]) throw Error("Unknown playlist URI: " + playlist); playlist = this.masterPlaylistLoader_.master.playlists[playlist]; } var mediaChange = !this.media_ || playlist.id !== this.media_.id; @@ -7553,7 +7552,7 @@ }); }, _proto.refreshMedia_ = function(mediaID) { var _this9 = this; - if (!mediaID) throw new Error("refreshMedia_ must take a media id"); + if (!mediaID) throw Error("refreshMedia_ must take a media id"); this.media_ && this.isMaster_ && this.handleMaster_(); var playlists = this.masterPlaylistLoader_.master.playlists, mediaChanged = !this.media_ || this.media_ !== playlists[mediaID]; mediaChanged ? this.media_ = playlists[mediaID] : this.trigger("playlistunchanged"), this.mediaUpdateTimeout || _this9.media().endList || (_this9.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function() { @@ -9644,7 +9643,7 @@ return 8 * workingBytesAvailable + workingBitsAvailable; }, this.loadWord = function() { var position = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable); - if (0 === availableBytes) throw new Error("no bytes available"); + if (0 === availableBytes) throw Error("no bytes available"); workingBytes.set(workingData.subarray(position, position + availableBytes)), workingWord = new DataView(workingBytes.buffer).getUint32(0), workingBitsAvailable = 8 * availableBytes, workingBytesAvailable -= availableBytes; }, this.skipBits = function(count) { var skipBytes; @@ -11845,9 +11844,9 @@ }, SegmentLoader1 = function(_videojs$EventTarget) { function SegmentLoader(settings, options) { var _this; - if (_this = _videojs$EventTarget.call(this) || this, !settings) throw new TypeError("Initialization settings are required"); - if ("function" != typeof settings.currentTime) throw new TypeError("No currentTime getter specified"); - if (!settings.mediaSource) throw new TypeError("No MediaSource specified"); + if (_this = _videojs$EventTarget.call(this) || this, !settings) throw TypeError("Initialization settings are required"); + if ("function" != typeof settings.currentTime) throw TypeError("No currentTime getter specified"); + if (!settings.mediaSource) throw TypeError("No MediaSource specified"); return _this.bandwidth = settings.bandwidth, _this.throughput = { rate: 0, count: 0 @@ -12782,7 +12781,7 @@ }); }, _proto.addOrChangeSourceBuffers = function(codecs) { var _this2 = this; - if (!codecs || "object" != typeof codecs || 0 === Object.keys(codecs).length) throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs"); + if (!codecs || "object" != typeof codecs || 0 === Object.keys(codecs).length) throw Error("Cannot addOrChangeSourceBuffers to undefined codecs"); Object.keys(codecs).forEach(function(type) { var codec = codecs[type]; if (!_this2.hasCreatedSourceBuffers()) return _this2.addSourceBuffer(type, codec); @@ -13317,7 +13316,7 @@ }, fn(module, module.exports), module.exports; } function commonjsRequire() { - throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); + throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); } var createClass = createCommonjsModule(function(module) { function _defineProperties(target, props) { @@ -13404,7 +13403,7 @@ ], ]; var i, j, tmp, sbox = this._tables[0][4], decTable = this._tables[1], keyLen = key.length, rcon = 1; - if (4 !== keyLen && 6 !== keyLen && 8 !== keyLen) throw new Error("Invalid aes key size"); + if (4 !== keyLen && 6 !== keyLen && 8 !== keyLen) throw Error("Invalid aes key size"); var encKey = key.slice(0), decKey = []; for(this._key = [ encKey, @@ -13799,7 +13798,7 @@ function MasterPlaylistController(options) { _this = _videojs$EventTarget.call(this) || this; var _this, src = options.src, handleManifestRedirects = options.handleManifestRedirects, withCredentials = options.withCredentials, tech = options.tech, bandwidth = options.bandwidth, externVhs = options.externVhs, useCueTags = options.useCueTags, blacklistDuration = options.blacklistDuration, enableLowInitialPlaylist = options.enableLowInitialPlaylist, sourceType = options.sourceType, cacheEncryptionKeys = options.cacheEncryptionKeys, experimentalBufferBasedABR = options.experimentalBufferBasedABR, experimentalLeastPixelDiffSelector = options.experimentalLeastPixelDiffSelector, captionServices = options.captionServices; - if (!src) throw new Error("A non-empty playlist URL or JSON manifest string is required"); + if (!src) throw Error("A non-empty playlist URL or JSON manifest string is required"); var maxPlaylistRetries = options.maxPlaylistRetries; null == maxPlaylistRetries && (maxPlaylistRetries = 1 / 0), Vhs$1 = externVhs, _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR), _this.experimentalLeastPixelDiffSelector = Boolean(experimentalLeastPixelDiffSelector), _this.withCredentials = withCredentials, _this.tech_ = tech, _this.vhs_ = tech.vhs, _this.sourceType_ = sourceType, _this.useCueTags_ = useCueTags, _this.blacklistDuration = blacklistDuration, _this.maxPlaylistRetries = maxPlaylistRetries, _this.enableLowInitialPlaylist = enableLowInitialPlaylist, _this.useCueTags_ && (_this.cueTagsTrack_ = _this.tech_.addTextTrack("metadata", "ad-cues"), _this.cueTagsTrack_.inBandMetadataTrackDispatchType = ""), _this.requestOptions_ = { withCredentials: withCredentials, @@ -14661,7 +14660,7 @@ lastBandwidthSelector: lastBandwidthSelector, movingAverageBandwidthSelector: function(decay) { var average = -1, lastSystemBandwidth = -1; - if (decay < 0 || decay > 1) throw new Error("Moving average bandwidth decay must be between 0 and 1."); + if (decay < 0 || decay > 1) throw Error("Moving average bandwidth decay must be between 0 and 1."); return function() { var pixelRatio = this.useDevicePixelRatio && global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1; return average < 0 && (average = this.systemBandwidth, lastSystemBandwidth = this.systemBandwidth), this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth && (average = decay * this.systemBandwidth + (1 - decay) * average, lastSystemBandwidth = this.systemBandwidth), simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); @@ -14816,7 +14815,7 @@ }), _this.player_ = _player; } if (_this.tech_ = tech, _this.source_ = source, _this.stats = {}, _this.ignoreNextSeekingEvent_ = !1, _this.setOptions_(), _this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) tech.overrideNativeAudioTracks(!0), tech.overrideNativeVideoTracks(!0); - else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB"); + else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) throw Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB"); return _this.on(global_document__WEBPACK_IMPORTED_MODULE_1___default(), [ "fullscreenchange", "webkitfullscreenchange", diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index 99b8891f2f0..63fec14a3af 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -91,7 +91,7 @@ for(var view = new Uint8Array(string.length), i = 0; i < string.length; i++)view[i] = string.charCodeAt(i); return view; }, concatTypedArrays = function() { - for(var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++)buffers[_key] = arguments[_key]; + for(var _len = arguments.length, buffers = Array(_len), _key = 0; _key < _len; _key++)buffers[_key] = arguments[_key]; if ((buffers = buffers.filter(function(b) { return b && (b.byteLength || b.length) && "string" != typeof b; })).length <= 1) return toUint8(buffers[0]); @@ -843,12 +843,12 @@ return _createXHR(options = initParams(uri, options, callback)); } function _createXHR(options) { - if (void 0 === options.callback) throw new Error("callback argument missing"); + if (void 0 === options.callback) throw Error("callback argument missing"); var key, aborted, timeoutTimer, called = !1, callback = function(err, response, body) { called || (called = !0, options.callback(err, response, body)); }; function errorFunc(evt) { - return clearTimeout(timeoutTimer), evt instanceof Error || (evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"))), evt.statusCode = 0, callback(evt, failureResponse); + return clearTimeout(timeoutTimer), evt instanceof Error || (evt = Error("" + (evt || "Unknown XMLHttpRequest Error"))), evt.statusCode = 0, callback(evt, failureResponse); } function loadFunc() { if (!aborted) { @@ -867,7 +867,7 @@ headers: {}, url: uri, rawRequest: xhr - }, xhr.getAllResponseHeaders && (response.headers = parseHeaders(xhr.getAllResponseHeaders()))) : err = new Error("Internal XMLHttpRequest Error"), callback(err, response, response.body); + }, xhr.getAllResponseHeaders && (response.headers = parseHeaders(xhr.getAllResponseHeaders()))) : err = Error("Internal XMLHttpRequest Error"), callback(err, response, response.body); } } var xhr = options.xhr || null; @@ -887,14 +887,14 @@ }, xhr.ontimeout = errorFunc, xhr.open(method, uri, !sync, options.username, options.password), sync || (xhr.withCredentials = !!options.withCredentials), !sync && options.timeout > 0 && (timeoutTimer = setTimeout(function() { if (!aborted) { aborted = !0, xhr.abort("timeout"); - var e = new Error("XMLHttpRequest timeout"); + var e = Error("XMLHttpRequest timeout"); e.code = "ETIMEDOUT", errorFunc(e); } }, options.timeout)), xhr.setRequestHeader) for(key in headers)headers.hasOwnProperty(key) && xhr.setRequestHeader(key, headers[key]); else if (options.headers && !function(obj) { for(var i in obj)if (obj.hasOwnProperty(i)) return !1; return !0; - }(options.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); + }(options.headers)) throw Error("Headers cannot be set on an XDomainRequest object"); return "responseType" in options && (xhr.responseType = options.responseType), "beforeSend" in options && "function" == typeof options.beforeSend && options.beforeSend(xhr), xhr.send(body1 || null), xhr; } function getXml(xhr) { @@ -1120,7 +1120,7 @@ var doc = el.ownerDocument; doc && (_onRemoveAttribute(doc, el, attr), attr.ownerElement = null); } - } else throw DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr)); + } else throw DOMException(NOT_FOUND_ERR, Error(el.tagName + "@" + attr)); } function DOMImplementation() {} function Node() {} @@ -1640,7 +1640,7 @@ this.replaceData(offset, 0, text); }, appendChild: function(newChild) { - throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]); + throw Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]); }, deleteData: function(offset, count) { this.replaceData(offset, count, ""); @@ -1962,7 +1962,7 @@ dom.DOMImplementation, dom.XMLSerializer, exports.DOMParser = __webpack_require__(6129).DOMParser; }, 6925: function(__unused_webpack_module, exports, __webpack_require__) { - var NAMESPACE = __webpack_require__(2167).NAMESPACE, nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"), tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$"); + var NAMESPACE = __webpack_require__(2167).NAMESPACE, nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, nameChar = RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"), tagNamePattern = RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$"); function ParseError(message, locator) { this.message = message, this.locator = locator, Error.captureStackTrace && Error.captureStackTrace(this, ParseError); } @@ -1980,15 +1980,15 @@ case "=": if (1 === s) attrName = source.slice(start, p), s = 3; else if (2 === s) s = 3; - else throw new Error("attribute equal must after attrName"); + else throw Error("attribute equal must after attrName"); break; case "'": case '"': if (3 === s || 1 === s) { if (1 === s && (errorHandler.warning('attribute value must after "="'), attrName = source.slice(start, p)), start = p + 1, (p = source.indexOf(c, start)) > 0) addAttribute(attrName, value1 = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer), start - 1), s = 5; - else throw new Error("attribute value no end '" + c + "' match"); + else throw Error("attribute value no end '" + c + "' match"); } else if (4 == s) addAttribute(attrName, value1 = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer), start), errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!"), start = p + 1, s = 5; - else throw new Error('attribute value must after "="'); + else throw Error('attribute value must after "="'); break; case "/": switch(s){ @@ -2003,7 +2003,7 @@ case 2: break; default: - throw new Error("attribute invalid close char('/')"); + throw Error("attribute invalid close char('/')"); } break; case "": @@ -2023,7 +2023,7 @@ 2 === s && (value1 = attrName), 4 == s ? (errorHandler.warning('attribute "' + value1 + '" missed quot(")!'), addAttribute(attrName, value1.replace(/&#?\w+;/g, entityReplacer), start)) : (NAMESPACE.isHTML(currentNSMap[""]) && value1.match(/^(?:disabled|checked|selected)$/i) || errorHandler.warning('attribute "' + value1 + '" missed value!! "' + value1 + '" instead!!'), addAttribute(value1, value1, start)); break; case 3: - throw new Error("attribute value missed!!"); + throw Error("attribute value missed!!"); } return p; case "\u0080": @@ -2055,7 +2055,7 @@ s = 4, start = p; break; case 7: - throw new Error("elements closed character '/' and '>' must be connected to"); + throw Error("elements closed character '/' and '>' must be connected to"); } } p++; @@ -2129,7 +2129,7 @@ var match, buf = [], reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; for(reg.lastIndex = start, reg.exec(source); match = reg.exec(source);)if (buf.push(match), match[1]) return buf; } - ParseError.prototype = new Error(), ParseError.prototype.name = ParseError.name, XMLReader.prototype = { + ParseError.prototype = Error(), ParseError.prototype.name = ParseError.name, XMLReader.prototype = { parse: function(source1, defaultNSMap, entityMap1) { var domBuilder2 = this.domBuilder; domBuilder2.startDocument(), _copy(defaultNSMap, defaultNSMap = {}), function(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { @@ -2204,11 +2204,11 @@ } }, ElementAttributes.prototype = { setTagName: function(tagName) { - if (!tagNamePattern.test(tagName)) throw new Error("invalid tagName:" + tagName); + if (!tagNamePattern.test(tagName)) throw Error("invalid tagName:" + tagName); this.tagName = tagName; }, addValue: function(qName, value, offset) { - if (!tagNamePattern.test(qName)) throw new Error("invalid attribute:" + qName); + if (!tagNamePattern.test(qName)) throw Error("invalid attribute:" + qName); this.attributeNames[qName] = this.length, this[this.length++] = { qName: qName, value: value, @@ -2392,7 +2392,7 @@ var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || ""), result = {}; return match[1] && (result.length = parseInt(match[1], 10)), match[2] && (result.offset = parseInt(match[2], 10)), result; }, attributeSeparator = function() { - return new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'); + return RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'); }, parseAttributes = function(attributes) { for(var attr, attrs = attributes.split(attributeSeparator()), result = {}, i = attrs.length; i--;)"" !== attrs[i] && ((attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1))[0] = attr[0].replace(/^\s+|\s+$/g, ""), attr[1] = attr[1].replace(/^\s+|\s+$/g, ""), attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1"), result[attr[0]] = attr[1]); return result; @@ -3013,7 +3013,7 @@ var _videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(779), global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__), _videojs_vhs_utils_es_decode_b64_to_uint8_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6722), _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3969), isObject = function(obj) { return !!obj && "object" == typeof obj; }, merge1 = function merge() { - for(var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++)objects[_key] = arguments[_key]; + for(var _len = arguments.length, objects = Array(_len), _key = 0; _key < _len; _key++)objects[_key] = arguments[_key]; return objects.reduce(function(result, source) { return "object" != typeof source || Object.keys(source).forEach(function(key) { Array.isArray(result[key]) && Array.isArray(source[key]) ? result[key] = result[key].concat(source[key]) : isObject(result[key]) && isObject(source[key]) ? result[key] = merge(result[key], source[key]) : result[key] = source[key]; @@ -3094,7 +3094,7 @@ return segments; }, segmentsFromBase = function(attributes) { var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = void 0 === _attributes$initializ ? {} : _attributes$initializ, sourceDuration = attributes.sourceDuration, _attributes$indexRang = attributes.indexRange, duration = attributes.duration; - if (!baseUrl) throw new Error(errors.NO_BASE_URL); + if (!baseUrl) throw Error(errors.NO_BASE_URL); var initSegment = urlTypeToSegment({ baseUrl: baseUrl, source: initialization.sourceURL, @@ -3310,7 +3310,7 @@ if ("$$" === match) return "$"; if (void 0 === values1[identifier]) return match; var value = "" + values1[identifier]; - return "RepresentationID" === identifier ? value : (width = format ? parseInt(width, 10) : 1, value.length >= width) ? value : "" + new Array(width - value.length + 1).join("0") + value; + return "RepresentationID" === identifier ? value : (width = format ? parseInt(width, 10) : 1, value.length >= width) ? value : "" + Array(width - value.length + 1).join("0") + value; })); }, segmentsFromTemplate = function(attributes, segmentTimeline) { var attributes2, segmentTimeline1, templateValues = { @@ -3357,7 +3357,7 @@ return segment.map = initSegment, segment; }, segmentsFromList = function(attributes, segmentTimeline) { var segmentTimeInfo, duration = attributes.duration, _attributes$segmentUr = attributes.segmentUrls, periodStart = attributes.periodStart; - if (!duration && !segmentTimeline || duration && segmentTimeline) throw new Error(errors.SEGMENT_TIME_UNSPECIFIED); + if (!duration && !segmentTimeline || duration && segmentTimeline) throw Error(errors.SEGMENT_TIME_UNSPECIFIED); var segmentUrlMap = (void 0 === _attributes$segmentUr ? [] : _attributes$segmentUr).map(function(segmentUrlObject) { return SegmentURLToSegmentObject(attributes, segmentUrlObject); }); @@ -3526,7 +3526,7 @@ }, inheritAttributes = function(mpd, options) { void 0 === options && (options = {}); var _options = options, _options$manifestUri = _options.manifestUri, _options$NOW = _options.NOW, NOW = void 0 === _options$NOW ? Date.now() : _options$NOW, _options$clientOffset = _options.clientOffset, periodNodes = findChildren(mpd, "Period"); - if (!periodNodes.length) throw new Error(errors.INVALID_NUMBER_OF_PERIOD); + if (!periodNodes.length) throw Error(errors.INVALID_NUMBER_OF_PERIOD); var locations = findChildren(mpd, "Location"), mpdAttributes = parseAttributes(mpd), mpdBaseUrls = buildBaseUrls([ void 0 === _options$manifestUri ? "" : _options$manifestUri ], findChildren(mpd, "BaseURL")); @@ -3595,12 +3595,12 @@ }))) }; }, stringToMpdXml = function(manifestString) { - if ("" === manifestString) throw new Error(errors.DASH_EMPTY_MANIFEST); + if ("" === manifestString) throw Error(errors.DASH_EMPTY_MANIFEST); var xml, mpd, parser = new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_3__.DOMParser(); try { mpd = (xml = parser.parseFromString(manifestString, "application/xml")) && "MPD" === xml.documentElement.tagName ? xml.documentElement : null; } catch (e) {} - if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) throw new Error(errors.DASH_INVALID_XML); + if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) throw Error(errors.DASH_INVALID_XML); return mpd; }, parseUTCTimingScheme = function(mpd) { var UTCTimingNode = findChildren(mpd, "UTCTiming")[0]; @@ -3622,7 +3622,7 @@ attributes.method = "DIRECT", attributes.value = Date.parse(attributes.value); break; default: - throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); + throw Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME); } return attributes; }, parse = function(manifestString, options) { @@ -3793,14 +3793,14 @@ if (opts = opts || {}, baseURL = baseURL.trim(), !(relativeURL = relativeURL.trim())) { if (!opts.alwaysNormalize) return baseURL; var basePartsForNormalise = URLToolkit.parseURL(baseURL); - if (!basePartsForNormalise) throw new Error("Error trying to parse base URL."); + if (!basePartsForNormalise) throw Error("Error trying to parse base URL."); return basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path), URLToolkit.buildURLFromParts(basePartsForNormalise); } var relativeParts = URLToolkit.parseURL(relativeURL); - if (!relativeParts) throw new Error("Error trying to parse relative URL."); + if (!relativeParts) throw Error("Error trying to parse relative URL."); if (relativeParts.scheme) return opts.alwaysNormalize ? (relativeParts.path = URLToolkit.normalizePath(relativeParts.path), URLToolkit.buildURLFromParts(relativeParts)) : relativeURL; var baseParts = URLToolkit.parseURL(baseURL); - if (!baseParts) throw new Error("Error trying to parse base URL."); + if (!baseParts) throw Error("Error trying to parse base URL."); if (!baseParts.netLoc && baseParts.path && "/" !== baseParts.path[0]) { var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path); baseParts.netLoc = pathParts[1], baseParts.path = pathParts[2]; @@ -3860,7 +3860,7 @@ var document = __webpack_require__(9144), _objCreate = Object.create || function() { function F() {} return function(o) { - if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter."); + if (1 !== arguments.length) throw Error("Object.create shim only accepts one parameter."); return F.prototype = o, new F(); }; }(); @@ -4725,7 +4725,7 @@ return { decode: function(data) { if (!data) return ""; - if ("string" != typeof data) throw new Error("Error - expected string data."); + if ("string" != typeof data) throw Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(data)); } }; @@ -4932,7 +4932,7 @@ return _startTime; }, set: function(value) { - if ("number" != typeof value) throw new TypeError("Start time must be set to a number."); + if ("number" != typeof value) throw TypeError("Start time must be set to a number."); _startTime = value, this.hasBeenReset = !0; } }, @@ -4942,7 +4942,7 @@ return _endTime; }, set: function(value) { - if ("number" != typeof value) throw new TypeError("End time must be set to a number."); + if ("number" != typeof value) throw TypeError("End time must be set to a number."); _endTime = value, this.hasBeenReset = !0; } }, @@ -4971,7 +4971,7 @@ }, set: function(value) { var value2, setting = "string" == typeof (value2 = value) && !!directionSetting[value2.toLowerCase()] && value2.toLowerCase(); - if (!1 === setting) throw new SyntaxError("Vertical: an invalid or illegal direction string was specified."); + if (!1 === setting) throw SyntaxError("Vertical: an invalid or illegal direction string was specified."); _vertical = setting, this.hasBeenReset = !0; } }, @@ -4990,7 +4990,7 @@ return _line; }, set: function(value) { - if ("number" != typeof value && "auto" !== value) throw new SyntaxError("Line: an invalid number or illegal string was specified."); + if ("number" != typeof value && "auto" !== value) throw SyntaxError("Line: an invalid number or illegal string was specified."); _line = value, this.hasBeenReset = !0; } }, @@ -5010,7 +5010,7 @@ return _position; }, set: function(value) { - if (value < 0 || value > 100) throw new Error("Position must be between 0 and 100."); + if (value < 0 || value > 100) throw Error("Position must be between 0 and 100."); _position = value, this.hasBeenReset = !0; } }, @@ -5030,7 +5030,7 @@ return _size; }, set: function(value) { - if (value < 0 || value > 100) throw new Error("Size must be between 0 and 100."); + if (value < 0 || value > 100) throw Error("Size must be between 0 and 100."); _size = value, this.hasBeenReset = !0; } }, @@ -5041,7 +5041,7 @@ }, set: function(value) { var setting = findAlignSetting(value); - if (!setting) throw new SyntaxError("align: an invalid or illegal alignment string was specified."); + if (!setting) throw SyntaxError("align: an invalid or illegal alignment string was specified."); _align = setting, this.hasBeenReset = !0; } } @@ -5068,7 +5068,7 @@ return _width; }, set: function(value) { - if (!isValidPercentValue(value)) throw new Error("Width must be between 0 and 100."); + if (!isValidPercentValue(value)) throw Error("Width must be between 0 and 100."); _width = value; } }, @@ -5078,7 +5078,7 @@ return _lines; }, set: function(value) { - if ("number" != typeof value) throw new TypeError("Lines must be set to a number."); + if ("number" != typeof value) throw TypeError("Lines must be set to a number."); _lines = value; } }, @@ -5088,7 +5088,7 @@ return _regionAnchorY; }, set: function(value) { - if (!isValidPercentValue(value)) throw new Error("RegionAnchorX must be between 0 and 100."); + if (!isValidPercentValue(value)) throw Error("RegionAnchorX must be between 0 and 100."); _regionAnchorY = value; } }, @@ -5098,7 +5098,7 @@ return _regionAnchorX; }, set: function(value) { - if (!isValidPercentValue(value)) throw new Error("RegionAnchorY must be between 0 and 100."); + if (!isValidPercentValue(value)) throw Error("RegionAnchorY must be between 0 and 100."); _regionAnchorX = value; } }, @@ -5108,7 +5108,7 @@ return _viewportAnchorY; }, set: function(value) { - if (!isValidPercentValue(value)) throw new Error("ViewportAnchorY must be between 0 and 100."); + if (!isValidPercentValue(value)) throw Error("ViewportAnchorY must be between 0 and 100."); _viewportAnchorY = value; } }, @@ -5118,7 +5118,7 @@ return _viewportAnchorX; }, set: function(value) { - if (!isValidPercentValue(value)) throw new Error("ViewportAnchorX must be between 0 and 100."); + if (!isValidPercentValue(value)) throw Error("ViewportAnchorX must be between 0 and 100."); _viewportAnchorX = value; } }, @@ -5151,7 +5151,7 @@ for(var lookup = [], revLookup = [], Arr = "undefined" != typeof Uint8Array ? Uint8Array : Array, code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i3 = 0, len1 = code.length; i3 < len1; ++i3)lookup[i3] = code[i3], revLookup[code.charCodeAt(i3)] = i3; function getLens(b64) { var len = b64.length; - if (len % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); + if (len % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4"); var validLen = b64.indexOf("="); -1 === validLen && (validLen = len); var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; @@ -5173,13 +5173,13 @@ "use strict"; var base64 = __webpack_require__(4782), ieee754 = __webpack_require__(8898), customInspectSymbol = "function" == typeof Symbol && "function" == typeof Symbol.for ? Symbol.for("nodejs.util.inspect.custom") : null; function createBuffer(length) { - if (length > 0x7fffffff) throw new RangeError('The value "' + length + '" is invalid for option "size"'); + if (length > 0x7fffffff) throw RangeError('The value "' + length + '" is invalid for option "size"'); var buf = new Uint8Array(length); return Object.setPrototypeOf(buf, Buffer.prototype), buf; } function Buffer(arg, encodingOrOffset, length) { if ("number" == typeof arg) { - if ("string" == typeof encodingOrOffset) throw new TypeError('The "string" argument must be of type string. Received type number'); + if ("string" == typeof encodingOrOffset) throw TypeError('The "string" argument must be of type string. Received type number'); return allocUnsafe(arg); } return from(arg, encodingOrOffset, length); @@ -5187,25 +5187,25 @@ function from(value, encodingOrOffset, length) { if ("string" == typeof value) return fromString(value, encodingOrOffset); if (ArrayBuffer.isView(value)) return fromArrayLike(value); - if (null == value) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); + if (null == value) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer) || "undefined" != typeof SharedArrayBuffer && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if ("number" == typeof value) throw new TypeError('The "value" argument must not be of type number. Received type number'); + if ("number" == typeof value) throw TypeError('The "value" argument must not be of type number. Received type number'); var valueOf = value.valueOf && value.valueOf(); if (null != valueOf && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); var b = fromObject(value); if (b) return b; if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof value[Symbol.toPrimitive]) return Buffer.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); + throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } function assertSize(size) { - if ("number" != typeof size) throw new TypeError('"size" argument must be of type number'); - if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); + if ("number" != typeof size) throw TypeError('"size" argument must be of type number'); + if (size < 0) throw RangeError('The value "' + size + '" is invalid for option "size"'); } function allocUnsafe(size) { return assertSize(size), createBuffer(size < 0 ? 0 : 0 | checked(size)); } function fromString(string, encoding) { - if (("string" != typeof encoding || "" === encoding) && (encoding = "utf8"), !Buffer.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding); + if (("string" != typeof encoding || "" === encoding) && (encoding = "utf8"), !Buffer.isEncoding(encoding)) throw TypeError("Unknown encoding: " + encoding); var length = 0 | byteLength1(string, encoding), buf = createBuffer(length), actual = buf.write(string, encoding); return actual !== length && (buf = buf.slice(0, actual)), buf; } @@ -5215,8 +5215,8 @@ } function fromArrayBuffer(array, byteOffset, length) { var buf; - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); + if (byteOffset < 0 || array.byteLength < byteOffset) throw RangeError('"offset" is outside of buffer bounds'); + if (array.byteLength < byteOffset + (length || 0)) throw RangeError('"length" is outside of buffer bounds'); return Object.setPrototypeOf(buf = void 0 === byteOffset && void 0 === length ? new Uint8Array(array) : void 0 === length ? new Uint8Array(array, byteOffset) : new Uint8Array(array, byteOffset, length), Buffer.prototype), buf; } function fromObject(obj) { @@ -5227,13 +5227,13 @@ return void 0 !== obj.length ? "number" != typeof obj.length || (obj1 = obj.length) != obj1 ? createBuffer(0) : fromArrayLike(obj) : "Buffer" === obj.type && Array.isArray(obj.data) ? fromArrayLike(obj.data) : void 0; } function checked(length) { - if (length >= 0x7fffffff) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 0x7fffffff.toString(16) + " bytes"); + if (length >= 0x7fffffff) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 0x7fffffff.toString(16) + " bytes"); return 0 | length; } function byteLength1(string, encoding) { if (Buffer.isBuffer(string)) return string.length; if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if ("string" != typeof string) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); + if ("string" != typeof string) throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); var len = string.length, mustMatch = arguments.length > 2 && !0 === arguments[2]; if (!mustMatch && 0 === len) return 0; for(var loweredCase = !1;;)switch(encoding){ @@ -5280,7 +5280,7 @@ case "utf-16le": return utf16leSlice(this, start, end); default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); + if (loweredCase) throw TypeError("Unknown encoding: " + encoding); encoding = (encoding + "").toLowerCase(), loweredCase = !0; } } @@ -5302,7 +5302,7 @@ if ("number" == typeof val) return (val &= 0xff, "function" == typeof Uint8Array.prototype.indexOf) ? dir ? Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) : Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) : arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir); - throw new TypeError("val must be string, number or Buffer"); + throw TypeError("val must be string, number or Buffer"); } function arrayIndexOf(arr, val, byteOffset, encoding, dir) { var i4, indexSize = 1, arrLength = arr.length, valLength = val.length; @@ -5408,16 +5408,16 @@ return res; } function checkOffset(offset, ext, length) { - if (offset % 1 != 0 || offset < 0) throw new RangeError("offset is not uint"); - if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); + if (offset % 1 != 0 || offset < 0) throw RangeError("offset is not uint"); + if (offset + ext > length) throw RangeError("Trying to access beyond buffer length"); } function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError("Index out of range"); + if (!Buffer.isBuffer(buf)) throw TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) throw RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw RangeError("Index out of range"); } function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length || offset < 0) throw new RangeError("Index out of range"); + if (offset + ext > buf.length || offset < 0) throw RangeError("Index out of range"); } function writeFloat(buf, value, offset, littleEndian, noAssert) { return value = +value, offset >>>= 0, noAssert || checkIEEE754(buf, value, offset, 4, 3.4028234663852886e38, -340282346638528860000000000000000000000), ieee754.write(buf, value, offset, littleEndian, 23, 4), offset + 4; @@ -5460,7 +5460,7 @@ }, Buffer.isBuffer = function(b) { return null != b && !0 === b._isBuffer && b !== Buffer.prototype; }, Buffer.compare = function(a, b) { - if (isInstance(a, Uint8Array) && (a = Buffer.from(a, a.offset, a.byteLength)), isInstance(b, Uint8Array) && (b = Buffer.from(b, b.offset, b.byteLength)), !Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (isInstance(a, Uint8Array) && (a = Buffer.from(a, a.offset, a.byteLength)), isInstance(b, Uint8Array) && (b = Buffer.from(b, b.offset, b.byteLength)), !Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); if (a === b) return 0; for(var x = a.length, y = b.length, i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { x = a[i], y = b[i]; @@ -5485,43 +5485,43 @@ return !1; } }, Buffer.concat = function(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (!Array.isArray(list)) throw TypeError('"list" argument must be an Array of Buffers'); if (0 === list.length) return Buffer.alloc(0); if (void 0 === length) for(i = 0, length = 0; i < list.length; ++i)length += list[i].length; var i, buffer = Buffer.allocUnsafe(length), pos = 0; for(i = 0; i < list.length; ++i){ var buf = list[i]; - if (isInstance(buf, Uint8Array) && (buf = Buffer.from(buf)), !Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (isInstance(buf, Uint8Array) && (buf = Buffer.from(buf)), !Buffer.isBuffer(buf)) throw TypeError('"list" argument must be an Array of Buffers'); buf.copy(buffer, pos), pos += buf.length; } return buffer; }, Buffer.byteLength = byteLength1, Buffer.prototype._isBuffer = !0, Buffer.prototype.swap16 = function() { var len = this.length; - if (len % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); + if (len % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits"); for(var i = 0; i < len; i += 2)swap(this, i, i + 1); return this; }, Buffer.prototype.swap32 = function() { var len = this.length; - if (len % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); + if (len % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits"); for(var i = 0; i < len; i += 4)swap(this, i, i + 3), swap(this, i + 1, i + 2); return this; }, Buffer.prototype.swap64 = function() { var len = this.length; - if (len % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); + if (len % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits"); for(var i = 0; i < len; i += 8)swap(this, i, i + 7), swap(this, i + 1, i + 6), swap(this, i + 2, i + 5), swap(this, i + 3, i + 4); return this; }, Buffer.prototype.toString = function() { var length = this.length; return 0 === length ? "" : 0 === arguments.length ? utf8Slice(this, 0, length) : slowToString.apply(this, arguments); }, Buffer.prototype.toLocaleString = Buffer.prototype.toString, Buffer.prototype.equals = function(b) { - if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); + if (!Buffer.isBuffer(b)) throw TypeError("Argument must be a Buffer"); return this === b || 0 === Buffer.compare(this, b); }, Buffer.prototype.inspect = function() { var str = "", max = exports.INSPECT_MAX_BYTES; return str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(), this.length > max && (str += " ... "), ""; }, customInspectSymbol && (Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect), Buffer.prototype.compare = function(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array) && (target = Buffer.from(target, target.offset, target.byteLength)), !Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError("out of range index"); + if (isInstance(target, Uint8Array) && (target = Buffer.from(target, target.offset, target.byteLength)), !Buffer.isBuffer(target)) throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); + if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw RangeError("out of range index"); if (thisStart >= thisEnd && start >= end) return 0; if (thisStart >= thisEnd) return -1; if (start >= end) return 1; @@ -5541,9 +5541,9 @@ if (void 0 === offset) encoding = "utf8", length = this.length, offset = 0; else if (void 0 === length && "string" == typeof offset) encoding = offset, length = this.length, offset = 0; else if (isFinite(offset)) offset >>>= 0, isFinite(length) ? (length >>>= 0, void 0 === encoding && (encoding = "utf8")) : (encoding = length, length = void 0); - else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); + else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); var remaining = this.length - offset; - if ((void 0 === length || length > remaining) && (length = remaining), string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError("Attempt to write outside buffer bounds"); + if ((void 0 === length || length > remaining) && (length = remaining), string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw RangeError("Attempt to write outside buffer bounds"); encoding || (encoding = "utf8"); for(var loweredCase = !1;;)switch(encoding){ case "hex": @@ -5564,7 +5564,7 @@ case "utf-16le": return ucs2Write(this, string, offset, length); default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); + if (loweredCase) throw TypeError("Unknown encoding: " + encoding); encoding = ("" + encoding).toLowerCase(), loweredCase = !0; } }, Buffer.prototype.toJSON = function() { @@ -5686,11 +5686,11 @@ }, Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) { return writeDouble(this, value, offset, !1, noAssert); }, Buffer.prototype.copy = function(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError("argument should be a Buffer"); + if (!Buffer.isBuffer(target)) throw TypeError("argument should be a Buffer"); if (start || (start = 0), end || 0 === end || (end = this.length), targetStart >= target.length && (targetStart = target.length), targetStart || (targetStart = 0), end > 0 && end < start && (end = start), end === start || 0 === target.length || 0 === this.length) return 0; - if (targetStart < 0) throw new RangeError("targetStart out of bounds"); - if (start < 0 || start >= this.length) throw new RangeError("Index out of range"); - if (end < 0) throw new RangeError("sourceEnd out of bounds"); + if (targetStart < 0) throw RangeError("targetStart out of bounds"); + if (start < 0 || start >= this.length) throw RangeError("Index out of range"); + if (end < 0) throw RangeError("sourceEnd out of bounds"); end > this.length && (end = this.length), target.length - targetStart < end - start && (end = target.length - targetStart + start); var len = end - start; if (this === target && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(targetStart, start, end); @@ -5699,19 +5699,19 @@ return len; }, Buffer.prototype.fill = function(val, start, end, encoding) { if ("string" == typeof val) { - if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, end = this.length), void 0 !== encoding && "string" != typeof encoding) throw new TypeError("encoding must be a string"); - if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding); + if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, end = this.length), void 0 !== encoding && "string" != typeof encoding) throw TypeError("encoding must be a string"); + if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) throw TypeError("Unknown encoding: " + encoding); if (1 === val.length) { var i, code = val.charCodeAt(0); ("utf8" === encoding && code < 128 || "latin1" === encoding) && (val = code); } } else "number" == typeof val ? val &= 255 : "boolean" == typeof val && (val = Number(val)); - if (start < 0 || this.length < start || this.length < end) throw new RangeError("Out of range index"); + if (start < 0 || this.length < start || this.length < end) throw RangeError("Out of range index"); if (end <= start) return this; if (start >>>= 0, end = void 0 === end ? this.length : end >>> 0, val || (val = 0), "number" == typeof val) for(i = start; i < end; ++i)this[i] = val; else { var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding), len = bytes.length; - if (0 === len) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + if (0 === len) throw TypeError('The value "' + val + '" is invalid for argument "value"'); for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; } return this; @@ -5747,7 +5747,7 @@ } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break; bytes.push(codePoint >> 0x12 | 0xf0, codePoint >> 0xc & 0x3f | 0x80, codePoint >> 0x6 & 0x3f | 0x80, 0x3f & codePoint | 0x80); - } else throw new Error("Invalid code point"); + } else throw Error("Invalid code point"); } return bytes; } @@ -5774,7 +5774,7 @@ return obj instanceof type || null != obj && null != obj.constructor && null != obj.constructor.name && obj.constructor.name === type.name; } var hexSliceLookupTable = function() { - for(var alphabet = "0123456789abcdef", table = new Array(256), i = 0; i < 16; ++i)for(var i16 = 16 * i, j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; + for(var alphabet = "0123456789abcdef", table = Array(256), i = 0; i < 16; ++i)for(var i16 = 16 * i, j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; return table; }(); }, @@ -5800,7 +5800,7 @@ 7326: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; function _assertThisInitialized(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } __webpack_require__.d(__webpack_exports__, { @@ -5862,7 +5862,7 @@ }); var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9611); function _inherits(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js index 3f087a53a83..ef3c48763f9 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js @@ -6,7 +6,7 @@ presto_version && (presto_version = Number(presto_version[1])), presto_version && presto_version >= 15 && (presto = !1, webkit = !0); var flipCtrlCmd = mac && (qtwebkit || presto && (null == presto_version || presto_version < 12.11)), captureRightClick = gecko || ie && ie_version >= 9; function classTest(cls) { - return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); + return RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); } var rmClass = function(node, cls) { var current = node.className, match = classTest(cls).exec(current); @@ -417,7 +417,7 @@ this.pos = this.start = 0, this.string = string, this.tabSize = tabSize || 8, this.lastColumnPos = this.lastColumnValue = 0, this.lineStart = 0, this.lineOracle = lineOracle; }; function getLine(doc, n) { - if ((n -= doc.first) < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); + if ((n -= doc.first) < 0 || n >= doc.size) throw Error("There is no line " + (n + doc.first) + " in the document."); for(var chunk = doc; !chunk.lines;)for(var i = 0;; ++i){ var child = chunk.children[i], sz = child.chunkSize(); if (n < sz) { @@ -633,7 +633,7 @@ var style = mode.token(stream, state); if (stream.pos > stream.start) return style; } - throw new Error("Mode " + mode.name + " failed to advance stream."); + throw Error("Mode " + mode.name + " failed to advance stream."); } Context.prototype.lookAhead = function(n) { var line = this.doc.getLine(this.line + n); @@ -670,7 +670,7 @@ if (!lineClass) break; type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); var prop = lineClass[1] ? "bgClass" : "textClass"; - null == output[prop] ? output[prop] = lineClass[2] : new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)").test(output[prop]) || (output[prop] += " " + lineClass[2]); + null == output[prop] ? output[prop] = lineClass[2] : RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)").test(output[prop]) || (output[prop] += " " + lineClass[2]); } return type; } @@ -2425,7 +2425,7 @@ propagate(doc1, null, !0); } function attachDoc(cm, doc) { - if (doc.cm) throw new Error("This document is already in use."); + if (doc.cm) throw Error("This document is already in use."); cm.doc = doc, doc.cm = cm, estimateLineHeights(cm), loadMode(cm), setDirectionClass(cm), cm.options.direction = doc.direction, cm.options.lineWrapping || findMaxLine(cm), cm.options.mode = doc.modeOption, regChange(cm); } function setDirectionClass(cm) { @@ -2998,7 +2998,7 @@ if (marker.replacedWith && (marker.collapsed = !0, marker.widgetNode = eltP("span", [ marker.replacedWith ], "CodeMirror-widget"), options.handleMouseEvents || marker.widgetNode.setAttribute("cm-ignore-events", "true"), options.insertLeft && (marker.widgetNode.insertLeft = !0)), marker.collapsed) { - if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) throw new Error("Inserting collapsed marker partially overlapping an existing one"); + if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) throw Error("Inserting collapsed marker partially overlapping an existing one"); sawCollapsedSpans = !0; } marker.addToHistory && addChangeToHistory(doc, { @@ -3657,7 +3657,7 @@ else if (/^a(lt)?$/i.test(mod)) alt = !0; else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = !0; else if (/^s(hift)?$/i.test(mod)) shift = !0; - else throw new Error("Unrecognized modifier name: " + mod); + else throw Error("Unrecognized modifier name: " + mod); } return alt && (name = "Alt-" + name), ctrl && (name = "Ctrl-" + name), cmd && (name = "Cmd-" + name), shift && (name = "Shift-" + name), name; } @@ -5148,11 +5148,11 @@ for(var i = newBreaks.length - 1; i >= 0; i--)replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } }), option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function(cm, val, old) { - cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"), old != Init && cm.refresh(); + cm.state.specialChars = RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"), old != Init && cm.refresh(); }), option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) { return cm.refresh(); }, !0), option("electricChars", !0), option("inputStyle", mobile ? "contenteditable" : "textarea", function() { - throw new Error("inputStyle can not (yet) be changed in a running editor"); + throw Error("inputStyle can not (yet) be changed in a running editor"); }, !0), option("spellcheck", !1, function(cm, val) { return cm.getInputField().spellcheck = val; }, !0), option("autocorrect", !1, function(cm, val) { @@ -5216,7 +5216,7 @@ }, addOverlay: methodOp(function(spec, options) { var mode = spec.token ? spec : CodeMirror3.getMode(this.options, spec); - if (mode.startState) throw new Error("Overlays may not be stateful."); + if (mode.startState) throw Error("Overlays may not be stateful."); (function(array, value, score) { for(var pos = 0, priority = score(value); pos < array.length && score(array[pos]) <= priority;)pos++; array.splice(pos, 0, value); @@ -5593,7 +5593,7 @@ i == keys.length - 1 ? (name = keys.join(" "), val = value) : (name = keys.slice(0, i + 1).join(" "), val = "..."); var prev = copy[name]; if (prev) { - if (prev != val) throw new Error("Inconsistent bindings for " + name); + if (prev != val) throw Error("Inconsistent bindings for " + name); } else copy[name] = val; } delete keymap[keyname]; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js index 603ef774979..13b977a2787 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js @@ -118,7 +118,7 @@ for(var t2 = [], f1 = [], n1 = "undefined" != typeof Uint8Array ? Uint8Array : Array, i1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o1 = 0, u1 = i1.length; o1 < u1; ++o1)t2[o1] = i1[o1], f1[i1.charCodeAt(o1)] = o1; function getLens(e) { var r = e.length; - if (r % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); + if (r % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4"); var t = e.indexOf("="); -1 === t && (t = r); var f = t === r ? 0 : 4 - t % 4; @@ -140,13 +140,13 @@ "use strict"; var f2 = t4(991), n2 = t4(759), i2 = "function" == typeof Symbol && "function" == typeof Symbol.for ? Symbol.for("nodejs.util.inspect.custom") : null; function createBuffer(e) { - if (e > 2147483647) throw new RangeError('The value "' + e + '" is invalid for option "size"'); + if (e > 2147483647) throw RangeError('The value "' + e + '" is invalid for option "size"'); var r = new Uint8Array(e); return Object.setPrototypeOf(r, Buffer.prototype), r; } function Buffer(e, r, t) { if ("number" == typeof e) { - if ("string" == typeof r) throw new TypeError('The "string" argument must be of type string. Received type number'); + if ("string" == typeof r) throw TypeError('The "string" argument must be of type string. Received type number'); return allocUnsafe(e); } return from(e, r, t); @@ -154,25 +154,25 @@ function from(e, r, t) { if ("string" == typeof e) return fromString(e, r); if (ArrayBuffer.isView(e)) return fromArrayLike(e); - if (null == e) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e); + if (null == e) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e); if (isInstance(e, ArrayBuffer) || e && isInstance(e.buffer, ArrayBuffer) || "undefined" != typeof SharedArrayBuffer && (isInstance(e, SharedArrayBuffer) || e && isInstance(e.buffer, SharedArrayBuffer))) return fromArrayBuffer(e, r, t); - if ("number" == typeof e) throw new TypeError('The "value" argument must not be of type number. Received type number'); + if ("number" == typeof e) throw TypeError('The "value" argument must not be of type number. Received type number'); var f = e.valueOf && e.valueOf(); if (null != f && f !== e) return Buffer.from(f, r, t); var n = fromObject(e); if (n) return n; if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof e[Symbol.toPrimitive]) return Buffer.from(e[Symbol.toPrimitive]("string"), r, t); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e); + throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e); } function assertSize(e) { - if ("number" != typeof e) throw new TypeError('"size" argument must be of type number'); - if (e < 0) throw new RangeError('The value "' + e + '" is invalid for option "size"'); + if ("number" != typeof e) throw TypeError('"size" argument must be of type number'); + if (e < 0) throw RangeError('The value "' + e + '" is invalid for option "size"'); } function allocUnsafe(e) { return assertSize(e), createBuffer(e < 0 ? 0 : 0 | checked(e)); } function fromString(e, r) { - if (("string" != typeof r || "" === r) && (r = "utf8"), !Buffer.isEncoding(r)) throw new TypeError("Unknown encoding: " + r); + if (("string" != typeof r || "" === r) && (r = "utf8"), !Buffer.isEncoding(r)) throw TypeError("Unknown encoding: " + r); var t = 0 | byteLength(e, r), f = createBuffer(t), n = f.write(e, r); return n !== t && (f = f.slice(0, n)), f; } @@ -182,8 +182,8 @@ } function fromArrayBuffer(e, r, t) { var f; - if (r < 0 || e.byteLength < r) throw new RangeError('"offset" is outside of buffer bounds'); - if (e.byteLength < r + (t || 0)) throw new RangeError('"length" is outside of buffer bounds'); + if (r < 0 || e.byteLength < r) throw RangeError('"offset" is outside of buffer bounds'); + if (e.byteLength < r + (t || 0)) throw RangeError('"length" is outside of buffer bounds'); return Object.setPrototypeOf(f = void 0 === r && void 0 === t ? new Uint8Array(e) : void 0 === t ? new Uint8Array(e, r) : new Uint8Array(e, r, t), Buffer.prototype), f; } function fromObject(e) { @@ -194,13 +194,13 @@ return void 0 !== e.length ? "number" != typeof e.length || (e4 = e.length) != e4 ? createBuffer(0) : fromArrayLike(e) : "Buffer" === e.type && Array.isArray(e.data) ? fromArrayLike(e.data) : void 0; } function checked(e) { - if (e >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes"); + if (e >= 2147483647) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes"); return 0 | e; } function byteLength(e, r) { if (Buffer.isBuffer(e)) return e.length; if (ArrayBuffer.isView(e) || isInstance(e, ArrayBuffer)) return e.byteLength; - if ("string" != typeof e) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e); + if ("string" != typeof e) throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e); var t = e.length, f = arguments.length > 2 && !0 === arguments[2]; if (!f && 0 === t) return 0; for(var n = !1;;)switch(r){ @@ -247,7 +247,7 @@ case "utf-16le": return utf16leSlice(this, r, t); default: - if (f) throw new TypeError("Unknown encoding: " + e); + if (f) throw TypeError("Unknown encoding: " + e); e = (e + "").toLowerCase(), f = !0; } } @@ -269,7 +269,7 @@ if ("number" == typeof r) return (r &= 255, "function" == typeof Uint8Array.prototype.indexOf) ? n ? Uint8Array.prototype.indexOf.call(e, r, t) : Uint8Array.prototype.lastIndexOf.call(e, r, t) : arrayIndexOf(e, [ r ], t, f, n); - throw new TypeError("val must be string, number or Buffer"); + throw TypeError("val must be string, number or Buffer"); } function arrayIndexOf(e6, r4, t, f, n) { var a, i = 1, o = e6.length, u = r4.length; @@ -375,16 +375,16 @@ return n; } function checkOffset(e, r, t) { - if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); - if (e + r > t) throw new RangeError("Trying to access beyond buffer length"); + if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint"); + if (e + r > t) throw RangeError("Trying to access beyond buffer length"); } function checkInt(e, r, t, f, n, i) { - if (!Buffer.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (r > n || r < i) throw new RangeError('"value" argument is out of bounds'); - if (t + f > e.length) throw new RangeError("Index out of range"); + if (!Buffer.isBuffer(e)) throw TypeError('"buffer" argument must be a Buffer instance'); + if (r > n || r < i) throw RangeError('"value" argument is out of bounds'); + if (t + f > e.length) throw RangeError("Index out of range"); } function checkIEEE754(e, r, t, f, n, i) { - if (t + f > e.length || t < 0) throw new RangeError("Index out of range"); + if (t + f > e.length || t < 0) throw RangeError("Index out of range"); } function writeFloat(e, r, t, f, i) { return r = +r, t >>>= 0, i || checkIEEE754(e, r, t, 4, 34028234663852886e22, -340282346638528860000000000000000000000), n2.write(e, r, t, f, 23, 4), t + 4; @@ -427,7 +427,7 @@ }, Buffer.isBuffer = function(e) { return null != e && !0 === e._isBuffer && e !== Buffer.prototype; }, Buffer.compare = function(e, r) { - if (isInstance(e, Uint8Array) && (e = Buffer.from(e, e.offset, e.byteLength)), isInstance(r, Uint8Array) && (r = Buffer.from(r, r.offset, r.byteLength)), !Buffer.isBuffer(e) || !Buffer.isBuffer(r)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (isInstance(e, Uint8Array) && (e = Buffer.from(e, e.offset, e.byteLength)), isInstance(r, Uint8Array) && (r = Buffer.from(r, r.offset, r.byteLength)), !Buffer.isBuffer(e) || !Buffer.isBuffer(r)) throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); if (e === r) return 0; for(var t = e.length, f = r.length, n = 0, i = Math.min(t, f); n < i; ++n)if (e[n] !== r[n]) { t = e[n], f = r[n]; @@ -452,43 +452,43 @@ return !1; } }, Buffer.concat = function(e, r) { - if (!Array.isArray(e)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (!Array.isArray(e)) throw TypeError('"list" argument must be an Array of Buffers'); if (0 === e.length) return Buffer.alloc(0); if (void 0 === r) for(t = 0, r = 0; t < e.length; ++t)r += e[t].length; var t, f = Buffer.allocUnsafe(r), n = 0; for(t = 0; t < e.length; ++t){ var i = e[t]; - if (isInstance(i, Uint8Array) && (i = Buffer.from(i)), !Buffer.isBuffer(i)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (isInstance(i, Uint8Array) && (i = Buffer.from(i)), !Buffer.isBuffer(i)) throw TypeError('"list" argument must be an Array of Buffers'); i.copy(f, n), n += i.length; } return f; }, Buffer.byteLength = byteLength, Buffer.prototype._isBuffer = !0, Buffer.prototype.swap16 = function() { var e = this.length; - if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); + if (e % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits"); for(var r = 0; r < e; r += 2)swap(this, r, r + 1); return this; }, Buffer.prototype.swap32 = function() { var e = this.length; - if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); + if (e % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits"); for(var r = 0; r < e; r += 4)swap(this, r, r + 3), swap(this, r + 1, r + 2); return this; }, Buffer.prototype.swap64 = function() { var e = this.length; - if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); + if (e % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits"); for(var r = 0; r < e; r += 8)swap(this, r, r + 7), swap(this, r + 1, r + 6), swap(this, r + 2, r + 5), swap(this, r + 3, r + 4); return this; }, Buffer.prototype.toString = function() { var e = this.length; return 0 === e ? "" : 0 === arguments.length ? utf8Slice(this, 0, e) : slowToString.apply(this, arguments); }, Buffer.prototype.toLocaleString = Buffer.prototype.toString, Buffer.prototype.equals = function(e) { - if (!Buffer.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); + if (!Buffer.isBuffer(e)) throw TypeError("Argument must be a Buffer"); return this === e || 0 === Buffer.compare(this, e); }, Buffer.prototype.inspect = function() { var e = "", t = r3.INSPECT_MAX_BYTES; return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), ""; }, i2 && (Buffer.prototype[i2] = Buffer.prototype.inspect), Buffer.prototype.compare = function(e, r, t, f, n) { - if (isInstance(e, Uint8Array) && (e = Buffer.from(e, e.offset, e.byteLength)), !Buffer.isBuffer(e)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e); - if (void 0 === r && (r = 0), void 0 === t && (t = e ? e.length : 0), void 0 === f && (f = 0), void 0 === n && (n = this.length), r < 0 || t > e.length || f < 0 || n > this.length) throw new RangeError("out of range index"); + if (isInstance(e, Uint8Array) && (e = Buffer.from(e, e.offset, e.byteLength)), !Buffer.isBuffer(e)) throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e); + if (void 0 === r && (r = 0), void 0 === t && (t = e ? e.length : 0), void 0 === f && (f = 0), void 0 === n && (n = this.length), r < 0 || t > e.length || f < 0 || n > this.length) throw RangeError("out of range index"); if (f >= n && r >= t) return 0; if (f >= n) return -1; if (r >= t) return 1; @@ -508,9 +508,9 @@ if (void 0 === r) f = "utf8", t = this.length, r = 0; else if (void 0 === t && "string" == typeof r) f = r, t = this.length, r = 0; else if (isFinite(r)) r >>>= 0, isFinite(t) ? (t >>>= 0, void 0 === f && (f = "utf8")) : (f = t, t = void 0); - else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); + else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); var n = this.length - r; - if ((void 0 === t || t > n) && (t = n), e.length > 0 && (t < 0 || r < 0) || r > this.length) throw new RangeError("Attempt to write outside buffer bounds"); + if ((void 0 === t || t > n) && (t = n), e.length > 0 && (t < 0 || r < 0) || r > this.length) throw RangeError("Attempt to write outside buffer bounds"); f || (f = "utf8"); for(var i = !1;;)switch(f){ case "hex": @@ -531,7 +531,7 @@ case "utf-16le": return ucs2Write(this, e, r, t); default: - if (i) throw new TypeError("Unknown encoding: " + f); + if (i) throw TypeError("Unknown encoding: " + f); f = ("" + f).toLowerCase(), i = !0; } }, Buffer.prototype.toJSON = function() { @@ -653,11 +653,11 @@ }, Buffer.prototype.writeDoubleBE = function(e, r, t) { return writeDouble(this, e, r, !1, t); }, Buffer.prototype.copy = function(e, r, t, f) { - if (!Buffer.isBuffer(e)) throw new TypeError("argument should be a Buffer"); + if (!Buffer.isBuffer(e)) throw TypeError("argument should be a Buffer"); if (t || (t = 0), f || 0 === f || (f = this.length), r >= e.length && (r = e.length), r || (r = 0), f > 0 && f < t && (f = t), f === t || 0 === e.length || 0 === this.length) return 0; - if (r < 0) throw new RangeError("targetStart out of bounds"); - if (t < 0 || t >= this.length) throw new RangeError("Index out of range"); - if (f < 0) throw new RangeError("sourceEnd out of bounds"); + if (r < 0) throw RangeError("targetStart out of bounds"); + if (t < 0 || t >= this.length) throw RangeError("Index out of range"); + if (f < 0) throw RangeError("sourceEnd out of bounds"); f > this.length && (f = this.length), e.length - r < f - t && (f = e.length - r + t); var n = f - t; if (this === e && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(r, t, f); @@ -666,19 +666,19 @@ return n; }, Buffer.prototype.fill = function(e, r, t, f) { if ("string" == typeof e) { - if ("string" == typeof r ? (f = r, r = 0, t = this.length) : "string" == typeof t && (f = t, t = this.length), void 0 !== f && "string" != typeof f) throw new TypeError("encoding must be a string"); - if ("string" == typeof f && !Buffer.isEncoding(f)) throw new TypeError("Unknown encoding: " + f); + if ("string" == typeof r ? (f = r, r = 0, t = this.length) : "string" == typeof t && (f = t, t = this.length), void 0 !== f && "string" != typeof f) throw TypeError("encoding must be a string"); + if ("string" == typeof f && !Buffer.isEncoding(f)) throw TypeError("Unknown encoding: " + f); if (1 === e.length) { var i, n = e.charCodeAt(0); ("utf8" === f && n < 128 || "latin1" === f) && (e = n); } } else "number" == typeof e ? e &= 255 : "boolean" == typeof e && (e = Number(e)); - if (r < 0 || this.length < r || this.length < t) throw new RangeError("Out of range index"); + if (r < 0 || this.length < r || this.length < t) throw RangeError("Out of range index"); if (t <= r) return this; if (r >>>= 0, t = void 0 === t ? this.length : t >>> 0, e || (e = 0), "number" == typeof e) for(i = r; i < t; ++i)this[i] = e; else { var o = Buffer.isBuffer(e) ? e : Buffer.from(e, f), u = o.length; - if (0 === u) throw new TypeError('The value "' + e + '" is invalid for argument "value"'); + if (0 === u) throw TypeError('The value "' + e + '" is invalid for argument "value"'); for(i = 0; i < t - r; ++i)this[i + r] = o[i % u]; } return this; @@ -714,7 +714,7 @@ } else if (t < 1114112) { if ((r -= 4) < 0) break; i.push(t >> 18 | 240, t >> 12 & 63 | 128, t >> 6 & 63 | 128, 63 & t | 128); - } else throw new Error("Invalid code point"); + } else throw Error("Invalid code point"); } return i; } @@ -741,7 +741,7 @@ return e instanceof r || null != e && null != e.constructor && null != e.constructor.name && e.constructor.name === r.name; } var s1 = function() { - for(var e = "0123456789abcdef", r = new Array(256), t = 0; t < 16; ++t)for(var f = 16 * t, n = 0; n < 16; ++n)r[f + n] = e[t] + e[n]; + for(var e = "0123456789abcdef", r = Array(256), t = 0; t < 16; ++t)for(var f = 16 * t, n = 0; n < 16; ++n)r[f + n] = e[t] + e[n]; return r; }(); }, @@ -789,10 +789,10 @@ 162: function(e12) { var r8, n, u, t7 = e12.exports = {}; function defaultSetTimout() { - throw new Error("setTimeout has not been defined"); + throw Error("setTimeout has not been defined"); } function defaultClearTimeout() { - throw new Error("clearTimeout has not been defined"); + throw Error("clearTimeout has not been defined"); } function runTimeout(e) { if (r8 === setTimeout) return setTimeout(e, 0); @@ -851,7 +851,7 @@ } function noop() {} t7.nextTick = function(e) { - var t = new Array(arguments.length - 1); + var t = Array(arguments.length - 1); if (arguments.length > 1) for(var r = 1; r < arguments.length; r++)t[r - 1] = arguments[r]; i.push(new Item(e, t)), 1 !== i.length || o || runTimeout(drainQueue); }, Item.prototype.run = function() { @@ -859,11 +859,11 @@ }, t7.title = "browser", t7.browser = !0, t7.env = {}, t7.argv = [], t7.version = "", t7.versions = {}, t7.on = noop, t7.addListener = noop, t7.once = noop, t7.off = noop, t7.removeListener = noop, t7.removeAllListeners = noop, t7.emit = noop, t7.prependListener = noop, t7.prependOnceListener = noop, t7.listeners = function(e) { return []; }, t7.binding = function(e) { - throw new Error("process.binding is not supported"); + throw Error("process.binding is not supported"); }, t7.cwd = function() { return "/"; }, t7.chdir = function(e) { - throw new Error("process.chdir is not supported"); + throw Error("process.chdir is not supported"); }, t7.umask = function() { return 0; }; @@ -894,7 +894,7 @@ 901: function(r10) { r10.exports = function(r, e, o) { if (r.filter) return r.filter(e, o); - if (null == r || "function" != typeof e) throw new TypeError(); + if (null == r || "function" != typeof e) throw TypeError(); for(var n = [], i = 0; i < r.length; i++)if (t.call(r, i)) { var a = r[i]; e.call(o, a, i, r) && n.push(a); @@ -1290,7 +1290,7 @@ 219: function(r18) { var t = Object.prototype.hasOwnProperty, e = Object.prototype.toString; r18.exports = function(r, o, n) { - if ("[object Function]" !== e.call(o)) throw new TypeError("iterator must be a function"); + if ("[object Function]" !== e.call(o)) throw TypeError("iterator must be a function"); var i = r.length; if (i === +i) for(var a = 0; a < i; a++)o.call(n, r[a], a, r); else for(var y in r)t.call(r, y) && o.call(n, r[y], y, r); @@ -1301,7 +1301,7 @@ var e = Array.prototype.slice, o = Object.prototype.toString; r19.exports = function(r) { var y, i = this; - if ("function" != typeof i || "[object Function]" !== o.call(i)) throw new TypeError("Function.prototype.bind called on incompatible " + i); + if ("function" != typeof i || "[object Function]" !== o.call(i)) throw TypeError("Function.prototype.bind called on incompatible " + i); for(var a = e.call(arguments, 1), binder = function() { if (!(this instanceof y)) return i.apply(r, a.concat(e.call(arguments))); var t = i.apply(this, a.concat(e.call(arguments))); @@ -1764,7 +1764,7 @@ }, s = i("String.prototype.slice"), c = {}, l = e22(982), d = Object.getPrototypeOf; p && l && d && o4(f, function(r) { var t = new __webpack_require__.g[r](); - if (!(Symbol.toStringTag in t)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + r + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in t)) throw EvalError("this engine has support for Symbol.toStringTag, but " + r + " does not have the property! Please report this."); var e = d(t), o = l(e, Symbol.toStringTag); if (!o) { var n = d(e); @@ -1924,7 +1924,7 @@ Object.defineProperty(t16, r, { enumerable: !1, value: function() { - throw new Error(r + " is not supported in userland"); + throw Error(r + " is not supported in userland"); } }); }); @@ -1966,7 +1966,7 @@ var o = !1; return function() { if (!o) { - if (process.throwDeprecation) throw new Error(e); + if (process.throwDeprecation) throw Error(e); process.traceDeprecation ? console.trace(e) : console.error(e), o = !0; } return r.apply(this, arguments); @@ -1975,7 +1975,7 @@ var i4 = {}, a2 = /^$/; if (process.env.NODE_DEBUG) { var y1 = process.env.NODE_DEBUG; - y1 = y1.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), a2 = new RegExp("^" + y1 + "$", "i"); + a2 = RegExp("^" + (y1 = y1.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase()) + "$", "i"); } function inspect(r, e) { var o = { @@ -2215,16 +2215,16 @@ var f5 = "undefined" != typeof Symbol ? Symbol("util.promisify.custom") : void 0; function callbackifyOnRejected(r, t) { if (!r) { - var e = new Error("Promise was rejected with a falsy value"); + var e = Error("Promise was rejected with a falsy value"); e.reason = r, r = e; } return t(r); } t17.promisify = function(r39) { - if ("function" != typeof r39) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof r39) throw TypeError('The "original" argument must be of type Function'); if (f5 && r39[f5]) { var t20 = r39[f5]; - if ("function" != typeof t20) throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + if ("function" != typeof t20) throw TypeError('The "util.promisify.custom" argument must be of type Function'); return Object.defineProperty(t20, f5, { value: t20, enumerable: !1, @@ -2253,11 +2253,11 @@ configurable: !0 }), Object.defineProperties(t20, o5(r39)); }, t17.promisify.custom = f5, t17.callbackify = function(r40) { - if ("function" != typeof r40) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof r40) throw TypeError('The "original" argument must be of type Function'); function callbackified() { for(var t = [], e = 0; e < arguments.length; e++)t.push(arguments[e]); var o = t.pop(); - if ("function" != typeof o) throw new TypeError("The last argument must be of type Function"); + if ("function" != typeof o) throw TypeError("The last argument must be of type Function"); var n = this, cb = function() { return o.apply(n, arguments); }; @@ -2276,7 +2276,7 @@ p && c && l && o7(f, function(r) { if ("function" == typeof __webpack_require__.g[r]) { var t = new __webpack_require__.g[r](); - if (!(Symbol.toStringTag in t)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + r + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in t)) throw EvalError("this engine has support for Symbol.toStringTag, but " + r + " does not have the property! Please report this."); var e = l(t), o = c(e, Symbol.toStringTag); if (!o) { var n = l(e); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js index c0eff250ba5..d54cdf8e665 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js @@ -1715,7 +1715,7 @@ "undefined" != typeof console && console.warn && console.warn.apply(console, arguments); } function reportError(msg, data) { - var e = new Error(msg); + var e = Error(msg); e.data = data, "object" == typeof console && console.error && console.error(e), setTimeout(function() { throw e; }); @@ -1778,11 +1778,11 @@ useStrictCSP: null }; exports.get = function(key) { - if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); + if (!options.hasOwnProperty(key)) throw Error("Unknown config key: " + key); return options[key]; }, exports.set = function(key, value) { if (options.hasOwnProperty(key)) options[key] = value; - else if (!1 == this.setDefaultValue("", key, value)) throw new Error("Unknown config key: " + key); + else if (!1 == this.setDefaultValue("", key, value)) throw Error("Unknown config key: " + key); "useStrictCSP" == key && dom.useStrictCSP(value); }, exports.all = function() { return lang.copyObject(options); @@ -1790,7 +1790,7 @@ if (options.$moduleUrls[name]) return options.$moduleUrls[name]; var parts = name.split("/"), sep = "snippets" == (component = component || parts[parts.length - 2] || "") ? "/" : "-", base = parts[parts.length - 1]; if ("worker" == component && "-" == sep) { - var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); + var re = RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); base = base.replace(re, ""); } (!base || base == component) && parts.length > 1 && (base = parts[parts.length - 2]); @@ -2493,7 +2493,7 @@ } exports.L = 0, exports.R = 1, exports.EN = 2, exports.ON_R = 3, exports.AN = 4, exports.R_H = 5, exports.B = 6, exports.RLE = 7, exports.DOT = "\xB7", exports.doBidiReorder = function(text, textCharTypes, isRtl) { if (text.length < 2) return {}; - var chars1 = text.split(""), logicalFromVisual = new Array(chars1.length), bidiLevels = new Array(chars1.length), levels1 = []; + var chars1 = text.split(""), logicalFromVisual = Array(chars1.length), bidiLevels = Array(chars1.length), levels1 = []; dir = isRtl ? 1 : 0, function(chars, levels, len, charTypes) { var impTab = dir ? impTab_RTL : impTab_LTR, prevState = null, newClass = null, newLevel = null, newState = 0, action = null, condPos = -1, i = null, ix = null, classes = []; if (!charTypes) for(i = 0, charTypes = []; i < len; i++)charTypes[i] = _getCharacterType(chars[i]); @@ -2922,7 +2922,7 @@ var rule = state[i]; if (rule.defaultToken && (mapping.defaultToken = rule.defaultToken), rule.caseInsensitive && (flag = "gi"), null != rule.regex) { rule.regex instanceof RegExp && (rule.regex = rule.regex.toString().slice(1, -1)); - var adjustedregex = rule.regex, matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2; + var adjustedregex = rule.regex, matchcount = RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2; Array.isArray(rule.token) ? 1 == rule.token.length || 1 == matchcount ? rule.token = rule.token[0] : matchcount - 1 != rule.token.length ? (this.reportError("number of classes and regexp groups doesn't match", { rule: rule, groupCount: matchcount - 1 @@ -2933,7 +2933,7 @@ } ruleRegExps.length || (mapping[0] = 0, ruleRegExps.push("$")), splitterRurles.forEach(function(rule) { rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); - }, this), this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag); + }, this), this.regExps[key] = RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag); } }; (function() { @@ -2972,7 +2972,7 @@ return inChClass ? inChClass = "]" != square : square ? inChClass = !0 : parenClose ? (stack == lastCapture.stack && (lastCapture.end = index + 1, lastCapture.stack = -1), stack--) : parenOpen && (stack++, 1 != parenOpen.length && (lastCapture.stack = stack, lastCapture.start = index)), m; }), null != lastCapture.end && /^\)*$/.test(src.substr(lastCapture.end)) && (src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end)); } - return "^" != src.charAt(0) && (src = "^" + src), "$" != src.charAt(src.length - 1) && (src += "$"), new RegExp(src, (flag || "").replace("g", "")); + return "^" != src.charAt(0) && (src = "^" + src), "$" != src.charAt(src.length - 1) && (src += "$"), RegExp(src, (flag || "").replace("g", "")); }, this.getLineTokens = function(line, startState) { if (startState && "string" != typeof startState) { var stack = startState.slice(0); @@ -4320,14 +4320,14 @@ this.HighlightRules = TextHighlightRules; }; (function() { - this.$defaultBehaviour = new CstyleBehaviour(), this.tokenRe = new RegExp("^[" + unicode.wordChars + "\\$_]+", "g"), this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g"), this.getTokenizer = function() { + this.$defaultBehaviour = new CstyleBehaviour(), this.tokenRe = RegExp("^[" + unicode.wordChars + "\\$_]+", "g"), this.nonTokenRe = RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g"), this.getTokenizer = function() { return this.$tokenizer || (this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig), this.$tokenizer = new Tokenizer(this.$highlightRules.getRules())), this.$tokenizer; }, this.lineCommentStart = "", this.blockComment = "", this.toggleCommentLines = function(state, session, startRow, endRow) { var doc = session.doc, ignoreBlankLines = !0, shouldRemove = !0, minIndent = 1 / 0, tabSize = session.getTabSize(), insertAtTabStop = !1; if (this.lineCommentStart) { if (Array.isArray(this.lineCommentStart)) var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|"), lineCommentStart = this.lineCommentStart[0]; else var regexpStart = lang.escapeRegExp(this.lineCommentStart), lineCommentStart = this.lineCommentStart; - regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?"), insertAtTabStop = session.getUseSoftTabs(); + regexpStart = RegExp("^(\\s*)(?:" + regexpStart + ") ?"), insertAtTabStop = session.getUseSoftTabs(); var uncomment = function(line, i) { var m = line.match(regexpStart); if (m) { @@ -4352,7 +4352,7 @@ }; } else { if (!this.blockComment) return !1; - var lineCommentStart = this.blockComment.start, lineCommentEnd = this.blockComment.end, regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")"), regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$"), comment = function(line, i) { + var lineCommentStart = this.blockComment.start, lineCommentEnd = this.blockComment.end, regexpStart = RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")"), regexpEnd = RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$"), comment = function(line, i) { !testRemove(line, i) && (!ignoreBlankLines || /\S/.test(line)) && (doc.insertInLine({ row: i, column: line.length @@ -4915,13 +4915,13 @@ }); }, this.addFold = function(fold) { if (fold.sameRow) { - if (fold.start.row < this.startRow || fold.endRow > this.endRow) throw new Error("Can't add a fold to this FoldLine as it has no connection"); + if (fold.start.row < this.startRow || fold.endRow > this.endRow) throw Error("Can't add a fold to this FoldLine as it has no connection"); this.folds.push(fold), this.folds.sort(function(a, b) { return -a.range.compareEnd(b.start.row, b.start.column); }), this.range.compareEnd(fold.start.row, fold.start.column) > 0 ? (this.end.row = fold.end.row, this.end.column = fold.end.column) : 0 > this.range.compareStart(fold.end.row, fold.end.column) && (this.start.row = fold.start.row, this.start.column = fold.start.column); } else if (fold.start.row == this.end.row) this.folds.push(fold), this.end.row = fold.end.row, this.end.column = fold.end.column; else if (fold.end.row == this.start.row) this.folds.unshift(fold), this.start.row = fold.start.row, this.start.column = fold.start.column; - else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); + else throw Error("Trying to add fold to FoldRow that doesn't have a matching row"); fold.foldLine = this; }, this.containsRow = function(row) { return row >= this.start.row && row <= this.end.row; @@ -5374,7 +5374,7 @@ var iterator = new TokenIterator(this, row, column), token = iterator.getCurrentToken(), type = token && token.type; if (token && /^comment|string/.test(type)) { "comment" == (type = type.match(/comment|string/)[0]) && (type += "|doc-start"); - var re = new RegExp(type), range = new Range(); + var re = RegExp(type), range = new Range(); if (1 != dir) { do token = iterator.stepBackward(); while (token && re.test(token.type)) @@ -5419,7 +5419,7 @@ markbegin: 1, markbeginend: 1 }, this.$foldStyle = "markbegin", this.setFoldStyle = function(style) { - if (!this.$foldStyles[style]) throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); + if (!this.$foldStyles[style]) throw Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); if (this.$foldStyle != style) { this.$foldStyle = style, "manual" == style && this.unfold(); var mode = this.$foldMode; @@ -5555,7 +5555,7 @@ }, this.$findOpeningBracket = function(bracket, position, typeRe) { var openBracket = this.$brackets[bracket], depth = 1, iterator = new TokenIterator(this, position.row, position.column), token = iterator.getCurrentToken(); if (token || (token = iterator.stepForward()), token) { - typeRe || (typeRe = new RegExp("(\\.?" + token.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+")); + typeRe || (typeRe = RegExp("(\\.?" + token.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+")); for(var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2, value = token.value;;){ for(; valueIndex >= 0;){ var chr = value.charAt(valueIndex); @@ -5577,7 +5577,7 @@ }, this.$findClosingBracket = function(bracket, position, typeRe) { var closingBracket = this.$brackets[bracket], depth = 1, iterator = new TokenIterator(this, position.row, position.column), token = iterator.getCurrentToken(); if (token || (token = iterator.stepForward()), token) { - typeRe || (typeRe = new RegExp("(\\.?" + token.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+")); + typeRe || (typeRe = RegExp("(\\.?" + token.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+")); for(var valueIndex = position.column - iterator.getCurrentTokenColumn();;){ for(var value = token.value, valueLength = value.length; valueIndex < valueLength;){ var chr = value.charAt(valueIndex); @@ -6431,14 +6431,14 @@ var modifier = options1.caseSensitive ? "gm" : "gmi"; if (options1.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle1), options1.$isMultiLine) return options1.re = this.$assembleMultilineRegExp(needle1, modifier); try { - var re = new RegExp(needle1, modifier); + var re = RegExp(needle1, modifier); } catch (e) { re = !1; } return options1.re = re; }, this.$assembleMultilineRegExp = function(needle, modifier) { for(var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n"), re = [], i = 0; i < parts.length; i++)try { - re.push(new RegExp(parts[i], modifier)); + re.push(RegExp(parts[i], modifier)); } catch (e) { return !1; } @@ -8425,8 +8425,8 @@ itLength = curLength + item.length, delta >= curLength && delta <= itLength && (currentState = item, that.selection.clearSelection(), that.moveCursorTo(row, curLength + currWordStart), that.selection.selectTo(row, itLength + currWordStart)), curLength = itLength; }); for(var wordPairs = this.$toggleWordPairs, i = 0; i < wordPairs.length; i++)for(var item1 = wordPairs[i], j = 0; j <= 1; j++){ - var negate = +!j, firstCondition = currentState.match(new RegExp("^\\s?_?(" + lang.escapeRegExp(item1[j]) + ")\\s?$", "i")); - firstCondition && currentState.match(new RegExp("([_]|^|\\s)(" + lang.escapeRegExp(firstCondition[1]) + ")($|\\s)", "g")) && (reg = currentState.replace(new RegExp(lang.escapeRegExp(item1[j]), "i"), function(result) { + var negate = +!j, firstCondition = currentState.match(RegExp("^\\s?_?(" + lang.escapeRegExp(item1[j]) + ")\\s?$", "i")); + firstCondition && currentState.match(RegExp("([_]|^|\\s)(" + lang.escapeRegExp(firstCondition[1]) + ")($|\\s)", "g")) && (reg = currentState.replace(RegExp(lang.escapeRegExp(item1[j]), "i"), function(result) { var res = item1[negate]; return result.toUpperCase() == result ? res = res.toUpperCase() : result.charAt(0).toUpperCase() == result.charAt(0) && (res = res.substr(0, 0) + item1[negate].charAt(0).toUpperCase() + res.substr(1)), res; }), this.insert(reg), reg = ""); @@ -9204,7 +9204,7 @@ if (0 === len) ; else if ("remove" == delta.action) this.$annotations.splice(firstRow, len + 1, null); else { - var args = new Array(len + 1); + var args = Array(len + 1); args.unshift(firstRow, 1), this.$annotations.splice.apply(this.$annotations, args); } } @@ -10901,7 +10901,7 @@ margin: 0 10px;\ } function afterLoad(module) { if (_self.$themeId != theme) return cb && cb(); - if (!module || !module.cssClass) throw new Error("couldn't load module " + theme + " or it didn't call define"); + if (!module || !module.cssClass) throw Error("couldn't load module " + theme + " or it didn't call define"); module.$id && (_self.$themeId = module.$id), dom.importCssString(module.cssText, module.cssClass, _self.container), _self.theme && dom.removeCssClass(_self.container, _self.theme.cssClass); var padding = "padding" in module ? module.padding : "padding" in (_self.theme || {}) ? 4 : _self.$padding; _self.$padding && padding != _self.$padding && _self.setPadding(padding), _self.$theme = module.cssClass, _self.theme = module, dom.addCssClass(_self.container, module.cssClass), dom.setCssClass(_self.container, "ace_dark", module.isDark), _self.$size && (_self.$size.width = 0, _self.$updateSizeAsync()), _self._dispatchEvent("themeLoaded", { @@ -12098,7 +12098,7 @@ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZg w && this.removeLineWidget(w); }, this), this.$updateRows(); } else { - var args = new Array(len); + var args = Array(len); lineWidgets[startRow] && null != lineWidgets[startRow].column && delta.start.column > lineWidgets[startRow].column && startRow++, args.unshift(startRow, 0), lineWidgets.splice.apply(lineWidgets, args), this.$updateRows(); } } @@ -12111,7 +12111,7 @@ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZg }), noWidgets && (this.session.lineWidgets = null); } }, this.$registerLineWidget = function(w) { - this.session.lineWidgets || (this.session.lineWidgets = new Array(this.session.getLength())); + this.session.lineWidgets || (this.session.lineWidgets = Array(this.session.getLength())); var old = this.session.lineWidgets[w.row]; return old && (w.$oldWidget = old, old.el && old.el.parentNode && (old.el.parentNode.removeChild(old.el), old._inDocument = !1)), this.session.lineWidgets[w.row] = w, w; }, this.addLineWidget = function(w) { @@ -12349,7 +12349,7 @@ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZg require("./worker/worker_client"), require("./keyboard/hash_handler"), require("./placeholder"), require("./multi_select"), require("./mode/folding/fold_mode"), require("./theme/textmate"), require("./ext/error_marker"), exports.config = require("./config"), exports.require = require, exports.define = __webpack_require__.amdD, exports.edit = function(el, options) { if ("string" == typeof el) { var _id = el; - if (!(el = document.getElementById(_id))) throw new Error("ace.edit can't find div #" + _id); + if (!(el = document.getElementById(_id))) throw Error("ace.edit can't find div #" + _id); } if (el && el.env && el.env.editor instanceof Editor) return el.env.editor; var value = ""; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index 9f052fb5868..20e880777ad 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -6,7 +6,7 @@ 7228: function(a) { a.exports = function(c, a) { (null == a || a > c.length) && (a = c.length); - for(var b = 0, d = new Array(a); b < a; b++)d[b] = c[b]; + for(var b = 0, d = Array(a); b < a; b++)d[b] = c[b]; return d; }, a.exports.__esModule = !0, a.exports.default = a.exports; }, @@ -66,7 +66,7 @@ }; }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }, a.exports.__esModule = !0, a.exports.default = a.exports; }, 7154: function(a) { @@ -122,7 +122,7 @@ function u(c, a, d, e) { var f, g, h, i, b = Object.create((a && a.prototype instanceof v ? a : v).prototype), j = new r(e || []); return b._invoke = (f = c, g = d, h = j, i = "suspendedStart", function(c, d) { - if ("executing" === i) throw new Error("Generator is already running"); + if ("executing" === i) throw Error("Generator is already running"); if ("completed" === i) { if ("throw" === c) throw d; return D(); @@ -222,14 +222,14 @@ if (void 0 === e) { if (a.delegate = null, "throw" === a.method) { if (b.iterator.return && (a.method = "return", a.arg = void 0, A(b, a), "throw" === a.method)) return z; - a.method = "throw", a.arg = new TypeError("The iterator does not provide a 'throw' method"); + a.method = "throw", a.arg = TypeError("The iterator does not provide a 'throw' method"); } return z; } var d = y(e, b.iterator, a.arg); if ("throw" === d.type) return a.method = "throw", a.arg = d.arg, a.delegate = null, z; var c = d.arg; - return c ? c.done ? (a[b.resultName] = c.value, a.next = b.nextLoc, "return" !== a.method && (a.method = "next", a.arg = void 0), a.delegate = null, z) : c : (a.method = "throw", a.arg = new TypeError("iterator result is not an object"), a.delegate = null, z); + return c ? c.done ? (a[b.resultName] = c.value, a.next = b.nextLoc, "return" !== a.method && (a.method = "next", a.arg = void 0), a.delegate = null, z) : c : (a.method = "throw", a.arg = TypeError("iterator result is not an object"), a.delegate = null, z); } function B(a) { var b = { @@ -330,7 +330,7 @@ } else if (d) { if (this.prev < a.catchLoc) return b(a.catchLoc, !0); } else { - if (!e) throw new Error("try statement without catch or finally"); + if (!e) throw Error("try statement without catch or finally"); if (this.prev < a.finallyLoc) return b(a.finallyLoc); } } @@ -370,7 +370,7 @@ return e; } } - throw new Error("illegal catch attempt"); + throw Error("illegal catch attempt"); }, delegateYield: function(a, b, c) { return this.delegate = { @@ -427,13 +427,13 @@ b.__esModule = !0, b.default = void 0; var e = c(a(7757)), f = c(a(8926)), g = c(a(4615)); b.default = function() { - for(var c, b = arguments.length, d = new Array(b), a = 0; a < b; a++)d[a] = arguments[a]; + for(var c, b = arguments.length, d = Array(b), a = 0; a < b; a++)d[a] = arguments[a]; return c = (0, f.default)(e.default.mark(function a(b) { var c, f, h, i, j, k, l, m = arguments; return e.default.wrap(function(a) { for(;;)switch(a.prev = a.next){ case 0: - for(c = b, f = (0, g.default)(d), h = m.length, i = new Array(h > 1 ? h - 1 : 0), j = 1; j < h; j++)i[j - 1] = m[j]; + for(c = b, f = (0, g.default)(d), i = Array((h = m.length) > 1 ? h - 1 : 0), j = 1; j < h; j++)i[j - 1] = m[j]; k = 0; case 4: if (!(k < f.length)) { @@ -482,9 +482,9 @@ a.__esModule = !0, a.default = void 0; var e = c(b(4615)); a.default = function() { - for(var b = arguments.length, c = new Array(b), a = 0; a < b; a++)c[a] = arguments[a]; + for(var b = arguments.length, c = Array(b), a = 0; a < b; a++)c[a] = arguments[a]; return function(i) { - for(var b = i, g = (0, e.default)(c), d = arguments.length, h = new Array(d > 1 ? d - 1 : 0), a = 1; a < d; a++)h[a - 1] = arguments[a]; + for(var b = i, g = (0, e.default)(c), d = arguments.length, h = Array(d > 1 ? d - 1 : 0), a = 1; a < d; a++)h[a - 1] = arguments[a]; for(var f = 0; f < g.length; f += 1)b = g[f].apply(void 0, [ b ].concat(h)); @@ -755,7 +755,7 @@ }).sort(w), j = a.filter(function(a) { return a.fontWeight > c; }).sort(w); - if (c < 400 && (b = d[d.length - 1] || j[0]), c > 500 && (b = j[0] || d[d.length - 1]), !b) throw new Error("Could not resolve font for " + this.family + ", fontWeight " + c); + if (c < 400 && (b = d[d.length - 1] || j[0]), c > 500 && (b = j[0] || d[d.length - 1]), !b) throw Error("Could not resolve font for " + this.family + ", fontWeight " + c); return b; }, a; }(), z = [ @@ -791,7 +791,7 @@ }, this.getFont = function(b) { var a = b.fontFamily; if (z.includes(a)) return null; - if (!c[a]) throw new Error("Font family not registered: " + a + ". Please register it calling Font.register() method."); + if (!c[a]) throw Error("Font family not registered: " + a + ". Please register it calling Font.register() method."); return c[a].resolve(b); }, this.load = (a = k.default(l.default.mark(function a(c) { var d, e, f; @@ -868,9 +868,9 @@ 0xffce, 0xffcf, ], k = function(b) { - if (this.data = null, this.width = null, this.height = null, this.data = b, 0xffd8 !== b.readUInt16BE(0)) throw new Error("SOI not found in JPEG"); + if (this.data = null, this.width = null, this.height = null, this.data = b, 0xffd8 !== b.readUInt16BE(0)) throw Error("SOI not found in JPEG"); for(var c, a = 2; a < b.length && (c = b.readUInt16BE(a), a += 2, !t.includes(c));)a += b.readUInt16BE(a); - if (!t.includes(c)) throw new Error("Invalid JPEG."); + if (!t.includes(c)) throw Error("Invalid JPEG."); a += 3, this.height = b.readUInt16BE(a), a += 2, this.width = b.readUInt16BE(a); }; k.isValid = function(a) { @@ -931,7 +931,7 @@ } var p, A = function(c) { var d = c.uri, a = /^data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(d), b = a[1], e = a[2]; - if (!w(b)) throw new Error("Base64 image invalid format: " + b); + if (!w(b)) throw Error("Base64 image invalid format: " + b); return new Promise(function(a) { return a(z(r.from(e, "base64"), b)); }); @@ -939,7 +939,7 @@ if (a.data && a.format) return new Promise(function(b) { return b(z(a.data, a.format)); }); - throw new Error("Invalid data given for local file: " + JSON.stringify(a)); + throw Error("Invalid data given for local file: " + JSON.stringify(a)); }, C = function(a) { var b = x(a); return b ? new Promise(function(c) { @@ -949,7 +949,7 @@ var c = 137 === a[0] && 80 === a[1] && 78 === a[2] && 71 === a[3] && 13 === a[4] && 10 === a[5] && 26 === a[6] && 10 === a[7], d = 255 === a[0] && 216 === a[1] && 255 === a[2], b = ""; if (c) b = "png"; else if (d) b = "jpg"; - else throw new Error("Not valid image extension"); + else throw Error("Not valid image extension"); return b; }, E = (p = d.default(e.default.mark(function a(b) { var c, d, f, g, h, i, j; @@ -982,7 +982,7 @@ c.default = function(a, d) { var b, e = (void 0 === d ? {} : d).cache, f = void 0 === e || e, c = a.data ? a.data.toString() : a.uri; if (f && u.get(c)) return u.get(c); - if (!(b = y(a) ? A(a) : r.isBuffer(a) ? C(a) : "object" == typeof a && a.data ? B(a) : E(a))) throw new Error("Cannot resolve image"); + if (!(b = y(a) ? A(a) : r.isBuffer(a) ? C(a) : "object" == typeof a && a.data ? B(a) : E(a))) throw Error("Cannot resolve image"); return f && u.set(c, b), b; }; }, @@ -1568,7 +1568,7 @@ a.next = 11; break; } - throw new Error('Image\'s "src" or "source" prop returned ' + e); + throw Error('Image\'s "src" or "source" prop returned ' + e); case 11: return a.next = 13, ae.default(e, { cache: d @@ -2089,13 +2089,13 @@ ], bG = [ function(a) { return a.map(function(a) { - var b, c = (b = a.attributes.font, bF.reduce(function(a, c) { + var b, c = RegExp((b = a.attributes.font, bF.reduce(function(a, c) { return b && b.hasGlyphForCodePoint && b.hasGlyphForCodePoint(c) ? a : [].concat(a, [ String.fromCharCode(c) ]); - }, [])), d = new RegExp(c.join("|")); + }, [])).join("|")); return { - string: a.string.replace(d, ""), + string: a.string.replace(c, ""), attributes: a.attributes }; }); @@ -2314,7 +2314,7 @@ var e = q._yogaNode; if (!l.isNil(d) && e) { var h, i, j, k, m, n, o = !l.isNil(c), f = "set" + l.upperFirst(b), r = f + "Auto", p = f + "Percent", g = l.matchPercent(d); - if (g && !e[p]) throw new Error("You can't pass percentage values to " + b + " property"); + if (g && !e[p]) throw Error("You can't pass percentage values to " + b + " property"); g ? o ? null === (h = e[p]) || void 0 === h || h.call(e, c, g.value) : null === (i = e[p]) || void 0 === i || i.call(e, g.value) : "auto" === d ? o ? null === (j = e[r]) || void 0 === j || j.call(e, c) : "flexBasis" === b ? e.setFlexBasis(a.default.UNIT_AUTO) : null === (k = e[r]) || void 0 === k || k.call(e) : o ? null === (m = e[f]) || void 0 === m || m.call(e, c, d) : null === (n = e[f]) || void 0 === n || n.call(e, d); } return q; @@ -2769,7 +2769,7 @@ b = c0(b), e += b.length, a = a.concat(b); } return a = a.map(function() { - for(var b, c = arguments.length, d = new Array(c), a = 0; a < c; a++)d[a] = arguments[a]; + for(var b, c = arguments.length, d = Array(c), a = 0; a < c; a++)d[a] = arguments[a]; return b = (function(b, a, c, d) { return c$({ totalPages: d.length, @@ -2945,17 +2945,17 @@ default: this.pos += b; } - if (this.pos += 4, this.pos > this.data.length) throw new Error("Incomplete or corrupt PNG file"); + if (this.pos += 4, this.pos > this.data.length) throw Error("Incomplete or corrupt PNG file"); } } b.decode = function(a, b) { - throw new Error("PNG.decode not available in browser build"); + throw Error("PNG.decode not available in browser build"); }, b.load = function(a) { - throw new Error("PNG.load not available in browser build"); + throw Error("PNG.load not available in browser build"); }; var a = b.prototype; return a.read = function(b) { - for(var c = new Array(b), a = 0; a < b; a++)c[a] = this.data[this.pos++]; + for(var c = Array(b), a = 0; a < b; a++)c[a] = this.data[this.pos++]; return c; }, a.readUInt32 = function() { return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]; @@ -2990,7 +2990,7 @@ } break; default: - throw new Error("Invalid filter algorithm: " + j[k - 1]); + throw Error("Invalid filter algorithm: " + j[k - 1]); } if (!l) { var B = ((s + c * u) * e + r) * h, E = c * b; @@ -3147,7 +3147,7 @@ } return a; }(a, b); - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); }, J = 2 * Math.PI, K = function(a, f, g, b, c, h, i) { var d = a.x, e = a.y, j = b * (d *= f) - c * (e *= g), k = c * d + b * e; return { @@ -4356,7 +4356,7 @@ "innerRef", "showToolbar", ], bz = function(a) { - throw new Error(a + " is a Node specific API. You're either using this method in a browser, or your bundler is not loading react-pdf from the appropriate web build."); + throw Error(a + " is a Node specific API. You're either using this method in a browser, or your bundler is not loading react-pdf from the appropriate web build."); }; (0, h.Z)({ pdf: s, @@ -7118,7 +7118,7 @@ if (f = !0, a) throw a; b = c; } - }), !f) throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't"); + }), !f) throw Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't"); c.exports = d(b.bind, b.lib); }, 1009: function(a, c, b) { @@ -7149,7 +7149,7 @@ }) : a[b] = c, a; } function g(a, b) { - if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); + if (!(a instanceof b)) throw TypeError("Cannot call a class as a function"); } var h = b(1290), i = function() { function a(b, c, d, e, f, h) { @@ -7258,8 +7258,8 @@ var a = e.pop(), b = void 0, c = void 0; if ("auto" === a) b = h.UNIT_AUTO, c = void 0; else if (a instanceof k) b = a.unit, c = a.valueOf(); - else if (b = "string" == typeof a && a.endsWith("%") ? h.UNIT_PERCENT : h.UNIT_POINT, c = parseFloat(a), !Number.isNaN(a) && Number.isNaN(c)) throw new Error("Invalid value " + a + " for " + d); - if (!i[b]) throw new Error('Failed to execute "' + d + "\": Unsupported unit '" + a + "'"); + else if (b = "string" == typeof a && a.endsWith("%") ? h.UNIT_PERCENT : h.UNIT_POINT, c = parseFloat(a), !Number.isNaN(a) && Number.isNaN(c)) throw Error("Invalid value " + a + " for " + d); + if (!i[b]) throw Error('Failed to execute "' + d + "\": Unsupported unit '" + a + "'"); return void 0 !== c ? (j = i[b]).call.apply(j, [ this ].concat(e, [ @@ -7442,7 +7442,7 @@ if (null === d) return null; if (0 == n || "object" != typeof d) return d; if (a.__isArray(d)) f = []; - else if (a.__isRegExp(d)) f = new RegExp(d.source, c(d)), d.lastIndex && (f.lastIndex = d.lastIndex); + else if (a.__isRegExp(d)) f = RegExp(d.source, c(d)), d.lastIndex && (f.lastIndex = d.lastIndex); else if (a.__isDate(d)) f = new Date(d.getTime()); else { if (k && e.isBuffer(d)) return f = e.allocUnsafe ? e.allocUnsafe(d.length) : new e(d.length), d.copy(f), f; @@ -8367,7 +8367,7 @@ return a && i.indexOf(Object.prototype.toString.call(a)) > -1; }; function k(a) { - if ("string" != typeof a && (a = String(a)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a)) throw new TypeError("Invalid character in header field name"); + if ("string" != typeof a && (a = String(a)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a)) throw TypeError("Invalid character in header field name"); return a.toLowerCase(); } function l(a) { @@ -8397,7 +8397,7 @@ }, this); } function n(a) { - if (a.bodyUsed) return Promise.reject(new TypeError("Already read")); + if (a.bodyUsed) return Promise.reject(TypeError("Already read")); a.bodyUsed = !0; } function o(a) { @@ -8443,7 +8443,7 @@ if (!this._bodyFormData) return Promise.resolve(new Blob([ this._bodyText ])); - throw new Error("could not read FormData body as blob"); + throw Error("could not read FormData body as blob"); }, this.arrayBuffer = function() { return this._bodyArrayBuffer ? n(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(p); }), this.text = function() { @@ -8451,11 +8451,11 @@ if (d) return d; if (this._bodyBlob) return b = this._bodyBlob, a = new FileReader(), c = o(a), a.readAsText(b), c; if (this._bodyArrayBuffer) return Promise.resolve(function(d) { - for(var b = new Uint8Array(d), c = new Array(b.length), a = 0; a < b.length; a++)c[a] = String.fromCharCode(b[a]); + for(var b = new Uint8Array(d), c = Array(b.length), a = 0; a < b.length; a++)c[a] = String.fromCharCode(b[a]); return c.join(""); }(this._bodyArrayBuffer)); if (!this._bodyFormData) return Promise.resolve(this._bodyText); - throw new Error("could not read FormData body as text"); + throw Error("could not read FormData body as text"); }, g.formData && (this.formData = function() { return this.text().then(s); }), this.json = function() { @@ -8506,10 +8506,10 @@ function e(a, c) { var g, f, d = (c = c || {}).body; if (a instanceof e) { - if (a.bodyUsed) throw new TypeError("Already read"); + if (a.bodyUsed) throw TypeError("Already read"); this.url = a.url, this.credentials = a.credentials, c.headers || (this.headers = new b(a.headers)), this.method = a.method, this.mode = a.mode, this.signal = a.signal, d || null == a._bodyInit || (d = a._bodyInit, a.bodyUsed = !0); } else this.url = String(a); - if (this.credentials = c.credentials || this.credentials || "same-origin", (c.headers || !this.headers) && (this.headers = new b(c.headers)), this.method = (f = (g = c.method || this.method || "GET").toUpperCase(), r.indexOf(f) > -1 ? f : g), this.mode = c.mode || this.mode || null, this.signal = c.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && d) throw new TypeError("Body not allowed for GET or HEAD requests"); + if (this.credentials = c.credentials || this.credentials || "same-origin", (c.headers || !this.headers) && (this.headers = new b(c.headers)), this.method = (f = (g = c.method || this.method || "GET").toUpperCase(), r.indexOf(f) > -1 ? f : g), this.mode = c.mode || this.mode || null, this.signal = c.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && d) throw TypeError("Body not allowed for GET or HEAD requests"); this._initBody(d); } function s(a) { @@ -8550,7 +8550,7 @@ 308 ]; d.redirect = function(b, a) { - if (-1 === t.indexOf(a)) throw new RangeError("Invalid status code"); + if (-1 === t.indexOf(a)) throw RangeError("Invalid status code"); return new d(null, { status: a, headers: { @@ -8591,9 +8591,9 @@ var f = "response" in i ? i.response : i.responseText; l(new d(f, a)); }, i.onerror = function() { - j(new TypeError("Network request failed")); + j(TypeError("Network request failed")); }, i.ontimeout = function() { - j(new TypeError("Network request failed")); + j(TypeError("Network request failed")); }, i.onabort = function() { j(new c.DOMException("Aborted", "AbortError")); }, i.open(h.method, h.url, !0), "include" === h.credentials ? i.withCredentials = !0 : "omit" === h.credentials && (i.withCredentials = !1), "responseType" in i && g.blob && (i.responseType = "blob"), h.headers.forEach(function(a, b) { @@ -8628,7 +8628,7 @@ return j.randomBytes(4).readInt32LE(); } catch (b) {} } - throw new Error("Native crypto module could not be used to get secure random number."); + throw Error("Native crypto module could not be used to get secure random number."); }, l = Object.create || function() { function a() {} return function(c) { @@ -8711,7 +8711,7 @@ try { return decodeURIComponent(escape(o.stringify(a))); } catch (b) { - throw new Error("Malformed UTF-8 data"); + throw Error("Malformed UTF-8 data"); } }, parse: function(a) { @@ -8889,7 +8889,7 @@ var b = Array.prototype.slice, c = Object.prototype.toString; a.exports = function(k) { var d, a = this; - if ("function" != typeof a || "[object Function]" !== c.call(a)) throw new TypeError("Function.prototype.bind called on incompatible " + a); + if ("function" != typeof a || "[object Function]" !== c.call(a)) throw TypeError("Function.prototype.bind called on incompatible " + a); for(var h = b.call(arguments, 1), i = function() { if (!(this instanceof d)) return a.apply(k, h.concat(b.call(arguments))); var c = a.apply(this, h.concat(b.call(arguments))); @@ -9406,7 +9406,7 @@ }, {}); } function i(d, l, m, n) { - for(var c, b = new Array(d.length + 1), o = d.toLocaleLowerCase(), f = [], p = 0, a = b.length; a--;)b[a] = 0; + for(var c, b = Array(d.length + 1), o = d.toLocaleLowerCase(), f = [], p = 0, a = b.length; a--;)b[a] = 0; for(; c = l[p++];)for(var g = 0, h = !1; !h;){ var e = o.indexOf(c.text, g); if (e > -1 && (!c.stickToLeft || 0 === e) && (!c.stickToRight || e + c.text.length === d.length)) { @@ -9464,7 +9464,7 @@ return function(l, c) { c = c || {}; var o = g(c, "async", !1), p = {}, r = g(c, a, !1), m = {}, n = g(c, b, "\u00AD"), s = l.patterns.map(j), q = g(c, d, 5) >> 0, t = g(c, "html", !1), k = n + q; - if (m[k] = h(l, n), p[k] = f(m[k]), o && !("Promise" in e)) throw new Error("Failed to create hyphenator: Could not find global Promise object, needed for hyphenator to work in async mode"); + if (m[k] = h(l, n), p[k] = f(m[k]), o && !("Promise" in e)) throw Error("Failed to create hyphenator: Could not find global Promise object, needed for hyphenator to work in async mode"); return function(u, e) { e = e || {}; var v = g(e, a, r), j = g(e, b, n), k = g(e, d, q) >> 0, c = j + k; @@ -14607,7 +14607,7 @@ case ",": return new c(a, d); default: - throw new Error(value); + throw Error(value); } }; }, @@ -14684,7 +14684,7 @@ }); continue; } - throw new TypeError("Tokenizer: I dont know what this character is: " + a); + throw TypeError("Tokenizer: I dont know what this character is: " + a); } return e; }(a)); @@ -14730,7 +14730,7 @@ case "orientation": return new f(a); default: - throw new Error(a); + throw Error(a); } }; }, @@ -14748,7 +14748,7 @@ "use strict"; function e(c, a) { (null == a || a > c.length) && (a = c.length); - for(var b = 0, d = new Array(a); b < a; b++)d[b] = c[b]; + for(var b = 0, d = Array(a); b < a; b++)d[b] = c[b]; return d; } function f(a, b, c) { @@ -14780,7 +14780,7 @@ return c; } }(a, b) || i(a, b) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); } function h(a) { @@ -14789,7 +14789,7 @@ }(a) || function(a) { if ("undefined" != typeof Symbol && null != a[Symbol.iterator] || null != a["@@iterator"]) return Array.from(a); }(a) || i(a) || function() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); } function i(a, c) { @@ -14852,8 +14852,8 @@ var $ = ""; if (x(c)) { var i = w(c) ? c.default : c; - if (!i.src) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(i))); - if (J = J || i.blurDataURL, $ = i.src, (!d || "fill" !== d) && (I = I || i.height, H = H || i.width, !i.height || !i.width)) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(i))); + if (!i.src) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(i))); + if (J = J || i.blurDataURL, $ = i.src, (!d || "fill" !== d) && (I = I || i.height, H = H || i.width, !i.height || !i.width)) throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(i))); } c = "string" == typeof c ? c : $; var r = z(H), v = z(I), _ = z(ai), B = !R && ("lazy" === G || void 0 === G); @@ -15097,7 +15097,7 @@ "custom", function(a) { var b = a.src; - throw new Error('Image with src "'.concat(b, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); + throw Error('Image with src "'.concat(b, '" is missing "loader" prop.') + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader"); } ], ]); @@ -15171,7 +15171,7 @@ function A(b) { var a, c = (null === (a = b.config) || void 0 === a ? void 0 : a.loader) || "default", d = v.get(c); if (d) return d(b); - throw new Error('Unknown "loader" found in "next.config.js". Expected: '.concat(l.VALID_LOADERS.join(", "), ". Received: ").concat(c)); + throw Error('Unknown "loader" found in "next.config.js". Expected: '.concat(l.VALID_LOADERS.join(", "), ". Received: ").concat(c)); } function B(a, b, c, d, e, f) { a && a.src !== u && a["data-loaded-src"] !== b && (a["data-loaded-src"] = b, ("decode" in a ? a.decode() : Promise.resolve()).catch(function() {}).then(function() { @@ -15261,7 +15261,7 @@ "use strict"; function d(c, a) { (null == a || a > c.length) && (a = c.length); - for(var b = 0, d = new Array(a); b < a; b++)d[b] = c[b]; + for(var b = 0, d = Array(a); b < a; b++)d[b] = c[b]; return d; } function e(a, b) { @@ -15285,7 +15285,7 @@ return c; } }(a, b) || f(a, b) || function() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); } function f(a, c) { @@ -15378,7 +15378,7 @@ 901: function(a) { a.exports = function(a, d, e) { if (a.filter) return a.filter(d, e); - if (null == a || "function" != typeof d) throw new TypeError(); + if (null == a || "function" != typeof d) throw TypeError(); for(var f = [], c = 0; c < a.length; c++)if (b.call(a, c)) { var g = a[c]; d.call(e, g, c, a) && f.push(g); @@ -15435,7 +15435,7 @@ } } function i() { - for(var c = arguments.length, b = new Array(c), a = 0; a < c; a++)b[a] = arguments[a]; + for(var c = arguments.length, b = Array(c), a = 0; a < c; a++)b[a] = arguments[a]; C.apply(void 0, [ i, b.length @@ -15518,7 +15518,7 @@ var D = function a(c, b, d) { var e = this; !function(a, b) { - if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); + if (!(a instanceof b)) throw TypeError("Cannot call a class as a function"); }(this, a), b.forEach(function(a) { a in c && (void 0 !== d && "string" == typeof d[a] && w(c[a]) && c[a].test(d[a]) ? e[a] = d[a] : e[a] = c[a]); }); @@ -15647,20 +15647,20 @@ } } function k() { - for(var c = arguments.length, b = new Array(c), a = 0; a < c; a++)b[a] = arguments[a]; + for(var c = arguments.length, b = Array(c), a = 0; a < c; a++)b[a] = arguments[a]; C.apply(void 0, [ k, b.length ].concat(b)); } a.throws = function d(e) { - for(var b = arguments.length, c = new Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)c[a - 1] = arguments[a]; + for(var b = arguments.length, c = Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)c[a - 1] = arguments[a]; I.apply(void 0, [ d, F(e) ].concat(c)); }, a.rejects = function e(c) { - for(var b = arguments.length, d = new Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)d[a - 1] = arguments[a]; + for(var b = arguments.length, d = Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)d[a - 1] = arguments[a]; return H(c).then(function(a) { return I.apply(void 0, [ e, @@ -15668,13 +15668,13 @@ ].concat(d)); }); }, a.doesNotThrow = function d(e) { - for(var b = arguments.length, c = new Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)c[a - 1] = arguments[a]; + for(var b = arguments.length, c = Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)c[a - 1] = arguments[a]; J.apply(void 0, [ d, F(e) ].concat(c)); }, a.doesNotReject = function e(c) { - for(var b = arguments.length, d = new Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)d[a - 1] = arguments[a]; + for(var b = arguments.length, d = Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)d[a - 1] = arguments[a]; return H(c).then(function(a) { return J.apply(void 0, [ e, @@ -15733,14 +15733,14 @@ return a && ("object" === n(a) || "function" == typeof a) ? a : i(b); } function i(a) { - if (void 0 === a) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === a) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return a; } function c(a) { var b = "function" == typeof Map ? new Map() : void 0; return (c = function(a) { if (null === a || !k(a)) return a; - if ("function" != typeof a) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof a) throw TypeError("Super expression must either be null or a function"); if (void 0 !== b) { if (b.has(a)) return b.get(a); b.set(a, c); @@ -15838,7 +15838,7 @@ var a, c, d; function b(g) { if (!function(a, b) { - if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); + if (!(a instanceof b)) throw TypeError("Cannot call a class as a function"); }(this, b), "object" !== n(g) || null === g) throw new p("options", "Object", g); var c, l = g.message, a = g.operator, y = g.stackStartFn, d = g.actual, f = g.expected, z = Error.stackTraceLimit; if (Error.stackTraceLimit = 0, null != l) c = h(this, m(b).call(this, String(l))); @@ -15895,7 +15895,7 @@ }), c.code = "ERR_ASSERTION", c.actual = d, c.expected = f, c.operator = a, Error.captureStackTrace && Error.captureStackTrace(i(c), y), c.stack, c.name = "AssertionError", h(c); } return !function(b, a) { - if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof a && null !== a) throw TypeError("Super expression must either be null or a function"); b.prototype = Object.create(a && a.prototype, { constructor: { value: b, @@ -15959,14 +15959,14 @@ function a(l, m, n) { var d, h, i, j, k, c; return !function(a, b) { - if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); + if (!(a instanceof b)) throw TypeError("Cannot call a class as a function"); }(this, a), (d = (k = this, (c = g(a).call(this, (h = l, i = m, j = n, "string" == typeof e ? e : e(h, i, j)))) && ("object" === f(c) || "function" == typeof c) ? c : function(a) { - if (void 0 === a) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === a) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return a; }(k))).code = b, d; } return !function(b, a) { - if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof a && null !== a) throw TypeError("Super expression must either be null or a function"); b.prototype = Object.create(a && a.prototype, { constructor: { value: b, @@ -16001,7 +16001,7 @@ var b; return b = a && a.constructor && a.constructor.name ? "instance of ".concat(a.constructor.name) : "type ".concat(f(a)), "Expected ".concat(c, ' to be returned from the "').concat(d, '"') + " function but got ".concat(b, "."); }, TypeError), a("ERR_MISSING_ARGS", function() { - for(var f = arguments.length, a = new Array(f), c = 0; c < f; c++)a[c] = arguments[c]; + for(var f = arguments.length, a = Array(f), c = 0; c < f; c++)a[c] = arguments[c]; void 0 === i && (i = e(313)), i(a.length > 0, "At least one arg needs to be specified"); var b = "The ", d = a.length; switch(a = a.map(function(a) { @@ -16025,7 +16025,7 @@ return i(a) || h(a, b) || g(); } function g() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + throw TypeError("Invalid attempt to destructure non-iterable instance"); } function h(h, d) { var a = [], b = !0, e = !1, f = void 0; @@ -16707,7 +16707,7 @@ 274: function(a) { "use strict"; function b(e, j) { - if (null == e) throw new TypeError("Cannot convert first argument to object"); + if (null == e) throw TypeError("Cannot convert first argument to object"); for(var f = Object(e), b = 1; b < arguments.length; b++){ var a = arguments[b]; if (null != a) for(var g = Object.keys(Object(a)), c = 0, i = g.length; c < i; c++){ @@ -16732,7 +16732,7 @@ 219: function(a) { var b = Object.prototype.hasOwnProperty, c = Object.prototype.toString; a.exports = function(a, e, h) { - if ("[object Function]" !== c.call(e)) throw new TypeError("iterator must be a function"); + if ("[object Function]" !== c.call(e)) throw TypeError("iterator must be a function"); var f = a.length; if (f === +f) for(var d = 0; d < f; d++)e.call(h, a[d], d, a); else for(var g in a)b.call(a, g) && e.call(h, a[g], g, a); @@ -16743,7 +16743,7 @@ var b = Array.prototype.slice, c = Object.prototype.toString; a.exports = function(k) { var d, a = this; - if ("function" != typeof a || "[object Function]" !== c.call(a)) throw new TypeError("Function.prototype.bind called on incompatible " + a); + if ("function" != typeof a || "[object Function]" !== c.call(a)) throw TypeError("Function.prototype.bind called on incompatible " + a); for(var h = b.call(arguments, 1), i = function() { if (!(this instanceof d)) return a.apply(k, h.concat(b.call(arguments))); var c = a.apply(this, h.concat(b.call(arguments))); @@ -17242,7 +17242,7 @@ }, n = b("String.prototype.slice"), o = {}, i = a(982), j = Object.getPrototypeOf; g && i && j && d(h, function(a) { var c = new __webpack_require__.g[a](); - if (!(Symbol.toStringTag in c)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in c)) throw EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); var d = j(c), b = i(d, Symbol.toStringTag); if (!b) { var e = j(d); @@ -17349,7 +17349,7 @@ }; a = function(a) { var m = null !== a && "object" == typeof a, n = "[object Function]" === g.call(a), p = h(a), q = m && "[object String]" === g.call(a), b = []; - if (!m && !n && !p) throw new TypeError("Object.keys called on a non-object"); + if (!m && !n && !p) throw TypeError("Object.keys called on a non-object"); var r = j && n; if (q && a.length > 0 && !f.call(a, 0)) for(var d = 0; d < a.length; ++d)b.push(String(d)); if (p && a.length > 0) for(var e = 0; e < a.length; ++e)b.push(String(e)); @@ -17507,7 +17507,7 @@ Object.defineProperty(a, b, { enumerable: !1, value: function() { - throw new Error(b + " is not supported in userland"); + throw Error(b + " is not supported in userland"); } }); }); @@ -17519,27 +17519,27 @@ }, u = /%[sdj%]/g; a.format = function(f) { if (!n(f)) { - for(var g = [], a = 0; a < arguments.length; a++)g.push(d(arguments[a])); + for(var g = [], a = 0; a < arguments.length; a++)g.push(c(arguments[a])); return g.join(" "); } - for(var a = 1, c = arguments, h = c.length, e = String(f).replace(u, function(b) { + for(var a = 1, d = arguments, h = d.length, e = String(f).replace(u, function(b) { if ("%%" === b) return "%"; if (a >= h) return b; switch(b){ case "%s": - return String(c[a++]); + return String(d[a++]); case "%d": - return Number(c[a++]); + return Number(d[a++]); case "%j": try { - return JSON.stringify(c[a++]); - } catch (d) { + return JSON.stringify(d[a++]); + } catch (c) { return "[Circular]"; } default: return b; } - }), b = c[a]; a < h; b = c[++a])k(b) || !p(b) ? e += " " + b : e += " " + d(b); + }), b = d[a]; a < h; b = d[++a])k(b) || !p(b) ? e += " " + b : e += " " + c(b); return e; }, a.deprecate = function(b, c) { if (void 0 !== process && !0 === process.noDeprecation) return b; @@ -17549,7 +17549,7 @@ var d = !1; return function() { if (!d) { - if (process.throwDeprecation) throw new Error(c); + if (process.throwDeprecation) throw Error(c); process.traceDeprecation ? console.trace(c) : console.error(c), d = !0; } return b.apply(this, arguments); @@ -17557,19 +17557,19 @@ }; var v = {}, h = /^$/; if (process.env.NODE_DEBUG) { - var c = process.env.NODE_DEBUG; - c = c.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), h = new RegExp("^" + c + "$", "i"); + var d = process.env.NODE_DEBUG; + h = RegExp("^" + (d = d.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase()) + "$", "i"); } - function d(d, c) { + function c(d, c) { var b = { seen: [], stylize: x }; return arguments.length >= 3 && (b.depth = arguments[2]), arguments.length >= 4 && (b.colors = arguments[3]), j(c) ? b.showHidden = c : c && a._extend(b, c), o(b.showHidden) && (b.showHidden = !1), o(b.depth) && (b.depth = 2), o(b.colors) && (b.colors = !1), o(b.customInspect) && (b.customInspect = !0), b.colors && (b.stylize = w), y(b, d, b.depth); } - function w(b, c) { - var a = d.styles[c]; - return a ? "[" + d.colors[a][0] + "m" + b + "[" + d.colors[a][1] + "m" : b; + function w(b, d) { + var a = c.styles[d]; + return a ? "[" + c.colors[a][0] + "m" + b + "[" + c.colors[a][1] + "m" : b; } function x(a, b) { return a; @@ -17695,7 +17695,7 @@ } else v[b] = function() {}; } return v[b]; - }, a.inspect = d, d.colors = { + }, a.inspect = c, c.colors = { bold: [ 1, 22 @@ -17748,7 +17748,7 @@ 33, 39 ] - }, d.styles = { + }, c.styles = { special: "cyan", number: "yellow", boolean: "yellow", @@ -17798,16 +17798,16 @@ var r = "undefined" != typeof Symbol ? Symbol("util.promisify.custom") : void 0; function I(a, c) { if (!a) { - var b = new Error("Promise was rejected with a falsy value"); + var b = Error("Promise was rejected with a falsy value"); b.reason = a, a = b; } return c(a); } a.promisify = function(b) { - if ("function" != typeof b) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof b) throw TypeError('The "original" argument must be of type Function'); if (r && b[r]) { var a = b[r]; - if ("function" != typeof a) throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + if ("function" != typeof a) throw TypeError('The "util.promisify.custom" argument must be of type Function'); return Object.defineProperty(a, r, { value: a, enumerable: !1, @@ -17836,11 +17836,11 @@ configurable: !0 }), Object.defineProperties(a, t(b)); }, a.promisify.custom = r, a.callbackify = function(a) { - if ("function" != typeof a) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof a) throw TypeError('The "original" argument must be of type Function'); function b() { for(var b = [], c = 0; c < arguments.length; c++)b.push(arguments[c]); var d = b.pop(); - if ("function" != typeof d) throw new TypeError("The last argument must be of type Function"); + if ("function" != typeof d) throw TypeError("The last argument must be of type Function"); var e = this, f = function() { return d.apply(e, arguments); }; @@ -17859,7 +17859,7 @@ g && i && j && d(h, function(a) { if ("function" == typeof __webpack_require__.g[a]) { var c = new __webpack_require__.g[a](); - if (!(Symbol.toStringTag in c)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in c)) throw EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); var d = j(c), b = i(d, Symbol.toStringTag); if (!b) { var e = j(d); @@ -18286,7 +18286,7 @@ var k = c(491), l = c(944), m = c(492), n = c(422), g = c(234); for(var h in g)b[h] = g[h]; function a(a) { - if ("number" != typeof a || a < b.DEFLATE || a > b.UNZIP) throw new TypeError("Bad argument"); + if ("number" != typeof a || a < b.DEFLATE || a > b.UNZIP) throw TypeError("Bad argument"); this.dictionary = null, this.err = 0, this.flush = 0, this.init_done = !1, this.level = 0, this.memLevel = 0, this.mode = a, this.strategy = 0, this.windowBits = 0, this.write_in_progress = !1, this.pending_close = !1, this.gzip_id_bytes_read = 0; } b.NONE = 0, b.DEFLATE = 1, b.INFLATE = 2, b.GZIP = 3, b.GUNZIP = 4, b.DEFLATERAW = 5, b.INFLATERAW = 6, b.UNZIP = 7, a.prototype.close = function() { @@ -18300,7 +18300,7 @@ }, a.prototype.writeSync = function(a, b, c, d, f, g, h) { return this._write(!1, a, b, c, d, f, g, h); }, a.prototype._write = function(j, a, c, g, h, l, m, n) { - if (k.equal(arguments.length, 8), k(this.init_done, "write before init"), k(this.mode !== b.NONE, "already finalized"), k.equal(!1, this.write_in_progress, "write already in progress"), k.equal(!1, this.pending_close, "close is pending"), this.write_in_progress = !0, k.equal(!1, void 0 === a, "must provide flush value"), this.write_in_progress = !0, a !== b.Z_NO_FLUSH && a !== b.Z_PARTIAL_FLUSH && a !== b.Z_SYNC_FLUSH && a !== b.Z_FULL_FLUSH && a !== b.Z_FINISH && a !== b.Z_BLOCK) throw new Error("Invalid flush value"); + if (k.equal(arguments.length, 8), k(this.init_done, "write before init"), k(this.mode !== b.NONE, "already finalized"), k.equal(!1, this.write_in_progress, "write already in progress"), k.equal(!1, this.pending_close, "close is pending"), this.write_in_progress = !0, k.equal(!1, void 0 === a, "must provide flush value"), this.write_in_progress = !0, a !== b.Z_NO_FLUSH && a !== b.Z_PARTIAL_FLUSH && a !== b.Z_SYNC_FLUSH && a !== b.Z_FULL_FLUSH && a !== b.Z_FINISH && a !== b.Z_BLOCK) throw Error("Invalid flush value"); if (null == c && (c = d.alloc(0), h = 0, g = 0), this.strm.avail_in = h, this.strm.input = c, this.strm.next_in = g, this.strm.avail_out = n, this.strm.output = l, this.strm.next_out = m, this.flush = a, !j) return (this._process(), this._checkError()) ? this._afterSync() : void 0; var o = this; return f.nextTick(function() { @@ -18335,7 +18335,7 @@ 139 === this.strm.input[a] ? (this.gzip_id_bytes_read = 2, this.mode = b.GUNZIP) : this.mode = b.INFLATE; break; default: - throw new Error("invalid number of gzip magic number bytes read"); + throw Error("invalid number of gzip magic number bytes read"); } case b.INFLATE: case b.GUNZIP: @@ -18343,7 +18343,7 @@ for(this.err = n.inflate(this.strm, this.flush), this.err === b.Z_NEED_DICT && this.dictionary && (this.err = n.inflateSetDictionary(this.strm, this.dictionary), this.err === b.Z_OK ? this.err = n.inflate(this.strm, this.flush) : this.err === b.Z_DATA_ERROR && (this.err = b.Z_NEED_DICT)); this.strm.avail_in > 0 && this.mode === b.GUNZIP && this.err === b.Z_STREAM_END && 0 !== this.strm.next_in[0];)this.reset(), this.err = n.inflate(this.strm, this.flush); break; default: - throw new Error("Unknown mode " + this.mode); + throw Error("Unknown mode " + this.mode); } }, a.prototype._checkError = function() { switch(this.err){ @@ -18369,7 +18369,7 @@ }, a.prototype.init = function(c, d, f, a, g) { k(4 === arguments.length || 5 === arguments.length, "init(windowBits, level, memLevel, strategy, [dictionary])"), k(c >= 8 && c <= 15, "invalid windowBits"), k(d >= -1 && d <= 9, "invalid compression level"), k(f >= 1 && f <= 9, "invalid memlevel"), k(a === b.Z_FILTERED || a === b.Z_HUFFMAN_ONLY || a === b.Z_RLE || a === b.Z_FIXED || a === b.Z_DEFAULT_STRATEGY, "invalid strategy"), this._init(d, c, f, a, g), this._setDictionary(); }, a.prototype.params = function() { - throw new Error("deflateParams Not supported"); + throw Error("deflateParams Not supported"); }, a.prototype.reset = function() { this._reset(), this._setDictionary(); }, a.prototype._init = function(a, c, d, f, g) { @@ -18386,7 +18386,7 @@ this.err = n.inflateInit2(this.strm, this.windowBits); break; default: - throw new Error("Unknown mode " + this.mode); + throw Error("Unknown mode " + this.mode); } this.err !== b.Z_OK && this._error("Init error"), this.dictionary = g, this.write_in_progress = !1, this.init_done = !0; }, a.prototype._setDictionary = function() { @@ -18446,14 +18446,14 @@ } function d() { var b, c = null; - h >= y ? c = new RangeError(C) : b = A.concat(g, h), g = [], a.close(), f(c, b); + h >= y ? c = RangeError(C) : b = A.concat(g, h), g = [], a.close(), f(c, b); } a.on("error", function(b) { a.removeListener("end", d), a.removeListener("readable", c), f(b); }), a.on("end", d), a.end(b), c(); } function E(b, a) { - if ("string" == typeof a && (a = A.from(a)), !A.isBuffer(a)) throw new TypeError("Not a string or buffer"); + if ("string" == typeof a && (a = A.from(a)), !A.isBuffer(a)) throw TypeError("Not a string or buffer"); var c = b._finishFlushFlag; return b._processChunk(a, c); } @@ -18490,19 +18490,19 @@ } function c(c, g) { var h = this; - if (this._opts = c = c || {}, this._chunkSize = c.chunkSize || a.Z_DEFAULT_CHUNK, x.call(this, c), c.flush && !F(c.flush)) throw new Error("Invalid flush flag: " + c.flush); - if (c.finishFlush && !F(c.finishFlush)) throw new Error("Invalid flush flag: " + c.finishFlush); - if (this._flushFlag = c.flush || b.Z_NO_FLUSH, this._finishFlushFlag = void 0 !== c.finishFlush ? c.finishFlush : b.Z_FINISH, c.chunkSize && (c.chunkSize < a.Z_MIN_CHUNK || c.chunkSize > a.Z_MAX_CHUNK)) throw new Error("Invalid chunk size: " + c.chunkSize); - if (c.windowBits && (c.windowBits < a.Z_MIN_WINDOWBITS || c.windowBits > a.Z_MAX_WINDOWBITS)) throw new Error("Invalid windowBits: " + c.windowBits); - if (c.level && (c.level < a.Z_MIN_LEVEL || c.level > a.Z_MAX_LEVEL)) throw new Error("Invalid compression level: " + c.level); - if (c.memLevel && (c.memLevel < a.Z_MIN_MEMLEVEL || c.memLevel > a.Z_MAX_MEMLEVEL)) throw new Error("Invalid memLevel: " + c.memLevel); - if (c.strategy && c.strategy != a.Z_FILTERED && c.strategy != a.Z_HUFFMAN_ONLY && c.strategy != a.Z_RLE && c.strategy != a.Z_FIXED && c.strategy != a.Z_DEFAULT_STRATEGY) throw new Error("Invalid strategy: " + c.strategy); - if (c.dictionary && !A.isBuffer(c.dictionary)) throw new Error("Invalid dictionary: it should be a Buffer instance"); + if (this._opts = c = c || {}, this._chunkSize = c.chunkSize || a.Z_DEFAULT_CHUNK, x.call(this, c), c.flush && !F(c.flush)) throw Error("Invalid flush flag: " + c.flush); + if (c.finishFlush && !F(c.finishFlush)) throw Error("Invalid flush flag: " + c.finishFlush); + if (this._flushFlag = c.flush || b.Z_NO_FLUSH, this._finishFlushFlag = void 0 !== c.finishFlush ? c.finishFlush : b.Z_FINISH, c.chunkSize && (c.chunkSize < a.Z_MIN_CHUNK || c.chunkSize > a.Z_MAX_CHUNK)) throw Error("Invalid chunk size: " + c.chunkSize); + if (c.windowBits && (c.windowBits < a.Z_MIN_WINDOWBITS || c.windowBits > a.Z_MAX_WINDOWBITS)) throw Error("Invalid windowBits: " + c.windowBits); + if (c.level && (c.level < a.Z_MIN_LEVEL || c.level > a.Z_MAX_LEVEL)) throw Error("Invalid compression level: " + c.level); + if (c.memLevel && (c.memLevel < a.Z_MIN_MEMLEVEL || c.memLevel > a.Z_MAX_MEMLEVEL)) throw Error("Invalid memLevel: " + c.memLevel); + if (c.strategy && c.strategy != a.Z_FILTERED && c.strategy != a.Z_HUFFMAN_ONLY && c.strategy != a.Z_RLE && c.strategy != a.Z_FIXED && c.strategy != a.Z_DEFAULT_STRATEGY) throw Error("Invalid strategy: " + c.strategy); + if (c.dictionary && !A.isBuffer(c.dictionary)) throw Error("Invalid dictionary: it should be a Buffer instance"); this._handle = new b.Zlib(g); var j = this; this._hadError = !1, this._handle.onerror = function(d, c) { G(j), j._hadError = !0; - var b = new Error(d); + var b = Error(d); b.errno = c, b.code = a.codes[c], j.emit("error", b); }; var d = a.Z_DEFAULT_COMPRESSION; @@ -18569,8 +18569,8 @@ }, a.inflateRawSync = function(a, b) { return E(new v(b), a); }, d.inherits(c, x), c.prototype.params = function(d, c, g) { - if (d < a.Z_MIN_LEVEL || d > a.Z_MAX_LEVEL) throw new RangeError("Invalid compression level: " + d); - if (c != a.Z_FILTERED && c != a.Z_HUFFMAN_ONLY && c != a.Z_RLE && c != a.Z_FIXED && c != a.Z_DEFAULT_STRATEGY) throw new TypeError("Invalid strategy: " + c); + if (d < a.Z_MIN_LEVEL || d > a.Z_MAX_LEVEL) throw RangeError("Invalid compression level: " + d); + if (c != a.Z_FILTERED && c != a.Z_HUFFMAN_ONLY && c != a.Z_RLE && c != a.Z_FIXED && c != a.Z_DEFAULT_STRATEGY) throw TypeError("Invalid strategy: " + c); if (this._level !== d || this._strategy !== c) { var h = this; this.flush(b.Z_SYNC_FLUSH, function() { @@ -18590,7 +18590,7 @@ G(this, a), f.nextTick(H, this); }, c.prototype._transform = function(a, h, d) { var f, c = this._writableState, g = (c.ending || c.ended) && (!a || c.length === a.length); - return null === a || A.isBuffer(a) ? this._handle ? void (g ? f = this._finishFlushFlag : (f = this._flushFlag, a.length >= c.length && (this._flushFlag = this._opts.flush || b.Z_NO_FLUSH)), this._processChunk(a, f, d)) : d(new Error("zlib binding closed")) : d(new Error("invalid input")); + return null === a || A.isBuffer(a) ? this._handle ? void (g ? f = this._finishFlushFlag : (f = this._flushFlag, a.length >= c.length && (this._flushFlag = this._opts.flush || b.Z_NO_FLUSH)), this._processChunk(a, f, d)) : d(Error("zlib binding closed")) : d(Error("invalid input")); }, c.prototype._processChunk = function(a, b, j) { var c = a && a.length, d = this._chunkSize - this._offset, f = 0, p = this, k = "function" == typeof j; if (!k) { @@ -18601,7 +18601,7 @@ do var q = this._handle.writeSync(b, a, f, c, this._buffer, this._offset, d); while (!this._hadError && o(q[0], q[1])) if (this._hadError) throw l; - if (g >= y) throw G(this), new RangeError(C); + if (g >= y) throw G(this), RangeError(C); var n = A.concat(m, g); return G(this), n; } @@ -18635,7 +18635,7 @@ for(var f = Array.prototype.slice.call(arguments, 1); f.length;){ var a = f.shift(); if (a) { - if ("object" != typeof a) throw new TypeError(a + "must be non-object"); + if ("object" != typeof a) throw TypeError(a + "must be non-object"); for(var b in a)d(a, b) && (c[b] = a[b]); } } @@ -19176,7 +19176,7 @@ } else a.head && (a.head.extra = null); a.mode = 6; case 6: - if (1024 & a.flags && ((g = a.length) > f && (g = f), g && (a.head && (s = a.head.extra_len - a.length, a.head.extra || (a.head.extra = new Array(a.head.extra_len)), l.arraySet(a.head.extra, j, h, g, s)), 512 & a.flags && (a.check = n(a.check, j, g, h)), f -= g, h += g, a.length -= g), a.length)) break e; + if (1024 & a.flags && ((g = a.length) > f && (g = f), g && (a.head && (s = a.head.extra_len - a.length, a.head.extra || (a.head.extra = Array(a.head.extra_len)), l.arraySet(a.head.extra, j, h, g, s)), 512 & a.flags && (a.check = n(a.check, j, g, h)), f -= g, h += g, a.length -= g), a.length)) break e; a.length = 0, a.mode = 7; case 7: if (2048 & a.flags) { @@ -19769,17 +19769,17 @@ 14, 1, 15, - ], d = new Array(576); + ], d = Array(576); a(d); - var f = new Array(60); + var f = Array(60); a(f); - var g = new Array(512); + var g = Array(512); a(g); - var h = new Array(256); + var h = Array(256); a(h); - var j = new Array(29); + var j = Array(29); a(j); - var k = new Array(30); + var k = Array(30); function w(a, b, c, d, f) { this.static_tree = a, this.extra_bits = b, this.extra_base = c, this.elems = d, this.max_length = f, this.has_stree = a && a.length; } @@ -19805,7 +19805,7 @@ return a >>> 1; } function D(d, h, j) { - var a, b, f = new Array(16), g = 0; + var a, b, f = Array(16), g = 0; for(a = 1; a <= 15; a++)f[a] = g = g + j[a - 1] << 1; for(b = 0; b <= h; b++){ var c = d[2 * b + 1]; @@ -19878,7 +19878,7 @@ } b._tr_init = function(a) { M || (function() { - var a, m, q, b, c, l = new Array(16); + var a, m, q, b, c, l = Array(16); for(b = 0, q = 0; b < 28; b++)for(a = 0, j[b] = q; a < 1 << r[b]; a++)h[q++] = b; for(h[q - 1] = b, c = 0, b = 0; b < 16; b++)for(a = 0, k[b] = c; a < 1 << s[b]; a++)g[c++] = b; for(c >>= 7; b < 30; b++)for(a = 0, k[b] = c << 7; a < 1 << s[b] - 7; a++)g[256 + c++] = b; @@ -19888,7 +19888,7 @@ for(; a <= 279;)d[2 * a + 1] = 7, a++, l[7]++; for(; a <= 287;)d[2 * a + 1] = 8, a++, l[8]++; for(D(d, 287, l), a = 0; a < 30; a++)f[2 * a + 1] = 5, f[2 * a] = C(a, 5); - n = new w(d, r, 257, 286, 15), o = new w(f, s, 0, 30, 15), p = new w(new Array(0), u, 0, 19, 7); + n = new w(d, r, 257, 286, 15), o = new w(f, s, 0, 30, 15), p = new w(Array(0), u, 0, 19, 7); }(), M = !0), a.l_desc = new x(a.dyn_ltree, n), a.d_desc = new x(a.dyn_dtree, o), a.bl_desc = new x(a.bl_tree, p), a.bi_buf = 0, a.bi_valid = 0, E(a); }, b._tr_stored_block = l, b._tr_flush_block = function(a, j, h, g) { var b, c, k = 0; @@ -19969,7 +19969,7 @@ for(var e = [], c = [], h = "undefined" != typeof Uint8Array ? Uint8Array : Array, d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, f = d.length; a < f; ++a)e[a] = d[a], c[d.charCodeAt(a)] = a; function i(c) { var b = c.length; - if (b % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); + if (b % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4"); var a = c.indexOf("="); -1 === a && (a = b); var d = a === b ? 0 : 4 - a % 4; @@ -19991,13 +19991,13 @@ "use strict"; var g = c(991), h = c(759), d = "function" == typeof Symbol && "function" == typeof Symbol.for ? Symbol.for("nodejs.util.inspect.custom") : null; function i(b) { - if (b > 2147483647) throw new RangeError('The value "' + b + '" is invalid for option "size"'); + if (b > 2147483647) throw RangeError('The value "' + b + '" is invalid for option "size"'); var c = new Uint8Array(b); return Object.setPrototypeOf(c, a.prototype), c; } function a(a, b, c) { if ("number" == typeof a) { - if ("string" == typeof b) throw new TypeError('The "string" argument must be of type string. Received type number'); + if ("string" == typeof b) throw TypeError('The "string" argument must be of type string. Received type number'); return l(a); } return j(a, b, c); @@ -20005,25 +20005,25 @@ function j(b, c, d) { if ("string" == typeof b) return m(b, c); if (ArrayBuffer.isView(b)) return n(b); - if (null == b) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof b); + if (null == b) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof b); if (T(b, ArrayBuffer) || b && T(b.buffer, ArrayBuffer) || "undefined" != typeof SharedArrayBuffer && (T(b, SharedArrayBuffer) || b && T(b.buffer, SharedArrayBuffer))) return o(b, c, d); - if ("number" == typeof b) throw new TypeError('The "value" argument must not be of type number. Received type number'); + if ("number" == typeof b) throw TypeError('The "value" argument must not be of type number. Received type number'); var e = b.valueOf && b.valueOf(); if (null != e && e !== b) return a.from(e, c, d); var f = p(b); if (f) return f; if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof b[Symbol.toPrimitive]) return a.from(b[Symbol.toPrimitive]("string"), c, d); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof b); + throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof b); } function k(a) { - if ("number" != typeof a) throw new TypeError('"size" argument must be of type number'); - if (a < 0) throw new RangeError('The value "' + a + '" is invalid for option "size"'); + if ("number" != typeof a) throw TypeError('"size" argument must be of type number'); + if (a < 0) throw RangeError('The value "' + a + '" is invalid for option "size"'); } function l(a) { return k(a), i(a < 0 ? 0 : 0 | q(a)); } function m(d, b) { - if (("string" != typeof b || "" === b) && (b = "utf8"), !a.isEncoding(b)) throw new TypeError("Unknown encoding: " + b); + if (("string" != typeof b || "" === b) && (b = "utf8"), !a.isEncoding(b)) throw TypeError("Unknown encoding: " + b); var f = 0 | e(d, b), c = i(f), g = c.write(d, b); return g !== f && (c = c.slice(0, g)), c; } @@ -20033,8 +20033,8 @@ } function o(c, b, d) { var e; - if (b < 0 || c.byteLength < b) throw new RangeError('"offset" is outside of buffer bounds'); - if (c.byteLength < b + (d || 0)) throw new RangeError('"length" is outside of buffer bounds'); + if (b < 0 || c.byteLength < b) throw RangeError('"offset" is outside of buffer bounds'); + if (c.byteLength < b + (d || 0)) throw RangeError('"length" is outside of buffer bounds'); return Object.setPrototypeOf(e = void 0 === b && void 0 === d ? new Uint8Array(c) : void 0 === d ? new Uint8Array(c, b) : new Uint8Array(c, b, d), a.prototype), e; } function p(b) { @@ -20045,13 +20045,13 @@ return void 0 !== b.length ? "number" != typeof b.length || (d = b.length) != d ? i(0) : n(b) : "Buffer" === b.type && Array.isArray(b.data) ? n(b.data) : void 0; } function q(a) { - if (a >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes"); + if (a >= 2147483647) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes"); return 0 | a; } function e(b, d) { if (a.isBuffer(b)) return b.length; if (ArrayBuffer.isView(b) || T(b, ArrayBuffer)) return b.byteLength; - if ("string" != typeof b) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof b); + if ("string" != typeof b) throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof b); var c = b.length, e = arguments.length > 2 && !0 === arguments[2]; if (!e && 0 === c) return 0; for(var f = !1;;)switch(d){ @@ -20098,7 +20098,7 @@ case "utf-16le": return H(this, a, b); default: - if (d) throw new TypeError("Unknown encoding: " + c); + if (d) throw TypeError("Unknown encoding: " + c); c = (c + "").toLowerCase(), d = !0; } } @@ -20120,7 +20120,7 @@ if ("number" == typeof c) return (c &= 255, "function" == typeof Uint8Array.prototype.indexOf) ? e ? Uint8Array.prototype.indexOf.call(d, c, b) : Uint8Array.prototype.lastIndexOf.call(d, c, b) : u(d, [ c ], b, f, e); - throw new TypeError("val must be string, number or Buffer"); + throw TypeError("val must be string, number or Buffer"); } function u(f, g, d, c, m) { var a, k = 1, h = f.length, e = g.length; @@ -20226,16 +20226,16 @@ return c; } function I(a, b, c) { - if (a % 1 != 0 || a < 0) throw new RangeError("offset is not uint"); - if (a + b > c) throw new RangeError("Trying to access beyond buffer length"); + if (a % 1 != 0 || a < 0) throw RangeError("offset is not uint"); + if (a + b > c) throw RangeError("Trying to access beyond buffer length"); } function J(b, c, d, e, f, g) { - if (!a.isBuffer(b)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (c > f || c < g) throw new RangeError('"value" argument is out of bounds'); - if (d + e > b.length) throw new RangeError("Index out of range"); + if (!a.isBuffer(b)) throw TypeError('"buffer" argument must be a Buffer instance'); + if (c > f || c < g) throw RangeError('"value" argument is out of bounds'); + if (d + e > b.length) throw RangeError("Index out of range"); } function K(b, d, a, c, e, f) { - if (a + c > b.length || a < 0) throw new RangeError("Index out of range"); + if (a + c > b.length || a < 0) throw RangeError("Index out of range"); } function L(c, a, b, d, e) { return a = +a, b >>>= 0, e || K(c, a, b, 4, 34028234663852886e22, -340282346638528860000000000000000000000), h.write(c, a, b, d, 23, 4), b + 4; @@ -20278,7 +20278,7 @@ }, a.isBuffer = function(b) { return null != b && !0 === b._isBuffer && b !== a.prototype; }, a.compare = function(b, c) { - if (T(b, Uint8Array) && (b = a.from(b, b.offset, b.byteLength)), T(c, Uint8Array) && (c = a.from(c, c.offset, c.byteLength)), !a.isBuffer(b) || !a.isBuffer(c)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (T(b, Uint8Array) && (b = a.from(b, b.offset, b.byteLength)), T(c, Uint8Array) && (c = a.from(c, c.offset, c.byteLength)), !a.isBuffer(b) || !a.isBuffer(c)) throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); if (b === c) return 0; for(var e = b.length, f = c.length, d = 0, g = Math.min(e, f); d < g; ++d)if (b[d] !== c[d]) { e = b[d], f = c[d]; @@ -20303,43 +20303,43 @@ return !1; } }, a.concat = function(b, d) { - if (!Array.isArray(b)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (!Array.isArray(b)) throw TypeError('"list" argument must be an Array of Buffers'); if (0 === b.length) return a.alloc(0); if (void 0 === d) for(e = 0, d = 0; e < b.length; ++e)d += b[e].length; var e, f = a.allocUnsafe(d), g = 0; for(e = 0; e < b.length; ++e){ var c = b[e]; - if (T(c, Uint8Array) && (c = a.from(c)), !a.isBuffer(c)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (T(c, Uint8Array) && (c = a.from(c)), !a.isBuffer(c)) throw TypeError('"list" argument must be an Array of Buffers'); c.copy(f, g), g += c.length; } return f; }, a.byteLength = e, a.prototype._isBuffer = !0, a.prototype.swap16 = function() { var b = this.length; - if (b % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); + if (b % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits"); for(var a = 0; a < b; a += 2)s(this, a, a + 1); return this; }, a.prototype.swap32 = function() { var b = this.length; - if (b % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); + if (b % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits"); for(var a = 0; a < b; a += 4)s(this, a, a + 3), s(this, a + 1, a + 2); return this; }, a.prototype.swap64 = function() { var b = this.length; - if (b % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); + if (b % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits"); for(var a = 0; a < b; a += 8)s(this, a, a + 7), s(this, a + 1, a + 6), s(this, a + 2, a + 5), s(this, a + 3, a + 4); return this; }, a.prototype.toString = function() { var a = this.length; return 0 === a ? "" : 0 === arguments.length ? C(this, 0, a) : r.apply(this, arguments); }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(b) { - if (!a.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); + if (!a.isBuffer(b)) throw TypeError("Argument must be a Buffer"); return this === b || 0 === a.compare(this, b); }, a.prototype.inspect = function() { var a = "", c = b.INSPECT_MAX_BYTES; return a = this.toString("hex", 0, c).replace(/(.{2})/g, "$1 ").trim(), this.length > c && (a += " ... "), ""; }, d && (a.prototype[d] = a.prototype.inspect), a.prototype.compare = function(b, c, d, e, f) { - if (T(b, Uint8Array) && (b = a.from(b, b.offset, b.byteLength)), !a.isBuffer(b)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof b); - if (void 0 === c && (c = 0), void 0 === d && (d = b ? b.length : 0), void 0 === e && (e = 0), void 0 === f && (f = this.length), c < 0 || d > b.length || e < 0 || f > this.length) throw new RangeError("out of range index"); + if (T(b, Uint8Array) && (b = a.from(b, b.offset, b.byteLength)), !a.isBuffer(b)) throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof b); + if (void 0 === c && (c = 0), void 0 === d && (d = b ? b.length : 0), void 0 === e && (e = 0), void 0 === f && (f = this.length), c < 0 || d > b.length || e < 0 || f > this.length) throw RangeError("out of range index"); if (e >= f && c >= d) return 0; if (e >= f) return -1; if (c >= d) return 1; @@ -20359,9 +20359,9 @@ if (void 0 === b) c = "utf8", a = this.length, b = 0; else if (void 0 === a && "string" == typeof b) c = b, a = this.length, b = 0; else if (isFinite(b)) b >>>= 0, isFinite(a) ? (a >>>= 0, void 0 === c && (c = "utf8")) : (c = a, a = void 0); - else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); + else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); var e = this.length - b; - if ((void 0 === a || a > e) && (a = e), d.length > 0 && (a < 0 || b < 0) || b > this.length) throw new RangeError("Attempt to write outside buffer bounds"); + if ((void 0 === a || a > e) && (a = e), d.length > 0 && (a < 0 || b < 0) || b > this.length) throw RangeError("Attempt to write outside buffer bounds"); c || (c = "utf8"); for(var f = !1;;)switch(c){ case "hex": @@ -20382,7 +20382,7 @@ case "utf-16le": return A(this, d, b, a); default: - if (f) throw new TypeError("Unknown encoding: " + c); + if (f) throw TypeError("Unknown encoding: " + c); c = ("" + c).toLowerCase(), f = !0; } }, a.prototype.toJSON = function() { @@ -20504,11 +20504,11 @@ }, a.prototype.writeDoubleBE = function(a, b, c) { return M(this, a, b, !1, c); }, a.prototype.copy = function(e, d, c, b) { - if (!a.isBuffer(e)) throw new TypeError("argument should be a Buffer"); + if (!a.isBuffer(e)) throw TypeError("argument should be a Buffer"); if (c || (c = 0), b || 0 === b || (b = this.length), d >= e.length && (d = e.length), d || (d = 0), b > 0 && b < c && (b = c), b === c || 0 === e.length || 0 === this.length) return 0; - if (d < 0) throw new RangeError("targetStart out of bounds"); - if (c < 0 || c >= this.length) throw new RangeError("Index out of range"); - if (b < 0) throw new RangeError("sourceEnd out of bounds"); + if (d < 0) throw RangeError("targetStart out of bounds"); + if (c < 0 || c >= this.length) throw RangeError("Index out of range"); + if (b < 0) throw RangeError("sourceEnd out of bounds"); b > this.length && (b = this.length), e.length - d < b - c && (b = e.length - d + c); var g = b - c; if (this === e && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(d, c, b); @@ -20517,19 +20517,19 @@ return g; }, a.prototype.fill = function(b, d, c, e) { if ("string" == typeof b) { - if ("string" == typeof d ? (e = d, d = 0, c = this.length) : "string" == typeof c && (e = c, c = this.length), void 0 !== e && "string" != typeof e) throw new TypeError("encoding must be a string"); - if ("string" == typeof e && !a.isEncoding(e)) throw new TypeError("Unknown encoding: " + e); + if ("string" == typeof d ? (e = d, d = 0, c = this.length) : "string" == typeof c && (e = c, c = this.length), void 0 !== e && "string" != typeof e) throw TypeError("encoding must be a string"); + if ("string" == typeof e && !a.isEncoding(e)) throw TypeError("Unknown encoding: " + e); if (1 === b.length) { var f, g = b.charCodeAt(0); ("utf8" === e && g < 128 || "latin1" === e) && (b = g); } } else "number" == typeof b ? b &= 255 : "boolean" == typeof b && (b = Number(b)); - if (d < 0 || this.length < d || this.length < c) throw new RangeError("Out of range index"); + if (d < 0 || this.length < d || this.length < c) throw RangeError("Out of range index"); if (c <= d) return this; if (d >>>= 0, c = void 0 === c ? this.length : c >>> 0, b || (b = 0), "number" == typeof b) for(f = d; f < c; ++f)this[f] = b; else { var h = a.isBuffer(b) ? b : a.from(b, e), i = h.length; - if (0 === i) throw new TypeError('The value "' + b + '" is invalid for argument "value"'); + if (0 === i) throw TypeError('The value "' + b + '" is invalid for argument "value"'); for(f = 0; f < c - d; ++f)this[f + d] = h[f % i]; } return this; @@ -20565,7 +20565,7 @@ } else if (a < 1114112) { if ((b -= 4) < 0) break; c.push(a >> 18 | 240, a >> 12 & 63 | 128, a >> 6 & 63 | 128, 63 & a | 128); - } else throw new Error("Invalid code point"); + } else throw Error("Invalid code point"); } return c; } @@ -20592,7 +20592,7 @@ return a instanceof b || null != a && null != a.constructor && null != a.constructor.name && a.constructor.name === b.name; } var U = function() { - for(var c = "0123456789abcdef", d = new Array(256), a = 0; a < 16; ++a)for(var e = 16 * a, b = 0; b < 16; ++b)d[e + b] = c[a] + c[b]; + for(var c = "0123456789abcdef", d = Array(256), a = 0; a < 16; ++a)for(var e = 16 * a, b = 0; b < 16; ++b)d[e + b] = c[a] + c[b]; return d; }(); }, @@ -20669,7 +20669,7 @@ }, a.EventEmitter = a, a.prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0; var h = 10; function i(a) { - if ("function" != typeof a) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof a); + if ("function" != typeof a) throw TypeError('The "listener" argument must be of type Function. Received type ' + typeof a); } function j(b) { return void 0 === b._maxListeners ? a.defaultMaxListeners : b._maxListeners; @@ -20684,7 +20684,7 @@ b ] : e ? f.unshift(b) : f.push(b), (h = j(a)) > 0 && f.length > h && !f.warned) { f.warned = !0; - var h, k, f, g, d = new Error("Possible EventEmitter memory leak detected. " + f.length + " " + String(c) + " listeners added. Use emitter.setMaxListeners() to increase limit"); + var h, k, f, g, d = Error("Possible EventEmitter memory leak detected. " + f.length + " " + String(c) + " listeners added. Use emitter.setMaxListeners() to increase limit"); d.name = "MaxListenersExceededWarning", d.emitter = a, d.type = c, d.count = f.length, g = d, console && console.warn && console.warn(g); } return a; @@ -20722,11 +20722,11 @@ return 0; } function o(d, b) { - for(var c = new Array(b), a = 0; a < b; ++a)c[a] = d[a]; + for(var c = Array(b), a = 0; a < b; ++a)c[a] = d[a]; return c; } function p(b) { - for(var c = new Array(b.length), a = 0; a < c.length; ++a)c[a] = b[a].listener || b[a]; + for(var c = Array(b.length), a = 0; a < c.length; ++a)c[a] = b[a].listener || b[a]; return c; } function q(a, b, c) { @@ -20737,7 +20737,7 @@ else if ("function" == typeof a.addEventListener) a.addEventListener(b, function e(f) { d.once && a.removeEventListener(b, e), c(f); }); - else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof a); + else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof a); } Object.defineProperty(a, "defaultMaxListeners", { enumerable: !0, @@ -20745,13 +20745,13 @@ return h; }, set: function(a) { - if ("number" != typeof a || a < 0 || g(a)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + a + "."); + if ("number" != typeof a || a < 0 || g(a)) throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + a + "."); h = a; } }), a.init = function() { (void 0 === this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; }, a.prototype.setMaxListeners = function(a) { - if ("number" != typeof a || a < 0 || g(a)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + a + "."); + if ("number" != typeof a || a < 0 || g(a)) throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + a + "."); return this._maxListeners = a, this; }, a.prototype.getMaxListeners = function() { return j(this); @@ -20762,7 +20762,7 @@ else if (!d) return !1; if (d) { if (b.length > 0 && (g = b[0]), g instanceof Error) throw g; - var g, i = new Error("Unhandled error." + (g ? " (" + g.message + ")" : "")); + var g, i = Error("Unhandled error." + (g ? " (" + g.message + ")" : "")); throw i.context = g, i; } var c = e[h]; @@ -20841,10 +20841,10 @@ 162: function(c) { var e, f, g, a = c.exports = {}; function h() { - throw new Error("setTimeout has not been defined"); + throw Error("setTimeout has not been defined"); } function i() { - throw new Error("clearTimeout has not been defined"); + throw Error("clearTimeout has not been defined"); } function j(a) { if (e === setTimeout) return setTimeout(a, 0); @@ -20903,7 +20903,7 @@ } function b() {} a.nextTick = function(c) { - var b = new Array(arguments.length - 1); + var b = Array(arguments.length - 1); if (arguments.length > 1) for(var a = 1; a < arguments.length; a++)b[a - 1] = arguments[a]; k.push(new d(c, b)), 1 !== k.length || l || j(o); }, d.prototype.run = function() { @@ -20911,11 +20911,11 @@ }, a.title = "browser", a.browser = !0, a.env = {}, a.argv = [], a.version = "", a.versions = {}, a.on = b, a.addListener = b, a.once = b, a.off = b, a.removeListener = b, a.removeAllListeners = b, a.emit = b, a.prependListener = b, a.prependOnceListener = b, a.listeners = function(a) { return []; }, a.binding = function(a) { - throw new Error("process.binding is not supported"); + throw Error("process.binding is not supported"); }, a.cwd = function() { return "/"; }, a.chdir = function(a) { - throw new Error("process.chdir is not supported"); + throw Error("process.chdir is not supported"); }, a.umask = function() { return 0; }; @@ -20970,17 +20970,17 @@ return b(a, c, d); } b.from && b.alloc && b.allocUnsafe && b.allocUnsafeSlow ? f.exports = c : (e(c, d), d.Buffer = a), a.prototype = Object.create(b.prototype), e(b, a), a.from = function(a, c, d) { - if ("number" == typeof a) throw new TypeError("Argument must not be a number"); + if ("number" == typeof a) throw TypeError("Argument must not be a number"); return b(a, c, d); }, a.alloc = function(d, c, e) { - if ("number" != typeof d) throw new TypeError("Argument must be a number"); + if ("number" != typeof d) throw TypeError("Argument must be a number"); var a = b(d); return void 0 !== c ? "string" == typeof e ? a.fill(c, e) : a.fill(c) : a.fill(0), a; }, a.allocUnsafe = function(a) { - if ("number" != typeof a) throw new TypeError("Argument must be a number"); + if ("number" != typeof a) throw TypeError("Argument must be a number"); return b(a); }, a.allocUnsafeSlow = function(a) { - if ("number" != typeof a) throw new TypeError("Argument must be a number"); + if ("number" != typeof a) throw TypeError("Argument must be a number"); return c.SlowBuffer(a); }; }, @@ -21505,14 +21505,14 @@ a.bufferProcessing = !0; var b = a.bufferedRequest; if (d._writev && b && b.next) { - var i = a.bufferedRequestCount, e = new Array(i), c = a.corkedRequestsFree; + var e = Array(a.bufferedRequestCount), c = a.corkedRequestsFree; c.entry = b; for(var f = 0, g = !0; b;)e[f] = b, b.isBuf || (g = !1), b = b.next, f += 1; e.allBuffers = g, B(d, a, !0, a.length, e, "", c.finish), a.pendingcb++, a.lastBufferedRequest = null, c.next ? (a.corkedRequestsFree = c.next, c.next = null) : a.corkedRequestsFree = new l(a), a.bufferedRequestCount = 0; } else { for(; b;){ - var h = b.chunk, j = b.encoding, k = b.callback, m = a.objectMode ? 1 : h.length; - if (B(d, a, !1, m, h, j, k), b = b.next, a.bufferedRequestCount--, a.writing) break; + var h = b.chunk, i = b.encoding, j = b.callback, k = a.objectMode ? 1 : h.length; + if (B(d, a, !1, k, h, i, j), b = b.next, a.bufferedRequestCount--, a.writing) break; } null === b && (a.lastBufferedRequest = null); } @@ -21777,7 +21777,7 @@ var a, c, d; function k() { !function(a, b) { - if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); + if (!(a instanceof b)) throw TypeError("Cannot call a class as a function"); }(this, k), this.head = null, this.tail = null, this.length = 0; } return a = k, c = [ @@ -21933,7 +21933,7 @@ b || (b = {}), d = (o = d || f, p = !1, function() { if (!p) { p = !0; - for(var b = arguments.length, c = new Array(b), a = 0; a < b; a++)c[a] = arguments[a]; + for(var b = arguments.length, c = Array(b), a = 0; a < b; a++)c[a] = arguments[a]; o.apply(this, c); } }); @@ -22052,7 +22052,7 @@ return a.pipe(b); } b.exports = function() { - for(var l, k = arguments.length, a = new Array(k), b = 0; b < k; b++)a[b] = arguments[b]; + for(var l, k = arguments.length, a = Array(k), b = 0; b < k; b++)a[b] = arguments[b]; var d, m = (d = a).length && "function" == typeof d[d.length - 1] ? d.pop() : h; if (Array.isArray(a[0]) && (a = a[0]), a.length < 2) throw new f("streams"); var n = a.map(function(d, b) { @@ -22154,7 +22154,7 @@ a = ("" + a).toLowerCase(), b = !0; } }(a); - if ("string" != typeof b && (d.isEncoding === f || !f(a))) throw new Error("Unknown encoding: " + a); + if ("string" != typeof b && (d.isEncoding === f || !f(a))) throw Error("Unknown encoding: " + a); return b || a; }(b), this.encoding){ case "utf16le": @@ -22251,7 +22251,7 @@ var d = !1; return function() { if (!d) { - if (c("throwDeprecation")) throw new Error(b); + if (c("throwDeprecation")) throw Error(b); c("traceDeprecation") ? console.trace(b) : console.warn(b), d = !0; } return a.apply(this, arguments); @@ -22309,7 +22309,7 @@ 901: function(a) { a.exports = function(a, d, e) { if (a.filter) return a.filter(d, e); - if (null == a || "function" != typeof d) throw new TypeError(); + if (null == a || "function" != typeof d) throw TypeError(); for(var f = [], c = 0; c < a.length; c++)if (b.call(a, c)) { var g = a[c]; d.call(e, g, c, a) && f.push(g); @@ -22705,7 +22705,7 @@ 219: function(a) { var b = Object.prototype.hasOwnProperty, c = Object.prototype.toString; a.exports = function(a, e, h) { - if ("[object Function]" !== c.call(e)) throw new TypeError("iterator must be a function"); + if ("[object Function]" !== c.call(e)) throw TypeError("iterator must be a function"); var f = a.length; if (f === +f) for(var d = 0; d < f; d++)e.call(h, a[d], d, a); else for(var g in a)b.call(a, g) && e.call(h, a[g], g, a); @@ -22716,7 +22716,7 @@ var b = Array.prototype.slice, c = Object.prototype.toString; a.exports = function(k) { var d, a = this; - if ("function" != typeof a || "[object Function]" !== c.call(a)) throw new TypeError("Function.prototype.bind called on incompatible " + a); + if ("function" != typeof a || "[object Function]" !== c.call(a)) throw TypeError("Function.prototype.bind called on incompatible " + a); for(var h = b.call(arguments, 1), i = function() { if (!(this instanceof d)) return a.apply(k, h.concat(b.call(arguments))); var c = a.apply(this, h.concat(b.call(arguments))); @@ -23179,7 +23179,7 @@ }, n = b("String.prototype.slice"), o = {}, i = a(982), j = Object.getPrototypeOf; g && i && j && d(h, function(a) { var c = new __webpack_require__.g[a](); - if (!(Symbol.toStringTag in c)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in c)) throw EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); var d = j(c), b = i(d, Symbol.toStringTag); if (!b) { var e = j(d); @@ -23339,7 +23339,7 @@ Object.defineProperty(a, b, { enumerable: !1, value: function() { - throw new Error(b + " is not supported in userland"); + throw Error(b + " is not supported in userland"); } }); }); @@ -23351,27 +23351,27 @@ }, u = /%[sdj%]/g; a.format = function(f) { if (!n(f)) { - for(var g = [], a = 0; a < arguments.length; a++)g.push(d(arguments[a])); + for(var g = [], a = 0; a < arguments.length; a++)g.push(c(arguments[a])); return g.join(" "); } - for(var a = 1, c = arguments, h = c.length, e = String(f).replace(u, function(b) { + for(var a = 1, d = arguments, h = d.length, e = String(f).replace(u, function(b) { if ("%%" === b) return "%"; if (a >= h) return b; switch(b){ case "%s": - return String(c[a++]); + return String(d[a++]); case "%d": - return Number(c[a++]); + return Number(d[a++]); case "%j": try { - return JSON.stringify(c[a++]); - } catch (d) { + return JSON.stringify(d[a++]); + } catch (c) { return "[Circular]"; } default: return b; } - }), b = c[a]; a < h; b = c[++a])k(b) || !p(b) ? e += " " + b : e += " " + d(b); + }), b = d[a]; a < h; b = d[++a])k(b) || !p(b) ? e += " " + b : e += " " + c(b); return e; }, a.deprecate = function(b, c) { if (void 0 !== process && !0 === process.noDeprecation) return b; @@ -23381,7 +23381,7 @@ var d = !1; return function() { if (!d) { - if (process.throwDeprecation) throw new Error(c); + if (process.throwDeprecation) throw Error(c); process.traceDeprecation ? console.trace(c) : console.error(c), d = !0; } return b.apply(this, arguments); @@ -23389,19 +23389,19 @@ }; var v = {}, h = /^$/; if (process.env.NODE_DEBUG) { - var c = process.env.NODE_DEBUG; - c = c.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), h = new RegExp("^" + c + "$", "i"); + var d = process.env.NODE_DEBUG; + h = RegExp("^" + (d = d.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase()) + "$", "i"); } - function d(d, c) { + function c(d, c) { var b = { seen: [], stylize: x }; return arguments.length >= 3 && (b.depth = arguments[2]), arguments.length >= 4 && (b.colors = arguments[3]), j(c) ? b.showHidden = c : c && a._extend(b, c), o(b.showHidden) && (b.showHidden = !1), o(b.depth) && (b.depth = 2), o(b.colors) && (b.colors = !1), o(b.customInspect) && (b.customInspect = !0), b.colors && (b.stylize = w), y(b, d, b.depth); } - function w(b, c) { - var a = d.styles[c]; - return a ? "[" + d.colors[a][0] + "m" + b + "[" + d.colors[a][1] + "m" : b; + function w(b, d) { + var a = c.styles[d]; + return a ? "[" + c.colors[a][0] + "m" + b + "[" + c.colors[a][1] + "m" : b; } function x(a, b) { return a; @@ -23527,7 +23527,7 @@ } else v[b] = function() {}; } return v[b]; - }, a.inspect = d, d.colors = { + }, a.inspect = c, c.colors = { bold: [ 1, 22 @@ -23580,7 +23580,7 @@ 33, 39 ] - }, d.styles = { + }, c.styles = { special: "cyan", number: "yellow", boolean: "yellow", @@ -23630,16 +23630,16 @@ var r = "undefined" != typeof Symbol ? Symbol("util.promisify.custom") : void 0; function I(a, c) { if (!a) { - var b = new Error("Promise was rejected with a falsy value"); + var b = Error("Promise was rejected with a falsy value"); b.reason = a, a = b; } return c(a); } a.promisify = function(b) { - if ("function" != typeof b) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof b) throw TypeError('The "original" argument must be of type Function'); if (r && b[r]) { var a = b[r]; - if ("function" != typeof a) throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + if ("function" != typeof a) throw TypeError('The "util.promisify.custom" argument must be of type Function'); return Object.defineProperty(a, r, { value: a, enumerable: !1, @@ -23668,11 +23668,11 @@ configurable: !0 }), Object.defineProperties(a, t(b)); }, a.promisify.custom = r, a.callbackify = function(a) { - if ("function" != typeof a) throw new TypeError('The "original" argument must be of type Function'); + if ("function" != typeof a) throw TypeError('The "original" argument must be of type Function'); function b() { for(var b = [], c = 0; c < arguments.length; c++)b.push(arguments[c]); var d = b.pop(); - if ("function" != typeof d) throw new TypeError("The last argument must be of type Function"); + if ("function" != typeof d) throw TypeError("The last argument must be of type Function"); var e = this, f = function() { return d.apply(e, arguments); }; @@ -23691,7 +23691,7 @@ g && i && j && d(h, function(a) { if ("function" == typeof __webpack_require__.g[a]) { var c = new __webpack_require__.g[a](); - if (!(Symbol.toStringTag in c)) throw new EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); + if (!(Symbol.toStringTag in c)) throw EvalError("this engine has support for Symbol.toStringTag, but " + a + " does not have the property! Please report this."); var d = j(c), b = i(d, Symbol.toStringTag); if (!b) { var e = j(d); @@ -24217,7 +24217,7 @@ }; a = function(a) { var m = null !== a && "object" == typeof a, n = "[object Function]" === g.call(a), p = h(a), q = m && "[object String]" === g.call(a), b = []; - if (!m && !n && !p) throw new TypeError("Object.keys called on a non-object"); + if (!m && !n && !p) throw TypeError("Object.keys called on a non-object"); var r = j && n; if (q && a.length > 0 && !f.call(a, 0)) for(var d = 0; d < a.length; ++d)b.push(String(d)); if (p && a.length > 0) for(var e = 0; e < a.length; ++e)b.push(String(e)); @@ -24259,7 +24259,7 @@ c ].concat(a.splice(0, 2))), f = "l", c = "m" == c ? "l" : "L");;){ if (a.length == b[f]) return a.unshift(c), d.push(a); - if (a.length < b[f]) throw new Error("malformed path data"); + if (a.length < b[f]) throw Error("malformed path data"); d.push([ c ].concat(a.splice(0, b[f]))); @@ -27801,7 +27801,7 @@ var c, e; try { e = a(Object(function() { - var a = new Error("Cannot find module 'iconv-lite'"); + var a = Error("Cannot find module 'iconv-lite'"); throw a.code = "MODULE_NOT_FOUND", a; }())); } catch (f) {} @@ -27872,7 +27872,7 @@ e = a(9681), f = a(2903); try { g = a(Object(function() { - var a = new Error("Cannot find module 'iconv-lite'"); + var a = Error("Cannot find module 'iconv-lite'"); throw a.code = "MODULE_NOT_FOUND", a; }())); } catch (j) {} @@ -27906,7 +27906,7 @@ return this.writeBuffer(a); default: if (g) return this.writeBuffer(g.encode(e, c)); - throw new Error("Install iconv-lite to enable additional string encodings."); + throw Error("Install iconv-lite to enable additional string encodings."); } }, a.prototype.writeUInt24BE = function(a) { return this.ensure(3), this.buffer[this.bufferOffset++] = a >>> 16 & 0xff, this.buffer[this.bufferOffset++] = a >>> 8 & 0xff, this.buffer[this.bufferOffset++] = 0xff & a, this.pos += 3; @@ -27939,7 +27939,7 @@ return this.type.size(); }, a.prototype.encode = function(c, a) { var b; - if (-1 === (b = this.options.indexOf(a))) throw new Error("Unknown option in enum: " + a); + if (-1 === (b = this.options.indexOf(a))) throw Error("Unknown option in enum: " + a); return this.type.encode(c, b); }, a; }(), a.exports = b; @@ -28046,7 +28046,7 @@ e = c(2022), a = function() { function a(f, g, a) { var b, c, d, e; - this.offsetType = f, this.type = g, this.options = null != a ? a : {}, "void" === this.type && (this.type = null), null == (b = this.options).type && (b.type = "local"), null == (c = this.options).allowNull && (c.allowNull = !0), null == (d = this.options).nullValue && (d.nullValue = 0), null == (e = this.options).lazy && (e.lazy = !1), this.options.relativeTo && (this.relativeToGetter = new Function("ctx", "return ctx." + this.options.relativeTo)); + this.offsetType = f, this.type = g, this.options = null != a ? a : {}, "void" === this.type && (this.type = null), null == (b = this.options).type && (b.type = "local"), null == (c = this.options).allowNull && (c.allowNull = !0), null == (d = this.options).nullValue && (d.nullValue = 0), null == (e = this.options).lazy && (e.lazy = !1), this.options.relativeTo && (this.relativeToGetter = Function("ctx", "return ctx." + this.options.relativeTo)); } return a.prototype.decode = function(g, c) { var j, a, d, f, b, h, i; @@ -28081,7 +28081,7 @@ for(; a.parent;)a = a.parent; } if (null == (c = this.type)) { - if (!(b instanceof d)) throw new Error("Must be a VoidPointer"); + if (!(b instanceof d)) throw Error("Must be a VoidPointer"); c = b.type, b = b.value; } return b && a && (a.pointerSize += c.size(b, e)), this.offsetType.size(); @@ -28105,7 +28105,7 @@ for(c = 0; a.parent;)a = a.parent; } if (this.options.relativeTo && (c += this.relativeToGetter(e.val)), this.offsetType.encode(g, a.pointerOffset - c), null == (f = this.type)) { - if (!(b instanceof d)) throw new Error("Must be a VoidPointer"); + if (!(b instanceof d)) throw Error("Must be a VoidPointer"); f = b.type, b = b.value; } return a.pointers.push({ @@ -28225,21 +28225,21 @@ }; b = function(b) { function a(b, a) { - this.type = b, this.versions = null != a ? a : {}, "string" == typeof this.type && (this.versionGetter = new Function("parent", "return parent." + this.type), this.versionSetter = new Function("parent", "version", "return parent." + this.type + " = version")); + this.type = b, this.versions = null != a ? a : {}, "string" == typeof this.type && (this.versionGetter = Function("parent", "return parent." + this.type), this.versionSetter = Function("parent", "version", "return parent." + this.type + " = version")); } return e(a, b), a.prototype.decode = function(c, e, f) { var d, b, g; - if (null == f && (f = 0), b = this._setup(c, e, f), "string" == typeof this.type ? b.version = this.versionGetter(e) : b.version = this.type.decode(c), this.versions.header && this._parseFields(c, b, this.versions.header), null == (d = this.versions[b.version])) throw new Error("Unknown version " + b.version); + if (null == f && (f = 0), b = this._setup(c, e, f), "string" == typeof this.type ? b.version = this.versionGetter(e) : b.version = this.type.decode(c), this.versions.header && this._parseFields(c, b, this.versions.header), null == (d = this.versions[b.version])) throw Error("Unknown version " + b.version); return d instanceof a ? d.decode(c, e) : (this._parseFields(c, b, d), null != (g = this.process) && g.call(b, c), b); }, a.prototype.size = function(a, i, f) { var d, g, b, c, e, h; - if (null == f && (f = !0), !a) throw new Error("Not a fixed size"); + if (null == f && (f = !0), !a) throw Error("Not a fixed size"); if (d = { parent: i, val: a, pointerSize: 0 }, c = 0, "string" != typeof this.type && (c += this.type.size(a.version, d)), this.versions.header) for(b in h = this.versions.header)null != (e = h[b]).size && (c += e.size(a[b], d)); - if (null == (g = this.versions[a.version])) throw new Error("Unknown version " + a.version); + if (null == (g = this.versions[a.version])) throw Error("Unknown version " + a.version); for(b in g)null != (e = g[b]).size && (c += e.size(a[b], d)); return f && (c += d.pointerSize), c; }, a.prototype.encode = function(a, b, k) { @@ -28262,7 +28262,7 @@ var d, a; d = c(3660).Number, b.resolveLength = function(a, e, c) { var b; - if ("number" == typeof a ? b = a : "function" == typeof a ? b = a.call(c, c) : c && "string" == typeof a ? b = c[a] : e && a instanceof d && (b = a.decode(e)), isNaN(b)) throw new Error("Not a fixed size"); + if ("number" == typeof a ? b = a : "function" == typeof a ? b = a.call(c, c) : c && "string" == typeof a ? b = c[a] : e && a instanceof d && (b = a.decode(e)), isNaN(b)) throw Error("Not a fixed size"); return b; }, a = function(a) { var b, c; @@ -28409,7 +28409,7 @@ default: b = -3; } - if (0 !== b) throw new Error("Data error"); + if (0 !== b) throw Error("Data error"); }while (!c) return a.destLen < a.dest.length ? "function" == typeof a.dest.slice ? a.dest.slice(0, a.destLen) : a.dest.subarray(0, a.destLen) : a.dest; }; @@ -28447,7 +28447,7 @@ 7326: function(c, a, b) { "use strict"; function d(a) { - if (void 0 === a) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === a) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return a; } b.d(a, { @@ -28479,7 +28479,7 @@ "use strict"; function d(c, a) { (null == a || a > c.length) && (a = c.length); - for(var b = 0, d = new Array(a); b < a; b++)d[b] = c[b]; + for(var b = 0, d = Array(a); b < a; b++)d[b] = c[b]; return d; } function e(a, c) { @@ -28504,7 +28504,7 @@ }; }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } b.d(a, { Z: function() { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js index ddadea8d189..6f1db1438e0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js @@ -3497,7 +3497,7 @@ }), destination); } deepmerge.all = function(array, options) { - if (!Array.isArray(array)) throw new Error("first argument should be an array"); + if (!Array.isArray(array)) throw Error("first argument should be an array"); return array.reduce(function(prev, next) { return deepmerge(prev, next, options); }, {}); @@ -4455,8 +4455,8 @@ } var A1 = void 0 !== process && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", I1 = "undefined" != typeof window && "HTMLElement" in window, P1 = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : void 0 !== process && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : void 0 !== process && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY && "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY), O1 = {}; function j(e) { - for(var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; - throw new Error("An error occurred. See https://git.io/JUIaE#" + e + " for more information." + (n.length > 0 ? " Args: " + n.join(", ") : "")); + for(var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; + throw Error("An error occurred. See https://git.io/JUIaE#" + e + " for more information." + (n.length > 0 ? " Args: " + n.join(", ") : "")); } var T1 = function() { function e1(e) { @@ -4492,7 +4492,7 @@ return x1.set(e, t), k1.set(t, e), t; }, M1 = function(e, t) { t >= V1 && (V1 = t + 1), x1.set(e, t), k1.set(t, e); - }, G1 = "style[" + A1 + '][data-styled-version="5.3.5"]', L1 = new RegExp("^" + A1 + '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'), F1 = function(e, t, n) { + }, G1 = "style[" + A1 + '][data-styled-version="5.3.5"]', L1 = RegExp("^" + A1 + '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'), F1 = function(e, t, n) { for(var r, o = n.split(","), s = 0, i = o.length; s < i; s++)(r = o[s]) && e.registerName(t, r); }, Y1 = function(e, t) { for(var n = (t.textContent || "").split("/*!sc*/\n"), r = [], o = 0, s = n.length; o < s; o++){ @@ -4725,7 +4725,7 @@ function m(e, s, i, a) { void 0 === a && (a = "&"); var c = e.replace(ie, ""); - return t10 = a, n3 = s, r2 = new RegExp("\\" + n3 + "\\b", "g"), o1 = new RegExp("(\\" + n3 + "\\b){2,}"), l1(i || !s ? "" : s, s && i ? i + " " + s + " { " + c + " }" : c); + return t10 = a, r2 = RegExp("\\" + (n3 = s) + "\\b", "g"), o1 = RegExp("(\\" + n3 + "\\b){2,}"), l1(i || !s ? "" : s, s && i ? i + " " + s + " { " + c + " }" : c); } return l1.use([].concat(u1, [ function(e, t, o) { @@ -4824,7 +4824,7 @@ return Array.isArray(e) && (e.isCss = !0), e; }; function Ce(e) { - for(var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; + for(var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; return b1(e) || S1(e) ? Ae(Ne(g1(w1, [ e ].concat(n)))) : 0 === n.length && 1 === e.length && "string" == typeof e[0] ? e : Ae(Ne(g1(e, n))); @@ -4849,7 +4849,7 @@ Ve(t) && Ve(r) ? Me(r, t) : e[n] = t; } function Me(e) { - for(var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; + for(var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; for(var o = 0, s = n; o < s.length; o++){ var e17, i = s[o]; if (Ve(i)) for(var a in i)"__proto__" !== (e17 = a) && "constructor" !== e17 && "prototype" !== e17 && ze(e, i[a], a); @@ -5233,7 +5233,7 @@ config[key] = createStyleFunction(conf); }), createParser1(config); }, compose = function() { - for(var config = {}, _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++)parsers[_key] = arguments[_key]; + for(var config = {}, _len = arguments.length, parsers = Array(_len), _key = 0; _key < _len; _key++)parsers[_key] = arguments[_key]; return parsers.forEach(function(parser) { parser && parser.config && object_assign_default()(config, parser.config); }), createParser1(config); @@ -6419,9 +6419,9 @@ return target; }).apply(this, arguments); } - Boolean("undefined" != typeof window && window.document && window.document.createElement); + "undefined" != typeof window && window.document && window.document.createElement; const GlobalStyle = function(e29) { - for(var t22 = arguments.length, n11 = new Array(t22 > 1 ? t22 - 1 : 0), o7 = 1; o7 < t22; o7++)n11[o7 - 1] = arguments[o7]; + for(var t22 = arguments.length, n11 = Array(t22 > 1 ? t22 - 1 : 0), o7 = 1; o7 < t22; o7++)n11[o7 - 1] = arguments[o7]; var i = Ce.apply(void 0, [ e29 ].concat(n11)), a = "sc-global-" + xe(JSON.stringify(i)), u = new $e(i, a); @@ -6496,10 +6496,10 @@ 162: function(e31) { var r8, n, u, t24 = e31.exports = {}; function defaultSetTimout() { - throw new Error("setTimeout has not been defined"); + throw Error("setTimeout has not been defined"); } function defaultClearTimeout() { - throw new Error("clearTimeout has not been defined"); + throw Error("clearTimeout has not been defined"); } function runTimeout(e) { if (r8 === setTimeout) return setTimeout(e, 0); @@ -6558,7 +6558,7 @@ } function noop() {} t24.nextTick = function(e) { - var t = new Array(arguments.length - 1); + var t = Array(arguments.length - 1); if (arguments.length > 1) for(var r = 1; r < arguments.length; r++)t[r - 1] = arguments[r]; i.push(new Item(e, t)), 1 !== i.length || o || runTimeout(drainQueue); }, Item.prototype.run = function() { @@ -6566,11 +6566,11 @@ }, t24.title = "browser", t24.browser = !0, t24.env = {}, t24.argv = [], t24.version = "", t24.versions = {}, t24.on = noop, t24.addListener = noop, t24.once = noop, t24.off = noop, t24.removeListener = noop, t24.removeAllListeners = noop, t24.emit = noop, t24.prependListener = noop, t24.prependOnceListener = noop, t24.listeners = function(e) { return []; }, t24.binding = function(e) { - throw new Error("process.binding is not supported"); + throw Error("process.binding is not supported"); }, t24.cwd = function() { return "/"; }, t24.chdir = function(e) { - throw new Error("process.chdir is not supported"); + throw Error("process.chdir is not supported"); }, t24.umask = function() { return 0; }; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/swc-4559/output.js b/crates/swc_ecma_minifier/tests/fixture/next/swc-4559/output.js index 265a5c3bbfd..23b46ec4af0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/swc-4559/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/swc-4559/output.js @@ -4,7 +4,7 @@ ], { 4816: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - return new Error(`MUI: \`\` is not a valid prop. + return Error(`MUI: \`\` is not a valid prop. Only page size below ${MAX_PAGE_SIZE} is available in the MIT version. You need to upgrade to the DataGridPro component to unlock this feature.`); diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/18/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/18/output.js index e5b6a34ab2a..cd7d34d0310 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/18/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/18/output.js @@ -2,6 +2,6 @@ export const obj = { _routeToRegExp: function(route) { return route = route.replace(escapeRegExp, "\\$&").replace(optionalParam, "(?:$1)?").replace(namedParam, function(match, optional) { return optional ? match : "([^/]+)"; - }).replace(splatParam, "(.*?)"), new RegExp("^" + route + "$"); + }).replace(splatParam, "(.*?)"), RegExp("^" + route + "$"); } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/jquery/10/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/jquery/10/output.js index 6670be0540d..4e9ceda7be8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/jquery/10/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/jquery/10/output.js @@ -5,7 +5,7 @@ export const obj = { contexts[i] = this, values[i] = arguments.length > 1 ? core_slice.call(arguments) : value, values === progressValues ? deferred.notifyWith(contexts, values) : --remaining || deferred.resolveWith(contexts, values); }; }; - if (length > 1) for(progressValues = new Array(length), progressContexts = new Array(length), resolveContexts = new Array(length); i1 < length; i1++)resolveValues[i1] && jQuery.isFunction(resolveValues[i1].promise) ? resolveValues[i1].promise().done(updateFunc(i1, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i1, progressContexts, progressValues)) : --remaining; + if (length > 1) for(progressValues = Array(length), progressContexts = Array(length), resolveContexts = Array(length); i1 < length; i1++)resolveValues[i1] && jQuery.isFunction(resolveValues[i1].promise) ? resolveValues[i1].promise().done(updateFunc(i1, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i1, progressContexts, progressValues)) : --remaining; return remaining || deferred.resolveWith(resolveContexts, resolveValues), deferred.promise(); } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js index c123a6d97a5..84b59ba3249 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js index 707f89ef333..1fbd7d7eb8a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js index d757d936749..9048cea2d27 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js @@ -119,7 +119,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -263,7 +263,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js index 7803c88fb39..feada5e9a5f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js index 0a8f02c9f47..c21309c04fc 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js index 5eea7240561..c6c8e20afd6 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js @@ -6,7 +6,7 @@ 2911: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; function _assertThisInitialized(self) { - if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + if (void 0 === self) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } __webpack_require__.d(__webpack_exports__, { @@ -18,7 +18,7 @@ 8436: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + if (!(instance instanceof Constructor)) throw TypeError("Cannot call a class as a function"); } __webpack_require__.d(__webpack_exports__, { Z: function() { @@ -80,7 +80,7 @@ })(o2, p1); } function _inherits(subClass, superClass) { - if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + if ("function" != typeof superClass && null !== superClass) throw TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, @@ -198,7 +198,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -342,7 +342,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { @@ -456,7 +456,7 @@ function Welcome() { var _this; (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__.Z)(this, Welcome); - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return _this = _super.call.apply(_super, [ this ].concat(args)), (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__.Z)((0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__.Z)(_this), "state", { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js index 228ba963bd5..53a37ed3d56 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js index 13f92b65d10..eba32af0e1e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js index 87994ae8fbc..c52e1e1e30c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js index 3716b6aa3d0..e35b509efef 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js @@ -87,7 +87,7 @@ } function _arrayLikeToArray(arr, len) { (null == len || len > arr.length) && (len = arr.length); - for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + for(var i = 0, arr2 = Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } Object.defineProperty(exports, "__esModule", { @@ -231,7 +231,7 @@ f: F }; } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, err, normalCompletion = !0, didErr = !1; return { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/react/3/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/react/3/output.js index d6fd7a11c32..5e52ebce450 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/react/3/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/react/3/output.js @@ -1,4 +1,4 @@ function warn(format) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; + for(var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; printWarning("warn", format, args); } diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js index f671c6b170d..317183729e4 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js @@ -1,11 +1,11 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(b,c,a){var d=a(3454);!function(c,a){b.exports=a()}(this,function(){"use strict";var c,e,b;function a(g,a){if(c){if(e){var f="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+c+")(sharedChunk); ("+e+")(sharedChunk); self.onerror = null;",d={};c(d),b=a(d),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(b.workerUrl=window.URL.createObjectURL(new Blob([f],{type:"text/javascript"})))}else e=a}else c=a}return a(["exports"],function(a){var bq="2.7.0",eG=H;function H(a,c,d,b){this.cx=3*a,this.bx=3*(d-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*c,this.by=3*(b-c)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=b,this.p2x=d,this.p2y=b}H.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},H.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},H.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},H.prototype.solveCurveX=function(c,e){var b,d,a,f,g;for(void 0===e&&(e=1e-6),a=c,g=0;g<8;g++){if(Math.abs(f=this.sampleCurveX(a)-c)Math.abs(h))break;a-=f/h}if((a=c)<(b=0))return b;if(a>(d=1))return d;for(;bf?b=a:d=a,a=.5*(d-b)+b;return a},H.prototype.solve=function(a,b){return this.sampleCurveY(this.solveCurveX(a,b))};var aF=aG;function aG(a,b){this.x=a,this.y=b}aG.prototype={clone:function(){return new aG(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,b){return this.clone()._rotateAround(a,b)},matMult:function(a){return this.clone()._matMult(a)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var b=a.x-this.x,c=a.y-this.y;return b*b+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,b){return Math.atan2(this.x*b-this.y*a,this.x*a+this.y*b)},_matMult:function(a){var b=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=b,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=c*this.x+b*this.y;return this.x=b*this.x-c*this.y,this.y=d,this},_rotateAround:function(b,a){var c=Math.cos(b),d=Math.sin(b),e=a.y+d*(this.x-a.x)+c*(this.y-a.y);return this.x=a.x+c*(this.x-a.x)-d*(this.y-a.y),this.y=e,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},aG.convert=function(a){return a instanceof aG?a:Array.isArray(a)?new aG(a[0],a[1]):a};var s="undefined"!=typeof self?self:{},I="undefined"!=typeof Float32Array?Float32Array:Array;function aH(){var a=new I(9);return I!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function aI(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function aJ(a,b,c){var h=b[0],i=b[1],j=b[2],k=b[3],l=b[4],m=b[5],n=b[6],o=b[7],p=b[8],q=b[9],r=b[10],s=b[11],t=b[12],u=b[13],v=b[14],w=b[15],d=c[0],e=c[1],f=c[2],g=c[3];return a[0]=d*h+e*l+f*p+g*t,a[1]=d*i+e*m+f*q+g*u,a[2]=d*j+e*n+f*r+g*v,a[3]=d*k+e*o+f*s+g*w,a[4]=(d=c[4])*h+(e=c[5])*l+(f=c[6])*p+(g=c[7])*t,a[5]=d*i+e*m+f*q+g*u,a[6]=d*j+e*n+f*r+g*v,a[7]=d*k+e*o+f*s+g*w,a[8]=(d=c[8])*h+(e=c[9])*l+(f=c[10])*p+(g=c[11])*t,a[9]=d*i+e*m+f*q+g*u,a[10]=d*j+e*n+f*r+g*v,a[11]=d*k+e*o+f*s+g*w,a[12]=(d=c[12])*h+(e=c[13])*l+(f=c[14])*p+(g=c[15])*t,a[13]=d*i+e*m+f*q+g*u,a[14]=d*j+e*n+f*r+g*v,a[15]=d*k+e*o+f*s+g*w,a}function br(b,a,f){var r,g,h,i,j,k,l,m,n,o,p,q,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[1],h=a[2],i=a[3],j=a[4],k=a[5],l=a[6],m=a[7],n=a[8],o=a[9],p=a[10],q=a[11],b[0]=r=a[0],b[1]=g,b[2]=h,b[3]=i,b[4]=j,b[5]=k,b[6]=l,b[7]=m,b[8]=n,b[9]=o,b[10]=p,b[11]=q,b[12]=r*c+j*d+n*e+a[12],b[13]=g*c+k*d+o*e+a[13],b[14]=h*c+l*d+p*e+a[14],b[15]=i*c+m*d+q*e+a[15]),b}function bs(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function bt(a,b,e){var c=Math.sin(e),d=Math.cos(e),f=b[4],g=b[5],h=b[6],i=b[7],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=f*d+j*c,a[5]=g*d+k*c,a[6]=h*d+l*c,a[7]=i*d+m*c,a[8]=j*d-f*c,a[9]=k*d-g*c,a[10]=l*d-h*c,a[11]=m*d-i*c,a}function bu(a,b,e){var c=Math.sin(e),d=Math.cos(e),f=b[0],g=b[1],h=b[2],i=b[3],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=f*d-j*c,a[1]=g*d-k*c,a[2]=h*d-l*c,a[3]=i*d-m*c,a[8]=f*c+j*d,a[9]=g*c+k*d,a[10]=h*c+l*d,a[11]=i*c+m*d,a}Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)});var bv=aJ;function aK(){var a=new I(3);return I!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function eH(b){var a=new I(3);return a[0]=b[0],a[1]=b[1],a[2]=b[2],a}function aL(a){return Math.hypot(a[0],a[1],a[2])}function Q(b,c,d){var a=new I(3);return a[0]=b,a[1]=c,a[2]=d,a}function bw(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a}function aM(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}function aN(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a}function eI(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a}function bx(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a}function by(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a}function bz(c,a){var d=a[0],e=a[1],f=a[2],b=d*d+e*e+f*f;return b>0&&(b=1/Math.sqrt(b)),c[0]=a[0]*b,c[1]=a[1]*b,c[2]=a[2]*b,c}function bA(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function bB(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2];return a[0]=e*i-f*h,a[1]=f*g-d*i,a[2]=d*h-e*g,a}function bC(b,g,a){var c=g[0],d=g[1],e=g[2],f=a[3]*c+a[7]*d+a[11]*e+a[15];return b[0]=(a[0]*c+a[4]*d+a[8]*e+a[12])/(f=f||1),b[1]=(a[1]*c+a[5]*d+a[9]*e+a[13])/f,b[2]=(a[2]*c+a[6]*d+a[10]*e+a[14])/f,b}function bD(a,h,b){var c=b[0],d=b[1],e=b[2],i=h[0],j=h[1],k=h[2],l=d*k-e*j,f=e*i-c*k,g=c*j-d*i,p=d*g-e*f,n=e*l-c*g,o=c*f-d*l,m=2*b[3];return f*=m,g*=m,n*=2,o*=2,a[0]=i+(l*=m)+(p*=2),a[1]=j+f+n,a[2]=k+g+o,a}var J,bE=aM;function bF(b,c,a){var d=c[0],e=c[1],f=c[2],g=c[3];return b[0]=a[0]*d+a[4]*e+a[8]*f+a[12]*g,b[1]=a[1]*d+a[5]*e+a[9]*f+a[13]*g,b[2]=a[2]*d+a[6]*e+a[10]*f+a[14]*g,b[3]=a[3]*d+a[7]*e+a[11]*f+a[15]*g,b}function aO(){var a=new I(4);return I!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function bG(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function bH(a,b,e){e*=.5;var f=b[0],g=b[1],h=b[2],i=b[3],c=Math.sin(e),d=Math.cos(e);return a[0]=f*d+i*c,a[1]=g*d+h*c,a[2]=h*d-g*c,a[3]=i*d-f*c,a}function eJ(a,b){return a[0]===b[0]&&a[1]===b[1]}aK(),J=new I(4),I!=Float32Array&&(J[0]=0,J[1]=0,J[2]=0,J[3]=0),aK(),Q(1,0,0),Q(0,1,0),aO(),aO(),aH(),lr=new I(2),I!=Float32Array&&(lr[0]=0,lr[1]=0);const aP=Math.PI/180,eK=180/Math.PI;function bI(a){return a*aP}function bJ(a){return a*eK}const eL=[[0,0],[1,0],[1,1],[0,1],];function bK(a){if(a<=0)return 0;if(a>=1)return 1;const b=a*a,c=b*a;return 4*(a<.5?c:3*(a-b)+c-.75)}function aQ(a,b,c,d){const e=new eG(a,b,c,d);return function(a){return e.solve(a)}}const bL=aQ(.25,.1,.25,1);function bM(a,b,c){return Math.min(c,Math.max(b,a))}function bN(b,c,a){return(a=bM((a-b)/(c-b),0,1))*a*(3-2*a)}function bO(e,a,c){const b=c-a,d=((e-a)%b+b)%b+a;return d===a?c:d}function bP(a,c,b){if(!a.length)return b(null,[]);let d=a.length;const e=new Array(a.length);let f=null;a.forEach((a,g)=>{c(a,(a,c)=>{a&&(f=a),e[g]=c,0== --d&&b(f,e)})})}function bQ(a){const b=[];for(const c in a)b.push(a[c]);return b}function bR(a,...d){for(const b of d)for(const c in b)a[c]=b[c];return a}let eM=1;function bS(){return eM++}function eN(){return function b(a){return a?(a^16*Math.random()>>a/4).toString(16):([1e7]+ -[1e3]+ -4e3+ -8e3+ -1e11).replace(/[018]/g,b)}()}function bT(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function eO(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)}function bU(a,b){a.forEach(a=>{b[a]&&(b[a]=b[a].bind(b))})}function bV(a,b){return -1!==a.indexOf(b,a.length-b.length)}function eP(a,d,e){const c={};for(const b in a)c[b]=d.call(e||this,a[b],b,a);return c}function bW(a,d,e){const c={};for(const b in a)d.call(e||this,a[b],b,a)&&(c[b]=a[b]);return c}function bX(a){return Array.isArray(a)?a.map(bX):"object"==typeof a&&a?eP(a,bX):a}const eQ={};function bY(a){eQ[a]||("undefined"!=typeof console&&console.warn(a),eQ[a]=!0)}function eR(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)}function eS(a){let e=0;for(let b,c,d=0,f=a.length,g=f-1;d@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(f,c,d,e)=>{const b=d||e;return a[c]=!b||b.toLowerCase(),""}),a["max-age"]){const b=parseInt(a["max-age"],10);isNaN(b)?delete a["max-age"]:a["max-age"]=b}return a}let eU,af,eV,eW=null;function eX(b){if(null==eW){const a=b.navigator?b.navigator.userAgent:null;eW=!!b.safari||!(!a||!(/\b(iPad|iPhone|iPod)\b/.test(a)||a.match("Safari")&&!a.match("Chrome")))}return eW}function eY(b){try{const a=s[b];return a.setItem("_mapbox_test_",1),a.removeItem("_mapbox_test_"),!0}catch(c){return!1}}const b$={now:()=>void 0!==eV?eV:s.performance.now(),setNow(a){eV=a},restoreNow(){eV=void 0},frame(a){const b=s.requestAnimationFrame(a);return{cancel:()=>s.cancelAnimationFrame(b)}},getImageData(a,b=0){const c=s.document.createElement("canvas"),d=c.getContext("2d");if(!d)throw new Error("failed to create canvas 2d context");return c.width=a.width,c.height=a.height,d.drawImage(a,0,0,a.width,a.height),d.getImageData(-b,-b,a.width+2*b,a.height+2*b)},resolveURL:a=>(eU||(eU=s.document.createElement("a")),eU.href=a,eU.href),get devicePixelRatio(){return s.devicePixelRatio},get prefersReducedMotion(){return!!s.matchMedia&&(null==af&&(af=s.matchMedia("(prefers-reduced-motion: reduce)")),af.matches)}};let R;const b_={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==R){const aR=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{R=null!=d.env.API_URL_REGEX?new RegExp(d.env.API_URL_REGEX):aR}catch(eZ){R=aR}}return R},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},b0={supported:!1,testSupport:function(a){!e_&&ag&&(e0?e1(a):e$=a)}};let e$,ag,e_=!1,e0=!1;function e1(a){const b=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,ag),a.isContextLost())return;b0.supported=!0}catch(c){}a.deleteTexture(b),e_=!0}s.document&&((ag=s.document.createElement("img")).onload=function(){e$&&e1(e$),e$=null,e0=!0},ag.onerror=function(){e_=!0,e$=null},ag.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const b1="NO_ACCESS_TOKEN";function b2(a){return 0===a.indexOf("mapbox:")}function e2(a){return b_.API_URL_REGEX.test(a)}const e3=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function e4(b){const a=b.match(e3);if(!a)throw new Error("Unable to parse URL object");return{protocol:a[1],authority:a[2],path:a[3]||"/",params:a[4]?a[4].split("&"):[]}}function e5(a){const b=a.params.length?`?${a.params.join("&")}`:"";return`${a.protocol}://${a.authority}${a.path}${b}`}function e6(b){if(!b)return null;const a=b.split(".");if(!a||3!==a.length)return null;try{return JSON.parse(decodeURIComponent(s.atob(a[1]).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(c){return null}}class e7{constructor(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(c){const a=e6(b_.ACCESS_TOKEN);let b="";return b=a&&a.u?s.btoa(encodeURIComponent(a.u).replace(/%([0-9A-F]{2})/g,(b,a)=>String.fromCharCode(Number("0x"+a)))):b_.ACCESS_TOKEN||"",c?`mapbox.eventData.${c}:${b}`:`mapbox.eventData:${b}`}fetchEventData(){const c=eY("localStorage"),d=this.getStorageKey(),e=this.getStorageKey("uuid");if(c)try{const a=s.localStorage.getItem(d);a&&(this.eventData=JSON.parse(a));const b=s.localStorage.getItem(e);b&&(this.anonId=b)}catch(f){bY("Unable to read from LocalStorage")}}saveEventData(){const a=eY("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{s.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&s.localStorage.setItem(b,JSON.stringify(this.eventData))}catch(d){bY("Unable to write to LocalStorage")}}processRequests(a){}postEvent(d,a,h,e){if(!b_.EVENTS_URL)return;const b=e4(b_.EVENTS_URL);b.params.push(`access_token=${e||b_.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(d).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:bq,skuId:"01",userId:this.anonId},f=a?bR(c,a):c,g={url:e5(b),headers:{"Content-Type":"text/plain"},body:JSON.stringify([f])};this.pendingRequest=fj(g,a=>{this.pendingRequest=null,h(a),this.saveEventData(),this.processRequests(e)})}queueRequest(a,b){this.queue.push(a),this.processRequests(b)}}const aS=new class extends e7{constructor(a){super("appUserTurnstile"),this._customAccessToken=a}postTurnstileEvent(a,b){b_.EVENTS_URL&&b_.ACCESS_TOKEN&&Array.isArray(a)&&a.some(a=>b2(a)||e2(a))&&this.queueRequest(Date.now(),b)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const c=e6(b_.ACCESS_TOKEN),f=c?c.u:b_.ACCESS_TOKEN;let a=f!==this.eventData.tokenU;eO(this.anonId)||(this.anonId=eN(),a=!0);const b=this.queue.shift();if(this.eventData.lastSuccess){const g=new Date(this.eventData.lastSuccess),h=new Date(b),d=(b-this.eventData.lastSuccess)/864e5;a=a||d>=1||d< -1||g.getDate()!==h.getDate()}else a=!0;if(!a)return this.processRequests();this.postEvent(b,{"enabled.telemetry":!1},a=>{a||(this.eventData.lastSuccess=b,this.eventData.tokenU=f)},e)}},b3=aS.postTurnstileEvent.bind(aS),aT=new class extends e7{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(b,c,a,d){this.skuToken=c,this.errorCb=d,b_.EVENTS_URL&&(a||b_.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},a):this.errorCb(new Error(b1)))}processRequests(b){if(this.pendingRequest||0===this.queue.length)return;const{id:a,timestamp:c}=this.queue.shift();a&&this.success[a]||(this.anonId||this.fetchEventData(),eO(this.anonId)||(this.anonId=eN()),this.postEvent(c,{skuToken:this.skuToken},b=>{b?this.errorCb(b):a&&(this.success[a]=!0)},b))}},b4=aT.postMapLoadEvent.bind(aT),aU=new class extends e7{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,b,f,c){if(!b_.API_URL||!b_.SESSION_PATH)return;const a=e4(b_.API_URL+b_.SESSION_PATH);a.params.push(`sku=${b||""}`),a.params.push(`access_token=${c||b_.ACCESS_TOKEN||""}`);const d={url:e5(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=fk(d,a=>{this.pendingRequest=null,f(a),this.saveEventData(),this.processRequests(c)})}getSessionAPI(b,c,a,d){this.skuToken=c,this.errorCb=d,b_.SESSION_PATH&&b_.API_URL&&(a||b_.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},a):this.errorCb(new Error(b1)))}processRequests(b){if(this.pendingRequest||0===this.queue.length)return;const{id:a,timestamp:c}=this.queue.shift();a&&this.success[a]||this.getSession(c,this.skuToken,b=>{b?this.errorCb(b):a&&(this.success[a]=!0)},b)}},b5=aU.getSessionAPI.bind(aU),e8=new Set,e9="mapbox-tiles";let fa,fb,fc=500,fd=50;function fe(){s.caches&&!fa&&(fa=s.caches.open(e9))}function ff(a){const b=a.indexOf("?");return b<0?a:a.slice(0,b)}let fg=1/0;const aV={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(aV);class fh extends Error{constructor(a,b,c){401===b&&e2(c)&&(a+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(a),this.status=b,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const b6=bZ()?()=>self.worker&&self.worker.referrer:()=>("blob:"===s.location.protocol?s.parent:s).location.href,b7=function(a,b){var c;if(!(/^file:/.test(c=a.url)||/^file:/.test(b6())&&!/^\w+:/.test(c))){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return function(a,g){var c;const e=new s.AbortController,b=new s.Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,referrer:b6(),signal:e.signal});let h=!1,i=!1;const f=(c=b.url).indexOf("sku=")>0&&e2(c);"json"===a.type&&b.headers.set("Accept","application/json");const d=(c,d,e)=>{if(i)return;if(c&&"SecurityError"!==c.message&&bY(c),d&&e)return j(d);const h=Date.now();s.fetch(b).then(b=>{if(b.ok){const c=f?b.clone():null;return j(b,c,h)}return g(new fh(b.statusText,b.status,a.url))}).catch(a=>{20!==a.code&&g(new Error(a.message))})},j=(c,d,e)=>{("arrayBuffer"===a.type?c.arrayBuffer():"json"===a.type?c.json():c.text()).then(a=>{i||(d&&e&&function(e,a,c){if(fe(),!fa)return;const d={status:a.status,statusText:a.statusText,headers:new s.Headers};a.headers.forEach((a,b)=>d.headers.set(b,a));const b=eT(a.headers.get("Cache-Control")||"");b["no-store"]||(b["max-age"]&&d.headers.set("Expires",new Date(c+1e3*b["max-age"]).toUTCString()),new Date(d.headers.get("Expires")).getTime()-c<42e4||function(a,b){if(void 0===fb)try{new Response(new ReadableStream),fb=!0}catch(c){fb=!1}fb?b(a.body):a.blob().then(b)}(a,a=>{const b=new s.Response(a,d);fe(),fa&&fa.then(a=>a.put(ff(e.url),b)).catch(a=>bY(a.message))}))}(b,d,e),h=!0,g(null,a,c.headers.get("Cache-Control"),c.headers.get("Expires")))}).catch(a=>{i||g(new Error(a.message))})};return f?function(b,a){if(fe(),!fa)return a(null);const c=ff(b.url);fa.then(b=>{b.match(c).then(d=>{const e=function(a){if(!a)return!1;const b=new Date(a.headers.get("Expires")||0),c=eT(a.headers.get("Cache-Control")||"");return b>Date.now()&&!c["no-cache"]}(d);b.delete(c),e&&b.put(c,d.clone()),a(null,d,e)}).catch(a)}).catch(a)}(b,d):d(null,null),{cancel(){i=!0,h||e.abort()}}}(a,b);if(bZ()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,b,void 0,!0)}return function(b,d){const a=new s.XMLHttpRequest;for(const c in a.open(b.method||"GET",b.url,!0),"arrayBuffer"===b.type&&(a.responseType="arraybuffer"),b.headers)a.setRequestHeader(c,b.headers[c]);return"json"===b.type&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===b.credentials,a.onerror=()=>{d(new Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let c=a.response;if("json"===b.type)try{c=JSON.parse(a.response)}catch(e){return d(e)}d(null,c,a.getResponseHeader("Cache-Control"),a.getResponseHeader("Expires"))}else d(new fh(a.statusText,a.status,b.url))},a.send(b.body),{cancel:()=>a.abort()}}(a,b)},fi=function(a,b){return b7(bR(a,{type:"arrayBuffer"}),b)},fj=function(a,b){return b7(bR(a,{method:"POST"}),b)},fk=function(a,b){return b7(bR(a,{method:"GET"}),b)};function fl(b){const a=s.document.createElement("a");return a.href=b,a.protocol===s.document.location.protocol&&a.host===s.document.location.host}const fm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let b8,b9;b8=[],b9=0;const ca=function(a,c){if(b0.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),b9>=b_.MAX_PARALLEL_IMAGE_REQUESTS){const b={requestParameters:a,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return b8.push(b),b}b9++;let d=!1;const e=()=>{if(!d)for(d=!0,b9--;b8.length&&b9{e(),b?c(b):a&&(s.createImageBitmap?function(a,c){const b=new s.Blob([new Uint8Array(a)],{type:"image/png"});s.createImageBitmap(b).then(a=>{c(null,a)}).catch(a=>{c(new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(a,(a,b)=>c(a,b,d,f)):function(b,e){const a=new s.Image,c=s.URL;a.onload=()=>{e(null,a),c.revokeObjectURL(a.src),a.onload=null,s.requestAnimationFrame(()=>{a.src=fm})},a.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const d=new s.Blob([new Uint8Array(b)],{type:"image/png"});a.src=b.byteLength?c.createObjectURL(d):fm}(a,(a,b)=>c(a,b,d,f)))});return{cancel(){f.cancel(),e()}}};function fn(a,c,b){b[a]&& -1!==b[a].indexOf(c)||(b[a]=b[a]||[],b[a].push(c))}function fo(b,d,a){if(a&&a[b]){const c=a[b].indexOf(d);-1!==c&&a[b].splice(c,1)}}class aW{constructor(a,b={}){bR(this,b),this.type=a}}class cb extends aW{constructor(a,b={}){super("error",bR({error:a},b))}}class S{on(a,b){return this._listeners=this._listeners||{},fn(a,b,this._listeners),this}off(a,b){return fo(a,b,this._listeners),fo(a,b,this._oneTimeListeners),this}once(b,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fn(b,a,this._oneTimeListeners),this):new Promise(a=>this.once(b,a))}fire(a,e){"string"==typeof a&&(a=new aW(a,e||{}));const b=a.type;if(this.listens(b)){a.target=this;const f=this._listeners&&this._listeners[b]?this._listeners[b].slice():[];for(const g of f)g.call(this,a);const h=this._oneTimeListeners&&this._oneTimeListeners[b]?this._oneTimeListeners[b].slice():[];for(const c of h)fo(b,c,this._oneTimeListeners),c.call(this,a);const d=this._eventedParent;d&&(bR(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),d.fire(a))}else a instanceof cb&&console.error(a.error);return this}listens(a){return!!(this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a))}setEventedParent(a,b){return this._eventedParent=a,this._eventedParentData=b,this}}var b=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');class cc{constructor(b,a,d,c){this.message=(b?`${b}: `:"")+d,c&&(this.identifier=c),null!=a&&a.__line__&&(this.line=a.__line__)}}function cd(a){const b=a.value;return b?[new cc(a.key,b,"constants have been deprecated as of v8"),]:[]}function ce(a,...d){for(const b of d)for(const c in b)a[c]=b[c];return a}function fp(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function fq(a){if(Array.isArray(a))return a.map(fq);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const b={};for(const c in a)b[c]=fq(a[c]);return b}return fp(a)}class fr extends Error{constructor(b,a){super(a),this.message=a,this.key=b}}class fs{constructor(a,b=[]){for(const[c,d]of(this.parent=a,this.bindings={},b))this.bindings[c]=d}concat(a){return new fs(this,a)}get(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw new Error(`${a} not found in scope.`)}has(a){return!!this.bindings[a]|| !!this.parent&&this.parent.has(a)}}const cf={kind:"null"},f={kind:"number"},i={kind:"string"},h={kind:"boolean"},y={kind:"color"},K={kind:"object"},l={kind:"value"},cg={kind:"collator"},ch={kind:"formatted"},ci={kind:"resolvedImage"};function z(a,b){return{kind:"array",itemType:a,N:b}}function ft(a){if("array"===a.kind){const b=ft(a.itemType);return"number"==typeof a.N?`array<${b}, ${a.N}>`:"value"===a.itemType.kind?"array":`array<${b}>`}return a.kind}const fu=[cf,f,i,h,y,ch,K,z(l),ci];function fv(b,a){if("error"===a.kind)return null;if("array"===b.kind){if("array"===a.kind&&(0===a.N&&"value"===a.itemType.kind||!fv(b.itemType,a.itemType))&&("number"!=typeof b.N||b.N===a.N))return null}else{if(b.kind===a.kind)return null;if("value"===b.kind){for(const c of fu)if(!fv(c,a))return null}}return`Expected ${ft(b)} but found ${ft(a)} instead.`}function fw(b,a){return a.some(a=>a.kind===b.kind)}function fx(b,a){return a.some(a=>"null"===a?null===b:"array"===a?Array.isArray(b):"object"===a?b&&!Array.isArray(b)&&"object"==typeof b:a===typeof b)}function ah(b){var a={exports:{}};return b(a,a.exports),a.exports}var fy=ah(function(b,a){var c={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function d(a){return(a=Math.round(a))<0?0:a>255?255:a}function e(a){return d("%"===a[a.length-1]?parseFloat(a)/100*255:parseInt(a))}function f(a){var b;return(b="%"===a[a.length-1]?parseFloat(a)/100:parseFloat(a))<0?0:b>1?1:b}function g(b,c,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?b+(c-b)*a*6:2*a<1?c:3*a<2?b+(c-b)*(2/3-a)*6:b}try{a.parseCSSColor=function(q){var a,b=q.replace(/ /g,"").toLowerCase();if(b in c)return c[b].slice();if("#"===b[0])return 4===b.length?(a=parseInt(b.substr(1),16))>=0&&a<=4095?[(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,1,]:null:7===b.length&&(a=parseInt(b.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1,]:null;var j=b.indexOf("("),p=b.indexOf(")");if(-1!==j&&p+1===b.length){var r=b.substr(0,j),h=b.substr(j+1,p-(j+1)).split(","),k=1;switch(r){case"rgba":if(4!==h.length)break;k=f(h.pop());case"rgb":return 3!==h.length?null:[e(h[0]),e(h[1]),e(h[2]),k,];case"hsla":if(4!==h.length)break;k=f(h.pop());case"hsl":if(3!==h.length)break;var m=(parseFloat(h[0])%360+360)%360/360,n=f(h[1]),i=f(h[2]),l=i<=.5?i*(n+1):i+n-i*n,o=2*i-l;return[d(255*g(o,l,m+1/3)),d(255*g(o,l,m)),d(255*g(o,l,m-1/3)),k,]}}return null}}catch(h){}});class m{constructor(a,b,c,d=1){this.r=a,this.g=b,this.b=c,this.a=d}static parse(b){if(!b)return;if(b instanceof m)return b;if("string"!=typeof b)return;const a=fy.parseCSSColor(b);return a?new m(a[0]/255*a[3],a[1]/255*a[3],a[2]/255*a[3],a[3]):void 0}toString(){const[a,b,c,d]=this.toArray();return`rgba(${Math.round(a)},${Math.round(b)},${Math.round(c)},${d})`}toArray(){const{r:b,g:c,b:d,a:a}=this;return 0===a?[0,0,0,0]:[255*b/a,255*c/a,255*d/a,a,]}}m.black=new m(0,0,0,1),m.white=new m(1,1,1,1),m.transparent=new m(0,0,0,0),m.red=new m(1,0,0,1),m.blue=new m(0,0,1,1);class fz{constructor(b,a,c){this.sensitivity=b?a?"variant":"case":a?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(a,b){return this.collator.compare(a,b)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class fA{constructor(a,b,c,d,e){this.text=a.normalize?a.normalize():a,this.image=b,this.scale=c,this.fontStack=d,this.textColor=e}}class fB{constructor(a){this.sections=a}static fromString(a){return new fB([new fA(a,null,null,null,null),])}isEmpty(){return 0===this.sections.length||!this.sections.some(a=>0!==a.text.length||a.image&&0!==a.image.name.length)}static factory(a){return a instanceof fB?a:fB.fromString(a)}toString(){return 0===this.sections.length?"":this.sections.map(a=>a.text).join("")}serialize(){const b=["format"];for(const a of this.sections){if(a.image){b.push(["image",a.image.name]);continue}b.push(a.text);const c={};a.fontStack&&(c["text-font"]=["literal",a.fontStack.split(","),]),a.scale&&(c["font-scale"]=a.scale),a.textColor&&(c["text-color"]=["rgba"].concat(a.textColor.toArray())),b.push(c)}return b}}class cj{constructor(a){this.name=a.name,this.available=a.available}toString(){return this.name}static fromString(a){return a?new cj({name:a,available:!1}):null}serialize(){return["image",this.name]}}function fC(b,c,d,a){return"number"==typeof b&&b>=0&&b<=255&&"number"==typeof c&&c>=0&&c<=255&&"number"==typeof d&&d>=0&&d<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[b,c,d,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[b,c,d,a]:[b,c,d]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fD(a){if(null===a||"string"==typeof a||"boolean"==typeof a||"number"==typeof a||a instanceof m||a instanceof fz||a instanceof fB||a instanceof cj)return!0;if(Array.isArray(a)){for(const b of a)if(!fD(b))return!1;return!0}if("object"==typeof a){for(const c in a)if(!fD(a[c]))return!1;return!0}return!1}function fE(a){if(null===a)return cf;if("string"==typeof a)return i;if("boolean"==typeof a)return h;if("number"==typeof a)return f;if(a instanceof m)return y;if(a instanceof fz)return cg;if(a instanceof fB)return ch;if(a instanceof cj)return ci;if(Array.isArray(a)){const d=a.length;let b;for(const e of a){const c=fE(e);if(b){if(b===c)continue;b=l;break}b=c}return z(b||l,d)}return K}function fF(a){const b=typeof a;return null===a?"":"string"===b||"number"===b||"boolean"===b?String(a):a instanceof m||a instanceof fB||a instanceof cj?a.toString():JSON.stringify(a)}class ck{constructor(a,b){this.type=a,this.value=b}static parse(b,d){if(2!==b.length)return d.error(`'literal' expression requires exactly one argument, but found ${b.length-1} instead.`);if(!fD(b[1]))return d.error("invalid value");const e=b[1];let c=fE(e);const a=d.expectedType;return"array"===c.kind&&0===c.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(c=a),new ck(c,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof m?["rgba"].concat(this.value.toArray()):this.value instanceof fB?this.value.serialize():this.value}}class fG{constructor(a){this.name="ExpressionEvaluationError",this.message=a}toJSON(){return this.message}}const fH={string:i,number:f,boolean:h,object:K};class L{constructor(a,b){this.type=a,this.args=b}static parse(a,c){if(a.length<2)return c.error("Expected at least one argument.");let e,b=1;const g=a[0];if("array"===g){let f,h;if(a.length>2){const d=a[1];if("string"!=typeof d||!(d in fH)||"object"===d)return c.error('The item type argument of "array" must be one of string, number, boolean',1);f=fH[d],b++}else f=l;if(a.length>3){if(null!==a[2]&&("number"!=typeof a[2]||a[2]<0||a[2]!==Math.floor(a[2])))return c.error('The length argument to "array" must be a positive integer literal',2);h=a[2],b++}e=z(f,h)}else e=fH[g];const i=[];for(;ba.outputDefined())}serialize(){const a=this.type,c=[a.kind];if("array"===a.kind){const b=a.itemType;if("string"===b.kind||"number"===b.kind||"boolean"===b.kind){c.push(b.kind);const d=a.N;("number"==typeof d||this.args.length>1)&&c.push(d)}}return c.concat(this.args.map(a=>a.serialize()))}}class cl{constructor(a){this.type=ch,this.sections=a}static parse(c,b){if(c.length<2)return b.error("Expected at least one argument.");const m=c[1];if(!Array.isArray(m)&&"object"==typeof m)return b.error("First argument must be an image or text section.");const d=[];let h=!1;for(let e=1;e<=c.length-1;++e){const a=c[e];if(h&&"object"==typeof a&&!Array.isArray(a)){h=!1;let n=null;if(a["font-scale"]&&!(n=b.parse(a["font-scale"],1,f)))return null;let o=null;if(a["text-font"]&&!(o=b.parse(a["text-font"],1,z(i))))return null;let p=null;if(a["text-color"]&&!(p=b.parse(a["text-color"],1,y)))return null;const j=d[d.length-1];j.scale=n,j.font=o,j.textColor=p}else{const k=b.parse(c[e],1,l);if(!k)return null;const g=k.type.kind;if("string"!==g&&"value"!==g&&"null"!==g&&"resolvedImage"!==g)return b.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,d.push({content:k,scale:null,font:null,textColor:null})}}return new cl(d)}evaluate(a){return new fB(this.sections.map(b=>{const c=b.content.evaluate(a);return fE(c)===ci?new fA("",c,null,null,null):new fA(fF(c),null,b.scale?b.scale.evaluate(a):null,b.font?b.font.evaluate(a).join(","):null,b.textColor?b.textColor.evaluate(a):null)}))}eachChild(b){for(const a of this.sections)b(a.content),a.scale&&b(a.scale),a.font&&b(a.font),a.textColor&&b(a.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const a of this.sections){c.push(a.content.serialize());const b={};a.scale&&(b["font-scale"]=a.scale.serialize()),a.font&&(b["text-font"]=a.font.serialize()),a.textColor&&(b["text-color"]=a.textColor.serialize()),c.push(b)}return c}}class cm{constructor(a){this.type=ci,this.input=a}static parse(b,a){if(2!==b.length)return a.error("Expected two arguments.");const c=a.parse(b[1],1,i);return c?new cm(c):a.error("No image name provided.")}evaluate(a){const c=this.input.evaluate(a),b=cj.fromString(c);return b&&a.availableImages&&(b.available=a.availableImages.indexOf(c)> -1),b}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const fI={"to-boolean":h,"to-color":y,"to-number":f,"to-string":i};class T{constructor(a,b){this.type=a,this.args=b}static parse(a,c){if(a.length<2)return c.error("Expected at least one argument.");const d=a[0];if(("to-boolean"===d||"to-string"===d)&&2!==a.length)return c.error("Expected one argument.");const g=fI[d],e=[];for(let b=1;b4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:fC(a[0],a[1],a[2],a[3])))return new m(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new fG(c||`Could not parse color from value '${"string"==typeof a?a:String(JSON.stringify(a))}'`)}if("number"===this.type.kind){let d=null;for(const h of this.args){if(null===(d=h.evaluate(b)))return 0;const f=Number(d);if(!isNaN(f))return f}throw new fG(`Could not convert ${JSON.stringify(d)} to number.`)}return"formatted"===this.type.kind?fB.fromString(fF(this.args[0].evaluate(b))):"resolvedImage"===this.type.kind?cj.fromString(fF(this.args[0].evaluate(b))):fF(this.args[0].evaluate(b))}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){if("formatted"===this.type.kind)return new cl([{content:this.args[0],scale:null,font:null,textColor:null},]).serialize();if("resolvedImage"===this.type.kind)return new cm(this.args[0]).serialize();const a=[`to-${this.type.kind}`];return this.eachChild(b=>{a.push(b.serialize())}),a}}const fJ=["Unknown","Point","LineString","Polygon",];class fK{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?fJ[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const a=this.featureDistanceData.center,b=this.featureDistanceData.scale,{x:c,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*b-a[0])+this.featureDistanceData.bearing[1]*(d*b-a[1])}return 0}parseColor(a){let b=this._parseColorCache[a];return b||(b=this._parseColorCache[a]=m.parse(a)),b}}class aX{constructor(a,b,c,d){this.name=a,this.type=b,this._evaluate=c,this.args=d}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(a=>a.serialize()))}static parse(f,c){const j=f[0],b=aX.definitions[j];if(!b)return c.error(`Unknown expression "${j}". If you wanted a literal array, use ["literal", [...]].`,0);const q=Array.isArray(b)?b[0]:b.type,m=Array.isArray(b)?[[b[1],b[2]]]:b.overloads,h=m.filter(([a])=>!Array.isArray(a)||a.length===f.length-1);let e=null;for(const[a,r]of h){e=new f1(c.registry,c.path,null,c.scope);const d=[];let n=!1;for(let i=1;i{var a;return Array.isArray(a=b)?`(${a.map(ft).join(", ")})`:`(${ft(a.type)}...)`}).join(" | "),k=[];for(let l=1;l=b[2]||a[1]<=b[1]||a[3]>=b[3])}function fN(a,c){const d=(180+a[0])/360,e=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,b=Math.pow(2,c.z);return[Math.round(d*b*8192),Math.round(e*b*8192),]}function fO(a,b,c){const d=a[0]-b[0],e=a[1]-b[1],f=a[0]-c[0],g=a[1]-c[1];return d*g-f*e==0&&d*f<=0&&e*g<=0}function fP(h,i){var d,b,e;let f=!1;for(let g=0,j=i.length;g(d=h)[1]!=(e=c[a+1])[1]>d[1]&&d[0]<(e[0]-b[0])*(d[1]-b[1])/(e[1]-b[1])+b[0]&&(f=!f)}}return f}function fQ(c,b){for(let a=0;a0&&h<0||g<0&&h>0}function fS(i,j,k){var a,b,c,d,g,h;for(const f of k)for(let e=0;eb[2]){const d=.5*c;let e=a[0]-b[0]>d?-c:b[0]-a[0]>d?c:0;0===e&&(e=a[0]-b[2]>d?-c:b[2]-a[0]>d?c:0),a[0]+=e}fL(f,a)}function fY(f,g,h,a){const i=8192*Math.pow(2,a.z),b=[8192*a.x,8192*a.y],c=[];for(const j of f)for(const d of j){const e=[d.x+b[0],d.y+b[1]];fX(e,g,h,i),c.push(e)}return c}function fZ(j,a,k,c){var b;const e=8192*Math.pow(2,c.z),f=[8192*c.x,8192*c.y],d=[];for(const l of j){const g=[];for(const h of l){const i=[h.x+f[0],h.y+f[1]];fL(a,i),g.push(i)}d.push(g)}if(a[2]-a[0]<=e/2)for(const m of((b=a)[0]=b[1]=1/0,b[2]=b[3]=-1/0,d))for(const n of m)fX(n,a,k,e);return d}class co{constructor(a,b){this.type=h,this.geojson=a,this.geometries=b}static parse(b,d){if(2!==b.length)return d.error(`'within' expression requires exactly one argument, but found ${b.length-1} instead.`);if(fD(b[1])){const a=b[1];if("FeatureCollection"===a.type)for(let c=0;c{b&&!f$(a)&&(b=!1)}),b}function f_(a){if(a instanceof aX&&"feature-state"===a.name)return!1;let b=!0;return a.eachChild(a=>{b&&!f_(a)&&(b=!1)}),b}function f0(a,b){if(a instanceof aX&&b.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(a=>{c&&!f0(a,b)&&(c=!1)}),c}class cp{constructor(b,a){this.type=a.type,this.name=b,this.boundExpression=a}static parse(c,b){if(2!==c.length||"string"!=typeof c[1])return b.error("'var' expression requires exactly one string literal argument.");const a=c[1];return b.scope.has(a)?new cp(a,b.scope.get(a)):b.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class f1{constructor(b,a=[],c,d=new fs,e=[]){this.registry=b,this.path=a,this.key=a.map(a=>`[${a}]`).join(""),this.scope=d,this.errors=e,this.expectedType=c}parse(a,b,d,e,c={}){return b?this.concat(b,d,e)._parse(a,c):this._parse(a,c)}_parse(a,f){function g(a,b,c){return"assert"===c?new L(b,[a]):"coerce"===c?new T(b,[a]):a}if(null!==a&&"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a||(a=["literal",a]),Array.isArray(a)){if(0===a.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=a[0];if("string"!=typeof d)return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[d];if(h){let b=h.parse(a,this);if(!b)return null;if(this.expectedType){const c=this.expectedType,e=b.type;if("string"!==c.kind&&"number"!==c.kind&&"boolean"!==c.kind&&"object"!==c.kind&&"array"!==c.kind||"value"!==e.kind){if("color"!==c.kind&&"formatted"!==c.kind&&"resolvedImage"!==c.kind||"value"!==e.kind&&"string"!==e.kind){if(this.checkSubtype(c,e))return null}else b=g(b,c,f.typeAnnotation||"coerce")}else b=g(b,c,f.typeAnnotation||"assert")}if(!(b instanceof ck)&&"resolvedImage"!==b.type.kind&&f2(b)){const i=new fK;try{b=new ck(b.type,b.evaluate(i))}catch(j){return this.error(j.message),null}}return b}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===a?"'undefined' value invalid. Use null instead.":"object"==typeof a?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,c,b){const d="number"==typeof a?this.path.concat(a):this.path,e=b?this.scope.concat(b):this.scope;return new f1(this.registry,d,c||null,e,this.errors)}error(a,...b){const c=`${this.key}${b.map(a=>`[${a}]`).join("")}`;this.errors.push(new fr(c,a))}checkSubtype(b,c){const a=fv(b,c);return a&&this.error(a),a}}function f2(a){if(a instanceof cp)return f2(a.boundExpression);if(a instanceof aX&&"error"===a.name||a instanceof cn||a instanceof co)return!1;const c=a instanceof T||a instanceof L;let b=!0;return a.eachChild(a=>{b=c?b&&f2(a):b&&a instanceof ck}),!!b&&f$(a)&&f0(a,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center",])}function f3(b,c){const g=b.length-1;let d,h,e=0,f=g,a=0;for(;e<=f;)if(d=b[a=Math.floor((e+f)/2)],h=b[a+1],d<=c){if(a===g||cc))throw new fG("Input is not a number.");f=a-1}return 0}class cq{constructor(a,b,c){for(const[d,e]of(this.type=a,this.input=b,this.labels=[],this.outputs=[],c))this.labels.push(d),this.outputs.push(e)}static parse(b,a){if(b.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${b.length-1}.`);if((b.length-1)%2!=0)return a.error("Expected an even number of arguments.");const i=a.parse(b[1],1,f);if(!i)return null;const d=[];let e=null;a.expectedType&&"value"!==a.expectedType.kind&&(e=a.expectedType);for(let c=1;c=g)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',j);const h=a.parse(k,l,e);if(!h)return null;e=e||h.type,d.push([g,h])}return new cq(e,i,d)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const e=b.length;return d>=b[e-1]?c[e-1].evaluate(a):c[f3(b,d)].evaluate(a)}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){const b=["step",this.input.serialize()];for(let a=0;a0&&b.push(this.labels[a]),b.push(this.outputs[a].serialize());return b}}function aY(b,c,a){return b*(1-a)+c*a}var f4=Object.freeze({__proto__:null,number:aY,color:function(a,b,c){return new m(aY(a.r,b.r,c),aY(a.g,b.g,c),aY(a.b,b.b,c),aY(a.a,b.a,c))},array:function(a,b,c){return a.map((a,d)=>aY(a,b[d],c))}});const f5=4/29,aZ=6/29,f6=3*aZ*aZ,f7=Math.PI/180,f8=180/Math.PI;function f9(a){return a>.008856451679035631?Math.pow(a,1/3):a/f6+f5}function ga(a){return a>aZ?a*a*a:f6*(a-f5)}function gb(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function gc(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function cr(a){const b=gc(a.r),c=gc(a.g),d=gc(a.b),f=f9((.4124564*b+.3575761*c+.1804375*d)/.95047),e=f9((.2126729*b+.7151522*c+.072175*d)/1);return{l:116*e-16,a:500*(f-e),b:200*(e-f9((.0193339*b+.119192*c+.9503041*d)/1.08883)),alpha:a.a}}function cs(b){let a=(b.l+16)/116,c=isNaN(b.a)?a:a+b.a/500,d=isNaN(b.b)?a:a-b.b/200;return a=1*ga(a),c=.95047*ga(c),d=1.08883*ga(d),new m(gb(3.2404542*c-1.5371385*a-.4985314*d),gb(-0.969266*c+1.8760108*a+.041556*d),gb(.0556434*c-.2040259*a+1.0572252*d),b.alpha)}const ct={forward:cr,reverse:cs,interpolate:function(a,b,c){return{l:aY(a.l,b.l,c),a:aY(a.a,b.a,c),b:aY(a.b,b.b,c),alpha:aY(a.alpha,b.alpha,c)}}},cu={forward:function(d){const{l:e,a:a,b:b}=cr(d),c=Math.atan2(b,a)*f8;return{h:c<0?c+360:c,c:Math.sqrt(a*a+b*b),l:e,alpha:d.a}},reverse:function(a){const b=a.h*f7,c=a.c;return cs({l:a.l,a:Math.cos(b)*c,b:Math.sin(b)*c,alpha:a.alpha})},interpolate:function(a,b,c){return{h:function(b,c,d){const a=c-b;return b+d*(a>180||a< -180?a-360*Math.round(a/360):a)}(a.h,b.h,c),c:aY(a.c,b.c,c),l:aY(a.l,b.l,c),alpha:aY(a.alpha,b.alpha,c)}}};var gd=Object.freeze({__proto__:null,lab:ct,hcl:cu});class ai{constructor(a,b,c,d,e){for(const[f,g]of(this.type=a,this.operator=b,this.interpolation=c,this.input=d,this.labels=[],this.outputs=[],e))this.labels.push(f),this.outputs.push(g)}static interpolationFactor(a,d,e,f){let b=0;if("exponential"===a.name)b=ge(d,a.base,e,f);else if("linear"===a.name)b=ge(d,1,e,f);else if("cubic-bezier"===a.name){const c=a.controlPoints;b=new eG(c[0],c[1],c[2],c[3]).solve(ge(d,1,e,f))}return b}static parse(g,a){let[h,b,i,...j]=g;if(!Array.isArray(b)||0===b.length)return a.error("Expected an interpolation type expression.",1);if("linear"===b[0])b={name:"linear"};else if("exponential"===b[0]){const n=b[1];if("number"!=typeof n)return a.error("Exponential interpolation requires a numeric base.",1,1);b={name:"exponential",base:n}}else{if("cubic-bezier"!==b[0])return a.error(`Unknown interpolation type ${String(b[0])}`,1,0);{const k=b.slice(1);if(4!==k.length||k.some(a=>"number"!=typeof a||a<0||a>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);b={name:"cubic-bezier",controlPoints:k}}}if(g.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${g.length-1}.`);if((g.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(!(i=a.parse(i,2,f)))return null;const e=[];let c=null;"interpolate-hcl"===h||"interpolate-lab"===h?c=y:a.expectedType&&"value"!==a.expectedType.kind&&(c=a.expectedType);for(let d=0;d=l)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const m=a.parse(p,q,c);if(!m)return null;c=c||m.type,e.push([l,m])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new ai(c,h,b,i,e):a.error(`Type ${ft(c)} is not interpolatable.`)}evaluate(b){const a=this.labels,c=this.outputs;if(1===a.length)return c[0].evaluate(b);const d=this.input.evaluate(b);if(d<=a[0])return c[0].evaluate(b);const i=a.length;if(d>=a[i-1])return c[i-1].evaluate(b);const e=f3(a,d),f=ai.interpolationFactor(this.interpolation,d,a[e],a[e+1]),g=c[e].evaluate(b),h=c[e+1].evaluate(b);return"interpolate"===this.operator?f4[this.type.kind.toLowerCase()](g,h,f):"interpolate-hcl"===this.operator?cu.reverse(cu.interpolate(cu.forward(g),cu.forward(h),f)):ct.reverse(ct.interpolate(ct.forward(g),ct.forward(h),f))}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){let b;b="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base,]:["cubic-bezier"].concat(this.interpolation.controlPoints);const c=[this.operator,b,this.input.serialize(),];for(let a=0;afv(b,a.type));return new cv(h?l:a,c)}evaluate(d){let b,a=null,c=0;for(const e of this.args){if(c++,(a=e.evaluate(d))&&a instanceof cj&&!a.available&&(b||(b=a),a=null,c===this.args.length))return b;if(null!==a)break}return a}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){const a=["coalesce"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cw{constructor(b,a){this.type=a.type,this.bindings=[].concat(b),this.result=a}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(const b of this.bindings)a(b[1]);a(this.result)}static parse(a,c){if(a.length<4)return c.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);const e=[];for(let b=1;b=b.length)throw new fG(`Array index out of bounds: ${a} > ${b.length-1}.`);if(a!==Math.floor(a))throw new fG(`Array index must be an integer, but found ${a} instead.`);return b[a]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize(),]}}class cy{constructor(a,b){this.type=h,this.needle=a,this.haystack=b}static parse(a,b){if(3!==a.length)return b.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,l),d=b.parse(a[2],2,l);return c&&d?fw(c.type,[h,i,f,cf,l])?new cy(c,d):b.error(`Expected first argument to be of type boolean, string, number or null, but found ${ft(c.type)} instead`):null}evaluate(c){const b=this.needle.evaluate(c),a=this.haystack.evaluate(c);if(!a)return!1;if(!fx(b,["boolean","string","number","null",]))throw new fG(`Expected first argument to be of type boolean, string, number or null, but found ${ft(fE(b))} instead.`);if(!fx(a,["string","array"]))throw new fG(`Expected second argument to be of type array or string, but found ${ft(fE(a))} instead.`);return a.indexOf(b)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize(),]}}class cz{constructor(a,b,c){this.type=f,this.needle=a,this.haystack=b,this.fromIndex=c}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,l),d=b.parse(a[2],2,l);if(!c||!d)return null;if(!fw(c.type,[h,i,f,cf,l]))return b.error(`Expected first argument to be of type boolean, string, number or null, but found ${ft(c.type)} instead`);if(4===a.length){const e=b.parse(a[3],3,f);return e?new cz(c,d,e):null}return new cz(c,d)}evaluate(c){const a=this.needle.evaluate(c),b=this.haystack.evaluate(c);if(!fx(a,["boolean","string","number","null",]))throw new fG(`Expected first argument to be of type boolean, string, number or null, but found ${ft(fE(a))} instead.`);if(!fx(b,["string","array"]))throw new fG(`Expected second argument to be of type array or string, but found ${ft(fE(b))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(c);return b.indexOf(a,d)}return b.indexOf(a)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&& void 0!==this.fromIndex){const a=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),a,]}return["index-of",this.needle.serialize(),this.haystack.serialize(),]}}class cA{constructor(a,b,c,d,e,f){this.inputType=a,this.type=b,this.input=c,this.cases=d,this.outputs=e,this.otherwise=f}static parse(b,c){if(b.length<5)return c.error(`Expected at least 4 arguments, but found only ${b.length-1}.`);if(b.length%2!=1)return c.error("Expected an even number of arguments.");let g,d;c.expectedType&&"value"!==c.expectedType.kind&&(d=c.expectedType);const j={},k=[];for(let e=2;eNumber.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof a&&Math.floor(a)!==a)return f.error("Numeric branch labels must be integer values.");if(g){if(f.checkSubtype(g,fE(a)))return null}else g=fE(a);if(void 0!==j[String(a)])return f.error("Branch labels must be unique.");j[String(a)]=k.length}const m=c.parse(o,e,d);if(!m)return null;d=d||m.type,k.push(m)}const i=c.parse(b[1],1,l);if(!i)return null;const n=c.parse(b[b.length-1],b.length-1,d);return n?"value"!==i.type.kind&&c.concat(1).checkSubtype(g,i.type)?null:new cA(g,d,i,j,k,n):null}evaluate(a){const b=this.input.evaluate(a);return(fE(b)===this.inputType&&this.outputs[this.cases[b]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}serialize(){const b=["match",this.input.serialize()],h=Object.keys(this.cases).sort(),c=[],e={};for(const a of h){const f=e[this.cases[a]];void 0===f?(e[this.cases[a]]=c.length,c.push([this.cases[a],[a]])):c[f][1].push(a)}const g=a=>"number"===this.inputType.kind?Number(a):a;for(const[i,d]of c)b.push(1===d.length?g(d[0]):d.map(g)),b.push(this.outputs[i].serialize());return b.push(this.otherwise.serialize()),b}}class cB{constructor(a,b,c){this.type=a,this.branches=b,this.otherwise=c}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return b.error("Expected an odd number of arguments.");let c;b.expectedType&&"value"!==b.expectedType.kind&&(c=b.expectedType);const f=[];for(let d=1;da.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["case"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cC{constructor(a,b,c,d){this.type=a,this.input=b,this.beginIndex=c,this.endIndex=d}static parse(a,c){if(a.length<=2||a.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const b=c.parse(a[1],1,l),d=c.parse(a[2],2,f);if(!b||!d)return null;if(!fw(b.type,[z(l),i,l]))return c.error(`Expected first argument to be of type array or string, but found ${ft(b.type)} instead`);if(4===a.length){const e=c.parse(a[3],3,f);return e?new cC(b.type,b,d,e):null}return new cC(b.type,b,d)}evaluate(b){const a=this.input.evaluate(b),c=this.beginIndex.evaluate(b);if(!fx(a,["string","array"]))throw new fG(`Expected first argument to be of type array or string, but found ${ft(fE(a))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(b);return a.slice(c,d)}return a.slice(c)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&& void 0!==this.endIndex){const a=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),a,]}return["slice",this.input.serialize(),this.beginIndex.serialize(),]}}function gf(b,a){return"=="===b||"!="===b?"boolean"===a.kind||"string"===a.kind||"number"===a.kind||"null"===a.kind||"value"===a.kind:"string"===a.kind||"number"===a.kind||"value"===a.kind}function cD(d,a,b,c){return 0===c.compare(a,b)}function A(a,b,c){const d="=="!==a&&"!="!==a;return class e{constructor(a,b,c){this.type=h,this.lhs=a,this.rhs=b,this.collator=c,this.hasUntypedArgument="value"===a.type.kind||"value"===b.type.kind}static parse(f,c){if(3!==f.length&&4!==f.length)return c.error("Expected two or three arguments.");const g=f[0];let a=c.parse(f[1],1,l);if(!a)return null;if(!gf(g,a.type))return c.concat(1).error(`"${g}" comparisons are not supported for type '${ft(a.type)}'.`);let b=c.parse(f[2],2,l);if(!b)return null;if(!gf(g,b.type))return c.concat(2).error(`"${g}" comparisons are not supported for type '${ft(b.type)}'.`);if(a.type.kind!==b.type.kind&&"value"!==a.type.kind&&"value"!==b.type.kind)return c.error(`Cannot compare types '${ft(a.type)}' and '${ft(b.type)}'.`);d&&("value"===a.type.kind&&"value"!==b.type.kind?a=new L(b.type,[a]):"value"!==a.type.kind&&"value"===b.type.kind&&(b=new L(a.type,[b])));let h=null;if(4===f.length){if("string"!==a.type.kind&&"string"!==b.type.kind&&"value"!==a.type.kind&&"value"!==b.type.kind)return c.error("Cannot use collator to compare non-string types.");if(!(h=c.parse(f[3],3,cg)))return null}return new e(a,b,h)}evaluate(e){const f=this.lhs.evaluate(e),g=this.rhs.evaluate(e);if(d&&this.hasUntypedArgument){const h=fE(f),i=fE(g);if(h.kind!==i.kind||"string"!==h.kind&&"number"!==h.kind)throw new fG(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${h.kind}, ${i.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const j=fE(f),k=fE(g);if("string"!==j.kind||"string"!==k.kind)return b(e,f,g)}return this.collator?c(e,f,g,this.collator.evaluate(e)):b(e,f,g)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}serialize(){const b=[a];return this.eachChild(a=>{b.push(a.serialize())}),b}}}const cE=A("==",function(c,a,b){return a===b},cD),cF=A("!=",function(c,a,b){return a!==b},function(d,a,b,c){return!cD(0,a,b,c)}),cG=A("<",function(c,a,b){return ac.compare(a,b)}),cH=A(">",function(c,a,b){return a>b},function(d,a,b,c){return c.compare(a,b)>0}),cI=A("<=",function(c,a,b){return a<=b},function(d,a,b,c){return 0>=c.compare(a,b)}),cJ=A(">=",function(c,a,b){return a>=b},function(d,a,b,c){return c.compare(a,b)>=0});class cK{constructor(a,b,c,d,e){this.type=i,this.number=a,this.locale=b,this.currency=c,this.minFractionDigits=d,this.maxFractionDigits=e}static parse(c,b){if(3!==c.length)return b.error("Expected two arguments.");const d=b.parse(c[1],1,f);if(!d)return null;const a=c[2];if("object"!=typeof a||Array.isArray(a))return b.error("NumberFormat options argument must be an object.");let e=null;if(a.locale&&!(e=b.parse(a.locale,1,i)))return null;let g=null;if(a.currency&&!(g=b.parse(a.currency,1,i)))return null;let h=null;if(a["min-fraction-digits"]&&!(h=b.parse(a["min-fraction-digits"],1,f)))return null;let j=null;return!a["max-fraction-digits"]||(j=b.parse(a["max-fraction-digits"],1,f))?new cK(d,e,g,h,j):null}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const a={};return this.locale&&(a.locale=this.locale.serialize()),this.currency&&(a.currency=this.currency.serialize()),this.minFractionDigits&&(a["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(a["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),a,]}}class cL{constructor(a){this.type=f,this.input=a}static parse(b,c){if(2!==b.length)return c.error(`Expected 1 argument, but found ${b.length-1} instead.`);const a=c.parse(b[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?c.error(`Expected argument of type string or array, but found ${ft(a.type)} instead.`):new cL(a):null}evaluate(b){const a=this.input.evaluate(b);if("string"==typeof a||Array.isArray(a))return a.length;throw new fG(`Expected value to be of type string or array, but found ${ft(fE(a))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){const a=["length"];return this.eachChild(b=>{a.push(b.serialize())}),a}}const U={"==":cE,"!=":cF,">":cH,"<":cG,">=":cJ,"<=":cI,array:L,at:cx,boolean:L,case:cB,coalesce:cv,collator:cn,format:cl,image:cm,in:cy,"index-of":cz,interpolate:ai,"interpolate-hcl":ai,"interpolate-lab":ai,length:cL,let:cw,literal:ck,match:cA,number:L,"number-format":cK,object:L,slice:cC,step:cq,string:L,"to-boolean":T,"to-color":T,"to-number":T,"to-string":T,var:cp,within:co};function a$(b,[c,d,e,f]){c=c.evaluate(b),d=d.evaluate(b),e=e.evaluate(b);const a=f?f.evaluate(b):1,g=fC(c,d,e,a);if(g)throw new fG(g);return new m(c/255*a,d/255*a,e/255*a,a)}function gg(b,c){const a=c[b];return void 0===a?null:a}function x(a){return{type:a}}function gh(a){return{result:"success",value:a}}function gi(a){return{result:"error",value:a}}function gj(a){return"data-driven"===a["property-type"]||"cross-faded-data-driven"===a["property-type"]}function gk(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")> -1}function gl(a){return!!a.expression&&a.expression.interpolated}function gm(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":null===a?"null":typeof a}function gn(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function go(a){return a}function gp(a,e){const r="color"===e.type,g=a.stops&&"object"==typeof a.stops[0][0],s=g||!(g|| void 0!==a.property),b=a.type||(gl(e)?"exponential":"interval");if(r&&((a=ce({},a)).stops&&(a.stops=a.stops.map(a=>[a[0],m.parse(a[1]),])),a.default=m.parse(a.default?a.default:e.default)),a.colorSpace&&"rgb"!==a.colorSpace&&!gd[a.colorSpace])throw new Error(`Unknown color space: ${a.colorSpace}`);let f,j,t;if("exponential"===b)f=gt;else if("interval"===b)f=gs;else if("categorical"===b){for(const k of(f=gr,j=Object.create(null),a.stops))j[k[0]]=k[1];t=typeof a.stops[0][0]}else{if("identity"!==b)throw new Error(`Unknown function type "${b}"`);f=gu}if(g){const c={},l=[];for(let h=0;ha[0]),evaluate:({zoom:b},c)=>gt({stops:n,base:a.base},e,b).evaluate(b,c)}}if(s){const q="exponential"===b?{name:"exponential",base:void 0!==a.base?a.base:1}:null;return{kind:"camera",interpolationType:q,interpolationFactor:ai.interpolationFactor.bind(void 0,q),zoomStops:a.stops.map(a=>a[0]),evaluate:({zoom:b})=>f(a,e,b,j,t)}}return{kind:"source",evaluate(d,b){const c=b&&b.properties?b.properties[a.property]:void 0;return void 0===c?gq(a.default,e.default):f(a,e,c,j,t)}}}function gq(a,b,c){return void 0!==a?a:void 0!==b?b:void 0!==c?c:void 0}function gr(b,c,a,d,e){return gq(typeof a===e?d[a]:void 0,b.default,c.default)}function gs(a,d,b){if("number"!==gm(b))return gq(a.default,d.default);const c=a.stops.length;if(1===c||b<=a.stops[0][0])return a.stops[0][1];if(b>=a.stops[c-1][0])return a.stops[c-1][1];const e=f3(a.stops.map(a=>a[0]),b);return a.stops[e][1]}function gt(a,e,b){const h=void 0!==a.base?a.base:1;if("number"!==gm(b))return gq(a.default,e.default);const d=a.stops.length;if(1===d||b<=a.stops[0][0])return a.stops[0][1];if(b>=a.stops[d-1][0])return a.stops[d-1][1];const c=f3(a.stops.map(a=>a[0]),b),i=function(e,a,c,f){const b=f-c,d=e-c;return 0===b?0:1===a?d/b:(Math.pow(a,d)-1)/(Math.pow(a,b)-1)}(b,h,a.stops[c][0],a.stops[c+1][0]),f=a.stops[c][1],j=a.stops[c+1][1];let g=f4[e.type]||go;if(a.colorSpace&&"rgb"!==a.colorSpace){const k=gd[a.colorSpace];g=(a,b)=>k.reverse(k.interpolate(k.forward(a),k.forward(b),i))}return"function"==typeof f.evaluate?{evaluate(...a){const b=f.evaluate.apply(void 0,a),c=j.evaluate.apply(void 0,a);if(void 0!==b&& void 0!==c)return g(b,c,i)}}:g(f,j,i)}function gu(c,b,a){return"color"===b.type?a=m.parse(a):"formatted"===b.type?a=fB.fromString(a.toString()):"resolvedImage"===b.type?a=cj.fromString(a.toString()):gm(a)===b.type||"enum"===b.type&&b.values[a]||(a=void 0),gq(a,c.default,b.default)}aX.register(U,{error:[{kind:"error"},[i],(a,[b])=>{throw new fG(b.evaluate(a))},],typeof:[i,[l],(a,[b])=>ft(fE(b.evaluate(a))),],"to-rgba":[z(f,4),[y],(a,[b])=>b.evaluate(a).toArray(),],rgb:[y,[f,f,f],a$],rgba:[y,[f,f,f,f],a$],has:{type:h,overloads:[[[i],(a,[d])=>{var b,c;return b=d.evaluate(a),c=a.properties(),b in c},],[[i,K],(a,[b,c])=>b.evaluate(a) in c.evaluate(a),],]},get:{type:l,overloads:[[[i],(a,[b])=>gg(b.evaluate(a),a.properties()),],[[i,K],(a,[b,c])=>gg(b.evaluate(a),c.evaluate(a)),],]},"feature-state":[l,[i],(a,[b])=>gg(b.evaluate(a),a.featureState||{}),],properties:[K,[],a=>a.properties()],"geometry-type":[i,[],a=>a.geometryType()],id:[l,[],a=>a.id()],zoom:[f,[],a=>a.globals.zoom],pitch:[f,[],a=>a.globals.pitch||0],"distance-from-center":[f,[],a=>a.distanceFromCenter(),],"heatmap-density":[f,[],a=>a.globals.heatmapDensity||0,],"line-progress":[f,[],a=>a.globals.lineProgress||0,],"sky-radial-progress":[f,[],a=>a.globals.skyRadialProgress||0,],accumulated:[l,[],a=>void 0===a.globals.accumulated?null:a.globals.accumulated,],"+":[f,x(f),(b,c)=>{let a=0;for(const d of c)a+=d.evaluate(b);return a},],"*":[f,x(f),(b,c)=>{let a=1;for(const d of c)a*=d.evaluate(b);return a},],"-":{type:f,overloads:[[[f,f],(a,[b,c])=>b.evaluate(a)-c.evaluate(a),],[[f],(a,[b])=>-b.evaluate(a)],]},"/":[f,[f,f],(a,[b,c])=>b.evaluate(a)/c.evaluate(a),],"%":[f,[f,f],(a,[b,c])=>b.evaluate(a)%c.evaluate(a),],ln2:[f,[],()=>Math.LN2],pi:[f,[],()=>Math.PI],e:[f,[],()=>Math.E],"^":[f,[f,f],(a,[b,c])=>Math.pow(b.evaluate(a),c.evaluate(a)),],sqrt:[f,[f],(a,[b])=>Math.sqrt(b.evaluate(a)),],log10:[f,[f],(a,[b])=>Math.log(b.evaluate(a))/Math.LN10,],ln:[f,[f],(a,[b])=>Math.log(b.evaluate(a))],log2:[f,[f],(a,[b])=>Math.log(b.evaluate(a))/Math.LN2,],sin:[f,[f],(a,[b])=>Math.sin(b.evaluate(a)),],cos:[f,[f],(a,[b])=>Math.cos(b.evaluate(a)),],tan:[f,[f],(a,[b])=>Math.tan(b.evaluate(a)),],asin:[f,[f],(a,[b])=>Math.asin(b.evaluate(a)),],acos:[f,[f],(a,[b])=>Math.acos(b.evaluate(a)),],atan:[f,[f],(a,[b])=>Math.atan(b.evaluate(a)),],min:[f,x(f),(b,a)=>Math.min(...a.map(a=>a.evaluate(b))),],max:[f,x(f),(b,a)=>Math.max(...a.map(a=>a.evaluate(b))),],abs:[f,[f],(a,[b])=>Math.abs(b.evaluate(a)),],round:[f,[f],(b,[c])=>{const a=c.evaluate(b);return a<0?-Math.round(-a):Math.round(a)},],floor:[f,[f],(a,[b])=>Math.floor(b.evaluate(a)),],ceil:[f,[f],(a,[b])=>Math.ceil(b.evaluate(a)),],"filter-==":[h,[i,l],(a,[b,c])=>a.properties()[b.value]===c.value,],"filter-id-==":[h,[l],(a,[b])=>a.id()===b.value,],"filter-type-==":[h,[i],(a,[b])=>a.geometryType()===b.value,],"filter-<":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a{const a=c.id(),b=d.value;return typeof a==typeof b&&a":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a>b},],"filter-id->":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a>b},],"filter-<=":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a<=b},],"filter-id-<=":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a<=b},],"filter->=":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a>=b},],"filter-id->=":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a>=b},],"filter-has":[h,[l],(a,[b])=>b.value in a.properties(),],"filter-has-id":[h,[],a=>null!==a.id()&& void 0!==a.id(),],"filter-type-in":[h,[z(i)],(a,[b])=>b.value.indexOf(a.geometryType())>=0,],"filter-id-in":[h,[z(l)],(a,[b])=>b.value.indexOf(a.id())>=0,],"filter-in-small":[h,[i,z(l)],(a,[b,c])=>c.value.indexOf(a.properties()[b.value])>=0,],"filter-in-large":[h,[i,z(l)],(b,[c,a])=>(function(d,e,b,c){for(;b<=c;){const a=b+c>>1;if(e[a]===d)return!0;e[a]>d?c=a-1:b=a+1}return!1})(b.properties()[c.value],a.value,0,a.value.length-1),],all:{type:h,overloads:[[[h,h],(a,[b,c])=>b.evaluate(a)&&c.evaluate(a),],[x(h),(a,b)=>{for(const c of b)if(!c.evaluate(a))return!1;return!0},],]},any:{type:h,overloads:[[[h,h],(a,[b,c])=>b.evaluate(a)||c.evaluate(a),],[x(h),(a,b)=>{for(const c of b)if(c.evaluate(a))return!0;return!1},],]},"!":[h,[h],(a,[b])=>!b.evaluate(a)],"is-supported-script":[h,[i],(a,[c])=>{const b=a.globals&&a.globals.isSupportedScript;return!b||b(c.evaluate(a))},],upcase:[i,[i],(a,[b])=>b.evaluate(a).toUpperCase(),],downcase:[i,[i],(a,[b])=>b.evaluate(a).toLowerCase(),],concat:[i,x(l),(b,a)=>a.map(a=>fF(a.evaluate(b))).join(""),],"resolved-locale":[i,[cg],(a,[b])=>b.evaluate(a).resolvedLocale(),]});class cM{constructor(c,b){var a;this.expression=c,this._warningHistory={},this._evaluator=new fK,this._defaultValue=b?"color"===(a=b).type&&gn(a.default)?new m(0,0,0,0):"color"===a.type?m.parse(a.default)||null:void 0===a.default?null:a.default:null,this._enumValues=b&&"enum"===b.type?b.values:null}evaluateWithoutErrorHandling(a,b,c,d,e,f,g,h){return this._evaluator.globals=a,this._evaluator.feature=b,this._evaluator.featureState=c,this._evaluator.canonical=d,this._evaluator.availableImages=e||null,this._evaluator.formattedSection=f,this._evaluator.featureTileCoord=g||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(c,d,e,f,g,h,i,j){this._evaluator.globals=c,this._evaluator.feature=d||null,this._evaluator.featureState=e||null,this._evaluator.canonical=f,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=i||null,this._evaluator.featureDistanceData=j||null;try{const a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new fG(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,"undefined"!=typeof console&&console.warn(b.message)),this._defaultValue}}}function gv(a){return Array.isArray(a)&&a.length>0&&"string"==typeof a[0]&&a[0]in U}function cN(d,a){const b=new f1(U,[],a?function(a){const b={color:y,string:i,number:f,enum:i,boolean:h,formatted:ch,resolvedImage:ci};return"array"===a.type?z(b[a.value]||l,a.length):b[a.type]}(a):void 0),c=b.parse(d,void 0,void 0,void 0,a&&"string"===a.type?{typeAnnotation:"coerce"}:void 0);return c?gh(new cM(c,a)):gi(b.errors)}class cO{constructor(a,b){this.kind=a,this._styleExpression=b,this.isStateDependent="constant"!==a&&!f_(b.expression)}evaluateWithoutErrorHandling(a,b,c,d,e,f){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,e,f)}evaluate(a,b,c,d,e,f){return this._styleExpression.evaluate(a,b,c,d,e,f)}}class cP{constructor(a,b,c,d){this.kind=a,this.zoomStops=c,this._styleExpression=b,this.isStateDependent="camera"!==a&&!f_(b.expression),this.interpolationType=d}evaluateWithoutErrorHandling(a,b,c,d,e,f){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,e,f)}evaluate(a,b,c,d,e,f){return this._styleExpression.evaluate(a,b,c,d,e,f)}interpolationFactor(a,b,c){return this.interpolationType?ai.interpolationFactor(this.interpolationType,a,b,c):0}}function gw(b,c){if("error"===(b=cN(b,c)).result)return b;const d=b.value.expression,e=f$(d);if(!e&&!gj(c))return gi([new fr("","data expressions not supported"),]);const f=f0(d,["zoom","pitch","distance-from-center",]);if(!f&&!gk(c))return gi([new fr("","zoom expressions not supported"),]);const a=gx(d);return a||f?a instanceof fr?gi([a]):a instanceof ai&&!gl(c)?gi([new fr("",'"interpolate" expressions cannot be used with this property'),]):gh(a?new cP(e?"camera":"composite",b.value,a.labels,a instanceof ai?a.interpolation:void 0):new cO(e?"constant":"source",b.value)):gi([new fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'),])}class cQ{constructor(a,b){this._parameters=a,this._specification=b,ce(this,gp(this._parameters,this._specification))}static deserialize(a){return new cQ(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function gx(a){let b=null;if(a instanceof cw)b=gx(a.result);else if(a instanceof cv){for(const c of a.args)if(b=gx(c))break}else(a instanceof cq||a instanceof ai)&&a.input instanceof aX&&"zoom"===a.input.name&&(b=a);return b instanceof fr||a.eachChild(c=>{const a=gx(c);a instanceof fr?b=a:!b&&a?b=new fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):b&&a&&b!==a&&(b=new fr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),b}function cR(c){const d=c.key,a=c.value,b=c.valueSpec||{},f=c.objectElementValidators||{},l=c.style,m=c.styleSpec;let g=[];const k=gm(a);if("object"!==k)return[new cc(d,a,`object expected, ${k} found`),];for(const e in a){const j=e.split(".")[0],n=b[j]||b["*"];let h;if(f[j])h=f[j];else if(b[j])h=gR;else if(f["*"])h=f["*"];else{if(!b["*"]){g.push(new cc(d,a[e],`unknown property "${e}"`));continue}h=gR}g=g.concat(h({key:(d?`${d}.`:d)+e,value:a[e],valueSpec:n,style:l,styleSpec:m,object:a,objectKey:e},a))}for(const i in b)f[i]||b[i].required&& void 0===b[i].default&& void 0===a[i]&&g.push(new cc(d,a,`missing required property "${i}"`));return g}function cS(c){const b=c.value,a=c.valueSpec,i=c.style,h=c.styleSpec,e=c.key,j=c.arrayElementValidator||gR;if("array"!==gm(b))return[new cc(e,b,`array expected, ${gm(b)} found`),];if(a.length&&b.length!==a.length)return[new cc(e,b,`array length ${a.length} expected, length ${b.length} found`),];if(a["min-length"]&&b.lengthg)return[new cc(e,a,`${a} is greater than the maximum value ${g}`),]}return[]}function cU(a){const f=a.valueSpec,c=fp(a.value.type);let g,h,i,j={};const d="categorical"!==c&& void 0===a.value.property,e="array"===gm(a.value.stops)&&"array"===gm(a.value.stops[0])&&"object"===gm(a.value.stops[0][0]),b=cR({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(a){if("identity"===c)return[new cc(a.key,a.value,'identity function may not have a "stops" property'),];let b=[];const d=a.value;return b=b.concat(cS({key:a.key,value:d,valueSpec:a.valueSpec,style:a.style,styleSpec:a.styleSpec,arrayElementValidator:k})),"array"===gm(d)&&0===d.length&&b.push(new cc(a.key,d,"array must have at least one stop")),b},default:function(a){return gR({key:a.key,value:a.value,valueSpec:f,style:a.style,styleSpec:a.styleSpec})}}});return"identity"===c&&d&&b.push(new cc(a.key,a.value,'missing required property "property"')),"identity"===c||a.value.stops||b.push(new cc(a.key,a.value,'missing required property "stops"')),"exponential"===c&&a.valueSpec.expression&&!gl(a.valueSpec)&&b.push(new cc(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(d||gj(a.valueSpec)?d&&!gk(a.valueSpec)&&b.push(new cc(a.key,a.value,"zoom functions not supported")):b.push(new cc(a.key,a.value,"property functions not supported"))),("categorical"===c||e)&& void 0===a.value.property&&b.push(new cc(a.key,a.value,'"property" property is required')),b;function k(c){let d=[];const a=c.value,b=c.key;if("array"!==gm(a))return[new cc(b,a,`array expected, ${gm(a)} found`),];if(2!==a.length)return[new cc(b,a,`array length 2 expected, length ${a.length} found`),];if(e){if("object"!==gm(a[0]))return[new cc(b,a,`object expected, ${gm(a[0])} found`),];if(void 0===a[0].zoom)return[new cc(b,a,"object stop key must have zoom"),];if(void 0===a[0].value)return[new cc(b,a,"object stop key must have value"),];if(i&&i>fp(a[0].zoom))return[new cc(b,a[0].zoom,"stop zoom values must appear in ascending order"),];fp(a[0].zoom)!==i&&(i=fp(a[0].zoom),h=void 0,j={}),d=d.concat(cR({key:`${b}[0]`,value:a[0],valueSpec:{zoom:{}},style:c.style,styleSpec:c.styleSpec,objectElementValidators:{zoom:cT,value:l}}))}else d=d.concat(l({key:`${b}[0]`,value:a[0],valueSpec:{},style:c.style,styleSpec:c.styleSpec},a));return gv(fq(a[1]))?d.concat([new cc(`${b}[1]`,a[1],"expressions are not allowed in function stops."),]):d.concat(gR({key:`${b}[1]`,value:a[1],valueSpec:f,style:c.style,styleSpec:c.styleSpec}))}function l(a,k){const b=gm(a.value),d=fp(a.value),e=null!==a.value?a.value:k;if(g){if(b!==g)return[new cc(a.key,e,`${b} stop domain type must match previous stop domain type ${g}`),]}else g=b;if("number"!==b&&"string"!==b&&"boolean"!==b)return[new cc(a.key,e,"stop domain value must be a number, string, or boolean"),];if("number"!==b&&"categorical"!==c){let i=`number expected, ${b} found`;return gj(f)&& void 0===c&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new cc(a.key,e,i)]}return"categorical"!==c||"number"!==b||isFinite(d)&&Math.floor(d)===d?"categorical"!==c&&"number"===b&& void 0!==h&&dnew cc(`${a.key}${b.key}`,a.value,b.message));const b=c.value.expression||c.value._styleExpression.expression;if("property"===a.expressionContext&&"text-font"===a.propertyKey&&!b.outputDefined())return[new cc(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`),];if("property"===a.expressionContext&&"layout"===a.propertyType&&!f_(b))return[new cc(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.'),];if("filter"===a.expressionContext)return gz(b,a);if(a.expressionContext&&0===a.expressionContext.indexOf("cluster")){if(!f0(b,["zoom","feature-state"]))return[new cc(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.'),];if("cluster-initial"===a.expressionContext&&!f$(b))return[new cc(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties."),]}return[]}function gz(b,a){const c=new Set(["zoom","feature-state","pitch","distance-from-center",]);for(const d of a.valueSpec.expression.parameters)c.delete(d);if(0===c.size)return[];const e=[];return b instanceof aX&&c.has(b.name)?[new cc(a.key,a.value,`["${b.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`),]:(b.eachChild(b=>{e.push(...gz(b,a))}),e)}function cV(c){const e=c.key,a=c.value,b=c.valueSpec,d=[];return Array.isArray(b.values)?-1===b.values.indexOf(fp(a))&&d.push(new cc(e,a,`expected one of [${b.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(b.values).indexOf(fp(a))&&d.push(new cc(e,a,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(a)} found`)),d}function gA(a){if(!0===a|| !1===a)return!0;if(!Array.isArray(a)||0===a.length)return!1;switch(a[0]){case"has":return a.length>=2&&"$id"!==a[1]&&"$type"!==a[1];case"in":return a.length>=3&&("string"!=typeof a[1]||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==a.length||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const b of a.slice(1))if(!gA(b)&&"boolean"!=typeof b)return!1;return!0;default:return!0}}function gB(a,k="fill"){if(null==a)return{filter:()=>!0,needGeometry:!1,needFeature:!1};gA(a)||(a=gI(a));const c=a;let d=!0;try{d=function(a){if(!gE(a))return a;let b=fq(a);return gD(b),b=gC(b)}(c)}catch(l){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(b,c,a){var d=a(3454);!function(c,a){b.exports=a()}(this,function(){"use strict";var c,e,b;function a(g,a){if(c){if(e){var f="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+c+")(sharedChunk); ("+e+")(sharedChunk); self.onerror = null;",d={};c(d),b=a(d),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(b.workerUrl=window.URL.createObjectURL(new Blob([f],{type:"text/javascript"})))}else e=a}else c=a}return a(["exports"],function(a){var bq="2.7.0",eG=H;function H(a,c,d,b){this.cx=3*a,this.bx=3*(d-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*c,this.by=3*(b-c)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=b,this.p2x=d,this.p2y=b}H.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},H.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},H.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},H.prototype.solveCurveX=function(c,e){var b,d,a,f,g;for(void 0===e&&(e=1e-6),a=c,g=0;g<8;g++){if(Math.abs(f=this.sampleCurveX(a)-c)Math.abs(h))break;a-=f/h}if((a=c)<(b=0))return b;if(a>(d=1))return d;for(;bf?b=a:d=a,a=.5*(d-b)+b;return a},H.prototype.solve=function(a,b){return this.sampleCurveY(this.solveCurveX(a,b))};var aF=aG;function aG(a,b){this.x=a,this.y=b}aG.prototype={clone:function(){return new aG(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,b){return this.clone()._rotateAround(a,b)},matMult:function(a){return this.clone()._matMult(a)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var b=a.x-this.x,c=a.y-this.y;return b*b+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,b){return Math.atan2(this.x*b-this.y*a,this.x*a+this.y*b)},_matMult:function(a){var b=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=b,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=c*this.x+b*this.y;return this.x=b*this.x-c*this.y,this.y=d,this},_rotateAround:function(b,a){var c=Math.cos(b),d=Math.sin(b),e=a.y+d*(this.x-a.x)+c*(this.y-a.y);return this.x=a.x+c*(this.x-a.x)-d*(this.y-a.y),this.y=e,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},aG.convert=function(a){return a instanceof aG?a:Array.isArray(a)?new aG(a[0],a[1]):a};var s="undefined"!=typeof self?self:{},I="undefined"!=typeof Float32Array?Float32Array:Array;function aH(){var a=new I(9);return I!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function aI(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function aJ(a,b,c){var h=b[0],i=b[1],j=b[2],k=b[3],l=b[4],m=b[5],n=b[6],o=b[7],p=b[8],q=b[9],r=b[10],s=b[11],t=b[12],u=b[13],v=b[14],w=b[15],d=c[0],e=c[1],f=c[2],g=c[3];return a[0]=d*h+e*l+f*p+g*t,a[1]=d*i+e*m+f*q+g*u,a[2]=d*j+e*n+f*r+g*v,a[3]=d*k+e*o+f*s+g*w,a[4]=(d=c[4])*h+(e=c[5])*l+(f=c[6])*p+(g=c[7])*t,a[5]=d*i+e*m+f*q+g*u,a[6]=d*j+e*n+f*r+g*v,a[7]=d*k+e*o+f*s+g*w,a[8]=(d=c[8])*h+(e=c[9])*l+(f=c[10])*p+(g=c[11])*t,a[9]=d*i+e*m+f*q+g*u,a[10]=d*j+e*n+f*r+g*v,a[11]=d*k+e*o+f*s+g*w,a[12]=(d=c[12])*h+(e=c[13])*l+(f=c[14])*p+(g=c[15])*t,a[13]=d*i+e*m+f*q+g*u,a[14]=d*j+e*n+f*r+g*v,a[15]=d*k+e*o+f*s+g*w,a}function br(b,a,f){var r,g,h,i,j,k,l,m,n,o,p,q,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[1],h=a[2],i=a[3],j=a[4],k=a[5],l=a[6],m=a[7],n=a[8],o=a[9],p=a[10],q=a[11],b[0]=r=a[0],b[1]=g,b[2]=h,b[3]=i,b[4]=j,b[5]=k,b[6]=l,b[7]=m,b[8]=n,b[9]=o,b[10]=p,b[11]=q,b[12]=r*c+j*d+n*e+a[12],b[13]=g*c+k*d+o*e+a[13],b[14]=h*c+l*d+p*e+a[14],b[15]=i*c+m*d+q*e+a[15]),b}function bs(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function bt(a,b,e){var c=Math.sin(e),d=Math.cos(e),f=b[4],g=b[5],h=b[6],i=b[7],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=f*d+j*c,a[5]=g*d+k*c,a[6]=h*d+l*c,a[7]=i*d+m*c,a[8]=j*d-f*c,a[9]=k*d-g*c,a[10]=l*d-h*c,a[11]=m*d-i*c,a}function bu(a,b,e){var c=Math.sin(e),d=Math.cos(e),f=b[0],g=b[1],h=b[2],i=b[3],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=f*d-j*c,a[1]=g*d-k*c,a[2]=h*d-l*c,a[3]=i*d-m*c,a[8]=f*c+j*d,a[9]=g*c+k*d,a[10]=h*c+l*d,a[11]=i*c+m*d,a}Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)});var bv=aJ;function aK(){var a=new I(3);return I!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function eH(b){var a=new I(3);return a[0]=b[0],a[1]=b[1],a[2]=b[2],a}function aL(a){return Math.hypot(a[0],a[1],a[2])}function Q(b,c,d){var a=new I(3);return a[0]=b,a[1]=c,a[2]=d,a}function bw(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a}function aM(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}function aN(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a}function eI(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a}function bx(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a}function by(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a}function bz(c,a){var d=a[0],e=a[1],f=a[2],b=d*d+e*e+f*f;return b>0&&(b=1/Math.sqrt(b)),c[0]=a[0]*b,c[1]=a[1]*b,c[2]=a[2]*b,c}function bA(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function bB(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2];return a[0]=e*i-f*h,a[1]=f*g-d*i,a[2]=d*h-e*g,a}function bC(b,g,a){var c=g[0],d=g[1],e=g[2],f=a[3]*c+a[7]*d+a[11]*e+a[15];return b[0]=(a[0]*c+a[4]*d+a[8]*e+a[12])/(f=f||1),b[1]=(a[1]*c+a[5]*d+a[9]*e+a[13])/f,b[2]=(a[2]*c+a[6]*d+a[10]*e+a[14])/f,b}function bD(a,h,b){var c=b[0],d=b[1],e=b[2],i=h[0],j=h[1],k=h[2],l=d*k-e*j,f=e*i-c*k,g=c*j-d*i,p=d*g-e*f,n=e*l-c*g,o=c*f-d*l,m=2*b[3];return f*=m,g*=m,n*=2,o*=2,a[0]=i+(l*=m)+(p*=2),a[1]=j+f+n,a[2]=k+g+o,a}var J,bE=aM;function bF(b,c,a){var d=c[0],e=c[1],f=c[2],g=c[3];return b[0]=a[0]*d+a[4]*e+a[8]*f+a[12]*g,b[1]=a[1]*d+a[5]*e+a[9]*f+a[13]*g,b[2]=a[2]*d+a[6]*e+a[10]*f+a[14]*g,b[3]=a[3]*d+a[7]*e+a[11]*f+a[15]*g,b}function aO(){var a=new I(4);return I!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function bG(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function bH(a,b,e){e*=.5;var f=b[0],g=b[1],h=b[2],i=b[3],c=Math.sin(e),d=Math.cos(e);return a[0]=f*d+i*c,a[1]=g*d+h*c,a[2]=h*d-g*c,a[3]=i*d-f*c,a}function eJ(a,b){return a[0]===b[0]&&a[1]===b[1]}aK(),J=new I(4),I!=Float32Array&&(J[0]=0,J[1]=0,J[2]=0,J[3]=0),aK(),Q(1,0,0),Q(0,1,0),aO(),aO(),aH(),lr=new I(2),I!=Float32Array&&(lr[0]=0,lr[1]=0);const aP=Math.PI/180,eK=180/Math.PI;function bI(a){return a*aP}function bJ(a){return a*eK}const eL=[[0,0],[1,0],[1,1],[0,1],];function bK(a){if(a<=0)return 0;if(a>=1)return 1;const b=a*a,c=b*a;return 4*(a<.5?c:3*(a-b)+c-.75)}function aQ(a,b,c,d){const e=new eG(a,b,c,d);return function(a){return e.solve(a)}}const bL=aQ(.25,.1,.25,1);function bM(a,b,c){return Math.min(c,Math.max(b,a))}function bN(b,c,a){return(a=bM((a-b)/(c-b),0,1))*a*(3-2*a)}function bO(e,a,c){const b=c-a,d=((e-a)%b+b)%b+a;return d===a?c:d}function bP(a,c,b){if(!a.length)return b(null,[]);let d=a.length;const e=Array(a.length);let f=null;a.forEach((a,g)=>{c(a,(a,c)=>{a&&(f=a),e[g]=c,0== --d&&b(f,e)})})}function bQ(a){const b=[];for(const c in a)b.push(a[c]);return b}function bR(a,...d){for(const b of d)for(const c in b)a[c]=b[c];return a}let eM=1;function bS(){return eM++}function eN(){return function b(a){return a?(a^16*Math.random()>>a/4).toString(16):([1e7]+ -[1e3]+ -4e3+ -8e3+ -1e11).replace(/[018]/g,b)}()}function bT(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function eO(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)}function bU(a,b){a.forEach(a=>{b[a]&&(b[a]=b[a].bind(b))})}function bV(a,b){return -1!==a.indexOf(b,a.length-b.length)}function eP(a,d,e){const c={};for(const b in a)c[b]=d.call(e||this,a[b],b,a);return c}function bW(a,d,e){const c={};for(const b in a)d.call(e||this,a[b],b,a)&&(c[b]=a[b]);return c}function bX(a){return Array.isArray(a)?a.map(bX):"object"==typeof a&&a?eP(a,bX):a}const eQ={};function bY(a){eQ[a]||("undefined"!=typeof console&&console.warn(a),eQ[a]=!0)}function eR(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)}function eS(a){let e=0;for(let b,c,d=0,f=a.length,g=f-1;d@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(f,c,d,e)=>{const b=d||e;return a[c]=!b||b.toLowerCase(),""}),a["max-age"]){const b=parseInt(a["max-age"],10);isNaN(b)?delete a["max-age"]:a["max-age"]=b}return a}let eU,af,eV,eW=null;function eX(b){if(null==eW){const a=b.navigator?b.navigator.userAgent:null;eW=!!b.safari||!(!a||!(/\b(iPad|iPhone|iPod)\b/.test(a)||a.match("Safari")&&!a.match("Chrome")))}return eW}function eY(b){try{const a=s[b];return a.setItem("_mapbox_test_",1),a.removeItem("_mapbox_test_"),!0}catch(c){return!1}}const b$={now:()=>void 0!==eV?eV:s.performance.now(),setNow(a){eV=a},restoreNow(){eV=void 0},frame(a){const b=s.requestAnimationFrame(a);return{cancel:()=>s.cancelAnimationFrame(b)}},getImageData(a,b=0){const c=s.document.createElement("canvas"),d=c.getContext("2d");if(!d)throw Error("failed to create canvas 2d context");return c.width=a.width,c.height=a.height,d.drawImage(a,0,0,a.width,a.height),d.getImageData(-b,-b,a.width+2*b,a.height+2*b)},resolveURL:a=>(eU||(eU=s.document.createElement("a")),eU.href=a,eU.href),get devicePixelRatio(){return s.devicePixelRatio},get prefersReducedMotion(){return!!s.matchMedia&&(null==af&&(af=s.matchMedia("(prefers-reduced-motion: reduce)")),af.matches)}};let R;const b_={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==R){const aR=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{R=null!=d.env.API_URL_REGEX?RegExp(d.env.API_URL_REGEX):aR}catch(eZ){R=aR}}return R},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},b0={supported:!1,testSupport:function(a){!e_&&ag&&(e0?e1(a):e$=a)}};let e$,ag,e_=!1,e0=!1;function e1(a){const b=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,ag),a.isContextLost())return;b0.supported=!0}catch(c){}a.deleteTexture(b),e_=!0}s.document&&((ag=s.document.createElement("img")).onload=function(){e$&&e1(e$),e$=null,e0=!0},ag.onerror=function(){e_=!0,e$=null},ag.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const b1="NO_ACCESS_TOKEN";function b2(a){return 0===a.indexOf("mapbox:")}function e2(a){return b_.API_URL_REGEX.test(a)}const e3=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function e4(b){const a=b.match(e3);if(!a)throw Error("Unable to parse URL object");return{protocol:a[1],authority:a[2],path:a[3]||"/",params:a[4]?a[4].split("&"):[]}}function e5(a){const b=a.params.length?`?${a.params.join("&")}`:"";return`${a.protocol}://${a.authority}${a.path}${b}`}function e6(b){if(!b)return null;const a=b.split(".");if(!a||3!==a.length)return null;try{return JSON.parse(decodeURIComponent(s.atob(a[1]).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(c){return null}}class e7{constructor(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(c){const a=e6(b_.ACCESS_TOKEN);let b="";return b=a&&a.u?s.btoa(encodeURIComponent(a.u).replace(/%([0-9A-F]{2})/g,(b,a)=>String.fromCharCode(Number("0x"+a)))):b_.ACCESS_TOKEN||"",c?`mapbox.eventData.${c}:${b}`:`mapbox.eventData:${b}`}fetchEventData(){const c=eY("localStorage"),d=this.getStorageKey(),e=this.getStorageKey("uuid");if(c)try{const a=s.localStorage.getItem(d);a&&(this.eventData=JSON.parse(a));const b=s.localStorage.getItem(e);b&&(this.anonId=b)}catch(f){bY("Unable to read from LocalStorage")}}saveEventData(){const a=eY("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{s.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&s.localStorage.setItem(b,JSON.stringify(this.eventData))}catch(d){bY("Unable to write to LocalStorage")}}processRequests(a){}postEvent(d,a,h,e){if(!b_.EVENTS_URL)return;const b=e4(b_.EVENTS_URL);b.params.push(`access_token=${e||b_.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(d).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:bq,skuId:"01",userId:this.anonId},f=a?bR(c,a):c,g={url:e5(b),headers:{"Content-Type":"text/plain"},body:JSON.stringify([f])};this.pendingRequest=fj(g,a=>{this.pendingRequest=null,h(a),this.saveEventData(),this.processRequests(e)})}queueRequest(a,b){this.queue.push(a),this.processRequests(b)}}const aS=new class extends e7{constructor(a){super("appUserTurnstile"),this._customAccessToken=a}postTurnstileEvent(a,b){b_.EVENTS_URL&&b_.ACCESS_TOKEN&&Array.isArray(a)&&a.some(a=>b2(a)||e2(a))&&this.queueRequest(Date.now(),b)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const c=e6(b_.ACCESS_TOKEN),f=c?c.u:b_.ACCESS_TOKEN;let a=f!==this.eventData.tokenU;eO(this.anonId)||(this.anonId=eN(),a=!0);const b=this.queue.shift();if(this.eventData.lastSuccess){const g=new Date(this.eventData.lastSuccess),h=new Date(b),d=(b-this.eventData.lastSuccess)/864e5;a=a||d>=1||d< -1||g.getDate()!==h.getDate()}else a=!0;if(!a)return this.processRequests();this.postEvent(b,{"enabled.telemetry":!1},a=>{a||(this.eventData.lastSuccess=b,this.eventData.tokenU=f)},e)}},b3=aS.postTurnstileEvent.bind(aS),aT=new class extends e7{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(b,c,a,d){this.skuToken=c,this.errorCb=d,b_.EVENTS_URL&&(a||b_.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},a):this.errorCb(Error(b1)))}processRequests(b){if(this.pendingRequest||0===this.queue.length)return;const{id:a,timestamp:c}=this.queue.shift();a&&this.success[a]||(this.anonId||this.fetchEventData(),eO(this.anonId)||(this.anonId=eN()),this.postEvent(c,{skuToken:this.skuToken},b=>{b?this.errorCb(b):a&&(this.success[a]=!0)},b))}},b4=aT.postMapLoadEvent.bind(aT),aU=new class extends e7{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,b,f,c){if(!b_.API_URL||!b_.SESSION_PATH)return;const a=e4(b_.API_URL+b_.SESSION_PATH);a.params.push(`sku=${b||""}`),a.params.push(`access_token=${c||b_.ACCESS_TOKEN||""}`);const d={url:e5(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=fk(d,a=>{this.pendingRequest=null,f(a),this.saveEventData(),this.processRequests(c)})}getSessionAPI(b,c,a,d){this.skuToken=c,this.errorCb=d,b_.SESSION_PATH&&b_.API_URL&&(a||b_.ACCESS_TOKEN?this.queueRequest({id:b,timestamp:Date.now()},a):this.errorCb(Error(b1)))}processRequests(b){if(this.pendingRequest||0===this.queue.length)return;const{id:a,timestamp:c}=this.queue.shift();a&&this.success[a]||this.getSession(c,this.skuToken,b=>{b?this.errorCb(b):a&&(this.success[a]=!0)},b)}},b5=aU.getSessionAPI.bind(aU),e8=new Set,e9="mapbox-tiles";let fa,fb,fc=500,fd=50;function fe(){s.caches&&!fa&&(fa=s.caches.open(e9))}function ff(a){const b=a.indexOf("?");return b<0?a:a.slice(0,b)}let fg=1/0;const aV={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(aV);class fh extends Error{constructor(a,b,c){401===b&&e2(c)&&(a+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(a),this.status=b,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const b6=bZ()?()=>self.worker&&self.worker.referrer:()=>("blob:"===s.location.protocol?s.parent:s).location.href,b7=function(a,b){var c;if(!(/^file:/.test(c=a.url)||/^file:/.test(b6())&&!/^\w+:/.test(c))){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return function(a,g){var c;const e=new s.AbortController,b=new s.Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,referrer:b6(),signal:e.signal});let h=!1,i=!1;const f=(c=b.url).indexOf("sku=")>0&&e2(c);"json"===a.type&&b.headers.set("Accept","application/json");const d=(c,d,e)=>{if(i)return;if(c&&"SecurityError"!==c.message&&bY(c),d&&e)return j(d);const h=Date.now();s.fetch(b).then(b=>{if(b.ok){const c=f?b.clone():null;return j(b,c,h)}return g(new fh(b.statusText,b.status,a.url))}).catch(a=>{20!==a.code&&g(Error(a.message))})},j=(c,d,e)=>{("arrayBuffer"===a.type?c.arrayBuffer():"json"===a.type?c.json():c.text()).then(a=>{i||(d&&e&&function(e,a,c){if(fe(),!fa)return;const d={status:a.status,statusText:a.statusText,headers:new s.Headers};a.headers.forEach((a,b)=>d.headers.set(b,a));const b=eT(a.headers.get("Cache-Control")||"");b["no-store"]||(b["max-age"]&&d.headers.set("Expires",new Date(c+1e3*b["max-age"]).toUTCString()),new Date(d.headers.get("Expires")).getTime()-c<42e4||function(a,b){if(void 0===fb)try{new Response(new ReadableStream),fb=!0}catch(c){fb=!1}fb?b(a.body):a.blob().then(b)}(a,a=>{const b=new s.Response(a,d);fe(),fa&&fa.then(a=>a.put(ff(e.url),b)).catch(a=>bY(a.message))}))}(b,d,e),h=!0,g(null,a,c.headers.get("Cache-Control"),c.headers.get("Expires")))}).catch(a=>{i||g(Error(a.message))})};return f?function(b,a){if(fe(),!fa)return a(null);const c=ff(b.url);fa.then(b=>{b.match(c).then(d=>{const e=function(a){if(!a)return!1;const b=new Date(a.headers.get("Expires")||0),c=eT(a.headers.get("Cache-Control")||"");return b>Date.now()&&!c["no-cache"]}(d);b.delete(c),e&&b.put(c,d.clone()),a(null,d,e)}).catch(a)}).catch(a)}(b,d):d(null,null),{cancel(){i=!0,h||e.abort()}}}(a,b);if(bZ()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,b,void 0,!0)}return function(b,d){const a=new s.XMLHttpRequest;for(const c in a.open(b.method||"GET",b.url,!0),"arrayBuffer"===b.type&&(a.responseType="arraybuffer"),b.headers)a.setRequestHeader(c,b.headers[c]);return"json"===b.type&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===b.credentials,a.onerror=()=>{d(Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let c=a.response;if("json"===b.type)try{c=JSON.parse(a.response)}catch(e){return d(e)}d(null,c,a.getResponseHeader("Cache-Control"),a.getResponseHeader("Expires"))}else d(new fh(a.statusText,a.status,b.url))},a.send(b.body),{cancel:()=>a.abort()}}(a,b)},fi=function(a,b){return b7(bR(a,{type:"arrayBuffer"}),b)},fj=function(a,b){return b7(bR(a,{method:"POST"}),b)},fk=function(a,b){return b7(bR(a,{method:"GET"}),b)};function fl(b){const a=s.document.createElement("a");return a.href=b,a.protocol===s.document.location.protocol&&a.host===s.document.location.host}const fm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let b8,b9;b8=[],b9=0;const ca=function(a,c){if(b0.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),b9>=b_.MAX_PARALLEL_IMAGE_REQUESTS){const b={requestParameters:a,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return b8.push(b),b}b9++;let d=!1;const e=()=>{if(!d)for(d=!0,b9--;b8.length&&b9{e(),b?c(b):a&&(s.createImageBitmap?function(a,c){const b=new s.Blob([new Uint8Array(a)],{type:"image/png"});s.createImageBitmap(b).then(a=>{c(null,a)}).catch(a=>{c(Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(a,(a,b)=>c(a,b,d,f)):function(b,e){const a=new s.Image,c=s.URL;a.onload=()=>{e(null,a),c.revokeObjectURL(a.src),a.onload=null,s.requestAnimationFrame(()=>{a.src=fm})},a.onerror=()=>e(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const d=new s.Blob([new Uint8Array(b)],{type:"image/png"});a.src=b.byteLength?c.createObjectURL(d):fm}(a,(a,b)=>c(a,b,d,f)))});return{cancel(){f.cancel(),e()}}};function fn(a,c,b){b[a]&& -1!==b[a].indexOf(c)||(b[a]=b[a]||[],b[a].push(c))}function fo(b,d,a){if(a&&a[b]){const c=a[b].indexOf(d);-1!==c&&a[b].splice(c,1)}}class aW{constructor(a,b={}){bR(this,b),this.type=a}}class cb extends aW{constructor(a,b={}){super("error",bR({error:a},b))}}class S{on(a,b){return this._listeners=this._listeners||{},fn(a,b,this._listeners),this}off(a,b){return fo(a,b,this._listeners),fo(a,b,this._oneTimeListeners),this}once(b,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fn(b,a,this._oneTimeListeners),this):new Promise(a=>this.once(b,a))}fire(a,e){"string"==typeof a&&(a=new aW(a,e||{}));const b=a.type;if(this.listens(b)){a.target=this;const f=this._listeners&&this._listeners[b]?this._listeners[b].slice():[];for(const g of f)g.call(this,a);const h=this._oneTimeListeners&&this._oneTimeListeners[b]?this._oneTimeListeners[b].slice():[];for(const c of h)fo(b,c,this._oneTimeListeners),c.call(this,a);const d=this._eventedParent;d&&(bR(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),d.fire(a))}else a instanceof cb&&console.error(a.error);return this}listens(a){return!!(this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a))}setEventedParent(a,b){return this._eventedParent=a,this._eventedParentData=b,this}}var b=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');class cc{constructor(b,a,d,c){this.message=(b?`${b}: `:"")+d,c&&(this.identifier=c),null!=a&&a.__line__&&(this.line=a.__line__)}}function cd(a){const b=a.value;return b?[new cc(a.key,b,"constants have been deprecated as of v8"),]:[]}function ce(a,...d){for(const b of d)for(const c in b)a[c]=b[c];return a}function fp(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function fq(a){if(Array.isArray(a))return a.map(fq);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const b={};for(const c in a)b[c]=fq(a[c]);return b}return fp(a)}class fr extends Error{constructor(b,a){super(a),this.message=a,this.key=b}}class fs{constructor(a,b=[]){for(const[c,d]of(this.parent=a,this.bindings={},b))this.bindings[c]=d}concat(a){return new fs(this,a)}get(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw Error(`${a} not found in scope.`)}has(a){return!!this.bindings[a]|| !!this.parent&&this.parent.has(a)}}const cf={kind:"null"},f={kind:"number"},i={kind:"string"},h={kind:"boolean"},y={kind:"color"},K={kind:"object"},l={kind:"value"},cg={kind:"collator"},ch={kind:"formatted"},ci={kind:"resolvedImage"};function z(a,b){return{kind:"array",itemType:a,N:b}}function ft(a){if("array"===a.kind){const b=ft(a.itemType);return"number"==typeof a.N?`array<${b}, ${a.N}>`:"value"===a.itemType.kind?"array":`array<${b}>`}return a.kind}const fu=[cf,f,i,h,y,ch,K,z(l),ci];function fv(b,a){if("error"===a.kind)return null;if("array"===b.kind){if("array"===a.kind&&(0===a.N&&"value"===a.itemType.kind||!fv(b.itemType,a.itemType))&&("number"!=typeof b.N||b.N===a.N))return null}else{if(b.kind===a.kind)return null;if("value"===b.kind){for(const c of fu)if(!fv(c,a))return null}}return`Expected ${ft(b)} but found ${ft(a)} instead.`}function fw(b,a){return a.some(a=>a.kind===b.kind)}function fx(b,a){return a.some(a=>"null"===a?null===b:"array"===a?Array.isArray(b):"object"===a?b&&!Array.isArray(b)&&"object"==typeof b:a===typeof b)}function ah(b){var a={exports:{}};return b(a,a.exports),a.exports}var fy=ah(function(b,a){var c={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function d(a){return(a=Math.round(a))<0?0:a>255?255:a}function e(a){return d("%"===a[a.length-1]?parseFloat(a)/100*255:parseInt(a))}function f(a){var b;return(b="%"===a[a.length-1]?parseFloat(a)/100:parseFloat(a))<0?0:b>1?1:b}function g(b,c,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?b+(c-b)*a*6:2*a<1?c:3*a<2?b+(c-b)*(2/3-a)*6:b}try{a.parseCSSColor=function(q){var a,b=q.replace(/ /g,"").toLowerCase();if(b in c)return c[b].slice();if("#"===b[0])return 4===b.length?(a=parseInt(b.substr(1),16))>=0&&a<=4095?[(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,1,]:null:7===b.length&&(a=parseInt(b.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1,]:null;var j=b.indexOf("("),p=b.indexOf(")");if(-1!==j&&p+1===b.length){var r=b.substr(0,j),h=b.substr(j+1,p-(j+1)).split(","),k=1;switch(r){case"rgba":if(4!==h.length)break;k=f(h.pop());case"rgb":return 3!==h.length?null:[e(h[0]),e(h[1]),e(h[2]),k,];case"hsla":if(4!==h.length)break;k=f(h.pop());case"hsl":if(3!==h.length)break;var m=(parseFloat(h[0])%360+360)%360/360,n=f(h[1]),i=f(h[2]),l=i<=.5?i*(n+1):i+n-i*n,o=2*i-l;return[d(255*g(o,l,m+1/3)),d(255*g(o,l,m)),d(255*g(o,l,m-1/3)),k,]}}return null}}catch(h){}});class m{constructor(a,b,c,d=1){this.r=a,this.g=b,this.b=c,this.a=d}static parse(b){if(!b)return;if(b instanceof m)return b;if("string"!=typeof b)return;const a=fy.parseCSSColor(b);return a?new m(a[0]/255*a[3],a[1]/255*a[3],a[2]/255*a[3],a[3]):void 0}toString(){const[a,b,c,d]=this.toArray();return`rgba(${Math.round(a)},${Math.round(b)},${Math.round(c)},${d})`}toArray(){const{r:b,g:c,b:d,a:a}=this;return 0===a?[0,0,0,0]:[255*b/a,255*c/a,255*d/a,a,]}}m.black=new m(0,0,0,1),m.white=new m(1,1,1,1),m.transparent=new m(0,0,0,0),m.red=new m(1,0,0,1),m.blue=new m(0,0,1,1);class fz{constructor(b,a,c){this.sensitivity=b?a?"variant":"case":a?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(a,b){return this.collator.compare(a,b)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class fA{constructor(a,b,c,d,e){this.text=a.normalize?a.normalize():a,this.image=b,this.scale=c,this.fontStack=d,this.textColor=e}}class fB{constructor(a){this.sections=a}static fromString(a){return new fB([new fA(a,null,null,null,null),])}isEmpty(){return 0===this.sections.length||!this.sections.some(a=>0!==a.text.length||a.image&&0!==a.image.name.length)}static factory(a){return a instanceof fB?a:fB.fromString(a)}toString(){return 0===this.sections.length?"":this.sections.map(a=>a.text).join("")}serialize(){const b=["format"];for(const a of this.sections){if(a.image){b.push(["image",a.image.name]);continue}b.push(a.text);const c={};a.fontStack&&(c["text-font"]=["literal",a.fontStack.split(","),]),a.scale&&(c["font-scale"]=a.scale),a.textColor&&(c["text-color"]=["rgba"].concat(a.textColor.toArray())),b.push(c)}return b}}class cj{constructor(a){this.name=a.name,this.available=a.available}toString(){return this.name}static fromString(a){return a?new cj({name:a,available:!1}):null}serialize(){return["image",this.name]}}function fC(b,c,d,a){return"number"==typeof b&&b>=0&&b<=255&&"number"==typeof c&&c>=0&&c<=255&&"number"==typeof d&&d>=0&&d<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[b,c,d,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[b,c,d,a]:[b,c,d]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fD(a){if(null===a||"string"==typeof a||"boolean"==typeof a||"number"==typeof a||a instanceof m||a instanceof fz||a instanceof fB||a instanceof cj)return!0;if(Array.isArray(a)){for(const b of a)if(!fD(b))return!1;return!0}if("object"==typeof a){for(const c in a)if(!fD(a[c]))return!1;return!0}return!1}function fE(a){if(null===a)return cf;if("string"==typeof a)return i;if("boolean"==typeof a)return h;if("number"==typeof a)return f;if(a instanceof m)return y;if(a instanceof fz)return cg;if(a instanceof fB)return ch;if(a instanceof cj)return ci;if(Array.isArray(a)){const d=a.length;let b;for(const e of a){const c=fE(e);if(b){if(b===c)continue;b=l;break}b=c}return z(b||l,d)}return K}function fF(a){const b=typeof a;return null===a?"":"string"===b||"number"===b||"boolean"===b?String(a):a instanceof m||a instanceof fB||a instanceof cj?a.toString():JSON.stringify(a)}class ck{constructor(a,b){this.type=a,this.value=b}static parse(b,d){if(2!==b.length)return d.error(`'literal' expression requires exactly one argument, but found ${b.length-1} instead.`);if(!fD(b[1]))return d.error("invalid value");const e=b[1];let c=fE(e);const a=d.expectedType;return"array"===c.kind&&0===c.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(c=a),new ck(c,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof m?["rgba"].concat(this.value.toArray()):this.value instanceof fB?this.value.serialize():this.value}}class fG{constructor(a){this.name="ExpressionEvaluationError",this.message=a}toJSON(){return this.message}}const fH={string:i,number:f,boolean:h,object:K};class L{constructor(a,b){this.type=a,this.args=b}static parse(a,c){if(a.length<2)return c.error("Expected at least one argument.");let e,b=1;const g=a[0];if("array"===g){let f,h;if(a.length>2){const d=a[1];if("string"!=typeof d||!(d in fH)||"object"===d)return c.error('The item type argument of "array" must be one of string, number, boolean',1);f=fH[d],b++}else f=l;if(a.length>3){if(null!==a[2]&&("number"!=typeof a[2]||a[2]<0||a[2]!==Math.floor(a[2])))return c.error('The length argument to "array" must be a positive integer literal',2);h=a[2],b++}e=z(f,h)}else e=fH[g];const i=[];for(;ba.outputDefined())}serialize(){const a=this.type,c=[a.kind];if("array"===a.kind){const b=a.itemType;if("string"===b.kind||"number"===b.kind||"boolean"===b.kind){c.push(b.kind);const d=a.N;("number"==typeof d||this.args.length>1)&&c.push(d)}}return c.concat(this.args.map(a=>a.serialize()))}}class cl{constructor(a){this.type=ch,this.sections=a}static parse(c,b){if(c.length<2)return b.error("Expected at least one argument.");const m=c[1];if(!Array.isArray(m)&&"object"==typeof m)return b.error("First argument must be an image or text section.");const d=[];let h=!1;for(let e=1;e<=c.length-1;++e){const a=c[e];if(h&&"object"==typeof a&&!Array.isArray(a)){h=!1;let n=null;if(a["font-scale"]&&!(n=b.parse(a["font-scale"],1,f)))return null;let o=null;if(a["text-font"]&&!(o=b.parse(a["text-font"],1,z(i))))return null;let p=null;if(a["text-color"]&&!(p=b.parse(a["text-color"],1,y)))return null;const j=d[d.length-1];j.scale=n,j.font=o,j.textColor=p}else{const k=b.parse(c[e],1,l);if(!k)return null;const g=k.type.kind;if("string"!==g&&"value"!==g&&"null"!==g&&"resolvedImage"!==g)return b.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,d.push({content:k,scale:null,font:null,textColor:null})}}return new cl(d)}evaluate(a){return new fB(this.sections.map(b=>{const c=b.content.evaluate(a);return fE(c)===ci?new fA("",c,null,null,null):new fA(fF(c),null,b.scale?b.scale.evaluate(a):null,b.font?b.font.evaluate(a).join(","):null,b.textColor?b.textColor.evaluate(a):null)}))}eachChild(b){for(const a of this.sections)b(a.content),a.scale&&b(a.scale),a.font&&b(a.font),a.textColor&&b(a.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const a of this.sections){c.push(a.content.serialize());const b={};a.scale&&(b["font-scale"]=a.scale.serialize()),a.font&&(b["text-font"]=a.font.serialize()),a.textColor&&(b["text-color"]=a.textColor.serialize()),c.push(b)}return c}}class cm{constructor(a){this.type=ci,this.input=a}static parse(b,a){if(2!==b.length)return a.error("Expected two arguments.");const c=a.parse(b[1],1,i);return c?new cm(c):a.error("No image name provided.")}evaluate(a){const c=this.input.evaluate(a),b=cj.fromString(c);return b&&a.availableImages&&(b.available=a.availableImages.indexOf(c)> -1),b}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const fI={"to-boolean":h,"to-color":y,"to-number":f,"to-string":i};class T{constructor(a,b){this.type=a,this.args=b}static parse(a,c){if(a.length<2)return c.error("Expected at least one argument.");const d=a[0];if(("to-boolean"===d||"to-string"===d)&&2!==a.length)return c.error("Expected one argument.");const g=fI[d],e=[];for(let b=1;b4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:fC(a[0],a[1],a[2],a[3])))return new m(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new fG(c||`Could not parse color from value '${"string"==typeof a?a:String(JSON.stringify(a))}'`)}if("number"===this.type.kind){let d=null;for(const h of this.args){if(null===(d=h.evaluate(b)))return 0;const f=Number(d);if(!isNaN(f))return f}throw new fG(`Could not convert ${JSON.stringify(d)} to number.`)}return"formatted"===this.type.kind?fB.fromString(fF(this.args[0].evaluate(b))):"resolvedImage"===this.type.kind?cj.fromString(fF(this.args[0].evaluate(b))):fF(this.args[0].evaluate(b))}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){if("formatted"===this.type.kind)return new cl([{content:this.args[0],scale:null,font:null,textColor:null},]).serialize();if("resolvedImage"===this.type.kind)return new cm(this.args[0]).serialize();const a=[`to-${this.type.kind}`];return this.eachChild(b=>{a.push(b.serialize())}),a}}const fJ=["Unknown","Point","LineString","Polygon",];class fK{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?fJ[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const a=this.featureDistanceData.center,b=this.featureDistanceData.scale,{x:c,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*b-a[0])+this.featureDistanceData.bearing[1]*(d*b-a[1])}return 0}parseColor(a){let b=this._parseColorCache[a];return b||(b=this._parseColorCache[a]=m.parse(a)),b}}class aX{constructor(a,b,c,d){this.name=a,this.type=b,this._evaluate=c,this.args=d}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(a=>a.serialize()))}static parse(f,c){const j=f[0],b=aX.definitions[j];if(!b)return c.error(`Unknown expression "${j}". If you wanted a literal array, use ["literal", [...]].`,0);const q=Array.isArray(b)?b[0]:b.type,m=Array.isArray(b)?[[b[1],b[2]]]:b.overloads,h=m.filter(([a])=>!Array.isArray(a)||a.length===f.length-1);let e=null;for(const[a,r]of h){e=new f1(c.registry,c.path,null,c.scope);const d=[];let n=!1;for(let i=1;i{var a;return Array.isArray(a=b)?`(${a.map(ft).join(", ")})`:`(${ft(a.type)}...)`}).join(" | "),k=[];for(let l=1;l=b[2]||a[1]<=b[1]||a[3]>=b[3])}function fN(a,c){const d=(180+a[0])/360,e=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,b=Math.pow(2,c.z);return[Math.round(d*b*8192),Math.round(e*b*8192),]}function fO(a,b,c){const d=a[0]-b[0],e=a[1]-b[1],f=a[0]-c[0],g=a[1]-c[1];return d*g-f*e==0&&d*f<=0&&e*g<=0}function fP(h,i){var d,b,e;let f=!1;for(let g=0,j=i.length;g(d=h)[1]!=(e=c[a+1])[1]>d[1]&&d[0]<(e[0]-b[0])*(d[1]-b[1])/(e[1]-b[1])+b[0]&&(f=!f)}}return f}function fQ(c,b){for(let a=0;a0&&h<0||g<0&&h>0}function fS(i,j,k){var a,b,c,d,g,h;for(const f of k)for(let e=0;eb[2]){const d=.5*c;let e=a[0]-b[0]>d?-c:b[0]-a[0]>d?c:0;0===e&&(e=a[0]-b[2]>d?-c:b[2]-a[0]>d?c:0),a[0]+=e}fL(f,a)}function fY(f,g,h,a){const i=8192*Math.pow(2,a.z),b=[8192*a.x,8192*a.y],c=[];for(const j of f)for(const d of j){const e=[d.x+b[0],d.y+b[1]];fX(e,g,h,i),c.push(e)}return c}function fZ(j,a,k,c){var b;const e=8192*Math.pow(2,c.z),f=[8192*c.x,8192*c.y],d=[];for(const l of j){const g=[];for(const h of l){const i=[h.x+f[0],h.y+f[1]];fL(a,i),g.push(i)}d.push(g)}if(a[2]-a[0]<=e/2)for(const m of((b=a)[0]=b[1]=1/0,b[2]=b[3]=-1/0,d))for(const n of m)fX(n,a,k,e);return d}class co{constructor(a,b){this.type=h,this.geojson=a,this.geometries=b}static parse(b,d){if(2!==b.length)return d.error(`'within' expression requires exactly one argument, but found ${b.length-1} instead.`);if(fD(b[1])){const a=b[1];if("FeatureCollection"===a.type)for(let c=0;c{b&&!f$(a)&&(b=!1)}),b}function f_(a){if(a instanceof aX&&"feature-state"===a.name)return!1;let b=!0;return a.eachChild(a=>{b&&!f_(a)&&(b=!1)}),b}function f0(a,b){if(a instanceof aX&&b.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(a=>{c&&!f0(a,b)&&(c=!1)}),c}class cp{constructor(b,a){this.type=a.type,this.name=b,this.boundExpression=a}static parse(c,b){if(2!==c.length||"string"!=typeof c[1])return b.error("'var' expression requires exactly one string literal argument.");const a=c[1];return b.scope.has(a)?new cp(a,b.scope.get(a)):b.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class f1{constructor(b,a=[],c,d=new fs,e=[]){this.registry=b,this.path=a,this.key=a.map(a=>`[${a}]`).join(""),this.scope=d,this.errors=e,this.expectedType=c}parse(a,b,d,e,c={}){return b?this.concat(b,d,e)._parse(a,c):this._parse(a,c)}_parse(a,f){function g(a,b,c){return"assert"===c?new L(b,[a]):"coerce"===c?new T(b,[a]):a}if(null!==a&&"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a||(a=["literal",a]),Array.isArray(a)){if(0===a.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=a[0];if("string"!=typeof d)return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[d];if(h){let b=h.parse(a,this);if(!b)return null;if(this.expectedType){const c=this.expectedType,e=b.type;if("string"!==c.kind&&"number"!==c.kind&&"boolean"!==c.kind&&"object"!==c.kind&&"array"!==c.kind||"value"!==e.kind){if("color"!==c.kind&&"formatted"!==c.kind&&"resolvedImage"!==c.kind||"value"!==e.kind&&"string"!==e.kind){if(this.checkSubtype(c,e))return null}else b=g(b,c,f.typeAnnotation||"coerce")}else b=g(b,c,f.typeAnnotation||"assert")}if(!(b instanceof ck)&&"resolvedImage"!==b.type.kind&&f2(b)){const i=new fK;try{b=new ck(b.type,b.evaluate(i))}catch(j){return this.error(j.message),null}}return b}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===a?"'undefined' value invalid. Use null instead.":"object"==typeof a?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,c,b){const d="number"==typeof a?this.path.concat(a):this.path,e=b?this.scope.concat(b):this.scope;return new f1(this.registry,d,c||null,e,this.errors)}error(a,...b){const c=`${this.key}${b.map(a=>`[${a}]`).join("")}`;this.errors.push(new fr(c,a))}checkSubtype(b,c){const a=fv(b,c);return a&&this.error(a),a}}function f2(a){if(a instanceof cp)return f2(a.boundExpression);if(a instanceof aX&&"error"===a.name||a instanceof cn||a instanceof co)return!1;const c=a instanceof T||a instanceof L;let b=!0;return a.eachChild(a=>{b=c?b&&f2(a):b&&a instanceof ck}),!!b&&f$(a)&&f0(a,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center",])}function f3(b,c){const g=b.length-1;let d,h,e=0,f=g,a=0;for(;e<=f;)if(d=b[a=Math.floor((e+f)/2)],h=b[a+1],d<=c){if(a===g||cc))throw new fG("Input is not a number.");f=a-1}return 0}class cq{constructor(a,b,c){for(const[d,e]of(this.type=a,this.input=b,this.labels=[],this.outputs=[],c))this.labels.push(d),this.outputs.push(e)}static parse(b,a){if(b.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${b.length-1}.`);if((b.length-1)%2!=0)return a.error("Expected an even number of arguments.");const i=a.parse(b[1],1,f);if(!i)return null;const d=[];let e=null;a.expectedType&&"value"!==a.expectedType.kind&&(e=a.expectedType);for(let c=1;c=g)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',j);const h=a.parse(k,l,e);if(!h)return null;e=e||h.type,d.push([g,h])}return new cq(e,i,d)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const e=b.length;return d>=b[e-1]?c[e-1].evaluate(a):c[f3(b,d)].evaluate(a)}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){const b=["step",this.input.serialize()];for(let a=0;a0&&b.push(this.labels[a]),b.push(this.outputs[a].serialize());return b}}function aY(b,c,a){return b*(1-a)+c*a}var f4=Object.freeze({__proto__:null,number:aY,color:function(a,b,c){return new m(aY(a.r,b.r,c),aY(a.g,b.g,c),aY(a.b,b.b,c),aY(a.a,b.a,c))},array:function(a,b,c){return a.map((a,d)=>aY(a,b[d],c))}});const f5=4/29,aZ=6/29,f6=3*aZ*aZ,f7=Math.PI/180,f8=180/Math.PI;function f9(a){return a>.008856451679035631?Math.pow(a,1/3):a/f6+f5}function ga(a){return a>aZ?a*a*a:f6*(a-f5)}function gb(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function gc(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function cr(a){const b=gc(a.r),c=gc(a.g),d=gc(a.b),f=f9((.4124564*b+.3575761*c+.1804375*d)/.95047),e=f9((.2126729*b+.7151522*c+.072175*d)/1);return{l:116*e-16,a:500*(f-e),b:200*(e-f9((.0193339*b+.119192*c+.9503041*d)/1.08883)),alpha:a.a}}function cs(b){let a=(b.l+16)/116,c=isNaN(b.a)?a:a+b.a/500,d=isNaN(b.b)?a:a-b.b/200;return a=1*ga(a),c=.95047*ga(c),d=1.08883*ga(d),new m(gb(3.2404542*c-1.5371385*a-.4985314*d),gb(-0.969266*c+1.8760108*a+.041556*d),gb(.0556434*c-.2040259*a+1.0572252*d),b.alpha)}const ct={forward:cr,reverse:cs,interpolate:function(a,b,c){return{l:aY(a.l,b.l,c),a:aY(a.a,b.a,c),b:aY(a.b,b.b,c),alpha:aY(a.alpha,b.alpha,c)}}},cu={forward:function(d){const{l:e,a:a,b:b}=cr(d),c=Math.atan2(b,a)*f8;return{h:c<0?c+360:c,c:Math.sqrt(a*a+b*b),l:e,alpha:d.a}},reverse:function(a){const b=a.h*f7,c=a.c;return cs({l:a.l,a:Math.cos(b)*c,b:Math.sin(b)*c,alpha:a.alpha})},interpolate:function(a,b,c){return{h:function(b,c,d){const a=c-b;return b+d*(a>180||a< -180?a-360*Math.round(a/360):a)}(a.h,b.h,c),c:aY(a.c,b.c,c),l:aY(a.l,b.l,c),alpha:aY(a.alpha,b.alpha,c)}}};var gd=Object.freeze({__proto__:null,lab:ct,hcl:cu});class ai{constructor(a,b,c,d,e){for(const[f,g]of(this.type=a,this.operator=b,this.interpolation=c,this.input=d,this.labels=[],this.outputs=[],e))this.labels.push(f),this.outputs.push(g)}static interpolationFactor(a,d,e,f){let b=0;if("exponential"===a.name)b=ge(d,a.base,e,f);else if("linear"===a.name)b=ge(d,1,e,f);else if("cubic-bezier"===a.name){const c=a.controlPoints;b=new eG(c[0],c[1],c[2],c[3]).solve(ge(d,1,e,f))}return b}static parse(g,a){let[h,b,i,...j]=g;if(!Array.isArray(b)||0===b.length)return a.error("Expected an interpolation type expression.",1);if("linear"===b[0])b={name:"linear"};else if("exponential"===b[0]){const n=b[1];if("number"!=typeof n)return a.error("Exponential interpolation requires a numeric base.",1,1);b={name:"exponential",base:n}}else{if("cubic-bezier"!==b[0])return a.error(`Unknown interpolation type ${String(b[0])}`,1,0);{const k=b.slice(1);if(4!==k.length||k.some(a=>"number"!=typeof a||a<0||a>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);b={name:"cubic-bezier",controlPoints:k}}}if(g.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${g.length-1}.`);if((g.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(!(i=a.parse(i,2,f)))return null;const e=[];let c=null;"interpolate-hcl"===h||"interpolate-lab"===h?c=y:a.expectedType&&"value"!==a.expectedType.kind&&(c=a.expectedType);for(let d=0;d=l)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const m=a.parse(p,q,c);if(!m)return null;c=c||m.type,e.push([l,m])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new ai(c,h,b,i,e):a.error(`Type ${ft(c)} is not interpolatable.`)}evaluate(b){const a=this.labels,c=this.outputs;if(1===a.length)return c[0].evaluate(b);const d=this.input.evaluate(b);if(d<=a[0])return c[0].evaluate(b);const i=a.length;if(d>=a[i-1])return c[i-1].evaluate(b);const e=f3(a,d),f=ai.interpolationFactor(this.interpolation,d,a[e],a[e+1]),g=c[e].evaluate(b),h=c[e+1].evaluate(b);return"interpolate"===this.operator?f4[this.type.kind.toLowerCase()](g,h,f):"interpolate-hcl"===this.operator?cu.reverse(cu.interpolate(cu.forward(g),cu.forward(h),f)):ct.reverse(ct.interpolate(ct.forward(g),ct.forward(h),f))}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){let b;b="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base,]:["cubic-bezier"].concat(this.interpolation.controlPoints);const c=[this.operator,b,this.input.serialize(),];for(let a=0;afv(b,a.type));return new cv(h?l:a,c)}evaluate(d){let b,a=null,c=0;for(const e of this.args){if(c++,(a=e.evaluate(d))&&a instanceof cj&&!a.available&&(b||(b=a),a=null,c===this.args.length))return b;if(null!==a)break}return a}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){const a=["coalesce"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cw{constructor(b,a){this.type=a.type,this.bindings=[].concat(b),this.result=a}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(const b of this.bindings)a(b[1]);a(this.result)}static parse(a,c){if(a.length<4)return c.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);const e=[];for(let b=1;b=b.length)throw new fG(`Array index out of bounds: ${a} > ${b.length-1}.`);if(a!==Math.floor(a))throw new fG(`Array index must be an integer, but found ${a} instead.`);return b[a]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize(),]}}class cy{constructor(a,b){this.type=h,this.needle=a,this.haystack=b}static parse(a,b){if(3!==a.length)return b.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,l),d=b.parse(a[2],2,l);return c&&d?fw(c.type,[h,i,f,cf,l])?new cy(c,d):b.error(`Expected first argument to be of type boolean, string, number or null, but found ${ft(c.type)} instead`):null}evaluate(c){const b=this.needle.evaluate(c),a=this.haystack.evaluate(c);if(!a)return!1;if(!fx(b,["boolean","string","number","null",]))throw new fG(`Expected first argument to be of type boolean, string, number or null, but found ${ft(fE(b))} instead.`);if(!fx(a,["string","array"]))throw new fG(`Expected second argument to be of type array or string, but found ${ft(fE(a))} instead.`);return a.indexOf(b)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize(),]}}class cz{constructor(a,b,c){this.type=f,this.needle=a,this.haystack=b,this.fromIndex=c}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,l),d=b.parse(a[2],2,l);if(!c||!d)return null;if(!fw(c.type,[h,i,f,cf,l]))return b.error(`Expected first argument to be of type boolean, string, number or null, but found ${ft(c.type)} instead`);if(4===a.length){const e=b.parse(a[3],3,f);return e?new cz(c,d,e):null}return new cz(c,d)}evaluate(c){const a=this.needle.evaluate(c),b=this.haystack.evaluate(c);if(!fx(a,["boolean","string","number","null",]))throw new fG(`Expected first argument to be of type boolean, string, number or null, but found ${ft(fE(a))} instead.`);if(!fx(b,["string","array"]))throw new fG(`Expected second argument to be of type array or string, but found ${ft(fE(b))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(c);return b.indexOf(a,d)}return b.indexOf(a)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&& void 0!==this.fromIndex){const a=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),a,]}return["index-of",this.needle.serialize(),this.haystack.serialize(),]}}class cA{constructor(a,b,c,d,e,f){this.inputType=a,this.type=b,this.input=c,this.cases=d,this.outputs=e,this.otherwise=f}static parse(b,c){if(b.length<5)return c.error(`Expected at least 4 arguments, but found only ${b.length-1}.`);if(b.length%2!=1)return c.error("Expected an even number of arguments.");let g,d;c.expectedType&&"value"!==c.expectedType.kind&&(d=c.expectedType);const j={},k=[];for(let e=2;eNumber.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof a&&Math.floor(a)!==a)return f.error("Numeric branch labels must be integer values.");if(g){if(f.checkSubtype(g,fE(a)))return null}else g=fE(a);if(void 0!==j[String(a)])return f.error("Branch labels must be unique.");j[String(a)]=k.length}const m=c.parse(o,e,d);if(!m)return null;d=d||m.type,k.push(m)}const i=c.parse(b[1],1,l);if(!i)return null;const n=c.parse(b[b.length-1],b.length-1,d);return n?"value"!==i.type.kind&&c.concat(1).checkSubtype(g,i.type)?null:new cA(g,d,i,j,k,n):null}evaluate(a){const b=this.input.evaluate(a);return(fE(b)===this.inputType&&this.outputs[this.cases[b]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}serialize(){const b=["match",this.input.serialize()],h=Object.keys(this.cases).sort(),c=[],e={};for(const a of h){const f=e[this.cases[a]];void 0===f?(e[this.cases[a]]=c.length,c.push([this.cases[a],[a]])):c[f][1].push(a)}const g=a=>"number"===this.inputType.kind?Number(a):a;for(const[i,d]of c)b.push(1===d.length?g(d[0]):d.map(g)),b.push(this.outputs[i].serialize());return b.push(this.otherwise.serialize()),b}}class cB{constructor(a,b,c){this.type=a,this.branches=b,this.otherwise=c}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return b.error("Expected an odd number of arguments.");let c;b.expectedType&&"value"!==b.expectedType.kind&&(c=b.expectedType);const f=[];for(let d=1;da.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["case"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cC{constructor(a,b,c,d){this.type=a,this.input=b,this.beginIndex=c,this.endIndex=d}static parse(a,c){if(a.length<=2||a.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const b=c.parse(a[1],1,l),d=c.parse(a[2],2,f);if(!b||!d)return null;if(!fw(b.type,[z(l),i,l]))return c.error(`Expected first argument to be of type array or string, but found ${ft(b.type)} instead`);if(4===a.length){const e=c.parse(a[3],3,f);return e?new cC(b.type,b,d,e):null}return new cC(b.type,b,d)}evaluate(b){const a=this.input.evaluate(b),c=this.beginIndex.evaluate(b);if(!fx(a,["string","array"]))throw new fG(`Expected first argument to be of type array or string, but found ${ft(fE(a))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(b);return a.slice(c,d)}return a.slice(c)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&& void 0!==this.endIndex){const a=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),a,]}return["slice",this.input.serialize(),this.beginIndex.serialize(),]}}function gf(b,a){return"=="===b||"!="===b?"boolean"===a.kind||"string"===a.kind||"number"===a.kind||"null"===a.kind||"value"===a.kind:"string"===a.kind||"number"===a.kind||"value"===a.kind}function cD(d,a,b,c){return 0===c.compare(a,b)}function A(a,b,c){const d="=="!==a&&"!="!==a;return class e{constructor(a,b,c){this.type=h,this.lhs=a,this.rhs=b,this.collator=c,this.hasUntypedArgument="value"===a.type.kind||"value"===b.type.kind}static parse(f,c){if(3!==f.length&&4!==f.length)return c.error("Expected two or three arguments.");const g=f[0];let a=c.parse(f[1],1,l);if(!a)return null;if(!gf(g,a.type))return c.concat(1).error(`"${g}" comparisons are not supported for type '${ft(a.type)}'.`);let b=c.parse(f[2],2,l);if(!b)return null;if(!gf(g,b.type))return c.concat(2).error(`"${g}" comparisons are not supported for type '${ft(b.type)}'.`);if(a.type.kind!==b.type.kind&&"value"!==a.type.kind&&"value"!==b.type.kind)return c.error(`Cannot compare types '${ft(a.type)}' and '${ft(b.type)}'.`);d&&("value"===a.type.kind&&"value"!==b.type.kind?a=new L(b.type,[a]):"value"!==a.type.kind&&"value"===b.type.kind&&(b=new L(a.type,[b])));let h=null;if(4===f.length){if("string"!==a.type.kind&&"string"!==b.type.kind&&"value"!==a.type.kind&&"value"!==b.type.kind)return c.error("Cannot use collator to compare non-string types.");if(!(h=c.parse(f[3],3,cg)))return null}return new e(a,b,h)}evaluate(e){const f=this.lhs.evaluate(e),g=this.rhs.evaluate(e);if(d&&this.hasUntypedArgument){const h=fE(f),i=fE(g);if(h.kind!==i.kind||"string"!==h.kind&&"number"!==h.kind)throw new fG(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${h.kind}, ${i.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const j=fE(f),k=fE(g);if("string"!==j.kind||"string"!==k.kind)return b(e,f,g)}return this.collator?c(e,f,g,this.collator.evaluate(e)):b(e,f,g)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}serialize(){const b=[a];return this.eachChild(a=>{b.push(a.serialize())}),b}}}const cE=A("==",function(c,a,b){return a===b},cD),cF=A("!=",function(c,a,b){return a!==b},function(d,a,b,c){return!cD(0,a,b,c)}),cG=A("<",function(c,a,b){return ac.compare(a,b)}),cH=A(">",function(c,a,b){return a>b},function(d,a,b,c){return c.compare(a,b)>0}),cI=A("<=",function(c,a,b){return a<=b},function(d,a,b,c){return 0>=c.compare(a,b)}),cJ=A(">=",function(c,a,b){return a>=b},function(d,a,b,c){return c.compare(a,b)>=0});class cK{constructor(a,b,c,d,e){this.type=i,this.number=a,this.locale=b,this.currency=c,this.minFractionDigits=d,this.maxFractionDigits=e}static parse(c,b){if(3!==c.length)return b.error("Expected two arguments.");const d=b.parse(c[1],1,f);if(!d)return null;const a=c[2];if("object"!=typeof a||Array.isArray(a))return b.error("NumberFormat options argument must be an object.");let e=null;if(a.locale&&!(e=b.parse(a.locale,1,i)))return null;let g=null;if(a.currency&&!(g=b.parse(a.currency,1,i)))return null;let h=null;if(a["min-fraction-digits"]&&!(h=b.parse(a["min-fraction-digits"],1,f)))return null;let j=null;return!a["max-fraction-digits"]||(j=b.parse(a["max-fraction-digits"],1,f))?new cK(d,e,g,h,j):null}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const a={};return this.locale&&(a.locale=this.locale.serialize()),this.currency&&(a.currency=this.currency.serialize()),this.minFractionDigits&&(a["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(a["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),a,]}}class cL{constructor(a){this.type=f,this.input=a}static parse(b,c){if(2!==b.length)return c.error(`Expected 1 argument, but found ${b.length-1} instead.`);const a=c.parse(b[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?c.error(`Expected argument of type string or array, but found ${ft(a.type)} instead.`):new cL(a):null}evaluate(b){const a=this.input.evaluate(b);if("string"==typeof a||Array.isArray(a))return a.length;throw new fG(`Expected value to be of type string or array, but found ${ft(fE(a))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){const a=["length"];return this.eachChild(b=>{a.push(b.serialize())}),a}}const U={"==":cE,"!=":cF,">":cH,"<":cG,">=":cJ,"<=":cI,array:L,at:cx,boolean:L,case:cB,coalesce:cv,collator:cn,format:cl,image:cm,in:cy,"index-of":cz,interpolate:ai,"interpolate-hcl":ai,"interpolate-lab":ai,length:cL,let:cw,literal:ck,match:cA,number:L,"number-format":cK,object:L,slice:cC,step:cq,string:L,"to-boolean":T,"to-color":T,"to-number":T,"to-string":T,var:cp,within:co};function a$(b,[c,d,e,f]){c=c.evaluate(b),d=d.evaluate(b),e=e.evaluate(b);const a=f?f.evaluate(b):1,g=fC(c,d,e,a);if(g)throw new fG(g);return new m(c/255*a,d/255*a,e/255*a,a)}function gg(b,c){const a=c[b];return void 0===a?null:a}function x(a){return{type:a}}function gh(a){return{result:"success",value:a}}function gi(a){return{result:"error",value:a}}function gj(a){return"data-driven"===a["property-type"]||"cross-faded-data-driven"===a["property-type"]}function gk(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")> -1}function gl(a){return!!a.expression&&a.expression.interpolated}function gm(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":null===a?"null":typeof a}function gn(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function go(a){return a}function gp(a,e){const r="color"===e.type,g=a.stops&&"object"==typeof a.stops[0][0],s=g||!(g|| void 0!==a.property),b=a.type||(gl(e)?"exponential":"interval");if(r&&((a=ce({},a)).stops&&(a.stops=a.stops.map(a=>[a[0],m.parse(a[1]),])),a.default=m.parse(a.default?a.default:e.default)),a.colorSpace&&"rgb"!==a.colorSpace&&!gd[a.colorSpace])throw Error(`Unknown color space: ${a.colorSpace}`);let f,j,t;if("exponential"===b)f=gt;else if("interval"===b)f=gs;else if("categorical"===b){for(const k of(f=gr,j=Object.create(null),a.stops))j[k[0]]=k[1];t=typeof a.stops[0][0]}else{if("identity"!==b)throw Error(`Unknown function type "${b}"`);f=gu}if(g){const c={},l=[];for(let h=0;ha[0]),evaluate:({zoom:b},c)=>gt({stops:n,base:a.base},e,b).evaluate(b,c)}}if(s){const q="exponential"===b?{name:"exponential",base:void 0!==a.base?a.base:1}:null;return{kind:"camera",interpolationType:q,interpolationFactor:ai.interpolationFactor.bind(void 0,q),zoomStops:a.stops.map(a=>a[0]),evaluate:({zoom:b})=>f(a,e,b,j,t)}}return{kind:"source",evaluate(d,b){const c=b&&b.properties?b.properties[a.property]:void 0;return void 0===c?gq(a.default,e.default):f(a,e,c,j,t)}}}function gq(a,b,c){return void 0!==a?a:void 0!==b?b:void 0!==c?c:void 0}function gr(b,c,a,d,e){return gq(typeof a===e?d[a]:void 0,b.default,c.default)}function gs(a,d,b){if("number"!==gm(b))return gq(a.default,d.default);const c=a.stops.length;if(1===c||b<=a.stops[0][0])return a.stops[0][1];if(b>=a.stops[c-1][0])return a.stops[c-1][1];const e=f3(a.stops.map(a=>a[0]),b);return a.stops[e][1]}function gt(a,e,b){const h=void 0!==a.base?a.base:1;if("number"!==gm(b))return gq(a.default,e.default);const d=a.stops.length;if(1===d||b<=a.stops[0][0])return a.stops[0][1];if(b>=a.stops[d-1][0])return a.stops[d-1][1];const c=f3(a.stops.map(a=>a[0]),b),i=function(e,a,c,f){const b=f-c,d=e-c;return 0===b?0:1===a?d/b:(Math.pow(a,d)-1)/(Math.pow(a,b)-1)}(b,h,a.stops[c][0],a.stops[c+1][0]),f=a.stops[c][1],j=a.stops[c+1][1];let g=f4[e.type]||go;if(a.colorSpace&&"rgb"!==a.colorSpace){const k=gd[a.colorSpace];g=(a,b)=>k.reverse(k.interpolate(k.forward(a),k.forward(b),i))}return"function"==typeof f.evaluate?{evaluate(...a){const b=f.evaluate.apply(void 0,a),c=j.evaluate.apply(void 0,a);if(void 0!==b&& void 0!==c)return g(b,c,i)}}:g(f,j,i)}function gu(c,b,a){return"color"===b.type?a=m.parse(a):"formatted"===b.type?a=fB.fromString(a.toString()):"resolvedImage"===b.type?a=cj.fromString(a.toString()):gm(a)===b.type||"enum"===b.type&&b.values[a]||(a=void 0),gq(a,c.default,b.default)}aX.register(U,{error:[{kind:"error"},[i],(a,[b])=>{throw new fG(b.evaluate(a))},],typeof:[i,[l],(a,[b])=>ft(fE(b.evaluate(a))),],"to-rgba":[z(f,4),[y],(a,[b])=>b.evaluate(a).toArray(),],rgb:[y,[f,f,f],a$],rgba:[y,[f,f,f,f],a$],has:{type:h,overloads:[[[i],(a,[d])=>{var b,c;return b=d.evaluate(a),c=a.properties(),b in c},],[[i,K],(a,[b,c])=>b.evaluate(a) in c.evaluate(a),],]},get:{type:l,overloads:[[[i],(a,[b])=>gg(b.evaluate(a),a.properties()),],[[i,K],(a,[b,c])=>gg(b.evaluate(a),c.evaluate(a)),],]},"feature-state":[l,[i],(a,[b])=>gg(b.evaluate(a),a.featureState||{}),],properties:[K,[],a=>a.properties()],"geometry-type":[i,[],a=>a.geometryType()],id:[l,[],a=>a.id()],zoom:[f,[],a=>a.globals.zoom],pitch:[f,[],a=>a.globals.pitch||0],"distance-from-center":[f,[],a=>a.distanceFromCenter(),],"heatmap-density":[f,[],a=>a.globals.heatmapDensity||0,],"line-progress":[f,[],a=>a.globals.lineProgress||0,],"sky-radial-progress":[f,[],a=>a.globals.skyRadialProgress||0,],accumulated:[l,[],a=>void 0===a.globals.accumulated?null:a.globals.accumulated,],"+":[f,x(f),(b,c)=>{let a=0;for(const d of c)a+=d.evaluate(b);return a},],"*":[f,x(f),(b,c)=>{let a=1;for(const d of c)a*=d.evaluate(b);return a},],"-":{type:f,overloads:[[[f,f],(a,[b,c])=>b.evaluate(a)-c.evaluate(a),],[[f],(a,[b])=>-b.evaluate(a)],]},"/":[f,[f,f],(a,[b,c])=>b.evaluate(a)/c.evaluate(a),],"%":[f,[f,f],(a,[b,c])=>b.evaluate(a)%c.evaluate(a),],ln2:[f,[],()=>Math.LN2],pi:[f,[],()=>Math.PI],e:[f,[],()=>Math.E],"^":[f,[f,f],(a,[b,c])=>Math.pow(b.evaluate(a),c.evaluate(a)),],sqrt:[f,[f],(a,[b])=>Math.sqrt(b.evaluate(a)),],log10:[f,[f],(a,[b])=>Math.log(b.evaluate(a))/Math.LN10,],ln:[f,[f],(a,[b])=>Math.log(b.evaluate(a))],log2:[f,[f],(a,[b])=>Math.log(b.evaluate(a))/Math.LN2,],sin:[f,[f],(a,[b])=>Math.sin(b.evaluate(a)),],cos:[f,[f],(a,[b])=>Math.cos(b.evaluate(a)),],tan:[f,[f],(a,[b])=>Math.tan(b.evaluate(a)),],asin:[f,[f],(a,[b])=>Math.asin(b.evaluate(a)),],acos:[f,[f],(a,[b])=>Math.acos(b.evaluate(a)),],atan:[f,[f],(a,[b])=>Math.atan(b.evaluate(a)),],min:[f,x(f),(b,a)=>Math.min(...a.map(a=>a.evaluate(b))),],max:[f,x(f),(b,a)=>Math.max(...a.map(a=>a.evaluate(b))),],abs:[f,[f],(a,[b])=>Math.abs(b.evaluate(a)),],round:[f,[f],(b,[c])=>{const a=c.evaluate(b);return a<0?-Math.round(-a):Math.round(a)},],floor:[f,[f],(a,[b])=>Math.floor(b.evaluate(a)),],ceil:[f,[f],(a,[b])=>Math.ceil(b.evaluate(a)),],"filter-==":[h,[i,l],(a,[b,c])=>a.properties()[b.value]===c.value,],"filter-id-==":[h,[l],(a,[b])=>a.id()===b.value,],"filter-type-==":[h,[i],(a,[b])=>a.geometryType()===b.value,],"filter-<":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a{const a=c.id(),b=d.value;return typeof a==typeof b&&a":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a>b},],"filter-id->":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a>b},],"filter-<=":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a<=b},],"filter-id-<=":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a<=b},],"filter->=":[h,[i,l],(c,[d,e])=>{const a=c.properties()[d.value],b=e.value;return typeof a==typeof b&&a>=b},],"filter-id->=":[h,[l],(c,[d])=>{const a=c.id(),b=d.value;return typeof a==typeof b&&a>=b},],"filter-has":[h,[l],(a,[b])=>b.value in a.properties(),],"filter-has-id":[h,[],a=>null!==a.id()&& void 0!==a.id(),],"filter-type-in":[h,[z(i)],(a,[b])=>b.value.indexOf(a.geometryType())>=0,],"filter-id-in":[h,[z(l)],(a,[b])=>b.value.indexOf(a.id())>=0,],"filter-in-small":[h,[i,z(l)],(a,[b,c])=>c.value.indexOf(a.properties()[b.value])>=0,],"filter-in-large":[h,[i,z(l)],(b,[c,a])=>(function(d,e,b,c){for(;b<=c;){const a=b+c>>1;if(e[a]===d)return!0;e[a]>d?c=a-1:b=a+1}return!1})(b.properties()[c.value],a.value,0,a.value.length-1),],all:{type:h,overloads:[[[h,h],(a,[b,c])=>b.evaluate(a)&&c.evaluate(a),],[x(h),(a,b)=>{for(const c of b)if(!c.evaluate(a))return!1;return!0},],]},any:{type:h,overloads:[[[h,h],(a,[b,c])=>b.evaluate(a)||c.evaluate(a),],[x(h),(a,b)=>{for(const c of b)if(c.evaluate(a))return!0;return!1},],]},"!":[h,[h],(a,[b])=>!b.evaluate(a)],"is-supported-script":[h,[i],(a,[c])=>{const b=a.globals&&a.globals.isSupportedScript;return!b||b(c.evaluate(a))},],upcase:[i,[i],(a,[b])=>b.evaluate(a).toUpperCase(),],downcase:[i,[i],(a,[b])=>b.evaluate(a).toLowerCase(),],concat:[i,x(l),(b,a)=>a.map(a=>fF(a.evaluate(b))).join(""),],"resolved-locale":[i,[cg],(a,[b])=>b.evaluate(a).resolvedLocale(),]});class cM{constructor(c,b){var a;this.expression=c,this._warningHistory={},this._evaluator=new fK,this._defaultValue=b?"color"===(a=b).type&&gn(a.default)?new m(0,0,0,0):"color"===a.type?m.parse(a.default)||null:void 0===a.default?null:a.default:null,this._enumValues=b&&"enum"===b.type?b.values:null}evaluateWithoutErrorHandling(a,b,c,d,e,f,g,h){return this._evaluator.globals=a,this._evaluator.feature=b,this._evaluator.featureState=c,this._evaluator.canonical=d,this._evaluator.availableImages=e||null,this._evaluator.formattedSection=f,this._evaluator.featureTileCoord=g||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(c,d,e,f,g,h,i,j){this._evaluator.globals=c,this._evaluator.feature=d||null,this._evaluator.featureState=e||null,this._evaluator.canonical=f,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=i||null,this._evaluator.featureDistanceData=j||null;try{const a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new fG(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,"undefined"!=typeof console&&console.warn(b.message)),this._defaultValue}}}function gv(a){return Array.isArray(a)&&a.length>0&&"string"==typeof a[0]&&a[0]in U}function cN(d,a){const b=new f1(U,[],a?function(a){const b={color:y,string:i,number:f,enum:i,boolean:h,formatted:ch,resolvedImage:ci};return"array"===a.type?z(b[a.value]||l,a.length):b[a.type]}(a):void 0),c=b.parse(d,void 0,void 0,void 0,a&&"string"===a.type?{typeAnnotation:"coerce"}:void 0);return c?gh(new cM(c,a)):gi(b.errors)}class cO{constructor(a,b){this.kind=a,this._styleExpression=b,this.isStateDependent="constant"!==a&&!f_(b.expression)}evaluateWithoutErrorHandling(a,b,c,d,e,f){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,e,f)}evaluate(a,b,c,d,e,f){return this._styleExpression.evaluate(a,b,c,d,e,f)}}class cP{constructor(a,b,c,d){this.kind=a,this.zoomStops=c,this._styleExpression=b,this.isStateDependent="camera"!==a&&!f_(b.expression),this.interpolationType=d}evaluateWithoutErrorHandling(a,b,c,d,e,f){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,e,f)}evaluate(a,b,c,d,e,f){return this._styleExpression.evaluate(a,b,c,d,e,f)}interpolationFactor(a,b,c){return this.interpolationType?ai.interpolationFactor(this.interpolationType,a,b,c):0}}function gw(b,c){if("error"===(b=cN(b,c)).result)return b;const d=b.value.expression,e=f$(d);if(!e&&!gj(c))return gi([new fr("","data expressions not supported"),]);const f=f0(d,["zoom","pitch","distance-from-center",]);if(!f&&!gk(c))return gi([new fr("","zoom expressions not supported"),]);const a=gx(d);return a||f?a instanceof fr?gi([a]):a instanceof ai&&!gl(c)?gi([new fr("",'"interpolate" expressions cannot be used with this property'),]):gh(a?new cP(e?"camera":"composite",b.value,a.labels,a instanceof ai?a.interpolation:void 0):new cO(e?"constant":"source",b.value)):gi([new fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'),])}class cQ{constructor(a,b){this._parameters=a,this._specification=b,ce(this,gp(this._parameters,this._specification))}static deserialize(a){return new cQ(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function gx(a){let b=null;if(a instanceof cw)b=gx(a.result);else if(a instanceof cv){for(const c of a.args)if(b=gx(c))break}else(a instanceof cq||a instanceof ai)&&a.input instanceof aX&&"zoom"===a.input.name&&(b=a);return b instanceof fr||a.eachChild(c=>{const a=gx(c);a instanceof fr?b=a:!b&&a?b=new fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):b&&a&&b!==a&&(b=new fr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),b}function cR(c){const d=c.key,a=c.value,b=c.valueSpec||{},f=c.objectElementValidators||{},l=c.style,m=c.styleSpec;let g=[];const k=gm(a);if("object"!==k)return[new cc(d,a,`object expected, ${k} found`),];for(const e in a){const j=e.split(".")[0],n=b[j]||b["*"];let h;if(f[j])h=f[j];else if(b[j])h=gR;else if(f["*"])h=f["*"];else{if(!b["*"]){g.push(new cc(d,a[e],`unknown property "${e}"`));continue}h=gR}g=g.concat(h({key:(d?`${d}.`:d)+e,value:a[e],valueSpec:n,style:l,styleSpec:m,object:a,objectKey:e},a))}for(const i in b)f[i]||b[i].required&& void 0===b[i].default&& void 0===a[i]&&g.push(new cc(d,a,`missing required property "${i}"`));return g}function cS(c){const b=c.value,a=c.valueSpec,i=c.style,h=c.styleSpec,e=c.key,j=c.arrayElementValidator||gR;if("array"!==gm(b))return[new cc(e,b,`array expected, ${gm(b)} found`),];if(a.length&&b.length!==a.length)return[new cc(e,b,`array length ${a.length} expected, length ${b.length} found`),];if(a["min-length"]&&b.lengthg)return[new cc(e,a,`${a} is greater than the maximum value ${g}`),]}return[]}function cU(a){const f=a.valueSpec,c=fp(a.value.type);let g,h,i,j={};const d="categorical"!==c&& void 0===a.value.property,e="array"===gm(a.value.stops)&&"array"===gm(a.value.stops[0])&&"object"===gm(a.value.stops[0][0]),b=cR({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(a){if("identity"===c)return[new cc(a.key,a.value,'identity function may not have a "stops" property'),];let b=[];const d=a.value;return b=b.concat(cS({key:a.key,value:d,valueSpec:a.valueSpec,style:a.style,styleSpec:a.styleSpec,arrayElementValidator:k})),"array"===gm(d)&&0===d.length&&b.push(new cc(a.key,d,"array must have at least one stop")),b},default:function(a){return gR({key:a.key,value:a.value,valueSpec:f,style:a.style,styleSpec:a.styleSpec})}}});return"identity"===c&&d&&b.push(new cc(a.key,a.value,'missing required property "property"')),"identity"===c||a.value.stops||b.push(new cc(a.key,a.value,'missing required property "stops"')),"exponential"===c&&a.valueSpec.expression&&!gl(a.valueSpec)&&b.push(new cc(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(d||gj(a.valueSpec)?d&&!gk(a.valueSpec)&&b.push(new cc(a.key,a.value,"zoom functions not supported")):b.push(new cc(a.key,a.value,"property functions not supported"))),("categorical"===c||e)&& void 0===a.value.property&&b.push(new cc(a.key,a.value,'"property" property is required')),b;function k(c){let d=[];const a=c.value,b=c.key;if("array"!==gm(a))return[new cc(b,a,`array expected, ${gm(a)} found`),];if(2!==a.length)return[new cc(b,a,`array length 2 expected, length ${a.length} found`),];if(e){if("object"!==gm(a[0]))return[new cc(b,a,`object expected, ${gm(a[0])} found`),];if(void 0===a[0].zoom)return[new cc(b,a,"object stop key must have zoom"),];if(void 0===a[0].value)return[new cc(b,a,"object stop key must have value"),];if(i&&i>fp(a[0].zoom))return[new cc(b,a[0].zoom,"stop zoom values must appear in ascending order"),];fp(a[0].zoom)!==i&&(i=fp(a[0].zoom),h=void 0,j={}),d=d.concat(cR({key:`${b}[0]`,value:a[0],valueSpec:{zoom:{}},style:c.style,styleSpec:c.styleSpec,objectElementValidators:{zoom:cT,value:l}}))}else d=d.concat(l({key:`${b}[0]`,value:a[0],valueSpec:{},style:c.style,styleSpec:c.styleSpec},a));return gv(fq(a[1]))?d.concat([new cc(`${b}[1]`,a[1],"expressions are not allowed in function stops."),]):d.concat(gR({key:`${b}[1]`,value:a[1],valueSpec:f,style:c.style,styleSpec:c.styleSpec}))}function l(a,k){const b=gm(a.value),d=fp(a.value),e=null!==a.value?a.value:k;if(g){if(b!==g)return[new cc(a.key,e,`${b} stop domain type must match previous stop domain type ${g}`),]}else g=b;if("number"!==b&&"string"!==b&&"boolean"!==b)return[new cc(a.key,e,"stop domain value must be a number, string, or boolean"),];if("number"!==b&&"categorical"!==c){let i=`number expected, ${b} found`;return gj(f)&& void 0===c&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new cc(a.key,e,i)]}return"categorical"!==c||"number"!==b||isFinite(d)&&Math.floor(d)===d?"categorical"!==c&&"number"===b&& void 0!==h&&dnew cc(`${a.key}${b.key}`,a.value,b.message));const b=c.value.expression||c.value._styleExpression.expression;if("property"===a.expressionContext&&"text-font"===a.propertyKey&&!b.outputDefined())return[new cc(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`),];if("property"===a.expressionContext&&"layout"===a.propertyType&&!f_(b))return[new cc(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.'),];if("filter"===a.expressionContext)return gz(b,a);if(a.expressionContext&&0===a.expressionContext.indexOf("cluster")){if(!f0(b,["zoom","feature-state"]))return[new cc(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.'),];if("cluster-initial"===a.expressionContext&&!f$(b))return[new cc(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties."),]}return[]}function gz(b,a){const c=new Set(["zoom","feature-state","pitch","distance-from-center",]);for(const d of a.valueSpec.expression.parameters)c.delete(d);if(0===c.size)return[];const e=[];return b instanceof aX&&c.has(b.name)?[new cc(a.key,a.value,`["${b.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`),]:(b.eachChild(b=>{e.push(...gz(b,a))}),e)}function cV(c){const e=c.key,a=c.value,b=c.valueSpec,d=[];return Array.isArray(b.values)?-1===b.values.indexOf(fp(a))&&d.push(new cc(e,a,`expected one of [${b.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(b.values).indexOf(fp(a))&&d.push(new cc(e,a,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(a)} found`)),d}function gA(a){if(!0===a|| !1===a)return!0;if(!Array.isArray(a)||0===a.length)return!1;switch(a[0]){case"has":return a.length>=2&&"$id"!==a[1]&&"$type"!==a[1];case"in":return a.length>=3&&("string"!=typeof a[1]||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==a.length||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const b of a.slice(1))if(!gA(b)&&"boolean"!=typeof b)return!1;return!0;default:return!0}}function gB(a,k="fill"){if(null==a)return{filter:()=>!0,needGeometry:!1,needFeature:!1};gA(a)||(a=gI(a));const c=a;let d=!0;try{d=function(a){if(!gE(a))return a;let b=fq(a);return gD(b),b=gC(b)}(c)}catch(l){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(c,null,2)} - `)}const f=b[`filter_${k}`],g=cN(d,f);let h=null;if("error"===g.result)throw new Error(g.value.map(a=>`${a.key}: ${a.message}`).join(", "));h=(a,b,c)=>g.value.evaluate(a,b,{},c);let i=null,j=null;if(d!==c){const e=cN(c,f);if("error"===e.result)throw new Error(e.value.map(a=>`${a.key}: ${a.message}`).join(", "));i=(a,b,c,d,f)=>e.value.evaluate(a,b,{},c,void 0,void 0,d,f),j=!f$(e.value.expression)}return{filter:h,dynamicFilter:i||void 0,needGeometry:gH(d),needFeature:!!j}}function gC(a){if(!Array.isArray(a))return a;const b=function(a){if(gF.has(a[0])){for(let b=1;bgC(a))}function gD(a){let b=!1;const c=[];if("case"===a[0]){for(let d=1;d",">=","<","<=","to-boolean",]);function gG(a,b){return ab?1:0}function gH(a){if(!Array.isArray(a))return!1;if("within"===a[0])return!0;for(let b=1;b"===b||"<="===b||">="===b?gJ(a[1],a[2],b):"any"===b?["any"].concat(a.slice(1).map(gI)):"all"===b?["all"].concat(a.slice(1).map(gI)):"none"===b?["all"].concat(a.slice(1).map(gI).map(gM)):"in"===b?gK(a[1],a.slice(2)):"!in"===b?gM(gK(a[1],a.slice(2))):"has"===b?gL(a[1]):"!has"===b?gM(gL(a[1])):"within"!==b||a}function gJ(c,a,b){switch(c){case"$type":return[`filter-type-${b}`,a];case"$id":return[`filter-id-${b}`,a];default:return[`filter-${b}`,c,a]}}function gK(b,a){if(0===a.length)return!1;switch(b){case"$type":return["filter-type-in",["literal",a]];case"$id":return["filter-id-in",["literal",a]];default:return a.length>200&&!a.some(b=>typeof b!=typeof a[0])?["filter-in-large",b,["literal",a.sort(gG)],]:["filter-in-small",b,["literal",a],]}}function gL(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function gM(a){return["!",a]}function a_(a){if(gA(fq(a.value))){const b=fq(a.layerType);return gy(ce({},a,{expressionContext:"filter",valueSpec:a.styleSpec[`filter_${b||"fill"}`]}))}return gN(a)}function gN(e){const a=e.value,c=e.key;if("array"!==gm(a))return[new cc(c,a,`array expected, ${gm(a)} found`),];const h=e.styleSpec;let d,b=[];if(a.length<1)return[new cc(c,a,"filter array must have at least 1 element"),];switch(b=b.concat(cV({key:`${c}[0]`,value:a[0],valueSpec:h.filter_operator,style:e.style,styleSpec:e.styleSpec})),fp(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===fp(a[1])&&b.push(new cc(c,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&b.push(new cc(c,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(d=gm(a[1]))&&b.push(new cc(`${c}[1]`,a[1],`string expected, ${d} found`));for(let f=2;f{d in a&&b.push(new cc(c,a[d],`"${d}" is prohibited for ref layers`))}),g.layers.forEach(a=>{fp(a.id)===m&&(j=a)}),j?j.ref?b.push(new cc(c,a.ref,"ref cannot reference another ref layer")):e=fp(j.type):b.push(new cc(c,a.ref,`ref layer "${m}" not found`))}else if("background"!==e&&"sky"!==e){if(a.source){const h=g.sources&&g.sources[a.source],f=h&&fp(h.type);h?"vector"===f&&"raster"===e?b.push(new cc(c,a.source,`layer "${a.id}" requires a raster source`)):"raster"===f&&"raster"!==e?b.push(new cc(c,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==f||a["source-layer"]?"raster-dem"===f&&"hillshade"!==e?b.push(new cc(c,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===e&&a.paint&&a.paint["line-gradient"]&&("geojson"!==f||!h.lineMetrics)&&b.push(new cc(c,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):b.push(new cc(c,a,`layer "${a.id}" must specify a "source-layer"`)):b.push(new cc(c,a.source,`source "${a.source}" not found`))}else b.push(new cc(c,a,'missing required property "source"'))}return b=b.concat(cR({key:c,value:a,valueSpec:l.layer,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{"*":()=>[],type:()=>gR({key:`${c}.type`,value:a.type,valueSpec:l.layer.type,style:d.style,styleSpec:d.styleSpec,object:a,objectKey:"type"}),filter:a=>a_(ce({layerType:e},a)),layout:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cX(ce({layerType:e},a))}}),paint:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cW(ce({layerType:e},a))}})}}))}function cY(a){const b=a.value,d=a.key,c=gm(b);return"string"!==c?[new cc(d,b,`string expected, ${c} found`)]:[]}const gP={promoteId:function({key:b,value:a}){if("string"===gm(a))return cY({key:b,value:a});{const c=[];for(const d in a)c.push(...cY({key:`${b}.${d}`,value:a[d]}));return c}}};function a1(d){const a=d.value,b=d.key,c=d.styleSpec,e=d.style;if(!a.type)return[new cc(b,a,'"type" is required')];const i=fp(a.type);let f;switch(i){case"vector":case"raster":case"raster-dem":return cR({key:b,value:a,valueSpec:c[`source_${i.replace("-","_")}`],style:d.style,styleSpec:c,objectElementValidators:gP});case"geojson":if(f=cR({key:b,value:a,valueSpec:c.source_geojson,style:e,styleSpec:c,objectElementValidators:gP}),a.cluster)for(const g in a.clusterProperties){const[h,j]=a.clusterProperties[g],k="string"==typeof h?[h,["accumulated"],["get",g],]:h;f.push(...gy({key:`${b}.${g}.map`,value:j,expressionContext:"cluster-map"})),f.push(...gy({key:`${b}.${g}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return f;case"video":return cR({key:b,value:a,valueSpec:c.source_video,style:e,styleSpec:c});case"image":return cR({key:b,value:a,valueSpec:c.source_image,style:e,styleSpec:c});case"canvas":return[new cc(b,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return cV({key:`${b}.type`,value:a.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:e,styleSpec:c})}}function a2(f){const b=f.value,d=f.styleSpec,e=d.light,h=f.style;let c=[];const i=gm(b);if(void 0===b)return c;if("object"!==i)return c.concat([new cc("light",b,`object expected, ${i} found`),]);for(const a in b){const g=a.match(/^(.*)-transition$/);c=c.concat(g&&e[g[1]]&&e[g[1]].transition?gR({key:a,value:b[a],valueSpec:d.transition,style:h,styleSpec:d}):e[a]?gR({key:a,value:b[a],valueSpec:e[a],style:h,styleSpec:d}):[new cc(a,b[a],`unknown property "${a}"`),])}return c}function a3(d){const a=d.value,h=d.key,e=d.style,f=d.styleSpec,g=f.terrain;let c=[];const k=gm(a);if(void 0===a)return c;if("object"!==k)return c.concat([new cc("terrain",a,`object expected, ${k} found`),]);for(const b in a){const i=b.match(/^(.*)-transition$/);c=c.concat(i&&g[i[1]]&&g[i[1]].transition?gR({key:b,value:a[b],valueSpec:f.transition,style:e,styleSpec:f}):g[b]?gR({key:b,value:a[b],valueSpec:g[b],style:e,styleSpec:f}):[new cc(b,a[b],`unknown property "${b}"`),])}if(a.source){const j=e.sources&&e.sources[a.source],l=j&&fp(j.type);j?"raster-dem"!==l&&c.push(new cc(h,a.source,`terrain cannot be used with a source of type ${l}, it only be used with a "raster-dem" source type`)):c.push(new cc(h,a.source,`source "${a.source}" not found`))}else c.push(new cc(h,a,'terrain is missing required property "source"'));return c}function a4(f){const b=f.value,h=f.style,d=f.styleSpec,e=d.fog;let c=[];const i=gm(b);if(void 0===b)return c;if("object"!==i)return c.concat([new cc("fog",b,`object expected, ${i} found`),]);for(const a in b){const g=a.match(/^(.*)-transition$/);c=c.concat(g&&e[g[1]]&&e[g[1]].transition?gR({key:a,value:b[a],valueSpec:d.transition,style:h,styleSpec:d}):e[a]?gR({key:a,value:b[a],valueSpec:e[a],style:h,styleSpec:d}):[new cc(a,b[a],`unknown property "${a}"`),])}return c}const gQ={"*":()=>[],array:cS,boolean:function(a){const b=a.value,d=a.key,c=gm(b);return"boolean"!==c?[new cc(d,b,`boolean expected, ${c} found`),]:[]},number:cT,color:function(b){const c=b.key,a=b.value,d=gm(a);return"string"!==d?[new cc(c,a,`color expected, ${d} found`),]:null===fy.parseCSSColor(a)?[new cc(c,a,`color expected, "${a}" found`),]:[]},constants:cd,enum:cV,filter:a_,function:cU,layer:a0,object:cR,source:a1,light:a2,terrain:a3,fog:a4,string:cY,formatted:function(a){return 0===cY(a).length?[]:gy(a)},resolvedImage:function(a){return 0===cY(a).length?[]:gy(a)},projection:function(c){const b=c.value,f=c.styleSpec,g=f.projection,h=c.style;let a=[];const d=gm(b);if("object"===d)for(const e in b)a=a.concat(gR({key:e,value:b[e],valueSpec:g[e],style:h,styleSpec:f}));else"string"!==d&&(a=a.concat([new cc("projection",b,`object or string expected, ${d} found`),]));return a}};function gR(b){const c=b.value,a=b.valueSpec,d=b.styleSpec;return a.expression&&gn(fp(c))?cU(b):a.expression&&gv(fq(c))?gy(b):a.type&&gQ[a.type]?gQ[a.type](b):cR(ce({},b,{valueSpec:a.type?d[a.type]:a}))}function gS(c){const a=c.value,d=c.key,b=cY(c);return b.length||(-1===a.indexOf("{fontstack}")&&b.push(new cc(d,a,'"glyphs" url must include a "{fontstack}" token')),-1===a.indexOf("{range}")&&b.push(new cc(d,a,'"glyphs" url must include a "{range}" token'))),b}function t(a,d=b){let c=[];return c=c.concat(gR({key:"",value:a,valueSpec:d.$root,styleSpec:d,style:a,objectElementValidators:{glyphs:gS,"*":()=>[]}})),a.constants&&(c=c.concat(cd({key:"constants",value:a.constants,style:a,styleSpec:d}))),gT(c)}function gT(a){return[].concat(a).sort((a,b)=>a.line-b.line)}function v(a){return function(...b){return gT(a.apply(this,b))}}t.source=v(a1),t.light=v(a2),t.terrain=v(a3),t.fog=v(a4),t.layer=v(a0),t.filter=v(a_),t.paintProperty=v(cW),t.layoutProperty=v(cX);const M=t,cZ=M.light,c$=M.fog,gU=M.paintProperty,gV=M.layoutProperty;function c_(c,a){let b=!1;if(a&&a.length)for(const d of a)c.fire(new cb(new Error(d.message))),b=!0;return b}var aj=u;function u(b,c,d){var e=this.cells=[];if(b instanceof ArrayBuffer){this.arrayBuffer=b;var a=new Int32Array(this.arrayBuffer);b=a[0],this.d=(c=a[1])+2*(d=a[2]);for(var f=0;f=a[b+0]&&k>=a[b+1])?(d[c]=!0,m.push(n[c])):d[c]=!1}}},u.prototype._forEachCell=function(d,e,f,g,h,i,j,c){for(var k=this._convertToCellCoord(d),l=this._convertToCellCoord(e),m=this._convertToCellCoord(f),n=this._convertToCellCoord(g),a=k;a<=m;a++)for(var b=l;b<=n;b++){var o=this.d*b+a;if((!c||c(this._convertFromCellCoord(a),this._convertFromCellCoord(b),this._convertFromCellCoord(a+1),this._convertFromCellCoord(b+1)))&&h.call(this,d,e,f,g,o,i,j,c))return}},u.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},u.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},u.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var c=this.cells,f=3+this.cells.length+1+1,g=0,e=0;e=0)continue;const i=a[e];d[e]=gY[c].shallow.indexOf(e)>=0?i:g_(i,b)}a instanceof Error&&(d.message=a.message)}if(d.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==c&&(d.$name=c),d}throw new Error("can't serialize object of type "+typeof a)}function g0(a){if(null==a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||gZ(a)||g$(a)||ArrayBuffer.isView(a)||a instanceof gW)return a;if(Array.isArray(a))return a.map(g0);if("object"==typeof a){const d=a.$name||"Object",{klass:b}=gY[d];if(!b)throw new Error(`can't deserialize unregistered class ${d}`);if(b.deserialize)return b.deserialize(a);const e=Object.create(b.prototype);for(const c of Object.keys(a)){if("$name"===c)continue;const f=a[c];e[c]=gY[d].shallow.indexOf(c)>=0?f:g0(f)}return e}throw new Error("can't deserialize object of type "+typeof a)}class c0{constructor(){this.first=!0}update(b,c){const a=Math.floor(b);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=b,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=c):this.lastFloorZooma>=1536&&a<=1791,g2=a=>a>=1872&&a<=1919,g3=a=>a>=2208&&a<=2303,g4=a=>a>=11904&&a<=12031,g5=a=>a>=12032&&a<=12255,g6=a=>a>=12272&&a<=12287,g7=a=>a>=12288&&a<=12351,g8=a=>a>=12352&&a<=12447,g9=a=>a>=12448&&a<=12543,ha=a=>a>=12544&&a<=12591,hb=a=>a>=12704&&a<=12735,hc=a=>a>=12736&&a<=12783,hd=a=>a>=12784&&a<=12799,he=a=>a>=12800&&a<=13055,hf=a=>a>=13056&&a<=13311,hg=a=>a>=13312&&a<=19903,hh=a=>a>=19968&&a<=40959,hi=a=>a>=40960&&a<=42127,hj=a=>a>=42128&&a<=42191,hk=a=>a>=44032&&a<=55215,hl=a=>a>=63744&&a<=64255,hm=a=>a>=64336&&a<=65023,hn=a=>a>=65040&&a<=65055,ho=a=>a>=65072&&a<=65103,hp=a=>a>=65104&&a<=65135,hq=a=>a>=65136&&a<=65279,hr=a=>a>=65280&&a<=65519;function hs(a){for(const b of a)if(hv(b.charCodeAt(0)))return!0;return!1}function ht(a){for(const b of a)if(!hu(b.charCodeAt(0)))return!1;return!0}function hu(a){return!(g1(a)||g2(a)||g3(a)||hm(a)||hq(a))}function hv(a){var b,c,d,e,f,g,h,i;return!(746!==a&&747!==a&&(a<4352||!(hb(a)||ha(a)||ho(a)&&!(a>=65097&&a<=65103)||hl(a)||hf(a)||g4(a)||hc(a)||!(!g7(a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||hg(a)||hh(a)||he(a)||(b=a)>=12592&&b<=12687||(c=a)>=43360&&c<=43391||(d=a)>=55216&&d<=55295||(e=a)>=4352&&e<=4607||hk(a)||g8(a)||g6(a)||(f=a)>=12688&&f<=12703||g5(a)||hd(a)||g9(a)&&12540!==a||!(!hr(a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||!(!hp(a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(g=a)>=5120&&g<=5759||(h=a)>=6320&&h<=6399||hn(a)||(i=a)>=19904&&i<=19967||hi(a)||hj(a))))}function hw(b){var a,c,d,e,f,g,h,i,j,k,l,m,n;return!(hv(b)||(c=a=b)>=128&&c<=255&&(167===a||169===a||174===a||177===a||188===a||189===a||190===a||215===a||247===a)||(d=a)>=8192&&d<=8303&&(8214===a||8224===a||8225===a||8240===a||8241===a||8251===a||8252===a||8258===a||8263===a||8264===a||8265===a||8273===a)||(e=a)>=8448&&e<=8527||(f=a)>=8528&&f<=8591||(g=a)>=8960&&g<=9215&&(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||9003===a||a>=9085&&a<=9114||a>=9150&&a<=9165||9167===a||a>=9169&&a<=9179||a>=9186&&a<=9215)||(h=a)>=9216&&h<=9279&&9251!==a||(i=a)>=9280&&i<=9311||(j=a)>=9312&&j<=9471||(k=a)>=9632&&k<=9727||(l=a)>=9728&&l<=9983&&!(a>=9754&&a<=9759)||(m=a)>=11008&&m<=11263&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||g7(a)||g9(a)||(n=a)>=57344&&n<=63743||ho(a)||hp(a)||hr(a)||8734===a||8756===a||8757===a||a>=9984&&a<=10087||a>=10102&&a<=10131||65532===a||65533===a)}function hx(a){return a>=1424&&a<=2303||hm(a)||hq(a)}function hy(a,c){var b;return!(!c&&hx(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||(b=a)>=6016&&b<=6143)}function hz(a){for(const b of a)if(hx(b.charCodeAt(0)))return!0;return!1}const hA="deferred",hB="loading",hC="loaded";let hD=null,hE="unavailable",hF=null;const c1=function(a){a&&"string"==typeof a&&a.indexOf("NetworkError")> -1&&(hE="error"),hD&&hD(a)};function hG(){c2.fire(new aW("pluginStateChange",{pluginStatus:hE,pluginURL:hF}))}const c2=new S,c3=function(){return hE},hH=function(){if(hE!==hA||!hF)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hE=hB,hG(),hF&&fi({url:hF},a=>{a?c1(a):(hE=hC,hG())})},c4={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hE===hC||null!=c4.applyArabicShaping,isLoading:()=>hE===hB,setState(a){hE=a.pluginStatus,hF=a.pluginURL},isParsed:()=>null!=c4.applyArabicShaping&&null!=c4.processBidirectionalText&&null!=c4.processStyledBidirectionalText,getPluginURL:()=>hF};class c5{constructor(b,a){this.zoom=b,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition,this.pitch=a.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new c0,this.transition={},this.pitch=0)}isSupportedScript(a){return function(a,b){for(const c of a)if(!hy(c.charCodeAt(0),b))return!1;return!0}(a,c4.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const a=this.zoom,b=a-Math.floor(a),c=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:b+(1-b)*c}:{fromScale:.5,toScale:1,t:1-(1-c)*b}}}class hI{constructor(a,b){this.property=a,this.value=b,this.expression=function(a,b){if(gn(a))return new cQ(a,b);if(gv(a)){const c=gw(a,b);if("error"===c.result)throw new Error(c.value.map(a=>`${a.key}: ${a.message}`).join(", "));return c.value}{let d=a;return"string"==typeof a&&"color"===b.type&&(d=m.parse(a)),{kind:"constant",evaluate:()=>d}}}(void 0===b?a.specification.default:b,a.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(a,b,c){return this.property.possiblyEvaluate(this,a,b,c)}}class hJ{constructor(a){this.property=a,this.value=new hI(a,void 0)}transitioned(a,b){return new hK(this.property,this.value,b,bR({},a.transition,this.transition),a.now)}untransitioned(){return new hK(this.property,this.value,null,{},0)}}class c6{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return bX(this._values[a].value.value)}setValue(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new hJ(this._values[a].property)),this._values[a].value=new hI(this._values[a].property,null===b?void 0:bX(b))}getTransition(a){return bX(this._values[a].transition)}setTransition(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new hJ(this._values[a].property)),this._values[a].transition=bX(b)||void 0}serialize(){const b={};for(const a of Object.keys(this._values)){const c=this.getValue(a);void 0!==c&&(b[a]=c);const d=this.getTransition(a);void 0!==d&&(b[`${a}-transition`]=d)}return b}transitioned(c,d){const b=new hL(this._properties);for(const a of Object.keys(this._values))b._values[a]=this._values[a].transitioned(c,d._values[a]);return b}untransitioned(){const a=new hL(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].untransitioned();return a}}class hK{constructor(c,d,e,a,b){const f=a.delay||0,g=a.duration||0;b=b||0,this.property=c,this.value=d,this.begin=b+f,this.end=this.begin+g,c.specification.transition&&(a.delay||a.duration)&&(this.prior=e)}possiblyEvaluate(a,b,c){const d=a.now||0,e=this.value.possiblyEvaluate(a,b,c),f=this.prior;if(f){if(d>this.end||this.value.isDataDriven())return this.prior=null,e;if(dd.zoomHistory.lastIntegerZoom?{from:a,to:b,other:c}:{from:c,to:b,other:a}}interpolate(a){return a}}class a5{constructor(a){this.specification=a}possiblyEvaluate(b,a,d,e){if(void 0!==b.value){if("constant"===b.expression.kind){const c=b.expression.evaluate(a,null,{},d,e);return this._calculate(c,c,c,a)}return this._calculate(b.expression.evaluate(new c5(Math.floor(a.zoom-1),a)),b.expression.evaluate(new c5(Math.floor(a.zoom),a)),b.expression.evaluate(new c5(Math.floor(a.zoom+1),a)),a)}}_calculate(c,a,d,b){return b.zoom>b.zoomHistory.lastIntegerZoom?{from:c,to:a}:{from:d,to:a}}interpolate(a){return a}}class V{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){return!!a.expression.evaluate(b,null,{},c,d)}interpolate(){return!1}}class n{constructor(b){for(const a in this.properties=b,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],b){const c=b[a];c.specification.overridable&&this.overridableProperties.push(a);const d=this.defaultPropertyValues[a]=new hI(c,void 0),e=this.defaultTransitionablePropertyValues[a]=new hJ(c);this.defaultTransitioningPropertyValues[a]=e.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=d.possiblyEvaluate({})}}}function hO(a,b){return 256*(a=bM(Math.floor(a),0,255))+bM(Math.floor(b),0,255)}c("DataDrivenProperty",g),c("DataConstantProperty",e),c("CrossFadedDataDrivenProperty",N),c("CrossFadedProperty",a5),c("ColorRampProperty",V);const hP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class O{constructor(a,b){this._structArray=a,this._pos1=b*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class k{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,b){return a._trim(),b&&(a.isTransferred=!0,b.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(b){const a=Object.create(this.prototype);return a.arrayBuffer=b.arrayBuffer,a.length=b.length,a.capacity=b.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const b=this.uint8;this._refreshViews(),b&&this.uint8.set(b)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function j(b,a=1){let c=0,d=0;return{members:b.map(b=>{const e=hP[b.type].BYTES_PER_ELEMENT,g=c=hQ(c,Math.max(a,e)),f=b.components||1;return d=Math.max(d,e),c+=e*f,{name:b.name,type:b.type,components:f,offset:g}}),size:hQ(c,Math.max(d,a)),alignment:a}}function hQ(b,a){return Math.ceil(b/a)*a}class al extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.int16[b+0]=c,this.int16[b+1]=d,a}}al.prototype.bytesPerElement=4,c("StructArrayLayout2i4",al);class am extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(b,c,d,e,f){const a=4*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+3]=f,b}}am.prototype.bytesPerElement=8,c("StructArrayLayout4i8",am);class a6 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(a,d,e,f,g,h,i,j){const c=6*a,b=12*a,k=3*a;return this.int16[c+0]=d,this.int16[c+1]=e,this.uint8[b+4]=f,this.uint8[b+5]=g,this.uint8[b+6]=h,this.uint8[b+7]=i,this.float32[k+2]=j,a}}a6.prototype.bytesPerElement=12,c("StructArrayLayout2i4ub1f12",a6);class an extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,b}}an.prototype.bytesPerElement=12,c("StructArrayLayout3f12",an);class w extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k)}emplace(b,c,d,e,f,g,h,i,j,k,l){const a=10*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,this.uint16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,this.uint16[a+8]=k,this.uint16[a+9]=l,b}}w.prototype.bytesPerElement=20,c("StructArrayLayout10ui20",w);class W extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i)}emplace(b,c,d,e,f,g,h,i,j){const a=8*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,this.uint16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,b}}W.prototype.bytesPerElement=16,c("StructArrayLayout8ui16",W);class a7 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q)}emplace(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){const a=16*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,this.int16[a+8]=k,this.int16[a+9]=l,this.int16[a+10]=m,this.int16[a+11]=n,this.int16[a+12]=o,this.int16[a+13]=p,this.int16[a+14]=q,this.int16[a+15]=r,b}}a7.prototype.bytesPerElement=32,c("StructArrayLayout4i4ui4i4i32",a7);class a8 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.uint32[1*a+0]=b,a}}a8.prototype.bytesPerElement=4,c("StructArrayLayout1ul4",a8);class ao extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n)}emplace(c,d,e,f,g,h,i,j,k,l,m,n,o,p){const a=20*c,b=10*c;return this.int16[a+0]=d,this.int16[a+1]=e,this.int16[a+2]=f,this.int16[a+3]=g,this.int16[a+4]=h,this.float32[b+3]=i,this.float32[b+4]=j,this.float32[b+5]=k,this.float32[b+6]=l,this.int16[a+14]=m,this.uint32[b+8]=n,this.uint16[a+18]=o,this.uint16[a+19]=p,c}}ao.prototype.bytesPerElement=40,c("StructArrayLayout5i4f1i1ul2ui40",ao);class a9 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(b,c,d,e,f,g,h,i){const a=8*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+4]=f,this.int16[a+5]=g,this.int16[a+6]=h,this.int16[a+7]=i,b}}a9.prototype.bytesPerElement=16,c("StructArrayLayout3i2i2i16",a9);class ap extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f)}emplace(a,d,e,f,g,h){const b=4*a,c=8*a;return this.float32[b+0]=d,this.float32[b+1]=e,this.float32[b+2]=f,this.int16[c+6]=g,this.int16[c+7]=h,a}}ap.prototype.bytesPerElement=16,c("StructArrayLayout2f1f2i16",ap);class ba extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(a,d,e,f,g){const b=12*a,c=3*a;return this.uint8[b+0]=d,this.uint8[b+1]=e,this.float32[c+1]=f,this.float32[c+2]=g,a}}ba.prototype.bytesPerElement=12,c("StructArrayLayout2ub2f12",ba);class aq extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,b}}aq.prototype.bytesPerElement=6,c("StructArrayLayout3ui6",aq);class ar extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v)}emplace(c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y){const a=30*c,b=15*c,d=60*c;return this.int16[a+0]=e,this.int16[a+1]=f,this.int16[a+2]=g,this.float32[b+2]=h,this.float32[b+3]=i,this.uint16[a+8]=j,this.uint16[a+9]=k,this.uint32[b+5]=l,this.uint32[b+6]=m,this.uint32[b+7]=n,this.uint16[a+16]=o,this.uint16[a+17]=p,this.uint16[a+18]=q,this.float32[b+10]=r,this.float32[b+11]=s,this.uint8[d+48]=t,this.uint8[d+49]=u,this.uint8[d+50]=v,this.uint32[b+13]=w,this.int16[a+28]=x,this.uint8[d+58]=y,c}}ar.prototype.bytesPerElement=60,c("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ar);class as extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E)}emplace(c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G){const a=38*c,b=19*c;return this.int16[a+0]=d,this.int16[a+1]=e,this.int16[a+2]=f,this.float32[b+2]=g,this.float32[b+3]=h,this.int16[a+8]=i,this.int16[a+9]=j,this.int16[a+10]=k,this.int16[a+11]=l,this.int16[a+12]=m,this.int16[a+13]=n,this.uint16[a+14]=o,this.uint16[a+15]=p,this.uint16[a+16]=q,this.uint16[a+17]=r,this.uint16[a+18]=s,this.uint16[a+19]=t,this.uint16[a+20]=u,this.uint16[a+21]=v,this.uint16[a+22]=w,this.uint16[a+23]=x,this.uint16[a+24]=y,this.uint16[a+25]=z,this.uint16[a+26]=A,this.uint16[a+27]=B,this.uint16[a+28]=C,this.uint32[b+15]=D,this.float32[b+16]=E,this.float32[b+17]=F,this.float32[b+18]=G,c}}as.prototype.bytesPerElement=76,c("StructArrayLayout3i2f6i15ui1ul3f76",as);class X extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.float32[1*a+0]=b,a}}X.prototype.bytesPerElement=4,c("StructArrayLayout1f4",X);class at extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,b}}at.prototype.bytesPerElement=6,c("StructArrayLayout3i6",at);class bb extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(b,c,d,e,f,g,h,i){const a=7*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,this.float32[a+3]=f,this.float32[a+4]=g,this.float32[a+5]=h,this.float32[a+6]=i,b}}bb.prototype.bytesPerElement=28,c("StructArrayLayout7f28",bb);class au extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(a,c,d,e,f){const b=6*a;return this.uint32[3*a+0]=c,this.uint16[b+2]=d,this.uint16[b+3]=e,this.uint16[b+4]=f,a}}au.prototype.bytesPerElement=12,c("StructArrayLayout1ul3ui12",au);class Y extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.uint16[b+0]=c,this.uint16[b+1]=d,a}}Y.prototype.bytesPerElement=4,c("StructArrayLayout2ui4",Y);class av extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.uint16[1*a+0]=b,a}}av.prototype.bytesPerElement=2,c("StructArrayLayout1ui2",av);class Z extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.float32[b+0]=c,this.float32[b+1]=d,a}}Z.prototype.bytesPerElement=8,c("StructArrayLayout2f8",Z);class aw extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(b,c,d,e,f){const a=4*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,this.float32[a+3]=f,b}}aw.prototype.bytesPerElement=16,c("StructArrayLayout4f16",aw);class c7 extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}c7.prototype.size=40;class c8 extends ao{get(a){return new c7(this,a)}}c("CollisionBoxArray",c8);class c9 extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(a){this._structArray.uint8[this._pos1+49]=a}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(a){this._structArray.uint8[this._pos1+50]=a}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(a){this._structArray.uint32[this._pos4+13]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(a){this._structArray.uint8[this._pos1+58]=a}}c9.prototype.size=60;class da extends ar{get(a){return new c9(this,a)}}c("PlacedSymbolArray",da);class db extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(a){this._structArray.uint32[this._pos4+15]=a}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}db.prototype.size=76;class dc extends as{get(a){return new db(this,a)}}c("SymbolInstanceArray",dc);class dd extends X{getoffsetX(a){return this.float32[1*a+0]}}c("GlyphOffsetArray",dd);class de extends at{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}c("SymbolLineVertexArray",de);class df extends O{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}df.prototype.size=12;class dg extends au{get(a){return new df(this,a)}}c("FeatureIndexArray",dg);class dh extends O{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}dh.prototype.size=4;class di extends Y{get(a){return new dh(this,a)}}c("FillExtrusionCentroidArray",di);const hR=j([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},]),hS=j([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var bc=ah(function(a){a.exports=function(c,j){var g,h,a,i,e,f,b,d;for(h=c.length-(g=3&c.length),a=j,e=3432918353,f=461845907,d=0;d>>16)*e&65535)<<16)&4294967295)<<15|b>>>17))*f+(((b>>>16)*f&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(b=0,g){case 3:b^=(255&c.charCodeAt(d+2))<<16;case 2:b^=(255&c.charCodeAt(d+1))<<8;case 1:a^=b=(65535&(b=(b=(65535&(b^=255&c.charCodeAt(d)))*e+(((b>>>16)*e&65535)<<16)&4294967295)<<15|b>>>17))*f+(((b>>>16)*f&65535)<<16)&4294967295}return a^=c.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}}),dj=ah(function(a){a.exports=function(b,f){for(var d,e=b.length,a=f^e,c=0;e>=4;)d=1540483477*(65535&(d=255&b.charCodeAt(c)|(255&b.charCodeAt(++c))<<8|(255&b.charCodeAt(++c))<<16|(255&b.charCodeAt(++c))<<24))+((1540483477*(d>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(d=1540483477*(65535&(d^=d>>>24))+((1540483477*(d>>>16)&65535)<<16)),e-=4,++c;switch(e){case 3:a^=(255&b.charCodeAt(c+2))<<16;case 2:a^=(255&b.charCodeAt(c+1))<<8;case 1:a=1540483477*(65535&(a^=255&b.charCodeAt(c)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}}),bd=bc;bd.murmur3=bc,bd.murmur2=dj;class dk{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,b,c,d){this.ids.push(hT(a)),this.positions.push(b,c,d)}getPositions(f){const d=hT(f);let a=0,b=this.ids.length-1;for(;a>1;this.ids[c]>=d?b=c:a=c+1}const e=[];for(;this.ids[a]===d;)e.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return e}static serialize(c,d){const a=new Float64Array(c.ids),b=new Uint32Array(c.positions);return hU(a,b,0,a.length-1),d&&d.push(a.buffer,b.buffer),{ids:a,positions:b}}static deserialize(b){const a=new dk;return a.ids=b.ids,a.positions=b.positions,a.indexed=!0,a}}function hT(b){const a=+b;return!isNaN(a)&&Number.MIN_SAFE_INTEGER<=a&&a<=Number.MAX_SAFE_INTEGER?a:bd(String(b))}function hU(c,f,d,e){for(;d>1];let b=d-1,a=e+1;for(;;){do b++;while(c[b]g)if(b>=a)break;hV(c,b,a),hV(f,3*b,3*a),hV(f,3*b+1,3*a+1),hV(f,3*b+2,3*a+2)}a-d`u_${a}`),this.type=c}setUniform(a,c,b){a.set(b.constantOr(this.value))}getBinding(a,b,c){return"color"===this.type?new dn(a,b):new dl(a,b)}}class dq{constructor(b,a){this.uniformNames=a.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,b){this.pixelRatioFrom=b.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=b.tl.concat(b.br),this.patternTo=a.tl.concat(a.br)}setUniform(c,d,e,a){const b="u_pattern_to"===a||"u_dash_to"===a?this.patternTo:"u_pattern_from"===a||"u_dash_from"===a?this.patternFrom:"u_pixel_ratio_to"===a?this.pixelRatioTo:"u_pixel_ratio_from"===a?this.pixelRatioFrom:null;b&&c.set(b)}getBinding(b,c,a){return"u_pattern_from"===a||"u_pattern_to"===a||"u_dash_from"===a||"u_dash_to"===a?new dm(b,c):new dl(b,c)}}class dr{constructor(a,b,c,d){this.expression=a,this.type=c,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(a,b,h,c,d,e){const f=this.paintVertexArray.length,g=this.expression.evaluate(new c5(0),b,{},d,c,e);this.paintVertexArray.resize(a),this._setPaintValue(f,a,g)}updatePaintArray(a,b,c,d,e){const f=this.expression.evaluate({zoom:0},c,d,void 0,e);this._setPaintValue(a,b,f)}_setPaintValue(d,e,a){if("color"===this.type){const f=hZ(a);for(let b=d;b`u_${a}_t`),this.type=c,this.useIntegerZoom=d,this.zoom=e,this.maxValue=0,this.paintVertexAttributes=a.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?4:2,offset:0})),this.paintVertexArray=new f}populatePaintArray(a,b,i,c,d,e){const f=this.expression.evaluate(new c5(this.zoom),b,{},d,c,e),g=this.expression.evaluate(new c5(this.zoom+1),b,{},d,c,e),h=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(h,a,f,g)}updatePaintArray(d,e,a,b,c){const f=this.expression.evaluate({zoom:this.zoom},a,b,void 0,c),g=this.expression.evaluate({zoom:this.zoom+1},a,b,void 0,c);this._setPaintValue(d,e,f,g)}_setPaintValue(e,f,a,b){if("color"===this.type){const g=hZ(a),h=hZ(b);for(let c=e;c!0){this.binders={},this._buffers=[];const g=[];for(const a in e.paint._values){if(!n(a))continue;const c=e.paint.get(a);if(!(c instanceof hM&&gj(c.property.specification)))continue;const f=h_(a,e.type),b=c.value,d=c.property.specification.type,j=c.property.useIntegerZoom,k=c.property.specification["property-type"],h="cross-faded"===k||"cross-faded-data-driven"===k,l="line-dasharray"===String(a)&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==b.kind||l){if("source"===b.kind||l||h){const m=h2(a,d,"source");this.binders[a]=h?new dt(b,f,d,j,i,m,e.id):new dr(b,f,d,m),g.push(`/a_${a}`)}else{const o=h2(a,d,"composite");this.binders[a]=new ds(b,f,d,j,i,o),g.push(`/z_${a}`)}}else this.binders[a]=h?new dq(b.value,f):new dp(b.value,f,d),g.push(`/u_${a}`)}this.cacheKey=g.sort().join("")}getMaxValue(b){const a=this.binders[b];return a instanceof dr||a instanceof ds?a.maxValue:0}populatePaintArrays(b,c,d,e,f,g){for(const h in this.binders){const a=this.binders[h];(a instanceof dr||a instanceof ds||a instanceof dt)&&a.populatePaintArray(b,c,d,e,f,g)}}setConstantPatternPositions(b,c){for(const d in this.binders){const a=this.binders[d];a instanceof dq&&a.setConstantPatternPositions(b,c)}}updatePaintArrays(c,g,h,i,j,k){let d=!1;for(const e in c){const l=g.getPositions(e);for(const b of l){const m=h.feature(b.index);for(const f in this.binders){const a=this.binders[f];if((a instanceof dr||a instanceof ds||a instanceof dt)&& !0===a.expression.isStateDependent){const n=i.paint.get(f);a.expression=n.value,a.updatePaintArray(b.start,b.end,m,c[e],j,k),d=!0}}}}return d}defines(){const b=[];for(const c in this.binders){const a=this.binders[c];(a instanceof dp||a instanceof dq)&&b.push(...a.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return b}getBinderAttributes(){const c=[];for(const d in this.binders){const a=this.binders[d];if(a instanceof dr||a instanceof ds||a instanceof dt)for(let b=0;b!0){for(const a of(this.programConfigurations={},b))this.programConfigurations[a.id]=new du(a,c,d);this.needsUpload=!1,this._featureMap=new dk,this._bufferOffset=0}populatePaintArrays(a,b,c,d,e,f,g){for(const h in this.programConfigurations)this.programConfigurations[h].populatePaintArrays(a,b,d,e,f,g);void 0!==b.id&&this._featureMap.add(b.id,c,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(b,c,d,e,f){for(const a of d)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(b,this._featureMap,c,a,e,f)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(const b in this.programConfigurations)this.programConfigurations[b].upload(a);this.needsUpload=!1}}destroy(){for(const a in this.programConfigurations)this.programConfigurations[a].destroy()}}const h$={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"line-dasharray":["dash_to","dash_from"]};function h_(a,b){return h$[a]||[a.replace(`${b}-`,"").replace(/-/g,"_"),]}const h0={"line-pattern":{source:w,composite:w},"fill-pattern":{source:w,composite:w},"fill-extrusion-pattern":{source:w,composite:w},"line-dasharray":{source:W,composite:W}},h1={color:{source:Z,composite:aw},number:{source:X,composite:Z}};function h2(c,d,a){const b=h0[c];return b&&b[a]||h1[d][a]}c("ConstantBinder",dp),c("CrossFadedConstantBinder",dq),c("SourceExpressionBinder",dr),c("CrossFadedCompositeBinder",dt),c("CompositeExpressionBinder",ds),c("ProgramConfiguration",du,{omit:["_buffers"]}),c("ProgramConfigurationSet",dv);const h3="-transition";class be extends S{constructor(a,b){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==a.type&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,"background"!==a.type&&"sky"!==a.type&&(this.source=a.source,this.sourceLayer=a["source-layer"],this.filter=a.filter),b.layout&&(this._unevaluatedLayout=new class{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}getValue(a){return bX(this._values[a].value)}setValue(a,b){this._values[a]=new hI(this._values[a].property,null===b?void 0:bX(b))}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c)}return a}possiblyEvaluate(c,d,e){const a=new hN(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].possiblyEvaluate(c,d,e);return a}}(b.layout)),b.paint)){for(const c in this._transitionablePaint=new c6(b.paint),a.paint)this.setPaintProperty(c,a.paint[c],{validate:!1});for(const d in a.layout)this.setLayoutProperty(d,a.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hN(b.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return"visibility"===a?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,b,c={}){null!=b&&this._validate(gV,`layers.${this.id}.layout.${a}`,a,b,c)||("visibility"!==a?this._unevaluatedLayout.setValue(a,b):this.visibility=b)}getPaintProperty(a){return bV(a,h3)?this._transitionablePaint.getTransition(a.slice(0,-h3.length)):this._transitionablePaint.getValue(a)}setPaintProperty(a,b,e={}){if(null!=b&&this._validate(gU,`layers.${this.id}.paint.${a}`,a,b,e))return!1;if(bV(a,h3))return this._transitionablePaint.setTransition(a.slice(0,-h3.length),b||void 0),!1;{const c=this._transitionablePaint._values[a],f="cross-faded-data-driven"===c.property.specification["property-type"],g=c.value.isDataDriven(),h=c.value;this._transitionablePaint.setValue(a,b),this._handleSpecialPaintPropertyUpdate(a);const d=this._transitionablePaint._values[a].value;return d.isDataDriven()||g||f||this._handleOverridablePaintPropertyUpdate(a,h,d)}}_handleSpecialPaintPropertyUpdate(a){}getProgramIds(){return null}getProgramConfiguration(a){return null}_handleOverridablePaintPropertyUpdate(a,b,c){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||"none"===this.visibility}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,b){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,b)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,b)}serialize(){const a={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),bW(a,(a,b)=>!(void 0===a||"layout"===b&&!Object.keys(a).length||"paint"===b&&!Object.keys(a).length))}_validate(c,d,e,f,a={}){return(!a|| !1!==a.validate)&&c_(this,c.call(M,{key:d,layerType:this.type,objectKey:e,value:f,styleSpec:b,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const b in this.paint._values){const a=this.paint.get(b);if(a instanceof hM&&gj(a.property.specification)&&("source"===a.value.kind||"composite"===a.value.kind)&&a.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=gB(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const dw=j([{name:"a_pos",components:2,type:"Int16"},],4),{members:h4}=dw;class ay{constructor(a=[]){this.segments=a}prepareSegment(b,d,e,c){let a=this.segments[this.segments.length-1];return b>ay.MAX_VERTEX_ARRAY_LENGTH&&bY(`Max vertices per segment is ${ay.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${b}`),(!a||a.vertexLength+b>ay.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==c)&&(a={vertexOffset:d.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0},void 0!==c&&(a.sortKey=c),this.segments.push(a)),a}get(){return this.segments}destroy(){for(const a of this.segments)for(const b in a.vaos)a.vaos[b].destroy()}static simpleSegment(a,b,c,d){return new ay([{vertexOffset:a,primitiveOffset:b,vertexLength:c,primitiveLength:d,vaos:{},sortKey:0},])}}ay.MAX_VERTEX_ARRAY_LENGTH=65535,c("SegmentVector",ay);class dx{constructor(a,b){a&&(b?this.setSouthWest(a).setNorthEast(b):4===a.length?this.setSouthWest([a[0],a[1],]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))}setNorthEast(a){return this._ne=a instanceof dy?new dy(a.lng,a.lat):dy.convert(a),this}setSouthWest(a){return this._sw=a instanceof dy?new dy(a.lng,a.lat):dy.convert(a),this}extend(a){const d=this._sw,e=this._ne;let b,c;if(a instanceof dy)b=a,c=a;else{if(!(a instanceof dx))return Array.isArray(a)?4===a.length||a.every(Array.isArray)?this.extend(dx.convert(a)):this.extend(dy.convert(a)):this;if(b=a._sw,c=a._ne,!b||!c)return this}return d||e?(d.lng=Math.min(b.lng,d.lng),d.lat=Math.min(b.lat,d.lat),e.lng=Math.max(c.lng,e.lng),e.lat=Math.max(c.lat,e.lat)):(this._sw=new dy(b.lng,b.lat),this._ne=new dy(c.lng,c.lat)),this}getCenter(){return new dy((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new dy(this.getWest(),this.getNorth())}getSouthEast(){return new dy(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(d){const{lng:a,lat:b}=dy.convert(d);let c=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=b&&b<=this._ne.lat&&c}static convert(a){return!a||a instanceof dx?a:new dx(a)}}class dy{constructor(a,b){if(isNaN(a)||isNaN(b))throw new Error(`Invalid LngLat object: (${a}, ${b})`);if(this.lng=+a,this.lat=+b,this.lat>90||this.lat< -90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new dy(bO(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(b){const a=Math.PI/180,c=this.lat*a,d=b.lat*a,e=Math.sin(c)*Math.sin(d)+Math.cos(c)*Math.cos(d)*Math.cos((b.lng-this.lng)*a);return 6371008.8*Math.acos(Math.min(e,1))}toBounds(c=0){const a=360*c/40075017,b=a/Math.cos(Math.PI/180*this.lat);return new dx(new dy(this.lng-b,this.lat-a),new dy(this.lng+b,this.lat+a))}static convert(a){if(a instanceof dy)return a;if(Array.isArray(a)&&(2===a.length||3===a.length))return new dy(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&"object"==typeof a&&null!==a)return new dy(Number("lng"in a?a.lng:a.lon),Number(a.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const h5=2*Math.PI*6371008.8;function h6(a){return h5*Math.cos(a*Math.PI/180)}function dz(a){return(180+a)/360}function dA(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function dB(a,b){return a/h6(b)}function h7(a){return 360*a-180}function dC(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function h8(a,b){return a*h6(dC(b))}class dD{constructor(a,b,c=0){this.x=+a,this.y=+b,this.z=+c}static fromLngLat(b,c=0){const a=dy.convert(b);return new dD(dz(a.lng),dA(a.lat),dB(c,a.lat))}toLngLat(){return new dy(h7(this.x),dC(this.y))}toAltitude(){return h8(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/h5*(1/Math.cos(dC(this.y)*Math.PI/180))}}function h9(c,i,j,k,l,d,b,e,f){const g=(i+k)/2,h=(j+l)/2,a=new aF(g,h);e(a),function(e,f,a,b,g,h){const c=a-g,d=b-h;return Math.abs((b-f)*c-(a-e)*d)/Math.hypot(c,d)}(a.x,a.y,d.x,d.y,b.x,b.y)>=f?(h9(c,i,j,g,h,d,a,e,f),h9(c,g,h,k,l,a,b,e,f)):c.push(b)}function ia(i,d,j){const b=[];let e,f,c;for(const a of i){const{x:g,y:h}=a;d(a),c?h9(b,e,f,g,h,c,a,d,j):b.push(a),e=g,f=h,c=a}return b}function ib(a,d){const b=Math.round(a.x*d),c=Math.round(a.y*d);return a.x=bM(b,-16384,16383),a.y=bM(c,-16384,16383),(ba.x+1||ca.y+1)&&bY("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function ic(d,g,e){const a=d.loadGeometry(),f=d.extent,j=8192/f;if(g&&e&&e.projection.isReprojectedInTileSpace){const m=1<{const c=h7((g.x+a.x/f)/m),d=dC((g.y+a.y/f)/m),b=q.project(c,d);a.x=(b.x*n-o)*f,a.y=(b.y*n-p)*f};for(let b=0;b=f||c.y<0||c.y>=f||(h(c),i.push(c));a[b]=i}}for(const k of a)for(const l of k)ib(l,j);return a}function id(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?ic(a):[]}}function ie(a,b,c,d,e){a.emplaceBack(2*b+(d+1)/2,2*c+(e+1)/2)}class bf{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new al,this.indexArray=new aq,this.segments=new ay,this.programConfigurations=new dv(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(g,h,a,m){const i=this.layers[0],d=[];let b=null;for(const{feature:c,id:n,index:o,sourceLayerIndex:p}of("circle"===i.type&&(b=i.layout.get("circle-sort-key")),g)){const j=this.layers[0]._featureFilter.needGeometry,e=id(c,j);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),e,a))continue;const q=b?b.evaluate(e,{},a):void 0,r={id:n,properties:c.properties,type:c.type,sourceLayerIndex:p,index:o,geometry:j?e.geometry:ic(c,a,m),patterns:{},sortKey:q};d.push(r)}for(const k of(b&&d.sort((a,b)=>a.sortKey-b.sortKey),d)){const{geometry:l,index:f,sourceLayerIndex:s}=k,t=g[f].feature;this.addFeature(k,l,f,h.availableImages,a),h.featureIndex.insert(t,l,f,s,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,h4),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,g,h,i,j){for(const k of g)for(const f of k){const a=f.x,b=f.y;if(a<0||a>=8192||b<0||b>=8192)continue;const d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=d.vertexLength;ie(this.layoutVertexArray,a,b,-1,-1),ie(this.layoutVertexArray,a,b,1,-1),ie(this.layoutVertexArray,a,b,1,1),ie(this.layoutVertexArray,a,b,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),d.vertexLength+=4,d.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},i,j)}}function dE(a,b){for(let c=0;c1){if(ij(a,b))return!0;for(let c=0;c1?b:b.sub(a)._mult(d)._add(a))}function io(h,c){let b,a,d,e=!1;for(let f=0;fc.y!=d.y>c.y&&c.x<(d.x-a.x)*(c.y-a.y)/(d.y-a.y)+a.x&&(e=!e)}return e}function ip(b,c){let d=!1;for(let e=0,g=b.length-1;ec.y!=f.y>c.y&&c.x<(f.x-a.x)*(c.y-a.y)/(f.y-a.y)+a.x&&(d=!d)}return d}function dF(a,d,e,f,g){for(const b of a)if(d<=b.x&&e<=b.y&&f>=b.x&&g>=b.y)return!0;const h=[new aF(d,e),new aF(d,g),new aF(f,g),new aF(f,e),];if(a.length>2){for(const i of h)if(ip(a,i))return!0}for(let c=0;ce.x&&b.x>e.x||a.ye.y&&b.y>e.y)return!1;const f=eR(a,b,c[0]);return f!==eR(a,b,c[1])||f!==eR(a,b,c[2])||f!==eR(a,b,c[3])}function ir(a,b,d){const c=b.paint.get(a).value;return"constant"===c.kind?c.value:d.programConfigurations.get(b.id).getMaxValue(a)}function is(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function it(a,b,f,g,h){if(!b[0]&&!b[1])return a;const d=aF.convert(b)._mult(h);"viewport"===f&&d._rotate(-g);const e=[];for(let c=0;c{var a,b,c;const h=bF([],j,d),i=1/h[3]/e*g;return a=h,b=h,c=[i,i,f?1/h[3]:i,i],a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a[3]=b[3]*c[3],a}),c=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(a=>{const c=bz([],bB([],bE([],b[a[0]],b[a[1]]),bE([],b[a[2]],b[a[1]]))),d=-bA(c,b[a[1]]);return c.concat(d)});return new dH(b,c)}}class B{constructor(a,b){this.min=a,this.max=b,this.center=bx([],bw([],this.min,this.max),.5)}quadrant(d){const b=[d%2==0,d<2],e=eH(this.min),c=eH(this.max);for(let a=0;a=0;if(0===e)return 0;e!==c.length&&(j=!1)}if(j)return 2;for(let a=0;a<3;a++){let g=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(let i=0;ithis.max[a]-this.min[a])return 0}return 1}}function iw(b,l,c,g,h,a,i,m,d){if(a&&b.queryGeometry.isAboveHorizon)return!1;for(const n of(a&&(d*=b.pixelToTileUnitsFactor),l))for(const f of n){const e=f.add(m),j=h&&c.elevation?c.elevation.exaggeration()*h.getElevationAt(e.x,e.y,!0):0,o=a?e:ix(e,j,g),p=a?b.tilespaceRays.map(a=>iA(a,j)):b.queryGeometry.screenGeometry,k=bF([],[f.x,f.y,j,1],g);if(!i&&a?d*=k[3]/c.cameraToCenterDistance:i&&!a&&(d*=c.cameraToCenterDistance/k[3]),ig(p,o,d))return!0}return!1}function ix(b,c,d){const a=bF([],[b.x,b.y,c,1],d);return new aF(a[0]/a[3],a[1]/a[3])}const iy=Q(0,0,0),iz=Q(0,0,1);function iA(b,c){const a=aK();return iy[2]=c,b.intersectsPlane(iy,iz,a),new aF(a[0],a[1])}class dI extends bf{}function iB(b,{width:c,height:d},e,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==c*d*e)throw new RangeError("mismatched image size")}else a=new Uint8Array(c*d*e);return b.width=c,b.height=d,b.data=a,b}function iC(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const e=iB({},{width:b,height:c},d);iD(a,e,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,b),height:Math.min(a.height,c)},d),a.width=b,a.height=c,a.data=e.data}function iD(c,b,d,e,a,h){if(0===a.width||0===a.height)return b;if(a.width>c.width||a.height>c.height||d.x>c.width-a.width||d.y>c.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>b.width||a.height>b.height||e.x>b.width-a.width||e.y>b.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const i=c.data,j=b.data;for(let f=0;f{o[a.evaluationKey]=e;const b=a.expression.evaluate(o);l.data[c+d+0]=Math.floor(255*b.r/b.a),l.data[c+d+1]=Math.floor(255*b.g/b.a),l.data[c+d+2]=Math.floor(255*b.b/b.a),l.data[c+d+3]=Math.floor(255*b.a)};if(a.clips)for(let c=0,h=0;c80*a){d=g=b[0],e=h=b[1];for(var l=a;lg&&(g=i),j>h&&(h=j);k=0!==(k=Math.max(g-d,h-e))?1/k:0}return iJ(c,m,a,d,e,k),m}function iH(c,e,f,d,g){var a,b;if(g===i3(c,e,f,d)>0)for(a=e;a=e;a-=d)b=i0(a,c[a],c[a+1],b);return b&&iW(b,b.next)&&(i1(b),b=b.next),b}function iI(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner|| !iW(a,a.next)&&0!==iV(a.prev,a,a.next))a=a.next;else{if(i1(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function iJ(a,b,c,e,f,d,h){if(a){!h&&d&&function(b,c,d,e){var a=b;do null===a.z&&(a.z=iR(a.x,a.y,c,d,e)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==b)a.prevZ.nextZ=null,a.prevZ=null,function(g){var h,b,a,c,d,i,e,f,j=1;do{for(b=g,g=null,d=null,i=0;b;){for(i++,a=b,e=0,h=0;h0||f>0&&a;)0!==e&&(0===f||!a||b.z<=a.z)?(c=b,b=b.nextZ,e--):(c=a,a=a.nextZ,f--),d?d.nextZ=c:g=c,c.prevZ=d,d=c;b=a}d.nextZ=null,j*=2}while(i>1)}(a)}(a,e,f,d);for(var i,g,j=a;a.prev!==a.next;)if(i=a.prev,g=a.next,d?iL(a,e,f,d):iK(a))b.push(i.i/c),b.push(a.i/c),b.push(g.i/c),i1(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?iJ(a=iM(iI(a),b,c),b,c,e,f,d,2):2===h&&iN(a,b,c,e,f,d):iJ(iI(a),b,c,e,f,d,1);break}}}function iK(b){var c=b.prev,d=b,e=b.next;if(iV(c,d,e)>=0)return!1;for(var a=b.next.next;a!==b.prev;){if(iT(c.x,c.y,d.x,d.y,e.x,e.y,a.x,a.y)&&iV(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function iL(f,g,h,i){var d=f.prev,e=f,a=f.next;if(iV(d,e,a)>=0)return!1;for(var l=d.x>e.x?d.x>a.x?d.x:a.x:e.x>a.x?e.x:a.x,m=d.y>e.y?d.y>a.y?d.y:a.y:e.y>a.y?e.y:a.y,j=iR(d.x=j&&c&&c.z<=k;){if(b!==f.prev&&b!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,b.x,b.y)&&iV(b.prev,b,b.next)>=0||(b=b.prevZ,c!==f.prev&&c!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,c.x,c.y)&&iV(c.prev,c,c.next)>=0))return!1;c=c.nextZ}for(;b&&b.z>=j;){if(b!==f.prev&&b!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,b.x,b.y)&&iV(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;c&&c.z<=k;){if(c!==f.prev&&c!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,c.x,c.y)&&iV(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function iM(d,e,f){var a=d;do{var c=a.prev,b=a.next.next;!iW(c,b)&&iX(c,a,a.next,b)&&i$(c,b)&&i$(b,c)&&(e.push(c.i/f),e.push(a.i/f),e.push(b.i/f),i1(a),i1(a.next),a=d=b),a=a.next}while(a!==d)return iI(a)}function iN(d,e,f,g,h,i){var a=d;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&iU(a,b)){var c=i_(a,b);return a=iI(a,a.next),c=iI(c,c.next),iJ(a,e,f,g,h,i),void iJ(c,e,f,g,h,i)}b=b.next}a=a.next}while(a!==d)}function iO(a,b){return a.x-b.x}function iP(c,b){var a=function(h,k){var b,a=k,d=h.x,c=h.y,e=-1/0;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y){var f=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(f<=d&&f>e){if(e=f,f===d){if(c===a.y)return a;if(c===a.next.y)return a.next}b=a.x=a.x&&a.x>=l&&d!==a.x&&iT(cb.x||a.x===b.x&&iQ(b,a)))&&(b=a,j=g)),a=a.next;while(a!==m)return b}(c,b);if(!a)return b;var d=i_(a,c),e=iI(a,a.next);return iI(d,d.next),b===a?e:b}function iQ(a,b){return 0>iV(a.prev,a,b.prev)&&0>iV(b.next,a,a.next)}function iR(a,b,d,e,c){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-d)*c)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-e)*c)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function iS(c){var a=c,b=c;do(a.x=0&&(c-a)*(f-b)-(e-a)*(d-b)>=0&&(e-a)*(h-b)-(g-a)*(f-b)>=0}function iU(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(b,c){var a=b;do{if(a.i!==b.i&&a.next.i!==b.i&&a.i!==c.i&&a.next.i!==c.i&&iX(a,a.next,b,c))return!0;a=a.next}while(a!==b)return!1}(a,b)&&(i$(a,b)&&i$(b,a)&&function(b,e){var a=b,c=!1,f=(b.x+e.x)/2,d=(b.y+e.y)/2;do a.y>d!=a.next.y>d&&a.next.y!==a.y&&f<(a.next.x-a.x)*(d-a.y)/(a.next.y-a.y)+a.x&&(c=!c),a=a.next;while(a!==b)return c}(a,b)&&(iV(a.prev,a,b.prev)||iV(a,b.prev,b))||iW(a,b)&&iV(a.prev,a,a.next)>0&&iV(b.prev,b,b.next)>0)}function iV(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function iW(a,b){return a.x===b.x&&a.y===b.y}function iX(a,b,c,d){var e=iZ(iV(a,b,c)),f=iZ(iV(a,b,d)),g=iZ(iV(c,d,a)),h=iZ(iV(c,d,b));return e!==f&&g!==h||!(0!==e||!iY(a,c,b))||!(0!==f||!iY(a,d,b))||!(0!==g||!iY(c,a,d))||!(0!==h||!iY(c,b,d))}function iY(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function iZ(a){return a>0?1:a<0?-1:0}function i$(a,b){return 0>iV(a.prev,a,a.next)?iV(a,b,a.next)>=0&&iV(a,a.prev,b)>=0:0>iV(a,b,a.prev)||0>iV(a,a.next,b)}function i_(a,b){var d=new i2(a.i,a.x,a.y),c=new i2(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,d.next=e,e.prev=d,c.next=d,d.prev=c,f.next=c,c.prev=f,c}function i0(c,d,e,b){var a=new i2(c,d,e);return b?(a.next=b.next,a.prev=b,b.next.prev=a,b.next=a):(a.prev=a,a.next=a),a}function i1(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function i2(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function i3(b,g,d,e){for(var f=0,a=g,c=d-e;ab;){if(d-b>600){var f=d-b+1,k=e-b+1,l=Math.log(f),i=.5*Math.exp(2*l/3),m=.5*Math.sqrt(l*i*(f-i)/f)*(k-f/2<0?-1:1);i5(a,e,Math.max(b,Math.floor(e-k*i/f+m)),Math.min(d,Math.floor(e+(f-k)*i/f+m)),g)}var j=a[e],h=b,c=d;for(i6(a,b,e),g(a[d],j)>0&&i6(a,b,d);hg(a[h],j);)h++;for(;g(a[c],j)>0;)c--}0===g(a[b],j)?i6(a,b,c):i6(a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function i6(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function i7(a,b){return ab?1:0}function i8(c,f){const i=c.length;if(i<=1)return[c];const a=[];let d,h;for(let e=0;e1)for(let b=0;b0&&c.holes.push(g+=b[a-1].length)}return c},dM.default=az;class dN{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new al,this.indexArray=new aq,this.indexArray2=new Y,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.segments2=new ay,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,b,l){this.hasPattern=ja("fill",this.layers,a);const d=this.layers[0].layout.get("fill-sort-key"),e=[];for(const{feature:c,id:m,index:n,sourceLayerIndex:o}of i){const j=this.layers[0]._featureFilter.needGeometry,f=id(c,j);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),f,b))continue;const p=d?d.evaluate(f,{},b,a.availableImages):void 0,q={id:m,properties:c.properties,type:c.type,sourceLayerIndex:o,index:n,geometry:j?f.geometry:ic(c,b,l),patterns:{},sortKey:p};e.push(q)}for(const g of(d&&e.sort((a,b)=>a.sortKey-b.sortKey),e)){const{geometry:k,index:h,sourceLayerIndex:r}=g;if(this.hasPattern){const s=jb("fill",this.layers,g,this.zoom,a);this.patternFeatures.push(s)}else this.addFeature(g,k,h,b,{},a.availableImages);a.featureIndex.insert(i[h].feature,k,h,r,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(e,b,c,d){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,iG),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(m,n,o,p,q,r=[]){for(const g of i8(n,500)){let h=0;for(const s of g)h+=s.length;const i=this.segments.prepareSegment(h,this.layoutVertexArray,this.indexArray),j=i.vertexLength,c=[],l=[];for(const a of g){if(0===a.length)continue;a!==g[0]&&l.push(c.length/2);const k=this.segments2.prepareSegment(a.length,this.layoutVertexArray,this.indexArray2),f=k.vertexLength;this.layoutVertexArray.emplaceBack(a[0].x,a[0].y),this.indexArray2.emplaceBack(f+a.length-1,f),c.push(a[0].x),c.push(a[0].y);for(let b=1;b>3}if(d--,1===c||2===c)f+=b.readSVarint(),g+=b.readSVarint(),1===c&&(a&&e.push(a),a=[]),a.push(new aF(f,g));else{if(7!==c)throw new Error("unknown command "+c);a&&a.push(a[0].clone())}}return a&&e.push(a),e},$.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var k=a.readVarint()+a.pos,b=1,e=0,c=0,d=0,f=1/0,g=-1/0,h=1/0,i=-1/0;a.pos>3}if(e--,1===b||2===b)(c+=a.readSVarint())g&&(g=c),(d+=a.readSVarint())i&&(i=d);else if(7!==b)throw new Error("unknown command "+b)}return[f,h,g,i]},$.prototype.toGeoJSON=function(h,i,j){var a,c,k=this.extent*Math.pow(2,j),l=this.extent*h,m=this.extent*i,b=this.loadGeometry(),d=$.types[this.type];function e(b){for(var a=0;a>3;c=1===b?a.readString():2===b?a.readFloat():3===b?a.readDouble():4===b?a.readVarint64():5===b?a.readVarint():6===b?a.readSVarint():7===b?a.readBoolean():null}return c}(c))}function ji(c,d,a){if(3===c){var b=new dR(a,a.readVarint()+a.pos);b.length&&(d[b.name]=b)}}dS.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var b=this._pbf.readVarint()+this._pbf.pos;return new dQ(this._pbf,b,this.extent,this._keys,this._values)};var _={VectorTile:function(a,b){this.layers=a.readFields(ji,{},b)},VectorTileFeature:dQ,VectorTileLayer:dR};const jj=_.VectorTileFeature.types;function jk(a,b,c,d,e,f,g,h){a.emplaceBack((b<<1)+g,(c<<1)+f,(Math.floor(8192*d)<<1)+e,Math.round(h))}class dT{constructor(){this.acc=new aF(0,0),this.polyCount=[]}startRing(a){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new aF(a.x,a.y),this.max=new aF(a.x,a.y))}append(a,c){this.currentPolyCount.edges++,this.acc._add(a);let b=!!this.borders;const d=this.min,e=this.max;a.xe.x&&(e.x=a.x,b=!0),a.ye.y&&(e.y=a.y,b=!0),((0===a.x||8192===a.x)&&a.x===c.x)!=((0===a.y||8192===a.y)&&a.y===c.y)&&this.processBorderOverlap(a,c),b&&this.checkBorderIntersection(a,c)}checkBorderIntersection(b,a){a.x<0!=b.x<0&&this.addBorderIntersection(0,aY(a.y,b.y,(0-a.x)/(b.x-a.x))),a.x>8192!=b.x>8192&&this.addBorderIntersection(1,aY(a.y,b.y,(8192-a.x)/(b.x-a.x))),a.y<0!=b.y<0&&this.addBorderIntersection(2,aY(a.x,b.x,(0-a.y)/(b.y-a.y))),a.y>8192!=b.y>8192&&this.addBorderIntersection(3,aY(a.x,b.x,(8192-a.y)/(b.y-a.y)))}addBorderIntersection(c,a){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],]);const b=this.borders[c];ab[1]&&(b[1]=a)}processBorderOverlap(a,b){if(a.x===b.x){if(a.y===b.y)return;const c=0===a.x?0:1;this.addBorderIntersection(c,b.y),this.addBorderIntersection(c,a.y)}else{const d=0===a.y?2:3;this.addBorderIntersection(d,b.x),this.addBorderIntersection(d,a.x)}}centroid(){const a=this.polyCount.reduce((a,b)=>a+b.edges,0);return 0!==a?this.acc.div(a)._round():new aF(0,0)}span(){return new aF(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((a,b)=>a+ +(b[0]!==Number.MAX_VALUE),0)}}class dU{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new am,this.centroidVertexArray=new di,this.indexArray=new aq,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.enableTerrain=a.enableTerrain}populate(i,b,c,j){for(const{feature:a,id:k,index:e,sourceLayerIndex:f}of(this.features=[],this.hasPattern=ja("fill-extrusion",this.layers,b),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(a){const b=Math.exp(Math.PI*(1-a.y/(1<a.x<=0)||l.every(a=>a.x>=8192)||l.every(a=>a.y<=0)||l.every(a=>a.y>=8192))continue;for(let u=0;u=1){const d=g[i-1];if(!jl(c,d)){a&&a.append(c,d),b.vertexLength+4>ay.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const n=c.sub(d)._perp(),o=n.x/(Math.abs(n.x)+Math.abs(n.y)),p=n.y>0?1:0,z=d.dist(c);f+z>32768&&(f=0),jk(this.layoutVertexArray,c.x,c.y,o,p,0,0,f),jk(this.layoutVertexArray,c.x,c.y,o,p,0,1,f),f+=z,jk(this.layoutVertexArray,d.x,d.y,o,p,0,0,f),jk(this.layoutVertexArray,d.x,d.y,o,p,0,1,f);const h=b.vertexLength;this.indexArray.emplaceBack(h,h+2,h+1),this.indexArray.emplaceBack(h+1,h+2,h+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+m>ay.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray)),"Polygon"!==jj[y.type])continue;const q=[],A=[],v=b.vertexLength;for(let w=0;w0){if(a.borders){a.vertexArrayOffset=this.centroidVertexArray.length;const G=a.borders,H=this.featuresOnBorder.push(a)-1;for(let t=0;t<4;t++)G[t][0]!==Number.MAX_VALUE&&this.borders[t].push(H)}this.encodeCentroid(a.borders?void 0:a.centroid(),a)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,y,C,E,F,D)}sortBorders(){for(let a=0;a<4;a++)this.borders[a].sort((b,c)=>this.featuresOnBorder[b].borders[a][0]-this.featuresOnBorder[c].borders[a][0])}encodeCentroid(b,e,f=!0){let c,a;if(b){if(0!==b.y){const h=e.span()._mult(this.tileToMeter);c=(Math.max(b.x,1)<<3)+Math.min(7,Math.round(h.x/10)),a=(Math.max(b.y,1)<<3)+Math.min(7,Math.round(h.y/10))}else c=Math.ceil(7*(b.x+450)),a=0}else c=0,a=+f;let g=f?this.centroidVertexArray.length:e.vertexArrayOffset;for(const d of e.polyCount){f&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*d.edges+d.top);for(let i=0;i<2*d.edges;i++)this.centroidVertexArray.emplace(g++,0,a),this.centroidVertexArray.emplace(g++,c,a);for(let j=0;j8192)||a.y===b.y&&(a.y<0||a.y>8192)}c("FillExtrusionBucket",dU,{omit:["layers","features"]}),c("PartMetadata",dT);var jm={paint:new n({"fill-extrusion-opacity":new e(b["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new g(b["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new e(b["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new e(b["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new N(b["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new g(b["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new g(b["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new e(b["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function jn(a,b){return a.x*b.x+a.y*b.y}function jo(i,a){if(1===i.length){let b=0;const c=a[b++];let d;for(;!d||c.equals(d);)if(!(d=a[b++]))return 1/0;for(;ba.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new a6,this.layoutVertexArray2=new an,this.indexArray=new aq,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(j,a,b,m){this.hasPattern=ja("line",this.layers,a);const e=this.layers[0].layout.get("line-sort-key"),f=[];for(const{feature:c,id:n,index:o,sourceLayerIndex:p}of j){const k=this.layers[0]._featureFilter.needGeometry,g=id(c,k);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),g,b))continue;const q=e?e.evaluate(g,{},b):void 0,r={id:n,properties:c.properties,type:c.type,sourceLayerIndex:p,index:o,geometry:k?g.geometry:ic(c,b,m),patterns:{},sortKey:q};f.push(r)}e&&f.sort((a,b)=>a.sortKey-b.sortKey);const{lineAtlas:h,featureIndex:s}=a,t=this.addConstantDashes(h);for(const d of f){const{geometry:l,index:i,sourceLayerIndex:u}=d;if(t&&this.addFeatureDashes(d,h),this.hasPattern){const v=jb("line",this.layers,d,this.zoom,a);this.patternFeatures.push(v)}else this.addFeature(d,l,i,b,h.positions,a.availableImages);s.insert(j[i].feature,l,i,u,this.index)}}addConstantDashes(b){let d=!1;for(const e of this.layers){const f=e.paint.get("line-dasharray").value,g=e.layout.get("line-cap").value;if("constant"!==f.kind||"constant"!==g.kind)d=!0;else{const c=g.value,a=f.value;if(!a)continue;b.addDash(a.from,c),b.addDash(a.to,c),a.other&&b.addDash(a.other,c)}}return d}addFeatureDashes(a,b){const c=this.zoom;for(const m of this.layers){const d=m.paint.get("line-dasharray").value,e=m.layout.get("line-cap").value;if("constant"===d.kind&&"constant"===e.kind)continue;let g,h,i,j,k,l;if("constant"===d.kind){const f=d.value;if(!f)continue;g=f.other||f.to,h=f.to,i=f.from}else g=d.evaluate({zoom:c-1},a),h=d.evaluate({zoom:c},a),i=d.evaluate({zoom:c+1},a);"constant"===e.kind?j=k=l=e.value:(j=e.evaluate({zoom:c-1},a),k=e.evaluate({zoom:c},a),l=e.evaluate({zoom:c+1},a)),b.addDash(g,j),b.addDash(h,k),b.addDash(i,l);const n=b.getKey(g,j),o=b.getKey(h,k),p=b.getKey(i,l);a.patterns[m.id]={min:n,mid:o,max:p}}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(e,b,c,d){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,js)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,jr),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&a.properties.hasOwnProperty("mapbox_clip_start")&&a.properties.hasOwnProperty("mapbox_clip_end"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,c,d,e,f,g){const b=this.layers[0].layout,h=b.get("line-join").evaluate(a,{}),i=b.get("line-cap").evaluate(a,{}),j=b.get("line-miter-limit"),k=b.get("line-round-limit");for(const l of(this.lineClips=this.lineFeatureClips(a),c))this.addLine(l,a,h,i,j,k);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,d,f,g,e)}addLine(g,K,A,L,v,M){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let q=0;q=2&&g[i-1].equals(g[i-2]);)i--;let l=0;for(;l0;if(B&&m>l){const C=a.dist(h);if(C>2*s){const w=a.sub(a.sub(h)._mult(s/C)._round());this.updateDistance(h,w),this.addCurrentVertex(w,d,0,0,c),h=w}}const D=h&&j;let e=D?A:r?"butt":L;if(D&&"round"===e&&(kv&&(e="bevel"),"bevel"===e&&(k>2&&(e="flipbevel"),k100)f=b.mult(-1);else{const O=k*d.add(b).mag()/d.sub(b).mag();f._perp()._mult(O*(p?-1:1))}this.addCurrentVertex(a,f,0,0,c),this.addCurrentVertex(a,f.mult(-1),0,0,c)}else if("bevel"===e||"fakeround"===e){const E=-Math.sqrt(k*k-1),F=p?E:0,G=p?0:E;if(h&&this.addCurrentVertex(a,d,F,G,c),"fakeround"===e){const H=Math.round(180*N/Math.PI/20);for(let x=1;x2*s){const z=a.add(j.sub(a)._mult(s/J)._round());this.updateDistance(a,z),this.addCurrentVertex(z,b,0,0,c),a=z}}}}addCurrentVertex(d,a,b,c,e,f=!1){const g=a.y*c-a.x,h=-a.y-a.x*c;this.addHalfVertex(d,a.x+a.y*b,a.y-a.x*b,f,!1,b,e),this.addHalfVertex(d,g,h,f,!0,-c,e)}addHalfVertex({x:e,y:f},g,h,i,b,c,d){this.layoutVertexArray.emplaceBack((e<<1)+(i?1:0),(f<<1)+(b?1:0),Math.round(63*g)+128,Math.round(63*h)+128,1+(0===c?0:c<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const a=d.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,a),d.primitiveLength++),b?this.e2=a:this.e1=a}updateScaledDistance(){if(this.lineClips){const a=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=a*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(a,b){this.distance+=a.dist(b),this.updateScaledDistance()}}c("LineBucket",dX,{omit:["layers","patternFeatures"]});const dY=new n({"line-cap":new g(b.layout_line["line-cap"]),"line-join":new g(b.layout_line["line-join"]),"line-miter-limit":new e(b.layout_line["line-miter-limit"]),"line-round-limit":new e(b.layout_line["line-round-limit"]),"line-sort-key":new g(b.layout_line["line-sort-key"])});var dZ={paint:new n({"line-opacity":new g(b.paint_line["line-opacity"]),"line-color":new g(b.paint_line["line-color"]),"line-translate":new e(b.paint_line["line-translate"]),"line-translate-anchor":new e(b.paint_line["line-translate-anchor"]),"line-width":new g(b.paint_line["line-width"]),"line-gap-width":new g(b.paint_line["line-gap-width"]),"line-offset":new g(b.paint_line["line-offset"]),"line-blur":new g(b.paint_line["line-blur"]),"line-dasharray":new N(b.paint_line["line-dasharray"]),"line-pattern":new N(b.paint_line["line-pattern"]),"line-gradient":new V(b.paint_line["line-gradient"])}),layout:dY};const d$=new class extends g{possiblyEvaluate(b,a){return a=new c5(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(b,a)}evaluate(b,a,c,d){return a=bR({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(b,a,c,d)}}(dZ.paint.properties["line-width"].specification);function jv(a,b){return b>0?b+2*a:a}d$.useIntegerZoom=!0;const jw=j([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"},],4),jx=j([{name:"a_projected_pos",components:3,type:"Float32"},],4);j([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const jy=j([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),jz=j([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);j([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},]);const jA=j([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),d_=j([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function d0(e,i){const{expression:a}=i;if("constant"===a.kind)return{kind:"constant",layoutSize:a.evaluate(new c5(e+1))};if("source"===a.kind)return{kind:"source"};{const{zoomStops:b,interpolationType:h}=a;let c=0;for(;c{a.text=function(a,c,d){const b=c.layout.get("text-transform").evaluate(d,{});return"uppercase"===b?a=a.toLocaleUpperCase():"lowercase"===b&&(a=a.toLocaleLowerCase()),c4.applyArabicShaping&&(a=c4.applyArabicShaping(a)),a}(a.text,b,c)}),a}const jC={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xa2":"\uFFE0","\xa3":"\uFFE1","\xa5":"\uFFE5","\xa6":"\uFFE4","\xac":"\uFFE2","\xaf":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function jD(a){return"\uFE36"===a||"\uFE48"===a||"\uFE38"===a||"\uFE44"===a||"\uFE42"===a||"\uFE3E"===a||"\uFE3C"===a||"\uFE3A"===a||"\uFE18"===a||"\uFE40"===a||"\uFE10"===a||"\uFE13"===a||"\uFE14"===a||"\uFF40"===a||"\uFFE3"===a||"\uFE11"===a||"\uFE12"===a}function jE(a){return"\uFE35"===a||"\uFE47"===a||"\uFE37"===a||"\uFE43"===a||"\uFE41"===a||"\uFE3D"===a||"\uFE3B"===a||"\uFE39"===a||"\uFE17"===a||"\uFE3F"===a}var jF=function(g,h,j,e,k){var a,c,l=8*k-e-1,m=(1<>1,b=-7,d=j?k-1:0,i=j?-1:1,f=g[h+d];for(d+=i,a=f&(1<< -b)-1,f>>=-b,b+=l;b>0;a=256*a+g[h+d],d+=i,b-=8);for(c=a&(1<< -b)-1,a>>=-b,b+=e;b>0;c=256*c+g[h+d],d+=i,b-=8);if(0===a)a=1-n;else{if(a===m)return c?NaN:1/0*(f?-1:1);c+=Math.pow(2,e),a-=n}return(f?-1:1)*c*Math.pow(2,a-e)},jG=function(j,b,k,m,c,n){var a,d,e,h=8*n-c-1,i=(1<>1,o=23===c?5960464477539062e-23:0,g=m?0:n-1,l=m?1:-1,p=b<0||0===b&&1/b<0?1:0;for(isNaN(b=Math.abs(b))||b===1/0?(d=isNaN(b)?1:0,a=i):(a=Math.floor(Math.log(b)/Math.LN2),b*(e=Math.pow(2,-a))<1&&(a--,e*=2),(b+=a+f>=1?o/e:o*Math.pow(2,1-f))*e>=2&&(a++,e/=2),a+f>=i?(d=0,a=i):a+f>=1?(d=(b*e-1)*Math.pow(2,c),a+=f):(d=b*Math.pow(2,f-1)*Math.pow(2,c),a=0));c>=8;j[k+g]=255&d,g+=l,d/=256,c-=8);for(a=a<0;j[k+g]=255&a,g+=l,a/=256,h-=8);j[k+g-l]|=128*p},d2=P;function P(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}P.Varint=0,P.Fixed64=1,P.Bytes=2,P.Fixed32=5;var jH="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function jI(a){return a.type===P.Bytes?a.readVarint()+a.pos:a.pos+1}function jJ(e,a,b){var d=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));b.realloc(d);for(var c=b.pos-1;c>=e;c--)b.buf[c+d]=b.buf[c]}function jK(b,c){for(var a=0;a>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function jV(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function jW(b,a,c){a.glyphs=[],1===b&&c.readMessage(jX,a)}function jX(a,b,c){if(3===a){const{id:f,bitmap:g,width:d,height:e,left:h,top:i,advance:j}=c.readMessage(jY,{});b.glyphs.push({id:f,bitmap:new dJ({width:d+6,height:e+6},g),metrics:{width:d,height:e,left:h,top:i,advance:j}})}else 4===a?b.ascender=c.readSVarint():5===a&&(b.descender=c.readSVarint())}function jY(a,b,c){1===a?b.id=c.readVarint():2===a?b.bitmap=c.readBytes():3===a?b.width=c.readVarint():4===a?b.height=c.readVarint():5===a?b.left=c.readSVarint():6===a?b.top=c.readSVarint():7===a&&(b.advance=c.readVarint())}function d3(g){let h=0,i=0;for(const j of g)h+=j.w*j.h,i=Math.max(i,j.w);g.sort((a,b)=>b.h-a.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(h/.95)),i),h:1/0},];let e=0,f=0;for(const a of g)for(let d=c.length-1;d>=0;d--){const b=c[d];if(!(a.w>b.w||a.h>b.h)){if(a.x=b.x,a.y=b.y,f=Math.max(f,a.y+a.h),e=Math.max(e,a.x+a.w),a.w===b.w&&a.h===b.h){const k=c.pop();d>3,f=this.pos;this.type=7&b,d(e,c,this),this.pos===f&&this.skip(b)}return c},readMessage:function(a,b){return this.readFields(a,b,this.readVarint()+this.pos)},readFixed32:function(){var a=jT(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=jV(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=jT(this.buf,this.pos)+4294967296*jT(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=jT(this.buf,this.pos)+4294967296*jV(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=jF(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=jF(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(d){var a,b,c=this.buf;return a=127&(b=c[this.pos++]),b<128?a:(a|=(127&(b=c[this.pos++]))<<7,b<128?a:(a|=(127&(b=c[this.pos++]))<<14,b<128?a:(a|=(127&(b=c[this.pos++]))<<21,b<128?a:function(g,h,b){var e,f,c,a,d=b.buf;if(c=(112&(a=d[b.pos++]))>>4,a<128||(c|=(127&(a=d[b.pos++]))<<3,a<128)||(c|=(127&(a=d[b.pos++]))<<10,a<128)||(c|=(127&(a=d[b.pos++]))<<17,a<128)||(c|=(127&(a=d[b.pos++]))<<24,a<128)||(c|=(1&(a=d[b.pos++]))<<31,a<128))return e=g,f=c,h?4294967296*f+(e>>>0):4294967296*(f>>>0)+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(a|=(15&(b=c[this.pos]))<<28,d,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?-((a+1)/2):a/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var c,d,e,a=this.readVarint()+this.pos,b=this.pos;return this.pos=a,a-b>=12&&jH?(c=this.buf,d=b,e=a,jH.decode(c.subarray(d,e))):function(d,k,j){for(var h="",b=k;b239?4:c>223?3:c>191?2:1;if(b+e>j)break;1===e?c<128&&(a=c):2===e?128==(192&(f=d[b+1]))&&(a=(31&c)<<6|63&f)<=127&&(a=null):3===e?(g=d[b+2],128==(192&(f=d[b+1]))&&128==(192&g)&&((a=(15&c)<<12|(63&f)<<6|63&g)<=2047||a>=55296&&a<=57343)&&(a=null)):4===e&&(g=d[b+2],i=d[b+3],128==(192&(f=d[b+1]))&&128==(192&g)&&128==(192&i)&&((a=(15&c)<<18|(63&f)<<12|(63&g)<<6|63&i)<=65535||a>=1114112)&&(a=null)),null===a?(a=65533,e=1):a>65535&&(a-=65536,h+=String.fromCharCode(a>>>10&1023|55296),a=56320|1023&a),h+=String.fromCharCode(a),b+=e}return h}(this.buf,b,a)},readBytes:function(){var a=this.readVarint()+this.pos,b=this.buf.subarray(this.pos,a);return this.pos=a,b},readPackedVarint:function(a,b){if(this.type!==P.Bytes)return a.push(this.readVarint(b));var c=jI(this);for(a=a||[];this.pos127;);else if(a===P.Bytes)this.pos=this.readVarint()+this.pos;else if(a===P.Fixed32)this.pos+=4;else{if(a!==P.Fixed64)throw new Error("Unimplemented type: "+a);this.pos+=8}},writeTag:function(a,b){this.writeVarint(a<<3|b)},realloc:function(c){for(var a=this.length||16;a268435455||a<0?function(e,h){var f,g,d,c,a,b,i;if(e>=0?(f=e%4294967296|0,g=e/4294967296|0):(g=~(-e/4294967296),4294967295^(f=~(-e%4294967296))?f=f+1|0:(f=0,g=g+1|0)),e>=18446744073709552e3||e< -18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),d=f,(c=h).buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,c.buf[c.pos]=127&(d>>>=7),a=g,b=h,i=(7&a)<<4,b.buf[b.pos++]|=i|((a>>>=3)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a)))))}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?-(2*a)-1:2*a)},writeBoolean:function(a){this.writeVarint(Boolean(a))},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var c=this.pos;this.pos=function(c,f,b){for(var a,d,e=0;e55295&&a<57344){if(!d){a>56319||e+1===f.length?(c[b++]=239,c[b++]=191,c[b++]=189):d=a;continue}if(a<56320){c[b++]=239,c[b++]=191,c[b++]=189,d=a;continue}a=d-55296<<10|a-56320|65536,d=null}else d&&(c[b++]=239,c[b++]=191,c[b++]=189,d=null);a<128?c[b++]=a:(a<2048?c[b++]=a>>6|192:(a<65536?c[b++]=a>>12|224:(c[b++]=a>>18|240,c[b++]=a>>12&63|128),c[b++]=a>>6&63|128),c[b++]=63&a|128)}return b}(this.buf,a,this.pos);var b=this.pos-c;b>=128&&jJ(c,b,this),this.pos=c-1,this.writeVarint(b),this.pos+=b},writeFloat:function(a){this.realloc(4),jG(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),jG(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var a=c.length;this.writeVarint(a),this.realloc(a);for(var b=0;b=128&&jJ(b,a,this),this.pos=b-1,this.writeVarint(a),this.pos+=a},writeMessage:function(a,b,c){this.writeTag(a,P.Bytes),this.writeRawMessage(b,c)},writePackedVarint:function(b,a){a.length&&this.writeMessage(b,jK,a)},writePackedSVarint:function(b,a){a.length&&this.writeMessage(b,jL,a)},writePackedBoolean:function(b,a){a.length&&this.writeMessage(b,jO,a)},writePackedFloat:function(b,a){a.length&&this.writeMessage(b,jM,a)},writePackedDouble:function(b,a){a.length&&this.writeMessage(b,jN,a)},writePackedFixed32:function(b,a){a.length&&this.writeMessage(b,jP,a)},writePackedSFixed32:function(b,a){a.length&&this.writeMessage(b,jQ,a)},writePackedFixed64:function(b,a){a.length&&this.writeMessage(b,jR,a)},writePackedSFixed64:function(b,a){a.length&&this.writeMessage(b,jS,a)},writeBytesField:function(a,b){this.writeTag(a,P.Bytes),this.writeBytes(b)},writeFixed32Field:function(a,b){this.writeTag(a,P.Fixed32),this.writeFixed32(b)},writeSFixed32Field:function(a,b){this.writeTag(a,P.Fixed32),this.writeSFixed32(b)},writeFixed64Field:function(a,b){this.writeTag(a,P.Fixed64),this.writeFixed64(b)},writeSFixed64Field:function(a,b){this.writeTag(a,P.Fixed64),this.writeSFixed64(b)},writeVarintField:function(a,b){this.writeTag(a,P.Varint),this.writeVarint(b)},writeSVarintField:function(a,b){this.writeTag(a,P.Varint),this.writeSVarint(b)},writeStringField:function(a,b){this.writeTag(a,P.Bytes),this.writeString(b)},writeFloatField:function(a,b){this.writeTag(a,P.Fixed32),this.writeFloat(b)},writeDoubleField:function(a,b){this.writeTag(a,P.Fixed64),this.writeDouble(b)},writeBooleanField:function(a,b){this.writeVarintField(a,Boolean(b))}};class bj{constructor(a,{pixelRatio:b,version:c,stretchX:d,stretchY:e,content:f}){this.paddedRect=a,this.pixelRatio=b,this.stretchX=d,this.stretchY=e,this.content=f,this.version=c}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1,]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1,]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio,]}}class d4{constructor(g,h){const i={},j={};this.haveRenderCallbacks=[];const k=[];this.addImages(g,i,k),this.addImages(h,j,k);const{w:q,h:r}=d3(k),b=new bg({width:q||1,height:r||1});for(const l in g){const m=g[l],n=i[l].paddedRect;bg.copy(m.data,b,{x:0,y:0},{x:n.x+1,y:n.y+1},m.data)}for(const o in h){const a=h[o],p=j[o].paddedRect,c=p.x+1,d=p.y+1,e=a.data.width,f=a.data.height;bg.copy(a.data,b,{x:0,y:0},{x:c,y:d},a.data),bg.copy(a.data,b,{x:0,y:f-1},{x:c,y:d-1},{width:e,height:1}),bg.copy(a.data,b,{x:0,y:0},{x:c,y:d+f},{width:e,height:1}),bg.copy(a.data,b,{x:e-1,y:0},{x:c-1,y:d},{width:1,height:f}),bg.copy(a.data,b,{x:0,y:0},{x:c+e,y:d},{width:1,height:f})}this.image=b,this.iconPositions=i,this.patternPositions=j}addImages(c,e,f){for(const b in c){const a=c[b],d={x:0,y:0,w:a.data.width+2,h:a.data.height+2};f.push(d),e[b]=new bj(d,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(b)}}patchUpdatedImages(a,c){for(const b in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[b],a.getImage(b),c),this.patchUpdatedImage(this.patternPositions[b],a.getImage(b),c)}patchUpdatedImage(a,b,c){if(!a||!b||a.version===b.version)return;a.version=b.version;const[d,e]=a.tl;c.update(b.data,void 0,{x:d,y:e})}}c("ImagePosition",bj),c("ImageAtlas",d4);const d5={horizontal:1,vertical:2,horizontalOnly:3};class jZ{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(b,c){const a=new jZ;return a.scale=b||1,a.fontStack=c,a}static forImage(b){const a=new jZ;return a.imageName=b,a}}class j${constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(d,e){const a=new j$;for(let b=0;b=0&&b>=a&&j0[this.text.charCodeAt(b)];b--)d--;this.text=this.text.substring(a,d),this.sectionIndex=this.sectionIndex.slice(a,d)}substring(b,c){const a=new j$;return a.text=this.text.substring(b,c),a.sectionIndex=this.sectionIndex.slice(b,c),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,b)=>Math.max(a,this.sections[b].scale),0)}addTextSection(a,c){this.text+=a.text,this.sections.push(jZ.forText(a.scale,a.fontStack||c));const d=this.sections.length-1;for(let b=0;b=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function j_(u,c,v,d,w,i,x,y,z,e,f,j,m,k,l,A){const a=j$.fromFeature(u,w);let b;j===d5.vertical&&a.verticalizePunctuation(m);const{processBidirectionalText:n,processStyledBidirectionalText:o}=c4;if(n&&1===a.sections.length){b=[];const B=n(a.toString(),j7(a,e,i,c,d,k,l));for(const p of B){const g=new j$;g.text=p,g.sections=a.sections;for(let q=0;q0&&D>k&&(k=D)}else{const E=U[e.fontStack];if(!E)continue;E[c]&&(u=E[c]);const l=H[e.fontStack];if(!l)continue;const P=l.glyphs[c];if(!P)continue;if(d=P.metrics,B=8203!==c?24:0,i){const F=void 0!==l.ascender?Math.abs(l.ascender):0,Q=void 0!==l.descender?Math.abs(l.descender):0,R=(F+Q)*a;M=0;let f=0;for(let c=0;c -j/2;){if(--a<0)return!1;c-=b[a].dist(k),k=b[a]}c+=b[a].dist(b[a+1]),a++;const f=[];let g=0;for(;cl;)g-=f.shift().angleDelta;if(g>m)return!1;a++,c+=h.dist(i)}return!0}function kc(b){let c=0;for(let a=0;aj){const k=(j-e)/f,q=aY(c.x,d.x,k),r=aY(c.y,d.y,k),l=new d7(q,r,0,d.angleTo(c),b);return!i||kb(a,l,p,i,m)?l:void 0}e+=f}}function kg(b,a,k,f,l,g,c,h,d){const m=kd(f,g,c),i=ke(f,l),e=i*c,j=0===b[0].x||b[0].x===d||0===b[0].y||b[0].y===d;return a-e=0&&m=0&&n=0&&b+r<=v){const o=new d7(m,n,0,w,c);o._round(),i&&!kb(a,o,j,i,p)||f.push(o)}}e+=l}return u||f.length||q||(f=kh(a,e/2,d,i,p,j,q,!0,k)),f}function d8(k,c,d,e,f){const l=[];for(let i=0;i=e&&b.x>=e||(a.x>=e?a=new aF(e,a.y+(e-a.x)/(b.x-a.x)*(b.y-a.y))._round():b.x>=e&&(b=new aF(e,a.y+(e-a.x)/(b.x-a.x)*(b.y-a.y))._round()),a.y>=f&&b.y>=f||(a.y>=f?a=new aF(a.x+(f-a.y)/(b.y-a.y)*(b.x-a.x),f)._round():b.y>=f&&(b=new aF(a.x+(f-a.y)/(b.y-a.y)*(b.x-a.x),f)._round()),g&&a.equals(g[g.length-1])||(g=[a],l.push(g)),g.push(b)))))}}return l}function ki(f,a,b,g,h,c,i,j,k){for(let d=a;d -1)f[++c]=a,b[c]=j,b[c+1]=1e20}for(let e=0,k=0;e{let a=this.entries[b];a||(a=this.entries[b]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let d=a.glyphs[c];if(void 0!==d)return void f(null,{stack:b,id:c,glyph:d});if(d=this._tinySDF(a,b,c))return a.glyphs[c]=d,void f(null,{stack:b,id:c,glyph:d});const e=Math.floor(c/256);if(256*e>65535)return void f(new Error("glyphs > 65535 not supported"));if(a.ranges[e])return void f(null,{stack:b,id:c,glyph:d});let g=a.requests[e];g||(g=a.requests[e]=[],aA.loadGlyphRange(b,e,this.url,this.requestManager,(d,b)=>{if(b){for(const c in a.ascender=b.ascender,a.descender=b.descender,b.glyphs)this._doesCharSupportLocalGlyph(+c)||(a.glyphs[+c]=b.glyphs[+c]);a.ranges[e]=!0}for(const f of g)f(d,b);delete a.requests[e]})),g.push((a,d)=>{a?f(a):d&&f(null,{stack:b,id:c,glyph:d.glyphs[c]||null})})},(d,f)=>{if(d)e(d);else if(f){const b={};for(const{stack:a,id:g,glyph:c}of f)void 0===b[a]&&(b[a]={}),void 0===b[a].glyphs&&(b[a].glyphs={}),b[a].glyphs[g]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics},b[a].ascender=this.entries[a].ascender,b[a].descender=this.entries[a].descender;e(null,b)}})}_doesCharSupportLocalGlyph(a){return this.localGlyphMode!==d9.none&&(this.localGlyphMode===d9.all?!!this.localFontFamily:!!this.localFontFamily&&(hh(a)||hk(a)||g8(a)||g9(a))||g7(a))}_tinySDF(e,d,a){const f=this.localFontFamily;if(!f||!this._doesCharSupportLocalGlyph(a))return;let b=e.tinySDF;if(!b){let c="400";/bold/i.test(d)?c="900":/medium/i.test(d)?c="500":/light/i.test(d)&&(c="200"),(b=e.tinySDF=new aA.TinySDF({fontFamily:f,fontWeight:c,fontSize:48,buffer:6,radius:16})).fontWeight=c}if(this.localGlyphs[b.fontWeight][a])return this.localGlyphs[b.fontWeight][a];const g=String.fromCharCode(a),{data:h,width:i,height:j,glyphWidth:k,glyphHeight:l,glyphLeft:m,glyphTop:n,glyphAdvance:o}=b.draw(g);return this.localGlyphs[b.fontWeight][a]={id:a,bitmap:new dJ({width:i,height:j},h),metrics:{width:k/2,height:l/2,left:m/2,top:n/2-27,advance:o/2,localGlyph:!0}}}}function kk(c,D,E,o){const h=[],b=c.image,F=b.pixelRatio,i=b.paddedRect.w-2,j=b.paddedRect.h-2,G=c.right-c.left,H=c.bottom-c.top,d=b.stretchX||[[0,i]],e=b.stretchY||[[0,j]],p=(b,a)=>b+a[1]-a[0],k=d.reduce(p,0),l=e.reduce(p,0),q=i-k,r=j-l;let s=0,t=k,u=0,v=l,x=0,y=q,z=0,A=r;if(b.content&&o){const a=b.content;s=kl(d,0,a[0]),u=kl(e,0,a[1]),t=kl(d,a[0],a[2]),v=kl(e,a[1],a[3]),x=a[0]-s,z=a[1]-u,y=a[2]-a[0]-t,A=a[3]-a[1]-v}const w=(a,d,e,f)=>{const i=(a.stretch-s)/t*G+c.left,J=a.fixed-x-y*a.stretch/k,j=(d.stretch-u)/v*H+c.top,K=d.fixed-z-A*d.stretch/l,m=(e.stretch-s)/t*G+c.left,L=e.fixed-x-y*e.stretch/k,n=(f.stretch-u)/v*H+c.top,M=f.fixed-z-A*f.stretch/l,o=new aF(i,j),p=new aF(m,j),q=new aF(m,n),r=new aF(i,n),N=new aF(J/F,K/F),O=new aF(L/F,M/F),h=D*Math.PI/180;if(h){const w=Math.sin(h),B=Math.cos(h),g=[B,-w,w,B];o._matMult(g),p._matMult(g),r._matMult(g),q._matMult(g)}const C=a.stretch+a.fixed,I=d.stretch+d.fixed;return{tl:o,tr:p,bl:r,br:q,tex:{x:b.paddedRect.x+1+C,y:b.paddedRect.y+1+I,w:e.stretch+e.fixed-C,h:f.stretch+f.fixed-I},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:N,pixelOffsetBR:O,minFontScaleX:y/F/G,minFontScaleY:A/F/H,isSDF:E}};if(o&&(b.stretchX||b.stretchY)){const m=km(d,q,k),n=km(e,r,l);for(let f=0;f{if(b)g(b);else if(c){var d;const e={},a=(d=c,new d2(d).readFields(jW,{}));for(const f of a.glyphs)e[f.id]=f;g(null,{glyphs:e,ascender:a.ascender,descender:a.descender})}})},aA.TinySDF=class{constructor({fontSize:c=24,buffer:d=3,radius:e=8,cutoff:f=.25,fontFamily:g="sans-serif",fontWeight:h="normal",fontStyle:i="normal"}){this.buffer=d,this.cutoff=f,this.radius=e;const a=this.size=c+4*d,j=this._createCanvas(a),b=this.ctx=j.getContext("2d",{willReadFrequently:!0});b.font=`${i} ${h} ${c}px ${g}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(b){const a=document.createElement("canvas");return a.width=a.height=b,a}draw(p){const{width:u,actualBoundingBoxAscent:q,actualBoundingBoxDescent:v,actualBoundingBoxLeft:w,actualBoundingBoxRight:x}=this.ctx.measureText(p),r=Math.floor(q),b=Math.min(this.size-this.buffer,Math.ceil(x-w)),c=Math.min(this.size-this.buffer,Math.ceil(q)+Math.ceil(v)),d=b+2*this.buffer,m=c+2*this.buffer,i=d*m,s=new Uint8ClampedArray(i),t={data:s,width:d,height:m,glyphWidth:b,glyphHeight:c,glyphTop:r,glyphLeft:0,glyphAdvance:u};if(0===b||0===c)return t;const{ctx:n,buffer:a,gridInner:f,gridOuter:g}=this;n.clearRect(a,a,b,c),n.fillText(p,a,a+r+1);const y=n.getImageData(a,a,b,c);g.fill(1e20,0,i),f.fill(0,0,i);for(let j=0;j0?e*e:0,f[l]=e<0?e*e:0}}ki(g,0,0,d,m,d,this.f,this.v,this.z),ki(f,a,a,b,c,d,this.f,this.v,this.z);for(let h=0;hb?1:0}){if(this.data=b,this.length=this.data.length,this.compare=c,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const a=this.data[0],b=this.data.pop();return this.length--,this.length>0&&(this.data[0]=b,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:b,compare:f}=this,c=b[a];for(;a>0;){const d=a-1>>1,e=b[d];if(f(c,e)>=0)break;b[a]=e,a=d}b[a]=c}_down(a){const{data:b,compare:f}=this,h=this.length>>1,g=b[a];for(;af(b[e],d)&&(c=e,d=b[e]),f(d,g)>=0)break;b[a]=d,a=c}b[a]=g}}function kp(e,r=1,p=!1){let h=1/0,i=1/0,j=-1/0,k=-1/0;const q=e[0];for(let f=0;fj)&&(j=c.x),(!f||c.y>k)&&(k=c.y)}const l=Math.min(j-h,k-i);let a=l/2;const d=new ko([],kq);if(0===l)return new aF(h,i);for(let m=h;mg.d||!g.d)&&(g=b,p&&console.log("found best %d after %d probes",Math.round(1e4*b.d)/1e4,o)),b.max-g.d<=r||(a=b.h/2,d.push(new kr(b.p.x-a,b.p.y-a,a,e)),d.push(new kr(b.p.x+a,b.p.y-a,a,e)),d.push(new kr(b.p.x-a,b.p.y+a,a,e)),d.push(new kr(b.p.x+a,b.p.y+a,a,e)),o+=4)}return p&&(console.log(`num probes: ${o}`),console.log(`best distance: ${g.d}`)),g.p}function kq(a,b){return b.max-a.max}function kr(a,b,c,d){this.p=new aF(a,b),this.h=c,this.d=function(b,i){let d=!1,e=1/0;for(let f=0;fb.y!=c.y>b.y&&b.x<(c.x-a.x)*(b.y-a.y)/(c.y-a.y)+a.x&&(d=!d),e=Math.min(e,im(b,a,c))}}return(d?1:-1)*Math.sqrt(e)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const ks=Number.POSITIVE_INFINITY,kt=Math.sqrt(2);function ea(b,a){return a[1]!==ks?function(e,a,b){let c=0,d=0;switch(a=Math.abs(a),b=Math.abs(b),e){case"top-right":case"top-left":case"top":d=b-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-b}switch(e){case"top-right":case"bottom-right":case"right":c=-a;break;case"top-left":case"bottom-left":case"left":c=a}return[c,d]}(b,a[0],a[1]):function(e,a){let b=0,c=0;a<0&&(a=0);const d=a/kt;switch(e){case"top-right":case"top-left":c=d-7;break;case"bottom-right":case"bottom-left":c=7-d;break;case"bottom":c=7-a;break;case"top":c=a-7}switch(e){case"top-right":case"bottom-right":b=-d;break;case"top-left":case"bottom-left":b=d;break;case"left":b=a;break;case"right":b=-a}return[b,c]}(b,a[0])}function ku(a,w,x,y,n,M,N,b,o,O){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const d=a.layers[0].layout,g=a.layers[0]._unevaluatedLayout._values,e={};if("composite"===a.textSizeData.kind){const{minZoom:P,maxZoom:Q}=a.textSizeData;e.compositeTextSizes=[g["text-size"].possiblyEvaluate(new c5(P),b),g["text-size"].possiblyEvaluate(new c5(Q),b),]}if("composite"===a.iconSizeData.kind){const{minZoom:R,maxZoom:S}=a.iconSizeData;e.compositeIconSizes=[g["icon-size"].possiblyEvaluate(new c5(R),b),g["icon-size"].possiblyEvaluate(new c5(S),b),]}e.layoutTextSize=g["text-size"].possiblyEvaluate(new c5(o+1),b),e.layoutIconSize=g["icon-size"].possiblyEvaluate(new c5(o+1),b),e.textMaxSize=g["text-size"].possiblyEvaluate(new c5(18),b);const z="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),T=d.get("text-size");for(const c of a.features){const A=d.get("text-font").evaluate(c,{},b).join(","),B=T.evaluate(c,{},b),p=e.layoutTextSize.evaluate(c,{},b),f=(e.layoutIconSize.evaluate(c,{},b),{horizontal:{},vertical:void 0}),k=c.text;let q,l=[0,0];if(k){const C=k.toString(),U=24*d.get("text-letter-spacing").evaluate(c,{},b),D=24*d.get("text-line-height").evaluate(c,{},b),E=ht(C)?U:0,r=d.get("text-anchor").evaluate(c,{},b),s=d.get("text-variable-anchor");if(!s){const F=d.get("text-radial-offset").evaluate(c,{},b);l=F?ea(r,[24*F,ks]):d.get("text-offset").evaluate(c,{},b).map(a=>24*a)}let h=z?"center":d.get("text-justify").evaluate(c,{},b);const i=d.get("symbol-placement"),V="point"===i,G="point"===i?24*d.get("text-max-width").evaluate(c,{},b):0,H=b=>{a.allowVerticalPlacement&&hs(C)&&(f.vertical=j_(k,w,x,n,A,G,D,r,b,E,l,d5.vertical,!0,i,p,B))};if(!z&&s){const I="auto"===h?s.map(a=>eb(a)):[h];let J=!1;for(let t=0;t=0||!hs(C)){const K=j_(k,w,x,n,A,G,D,r,h,E,l,d5.horizontal,!1,i,p,B);K&&(f.horizontal[h]=K)}H("point"===i?"left":h)}}let L=!1;if(c.icon&&c.icon.name){const j=y[c.icon.name];j&&(q=j9(n[c.icon.name],d.get("icon-offset").evaluate(c,{},b),d.get("icon-anchor").evaluate(c,{},b)),L=j.sdf,void 0===a.sdfIcons?a.sdfIcons=j.sdf:a.sdfIcons!==j.sdf&&bY("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==a.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(a.iconsNeedLinear=!0))}const v=ky(f.horizontal)||f.vertical;a.iconsInText||(a.iconsInText=!!v&&v.iconsInText),(v||q)&&kv(a,c,f,q,y,e,p,0,l,L,N,b,O)}M&&a.generateCollisionDebugBuffers(o,a.collisionBoxArray)}function eb(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kv(c,b,e,f,F,A,n,G,H,I,J,d,K){let i=A.textMaxSize.evaluate(b,{},d);void 0===i&&(i=n);const a=c.layers[0].layout,o=a.get("icon-offset").evaluate(b,{},d),g=ky(e.horizontal)||e.vertical,p=n/24,q=c.tilePixelRatio*i/24,r=c.tilePixelRatio*a.get("symbol-spacing"),L=a.get("text-padding")*c.tilePixelRatio,M=a.get("icon-padding")*c.tilePixelRatio,s=a.get("text-max-angle")*aP,N="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement"),O="map"===a.get("icon-rotation-alignment")&&"point"!==a.get("symbol-placement"),t=a.get("symbol-placement"),B=r/2,j=a.get("icon-text-fit");let C;f&&"none"!==j&&(c.allowVerticalPlacement&&e.vertical&&(C=ka(f,e.vertical,j,a.get("icon-text-fit-padding"),o,p)),g&&(f=ka(f,g,j,a.get("icon-text-fit-padding"),o,p)));const h=(g,a,h)=>{if(a.x<0||a.x>=8192||a.y<0||a.y>=8192)return;const{x:i,y:j,z:k}=K.projectTilePoint(a.x,a.y,h),l=new d7(i,j,k,0,void 0);!function(a,d,e,aa,h,z,H,j,f,r,m,s,t,I,u,v,ac,J,K,L,b,w,M,x,c){const k=a.addToLineVertexArray(d,aa);let l,n,o,y,N,O,P,Q=0,R=0,S=0,T=0,A=-1,B=-1;const g={};let U=bd(""),C=0,D=0;if(void 0===f._unevaluatedLayout.getValue("text-radial-offset")?[C,D]=f.layout.get("text-offset").evaluate(b,{},c).map(a=>24*a):(C=24*f.layout.get("text-radial-offset").evaluate(b,{},c),D=ks),a.allowVerticalPlacement&&h.vertical){const V=h.vertical;if(u)O=kA(V),j&&(P=kA(j));else{const W=f.layout.get("text-rotate").evaluate(b,{},c)+90;o=kz(r,e,d,m,s,t,V,I,W,v),j&&(y=kz(r,e,d,m,s,t,j,J,W))}}if(z){const E=f.layout.get("icon-rotate").evaluate(b,{},c),X="none"!==f.layout.get("icon-text-fit"),Y=kk(z,E,M,X),F=j?kk(j,E,M,X):void 0;n=kz(r,e,d,m,s,t,z,J,E),Q=4*Y.length;const Z=a.iconSizeData;let p=null;"source"===Z.kind?(p=[128*f.layout.get("icon-size").evaluate(b,{},c),])[0]>kw&&bY(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Z.kind&&((p=[128*w.compositeIconSizes[0].evaluate(b,{},c),128*w.compositeIconSizes[1].evaluate(b,{},c),])[0]>kw||p[1]>kw)&&bY(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),a.addSymbols(a.icon,Y,p,L,K,b,!1,e,d,k.lineStartIndex,k.lineLength,-1,x,c),A=a.icon.placedSymbolArray.length-1,F&&(R=4*F.length,a.addSymbols(a.icon,F,p,L,K,b,d5.vertical,e,d,k.lineStartIndex,k.lineLength,-1,x,c),B=a.icon.placedSymbolArray.length-1)}for(const $ in h.horizontal){const q=h.horizontal[$];l||(U=bd(q.text),u?N=kA(q):l=kz(r,e,d,m,s,t,q,I,f.layout.get("text-rotate").evaluate(b,{},c),v));const _=1===q.positionedLines.length;if(S+=kx(a,e,d,q,H,f,u,b,v,k,h.vertical?d5.horizontal:d5.horizontalOnly,_?Object.keys(h.horizontal):[$],g,A,w,x,c),_)break}h.vertical&&(T+=kx(a,e,d,h.vertical,H,f,u,b,v,k,d5.vertical,["vertical"],g,B,w,x,c));let i=-1;const G=(a,b)=>a?Math.max(a,b):b;i=G(N,i),i=G(O,i),i=G(P,i);const ab=i> -1?1:0;a.glyphOffsetArray.length>=aB.MAX_GLYPHS&&bY("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&a.addToSortKeyRanges(a.symbolInstances.length,b.sortKey),a.symbolInstances.emplaceBack(e.x,e.y,e.z,d.x,d.y,g.right>=0?g.right:-1,g.center>=0?g.center:-1,g.left>=0?g.left:-1,g.vertical>=0?g.vertical:-1,A,B,U,void 0!==l?l:a.collisionBoxArray.length,void 0!==l?l+1:a.collisionBoxArray.length,void 0!==o?o:a.collisionBoxArray.length,void 0!==o?o+1:a.collisionBoxArray.length,void 0!==n?n:a.collisionBoxArray.length,void 0!==n?n+1:a.collisionBoxArray.length,y||a.collisionBoxArray.length,y?y+1:a.collisionBoxArray.length,m,S,T,Q,R,ab,0,C,D,i)}(c,a,l,g,e,f,F,C,c.layers[0],c.collisionBoxArray,b.index,b.sourceLayerIndex,c.index,L,N,H,0,M,O,o,b,A,I,J,d)};if("line"===t)for(const u of d8(b.geometry,0,0,8192,8192)){const D=kg(u,r,s,e.vertical||g,f,24,q,c.overscaling,8192);for(const v of D){const w=g;w&&kB(c,w.text,B,v)||h(u,v,d)}}else if("line-center"===t){for(const k of b.geometry)if(k.length>1){const x=kf(k,s,e.vertical||g,f,24,q);x&&h(k,x,d)}}else if("Polygon"===b.type)for(const y of i8(b.geometry,0)){const z=kp(y,16);h(y[0],new d7(z.x,z.y,0,0,void 0),d)}else if("LineString"===b.type)for(const l of b.geometry)h(l,new d7(l[0].x,l[0].y,0,0,void 0),d);else if("Point"===b.type)for(const E of b.geometry)for(const m of E)h([m],new d7(m.x,m.y,0,0,void 0),d)}const kw=32640;function kx(a,l,m,n,o,e,f,b,g,h,p,q,r,s,i,t,c){const j=function(Z,c,g,M,l,N,O,B){const s=[];if(0===c.positionedLines.length)return s;const h=M.layout.get("text-rotate").evaluate(N,{})*Math.PI/180,m=function(c){const a=c[0],b=c[1],d=a*b;return d>0?[a,-b]:d<0?[-a,b]:0===a?[b,a]:[b,-a]}(g);let C=Math.abs(c.top-c.bottom);for(const P of c.positionedLines)C-=P.lineOffset;const D=c.positionedLines.length,Q=C/D;let t=c.top-g[1];for(let n=0;nkw&&bY(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===k.kind&&((d=[128*i.compositeTextSizes[0].evaluate(b,{},c),128*i.compositeTextSizes[1].evaluate(b,{},c),])[0]>kw||d[1]>kw)&&bY(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),a.addSymbols(a.text,j,d,g,f,b,p,l,m,h.lineStartIndex,h.lineLength,s,t,c),q))r[u]=a.text.placedSymbolArray.length-1;return 4*j.length}function ky(a){for(const b in a)return a[b];return null}function kz(o,m,p,r,s,t,a,u,q,n){let b=a.top,c=a.bottom,d=a.left,e=a.right;const f=a.collisionPadding;if(f&&(d-=f[0],b-=f[1],e+=f[2],c+=f[3]),q){const g=new aF(d,b),h=new aF(e,b),i=new aF(d,c),j=new aF(e,c),l=q*aP;let k=new aF(0,0);n&&(k=new aF(n[0],n[1])),g._rotateAround(l,k),h._rotateAround(l,k),i._rotateAround(l,k),j._rotateAround(l,k),d=Math.min(g.x,h.x,i.x,j.x),e=Math.max(g.x,h.x,i.x,j.x),b=Math.min(g.y,h.y,i.y,j.y),c=Math.max(g.y,h.y,i.y,j.y)}return o.emplaceBack(m.x,m.y,m.z,p.x,p.y,d,b,e,c,u,r,s,t),o.length-1}function kA(a){a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const b=a.bottom-a.top;return b>0?Math.max(10,b):null}function kB(f,a,g,d){const b=f.compareText;if(a in b){const e=b[a];for(let c=e.length-1;c>=0;c--)if(d.dist(e[c])a.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=aI([]),this.placementViewportMatrix=aI([]);const d=this.layers[0]._unevaluatedLayout._values;this.textSizeData=d0(this.zoom,d["text-size"]),this.iconSizeData=d0(this.zoom,d["icon-size"]);const b=this.layers[0].layout,e=b.get("symbol-sort-key"),c=b.get("symbol-z-order");this.canOverlap=b.get("text-allow-overlap")||b.get("icon-allow-overlap")||b.get("text-ignore-placement")||b.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==c&& void 0!==e.constantOr(1),this.sortFeaturesByY=("viewport-y"===c||"auto"===c&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=b.get("text-writing-mode").map(a=>d5[a]),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.sourceID=a.sourceID}createArrays(){this.text=new ec(new dv(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new ec(new dv(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new dd,this.lineVertexArray=new de,this.symbolInstances=new dc}calculateGlyphDependencies(b,c,g,e,f){for(let a=0;a0)&&("constant"!==k.value.kind||k.value.value.length>0),o="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,x=b.get("symbol-sort-key");if(this.features=[],!n&&!o)return;const p=j.iconDependencies,q=j.glyphDependencies,r=j.availableImages,y=new c5(this.zoom);for(const{feature:h,id:z,index:A,sourceLayerIndex:B}of v){const s=d._featureFilter.needGeometry,a=id(h,s);if(!d._featureFilter.filter(y,a,c))continue;let e,f;if(s||(a.geometry=ic(h,c,w)),n){const C=d.getValueAndResolveTokens("text-field",a,c,r),t=fB.factory(C);kF(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===c3()||this.hasRTLText&&c4.isParsed())&&(e=jB(t,d,a))}if(o){const m=d.getValueAndResolveTokens("icon-image",a,c,r);f=m instanceof cj?m:cj.fromString(m)}if(!e&&!f)continue;const D=this.sortFeaturesByKey?x.evaluate(a,{},c):void 0;if(this.features.push({id:z,text:e,icon:f,index:A,sourceLayerIndex:B,geometry:a.geometry,properties:h.properties,type:kC[h.type],sortKey:D}),f&&(p[f.name]=!0),e){const E=k.evaluate(a,{},c).join(","),F="map"===b.get("text-rotation-alignment")&&"point"!==b.get("symbol-placement");for(const i of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(d5.vertical)>=0,e.sections))if(i.image)p[i.image.name]=!0;else{const G=hs(e.toString()),u=i.fontStack||E,H=q[u]=q[u]||{};this.calculateGlyphDependencies(i.text,H,F,this.allowVerticalPlacement,G)}}}"line"===b.get("symbol-placement")&&(this.features=function(k){const d={},c={},g=[];let l=0;function m(a){g.push(k[a]),l++}function n(b,d,e){const a=c[b];return delete c[b],c[d]=a,g[a].geometry[0].pop(),g[a].geometry[0]=g[a].geometry[0].concat(e[0]),a}function o(c,b,e){const a=d[b];return delete d[b],d[c]=a,g[a].geometry[0].shift(),g[a].geometry[0]=e[0].concat(g[a].geometry[0]),a}function i(c,a,d){const b=d?a[0][a[0].length-1]:a[0][0];return`${c}:${b.x}:${b.y}`}for(let e=0;ea.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((a,b)=>a.sortKey-b.sortKey)}update(a,b,c,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,b,this.layers,c,d),this.icon.programConfigurations.updatePaintArrays(a,b,this.layers,c,d))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(d,a){const h=this.lineVertexArray.length;if(void 0!==d.segment){let i=d.dist(a[d.segment+1]),j=d.dist(a[d.segment]);const e={};for(let b=d.segment+1;b=0;c--)e[c]={x:a[c].x,y:a[c].y,tileUnitDistanceFromAnchor:j},c>0&&(j+=a[c-1].dist(a[c]));for(let f=0;f=0?a.rightJustifiedTextSymbolIndex:a.centerJustifiedTextSymbolIndex>=0?a.centerJustifiedTextSymbolIndex:a.leftJustifiedTextSymbolIndex>=0?a.leftJustifiedTextSymbolIndex:a.verticalPlacedTextSymbolIndex>=0?a.verticalPlacedTextSymbolIndex:c),e=bh(this.textSizeData,b,d)/24;return this.tilePixelRatio*e}getSymbolInstanceIconSize(a,e,b){const c=this.icon.placedSymbolArray.get(b),d=bh(this.iconSizeData,a,c);return this.tilePixelRatio*d}_commitDebugCollisionVertexUpdate(b,c,a){b.emplaceBack(c,-a,-a),b.emplaceBack(c,a,-a),b.emplaceBack(c,a,a),b.emplaceBack(c,-a,a)}_updateTextDebugCollisionBoxes(b,c,d,e,f,g){for(let a=e;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(b,d){const c=b.placedSymbolArray.get(d),e=c.vertexStartIndex+4*c.numGlyphs;for(let a=c.vertexStartIndex;ag[a]-g[b]||h[b]-h[a]),c}addToSortKeyRanges(a,c){const b=this.sortKeyRanges[this.sortKeyRanges.length-1];b&&b.sortKey===c?b.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(b){if(this.sortFeaturesByY&&this.sortedAngle!==b&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const c of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(b),this.sortedAngle=b,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const a=this.symbolInstances.get(c);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex,].forEach((a,b,c)=>{a>=0&&c.indexOf(a)===b&&this.addIndicesForPlacedSymbol(this.text,a)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}c("SymbolBucket",aB,{omit:["layers","collisionBoxArray","features","compareText",]}),aB.MAX_GLYPHS=65535,aB.addDynamicAttributes=bk;const ee=new n({"symbol-placement":new e(b.layout_symbol["symbol-placement"]),"symbol-spacing":new e(b.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new e(b.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new g(b.layout_symbol["symbol-sort-key"]),"symbol-z-order":new e(b.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new e(b.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new e(b.layout_symbol["icon-ignore-placement"]),"icon-optional":new e(b.layout_symbol["icon-optional"]),"icon-rotation-alignment":new e(b.layout_symbol["icon-rotation-alignment"]),"icon-size":new g(b.layout_symbol["icon-size"]),"icon-text-fit":new e(b.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new e(b.layout_symbol["icon-text-fit-padding"]),"icon-image":new g(b.layout_symbol["icon-image"]),"icon-rotate":new g(b.layout_symbol["icon-rotate"]),"icon-padding":new e(b.layout_symbol["icon-padding"]),"icon-keep-upright":new e(b.layout_symbol["icon-keep-upright"]),"icon-offset":new g(b.layout_symbol["icon-offset"]),"icon-anchor":new g(b.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new e(b.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new e(b.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new e(b.layout_symbol["text-rotation-alignment"]),"text-field":new g(b.layout_symbol["text-field"]),"text-font":new g(b.layout_symbol["text-font"]),"text-size":new g(b.layout_symbol["text-size"]),"text-max-width":new g(b.layout_symbol["text-max-width"]),"text-line-height":new g(b.layout_symbol["text-line-height"]),"text-letter-spacing":new g(b.layout_symbol["text-letter-spacing"]),"text-justify":new g(b.layout_symbol["text-justify"]),"text-radial-offset":new g(b.layout_symbol["text-radial-offset"]),"text-variable-anchor":new e(b.layout_symbol["text-variable-anchor"]),"text-anchor":new g(b.layout_symbol["text-anchor"]),"text-max-angle":new e(b.layout_symbol["text-max-angle"]),"text-writing-mode":new e(b.layout_symbol["text-writing-mode"]),"text-rotate":new g(b.layout_symbol["text-rotate"]),"text-padding":new e(b.layout_symbol["text-padding"]),"text-keep-upright":new e(b.layout_symbol["text-keep-upright"]),"text-transform":new g(b.layout_symbol["text-transform"]),"text-offset":new g(b.layout_symbol["text-offset"]),"text-allow-overlap":new e(b.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new e(b.layout_symbol["text-ignore-placement"]),"text-optional":new e(b.layout_symbol["text-optional"])});var kG={paint:new n({"icon-opacity":new g(b.paint_symbol["icon-opacity"]),"icon-color":new g(b.paint_symbol["icon-color"]),"icon-halo-color":new g(b.paint_symbol["icon-halo-color"]),"icon-halo-width":new g(b.paint_symbol["icon-halo-width"]),"icon-halo-blur":new g(b.paint_symbol["icon-halo-blur"]),"icon-translate":new e(b.paint_symbol["icon-translate"]),"icon-translate-anchor":new e(b.paint_symbol["icon-translate-anchor"]),"text-opacity":new g(b.paint_symbol["text-opacity"]),"text-color":new g(b.paint_symbol["text-color"],{runtimeType:y,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new g(b.paint_symbol["text-halo-color"]),"text-halo-width":new g(b.paint_symbol["text-halo-width"]),"text-halo-blur":new g(b.paint_symbol["text-halo-blur"]),"text-translate":new e(b.paint_symbol["text-translate"]),"text-translate-anchor":new e(b.paint_symbol["text-translate-anchor"])}),layout:ee};class ef{constructor(a){this.type=a.property.overrides?a.property.overrides.runtimeType:cf,this.defaultValue=a}evaluate(a){if(a.formattedSection){const b=this.defaultValue.property.overrides;if(b&&b.hasOverride(a.formattedSection))return b.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}c("FormatSectionOverride",ef,{omit:["defaultValue"]});class eg extends be{constructor(a){super(a,kG)}recalculate(d,e){super.recalculate(d,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const b=this.layout.get("text-writing-mode");if(b){const a=[];for(const c of b)0>a.indexOf(c)&&a.push(c);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(b,c,e,f){var g;const a=this.layout.get(b).evaluate(c,{},e,f),d=this._unevaluatedLayout._values[b];return d.isDataDriven()||gv(d.value)||!a?a:(g=c.properties,a.replace(/{([^{}]+)}/g,(b,a)=>a in g?String(g[a]):""))}createBucket(a){return new aB(a)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const b of kG.paint.overridableProperties){if(!eg.hasPaintOverride(this.layout,b))continue;const a=this.paint.get(b),e=new ef(a),c=new cM(e,a.property.specification);let d=null;d="constant"===a.value.kind||"source"===a.value.kind?new cO("source",c):new cP("composite",c,a.value.zoomStops,a.value._interpolationType),this.paint._values[b]=new hM(a.property,d,a.parameters)}}_handleOverridablePaintPropertyUpdate(a,b,c){return!(!this.layout||b.isDataDriven()||c.isDataDriven())&&eg.hasPaintOverride(this.layout,a)}static hasPaintOverride(c,d){const a=c.get("text-field"),h=kG.paint.properties[d];let e=!1;const f=a=>{for(const b of a)if(h.overrides&&h.overrides.hasOverride(b))return void(e=!0)};if("constant"===a.value.kind&&a.value.value instanceof fB)f(a.value.value.sections);else if("source"===a.value.kind){const g=a=>{e||(a instanceof ck&&fE(a.value)===ch?f(a.value.sections):a instanceof cl?f(a.sections):a.eachChild(g))},b=a.value;b._styleExpression&&g(b._styleExpression.expression)}return e}getProgramConfiguration(a){return new du(this,a)}}var kH={paint:new n({"background-color":new e(b.paint_background["background-color"]),"background-pattern":new a5(b.paint_background["background-pattern"]),"background-opacity":new e(b.paint_background["background-opacity"])})},kI={paint:new n({"raster-opacity":new e(b.paint_raster["raster-opacity"]),"raster-hue-rotate":new e(b.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new e(b.paint_raster["raster-brightness-min"]),"raster-brightness-max":new e(b.paint_raster["raster-brightness-max"]),"raster-saturation":new e(b.paint_raster["raster-saturation"]),"raster-contrast":new e(b.paint_raster["raster-contrast"]),"raster-resampling":new e(b.paint_raster["raster-resampling"]),"raster-fade-duration":new e(b.paint_raster["raster-fade-duration"])})};class kJ extends be{constructor(a){super(a,{}),this.implementation=a}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(a){this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)}onRemove(a){this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)}}var kK={paint:new n({"sky-type":new e(b.paint_sky["sky-type"]),"sky-atmosphere-sun":new e(b.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new e(b.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new e(b.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new e(b.paint_sky["sky-gradient-radius"]),"sky-gradient":new V(b.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new e(b.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new e(b.paint_sky["sky-atmosphere-color"]),"sky-opacity":new e(b.paint_sky["sky-opacity"])})};function kL(l,m,n){var a,b,f,h,i,j,k,c,d;const g=Q(0,0,1),e=bG(aO());return a=e,b=e,f=n?-(l*aP)+Math.PI:l*aP,f*=.5,h=b[0],i=b[1],j=b[2],k=b[3],c=Math.sin(f),d=Math.cos(f),a[0]=h*d-j*c,a[1]=i*d+k*c,a[2]=j*d+h*c,a[3]=k*d-i*c,bH(e,e,-(m*aP)),bD(g,g,e),bz(g,g)}const kM={circle:class extends be{constructor(a){super(a,iv)}createBucket(a){return new bf(a)}queryRadius(b){const a=b;return ir("circle-radius",this,a)+ir("circle-stroke-width",this,a)+is(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,e,j,d,f,g){const h=iu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,a.pixelToTileUnitsFactor),i=this.paint.get("circle-radius").evaluate(b,c)+this.paint.get("circle-stroke-width").evaluate(b,c);return iw(a,e,d,f,g,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,i)}getProgramIds(){return["circle"]}getProgramConfiguration(a){return new du(this,a)}},heatmap:class extends be{createBucket(a){return new dI(a)}constructor(a){super(a,iE),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){"heatmap-color"===a&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=dK({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(a){return ir("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,i,e,f,g){const h=this.paint.get("heatmap-radius").evaluate(b,c);return iw(a,d,e,f,g,!0,!0,new aF(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(a){return new du(this,a)}},hillshade:class extends be{constructor(a){super(a,iF)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(a){return new du(this,a)}},fill:class extends be{constructor(a){super(a,jc)}getProgramIds(){const a=this.paint.get("fill-pattern"),b=a&&a.constantOr(1),c=[b?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&c.push(b&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),c}getProgramConfiguration(a){return new du(this,a)}recalculate(b,c){super.recalculate(b,c);const a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&& void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(a){return new dN(a)}queryRadius(){return is(this.paint.get("fill-translate"))}queryIntersectsFeature(a,d,e,b,f,c){return!a.queryGeometry.isAboveHorizon&&ih(it(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),c.angle,a.pixelToTileUnitsFactor),b)}isTileClipped(){return!0}},"fill-extrusion":class extends be{constructor(a){super(a,jm)}createBucket(a){return new dU(a)}queryRadius(){return is(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(a){return new du(this,a)}queryIntersectsFeature(c,k,l,v,C,a,w,m,x){var d,e,f,g,h,i,n,o,p;const y=iu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,c.pixelToTileUnitsFactor),z=this.paint.get("fill-extrusion-height").evaluate(k,l),A=this.paint.get("fill-extrusion-base").evaluate(k,l),b=[0,0],q=m&&a.elevation,B=a.elevation?a.elevation.exaggeration():1;if(q){const r=c.tile.getBucket(this).centroidVertexArray,s=x+1;if(s=3){for(let d=0;d1&&(b=i[++j]);const n=Math.abs(a-b.left),o=Math.abs(a-b.right),e=Math.min(n,o);let g;const h=d/c*(f+1);if(b.isDash){const k=f-Math.abs(h);g=Math.sqrt(e*e+k*k)}else g=f-Math.sqrt(e*e+h*h);this.image.data[m+a]=Math.max(0,Math.min(255,g+128))}}}addRegularDash(a,k){for(let b=a.length-1;b>=0;--b){const e=a[b],f=a[b+1];e.zeroLength?a.splice(b,1):f&&f.isDash===e.isDash&&(f.left=e.left,a.splice(b,1))}const g=a[0],h=a[a.length-1];g.isDash===h.isDash&&(g.left=h.left-this.width,h.right=g.right+this.width);const l=this.width*this.nextRow;let i=0,d=a[i];for(let c=0;c1&&(d=a[++i]);const m=Math.abs(c-d.left),n=Math.abs(c-d.right),j=Math.min(m,n);this.image.data[l+c]=Math.max(0,Math.min(255,(d.isDash?j:-j)+k+128))}}addDash(a,e){const f=this.getKey(a,e);if(this.positions[f])return this.positions[f];const h="round"===e,c=h?7:0,i=2*c+1;if(this.nextRow+i>this.height)return bY("LineAtlas out of space"),null;0===a.length&&a.push(1);let d=0;for(let b=0;b0;a--)c+=(e&(b=1<this.canonical.z?new bn(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bn(a,this.wrap,a,this.canonical.x>>b,this.canonical.y>>b)}calculateScaledKey(a,b=!0){if(this.overscaledZ===a&&b)return this.key;if(a>this.canonical.z)return kU(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return kU(this.wrap*+b,a,a,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(a){if(a.wrap!==this.wrap)return!1;const b=this.canonical.z-a.canonical.z;return 0===a.overscaledZ||a.overscaledZ>b&&a.canonical.y===this.canonical.y>>b}children(d){if(this.overscaledZ>=d)return[new bn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const a=this.canonical.z+1,b=2*this.canonical.x,c=2*this.canonical.y;return[new bn(a,this.wrap,a,b,c),new bn(a,this.wrap,a,b+1,c),new bn(a,this.wrap,a,b,c+1),new bn(a,this.wrap,a,b+1,c+1),]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.yMath.abs(i[a])){if(d[a]h[a])return null}else{const j=1/i[a];let b=(g[a]-d[a])*j,c=(h[a]-d[a])*j;if(b>c){const k=b;b=c,c=k}if(b>e&&(e=b),cf)return null}return e}function kZ(b,c,d,y,z,A,B,C,D,e,a){const f=y-b,g=z-c,h=A-d,i=B-b,j=C-c,k=D-d,q=a[1]*k-a[2]*j,r=a[2]*i-a[0]*k,s=a[0]*j-a[1]*i,t=f*q+g*r+h*s;if(1e-15>Math.abs(t))return null;const l=1/t,m=e[0]-b,n=e[1]-c,o=e[2]-d,p=(m*q+n*r+o*s)*l;if(p<0||p>1)return null;const u=n*h-o*g,v=o*f-m*h,w=m*g-n*f,x=(a[0]*u+a[1]*v+a[2]*w)*l;return x<0||p+x>1?null:(i*u+j*v+k*w)*l}function k$(d,e,j,b,c,k,l,f,g){const a=1<{const e=f?1:0,g=(c+1)*a-e,h=d*a,i=(d+1)*a-e;b[0]=c*a,b[1]=h,b[2]=g,b[3]=i};let c=new kX(b);const a=[];for(let g=0;g=1;b/=2){const d=f[f.length-1];c=new kX(b);for(let h=0;h0;){const{idx:u,t:B,nodex:g,nodey:h,depth:j}=t.pop();if(this.leaves[u]){k$(g,h,j,o,p,q,r,a,b);const k=1<=x[2])return B}continue}let l=0;for(let c=0;c=s[i[m]]&&(i.splice(m,0,c),y=!0);y||(i[l]=c),l++}}for(let z=0;z=this.dim+1||b< -1||b>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(b+1)*this.stride+(a+1)}_unpackMapbox(a,b,c){return(256*a*256+256*b+c)/10-1e4}_unpackTerrarium(a,b,c){return 256*a+b+c/256-32768}static pack(d,e){const b=[0,0,0,0],c=bo.getUnpackVector(e);let a=Math.floor((d+c[3])/c[2]);return b[2]=a%256,a=Math.floor(a/256),b[1]=a%256,a=Math.floor(a/256),b[0]=a,b}getPixels(){return new bg({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,a,b){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let e=a*this.dim,f=a*this.dim+this.dim,g=b*this.dim,h=b*this.dim+this.dim;switch(a){case -1:e=f-1;break;case 1:f=e+1}switch(b){case -1:g=h-1;break;case 1:h=g+1}const j=-a*this.dim,k=-b*this.dim;for(let c=g;c{"source"===a.dataType&&"metadata"===a.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===a.dataType&&"content"===a.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),a.on("error",()=>{this._sourceErrored=!0}),this._source=a,this._tiles={},this._cache=new class{constructor(a,b){this.max=a,this.onRemove=b,this.reset()}reset(){for(const b in this.data)for(const a of this.data[b])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(e,f,b){const a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);const c={value:f,timeout:void 0};if(void 0!==b&&(c.timeout=setTimeout(()=>{this.remove(e,c)},b)),this.data[a].push(c),this.order.push(a),this.order.length>this.max){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const b=this.data[a].shift();return b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),b.value}getByKey(b){const a=this.data[b];return a?a[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(c,d){if(!this.has(c))return this;const a=c.wrapped().key,e=void 0===d?0:this.data[a].indexOf(d),b=this.data[a][e];return this.data[a].splice(e,1),b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(b.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(b){for(this.max=b;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(d){const a=[];for(const e in this.data)for(const b of this.data[e])d(b.value)||a.push(b);for(const c of a)this.remove(c.value.tileID,c)}}(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,g,c){const b=String(g);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][b]=this.stateChanges[a][b]||{},bR(this.stateChanges[a][b],c),null===this.deletedStates[a])for(const d in this.deletedStates[a]={},this.state[a])d!==b&&(this.deletedStates[a][d]=null);else if(this.deletedStates[a]&&null===this.deletedStates[a][b])for(const e in this.deletedStates[a][b]={},this.state[a][b])c[e]||(this.deletedStates[a][b][e]=null);else for(const f in c)this.deletedStates[a]&&this.deletedStates[a][b]&&null===this.deletedStates[a][b][f]&&delete this.deletedStates[a][b][f]}removeFeatureState(a,d,c){if(null===this.deletedStates[a])return;const b=String(d);if(this.deletedStates[a]=this.deletedStates[a]||{},c&& void 0!==d)null!==this.deletedStates[a][b]&&(this.deletedStates[a][b]=this.deletedStates[a][b]||{},this.deletedStates[a][b][c]=null);else if(void 0!==d){if(this.stateChanges[a]&&this.stateChanges[a][b])for(c in this.deletedStates[a][b]={},this.stateChanges[a][b])this.deletedStates[a][b][c]=null;else this.deletedStates[a][b]=null}else this.deletedStates[a]=null}getState(a,b){const c=String(b),d=bR({},(this.state[a]||{})[c],(this.stateChanges[a]||{})[c]);if(null===this.deletedStates[a])return{};if(this.deletedStates[a]){const e=this.deletedStates[a][b];if(null===e)return{};for(const f in e)delete d[f]}return d}initializeTileState(a,b){a.setFeatureState(this.state,b)}coalesceChanges(g,j){const c={};for(const b in this.stateChanges){this.state[b]=this.state[b]||{};const h={};for(const d in this.stateChanges[b])this.state[b][d]||(this.state[b][d]={}),bR(this.state[b][d],this.stateChanges[b][d]),h[d]=this.state[b][d];c[b]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const f={};if(null===this.deletedStates[a])for(const i in this.state[a])f[i]={},this.state[a][i]={};else for(const e in this.deletedStates[a]){if(null===this.deletedStates[a][e])this.state[a][e]={};else for(const k of Object.keys(this.deletedStates[a][e]))delete this.state[a][e][k];f[e]=this.state[a][e]}c[a]=c[a]||{},bR(c[a],f)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(c).length)for(const l in g)g[l].setFeatureState(c,j)}}}onAdd(a){this.map=a,this._minTileCacheSize=a?a._minTileCacheSize:null,this._maxTileCacheSize=a?a._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const b in this._tiles){const a=this._tiles[b];if("loaded"!==a.state&&"errored"!==a.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(a,b){return a.isSymbolTile=this._onlySymbols,this._source.loadTile(a,b)}_unloadTile(a){if(this._source.unloadTile)return this._source.unloadTile(a,()=>{})}_abortTile(a){if(this._source.abortTile)return this._source.abortTile(a,()=>{})}serialize(){return this._source.serialize()}prepare(b){for(const c in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const a=this._tiles[c];a.upload(b),a.prepare(this.map.style.imageManager)}}getIds(){return bQ(this._tiles).map(a=>a.tileID).sort(k2).map(a=>a.key)}getRenderableIds(b){const a=[];for(const c in this._tiles)this._isIdRenderable(+c,b)&&a.push(this._tiles[c]);return b?a.sort((e,f)=>{const a=e.tileID,b=f.tileID,c=new aF(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),d=new aF(b.canonical.x,b.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-b.overscaledZ||d.y-c.y||d.x-c.x}).map(a=>a.tileID.key):a.map(a=>a.tileID).sort(k2).map(a=>a.key)}hasRenderableParent(b){const a=this.findLoadedParent(b,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(a,b){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(b||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const a in this._cache.reset(),this._tiles)"errored"!==this._tiles[a].state&&this._reloadTile(+a,"reloading")}_reloadTile(b,c){const a=this._tiles[b];a&&("loading"!==a.state&&(a.state=c),this._loadTile(a,this._tileLoaded.bind(this,a,b,c)))}_tileLoaded(a,d,e,b){if(b){if(a.state="errored",404!==b.status)this._source.fire(new cb(b,{tile:a}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const c=this.map.painter.terrain;this.update(this.transform,c.getScaledDemTileSize(),!0),c.resetTileLookupCache(this.id)}else this.update(this.transform)}else a.timeAdded=b$.now(),"expired"===e&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(d,a),"raster-dem"===this._source.type&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),this._source.fire(new aW("data",{dataType:"source",tile:a,coord:a.tileID,sourceCacheId:this.id}))}_backfillDEM(a){const c=this.getRenderableIds();for(let b=0;b1||(Math.abs(b)>1&&(1===Math.abs(b+d)?b+=d:1===Math.abs(b-d)&&(b-=d)),c.dem&&a.dem&&(a.dem.backfillBorder(c.dem,b,e),a.neighboringTiles&&a.neighboringTiles[f]&&(a.neighboringTiles[f].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(h,d,i,e){for(const f in this._tiles){let a=this._tiles[f];if(e[f]||!a.hasData()||a.tileID.overscaledZ<=d||a.tileID.overscaledZ>i)continue;let b=a.tileID;for(;a&&a.tileID.overscaledZ>d+1;){const g=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[g.key])&&a.hasData()&&(b=g)}let c=b;for(;c.overscaledZ>d;)if(h[(c=c.scaledTo(c.overscaledZ-1)).key]){e[b.key]=b;break}}}findLoadedParent(a,d){if(a.key in this._loadedParentTiles){const b=this._loadedParentTiles[a.key];return b&&b.tileID.overscaledZ>=d?b:null}for(let c=a.overscaledZ-1;c>=d;c--){const f=a.scaledTo(c),e=this._getLoadedTile(f);if(e)return e}}_getLoadedTile(a){const b=this._tiles[a.key];return b&&b.hasData()?b:this._cache.getByKey(this._source.reparseOverscaled?a.wrapped().key:a.canonical.key)}updateCacheSize(b,a){a=a||this._source.tileSize;const e=Math.ceil(b.width/a)+1,f=Math.ceil(b.height/a)+1,c=Math.floor(e*f*5),d="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,c):c,g="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(g)}handleWrapJump(b){const c=Math.round((b-(void 0===this._prevLng?b:this._prevLng))/360);if(this._prevLng=b,c){const d={};for(const g in this._tiles){const a=this._tiles[g];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+c),d[a.tileID.key]=a}for(const e in this._tiles=d,this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const f in this._tiles)this._setTileReloadTimer(+f,this._tiles[f])}}update(e,n,o){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!o)return;let a;this.updateCacheSize(e,n),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(a=>new bn(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(a=e.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!o,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter(a=>this._source.hasTile(a)))):a=[];const b=this._updateRetainedTiles(a);if(k3(this._source.type)&&0!==a.length){const h={},p={},s=Object.keys(b);for(const i of s){const j=b[i],k=this._tiles[i];if(!k||k.fadeEndTime&&k.fadeEndTime<=b$.now())continue;const f=this.findLoadedParent(j,Math.max(j.overscaledZ-aD.maxOverzooming,this._source.minzoom));f&&(this._addTile(f.tileID),h[f.tileID.key]=f.tileID),p[i]=j}const t=a[a.length-1].overscaledZ;for(const l in this._tiles){const m=this._tiles[l];if(b[l]||!m.hasData())continue;let c=m.tileID;for(;c.overscaledZ>t;){c=c.scaledTo(c.overscaledZ-1);const q=this._tiles[c.key];if(q&&q.hasData()&&p[c.key]){b[l]=m.tileID;break}}}for(const g in h)b[g]||(this._coveredTiles[g]=!0,b[g]=h[g])}for(const u in b)this._tiles[u].clearFadeHold();const v=function(c,d){const a=[];for(const b in c)b in d||a.push(b);return a}(this._tiles,b);for(const r of v){const d=this._tiles[r];d.hasSymbolBuckets&&!d.holdingForFade()?d.setHoldDuration(this.map._fadeDuration):d.hasSymbolBuckets&&!d.symbolFadeFinished()||this._removeTile(+r)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(+a)}_updateRetainedTiles(e){const a={};if(0===e.length)return a;const j={},k=e.reduce((a,b)=>Math.min(a,b.overscaledZ),1/0),l=e[0].overscaledZ,p=Math.max(l-aD.maxOverzooming,this._source.minzoom),q=Math.max(l+aD.maxUnderzooming,this._source.minzoom),m={};for(const f of e){const r=this._addTile(f);a[f.key]=f,r.hasData()||k=this._source.maxzoom){const h=c.children(this._source.maxzoom)[0],n=this.getTile(h);if(n&&n.hasData()){a[h.key]=h;continue}}else{const g=c.children(this._source.maxzoom);if(a[g[0].key]&&a[g[1].key]&&a[g[2].key]&&a[g[3].key])continue}let o=b.wasRequested();for(let i=c.overscaledZ-1;i>=p;--i){const d=c.scaledTo(i);if(j[d.key]||(j[d.key]=!0,(b=this.getTile(d))||!o||(b=this._addTile(d)),b&&(a[d.key]=d,o=b.wasRequested(),b.hasData())))break}}return a}_updateLoadedParentTileCache(){for(const e in this._loadedParentTiles={},this._tiles){const c=[];let b,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){b=this._loadedParentTiles[a.key];break}c.push(a.key);const d=a.scaledTo(a.overscaledZ-1);if(b=this._getLoadedTile(d))break;a=d}for(const f of c)this._loadedParentTiles[f]=b}}_addTile(b){let a=this._tiles[b.key];if(a)return a;(a=this._cache.getAndRemove(b))&&(this._setTileReloadTimer(b.key,a),a.tileID=b,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[b.key]&&(clearTimeout(this._cacheTimers[b.key]),delete this._cacheTimers[b.key],this._setTileReloadTimer(b.key,a)));const c=Boolean(a);if(!c){const d=this.map?this.map.painter:null,e="raster"===this._source.type||"raster-dem"===this._source.type;a=new eq(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,d,e),this._loadTile(a,this._tileLoaded.bind(this,a,b.key,a.state))}return a?(a.uses++,this._tiles[b.key]=a,c||this._source.fire(new aW("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a):null}_setTileReloadTimer(a,c){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const b=c.getExpiryTimeout();b&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},b))}_removeTile(b){const a=this._tiles[b];a&&(a.uses--,delete this._tiles[b],this._timers[b]&&(clearTimeout(this._timers[b]),delete this._timers[b]),a.uses>0||(a.hasData()&&"reloading"!==a.state?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}clearTiles(){for(const a in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+a);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(e,f,g){const a=[],c=this.transform;if(!c)return a;for(const h in this._tiles){const b=this._tiles[h];if(g&&b.clearQueryDebugViz(),b.holdingForFade())continue;const d=e.containsTile(b,c,f);d&&a.push(d)}return a}getVisibleCoordinates(c){const a=this.getRenderableIds(c).map(a=>this._tiles[a].tileID);for(const b of a)b.projMatrix=this.transform.calculateProjMatrix(b.toUnwrapped());return a}hasTransition(){if(this._source.hasTransition())return!0;if(k3(this._source.type))for(const b in this._tiles){const a=this._tiles[b];if(void 0!==a.fadeEndTime&&a.fadeEndTime>=b$.now())return!0}return!1}setFeatureState(a,b,c){this._state.updateState(a=a||"_geojsonTileLayer",b,c)}removeFeatureState(a,b,c){this._state.removeFeatureState(a=a||"_geojsonTileLayer",b,c)}getFeatureState(a,b){return this._state.getState(a=a||"_geojsonTileLayer",b)}setDependencies(b,c,d){const a=this._tiles[b];a&&a.setDependencies(c,d)}reloadTilesForDependencies(b,c){for(const a in this._tiles)this._tiles[a].hasDependency(b,c)&&this._reloadTile(+a,"reloading");this._cache.filter(a=>!a.hasDependency(b,c))}_preloadTiles(a,f){const b=new Map,g=Array.isArray(a)?a:[a],c=this.map.painter.terrain,h=this.usedForTerrain&&c?c.getScaledDemTileSize():this._source.tileSize;for(const d of g){const i=d.coveringTiles({tileSize:h,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of i)b.set(e.key,e);this.usedForTerrain&&d.updateElevation(!1)}const j=Array.from(b.values()),k="raster"===this._source.type||"raster-dem"===this._source.type;bP(j,(a,c)=>{const b=new eq(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,this.map.painter,k);this._loadTile(b,a=>{"raster-dem"===this._source.type&&b.dem&&this._backfillDEM(b),c(a,b)})},f)}}function k2(a,b){const c=Math.abs(2*a.wrap)- +(a.wrap<0),d=Math.abs(2*b.wrap)- +(b.wrap<0);return a.overscaledZ-b.overscaledZ||d-c||b.canonical.y-a.canonical.y||b.canonical.x-a.canonical.x}function k3(a){return"raster"===a||"image"===a||"video"===a}aD.maxOverzooming=10,aD.maxUnderzooming=3;class k4{constructor(a,b,c){this._demTile=a,this._dem=this._demTile.dem,this._scale=b,this._offset=c}static create(f,b,g){const a=g||f.findDEMTileFor(b);if(!a||!a.dem)return;const e=a.dem,c=a.tileID,d=1<=0&&a[3]>=0&&l.insert(k,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(const a in this.vtLayers=new _.VectorTile(new d2(this.rawTileData)).layers,this.sourceLayerCoder=new kV(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[a]=[];return this.vtLayers}query(c,j,k,l){this.loadVTLayers();const d=c.params||{},m=gB(d.filter),n=c.tileResult,g=c.transform,a=n.bufferedTilespaceBounds,b=this.grid.query(a.min.x,a.min.y,a.max.x,a.max.y,(a,b,c,d)=>dF(n.bufferedTilespaceGeometry,a,b,c,d));b.sort(k6);let o=null;g.elevation&&b.length>0&&(o=k4.create(g.elevation,this.tileID));const h={};let i;for(let e=0;e(q||(q=ic(a,this.tileID.canonical,c.tileTransform)),b.queryIntersectsFeature(n,a,d,q,this.z,c.transform,c.pixelPosMatrix,o,e)))}return h}loadMatchingFeature(l,t,g,e,m,u,v,n,o){const{featureIndex:p,bucketIndex:w,sourceLayerIndex:x,layoutVertexArrayOffset:y}=t,h=this.bucketLayerIDs[w];if(e&&!function(b,c){for(let a=0;a=0)return!0;return!1}(e,h))return;const q=this.sourceLayerCoder.decode(x),a=this.vtLayers[q].feature(p);if(g.needGeometry){const z=id(a,!0);if(!g.filter(new c5(this.tileID.overscaledZ),z,this.tileID.canonical))return}else if(!g.filter(new c5(this.tileID.overscaledZ),a))return;const i=this.getId(a,q);for(let j=0;je.indexOf(b))continue;const c=u[b];if(!c)continue;let f={};void 0!==i&&n&&(f=n.getState(c.sourceLayer||"_geojsonTileLayer",i));const d=bR({},v[b]);d.paint=k5(d.paint,c.paint,a,f,m),d.layout=k5(d.layout,c.layout,a,f,m);const r=!o||o(a,c,f,y);if(!r)continue;const s=new kW(a,this.z,this.x,this.y,i);s.layer=d;let k=l[b];void 0===k&&(k=l[b]=[]),k.push({featureIndex:p,feature:s,intersectionZ:r})}}lookupSymbolFeatures(b,c,d,e,f,g,h,i){const a={};this.loadVTLayers();const j=gB(f);for(const k of b)this.loadMatchingFeature(a,{bucketIndex:d,sourceLayerIndex:e,featureIndex:k,layoutVertexArrayOffset:0},j,g,h,i,c);return a}loadFeature(e){const{featureIndex:a,sourceLayerIndex:f}=e;this.loadVTLayers();const c=this.sourceLayerCoder.decode(f),b=this.vtFeatures[c];if(b[a])return b[a];const d=this.vtLayers[c].feature(a);return b[a]=d,d}hasLayer(a){for(const b of this.bucketLayerIDs)for(const c of b)if(a===c)return!0;return!1}getId(b,c){let a=b.id;return this.promoteId&&"boolean"==typeof(a=b.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[c]])&&(a=Number(a)),a}}function k5(a,b,c,d,e){return eP(a,(g,f)=>{const a=b instanceof hN?b.get(f):null;return a&&a.evaluate?a.evaluate(c,d,e):a})}function k6(a,b){return b-a}c("FeatureIndex",el,{omit:["rawTileData","sourceLayerCoder"]});var em=j([{name:"a_pos",type:"Int16",components:2},]);const aa=new Uint16Array(8184);for(let ab=0;ab<2046;ab++){let aE=ab+2,D=0,E=0,F=0,G=0,ac=0,ad=0;for(1&aE?F=G=ac=32:D=E=ad=32;(aE>>=1)>1;){const en=D+F>>1,eo=E+G>>1;1&aE?(F=D,G=E,D=ac,E=ad):(D=F,E=G,F=ac,G=ad),ac=en,ad=eo}const ae=4*ab;aa[ae+0]=D,aa[ae+1]=E,aa[ae+2]=F,aa[ae+3]=G}const k7=new Uint16Array(2178),k8=new Uint8Array(1089),k9=new Uint16Array(1089);function la(a){return 0===a?-0.03125:32===a?.03125:0}var ep=j([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const lb={type:2,extent:8192,loadGeometry:()=>[[new aF(0,0),new aF(8193,0),new aF(8193,8193),new aF(0,8193),new aF(0,0),],]};class eq{constructor(b,c,d,a,e){this.tileID=b,this.uid=bS(),this.uses=0,this.tileSize=c,this.tileZoom=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=e,this.expiredRequestCount=0,this.state="loading",a&&a.transform&&(this.projection=a.transform.projection)}registerFadeDuration(b){const a=b+this.timeAdded;ae.getLayer(a)).filter(Boolean);if(0!==c.length)for(const f of(a.layers=c,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(a=>c.filter(b=>b.id===a)[0])),c))b[f.id]=a}return b}(a.buckets,b.style),this.hasSymbolBuckets=!1,this.buckets){const c=this.buckets[g];if(c instanceof aB){if(this.hasSymbolBuckets=!0,!f)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const h in this.buckets){const d=this.buckets[h];if(d instanceof aB&&d.hasRTLText){this.hasRTLText=!0,c4.isLoading()||c4.isLoaded()||"deferred"!==c3()||hH();break}}for(const e in this.queryPadding=0,this.buckets){const i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,b.style.getLayer(e).queryRadius(i))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage),a.lineAtlas&&(this.lineAtlas=a.lineAtlas)}else this.collisionBoxArray=new c8}unloadVectorData(){if(this.hasData()){for(const a in this.buckets)this.buckets[a].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(a){return this.buckets[a.id]}upload(a){for(const d in this.buckets){const c=this.buckets[d];c.uploadPending()&&c.upload(a)}const b=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new eh(a,this.imageAtlas.image,b.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new eh(a,this.glyphAtlasImage,b.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new eh(a,this.lineAtlas.image,b.ALPHA),this.lineAtlas.uploaded=!0)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,b,c,d,e,f,g,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:g,transform:f,params:e,tileTransform:this.tileTransform},a,b,c):{}}querySourceFeatures(m,a){const b=this.latestFeatureIndex;if(!b||!b.rawTileData)return;const g=b.loadVTLayers(),h=a?a.sourceLayer:"",d=g._geojsonTileLayer||g[h];if(!d)return;const e=gB(a&&a.filter),{z:i,x:j,y:k}=this.tileID.canonical,n={z:i,x:j,y:k};for(let f=0;fe)a=!1;else if(c){if(this.expirationTime=0;f--){const g=4*f,h=aa[g+0],i=aa[g+1],j=aa[g+2],k=aa[g+3],l=h+j>>1,m=i+k>>1,r=l+m-i,s=m+h-l,t=33*i+h,u=33*k+j,a=33*m+l,y=Math.hypot((k7[2*t+0]+k7[2*u+0])/2-k7[2*a+0],(k7[2*t+1]+k7[2*u+1])/2-k7[2*a+1])>=16;if(k8[a]=k8[a]||(y?1:0),f<1022){const z=(i+s>>1)*33+(h+r>>1),A=(k+s>>1)*33+(j+r>>1);k8[a]=k8[a]||k8[z]||k8[A]}}const B=new am,C=new aq;let D=0;function E(b,c){const a=33*c+b;return 0===k9[a]&&(B.emplaceBack(k7[2*a+0],k7[2*a+1],8192*b/32,8192*c/32),k9[a]=++D),k9[a]-1}function v(a,b,e,f,c,d){const g=a+e>>1,h=b+f>>1;if(Math.abs(a-c)+Math.abs(b-d)>1&&k8[33*h+g])v(c,d,a,b,g,h),v(e,f,c,d,g,h);else{const i=E(a,b),j=E(e,f),k=E(c,d);C.emplaceBack(i,j,k)}}return v(0,0,32,32,32,0),v(32,32,0,0,0,32),{vertices:B,indices:C}}(this.tileID.canonical,e);a=g.vertices,b=g.indices}else{for(const{x:i,y:j}of(a=new am,b=new aq,h))a.emplaceBack(i,j,0,0);const d=dM(a.int16,void 0,4);for(let c=0;c{const a=65*d+b;c.emplaceBack(a+1,a,a+65),c.emplaceBack(a+65,a+65+1,a+1)};for(let a=0;a<64;a++)for(let b=0;b<64;b++)d(b,a);return c}getWirefameBuffer(b){if(!this.wireframeSegments){const a=this._createWireframeGrid();this.wireframeIndexBuffer=b.createIndexBuffer(a),this.wireframeSegments=ay.simpleSegment(0,0,4096,a.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const c=new Y,d=(b,d)=>{const a=65*d+b;c.emplaceBack(a,a+1),c.emplaceBack(a,a+65),c.emplaceBack(a,a+65+1)};for(let a=0;a<64;a++)for(let b=0;b<64;b++)d(b,a);return c}}function ew(a,b){if(!b.isReprojectedInTileSpace)return{scale:1<m&&(n(i,a,e,f,c,d),n(a,j,c,d,g,h))}n(c,d,h,j,i,j),n(d,e,i,j,i,k),n(e,f,i,k,h,k),n(f,c,h,k,h,j),o-=m,p-=m,q+=m,r+=m;const l=1/Math.max(q-o,r-p);return{scale:l,x:o*l,y:p*l,x2:q*l,y2:r*l,projection:b}}class ex{constructor(c){const d={},e=[];for(const f in c){const g=c[f],q=d[f]={};for(const h in g.glyphs){const a=g.glyphs[+h];if(!a||0===a.bitmap.width||0===a.bitmap.height)continue;const i=a.metrics.localGlyph?2:1,j={x:0,y:0,w:a.bitmap.width+2*i,h:a.bitmap.height+2*i};e.push(j),q[h]=j}}const{w:r,h:s}=d3(e),k=new dJ({width:r||1,height:s||1});for(const l in c){const m=c[l];for(const n in m.glyphs){const b=m.glyphs[+n];if(!b||0===b.bitmap.width||0===b.bitmap.height)continue;const o=d[l][n],p=b.metrics.localGlyph?2:1;dJ.copy(b.bitmap,k,{x:0,y:0},{x:o.x+p,y:o.y+p},b.bitmap)}}this.image=k,this.positions=d}}c("GlyphAtlas",ex);class lk{constructor(a){this.tileID=new bn(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),this.tileZoom=a.tileZoom,this.uid=a.uid,this.zoom=a.zoom,this.canonical=a.tileID.canonical,this.pixelRatio=a.pixelRatio,this.tileSize=a.tileSize,this.source=a.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=a.showCollisionBoxes,this.collectResourceTiming=!!a.collectResourceTiming,this.returnDependencies=!!a.returnDependencies,this.promoteId=a.promoteId,this.enableTerrain=!!a.enableTerrain,this.isSymbolTile=a.isSymbolTile,this.tileTransform=ew(a.tileID.canonical,a.projection),this.projection=a.projection}parse(h,v,i,j,E){this.status="parsing",this.data=h,this.collisionBoxArray=new c8;const w=new kV(Object.keys(h.layers).sort()),c=new el(this.tileID,this.promoteId);c.bucketLayerIDs=[];const x={},m=new bl(256,256),d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:m,availableImages:i},k=v.familiesBySource[this.source];for(const b in k){const e=h.layers[b];if(!e)continue;let n=!1,o=!1;for(const y of k[b])"symbol"===y[0].type?n=!0:o=!0;if(!0===this.isSymbolTile&&!n|| !1===this.isSymbolTile&&!o)continue;1===e.version&&bY(`Vector tile source "${this.source}" layer "${b}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const p=w.encode(b),q=[];for(let f=0;f=a.maxzoom||"none"!==a.visibility&&(ll(g,this.zoom,i),(x[a.id]=a.createBucket({index:c.bucketLayerIDs.length,layers:g,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:p,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:i})).populate(q,d,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(g.map(a=>a.id)))}}let F,A,B,C;m.trim();const l={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},s=eP(d.glyphDependencies,a=>Object.keys(a).map(Number));Object.keys(s).length?j.send("getGlyphs",{uid:this.uid,stacks:s},(a,b)=>{F||(F=a,A=b,D.call(this))},void 0,!1,l):A={};const t=Object.keys(d.iconDependencies);t.length?j.send("getImages",{icons:t,source:this.source,tileID:this.tileID,type:"icons"},(a,b)=>{F||(F=a,B=b,D.call(this))},void 0,!1,l):B={};const u=Object.keys(d.patternDependencies);function D(){if(F)return E(F);if(A&&B&&C){const b=new ex(A),e=new d4(B,C);for(const f in x){const a=x[f];a instanceof aB?(ll(a.layers,this.zoom,i),ku(a,A,b.positions,B,e.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection),a.projection=this.projection.name):a.hasPattern&&(a instanceof dX||a instanceof dN||a instanceof dU)&&(ll(a.layers,this.zoom,i),a.addFeatures(d,this.tileID.canonical,e.patternPositions,i))}this.status="done",E(null,{buckets:bQ(x).filter(a=>!a.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,lineAtlas:m,imageAtlas:e,glyphMap:this.returnDependencies?A:null,iconMap:this.returnDependencies?B:null,glyphPositions:this.returnDependencies?b.positions:null})}}u.length?j.send("getImages",{icons:u,source:this.source,tileID:this.tileID,type:"patterns"},(a,b)=>{F||(F=a,C=b,D.call(this))},void 0,!1,l):C={},D.call(this)}}function ll(a,b,c){const d=new c5(b);for(const e of a)e.recalculate(d,c)}class ey{constructor(a){this.entries={},this.scheduler=a}request(b,d,e,c){const a=this.entries[b]=this.entries[b]||{callbacks:[]};if(a.result){const[f,g]=a.result;return this.scheduler?this.scheduler.add(()=>{c(f,g)},d):c(f,g),()=>{}}return a.callbacks.push(c),a.cancel||(a.cancel=e((c,e)=>{for(const f of(a.result=[c,e],a.callbacks))this.scheduler?this.scheduler.add(()=>{f(c,e)},d):f(c,e);setTimeout(()=>delete this.entries[b],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(a=>a!==c),a.callbacks.length||(a.cancel(),delete this.entries[b]))}}}function ez(a,c,d){const b=JSON.stringify(a.request);return a.data&&(this.deduped.entries[b]={result:[null,a.data]}),this.deduped.request(b,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},b=>{const c=fi(a.request,(c,a,e,f)=>{c?b(c):a&&b(null,{vectorTile:d?void 0:new _.VectorTile(new d2(a)),rawData:a,cacheControl:e,expires:f})});return()=>{c.cancel(),b()}},c)}const lm=aI(new Float64Array(16));class ln{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lm}createTileMatrix(e){let a,f,g;const c=e.canonical,b=aI(new Float64Array(16)),h=this._tr.projection;if(h.isReprojectedInTileSpace){const d=ew(c,h);a=1,f=d.x+e.wrap*d.scale,g=d.y,bs(b,b,[a/d.scale,a/d.scale,this._tr.pixelsPerMeter/this._worldSize,])}else a=this._worldSize/this._tr.zoomScale(c.z),f=(c.x+Math.pow(2,c.z)*e.wrap)*a,g=c.y*a;return br(b,b,[f,g,0]),bs(b,b,[a/8192,a/8192,1]),b}pointCoordinate(a,b,c){const d=this._tr.horizonLineFromTop(!1),e=new aF(a,Math.max(d,b));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(e,c))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var eA={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&eJ(this.parallels,this.constants.parallels))return;const a=Math.sin(this.parallels[0]*aP),b=(a+Math.sin(this.parallels[1]*aP))/2,c=1+a*(2*b-a),d=Math.sqrt(c)/b;this.constants={n:b,c:c,r0:d,parallels:this.parallels}},project(d,e){this.initializeConstants();const b=(d-this.center[0])*aP,{n:a,c:f,r0:g}=this.constants,c=Math.sqrt(f-2*a*Math.sin(e*aP))/a;return{x:c*Math.sin(b*a),y:c*Math.cos(b*a)-g,z:0}},unproject(c,f){this.initializeConstants();const{n:a,c:g,r0:h}=this.constants,b=h+f;let d=Math.atan2(c,Math.abs(b))*Math.sign(b);b*a<0&&(d-=Math.PI*Math.sign(c)*Math.sign(b));const e=this.center[0]*aP*a;d=bO(d,-Math.PI-e,Math.PI-e);const i=d/a*eK+this.center[0],j=Math.asin(bM((g-(c*c+b*b)*a*a)/(2*a),-1,1)),k=bM(j*eK,-85.051129,85.051129);return new dy(i,k)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lo=Math.sqrt(3)/2;var eB={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(c,d){d=d/180*Math.PI,c=c/180*Math.PI;const b=Math.asin(lo*Math.sin(d)),a=b*b,e=a*a*a;return{x:.5*(c*Math.cos(b)/(lo*(1.340264+ -0.24331799999999998*a+e*(.0062510000000000005+.034164*a)))/Math.PI+.5),y:1-.5*(b*(1.340264+ -0.081106*a+e*(893e-6+.003796*a))/Math.PI+1),z:0}},unproject(d,e){d=(2*d-.5)*Math.PI;let b=e=(2*(1-e)-1)*Math.PI,a=b*b,c=a*a*a;for(let f,g,h,i=0;i<12&&(g=b*(1.340264+ -0.081106*a+c*(893e-6+.003796*a))-e,h=1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a),f=g/h,b=bM(b-f,-Math.PI/3,Math.PI/3),a=b*b,c=a*a*a,!(1e-12>Math.abs(f)));++i);const j=lo*d*(1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a))/Math.cos(b),k=Math.asin(Math.sin(b)/lo),l=bM(180*j/Math.PI,-180,180),m=bM(180*k/Math.PI,-85.051129,85.051129);return new dy(l,m)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)},eC={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(a,b)=>({x:.5+a/360,y:.5-b/360,z:0}),unproject(a,b){const c=bM(360*(.5-b),-85.051129,85.051129);return new dy(360*(a-.5),c)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lp=Math.PI/2;function lq(a){return Math.tan((lp+a)/2)}var lr,eD={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&eJ(this.parallels,this.constants.parallels))return;const a=this.parallels[0]*aP,b=this.parallels[1]*aP,d=Math.cos(a),c=a===b?Math.sin(a):Math.log(d/Math.cos(b))/Math.log(lq(b)/lq(a)),e=d*Math.pow(lq(a),c)/c;this.constants={n:c,f:e,parallels:this.parallels}},project(b,a){this.initializeConstants(),a*=aP,b=(b-this.center[0])*aP;const{n:c,f:d}=this.constants;d>0?a< -lp+1e-6&&(a=-lp+1e-6):a>lp-1e-6&&(a=lp-1e-6);const e=d/Math.pow(lq(a),c),f=e*Math.sin(c*b),g=d-e*Math.cos(c*b);return{x:.5*(f/Math.PI+.5),y:1-.5*(g/Math.PI+.5),z:0}},unproject(a,d){this.initializeConstants(),a=(2*a-.5)*Math.PI,d=(2*(1-d)-.5)*Math.PI;const{n:c,f:e}=this.constants,b=e-d,f=Math.sign(b),h=Math.sign(c)*Math.sqrt(a*a+b*b);let g=Math.atan2(a,Math.abs(b))*f;b*c<0&&(g-=Math.PI*Math.sign(a)*f);const i=bM(g/c*eK+this.center[0],-180,180),j=bM((2*Math.atan(Math.pow(e/h,1/c))-lp)*eK,-85.051129,85.051129);return new dy(i,j)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)},eE={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(a,b)=>({x:dz(a),y:dA(b),z:0}),unproject(a,b){const c=h7(a),d=dC(b);return new dy(c,d)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const ls=85.051129*aP;var eF={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(d,c){const a=(c*=aP)*c,b=a*a;return{x:.5*((d*=aP)*(.8707-.131979*a+b*(b*(.003971*a-.001529*b)-.013791))/Math.PI+.5),y:1-.5*(c*(1.007226+a*(.015085+b*(.028874*a-.044475-.005916*b)))/Math.PI+1),z:0}},unproject(d,e){d=(2*d-.5)*Math.PI;let b=e=(2*(1-e)-1)*Math.PI,g=25,f=0,a=b*b;do{a=b*b;const c=a*a;f=(b*(1.007226+a*(.015085+c*(.028874*a-.044475-.005916*c)))-e)/(1.007226+a*(.045255+c*(.259866*a-.311325-.06507600000000001*c))),b=bM(b-f,-ls,ls)}while(Math.abs(f)>1e-6&& --g>0)a=b*b;const h=bM(d/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*eK,-180,180),i=b*eK;return new dy(h,i)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lt=85.051129*aP,lu={albers:eA,equalEarth:eB,equirectangular:eC,lambertConformalConic:eD,mercator:eE,naturalEarth:eF,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b*=aP,a*=aP;const c=Math.cos(b),d=Math.acos(c*Math.cos(a/2)),e=Math.sin(d)/d,f=.5*(a*(2/Math.PI)+2*c*Math.sin(a/2)/e)||0,g=.5*(b+Math.sin(b)/e)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(g/Math.PI+1),z:0}},unproject(j,k){let b=j=(2*j-.5)*Math.PI,c=k=(2*(1-k)-1)*Math.PI,z=25,l=0,m=0;do{const a=Math.cos(c),d=Math.sin(c),o=2*d*a,p=d*d,n=a*a,e=Math.cos(b/2),f=Math.sin(b/2),q=2*e*f,r=f*f,h=1-n*e*e,i=h?1/h:0,g=h?Math.acos(a*e)*Math.sqrt(1/h):0,s=.5*(2*g*a*f+2*b/Math.PI)-j,t=.5*(g*d+c)-k,u=.5*i*(n*r+g*a*e*p)+1/Math.PI,v=i*(q*o/4-g*d*f),w=.125*i*(o*f-g*d*n*q),x=.5*i*(p*e+g*r*a)+.5,y=v*w-x*u;l=(t*v-s*x)/y,m=(s*w-t*u)/y,b=bM(b-l,-Math.PI,Math.PI),c=bM(c-m,-lt,lt)}while((Math.abs(l)>1e-6||Math.abs(m)>1e-6)&& --z>0)return new dy(b*eK,c*eK)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)}};a.ARRAY_TYPE=I,a.AUTH_ERR_MSG=b1,a.Aabb=B,a.Actor=class{constructor(a,b,c){this.target=a,this.parent=b,this.mapId=c,this.callbacks={},this.cancelCallbacks={},bU(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=bZ()?a:s,this.scheduler=new class{constructor(){this.tasks={},this.taskQueue=[],bU(["process"],this),this.invoker=new class{constructor(a){this._callback=a,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}(this.process),this.nextId=0}add(b,c){const a=this.nextId++,d=function({type:b,isSymbolTile:c,zoom:a}){return a=a||0,"message"===b?0:"maybePrepare"!==b||c?"parseTile"!==b||c?"parseTile"===b&&c?300-a:"maybePrepare"===b&&c?400-a:500:200-a:100-a}(c);return 0===d?(bZ(),b(),{cancel(){}}):(this.tasks[a]={fn:b,metadata:c,priority:d,id:a},this.taskQueue.push(a),this.invoker.trigger(),{cancel:()=>{delete this.tasks[a]}})}process(){bZ();{if(this.taskQueue=this.taskQueue.filter(a=>!!this.tasks[a]),!this.taskQueue.length)return;const a=this.pick();if(null===a)return;const b=this.tasks[a];if(delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),!b)return;b.fn()}}pick(){let a=null,c=1/0;for(let b=0;b{a&&delete this.callbacks[b],this.target.postMessage({id:b,type:"",targetMapId:f,sourceMapId:this.mapId})}}}receive(e){const a=e.data,b=a.id;if(b&&(!a.targetMapId||this.mapId===a.targetMapId)){if(""===a.type){const c=this.cancelCallbacks[b];delete this.cancelCallbacks[b],c&&c.cancel()}else if(a.mustQueue||bZ()){const d=this.callbacks[b];this.cancelCallbacks[b]=this.scheduler.add(()=>this.processTask(b,a),d&&d.metadata||{type:"message"})}else this.processTask(b,a)}}processTask(e,a){if(""===a.type){const b=this.callbacks[e];delete this.callbacks[e],b&&(a.error?b(g0(a.error)):b(null,g0(a.data)))}else{const g=eX(this.globalScope)?void 0:[],c=a.hasCallback?(a,b)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:a?g_(a):null,data:g_(b,g)},g)}:a=>{},d=g0(a.data);if(this.parent[a.type])this.parent[a.type](a.sourceMapId,d,c);else if(this.parent.getWorkerSource){const f=a.type.split(".");this.parent.getWorkerSource(a.sourceMapId,f[0],d.source)[f[1]](d,c)}else c(new Error(`Could not find function ${a.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.CanonicalTileID=bm,a.Color=m,a.ColorMode=r,a.CullFaceMode=o,a.DEMData=bo,a.DataConstantProperty=e,a.DedupedRequest=ey,a.DepthMode=C,a.EXTENT=8192,a.Elevation=class{getAtPointOrZero(a,b=0){return this.getAtPoint(a,b)||0}getAtPoint(a,f,o=!0){null==f&&(f=null);const i=this._source();if(!i||a.y<0||a.y>1)return f;const g=i.getSource().maxzoom,j=1<{const e=this.getAtTileOffset(a,c.x,c.y),d=b.upVector(a.canonical,c.x,c.y);return bx(d,d,e*b.upVectorScale(a.canonical)),d}}getForTilePoints(a,b,e,c){const d=k4.create(this,a,c);return!!d&&(b.forEach(a=>{a[2]=this.exaggeration()*d.getElevationAt(a[0],a[1],e)}),!0)}getMinMaxForTile(a){const c=this.findDEMTileFor(a);if(!c||!c.dem)return null;const d=c.dem.tree,e=c.tileID,h=1<Math.abs(e))return!1;const d=((b[0]-this.pos[0])*a[0]+(b[1]-this.pos[1])*a[1]+(b[2]-this.pos[2])*a[2])/e;return c[0]=this.pos[0]+this.dir[0]*d,c[1]=this.pos[1]+this.dir[1]*d,c[2]=this.pos[2]+this.dir[2]*d,!0}closestPointOnSphere(i,b,a){var j,k,n,o,p,q,r,s;if(j=this.pos,k=i,n=j[0],o=j[1],p=j[2],q=k[0],r=k[1],s=k[2],Math.abs(n-q)<=1e-6*Math.max(1,Math.abs(n),Math.abs(q))&&Math.abs(o-r)<=1e-6*Math.max(1,Math.abs(o),Math.abs(r))&&Math.abs(p-s)<=1e-6*Math.max(1,Math.abs(p),Math.abs(s))||0===b)return a[0]=a[1]=a[2]=0,!1;const[f,g,h]=this.dir,c=this.pos[0]-i[0],d=this.pos[1]-i[1],e=this.pos[2]-i[2],w=f*f+g*g+h*h,l=2*(c*f+d*g+e*h),x=l*l-4*w*(c*c+d*d+e*e-b*b);if(x<0){const t=Math.max(-l/2,0),y=c+f*t,z=d+g*t,A=e+h*t,u=Math.hypot(y,z,A);return a[0]=y*b/u,a[1]=z*b/u,a[2]=A*b/u,!1}{const m=(-l-Math.sqrt(x))/(2*w);if(m<0){const v=Math.hypot(c,d,e);return a[0]=c*b/v,a[1]=d*b/v,a[2]=e*b/v,!1}return a[0]=c+f*m,a[1]=d+g*m,a[2]=e+h*m,!0}}},a.RequestManager=class{constructor(a,b,c){this._transformRequestFn=a,this._customAccessToken=b,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const a=function(){let a="";for(let b=0;b<10;b++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",a].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(a,b){return this._transformRequestFn&&this._transformRequestFn(a,b)||{url:a}}normalizeStyleURL(a,c){if(!b2(a))return a;const b=e4(a);return b.path=`/styles/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||c)}normalizeGlyphsURL(a,c){if(!b2(a))return a;const b=e4(a);return b.path=`/fonts/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||c)}normalizeSourceURL(b,c){if(!b2(b))return b;const a=e4(b);return a.path=`/v4/${a.authority}.json`,a.params.push("secure"),this._makeAPIURL(a,this._customAccessToken||c)}normalizeSpriteURL(b,c,d,e){const a=e4(b);return b2(b)?(a.path=`/styles/v1${a.path}/sprite${c}${d}`,this._makeAPIURL(a,this._customAccessToken||e)):(a.path+=`${c}${d}`,e5(a))}normalizeTileURL(b,e,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),b&&!b2(b))return b;const a=e4(b);a.path=a.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||c&&"raster"!==a.authority&&512===c?"@2x":""}${b0.supported?".webp":"$1"}`),"raster"===a.authority?a.path=`/${b_.RASTER_URL_PREFIX}${a.path}`:(a.path=a.path.replace(/^.+\/v4\//,"/"),a.path=`/${b_.TILE_URL_VERSION}${a.path}`);const d=this._customAccessToken||function(b){for(const c of b){const a=c.match(/^access_token=(.*)$/);if(a)return a[1]}return null}(a.params)||b_.ACCESS_TOKEN;return b_.REQUIRE_ACCESS_TOKEN&&d&&this._skuToken&&a.params.push(`sku=${this._skuToken}`),this._makeAPIURL(a,d)}canonicalizeTileURL(d,e){const a=e4(d);if(!a.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!a.path.match(/\.[\w]+$/))return d;let b="mapbox://";a.path.match(/^\/raster\/v1\//)?b+=`raster/${a.path.replace(`/${b_.RASTER_URL_PREFIX}/`,"")}`:b+=`tiles/${a.path.replace(`/${b_.TILE_URL_VERSION}/`,"")}`;let c=a.params;return e&&(c=c.filter(a=>!a.match(/^access_token=/))),c.length&&(b+=`?${c.join("&")}`),b}canonicalizeTileset(d,c){const e=!!c&&b2(c),a=[];for(const b of d.tiles||[])e2(b)?a.push(this.canonicalizeTileURL(b,e)):a.push(b);return a}_makeAPIURL(a,b){const d="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",c=e4(b_.API_URL);if(a.protocol=c.protocol,a.authority=c.authority,"http"===a.protocol){const e=a.params.indexOf("secure");e>=0&&a.params.splice(e,1)}if("/"!==c.path&&(a.path=`${c.path}${a.path}`),!b_.REQUIRE_ACCESS_TOKEN)return e5(a);if(b=b||b_.ACCESS_TOKEN,!this._silenceAuthErrors){if(!b)throw new Error(`An API access token is required to use Mapbox GL. ${d}`);if("s"===b[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${d}`)}return a.params=a.params.filter(a=>-1===a.indexOf("access_token")),a.params.push(`access_token=${b||""}`),e5(a)}},a.ResourceType=aV,a.SegmentVector=ay,a.SourceCache=aD,a.StencilMode=aC,a.StructArrayLayout1ui2=av,a.StructArrayLayout2f1f2i16=ap,a.StructArrayLayout2i4=al,a.StructArrayLayout2ui4=Y,a.StructArrayLayout3f12=an,a.StructArrayLayout3ui6=aq,a.StructArrayLayout4i8=am,a.Texture=eh,a.Tile=eq,a.Transitionable=c6,a.Uniform1f=dl,a.Uniform1i=class extends ax{constructor(a,b){super(a,b),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},a.Uniform2f=class extends ax{constructor(a,b){super(a,b),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},a.Uniform3f=class extends ax{constructor(a,b){super(a,b),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},a.Uniform4f=dm,a.UniformColor=dn,a.UniformMatrix2f=class extends ax{constructor(a,b){super(a,b),this.current=hY}set(b){for(let a=0;a<4;a++)if(b[a]!==this.current[a]){this.current=b,this.gl.uniformMatrix2fv(this.location,!1,b);break}}},a.UniformMatrix3f=class extends ax{constructor(a,b){super(a,b),this.current=hX}set(b){for(let a=0;a<9;a++)if(b[a]!==this.current[a]){this.current=b,this.gl.uniformMatrix3fv(this.location,!1,b);break}}},a.UniformMatrix4f=class extends ax{constructor(a,b){super(a,b),this.current=hW}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let b=1;b<16;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},a.UnwrappedTileID=ej,a.ValidationError=cc,a.VectorTileWorkerSource=class extends S{constructor(a,b,c,d,e){super(),this.actor=a,this.layerIndex=b,this.availableImages=c,this.loadVectorData=e||ez,this.loading={},this.loaded={},this.deduped=new ey(a.scheduler),this.isSpriteLoaded=d,this.scheduler=a.scheduler}loadTile(a,e){const c=a.uid,b=a&&a.request,f=b&&b.collectResourceTiming,d=this.loading[c]=new lk(a);d.abort=this.loadVectorData(a,(h,g)=>{const i=!this.loading[c];if(delete this.loading[c],i||h||!g)return d.status="done",i||(this.loaded[c]=d),e(h);const k=g.rawData,j={};g.expires&&(j.expires=g.expires),g.cacheControl&&(j.cacheControl=g.cacheControl),d.vectorTile=g.vectorTile||new _.VectorTile(new d2(k));const l=()=>{d.parse(d.vectorTile,this.layerIndex,this.availableImages,this.actor,(a,c)=>{if(a||!c)return e(a);const d={};if(f){const g=ei(b);g.length>0&&(d.resourceTiming=JSON.parse(JSON.stringify(g)))}e(null,bR({rawTileData:k.slice(0)},c,j,d))})};this.isSpriteLoaded?l():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(l,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom}):l()}),this.loaded=this.loaded||{},this.loaded[c]=d})}reloadTile(b,f){const c=this.loaded,e=b.uid,g=this;if(c&&c[e]){const a=c[e];a.showCollisionBoxes=b.showCollisionBoxes,a.enableTerrain=!!b.enableTerrain,a.projection=b.projection;const d=(c,d)=>{const b=a.reloadCallback;b&&(delete a.reloadCallback,a.parse(a.vectorTile,g.layerIndex,this.availableImages,g.actor,b)),f(c,d)};"parsing"===a.status?a.reloadCallback=d:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,d):d())}}abortTile(c,d){const b=c.uid,a=this.loading[b];a&&(a.abort&&a.abort(),delete this.loading[b]),d()}removeTile(c,d){const a=this.loaded,b=c.uid;a&&a[b]&&delete a[b],d()}},a.WritingMode=d5,a.ZoomHistory=c0,a.add=bw,a.addDynamicAttributes=bk,a.adjoint=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8];return a[0]=g*k-h*j,a[1]=e*j-d*k,a[2]=d*h-e*g,a[3]=h*i-f*k,a[4]=c*k-e*i,a[5]=e*f-c*h,a[6]=f*j-g*i,a[7]=d*i-c*j,a[8]=c*g-d*f,a},a.asyncAll=bP,a.bezier=aQ,a.bindAll=bU,a.boundsAttributes=ep,a.bufferConvexPolygon=function(a,g){const e=[];for(let b=0;bfd&&(a.getActor().send("enforceCacheSizeLimit",fc),fg=0)},a.calculateGlobeMatrix=eu,a.calculateGlobeMercatorMatrix=function(a){const c=a.worldSize,f=bM(a.center.lat,-85.051129,85.051129),d=new aF(dz(a.center.lng)*c,dA(f)*c),g=dB(1,a.center.lat)*c,h=a.pixelsPerMeter,e=c/(g/a.pixelsPerMeter),b=aI(new Float64Array(16));return br(b,b,[d.x,d.y,0]),bs(b,b,[e,e,h]),b},a.clamp=bM,a.clearTileCache=function(a){const b=s.caches.delete(e9);a&&b.catch(a).then(()=>a())},a.clipLine=d8,a.clone=function(b){var a=new I(16);return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},a.clone$1=bX,a.collisionCircleLayout=d_,a.config=b_,a.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a},a.create=function(){var a=new I(16);return I!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},a.create$1=aH,a.createExpression=cN,a.createLayout=j,a.createStyleLayer=function(a){return"custom"===a.type?new kJ(a):new kM[a.type](a)},a.cross=bB,a.degToRad=bI,a.div=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a},a.dot=bA,a.ease=bL,a.easeCubicInOut=bK,a.emitValidationErrors=c_,a.endsWith=bV,a.enforceCacheSizeLimit=function(a){fe(),fa&&fa.then(b=>{b.keys().then(d=>{for(let c=0;cb&&(e+=(c[a]-b)*(c[a]-b)),d[a]Math.abs(a.parallels[0]+a.parallels[1])){let c=function(b){const a=Math.max(.01,Math.cos(b*aP)),c=1/(2*Math.max(Math.PI*a,1/a));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(b,d){const e=b*aP*a,f=Math.sin(d*aP)/a;return{x:e*c+.5,y:-f*c+.5,z:0}},unproject(b,d){const e=-(d-.5)/c,f=bM((b-.5)/c*eK/a,-180,180),g=Math.asin(bM(e*a,-1,1)),h=bM(g*eK,-85.051129,85.051129);return new dy(f,h)}}}(a.parallels[0]);if("lambertConformalConic"===a.name){const{project:d,unproject:e}=lu.mercator;c={wrap:!0,supportsWorldCopies:!0,project:d,unproject:e}}return bR({},b,a,c)}return bR({},b,a)}(a,b):a},a.getRTLTextPluginStatus=c3,a.getReferrer=b6,a.getTilePoint=function(a,{x:b,y:c},d=0){return new aF(((b-d)*a.scale-a.x)*8192,(c*a.scale-a.y)*8192)},a.getTileVec3=function(a,b,c=0){return Q(((b.x-c)*a.scale-a.x)*8192,(b.y*a.scale-a.y)*8192,h8(b.z,b.y))},a.getVideo=function(c,e){const a=s.document.createElement("video");a.muted=!0,a.onloadstart=function(){e(null,a)};for(let b=0;b0&&(a=1/Math.sqrt(a)),b[0]=d*a,b[1]=e*a,b[2]=f*a,b[3]=g*a,b},a.number=aY,a.ortho=function(a,b,c,d,e,f,g){var h=1/(b-c),i=1/(d-e),j=1/(f-g);return a[0]=-2*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*i,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*j,a[11]=0,a[12]=(b+c)*h,a[13]=(e+d)*i,a[14]=(g+f)*j,a[15]=1,a},a.pbf=d2,a.perspective=function(a,f,g,c,b){var d,e=1/Math.tan(f/2);return a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(a[10]=(b+c)*(d=1/(c-b)),a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a},a.pick=function(c,d){const e={};for(let a=0;athis._layers[a.id]),e=g[0];if("none"===e.visibility)continue;const h=e.source||"";let c=this.familiesBySource[h];c||(c=this.familiesBySource[h]={});const i=e.sourceLayer||"_geojsonTileLayer";let f=c[i];f||(f=c[i]=[]),f.push(g)}}}const{ImageBitmap:n}=a.window;class o{loadTile(d,e){const{uid:f,encoding:g,rawImageData:b,padding:c,buildQuadTree:h}=d,i=n&&b instanceof n?this.getImageData(b,c):b;e(null,new a.DEMData(f,i,g,c<1,h))}getImageData(b,c){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const d=this.offscreenCanvasContext.getImageData(-c,-c,b.width+2*c,b.height+2*c);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:d.width,height:d.height},d.data)}}var f,p=function e(b,c){var a,d=b&&b.type;if("FeatureCollection"===d)for(a=0;a=Math.abs(d)?b-f+d:d-f+b,b=f}b+g>=0!= !!i&&a.reverse()}const s=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class t{constructor(b){this._feature=b,this.extent=a.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(1===this._feature.type){const b=[];for(const c of this._feature.geometry)b.push([new a.pointGeometry(c[0],c[1]),]);return b}{const d=[];for(const g of this._feature.geometry){const e=[];for(const f of g)e.push(new a.pointGeometry(f[0],f[1]));d.push(e)}return d}}toGeoJSON(a,b,c){return s.call(this,a,b,c)}}class u{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(a){return new t(this._features[a])}}var g=a.vectorTile.VectorTileFeature,h=i;function i(a,b){this.options=b||{},this.features=a,this.length=a.length}function b(a,b){this.id="number"==typeof a.id?a.id:void 0,this.type=a.type,this.rawGeometry=1===a.type?[a.geometry]:a.geometry,this.properties=a.tags,this.extent=b||4096}i.prototype.feature=function(a){return new b(this.features[a],this.options.extent)},b.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var c=0;c>31}function A(f,a){for(var g=f.loadGeometry(),d=f.type,h=0,i=0,n=g.length,e=0;e>1;D(c,d,g,a,b,f%2),C(c,d,e,a,g-1,f+1),C(c,d,e,g+1,b,f+1)}function D(g,a,e,b,d,h){for(;d>b;){if(d-b>600){const f=d-b+1,l=e-b+1,m=Math.log(f),j=.5*Math.exp(2*m/3),n=.5*Math.sqrt(m*j*(f-j)/f)*(l-f/2<0?-1:1);D(g,a,e,Math.max(b,Math.floor(e-l*j/f+n)),Math.min(d,Math.floor(e+(f-l)*j/f+n)),h)}const k=a[2*e+h];let i=b,c=d;for(E(g,a,b,e),a[2*d+h]>k&&E(g,a,b,d);ik;)c--}a[2*b+h]===k?E(g,a,b,c):E(g,a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function E(d,c,a,b){F(d,a,b),F(c,2*a,2*b),F(c,2*a+1,2*b+1)}function F(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function G(c,d,e,f){const a=c-e,b=d-f;return a*a+b*b}c.fromVectorTileJs=j,c.fromGeojsonVt=function(d,b){b=b||{};var c={};for(var a in d)c[a]=new h(d[a].features,b),c[a].name=a,c[a].version=b.version,c[a].extent=b.extent;return j({layers:c})},c.GeoJSONWrapper=h;class H{constructor(b,f=a=>a[0],g=a=>a[1],e=64,h=Float64Array){this.nodeSize=e,this.points=b;const i=b.length<65536?Uint16Array:Uint32Array,c=this.ids=new i(b.length),d=this.coords=new h(2*b.length);for(let a=0;a=j&&b<=l&&c>=k&&c<=m&&n.push(i[d]);continue}const e=Math.floor((h+g)/2);b=f[2*e],c=f[2*e+1],b>=j&&b<=l&&c>=k&&c<=m&&n.push(i[e]);const p=(o+1)%2;(0===o?j<=b:k<=c)&&(a.push(h),a.push(e-1),a.push(p)),(0===o?l>=b:m>=c)&&(a.push(e+1),a.push(g),a.push(p))}return n}(this.ids,this.coords,a,b,c,d,this.nodeSize)}within(a,b,c){return function(j,e,f,g,b,q){const a=[0,j.length-1,0],k=[],o=b*b;for(;a.length;){const l=a.pop(),h=a.pop(),i=a.pop();if(h-i<=q){for(let c=i;c<=h;c++)G(e[2*c],e[2*c+1],f,g)<=o&&k.push(j[c]);continue}const d=Math.floor((i+h)/2),m=e[2*d],n=e[2*d+1];G(m,n,f,g)<=o&&k.push(j[d]);const p=(l+1)%2;(0===l?f-b<=m:g-b<=n)&&(a.push(i),a.push(d-1),a.push(p)),(0===l?f+b>=m:g+b>=n)&&(a.push(d+1),a.push(h),a.push(p))}return k}(this.ids,this.coords,a,b,c,this.nodeSize)}}const I=Math.fround||(f=new Float32Array(1),a=>(f[0]=+a,f[0]));class J{constructor(a){this.options=R(Object.create({minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a}),a),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:c,minZoom:i,maxZoom:f,nodeSize:g}=this.options;c&&console.time("total time");const h=`prepare ${b.length} points`;c&&console.time(h),this.points=b;let a=[];for(let d=0;d=i;e--){const j=+Date.now();a=this._cluster(a,e),this.trees[e]=new H(a,S,T,g,Float32Array),c&&console.log("z%d: %d clusters in %dms",e,a.length,+Date.now()-j)}return c&&console.timeEnd("total time"),this}getClusters(a,d){let b=((a[0]+180)%360+360)%360-180;const e=Math.max(-90,Math.min(90,a[1]));let c=180===a[2]?180:((a[2]+180)%360+360)%360-180;const f=Math.max(-90,Math.min(90,a[3]));if(a[2]-a[0]>=360)b=-180,c=180;else if(b>c){const j=this.getClusters([b,e,180,f],d),k=this.getClusters([-180,e,c,f],d);return j.concat(k)}const h=this.trees[this._limitZoom(d)],l=h.range(O(b),P(f),O(c),P(e)),i=[];for(const m of l){const g=h.points[m];i.push(g.numPoints?M(g):this.points[g.index])}return i}getChildren(c){const h=this._getOriginId(c),g=this._getOriginZoom(c),d="No cluster with the specified id.",a=this.trees[g];if(!a)throw new Error(d);const e=a.points[h];if(!e)throw new Error(d);const i=this.options.radius/(this.options.extent*Math.pow(2,g-1)),j=a.within(e.x,e.y,i),f=[];for(const k of j){const b=a.points[k];b.parentId===c&&f.push(b.numPoints?M(b):this.points[b.index])}if(0===f.length)throw new Error(d);return f}getLeaves(d,a,b){const c=[];return this._appendLeaves(c,d,a=a||10,b=b||0,0),c}getTile(i,d,e){const b=this.trees[this._limitZoom(i)],a=Math.pow(2,i),{extent:j,radius:k}=this.options,c=k/j,g=(e-c)/a,h=(e+1+c)/a,f={features:[]};return this._addTileFeatures(b.range((d-c)/a,g,(d+1+c)/a,h),b.points,d,e,a,f),0===d&&this._addTileFeatures(b.range(1-c/a,g,1,h),b.points,a,e,a,f),d===a-1&&this._addTileFeatures(b.range(0,g,c/a,h),b.points,-1,e,a,f),f.features.length?f:null}getClusterExpansionZoom(a){let b=this._getOriginZoom(a)-1;for(;b<=this.options.maxZoom;){const c=this.getChildren(a);if(b++,1!==c.length)break;a=c[0].properties.cluster_id}return b}_appendLeaves(c,g,e,d,a){const h=this.getChildren(g);for(const f of h){const b=f.properties;if(b&&b.cluster?a+b.point_count<=d?a+=b.point_count:a=this._appendLeaves(c,b.cluster_id,e,d,a):ab&&(c+=o.numPoints||1)}if(c>e&&c>=u){let p=a.x*e,q=a.y*e,i=j&&e>1?this._map(a,!0):null;const l=(g<<5)+(b+1)+this.points.length;for(const x of k){const d=h.points[x];if(d.zoom<=b)continue;d.zoom=b;const r=d.numPoints||1;p+=d.x*r,q+=d.y*r,d.parentId=l,j&&(i||(i=this._map(a,!0)),j(i,this._map(d)))}a.parentId=l,f.push(K(p/c,q/c,l,c,i))}else if(f.push(a),c>1)for(const y of k){const m=h.points[y];m.zoom<=b||(m.zoom=b,f.push(m))}}return f}_getOriginId(a){return a-this.points.length>>5}_getOriginZoom(a){return(a-this.points.length)%32}_map(a,c){if(a.numPoints)return c?R({},a.properties):a.properties;const d=this.points[a.index].properties,b=this.options.map(d);return c&&b===d?R({},b):b}}function K(a,b,c,d,e){return{x:I(a),y:I(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:e}}function L(a,b){const[c,d]=a.geometry.coordinates;return{x:I(O(c)),y:I(P(d)),zoom:1/0,index:b,parentId:-1}}function M(a){return{type:"Feature",id:a.id,properties:N(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),Q(a.y),]}}}function N(b){const a=b.numPoints,c=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a;return R(R({},b.properties),{cluster:!0,cluster_id:b.id,point_count:a,point_count_abbreviated:c})}function O(a){return a/360+.5}function P(c){const b=Math.sin(c*Math.PI/180),a=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return a<0?0:a>1?1:a}function Q(a){return 360*Math.atan(Math.exp((180-360*a)*Math.PI/180))/Math.PI-90}function R(a,b){for(const c in b)a[c]=b[c];return a}function S(a){return a.x}function T(a){return a.y}function U(a,b,c,g){for(var d,f=g,k=c-b>>1,i=c-b,l=a[b],m=a[b+1],n=a[c],o=a[c+1],e=b+3;ef)d=e,f=h;else if(h===f){var j=Math.abs(e-k);jg&&(d-b>3&&U(a,b,d,g),a[d+2]=f,c-d>3&&U(a,d,c,g))}function V(f,g,c,d,h,i){var a=h-c,b=i-d;if(0!==a||0!==b){var e=((f-c)*a+(g-d)*b)/(a*a+b*b);e>1?(c=h,d=i):e>0&&(c+=a*e,d+=b*e)}return(a=f-c)*a+(b=g-d)*b}function W(a,c,d,e){var b={id:void 0===a?null:a,type:c,geometry:d,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(d){var b=d.geometry,c=d.type;if("Point"===c||"MultiPoint"===c||"LineString"===c)X(d,b);else if("Polygon"===c||"MultiLineString"===c)for(var a=0;a0&&(h+=k?(f*d-c*g)/2:Math.sqrt(Math.pow(c-f,2)+Math.pow(d-g,2))),f=c,g=d}var i=a.length-3;a[2]=1,U(a,0,i,j),a[i+2]=1,a.size=Math.abs(h),a.start=0,a.end=a.size}function _(b,d,e,f){for(var a=0;a1?1:a}function ac(j,m,e,d,f,n,o,p){if(d/=m,n>=(e/=m)&&o=d)return null;for(var i=[],k=0;k=e&&r=d)){var b=[];if("Point"===a||"MultiPoint"===a)ad(h,b,e,d,f);else if("LineString"===a)ae(h,b,e,d,f,!1,p.lineMetrics);else if("MultiLineString"===a)ag(h,b,e,d,f,!1);else if("Polygon"===a)ag(h,b,e,d,f,!0);else if("MultiPolygon"===a)for(var g=0;g=e&&d<=f&&(c.push(b[a]),c.push(b[a+1]),c.push(b[a+2]))}}function ae(b,u,e,f,o,v,m){for(var n,g,a=af(b),p=0===o?ai:aj,q=b.start,h=0;he&&(g=p(a,c,d,j,k,e),m&&(a.start=q+n*g)):l>f?r=e&&(g=p(a,c,d,j,k,e),t=!0),r>f&&l<=f&&(g=p(a,c,d,j,k,f),t=!0),!v&&t&&(m&&(a.end=q+n*g),u.push(a),a=af(b)),m&&(q+=n)}var i=b.length-3;c=b[i],d=b[i+1],s=b[i+2],(l=0===o?c:d)>=e&&l<=f&&ah(a,c,d,s),i=a.length-3,v&&i>=3&&(a[i]!==a[0]||a[i+1]!==a[1])&&ah(a,a[0],a[1],a[2]),a.length&&u.push(a)}function af(b){var a=[];return a.size=b.size,a.start=b.start,a.end=b.end,a}function ag(b,c,d,e,f,g){for(var a=0;aa.maxX&&(a.maxX=h),i>a.maxY&&(a.maxY=i)}return a}function ap(f,d,h,m){var b=d.geometry,c=d.type,e=[];if("Point"===c||"MultiPoint"===c)for(var a=0;a0&&a.size<(f?g:b))e.numPoints+=a.length/3;else{for(var d=[],c=0;cg)&&(e.numSimplified++,d.push(a[c]),d.push(a[c+1])),e.numPoints++;f&&function(b,f){for(var e=0,a=0,c=b.length,d=c-2;a0===f)for(a=0,c=b.length;a24)throw new Error("maxZoom should be in the 0-24 range");if(a.promoteId&&a.generateId)throw new Error("promoteId and generateId cannot be used together.");var d,e,b,c,f,g,h=function(a,d){var c=[];if("FeatureCollection"===a.type)for(var b=0;b1&&console.time("creation"),a=this.tiles[u]=ao(g,c,d,b,e),this.tileCoords.push({z:c,x:d,y:b}),j)){j>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c,d,b,a.numFeatures,a.numPoints,a.numSimplified),console.timeEnd("creation"));var v="z"+c;this.stats[v]=(this.stats[v]||0)+1,this.total++}if(a.source=g,m){if(c===e.maxZoom||c===m)continue;var w=1<1&&console.time("clipping");var n,o,p,q,k,l,i=.5*e.buffer/e.extent,r=.5-i,s=.5+i,t=1+i;n=o=p=q=null,k=ac(g,h,d-i,d+s,0,a.minX,a.maxX,e),l=ac(g,h,d+r,d+t,0,a.minX,a.maxX,e),g=null,k&&(n=ac(k,h,b-i,b+s,1,a.minY,a.maxY,e),o=ac(k,h,b+r,b+t,1,a.minY,a.maxY,e),k=null),l&&(p=ac(l,h,b-i,b+s,1,a.minY,a.maxY,e),q=ac(l,h,b+r,b+t,1,a.minY,a.maxY,e),l=null),j>1&&console.timeEnd("clipping"),f.push(n||[],c+1,2*d,2*b),f.push(o||[],c+1,2*d,2*b+1),f.push(p||[],c+1,2*d+1,2*b),f.push(q||[],c+1,2*d+1,2*b+1)}}},d.prototype.getTile=function(a,b,g){var k=this.options,l=k.extent,h=k.debug;if(a<0||a>24)return null;var j=1<1&&console.log("drilling down to z%d-%d-%d",a,b,g);for(var c,d=a,e=b,f=g;!c&&d>0;)d--,e=Math.floor(e/2),f=Math.floor(f/2),c=this.tiles[ar(d,e,f)];return c&&c.source?(h>1&&console.log("found parent tile z%d-%d-%d",d,e,f),h>1&&console.time("drilling down"),this.splitTile(c.source,d,e,f,a,b,g),h>1&&console.timeEnd("drilling down"),this.tiles[i]?am(this.tiles[i],l):null):null};class as extends a.VectorTileWorkerSource{constructor(b,d,e,f,a){super(b,d,e,f,function(g,b){const d=g.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const e=this._geoJSONIndex.getTile(d.z,d.x,d.y);if(!e)return b(null,null);const f=new u(e.features);let a=c(f);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),b(null,{vectorTile:f,rawData:a.buffer})}),a&&(this.loadGeoJSON=a)}loadData(b,e){const c=b&&b.request,f=c&&c.collectResourceTiming;this.loadGeoJSON(b,(i,g)=>{if(i||!g)return e(i);if("object"!=typeof g)return e(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{p(g,!0);try{var j,k;if(b.filter){const l=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===l.result)throw new Error(l.value.map(a=>`${a.key}: ${a.message}`).join(", "));const n=g.features.filter(a=>l.value.evaluate({zoom:0},a));g={type:"FeatureCollection",features:n}}this._geoJSONIndex=b.cluster?new J(function({superclusterOptions:b,clusterProperties:d}){if(!d||!b)return b;const f={},g={},l={accumulated:null,zoom:0},m={properties:null},h=Object.keys(d);for(const c of h){const[e,i]=d[c],j=a.createExpression(i),k=a.createExpression("string"==typeof e?[e,["accumulated",],["get",c,],]:e);f[c]=j.value,g[c]=k.value}return b.map=c=>{m.properties=c;const a={};for(const b of h)a[b]=f[b].evaluate(l,m);return a},b.reduce=(b,c)=>{for(const a of(m.properties=c,h))l.accumulated=b[a],b[a]=g[a].evaluate(l,m)},b}(b)).load(g.features):(j=g,k=b.geojsonVtOptions,new d(j,k))}catch(o){return e(o)}this.loaded={};const h={};if(f){const m=a.getPerformanceMeasurement(c);m&&(h.resourceTiming={},h.resourceTiming[b.source]=JSON.parse(JSON.stringify(m)))}e(null,h)}})}reloadTile(a,b){const c=this.loaded;return c&&c[a.uid]?super.reloadTile(a,b):this.loadTile(a,b)}loadGeoJSON(b,c){if(b.request)a.getJSON(b.request,c);else{if("string"!=typeof b.data)return c(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));try{return c(null,JSON.parse(b.data))}catch(d){return c(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(b,a){try{a(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(c){a(c)}}getClusterChildren(b,a){try{a(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(c){a(c)}}getClusterLeaves(a,b){try{b(null,this._geoJSONIndex.getLeaves(a.clusterId,a.limit,a.offset))}catch(c){b(c)}}}class e{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.getProjection({name:"mercator"}),this.workerSourceTypes={vector:a.VectorTileWorkerSource,geojson:as},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(a,b)=>{if(this.workerSourceTypes[a])throw new Error(`Worker source with name "${a}" already registered.`);this.workerSourceTypes[a]=b},this.self.registerRTLTextPlugin=b=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=b.applyArabicShaping,a.plugin.processBidirectionalText=b.processBidirectionalText,a.plugin.processStyledBidirectionalText=b.processStyledBidirectionalText}}clearCaches(a,c,b){delete this.layerIndexes[a],delete this.availableImages[a],delete this.workerSources[a],delete this.demWorkerSources[a],b()}checkIfReady(b,c,a){a()}setReferrer(b,a){this.referrer=a}spriteLoaded(c,e){for(const f in this.isSpriteLoaded[c]=e,this.workerSources[c]){const b=this.workerSources[c][f];for(const d in b)b[d]instanceof a.VectorTileWorkerSource&&(b[d].isSpriteLoaded=e,b[d].fire(new a.Event("isSpriteLoaded")))}}setImages(a,b,d){for(const e in this.availableImages[a]=b,this.workerSources[a]){const c=this.workerSources[a][e];for(const f in c)c[f].availableImages=b}d()}enableTerrain(c,a,b){this.terrain=a,b()}setProjection(b,c){this.projections[b]=a.getProjection(c)}setLayers(a,b,c){this.getLayerIndex(a).replace(b),c()}updateLayers(b,a,c){this.getLayerIndex(b).update(a.layers,a.removedIds),c()}loadTile(c,b,e){const d=this.enableTerrain?a.extend({enableTerrain:this.terrain},b):b;d.projection=this.projections[c]||this.defaultProjection,this.getWorkerSource(c,b.type,b.source).loadTile(d,e)}loadDEMTile(c,b,d){const e=this.enableTerrain?a.extend({buildQuadTree:this.terrain},b):b;this.getDEMWorkerSource(c,b.source).loadTile(e,d)}reloadTile(c,b,e){const d=this.enableTerrain?a.extend({enableTerrain:this.terrain},b):b;d.projection=this.projections[c]||this.defaultProjection,this.getWorkerSource(c,b.type,b.source).reloadTile(d,e)}abortTile(b,a,c){this.getWorkerSource(b,a.type,a.source).abortTile(a,c)}removeTile(b,a,c){this.getWorkerSource(b,a.type,a.source).removeTile(a,c)}removeSource(b,a,c){if(!this.workerSources[b]||!this.workerSources[b][a.type]||!this.workerSources[b][a.type][a.source])return;const d=this.workerSources[b][a.type][a.source];delete this.workerSources[b][a.type][a.source],void 0!==d.removeSource?d.removeSource(a,c):c()}loadWorkerSource(d,b,a){try{this.self.importScripts(b.url),a()}catch(c){a(c.toString())}}syncRTLPluginState(g,e,c){try{a.plugin.setState(e);const b=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&null!=b){this.self.importScripts(b);const d=a.plugin.isParsed();c(d?void 0:new Error(`RTL Text Plugin failed to import scripts from ${b}`),d)}}catch(f){c(f.toString())}}getAvailableImages(b){let a=this.availableImages[b];return a||(a=[]),a}getLayerIndex(b){let a=this.layerIndexes[b];return a||(a=this.layerIndexes[b]=new m),a}getWorkerSource(a,b,c){return this.workerSources[a]||(this.workerSources[a]={}),this.workerSources[a][b]||(this.workerSources[a][b]={}),this.workerSources[a][b][c]||(this.workerSources[a][b][c]=new this.workerSourceTypes[b]({send:(b,c,d,g,e,f)=>{this.actor.send(b,c,d,a,e,f)},scheduler:this.actor.scheduler},this.getLayerIndex(a),this.getAvailableImages(a),this.isSpriteLoaded[a])),this.workerSources[a][b][c]}getDEMWorkerSource(a,b){return this.demWorkerSources[a]||(this.demWorkerSources[a]={}),this.demWorkerSources[a][b]||(this.demWorkerSources[a][b]=new o),this.demWorkerSources[a][b]}enforceCacheSizeLimit(c,b){a.enforceCacheSizeLimit(b)}getWorkerPerformanceMetrics(b,c,a){a(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new e(self)),e}),a(["./shared"],function(a){var l=m;function m(c){var b,a;return b=c,"undefined"!=typeof window&&"undefined"!=typeof document&&!!Array.prototype&&!!Array.prototype.every&&!!Array.prototype.filter&&!!Array.prototype.forEach&&!!Array.prototype.indexOf&&!!Array.prototype.lastIndexOf&&!!Array.prototype.map&&!!Array.prototype.some&&!!Array.prototype.reduce&&!!Array.prototype.reduceRight&&!!Array.isArray&&!!Function.prototype&&!!Function.prototype.bind&&!!Object.keys&&!!Object.create&&!!Object.getPrototypeOf&&!!Object.getOwnPropertyNames&&!!Object.isSealed&&!!Object.isFrozen&&!!Object.isExtensible&&!!Object.getOwnPropertyDescriptor&&!!Object.defineProperty&&!!Object.defineProperties&&!!Object.seal&&!!Object.freeze&&!!Object.preventExtensions&&!!("JSON"in window&&"parse"in JSON&&"stringify"in JSON)&&!!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var a,b,d=new Blob([""],{type:"text/javascript"}),c=URL.createObjectURL(d);try{b=new Worker(c),a=!0}catch(e){a=!1}return b&&b.terminate(),URL.revokeObjectURL(c),a}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d");if(!b)return!1;var c=b.getImageData(0,0,1,1);return c&&c.width===a.width}()&&(void 0===B[a=b&&b.failIfMajorPerformanceCaveat]&&(B[a]=function(f){var e,c,d,b,a=(e=f,c=document.createElement("canvas"),(d=Object.create(m.webGLContextAttributes)).failIfMajorPerformanceCaveat=e,c.getContext("webgl",d)||c.getContext("experimental-webgl",d));if(!a)return!1;try{b=a.createShader(a.VERTEX_SHADER)}catch(g){return!1}return!(!b||a.isContextLost())&&(a.shaderSource(b,"void main() {}"),a.compileShader(b),!0===a.getShaderParameter(b,a.COMPILE_STATUS))}(a)),!!B[a]&&!document.documentMode)}var B={};function C(b,c){var d=c[0],e=c[1],f=c[2],g=c[3],a=d*g-f*e;return a?(b[0]=g*(a=1/a),b[1]=-e*a,b[2]=-f*a,b[3]=d*a,b):null}function D(a,b){if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(let c=0;c{a.window.removeEventListener("click",G,!0)},0)},b.mousePos=function(a,b){const c=a.getBoundingClientRect();return H(a,c,b)},b.touchPos=function(b,c){const e=b.getBoundingClientRect(),d=[];for(let a=0;a=0?0:b.button};class J extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:b,callback:c}of this.requestors)this._notify(b,c);this.requestors=[]}}getImage(a){return this.images[a]}addImage(a,b){this._validate(a,b)&&(this.images[a]=b)}_validate(d,b){let c=!0;return this._validateStretch(b.stretchX,b.data&&b.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${d}" has invalid "stretchX" value`))),c=!1),this._validateStretch(b.stretchY,b.data&&b.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${d}" has invalid "stretchY" value`))),c=!1),this._validateContent(b.content,b)||(this.fire(new a.ErrorEvent(new Error(`Image "${d}" has invalid "content" value`))),c=!1),c}_validateStretch(b,d){if(!b)return!0;let c=0;for(const a of b){if(a[0]{this.ready=!0})}broadcast(c,d,b){a.asyncAll(this.actors,(a,b)=>{a.send(c,d,b)},b=b||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function V(b,c,d){return c*(a.EXTENT/(b.tileSize*Math.pow(2,d-b.tileID.overscaledZ)))}n.Actor=a.Actor;class W{constructor(b,c,d){this.context=b;const a=b.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(d),this.context.unbindVAO(),b.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete c.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(b){const a=this.context.gl;this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,b.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const X={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Y{constructor(c,b,d,e){this.length=b.length,this.attributes=d,this.itemSize=b.bytesPerElement,this.dynamicDraw=e,this.context=c;const a=c.gl;this.buffer=a.createBuffer(),c.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(b){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,b.arrayBuffer)}enableAttributes(c,d){for(let a=0;ad.pointCoordinate3D(a)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(b,c){let d,e;if(b instanceof a.pointGeometry||"number"==typeof b[0]){const h=a.pointGeometry.convert(b);d=[a.pointGeometry.convert(b)],e=c.isPointAboveHorizon(h)}else{const f=a.pointGeometry.convert(b[0]),g=a.pointGeometry.convert(b[1]);d=[f,g],e=a.polygonizeBounds(f,g).every(a=>c.isPointAboveHorizon(a))}return new _(d,c.getCameraPoint(),e,c)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(b){return a.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],b)}bufferedCameraGeometry(e){const d=this.screenBounds[0],b=1===this.screenBounds.length?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],c=a.polygonizeBounds(d,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>d.x&&this.cameraPoint.x=b.x?c[2]=this.cameraPoint:this.cameraPoint.x<=d.x&&(c[3]=this.cameraPoint)),a.bufferConvexPolygon(c,e)}containsTile(c,d,h){var b;const f=c.queryPadding+1,i=c.tileID.wrap,e=h?this._bufferedCameraMercator(f,d).map(b=>a.getTilePoint(c.tileTransform,b,i)):this._bufferedScreenMercator(f,d).map(b=>a.getTilePoint(c.tileTransform,b,i)),g=this.screenGeometryMercator.map(b=>a.getTileVec3(c.tileTransform,b,i)),j=g.map(b=>new a.pointGeometry(b[0],b[1])),k=d.getFreeCameraOptions().position||new a.MercatorCoordinate(0,0,0),n=a.getTileVec3(c.tileTransform,k,i),l=g.map(c=>{const b=a.sub(c,c,n);return a.normalize(b,b),new a.Ray(n,b)}),m=V(c,1,d.zoom);if(a.polygonIntersectsBox(e,0,0,a.EXTENT,a.EXTENT))return{queryGeometry:this,tilespaceGeometry:j,tilespaceRays:l,bufferedTilespaceGeometry:e,bufferedTilespaceBounds:((b=a.getBounds(e)).min.x=a.clamp(b.min.x,0,a.EXTENT),b.min.y=a.clamp(b.min.y,0,a.EXTENT),b.max.x=a.clamp(b.max.x,0,a.EXTENT),b.max.y=a.clamp(b.max.y,0,a.EXTENT),b),tile:c,tileID:c.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(b,d){const a=aa(b);if(this._screenRaycastCache[a])return this._screenRaycastCache[a];{const c=this.bufferedScreenGeometry(b).map(a=>d.pointCoordinate3D(a));return this._screenRaycastCache[a]=c,c}}_bufferedCameraMercator(b,d){const a=aa(b);if(this._cameraRaycastCache[a])return this._cameraRaycastCache[a];{const c=this.bufferedCameraGeometry(b).map(a=>d.pointCoordinate3D(a));return this._cameraRaycastCache[a]=c,c}}}function aa(a){return 100*a|0}function ab(b,c,e){const d=function(g,f){if(g)return e(g);if(f){const d=a.pick(a.extend(f,b),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);f.vector_layers&&(d.vectorLayers=f.vector_layers,d.vectorLayerIds=d.vectorLayers.map(a=>a.id)),d.tiles=c.canonicalizeTileset(d,b.url),e(null,d)}};return b.url?a.getJSON(c.transformRequest(c.normalizeSourceURL(b.url),a.ResourceType.Source),d):a.exported.frame(()=>d(null,b))}class ac{constructor(b,c,d){this.bounds=a.LngLatBounds.convert(this.validateBounds(b)),this.minzoom=c||0,this.maxzoom=d||24}validateBounds(a){return Array.isArray(a)&&4===a.length?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3]),]:[-180,-90,180,90]}contains(b){const c=Math.pow(2,b.z),d=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*c),e=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*c),f=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*c),g=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*c);return b.x>=d&&b.x=e&&b.y{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):b&&(a.extend(this,b),b.bounds&&(this.tileBounds=new ac(b.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(b.tiles),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(b,e){const c=a.exported.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);b.request=a.getImage(this.map._requestManager.transformRequest(d,a.ResourceType.Tile),(g,f,h,i)=>{if(delete b.request,b.aborted)b.state="unloaded",e(null);else if(g)b.state="errored",e(g);else if(f){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const c=this.map.painter.context,d=c.gl;b.texture=this.map.painter.getTileTexture(f.width),b.texture?b.texture.update(f,{useMipmap:!0}):(b.texture=new a.Texture(c,f,d.RGBA,{useMipmap:!0}),b.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&d.texParameterf(d.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),b.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),e(null)}})}abortTile(a,b){a.request&&(a.request.cancel(),delete a.request),b()}unloadTile(a,b){a.texture&&this.map.painter.saveTileTexture(a.texture),b()}hasTransition(){return!1}}let ad;function ae(e,f,g,h,i,j,k,l){const b=[e,g,i,f,h,j,1,1,1],c=[k,l,1],d=a.adjoint([],b),[m,n,o]=a.transformMat3(c,c,a.transpose(d,d));return a.multiply(b,[m,0,0,0,n,0,0,0,o],b)}class s extends a.Evented{constructor(b,a,c,d){super(),this.id=b,this.dispatcher=c,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=a}load(b,c){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(d,e)=>{this._loaded=!0,d?this.fire(new a.ErrorEvent(d)):e&&(this.image=a.exported.getImageData(e),this.width=this.image.width,this.height=this.image.height,b&&(this.coordinates=b),c&&c(),this._finishLoading())})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url&&(this.options.url=a.url,this.load(a.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}setCoordinates(b){this.coordinates=b,delete this._boundsArray;const c=b.map(a.MercatorCoordinate.fromLngLat);return this.tileID=function(i){let b=1/0,c=1/0,d=-1/0,e=-1/0;for(const f of i)b=Math.min(b,f.x),c=Math.min(c,f.y),d=Math.max(d,f.x),e=Math.max(e,f.y);const j=Math.max(d-b,e-c),g=Math.max(0,Math.floor(-Math.log(j)/Math.LN2)),h=Math.pow(2,g);return new a.CanonicalTileID(g,Math.floor((b+d)/2*h),Math.floor((c+e)/2*h))}(c),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const f=a.tileTransform(this.tileID,this.map.transform.projection),[b,c,d,e]=this.coordinates.map(b=>{const c=f.projection.project(b[0],b[1]);return a.getTilePoint(f,c)._round()});return this.perspectiveTransform=function(c,d,f,g,h,i,j,k,l,m){const e=ae(0,0,c,0,0,d,c,d),b=ae(f,g,h,i,j,k,l,m);return a.multiply(b,a.adjoint(e,e),b),[b[6]/b[8]*c/a.EXTENT,b[7]/b[8]*d/a.EXTENT,]}(this.width,this.height,b.x,b.y,c.x,c.y,e.x,e.y,d.x,d.y),this._boundsArray=new a.StructArrayLayout4i8,this._boundsArray.emplaceBack(b.x,b.y,0,0),this._boundsArray.emplaceBack(c.x,c.y,a.EXTENT,0),this._boundsArray.emplaceBack(e.x,e.y,0,a.EXTENT),this._boundsArray.emplaceBack(d.x,d.y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const b=this.map.painter.context,c=b.gl;for(const e in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new a.Texture(b,this.image,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){const d=this.tiles[e];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}loadTile(a,b){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},b(null)):(a.state="errored",b(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const af={vector:class extends a.Evented{constructor(c,b,d,e){if(super(),this.id=c,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(b,["url","scheme","tileSize","promoteId",])),this._options=a.extend({type:"vector"},b),this._collectResourceTiming=b.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(e),this._tileWorkers={},this._deduped=new a.DedupedRequest}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ab(this._options,this.map._requestManager,(c,b)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):b&&(a.extend(this,b),b.bounds&&(this.tileBounds=new ac(b.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(b.tiles,this.map._requestManager._customAccessToken),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}onAdd(a){this.map=a,this.load()}setSourceProperty(a){this._tileJSONRequest&&this._tileJSONRequest.cancel(),a();const b=this.map.style._getSourceCaches(this.id);for(const c of b)c.clearTiles();this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(b,e){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(d,a.ResourceType.Tile),data:void 0,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,tileSize:this.tileSize*b.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:b.isSymbolTile};if(c.request.collectResourceTiming=this._collectResourceTiming,b.actor&&"expired"!==b.state)"loading"===b.state?b.reloadCallback=e:b.request=b.actor.send("reloadTile",c,g.bind(this));else if(b.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)b.request=b.actor.send("loadTile",c,g.bind(this),void 0,!0);else{const f=a.loadVectorTile.call({deduped:this._deduped},c,(d,a)=>{d||!a?g.call(this,d):(c.data={cacheControl:a.cacheControl,expires:a.expires,rawData:a.rawData.slice(0)},b.actor&&b.actor.send("loadTile",c,g.bind(this),void 0,!0))},!0);b.request={cancel:f}}function g(d,c){return delete b.request,b.aborted?e(null):d&&404!==d.status?e(d):(c&&c.resourceTiming&&(b.resourceTiming=c.resourceTiming),this.map._refreshExpiredTiles&&c&&b.setExpiryData(c),b.loadVectorData(c,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),e(null),void(b.reloadCallback&&(this.loadTile(b,b.reloadCallback),b.reloadCallback=null)))}}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id})}unloadTile(a){a.unloadVectorData(),a.actor&&a.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:r,"raster-dem":class extends r{constructor(c,b,d,e){super(c,b,d,e),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},b),this.encoding=b.encoding||"mapbox"}loadTile(b,d){const c=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function e(a,c){a&&(b.state="errored",d(a)),c&&(b.dem=c,b.dem.onDeserialize(),b.needsHillshadePrepare=!0,b.needsDEMTextureUpload=!0,b.state="loaded",d(null))}b.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),(function(g,c,h,i){if(delete b.request,b.aborted)b.state="unloaded",d(null);else if(g)b.state="errored",d(g);else if(c){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const j=a.window.ImageBitmap&&c instanceof a.window.ImageBitmap&&(null==ad&&(ad=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),ad),f=1-(c.width-a.prevPowerOfTwo(c.width))/2;f<1||b.neighboringTiles||(b.neighboringTiles=this._getNeighboringTiles(b.tileID));const k=j?c:a.exported.getImageData(c,f),l={uid:b.uid,coord:b.tileID,source:this.id,rawImageData:k,encoding:this.encoding,padding:f};b.actor&&"expired"!==b.state||(b.actor=this.dispatcher.getActor(),b.actor.send("loadDEMTile",l,e.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(c){const b=c.canonical,e=Math.pow(2,b.z),f=(b.x-1+e)%e,g=0===b.x?c.wrap-1:c.wrap,h=(b.x+1+e)%e,i=b.x+1===e?c.wrap+1:c.wrap,d={};return d[new a.OverscaledTileID(c.overscaledZ,g,b.z,f,b.y).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,i,b.z,h,b.y).key]={backfilled:!1},b.y>0&&(d[new a.OverscaledTileID(c.overscaledZ,g,b.z,f,b.y-1).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,c.wrap,b.z,b.x,b.y-1).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,i,b.z,h,b.y-1).key]={backfilled:!1}),b.y+1{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new a.ErrorEvent(c));else{const d={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&b&&b.resourceTiming&&b.resourceTiming[this.id]&&(d.resourceTiming=b.resourceTiming[this.id]),this.fire(new a.Event("data",d)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(b,d){const c=b.actor?"reloadTile":"loadTile";b.actor=this.actor,b.request=this.actor.send(c,{type:this.type,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(a,e)=>(delete b.request,b.unloadVectorData(),b.aborted?d(null):a?d(a):(b.loadVectorData(e,this.map.painter,"reloadTile"===c),d(null))),void 0,"loadTile"===c)}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.aborted=!0}unloadTile(a){a.unloadVectorData(),this.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s{constructor(b,a,c,d){super(b,a,c,d),this.roundZoom=!0,this.type="video",this.options=a}load(){this._loaded=!1;const b=this.options;for(const c of(this.urls=[],b.urls))this.urls.push(this.map._requestManager.transformRequest(c,a.ResourceType.Source).url);a.getVideo(this.urls,(b,c)=>{this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(this.video=c,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const b=this.video.seekable;cb.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${b.start(0)} and ${b.end(0)}-second mark.`))):this.video.currentTime=c}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const c=this.map.painter.context,b=c.gl;for(const e in this.texture?this.video.paused||(this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE),b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,this.video)):(this.texture=new a.Texture(c,this.video,b.RGBA),this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const d=this.tiles[e];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s,canvas:class extends s{constructor(c,b,d,e){super(c,b,d,e),b.coordinates?Array.isArray(b.coordinates)&&4===b.coordinates.length&&!b.coordinates.some(a=>!Array.isArray(a)||2!==a.length||a.some(a=>"number"!=typeof a))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "coordinates"'))),b.animate&&"boolean"!=typeof b.animate&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),b.canvas?"string"==typeof b.canvas||b.canvas instanceof a.window.HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "canvas"'))),this.options=b,this.animate=void 0===b.animate||b.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof a.window.HTMLCanvasElement?this.options.canvas:a.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const c=this.map.painter.context,e=c.gl;for(const f in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.Texture(c,this.canvas,e.RGBA,{premultiply:!0}),this.tiles){const d=this.tiles[f];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height,])if(isNaN(a)||a<=0)return!0;return!1}}},ag=function(c,d,e,f){const b=new af[d.type](c,d,e,f);if(b.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${b.id}`);return a.bindAll(["load","abort","unload","serialize","prepare",],b),b};function ah(c,d){const b=a.identity([]);return a.scale(b,b,[.5*c.width,-(.5*c.height),1,]),a.translate(b,b,[1,-1,0]),a.multiply$1(b,b,c.calculateProjMatrix(d.toUnwrapped()))}function ai(b,g,h,i,j,k,l,d=!1){const e=b.tilesIn(i,l,d);e.sort(ak);const f=[];for(const a of e)f.push({wrappedTileID:a.tile.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(g,h,b._state,a,j,k,ah(b.transform,a.tile.tileID),d)});const c=function(j){const b={},d={};for(const e of j){const f=e.queryResults,g=e.wrappedTileID,h=d[g]=d[g]||{};for(const a in f){const k=f[a],i=h[a]=h[a]||{},l=b[a]=b[a]||[];for(const c of k)i[c.featureIndex]||(i[c.featureIndex]=!0,l.push(c))}}return b}(f);for(const m in c)c[m].forEach(c=>{const a=c.feature,d=b.getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=d});return c}function aj(g,h){const b=g.getRenderableIds().map(a=>g.getTileByID(a)),c=[],d={};for(let a=0;a{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[am]}numActive(){return Object.keys(this.active).length}}let an;function ao(){return an||(an=new e),an}function ap(c,e){const d={};for(const b in c)"ref"!==b&&(d[b]=c[b]);return a.refProperties.forEach(a=>{a in e&&(d[a]=e[a])}),d}function aq(a){a=a.slice();const d=Object.create(null);for(let c=0;c0?(e-g)/h:0;return this.points[f].mult(1-i).add(this.points[b].mult(i))}}class az{constructor(a,b,c){const e=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(a/c),this.yCellCount=Math.ceil(b/c);for(let d=0;dthis.width||i<0||g>this.height)return!d&&[];const a=[];if(f<=0&&g<=0&&this.width<=h&&this.height<=i){if(d)return!0;for(let b=0;b0:a}_queryCircle(b,c,a,d,j){const f=b-a,g=b+a,h=c-a,i=c+a;if(g<0||f>this.width||i<0||h>this.height)return!d&&[];const e=[];return this._forEachCell(f,h,g,i,this._queryCellCircle,e,{hitTest:d,circle:{x:b,y:c,radius:a},seenUids:{box:{},circle:{}}},j),d?e.length>0:e}query(a,b,c,d,e){return this._query(a,b,c,d,!1,e)}hitTest(a,b,c,d,e){return this._query(a,b,c,d,!0,e)}hitTestCircle(a,b,c,d){return this._queryCircle(a,b,c,!0,d)}_queryCell(l,m,n,o,p,g,k,h){const i=k.seenUids,q=this.boxCells[p];if(null!==q){const a=this.bboxes;for(const e of q)if(!i.box[e]){i.box[e]=!0;const b=4*e;if(l<=a[b+2]&&m<=a[b+3]&&n>=a[b+0]&&o>=a[b+1]&&(!h||h(this.boxKeys[e]))){if(k.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[e],x1:a[b],y1:a[b+1],x2:a[b+2],y2:a[b+3]})}}}const r=this.circleCells[p];if(null!==r){const c=this.circles;for(const f of r)if(!i.circle[f]){i.circle[f]=!0;const d=3*f;if(this._circleAndRectCollide(c[d],c[d+1],c[d+2],l,m,n,o)&&(!h||h(this.circleKeys[f]))){if(k.hitTest)return g.push(!0),!0;{const s=c[d],t=c[d+1],j=c[d+2];g.push({key:this.circleKeys[f],x1:s-j,y1:t-j,x2:s+j,y2:t+j})}}}}}_queryCellCircle(o,p,q,r,j,k,l,b){const a=l.circle,c=l.seenUids,m=this.boxCells[j];if(null!==m){const d=this.bboxes;for(const e of m)if(!c.box[e]){c.box[e]=!0;const f=4*e;if(this._circleAndRectCollide(a.x,a.y,a.radius,d[f+0],d[f+1],d[f+2],d[f+3])&&(!b||b(this.boxKeys[e])))return k.push(!0),!0}}const n=this.circleCells[j];if(null!==n){const h=this.circles;for(const g of n)if(!c.circle[g]){c.circle[g]=!0;const i=3*g;if(this._circlesCollide(h[i],h[i+1],h[i+2],a.x,a.y,a.radius)&&(!b||b(this.circleKeys[g])))return k.push(!0),!0}}}_forEachCell(c,d,e,f,g,h,i,j){const k=this._convertToXCellCoord(c),l=this._convertToYCellCoord(d),m=this._convertToXCellCoord(e),n=this._convertToYCellCoord(f);for(let a=k;a<=m;a++)for(let b=l;b<=n;b++)if(g.call(this,c,d,e,f,this.xCellCount*b+a,h,i,j))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(d,e,f,g,h,i){const a=g-d,b=h-e,c=f+i;return c*c>a*a+b*b}_circleAndRectCollide(j,k,a,f,g,l,m){const b=(l-f)/2,d=Math.abs(j-(f+b));if(d>b+a)return!1;const c=(m-g)/2,e=Math.abs(k-(g+c));if(e>c+a)return!1;if(d<=b||e<=c)return!0;const h=d-b,i=e-c;return h*h+i*i<=a*a}}const aA=Math.tan(85*Math.PI/180);function aB(e,f,g,h,c,i){let b=a.create();if(g){if("globe"===c.projection.name)b=a.calculateGlobeMatrix(c,c.worldSize/c._projectionScaler,[0,0]),a.multiply$1(b,b,a.globeDenormalizeECEF(a.globeTileBounds(f)));else{const d=C([],i);b[0]=d[0],b[1]=d[1],b[4]=d[2],b[5]=d[3]}h||a.rotateZ(b,b,c.angle)}else a.multiply$1(b,c.labelPlaneMatrix,e);return b}function aC(g,j,h,i,f,b){if(h){if("globe"===f.projection.name){const c=aB(g,j,h,i,f,b);return a.invert(c,c),a.multiply$1(c,g,c),c}{const d=a.clone(g),e=a.identity([]);return e[0]=b[0],e[1]=b[1],e[4]=b[2],e[5]=b[3],a.multiply$1(d,d,e),i||a.rotateZ(d,d,-f.angle),d}}return f.glCoordMatrix}function aD(d,e,f=0){const b=[d.x,d.y,f,1];f?a.transformMat4$1(b,b,e):aP(b,b,e);const c=b[3];return{point:new a.pointGeometry(b[0]/c,b[1]/c),signedDistanceFromCamera:c}}function aE(a,b){return Math.min(.5+a/b*.5,1.5)}function aF(a,b){const c=a[0]/a[3],d=a[1]/a[3];return c>= -b[0]&&c<=b[0]&&d>= -b[1]&&d<=b[1]}function aG(c,m,e,i,n,x,y,z,o,p){const q=e.transform,A=i?c.textSizeData:c.iconSizeData,G=a.evaluateSizeForZoom(A,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1,],d=i?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;d.clear();const B=c.lineVertexArray,r=i?c.text.placedSymbolArray:c.icon.placedSymbolArray,C=e.transform.width/e.transform.height;let f=!1;for(let g=0;gMath.abs(c.x-b.x)*e?{useVertical:!0}:d.writingMode===a.WritingMode.vertical?b.yaA}(b,c,e)?1===d.flipState?{needsFlipping:!0}:null:b.x>c.x?{needsFlipping:!0}:null}function aJ(b,E,c,v,m,n,w,o,d,F,p,e,q,x,r,i,j){const f=E/24,s=b.lineOffsetX*f,t=b.lineOffsetY*f;let g;if(b.numGlyphs>1){const G=b.glyphStartIndex+b.numGlyphs,H=b.lineStartIndex,I=b.lineStartIndex+b.lineLength,h=aH(f,o,s,t,c,p,e,b,d,n,q,r,!1,i,j);if(!h)return{notEnoughRoom:!0};const J=aD(h.first.point,w).point,K=aD(h.last.point,w).point;if(v&&!c){const k=aI(b,J,K,x);if(b.flipState=k&&k.needsFlipping?1:2,k)return k}g=[h.first];for(let u=b.glyphStartIndex+1;u0?B.point:aL(e,A,y,1,m,void 0,i,j.canonical),x);if(b.flipState=l&&l.needsFlipping?1:2,l)return l}const C=aM(f*o.getoffsetX(b.glyphStartIndex),s,t,c,p,e,b.segment,b.lineStartIndex,b.lineStartIndex+b.lineLength,d,n,q,r,!1,!1,i,j);if(!C)return{notEnoughRoom:!0};g=[C]}for(const D of g)a.addDynamicAttributes(F,D.point,D.angle);return{}}function aK(c,g,e,h,f){const b=h.projectTilePoint(c.x,c.y,g);if(!f)return aD(b,e,b.z);const d=f(c);return aD(new a.pointGeometry(b.x+d[0],b.y+d[1]),e,b.z+d[2])}function aL(a,d,b,e,f,g,h,i){const j=aK(a.add(a.sub(d)._unit()),i,f,h,g).point,c=b.sub(j);return b.add(c._mult(e/c.mag()))}function aM(p,q,r,s,t,D,u,k,E,f,F,j,v,w,G,H,I){const x=s?p-q:p+q;let h=x>0?1:-1,l=0;s&&(h*=-1,l=Math.PI),h<0&&(l+=Math.PI);let b=h>0?k+u:k+u+1,c=t,e=t,m=0,i=0;const y=Math.abs(x),n=[],g=[];let d=D;const J=()=>{const c=b-h;return 0===m?D:new a.pointGeometry(f.getx(c),f.gety(c))},z=()=>aL(J(),d,e,y-m+1,F,v,H,I.canonical);for(;m+i<=y;){if((b+=h)=E)return null;if(e=c,n.push(c),w&&g.push(d||J()),void 0===(c=j[b])){d=new a.pointGeometry(f.getx(b),f.gety(b));const A=aK(d,I.canonical,F,H,v);c=A.signedDistanceFromCamera>0?j[b]=A.point:z()}else d=null;m+=i,i=e.dist(c)}G&&v&&(d=d||new a.pointGeometry(f.getx(b),f.gety(b)),j[b]=c=void 0===j[b]?c:z(),i=e.dist(c));const B=(y-m)/i,C=c.sub(e),o=C.mult(B)._add(e);r&&o._add(C._unit()._perp()._mult(r*h));const K=l+Math.atan2(c.y-e.y,c.x-e.x);return n.push(o),w&&(d=d||new a.pointGeometry(f.getx(b),f.gety(b)),g.push(function(c,d,b){const e=1-b;return new a.pointGeometry(c.x*e+d.x*b,c.y*e+d.y*b)}(g.length>0?g[g.length-1]:d,d,B))),{point:o,angle:K,path:n,tilePath:g}}const aN=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function aO(d,a){for(let b=0;ba.sortKey-b.sortKey));this._currentPartIndex[0,0,0],I=new a.pointGeometry(f.tileAnchorX,f.tileAnchorY),r=this.transform.projection.projectTilePoint(f.tileAnchorX,f.tileAnchorY,l.canonical),s=H(I),g=[r.x+s[0],r.y+s[1],r.z+s[2]],t=this.projectAndGetPerspectiveRatio(V,g[0],g[1],g[2],l),{perspectiveRatio:u}=t,v=(q?D/u:D*u)/a.ONE_EM,_=aD(new a.pointGeometry(g[0],g[1]),E,g[2]).point,w=t.signedDistanceFromCamera>0?aH(v,U,f.lineOffsetX*v,f.lineOffsetY*v,!1,_,I,f,T,E,{},k&&!q?H:null,q&&!!k,this.transform.projection,l):null;let m=!1,x=!1,y=!0;if(w&&!t.aboveHorizon){const c=.5*Y*u+Z,h=new a.pointGeometry(-100,-100),i=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),n=new ay,J=w.first,K=w.last;let b=[];for(let z=J.path.length-1;z>=1;z--)b.push(J.path[z]);for(let A=1;A{const c=H(aaD(a,W));b=L.some(a=>a.signedDistanceFromCamera<=0)?[]:L.map(a=>a.point)}let M=[];if(b.length>0){const d=b[0].clone(),e=b[0].clone();for(let j=1;j=h.x&&e.x<=i.x&&d.y>=h.y&&e.y<=i.y?[b]:e.xi.x||e.yi.y?[]:a.clipLine([b],h.x,h.y,i.x,i.y)}for(const ab of M){n.reset(ab,.25*c);let B=0;B=n.length<=.5*c?1:Math.ceil(n.paddedLength/aa)+1;for(let C=0;C0){a.transformMat4$1(b,b,d);let i=!1;this.fogState&&g&&(i=function(d,e,f,g,h,b){const i=b.calculateFogTileMatrix(h),c=[e,f,g];return a.transformMat4(c,c,i),Q(d,c,b.pitch,b._fov)}(this.fogState,e,f,c||0,g.toUnwrapped(),this.transform)>.9),h=b[2]>b[3]||i}else aP(b,b,d);return{point:new a.pointGeometry((b[0]/b[3]+1)/2*this.transform.width+100,(-b[1]/b[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/b[3]*.5,1.5),signedDistanceFromCamera:b[3],aboveHorizon:h}}isOffscreen(a,b,c,d){return c<100||a>=this.screenRightBoundary||d<100||b>this.screenBottomBoundary}isInsideGrid(a,b,c,d){return c>=0&&a=0&&ba.collisionGroupID===b}}return this.collisionGroups[a]}}(e),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(h,d,b,q){const c=b.getBucket(d),i=b.latestFeatureIndex;if(!c||!i||d.id!==c.layerIds[0])return;const e=c.layers[0].layout,r=b.collisionBoxArray,s=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),t=b.tileSize/a.EXTENT,j=b.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(j),g="map"===e.get("text-pitch-alignment"),k="map"===e.get("text-rotation-alignment");d.compileFilter();const l=d.dynamicFilter(),u=d.dynamicFilterNeedsFeature(),m=this.transform.calculatePixelsToTileUnitsMatrix(b),v=aB(f,b.tileID.canonical,g,k,this.transform,m);let n=null;if(g){const w=aC(f,b.tileID.canonical,g,k,this.transform,m);n=a.multiply$1([],this.transform.labelPlaneMatrix,w)}let o=null;l&&b.latestFeatureIndex&&(o={unwrappedTileID:j,dynamicFilter:l,dynamicFilterNeedsFeature:u,featureIndex:b.latestFeatureIndex}),this.retainedQueryData[c.bucketInstanceId]=new aU(c.bucketInstanceId,i,c.sourceLayerIndex,c.index,b.tileID);const p={bucket:c,layout:e,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:n,clippingData:o,scale:s,textPixelRatio:t,holdingForFade:b.holdingForFade(),collisionBoxArray:r,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(c.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.evaluateSizeForZoom(c.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(q)for(const x of c.sortKeyRanges){const{sortKey:y,symbolInstanceStart:z,symbolInstanceEnd:A}=x;h.push({sortKey:y,symbolInstanceStart:z,symbolInstanceEnd:A,parameters:p})}else h.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:p})}attemptAnchorPlacement(d,s,g,h,e,i,j,k,l,m,n,a,t,c,f,o,v,u){const p=[a.textOffset0,a.textOffset1],b=aV(d,g,h,p,e),q=this.collisionIndex.placeCollisionBox(e,s,aW(b.x,b.y,i,j,this.transform.angle),n,k,l,m.predicate);if((!o||0!==this.collisionIndex.placeCollisionBox(c.getSymbolInstanceIconSize(u,this.transform.zoom,t),o,aW(b.x,b.y,i,j,this.transform.angle),n,k,l,m.predicate).box.length)&&q.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[a.crossTileID]&&this.prevPlacement.placements[a.crossTileID]&&this.prevPlacement.placements[a.crossTileID].text&&(r=this.prevPlacement.variableOffsets[a.crossTileID].anchor),this.variableOffsets[a.crossTileID]={textOffset:p,width:g,height:h,anchor:d,textScale:e,prevAnchor:r},this.markUsedJustification(c,d,a,f),c.allowVerticalPlacement&&(this.markUsedOrientation(c,f,a),this.placedOrientations[a.crossTileID]=f),{shift:b,placedGlyphBoxes:q}}}placeLayerBucketPart(e,t,i,o){const{bucket:b,layout:c,posMatrix:p,textLabelPlaneMatrix:u,labelToScreenMatrix:v,clippingData:w,textPixelRatio:x,holdingForFade:y,collisionBoxArray:f,partiallyEvaluatedTextSize:z,partiallyEvaluatedIconSize:A,collisionGroup:B}=e.parameters,q=c.get("text-optional"),r=c.get("icon-optional"),j=c.get("text-allow-overlap"),k=c.get("icon-allow-overlap"),C="map"===c.get("text-rotation-alignment"),D="map"===c.get("text-pitch-alignment"),E="none"!==c.get("icon-text-fit"),s="viewport-y"===c.get("symbol-z-order"),F=j&&(k||!b.hasIconData()||r),G=k&&(j||!b.hasTextData()||q);!b.collisionArrays&&f&&b.deserializeCollisionBoxes(f),i&&o&&b.updateCollisionDebugBuffers(this.transform.zoom,f);const l=(d,ac,f)=>{if(w){const $={zoom:this.transform.zoom,pitch:this.transform.pitch};let N=null;if(w.dynamicFilterNeedsFeature){const O=this.retainedQueryData[b.bucketInstanceId];N=w.featureIndex.loadFeature({featureIndex:d.featureIndex,bucketIndex:O.bucketIndex,sourceLayerIndex:O.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,w.dynamicFilter)($,N,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new a.pointGeometry(d.tileAnchorX,d.tileAnchorY),this.transform.calculateDistanceTileData(w.unwrappedTileID)))return this.placements[d.crossTileID]=new aS(!1,!1,!1,!0),void(t[d.crossTileID]=!0)}if(t[d.crossTileID])return;if(y)return void(this.placements[d.crossTileID]=new aS(!1,!1,!1));let e=!1,l=!1,n=!0,ad=null,h={box:null,offscreen:null},s={box:null,offscreen:null},m=null,g=null,H=null,J=0,K=0,P=0;f.textFeatureIndex?J=f.textFeatureIndex:d.useRuntimeCollisionCircles&&(J=d.featureIndex),f.verticalTextFeatureIndex&&(K=f.verticalTextFeatureIndex);const _=a=>{a.tileID=this.retainedQueryData[b.bucketInstanceId].tileID,(this.transform.elevation||a.elevation)&&(a.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[b.bucketInstanceId].tileID,a.tileAnchorX,a.tileAnchorY):0)},Q=f.textBox;if(Q){_(Q);const R=f=>{let c=a.WritingMode.horizontal;if(b.allowVerticalPlacement&&!f&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[d.crossTileID];e&&(this.placedOrientations[d.crossTileID]=e,c=e,this.markUsedOrientation(b,c,d))}return c},S=(c,e)=>{if(b.allowVerticalPlacement&&d.numVerticalGlyphVertices>0&&f.verticalTextBox){for(const g of b.writingModes)if(g===a.WritingMode.vertical?s=h=e():h=c(),h&&h.box&&h.box.length)break}else h=c()};if(c.get("text-variable-anchor")){let L=c.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]){const T=this.prevPlacement.variableOffsets[d.crossTileID];L.indexOf(T.anchor)>0&&(L=L.filter(a=>a!==T.anchor)).unshift(T.anchor)}const ae=(a,l,m)=>{const g=b.getSymbolInstanceTextSize(z,d,this.transform.zoom,ac),n=(a.x2-a.x1)*g+2*a.padding,o=(a.y2-a.y1)*g+2*a.padding,h=E&&!k?l:null;h&&_(h);let c={box:[],offscreen:!1};const q=j?2*L.length:L.length;for(let f=0;f=L.length,d,ac,b,m,h,z,A);if(i&&(c=i.placedGlyphBoxes)&&c.box&&c.box.length){e=!0,ad=i.shift;break}}return c};S(()=>ae(Q,f.iconBox,a.WritingMode.horizontal),()=>{const c=f.verticalTextBox;return c&&_(c),b.allowVerticalPlacement&&!(h&&h.box&&h.box.length)&&d.numVerticalGlyphVertices>0&&c?ae(c,f.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),h&&(e=h.box,n=h.offscreen);const aa=R(h&&h.box);if(!e&&this.prevPlacement){const M=this.prevPlacement.variableOffsets[d.crossTileID];M&&(this.variableOffsets[d.crossTileID]=M,this.markUsedJustification(b,M.anchor,d,aa))}}else{const af=(f,e)=>{const g=b.getSymbolInstanceTextSize(z,d,this.transform.zoom,ac),c=this.collisionIndex.placeCollisionBox(g,f,new a.pointGeometry(0,0),j,x,p,B.predicate);return c&&c.box&&c.box.length&&(this.markUsedOrientation(b,e,d),this.placedOrientations[d.crossTileID]=e),c};S(()=>af(Q,a.WritingMode.horizontal),()=>{const c=f.verticalTextBox;return b.allowVerticalPlacement&&d.numVerticalGlyphVertices>0&&c?(_(c),af(c,a.WritingMode.vertical)):{box:null,offscreen:null}}),R(h&&h.box&&h.box.length)}}if(e=(m=h)&&m.box&&m.box.length>0,n=m&&m.offscreen,d.useRuntimeCollisionCircles){const U=b.text.placedSymbolArray.get(d.centerJustifiedTextSymbolIndex>=0?d.centerJustifiedTextSymbolIndex:d.verticalPlacedTextSymbolIndex),V=a.evaluateSizeForFeature(b.textSizeData,z,U),ab=c.get("text-padding");g=this.collisionIndex.placeCollisionCircles(j,U,b.lineVertexArray,b.glyphOffsetArray,V,p,u,v,i,D,B.predicate,d.collisionCircleDiameter*V/a.ONE_EM,ab,this.retainedQueryData[b.bucketInstanceId].tileID),e=j||g.circles.length>0&&!g.collisionDetected,n=n&&g.offscreen}if(f.iconFeatureIndex&&(P=f.iconFeatureIndex),f.iconBox){const W=c=>{_(c);const d=E&&ad?aW(ad.x,ad.y,C,D,this.transform.angle):new a.pointGeometry(0,0),e=b.getSymbolInstanceIconSize(A,this.transform.zoom,ac);return this.collisionIndex.placeCollisionBox(e,c,d,k,x,p,B.predicate)};l=s&&s.box&&s.box.length&&f.verticalIconBox?(H=W(f.verticalIconBox)).box.length>0:(H=W(f.iconBox)).box.length>0,n=n&&H.offscreen}const X=q||0===d.numHorizontalGlyphVertices&&0===d.numVerticalGlyphVertices,Y=r||0===d.numIconVertices;if(X||Y?Y?X||(l=l&&e):e=l&&e:l=e=l&&e,e&&m&&m.box&&this.collisionIndex.insertCollisionBox(m.box,c.get("text-ignore-placement"),b.bucketInstanceId,s&&s.box&&K?K:J,B.ID),l&&H&&this.collisionIndex.insertCollisionBox(H.box,c.get("icon-ignore-placement"),b.bucketInstanceId,P,B.ID),g&&(e&&this.collisionIndex.insertCollisionCircles(g.circles,c.get("text-ignore-placement"),b.bucketInstanceId,J,B.ID),i)){const Z=b.bucketInstanceId;let o=this.collisionCircleArrays[Z];void 0===o&&(o=this.collisionCircleArrays[Z]=new aT);for(let I=0;I=0;--g){const h=m[g];l(b.symbolInstances.get(h),h,b.collisionArrays[h])}}else for(let d=e.symbolInstanceStart;d=0&&(e.text.placedSymbolArray.get(d).crossTileID=c>=0&&d!==c?0:b.crossTileID)}markUsedOrientation(d,b,c){const e=b===a.WritingMode.horizontal||b===a.WritingMode.horizontalOnly?b:0,f=b===a.WritingMode.vertical?b:0,g=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,];for(const h of g)d.text.placedSymbolArray.get(h).placedOrientation=e;c.verticalPlacedTextSymbolIndex&&(d.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(f){this.commitTime=f,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let c=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const i=a?a.symbolFadeChange(f):1,j=a?a.opacities:{},m=a?a.variableOffsets:{},n=a?a.placedOrientations:{};for(const g in this.placements){const b=this.placements[g],h=j[g];h?(this.opacities[g]=new aR(h,i,b.text,b.icon,null,b.clipped),c=c||b.text!==h.text.placed||b.icon!==h.icon.placed):(this.opacities[g]=new aR(null,i,b.text,b.icon,b.skipFade,b.clipped),c=c||b.text||b.icon)}for(const k in j){const l=j[k];if(!this.opacities[k]){const o=new aR(l,i,!1,!1);o.isHidden()||(this.opacities[k]=o,c=c||l.text.placed||l.icon.placed)}}for(const d in m)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=m[d]);for(const e in n)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=n[e]);c?this.lastPlacementChangeTime=f:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:f)}updateLayerOpacities(c,d){const e={};for(const a of d){const b=a.getBucket(c);b&&a.latestFeatureIndex&&c.id===b.layerIds[0]&&this.updateBucketOpacities(b,e,a.collisionBoxArray)}}updateBucketOpacities(b,s,t){b.hasTextData()&&b.text.opacityVertexArray.clear(),b.hasIconData()&&b.icon.opacityVertexArray.clear(),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexArray.clear(),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexArray.clear();const f=b.layers[0].layout,F=!!b.layers[0].dynamicFilter(),G=new aR(null,0,!1,!1,!0),u=f.get("text-allow-overlap"),v=f.get("icon-allow-overlap"),H=f.get("text-variable-anchor"),I="map"===f.get("text-rotation-alignment"),J="map"===f.get("text-pitch-alignment"),l="none"!==f.get("icon-text-fit"),K=new aR(null,0,u&&(v||!b.hasIconData()||f.get("icon-optional")),v&&(u||!b.hasTextData()||f.get("text-optional")),!0);!b.collisionArrays&&t&&(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData())&&b.deserializeCollisionBoxes(t);const m=(b,c,d)=>{for(let a=0;a0||y>0,A=c.numIconVertices>0,o=this.placedOrientations[c.crossTileID],p=o===a.WritingMode.vertical,j=o===a.WritingMode.horizontal||o===a.WritingMode.horizontalOnly;if(!z&&!A||d.isHidden()||w++,z){const B=aY(d.text);m(b.text,x,p?0:B),m(b.text,y,j?0:B);const L=d.text.isHidden();[c.rightJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.leftJustifiedTextSymbolIndex,].forEach(a=>{a>=0&&(b.text.placedSymbolArray.get(a).hidden=L||p?1:0)}),c.verticalPlacedTextSymbolIndex>=0&&(b.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).hidden=L||j?1:0);const C=this.variableOffsets[c.crossTileID];C&&this.markUsedJustification(b,C.anchor,c,o);const q=this.placedOrientations[c.crossTileID];q&&(this.markUsedJustification(b,"left",c,q),this.markUsedOrientation(b,q,c))}if(A){const D=aY(d.icon);c.placedIconSymbolIndex>=0&&(m(b.icon,c.numIconVertices,p?0:D),b.icon.placedSymbolArray.get(c.placedIconSymbolIndex).hidden=d.icon.isHidden()),c.verticalPlacedIconSymbolIndex>=0&&(m(b.icon,c.numVerticalIconVertices,j?0:D),b.icon.placedSymbolArray.get(c.verticalPlacedIconSymbolIndex).hidden=d.icon.isHidden())}if(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData()){const g=b.collisionArrays[n];if(g){let e=new a.pointGeometry(0,0),k=!0;if(g.textBox||g.verticalTextBox){if(H){const h=this.variableOffsets[i];h?(e=aV(h.anchor,h.width,h.height,h.textOffset,h.textScale),I&&e._rotate(J?this.transform.angle:-this.transform.angle)):k=!1}F&&(k=!d.clipped),g.textBox&&aX(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||p,e.x,e.y),g.verticalTextBox&&aX(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||j,e.x,e.y)}const E=k&&Boolean(!j&&g.verticalIconBox);g.iconBox&&aX(b.iconCollisionBox.collisionVertexArray,d.icon.placed,E,l?e.x:0,l?e.y:0),g.verticalIconBox&&aX(b.iconCollisionBox.collisionVertexArray,d.icon.placed,!E,l?e.x:0,l?e.y:0)}}}if(b.fullyClipped=0===w,b.sortFeatures(this.transform.angle),this.retainedQueryData[b.bucketInstanceId]&&(this.retainedQueryData[b.bucketInstanceId].featureSortOrder=b.featureSortOrder),b.hasTextData()&&b.text.opacityVertexBuffer&&b.text.opacityVertexBuffer.updateData(b.text.opacityVertexArray),b.hasIconData()&&b.icon.opacityVertexBuffer&&b.icon.opacityVertexBuffer.updateData(b.icon.opacityVertexArray),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexBuffer&&b.iconCollisionBox.collisionVertexBuffer.updateData(b.iconCollisionBox.collisionVertexArray),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexBuffer&&b.textCollisionBox.collisionVertexBuffer.updateData(b.textCollisionBox.collisionVertexArray),b.bucketInstanceId in this.collisionCircleArrays){const r=this.collisionCircleArrays[b.bucketInstanceId];b.placementInvProjMatrix=r.invProjMatrix,b.placementViewportMatrix=r.viewportMatrix,b.collisionCircleArray=r.circles,delete this.collisionCircleArrays[b.bucketInstanceId]}}symbolFadeChange(a){return 0===this.fadeDuration?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimeb}setStale(){this.stale=!0}}(b,f,g,h,i),this._currentPlacementIndex=c.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=e,this._done=!1}isDone(){return this._done}continuePlacement(d,e,f){const h=a.exported.now(),g=()=>{const b=a.exported.now()-h;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const b=e[d[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===b.type&&(!b.minzoom||b.minzoom<=c)&&(!b.maxzoom||b.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new aZ(b)),this._inProgressLayer.continuePlacement(f[b.source],this.placement,this._showCollisionBoxes,b,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const a_=512/a.EXTENT/2;class a0{constructor(d,e,f){this.tileID=d,this.indexedSymbolInstances={},this.bucketInstanceId=f;for(let a=0;aa.overscaledZ)for(const l in f){const i=f[l];i.tileID.isChildOf(a)&&i.findMatches(b.symbolInstances,a,d)}else{const j=f[a.scaledTo(Number(e)).key];j&&j.findMatches(b.symbolInstances,a,d)}}for(let g=0;g{c[a]=!0}),this.layerIndexes)c[a]||delete this.layerIndexes[a]}}const a3=(c,b)=>a.emitValidationErrors(c,b&&b.filter(a=>"source.canvas"!==a.identifier)),a4=a.pick(i,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),a5=a.pick(i,["setCenter","setZoom","setBearing","setPitch",]),a6=function(){const c={},f=a.spec.$version;for(const b in a.spec.$root){const d=a.spec.$root[b];if(d.required){let e=null;null!=(e="version"===b?f:"array"===d.type?[]:{})&&(c[b]=e)}}return c}(),a7={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class c extends a.Evented{constructor(d,b={}){super(),this.map=d,this.dispatcher=new n(ao(),this),this.imageManager=new J,this.imageManager.setEventedParent(this),this.glyphManager=new a.GlyphManager(d._requestManager,b.localFontFamily?a.LocalGlyphMode.all:b.localIdeographFontFamily?a.LocalGlyphMode.ideographs:a.LocalGlyphMode.none,b.localFontFamily||b.localIdeographFontFamily),this.lineAtlas=new a.LineAtlas(256,512),this.crossTileSymbolIndex=new a2,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const e=this;this._rtlTextPluginCallback=c.registerForPluginStateChange(b=>{e.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(f,b)=>{if(a.triggerPluginCompletionEvent(f),b&&b.every(a=>a))for(const g in e._sourceCaches){const c=e._sourceCaches[g],d=c.getSource().type;"vector"!==d&&"geojson"!==d||c.reload()}})}),this.on("data",a=>{if("source"!==a.dataType||"metadata"!==a.sourceDataType)return;const b=this.getSource(a.sourceId);if(b&&b.vectorLayerIds)for(const d in this._layers){const c=this._layers[d];c.source===b.id&&this._validateLayer(c)}})}loadURL(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const e="boolean"==typeof c.validate?c.validate:!a.isMapboxURL(b);b=this.map._requestManager.normalizeStyleURL(b,c.accessToken);const d=this.map._requestManager.transformRequest(b,a.ResourceType.Style);this._request=a.getJSON(d,(b,c)=>{this._request=null,b?this.fire(new a.ErrorEvent(b)):c&&this._load(c,e)})}loadJSON(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(b,!1!==c.validate)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(a6,!1)}_updateLayerCount(a,c){const b=c?1:-1;a.is3D()&&(this._num3DLayers+=b),"circle"===a.type&&(this._numCircleLayers+=b),"symbol"===a.type&&(this._numSymbolLayers+=b)}_load(c,f){if(f&&a3(this,a.validateStyle(c)))return;for(const d in this._loaded=!0,this.stylesheet=c,this.updateProjection(),c.sources)this.addSource(d,c.sources[d],{validate:!1});this._changed=!1,c.sprite?this._loadSprite(c.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(c.glyphs);const e=aq(this.stylesheet.layers);for(let b of(this._order=e.map(a=>a.id),this._layers={},this._serializedLayers={},e))(b=a.createStyleLayer(b)).setEventedParent(this,{layer:{id:b.id}}),this._layers[b.id]=b,this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new M(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const b=this.map.transform.projection,c=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),a=this.map.transform.projection;if(this._loaded&&(a.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),c){if(a.isReprojectedInTileSpace||b.isReprojectedInTileSpace)for(const d in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[d].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(b){this._spriteRequest=function(c,b,e){let f,g,h;const d=a.exported.devicePixelRatio>1?"@2x":"";let i=a.getJSON(b.transformRequest(b.normalizeSpriteURL(c,d,".json"),a.ResourceType.SpriteJSON),(a,b)=>{i=null,h||(h=a,f=b,k())}),j=a.getImage(b.transformRequest(b.normalizeSpriteURL(c,d,".png"),a.ResourceType.SpriteImage),(a,b)=>{j=null,h||(h=a,g=b,k())});function k(){if(h)e(h);else if(f&&g){const k=a.exported.getImageData(g),b={};for(const c in f){const{width:d,height:i,x:l,y:m,sdf:n,pixelRatio:o,stretchX:p,stretchY:q,content:r}=f[c],j=new a.RGBAImage({width:d,height:i});a.RGBAImage.copy(k,j,{x:l,y:m},{x:0,y:0},{width:d,height:i}),b[c]={data:j,pixelRatio:o,sdf:n,stretchX:p,stretchY:q,content:r}}e(null,b)}}return{cancel(){i&&(i.cancel(),i=null),j&&(j.cancel(),j=null)}}}(b,this.map._requestManager,(c,b)=>{if(this._spriteRequest=null,c)this.fire(new a.ErrorEvent(c));else if(b)for(const d in b)this.imageManager.addImage(d,b[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(c){const b=this.getSource(c.source);if(!b)return;const d=c.sourceLayer;d&&("geojson"===b.type||b.vectorLayerIds&& -1===b.vectorLayerIds.indexOf(d))&&this.fire(new a.ErrorEvent(new Error(`Source layer "${d}" does not exist on source "${b.id}" as specified by style layer "${c.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(c){const a=[];for(const d of c){const b=this._layers[d];"custom"!==b.type&&a.push(b.serialize())}return a}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const b in this._layers)if(this._layers[b].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&a7[a.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(b){if(!this._loaded)return;const p=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);for(const d in(g.length||h.length)&&this._updateWorkerLayers(g,h),this._updatedSources){const i=this._updatedSources[d];"reload"===i?this._reloadSource(d):"clear"===i&&this._clearSource(d)}for(const q in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[q].updateTransitions(b);this.light.updateTransitions(b),this.fog&&this.fog.updateTransitions(b),this._resetUpdates()}const e={};for(const j in this._sourceCaches){const k=this._sourceCaches[j];e[j]=k.used,k.used=!1}for(const r of this._order){const c=this._layers[r];if(c.recalculate(b,this._availableImages),!c.isHidden(b.zoom)){const l=this._getLayerSourceCache(c);l&&(l.used=!0)}const m=this.map.painter;if(m){const n=c.getProgramIds();if(!n)continue;const s=c.getProgramConfiguration(b.zoom);for(const t of n)m.useProgram(t,s)}}for(const o in e){const f=this._sourceCaches[o];e[o]!==f.used&&f.getSource().fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:f.getSource().id}))}this.light.recalculate(b),this.terrain&&this.terrain.recalculate(b),this.fog&&this.fog.recalculate(b),this.z=b.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),p&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const b in this._sourceCaches)this._sourceCaches[b].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,b){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:b})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(b){if(this._checkLoaded(),a3(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=aq(b.layers);const c=(function(c,a){if(!c)return[{command:i.setStyle,args:[a]},];let b=[];try{if(!D(c.version,a.version))return[{command:i.setStyle,args:[a]},];D(c.center,a.center)||b.push({command:i.setCenter,args:[a.center]}),D(c.zoom,a.zoom)||b.push({command:i.setZoom,args:[a.zoom]}),D(c.bearing,a.bearing)||b.push({command:i.setBearing,args:[a.bearing]}),D(c.pitch,a.pitch)||b.push({command:i.setPitch,args:[a.pitch]}),D(c.sprite,a.sprite)||b.push({command:i.setSprite,args:[a.sprite]}),D(c.glyphs,a.glyphs)||b.push({command:i.setGlyphs,args:[a.glyphs]}),D(c.transition,a.transition)||b.push({command:i.setTransition,args:[a.transition]}),D(c.light,a.light)||b.push({command:i.setLight,args:[a.light]}),D(c.fog,a.fog)||b.push({command:i.setFog,args:[a.fog]}),D(c.projection,a.projection)||b.push({command:i.setProjection,args:[a.projection]});const e={},f=[];!function(c,b,d,e){let a;for(a in b=b||{},c=c||{})c.hasOwnProperty(a)&&(b.hasOwnProperty(a)||as(a,d,e));for(a in b)b.hasOwnProperty(a)&&(c.hasOwnProperty(a)?D(c[a],b[a])||("geojson"===c[a].type&&"geojson"===b[a].type&&au(c,b,a)?d.push({command:i.setGeoJSONSourceData,args:[a,b[a].data,]}):at(a,b,d,e)):ar(a,b,d))}(c.sources,a.sources,f,e);const g=[];c.layers&&c.layers.forEach(a=>{e[a.source]?b.push({command:i.removeLayer,args:[a.id]}):g.push(a)});let d=c.terrain;d&&e[d.source]&&(b.push({command:i.setTerrain,args:[void 0]}),d=void 0),b=b.concat(f),D(d,a.terrain)||b.push({command:i.setTerrain,args:[a.terrain]}),function(m,k,f){k=k||[];const n=(m=m||[]).map(aw),j=k.map(aw),p=m.reduce(ax,{}),o=k.reduce(ax,{}),g=n.slice(),q=Object.create(null);let e,h,b,d,c,l,a;for(e=0,h=0;e!(a.command in a5));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in a4));if(d.length>0)throw new Error(`Unimplemented: ${d.map(a=>a.command).join(", ")}.`);return c.forEach(a=>{"setTransition"!==a.command&&this[a.command].apply(this,a.args)}),this.stylesheet=b,this.updateProjection(),!0}addImage(b,c){if(this.getImage(b))return this.fire(new a.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(b,c),this._afterImageUpdated(b)}updateImage(a,b){this.imageManager.updateImage(a,b)}getImage(a){return this.imageManager.getImage(a)}removeImage(b){if(!this.getImage(b))return this.fire(new a.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(b),this._afterImageUpdated(b)}_afterImageUpdated(b){this._availableImages=this.imageManager.listImages(),this._changedImages[b]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(c,b,f={}){if(this._checkLoaded(),void 0!==this.getSource(c))throw new Error("There is already a source with this ID");if(!b.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(b).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(b.type)>=0&&this._validate(a.validateStyle.source,`sources.${c}`,b,null,f))return;this.map&&this.map._collectResourceTiming&&(b.collectResourceTiming=!0);const d=ag(c,b,this.dispatcher,this);d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:c}));const e=b=>{const f=(b?"symbol:":"other:")+c,e=this._sourceCaches[f]=new a.SourceCache(f,d,b);(b?this._symbolSourceCaches:this._otherSourceCaches)[c]=e,e.style=this,e.onAdd(this.map)};e(!1),"vector"!==b.type&&"geojson"!==b.type||e(!0),d.onAdd&&d.onAdd(this.map),this._changed=!0}removeSource(b){this._checkLoaded();const d=this.getSource(b);if(void 0===d)throw new Error("There is no source with this ID");for(const e in this._layers)if(this._layers[e].source===b)return this.fire(new a.ErrorEvent(new Error(`Source "${b}" cannot be removed while layer "${e}" is using it.`)));if(this.terrain&&this.terrain.get().source===b)return this.fire(new a.ErrorEvent(new Error(`Source "${b}" cannot be removed while terrain is using it.`)));const f=this._getSourceCaches(b);for(const c of f)delete this._sourceCaches[c.id],delete this._updatedSources[c.id],c.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:c.getSource().id})),c.setEventedParent(null),c.clearTiles();delete this._otherSourceCaches[b],delete this._symbolSourceCaches[b],d.setEventedParent(null),d.onRemove&&d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,b){this._checkLoaded(),this.getSource(a).setData(b),this._changed=!0}getSource(b){const a=this._getSourceCache(b);return a&&a.getSource()}addLayer(c,e,h={}){this._checkLoaded();const d=c.id;if(this.getLayer(d))return void this.fire(new a.ErrorEvent(new Error(`Layer with id "${d}" already exists on this map`)));let b;if("custom"===c.type){if(a3(this,a.validateCustomStyleLayer(c)))return;b=a.createStyleLayer(c)}else{if("object"==typeof c.source&&(this.addSource(d,c.source),c=a.clone$1(c),c=a.extend(c,{source:d})),this._validate(a.validateStyle.layer,`layers.${d}`,c,{arrayIndex:-1},h))return;b=a.createStyleLayer(c),this._validateLayer(b),b.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}const f=e?this._order.indexOf(e):this._order.length;if(e&& -1===f)return void this.fire(new a.ErrorEvent(new Error(`Layer with id "${e}" does not exist on this map.`)));this._order.splice(f,0,d),this._layerOrderChanged=!0,this._layers[d]=b;const g=this._getLayerSourceCache(b);if(this._removedLayers[d]&&b.source&&g&&"custom"!==b.type){const i=this._removedLayers[d];delete this._removedLayers[d],i.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",g.pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(b,c){if(this._checkLoaded(),this._changed=!0,!this._layers[b])return void this.fire(new a.ErrorEvent(new Error(`The layer '${b}' does not exist in the map's style and cannot be moved.`)));if(b===c)return;const e=this._order.indexOf(b);this._order.splice(e,1);const d=c?this._order.indexOf(c):this._order.length;c&& -1===d?this.fire(new a.ErrorEvent(new Error(`Layer with id "${c}" does not exist on this map.`))):(this._order.splice(d,0,b),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(b){this._checkLoaded();const c=this._layers[b];if(!c)return void this.fire(new a.ErrorEvent(new Error(`The layer '${b}' does not exist in the map's style and cannot be removed.`)));c.setEventedParent(null),this._updateLayerCount(c,!1);const d=this._order.indexOf(b);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[b]=c,delete this._layers[b],delete this._serializedLayers[b],delete this._updatedLayers[b],delete this._updatedPaintProps[b],c.onRemove&&c.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const b in this._layers)if(this._layers[b].type===a)return!0;return!1}setLayerZoomRange(e,c,d){this._checkLoaded();const b=this.getLayer(e);b?b.minzoom===c&&b.maxzoom===d||(null!=c&&(b.minzoom=c),null!=d&&(b.maxzoom=d),this._updateLayer(b)):this.fire(new a.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(d,c,e={}){this._checkLoaded();const b=this.getLayer(d);if(b){if(!D(b.filter,c))return null==c?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(a.validateStyle.filter,`layers.${b.id}.filter`,c,{layerType:b.type},e)||(b.filter=a.clone$1(c),this._updateLayer(b)))}else this.fire(new a.ErrorEvent(new Error(`The layer '${d}' does not exist in the map's style and cannot be filtered.`)))}getFilter(b){return a.clone$1(this.getLayer(b).filter)}setLayoutProperty(c,d,e,f={}){this._checkLoaded();const b=this.getLayer(c);b?D(b.getLayoutProperty(d),e)||(b.setLayoutProperty(d,e,f),this._updateLayer(b)):this.fire(new a.ErrorEvent(new Error(`The layer '${c}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(b,d){const c=this.getLayer(b);if(c)return c.getLayoutProperty(d);this.fire(new a.ErrorEvent(new Error(`The layer '${b}' does not exist in the map's style.`)))}setPaintProperty(c,d,e,f={}){this._checkLoaded();const b=this.getLayer(c);b?D(b.getPaintProperty(d),e)||(b.setPaintProperty(d,e,f)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[c]=!0):this.fire(new a.ErrorEvent(new Error(`The layer '${c}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,b){return this.getLayer(a).getPaintProperty(b)}setFeatureState(b,g){this._checkLoaded();const c=b.source,d=b.sourceLayer,e=this.getSource(c);if(void 0===e)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));const f=e.type;if("geojson"===f&&d)return void this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===f&&!d)return void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===b.id&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided.")));const h=this._getSourceCaches(c);for(const i of h)i.setFeatureState(d,b.id,g)}removeFeatureState(b,d){this._checkLoaded();const c=b.source,e=this.getSource(c);if(void 0===e)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));const f=e.type,g="vector"===f?b.sourceLayer:void 0;if("vector"===f&&!g)return void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(d&&"string"!=typeof b.id&&"number"!=typeof b.id)return void this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const h=this._getSourceCaches(c);for(const i of h)i.removeFeatureState(g,b.id,d)}getFeatureState(b){this._checkLoaded();const c=b.source,d=b.sourceLayer,e=this.getSource(c);if(void 0!==e){if("vector"!==e.type||d)return void 0===b.id&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(c)[0].getFeatureState(d,b.id);this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const b={};for(const d in this._sourceCaches){const c=this._sourceCaches[d].getSource();b[c.id]||(b[c.id]=c.serialize())}return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:b,layers:this._serializeLayers(this._order)},a=>void 0!==a)}_updateLayer(a){this._updatedLayers[a.id]=!0;const b=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&b&&"raster"!==b.getSource().type&&(this._updatedSources[a.source]="reload",b.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(g){var h,i;const j={},a=[];for(let b=this._order.length-1;b>=0;b--){const d=this._order[b];if(h=d,"fill-extrusion"===this._layers[h].type)for(const o of(j[d]=b,g)){const k=o[d];if(k)for(const p of k)a.push(p)}}a.sort((a,b)=>b.intersectionZ-a.intersectionZ);const e=[];for(let c=this._order.length-1;c>=0;c--){const l=this._order[c];if(i=l,"fill-extrusion"===this._layers[i].type)for(let f=a.length-1;f>=0;f--){const m=a[f].feature;if(j[m.layer.id]{const a=this.getLayer(b);return a&&a.is3D()}):this.has3DLayers(),h=_.createFromScreenPoints(j,d);for(const i in this._sourceCaches){const l=this._sourceCaches[i].getSource().id;b.layers&&!e[l]||c.push(ai(this._sourceCaches[i],this._layers,this._serializedLayers,h,b,d,k,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,j,r,k,c,l,m){const a={},f=l.queryRenderedSymbols(k),d=[];for(const n of Object.keys(f).map(Number))d.push(m[n]);for(const b of(d.sort(ak),d)){const g=b.featureIndex.lookupSymbolFeatures(f[b.bucketInstanceId],j,b.bucketIndex,b.sourceLayerIndex,c.filter,c.layers,c.availableImages,i);for(const e in g){const o=a[e]=a[e]||[],h=g[e];for(const p of(h.sort((c,d)=>{const a=b.featureSortOrder;if(a){const e=a.indexOf(c.featureIndex);return a.indexOf(d.featureIndex)-e}return d.featureIndex-c.featureIndex}),h))o.push(p)}}for(const q in a)a[q].forEach(b=>{const a=b.feature,c=r(i[q]).getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=c});return a}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),h.screenGeometry,b,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(d,b){b&&b.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",b.filter,null,b);const e=this._getSourceCaches(d);let c=[];for(const f of e)c=c.concat(aj(f,b));return c}addSourceType(a,b,d){return c.getSourceType(a)?d(new Error(`A source type called "${a}" already exists.`)):(c.setSourceType(a,b),b.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:b.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(b,e={}){this._checkLoaded();const f=this.light.getLight();let c=!1;for(const d in b)if(!D(b[d],f[d])){c=!0;break}if(!c)return;const g={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(b,e),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(b,c=1){if(this._checkLoaded(),!b)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===c){if("object"==typeof b.source){const e="terrain-dem-src";this.addSource(e,b.source),b=a.clone$1(b),b=a.extend(b,{source:e})}if(this._validate(a.validateStyle.terrain,"terrain",b))return}if(!this.terrain||this.terrain&&c!==this.terrain.drapeRenderMode)this._createTerrain(b,c);else{const d=this.terrain,g=d.get();for(const f in b)if(!D(b[f],g[f])){d.set(b),this.stylesheet.terrain=b;const h={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(h);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(b){const c=this.fog=new U(b,this.map.transform);this.stylesheet.fog=b;const d={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(d)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(b){if(this._checkLoaded(),!b)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const c=this.fog,e=c.get();for(const d in b)if(!D(b[d],e[d])){c.set(b),this.stylesheet.fog=b;const f={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(f);break}}else this._createFog(b);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(a=>this.isLayerDraped(this._layers[a])),b=this._order.filter(a=>!this.isLayerDraped(this._layers[a]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...b)}_createTerrain(b,c){const d=this.terrain=new P(b,c);this.stylesheet.terrain=b,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const e={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(e)}_force3DLayerUpdate(){for(const b in this._layers){const a=this._layers[b];"fill-extrusion"===a.type&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const b in this._layers){const a=this._layers[b];"symbol"===a.type&&this._updateLayer(a)}}_validate(c,d,e,f,b={}){return(!b|| !1!==b.validate)&&a3(this,c.call(a.validateStyle,a.extend({key:d,style:this.serialize(),value:e,styleSpec:a.spec},f)))}_remove(){for(const c in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[c].setEventedParent(null);for(const b in this._sourceCaches)this._sourceCaches[b].clearTiles(),this._sourceCaches[b].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const b=this._getSourceCaches(a);for(const c of b)c.clearTiles()}_reloadSource(b){const c=this._getSourceCaches(b);for(const a of c)a.resume(),a.reload()}_updateSources(a){for(const b in this._sourceCaches)this._sourceCaches[b].update(a)}_generateCollisionBoxes(){for(const b in this._sourceCaches){const a=this._sourceCaches[b];a.resume(),a.reload()}}_updatePlacement(c,k,h,l,e=!1){let f=!1,i=!1;const d={};for(const m of this._order){const b=this._layers[m];if("symbol"!==b.type)continue;if(!d[b.source]){const j=this._getLayerSourceCache(b);if(!j)continue;d[b.source]=j.getRenderableIds(!0).map(a=>j.getTileByID(a)).sort((a,b)=>b.tileID.overscaledZ-a.tileID.overscaledZ||(a.tileID.isLessThan(b.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(b,d[b.source],c.center.lng,c.projection);f=f||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),e=e||this._layerOrderChanged||0===h,this._layerOrderChanged&&this.fire(new a.Event("neworder")),(e||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),c.zoom))&&(this.pauseablePlacement=new a$(c,this._order,e,k,h,l,this.placement,this.fog&&c.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,d),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),i=!0),f&&this.pauseablePlacement.placement.setStale()),i||f)for(const o of this._order){const g=this._layers[o];"symbol"===g.type&&this.placement.updateLayerOpacities(g,d[g.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(d,a,c){this.imageManager.getImages(a.icons,c),this._updateTilesForChangedImages();const b=b=>{b&&b.setDependencies(a.tileID.key,a.type,a.icons)};b(this._otherSourceCaches[a.source]),b(this._symbolSourceCaches[a.source])}getGlyphs(c,a,b){this.glyphManager.getGlyphs(a.stacks,b)}getResource(d,b,c){return a.makeRequest(b,c)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return"symbol"===a.type?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const b=[];return this._otherSourceCaches[a]&&b.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&b.push(this._symbolSourceCaches[a]),b}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}c.getSourceType=function(a){return af[a]},c.setSourceType=function(a,b){af[a]=b},c.registerForPluginStateChange=a.registerForPluginStateChange;var t="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}\n#endif",j="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let u={},v={};u=bb("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0),v=bb("#ifdef FOG\nuniform float u_fog_temporal_offset;float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif","#ifdef FOG\nuniform mat4 u_fog_matrix;vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",!0);const a8=bb("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),a9=t;var ba={background:bb("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:bb("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:bb("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 scaled_extrude=extrude*a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=scaled_extrude.x*surface_vectors[0]+scaled_extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:bb("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:bb("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\ngl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nextrude*=a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:bb("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:bb("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:bb("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:bb("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:bb("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:bb("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:bb("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:bb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:bb("varying vec4 v_color;void main() {vec4 color=v_color;\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(pos.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:bb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:bb("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:bb("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:bb("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:bb("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:bb("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:bb("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:bb("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:bb("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:bb("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n}"),terrainDepth:bb("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:bb("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",j),skyboxGradient:bb("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",j),skyboxCapture:bb("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:bb("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:bb("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function bb(c,b,h){const e=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,i=b.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),f=c.match(d),g=b.match(d),j=t.match(d);let a=g?g.concat(f):f;h||(u.staticUniforms&&(a=u.staticUniforms.concat(a)),v.staticUniforms&&(a=v.staticUniforms.concat(a))),a&&(a=a.concat(j));const k={};return{fragmentSource:c=c.replace(e,(e,d,b,c,a)=>(k[a]=!0,"define"===d?` + `)}const f=b[`filter_${k}`],g=cN(d,f);let h=null;if("error"===g.result)throw Error(g.value.map(a=>`${a.key}: ${a.message}`).join(", "));h=(a,b,c)=>g.value.evaluate(a,b,{},c);let i=null,j=null;if(d!==c){const e=cN(c,f);if("error"===e.result)throw Error(e.value.map(a=>`${a.key}: ${a.message}`).join(", "));i=(a,b,c,d,f)=>e.value.evaluate(a,b,{},c,void 0,void 0,d,f),j=!f$(e.value.expression)}return{filter:h,dynamicFilter:i||void 0,needGeometry:gH(d),needFeature:!!j}}function gC(a){if(!Array.isArray(a))return a;const b=function(a){if(gF.has(a[0])){for(let b=1;bgC(a))}function gD(a){let b=!1;const c=[];if("case"===a[0]){for(let d=1;d",">=","<","<=","to-boolean",]);function gG(a,b){return ab?1:0}function gH(a){if(!Array.isArray(a))return!1;if("within"===a[0])return!0;for(let b=1;b"===b||"<="===b||">="===b?gJ(a[1],a[2],b):"any"===b?["any"].concat(a.slice(1).map(gI)):"all"===b?["all"].concat(a.slice(1).map(gI)):"none"===b?["all"].concat(a.slice(1).map(gI).map(gM)):"in"===b?gK(a[1],a.slice(2)):"!in"===b?gM(gK(a[1],a.slice(2))):"has"===b?gL(a[1]):"!has"===b?gM(gL(a[1])):"within"!==b||a}function gJ(c,a,b){switch(c){case"$type":return[`filter-type-${b}`,a];case"$id":return[`filter-id-${b}`,a];default:return[`filter-${b}`,c,a]}}function gK(b,a){if(0===a.length)return!1;switch(b){case"$type":return["filter-type-in",["literal",a]];case"$id":return["filter-id-in",["literal",a]];default:return a.length>200&&!a.some(b=>typeof b!=typeof a[0])?["filter-in-large",b,["literal",a.sort(gG)],]:["filter-in-small",b,["literal",a],]}}function gL(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function gM(a){return["!",a]}function a_(a){if(gA(fq(a.value))){const b=fq(a.layerType);return gy(ce({},a,{expressionContext:"filter",valueSpec:a.styleSpec[`filter_${b||"fill"}`]}))}return gN(a)}function gN(e){const a=e.value,c=e.key;if("array"!==gm(a))return[new cc(c,a,`array expected, ${gm(a)} found`),];const h=e.styleSpec;let d,b=[];if(a.length<1)return[new cc(c,a,"filter array must have at least 1 element"),];switch(b=b.concat(cV({key:`${c}[0]`,value:a[0],valueSpec:h.filter_operator,style:e.style,styleSpec:e.styleSpec})),fp(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===fp(a[1])&&b.push(new cc(c,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&b.push(new cc(c,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(d=gm(a[1]))&&b.push(new cc(`${c}[1]`,a[1],`string expected, ${d} found`));for(let f=2;f{d in a&&b.push(new cc(c,a[d],`"${d}" is prohibited for ref layers`))}),g.layers.forEach(a=>{fp(a.id)===m&&(j=a)}),j?j.ref?b.push(new cc(c,a.ref,"ref cannot reference another ref layer")):e=fp(j.type):b.push(new cc(c,a.ref,`ref layer "${m}" not found`))}else if("background"!==e&&"sky"!==e){if(a.source){const h=g.sources&&g.sources[a.source],f=h&&fp(h.type);h?"vector"===f&&"raster"===e?b.push(new cc(c,a.source,`layer "${a.id}" requires a raster source`)):"raster"===f&&"raster"!==e?b.push(new cc(c,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==f||a["source-layer"]?"raster-dem"===f&&"hillshade"!==e?b.push(new cc(c,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===e&&a.paint&&a.paint["line-gradient"]&&("geojson"!==f||!h.lineMetrics)&&b.push(new cc(c,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):b.push(new cc(c,a,`layer "${a.id}" must specify a "source-layer"`)):b.push(new cc(c,a.source,`source "${a.source}" not found`))}else b.push(new cc(c,a,'missing required property "source"'))}return b=b.concat(cR({key:c,value:a,valueSpec:l.layer,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{"*":()=>[],type:()=>gR({key:`${c}.type`,value:a.type,valueSpec:l.layer.type,style:d.style,styleSpec:d.styleSpec,object:a,objectKey:"type"}),filter:a=>a_(ce({layerType:e},a)),layout:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cX(ce({layerType:e},a))}}),paint:b=>cR({layer:a,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":a=>cW(ce({layerType:e},a))}})}}))}function cY(a){const b=a.value,d=a.key,c=gm(b);return"string"!==c?[new cc(d,b,`string expected, ${c} found`)]:[]}const gP={promoteId:function({key:b,value:a}){if("string"===gm(a))return cY({key:b,value:a});{const c=[];for(const d in a)c.push(...cY({key:`${b}.${d}`,value:a[d]}));return c}}};function a1(d){const a=d.value,b=d.key,c=d.styleSpec,e=d.style;if(!a.type)return[new cc(b,a,'"type" is required')];const i=fp(a.type);let f;switch(i){case"vector":case"raster":case"raster-dem":return cR({key:b,value:a,valueSpec:c[`source_${i.replace("-","_")}`],style:d.style,styleSpec:c,objectElementValidators:gP});case"geojson":if(f=cR({key:b,value:a,valueSpec:c.source_geojson,style:e,styleSpec:c,objectElementValidators:gP}),a.cluster)for(const g in a.clusterProperties){const[h,j]=a.clusterProperties[g],k="string"==typeof h?[h,["accumulated"],["get",g],]:h;f.push(...gy({key:`${b}.${g}.map`,value:j,expressionContext:"cluster-map"})),f.push(...gy({key:`${b}.${g}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return f;case"video":return cR({key:b,value:a,valueSpec:c.source_video,style:e,styleSpec:c});case"image":return cR({key:b,value:a,valueSpec:c.source_image,style:e,styleSpec:c});case"canvas":return[new cc(b,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return cV({key:`${b}.type`,value:a.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:e,styleSpec:c})}}function a2(f){const b=f.value,d=f.styleSpec,e=d.light,h=f.style;let c=[];const i=gm(b);if(void 0===b)return c;if("object"!==i)return c.concat([new cc("light",b,`object expected, ${i} found`),]);for(const a in b){const g=a.match(/^(.*)-transition$/);c=c.concat(g&&e[g[1]]&&e[g[1]].transition?gR({key:a,value:b[a],valueSpec:d.transition,style:h,styleSpec:d}):e[a]?gR({key:a,value:b[a],valueSpec:e[a],style:h,styleSpec:d}):[new cc(a,b[a],`unknown property "${a}"`),])}return c}function a3(d){const a=d.value,h=d.key,e=d.style,f=d.styleSpec,g=f.terrain;let c=[];const k=gm(a);if(void 0===a)return c;if("object"!==k)return c.concat([new cc("terrain",a,`object expected, ${k} found`),]);for(const b in a){const i=b.match(/^(.*)-transition$/);c=c.concat(i&&g[i[1]]&&g[i[1]].transition?gR({key:b,value:a[b],valueSpec:f.transition,style:e,styleSpec:f}):g[b]?gR({key:b,value:a[b],valueSpec:g[b],style:e,styleSpec:f}):[new cc(b,a[b],`unknown property "${b}"`),])}if(a.source){const j=e.sources&&e.sources[a.source],l=j&&fp(j.type);j?"raster-dem"!==l&&c.push(new cc(h,a.source,`terrain cannot be used with a source of type ${l}, it only be used with a "raster-dem" source type`)):c.push(new cc(h,a.source,`source "${a.source}" not found`))}else c.push(new cc(h,a,'terrain is missing required property "source"'));return c}function a4(f){const b=f.value,h=f.style,d=f.styleSpec,e=d.fog;let c=[];const i=gm(b);if(void 0===b)return c;if("object"!==i)return c.concat([new cc("fog",b,`object expected, ${i} found`),]);for(const a in b){const g=a.match(/^(.*)-transition$/);c=c.concat(g&&e[g[1]]&&e[g[1]].transition?gR({key:a,value:b[a],valueSpec:d.transition,style:h,styleSpec:d}):e[a]?gR({key:a,value:b[a],valueSpec:e[a],style:h,styleSpec:d}):[new cc(a,b[a],`unknown property "${a}"`),])}return c}const gQ={"*":()=>[],array:cS,boolean:function(a){const b=a.value,d=a.key,c=gm(b);return"boolean"!==c?[new cc(d,b,`boolean expected, ${c} found`),]:[]},number:cT,color:function(b){const c=b.key,a=b.value,d=gm(a);return"string"!==d?[new cc(c,a,`color expected, ${d} found`),]:null===fy.parseCSSColor(a)?[new cc(c,a,`color expected, "${a}" found`),]:[]},constants:cd,enum:cV,filter:a_,function:cU,layer:a0,object:cR,source:a1,light:a2,terrain:a3,fog:a4,string:cY,formatted:function(a){return 0===cY(a).length?[]:gy(a)},resolvedImage:function(a){return 0===cY(a).length?[]:gy(a)},projection:function(c){const b=c.value,f=c.styleSpec,g=f.projection,h=c.style;let a=[];const d=gm(b);if("object"===d)for(const e in b)a=a.concat(gR({key:e,value:b[e],valueSpec:g[e],style:h,styleSpec:f}));else"string"!==d&&(a=a.concat([new cc("projection",b,`object or string expected, ${d} found`),]));return a}};function gR(b){const c=b.value,a=b.valueSpec,d=b.styleSpec;return a.expression&&gn(fp(c))?cU(b):a.expression&&gv(fq(c))?gy(b):a.type&&gQ[a.type]?gQ[a.type](b):cR(ce({},b,{valueSpec:a.type?d[a.type]:a}))}function gS(c){const a=c.value,d=c.key,b=cY(c);return b.length||(-1===a.indexOf("{fontstack}")&&b.push(new cc(d,a,'"glyphs" url must include a "{fontstack}" token')),-1===a.indexOf("{range}")&&b.push(new cc(d,a,'"glyphs" url must include a "{range}" token'))),b}function t(a,d=b){let c=[];return c=c.concat(gR({key:"",value:a,valueSpec:d.$root,styleSpec:d,style:a,objectElementValidators:{glyphs:gS,"*":()=>[]}})),a.constants&&(c=c.concat(cd({key:"constants",value:a.constants,style:a,styleSpec:d}))),gT(c)}function gT(a){return[].concat(a).sort((a,b)=>a.line-b.line)}function v(a){return function(...b){return gT(a.apply(this,b))}}t.source=v(a1),t.light=v(a2),t.terrain=v(a3),t.fog=v(a4),t.layer=v(a0),t.filter=v(a_),t.paintProperty=v(cW),t.layoutProperty=v(cX);const M=t,cZ=M.light,c$=M.fog,gU=M.paintProperty,gV=M.layoutProperty;function c_(c,a){let b=!1;if(a&&a.length)for(const d of a)c.fire(new cb(Error(d.message))),b=!0;return b}var aj=u;function u(b,c,d){var e=this.cells=[];if(b instanceof ArrayBuffer){this.arrayBuffer=b;var a=new Int32Array(this.arrayBuffer);b=a[0],this.d=(c=a[1])+2*(d=a[2]);for(var f=0;f=a[b+0]&&k>=a[b+1])?(d[c]=!0,m.push(n[c])):d[c]=!1}}},u.prototype._forEachCell=function(d,e,f,g,h,i,j,c){for(var k=this._convertToCellCoord(d),l=this._convertToCellCoord(e),m=this._convertToCellCoord(f),n=this._convertToCellCoord(g),a=k;a<=m;a++)for(var b=l;b<=n;b++){var o=this.d*b+a;if((!c||c(this._convertFromCellCoord(a),this._convertFromCellCoord(b),this._convertFromCellCoord(a+1),this._convertFromCellCoord(b+1)))&&h.call(this,d,e,f,g,o,i,j,c))return}},u.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},u.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},u.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var c=this.cells,f=3+this.cells.length+1+1,g=0,e=0;e=0)continue;const i=a[e];d[e]=gY[c].shallow.indexOf(e)>=0?i:g_(i,b)}a instanceof Error&&(d.message=a.message)}if(d.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==c&&(d.$name=c),d}throw Error("can't serialize object of type "+typeof a)}function g0(a){if(null==a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||gZ(a)||g$(a)||ArrayBuffer.isView(a)||a instanceof gW)return a;if(Array.isArray(a))return a.map(g0);if("object"==typeof a){const d=a.$name||"Object",{klass:b}=gY[d];if(!b)throw Error(`can't deserialize unregistered class ${d}`);if(b.deserialize)return b.deserialize(a);const e=Object.create(b.prototype);for(const c of Object.keys(a)){if("$name"===c)continue;const f=a[c];e[c]=gY[d].shallow.indexOf(c)>=0?f:g0(f)}return e}throw Error("can't deserialize object of type "+typeof a)}class c0{constructor(){this.first=!0}update(b,c){const a=Math.floor(b);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=b,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=c):this.lastFloorZooma>=1536&&a<=1791,g2=a=>a>=1872&&a<=1919,g3=a=>a>=2208&&a<=2303,g4=a=>a>=11904&&a<=12031,g5=a=>a>=12032&&a<=12255,g6=a=>a>=12272&&a<=12287,g7=a=>a>=12288&&a<=12351,g8=a=>a>=12352&&a<=12447,g9=a=>a>=12448&&a<=12543,ha=a=>a>=12544&&a<=12591,hb=a=>a>=12704&&a<=12735,hc=a=>a>=12736&&a<=12783,hd=a=>a>=12784&&a<=12799,he=a=>a>=12800&&a<=13055,hf=a=>a>=13056&&a<=13311,hg=a=>a>=13312&&a<=19903,hh=a=>a>=19968&&a<=40959,hi=a=>a>=40960&&a<=42127,hj=a=>a>=42128&&a<=42191,hk=a=>a>=44032&&a<=55215,hl=a=>a>=63744&&a<=64255,hm=a=>a>=64336&&a<=65023,hn=a=>a>=65040&&a<=65055,ho=a=>a>=65072&&a<=65103,hp=a=>a>=65104&&a<=65135,hq=a=>a>=65136&&a<=65279,hr=a=>a>=65280&&a<=65519;function hs(a){for(const b of a)if(hv(b.charCodeAt(0)))return!0;return!1}function ht(a){for(const b of a)if(!hu(b.charCodeAt(0)))return!1;return!0}function hu(a){return!(g1(a)||g2(a)||g3(a)||hm(a)||hq(a))}function hv(a){var b,c,d,e,f,g,h,i;return!(746!==a&&747!==a&&(a<4352||!(hb(a)||ha(a)||ho(a)&&!(a>=65097&&a<=65103)||hl(a)||hf(a)||g4(a)||hc(a)||!(!g7(a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||hg(a)||hh(a)||he(a)||(b=a)>=12592&&b<=12687||(c=a)>=43360&&c<=43391||(d=a)>=55216&&d<=55295||(e=a)>=4352&&e<=4607||hk(a)||g8(a)||g6(a)||(f=a)>=12688&&f<=12703||g5(a)||hd(a)||g9(a)&&12540!==a||!(!hr(a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||!(!hp(a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(g=a)>=5120&&g<=5759||(h=a)>=6320&&h<=6399||hn(a)||(i=a)>=19904&&i<=19967||hi(a)||hj(a))))}function hw(b){var a,c,d,e,f,g,h,i,j,k,l,m,n;return!(hv(b)||(c=a=b)>=128&&c<=255&&(167===a||169===a||174===a||177===a||188===a||189===a||190===a||215===a||247===a)||(d=a)>=8192&&d<=8303&&(8214===a||8224===a||8225===a||8240===a||8241===a||8251===a||8252===a||8258===a||8263===a||8264===a||8265===a||8273===a)||(e=a)>=8448&&e<=8527||(f=a)>=8528&&f<=8591||(g=a)>=8960&&g<=9215&&(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||9003===a||a>=9085&&a<=9114||a>=9150&&a<=9165||9167===a||a>=9169&&a<=9179||a>=9186&&a<=9215)||(h=a)>=9216&&h<=9279&&9251!==a||(i=a)>=9280&&i<=9311||(j=a)>=9312&&j<=9471||(k=a)>=9632&&k<=9727||(l=a)>=9728&&l<=9983&&!(a>=9754&&a<=9759)||(m=a)>=11008&&m<=11263&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||g7(a)||g9(a)||(n=a)>=57344&&n<=63743||ho(a)||hp(a)||hr(a)||8734===a||8756===a||8757===a||a>=9984&&a<=10087||a>=10102&&a<=10131||65532===a||65533===a)}function hx(a){return a>=1424&&a<=2303||hm(a)||hq(a)}function hy(a,c){var b;return!(!c&&hx(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||(b=a)>=6016&&b<=6143)}function hz(a){for(const b of a)if(hx(b.charCodeAt(0)))return!0;return!1}const hA="deferred",hB="loading",hC="loaded";let hD=null,hE="unavailable",hF=null;const c1=function(a){a&&"string"==typeof a&&a.indexOf("NetworkError")> -1&&(hE="error"),hD&&hD(a)};function hG(){c2.fire(new aW("pluginStateChange",{pluginStatus:hE,pluginURL:hF}))}const c2=new S,c3=function(){return hE},hH=function(){if(hE!==hA||!hF)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hE=hB,hG(),hF&&fi({url:hF},a=>{a?c1(a):(hE=hC,hG())})},c4={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hE===hC||null!=c4.applyArabicShaping,isLoading:()=>hE===hB,setState(a){hE=a.pluginStatus,hF=a.pluginURL},isParsed:()=>null!=c4.applyArabicShaping&&null!=c4.processBidirectionalText&&null!=c4.processStyledBidirectionalText,getPluginURL:()=>hF};class c5{constructor(b,a){this.zoom=b,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition,this.pitch=a.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new c0,this.transition={},this.pitch=0)}isSupportedScript(a){return function(a,b){for(const c of a)if(!hy(c.charCodeAt(0),b))return!1;return!0}(a,c4.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const a=this.zoom,b=a-Math.floor(a),c=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:b+(1-b)*c}:{fromScale:.5,toScale:1,t:1-(1-c)*b}}}class hI{constructor(a,b){this.property=a,this.value=b,this.expression=function(a,b){if(gn(a))return new cQ(a,b);if(gv(a)){const c=gw(a,b);if("error"===c.result)throw Error(c.value.map(a=>`${a.key}: ${a.message}`).join(", "));return c.value}{let d=a;return"string"==typeof a&&"color"===b.type&&(d=m.parse(a)),{kind:"constant",evaluate:()=>d}}}(void 0===b?a.specification.default:b,a.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(a,b,c){return this.property.possiblyEvaluate(this,a,b,c)}}class hJ{constructor(a){this.property=a,this.value=new hI(a,void 0)}transitioned(a,b){return new hK(this.property,this.value,b,bR({},a.transition,this.transition),a.now)}untransitioned(){return new hK(this.property,this.value,null,{},0)}}class c6{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return bX(this._values[a].value.value)}setValue(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new hJ(this._values[a].property)),this._values[a].value=new hI(this._values[a].property,null===b?void 0:bX(b))}getTransition(a){return bX(this._values[a].transition)}setTransition(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new hJ(this._values[a].property)),this._values[a].transition=bX(b)||void 0}serialize(){const b={};for(const a of Object.keys(this._values)){const c=this.getValue(a);void 0!==c&&(b[a]=c);const d=this.getTransition(a);void 0!==d&&(b[`${a}-transition`]=d)}return b}transitioned(c,d){const b=new hL(this._properties);for(const a of Object.keys(this._values))b._values[a]=this._values[a].transitioned(c,d._values[a]);return b}untransitioned(){const a=new hL(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].untransitioned();return a}}class hK{constructor(c,d,e,a,b){const f=a.delay||0,g=a.duration||0;b=b||0,this.property=c,this.value=d,this.begin=b+f,this.end=this.begin+g,c.specification.transition&&(a.delay||a.duration)&&(this.prior=e)}possiblyEvaluate(a,b,c){const d=a.now||0,e=this.value.possiblyEvaluate(a,b,c),f=this.prior;if(f){if(d>this.end||this.value.isDataDriven())return this.prior=null,e;if(dd.zoomHistory.lastIntegerZoom?{from:a,to:b,other:c}:{from:c,to:b,other:a}}interpolate(a){return a}}class a5{constructor(a){this.specification=a}possiblyEvaluate(b,a,d,e){if(void 0!==b.value){if("constant"===b.expression.kind){const c=b.expression.evaluate(a,null,{},d,e);return this._calculate(c,c,c,a)}return this._calculate(b.expression.evaluate(new c5(Math.floor(a.zoom-1),a)),b.expression.evaluate(new c5(Math.floor(a.zoom),a)),b.expression.evaluate(new c5(Math.floor(a.zoom+1),a)),a)}}_calculate(c,a,d,b){return b.zoom>b.zoomHistory.lastIntegerZoom?{from:c,to:a}:{from:d,to:a}}interpolate(a){return a}}class V{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){return!!a.expression.evaluate(b,null,{},c,d)}interpolate(){return!1}}class n{constructor(b){for(const a in this.properties=b,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],b){const c=b[a];c.specification.overridable&&this.overridableProperties.push(a);const d=this.defaultPropertyValues[a]=new hI(c,void 0),e=this.defaultTransitionablePropertyValues[a]=new hJ(c);this.defaultTransitioningPropertyValues[a]=e.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=d.possiblyEvaluate({})}}}function hO(a,b){return 256*(a=bM(Math.floor(a),0,255))+bM(Math.floor(b),0,255)}c("DataDrivenProperty",g),c("DataConstantProperty",e),c("CrossFadedDataDrivenProperty",N),c("CrossFadedProperty",a5),c("ColorRampProperty",V);const hP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class O{constructor(a,b){this._structArray=a,this._pos1=b*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class k{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,b){return a._trim(),b&&(a.isTransferred=!0,b.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(b){const a=Object.create(this.prototype);return a.arrayBuffer=b.arrayBuffer,a.length=b.length,a.capacity=b.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const b=this.uint8;this._refreshViews(),b&&this.uint8.set(b)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function j(b,a=1){let c=0,d=0;return{members:b.map(b=>{const e=hP[b.type].BYTES_PER_ELEMENT,g=c=hQ(c,Math.max(a,e)),f=b.components||1;return d=Math.max(d,e),c+=e*f,{name:b.name,type:b.type,components:f,offset:g}}),size:hQ(c,Math.max(d,a)),alignment:a}}function hQ(b,a){return Math.ceil(b/a)*a}class al extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.int16[b+0]=c,this.int16[b+1]=d,a}}al.prototype.bytesPerElement=4,c("StructArrayLayout2i4",al);class am extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(b,c,d,e,f){const a=4*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+3]=f,b}}am.prototype.bytesPerElement=8,c("StructArrayLayout4i8",am);class a6 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(a,d,e,f,g,h,i,j){const c=6*a,b=12*a,k=3*a;return this.int16[c+0]=d,this.int16[c+1]=e,this.uint8[b+4]=f,this.uint8[b+5]=g,this.uint8[b+6]=h,this.uint8[b+7]=i,this.float32[k+2]=j,a}}a6.prototype.bytesPerElement=12,c("StructArrayLayout2i4ub1f12",a6);class an extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,b}}an.prototype.bytesPerElement=12,c("StructArrayLayout3f12",an);class w extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k)}emplace(b,c,d,e,f,g,h,i,j,k,l){const a=10*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,this.uint16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,this.uint16[a+8]=k,this.uint16[a+9]=l,b}}w.prototype.bytesPerElement=20,c("StructArrayLayout10ui20",w);class W extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i)}emplace(b,c,d,e,f,g,h,i,j){const a=8*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,this.uint16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,b}}W.prototype.bytesPerElement=16,c("StructArrayLayout8ui16",W);class a7 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q)}emplace(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){const a=16*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+3]=f,this.uint16[a+4]=g,this.uint16[a+5]=h,this.uint16[a+6]=i,this.uint16[a+7]=j,this.int16[a+8]=k,this.int16[a+9]=l,this.int16[a+10]=m,this.int16[a+11]=n,this.int16[a+12]=o,this.int16[a+13]=p,this.int16[a+14]=q,this.int16[a+15]=r,b}}a7.prototype.bytesPerElement=32,c("StructArrayLayout4i4ui4i4i32",a7);class a8 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.uint32[1*a+0]=b,a}}a8.prototype.bytesPerElement=4,c("StructArrayLayout1ul4",a8);class ao extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n)}emplace(c,d,e,f,g,h,i,j,k,l,m,n,o,p){const a=20*c,b=10*c;return this.int16[a+0]=d,this.int16[a+1]=e,this.int16[a+2]=f,this.int16[a+3]=g,this.int16[a+4]=h,this.float32[b+3]=i,this.float32[b+4]=j,this.float32[b+5]=k,this.float32[b+6]=l,this.int16[a+14]=m,this.uint32[b+8]=n,this.uint16[a+18]=o,this.uint16[a+19]=p,c}}ao.prototype.bytesPerElement=40,c("StructArrayLayout5i4f1i1ul2ui40",ao);class a9 extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(b,c,d,e,f,g,h,i){const a=8*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,this.int16[a+4]=f,this.int16[a+5]=g,this.int16[a+6]=h,this.int16[a+7]=i,b}}a9.prototype.bytesPerElement=16,c("StructArrayLayout3i2i2i16",a9);class ap extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f)}emplace(a,d,e,f,g,h){const b=4*a,c=8*a;return this.float32[b+0]=d,this.float32[b+1]=e,this.float32[b+2]=f,this.int16[c+6]=g,this.int16[c+7]=h,a}}ap.prototype.bytesPerElement=16,c("StructArrayLayout2f1f2i16",ap);class ba extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(a,d,e,f,g){const b=12*a,c=3*a;return this.uint8[b+0]=d,this.uint8[b+1]=e,this.float32[c+1]=f,this.float32[c+2]=g,a}}ba.prototype.bytesPerElement=12,c("StructArrayLayout2ub2f12",ba);class aq extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.uint16[a+0]=c,this.uint16[a+1]=d,this.uint16[a+2]=e,b}}aq.prototype.bytesPerElement=6,c("StructArrayLayout3ui6",aq);class ar extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v)}emplace(c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y){const a=30*c,b=15*c,d=60*c;return this.int16[a+0]=e,this.int16[a+1]=f,this.int16[a+2]=g,this.float32[b+2]=h,this.float32[b+3]=i,this.uint16[a+8]=j,this.uint16[a+9]=k,this.uint32[b+5]=l,this.uint32[b+6]=m,this.uint32[b+7]=n,this.uint16[a+16]=o,this.uint16[a+17]=p,this.uint16[a+18]=q,this.float32[b+10]=r,this.float32[b+11]=s,this.uint8[d+48]=t,this.uint8[d+49]=u,this.uint8[d+50]=v,this.uint32[b+13]=w,this.int16[a+28]=x,this.uint8[d+58]=y,c}}ar.prototype.bytesPerElement=60,c("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ar);class as extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E)}emplace(c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G){const a=38*c,b=19*c;return this.int16[a+0]=d,this.int16[a+1]=e,this.int16[a+2]=f,this.float32[b+2]=g,this.float32[b+3]=h,this.int16[a+8]=i,this.int16[a+9]=j,this.int16[a+10]=k,this.int16[a+11]=l,this.int16[a+12]=m,this.int16[a+13]=n,this.uint16[a+14]=o,this.uint16[a+15]=p,this.uint16[a+16]=q,this.uint16[a+17]=r,this.uint16[a+18]=s,this.uint16[a+19]=t,this.uint16[a+20]=u,this.uint16[a+21]=v,this.uint16[a+22]=w,this.uint16[a+23]=x,this.uint16[a+24]=y,this.uint16[a+25]=z,this.uint16[a+26]=A,this.uint16[a+27]=B,this.uint16[a+28]=C,this.uint32[b+15]=D,this.float32[b+16]=E,this.float32[b+17]=F,this.float32[b+18]=G,c}}as.prototype.bytesPerElement=76,c("StructArrayLayout3i2f6i15ui1ul3f76",as);class X extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.float32[1*a+0]=b,a}}X.prototype.bytesPerElement=4,c("StructArrayLayout1f4",X);class at extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(b,c,d){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d)}emplace(b,c,d,e){const a=3*b;return this.int16[a+0]=c,this.int16[a+1]=d,this.int16[a+2]=e,b}}at.prototype.bytesPerElement=6,c("StructArrayLayout3i6",at);class bb extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e,f,g,h){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e,f,g,h)}emplace(b,c,d,e,f,g,h,i){const a=7*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,this.float32[a+3]=f,this.float32[a+4]=g,this.float32[a+5]=h,this.float32[a+6]=i,b}}bb.prototype.bytesPerElement=28,c("StructArrayLayout7f28",bb);class au extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(a,c,d,e,f){const b=6*a;return this.uint32[3*a+0]=c,this.uint16[b+2]=d,this.uint16[b+3]=e,this.uint16[b+4]=f,a}}au.prototype.bytesPerElement=12,c("StructArrayLayout1ul3ui12",au);class Y extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.uint16[b+0]=c,this.uint16[b+1]=d,a}}Y.prototype.bytesPerElement=4,c("StructArrayLayout2ui4",Y);class av extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(b){const a=this.length;return this.resize(a+1),this.emplace(a,b)}emplace(a,b){return this.uint16[1*a+0]=b,a}}av.prototype.bytesPerElement=2,c("StructArrayLayout1ui2",av);class Z extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c){const a=this.length;return this.resize(a+1),this.emplace(a,b,c)}emplace(a,c,d){const b=2*a;return this.float32[b+0]=c,this.float32[b+1]=d,a}}Z.prototype.bytesPerElement=8,c("StructArrayLayout2f8",Z);class aw extends k{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(b,c,d,e){const a=this.length;return this.resize(a+1),this.emplace(a,b,c,d,e)}emplace(b,c,d,e,f){const a=4*b;return this.float32[a+0]=c,this.float32[a+1]=d,this.float32[a+2]=e,this.float32[a+3]=f,b}}aw.prototype.bytesPerElement=16,c("StructArrayLayout4f16",aw);class c7 extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}c7.prototype.size=40;class c8 extends ao{get(a){return new c7(this,a)}}c("CollisionBoxArray",c8);class c9 extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(a){this._structArray.uint8[this._pos1+49]=a}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(a){this._structArray.uint8[this._pos1+50]=a}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(a){this._structArray.uint32[this._pos4+13]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(a){this._structArray.uint8[this._pos1+58]=a}}c9.prototype.size=60;class da extends ar{get(a){return new c9(this,a)}}c("PlacedSymbolArray",da);class db extends O{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(a){this._structArray.uint32[this._pos4+15]=a}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}db.prototype.size=76;class dc extends as{get(a){return new db(this,a)}}c("SymbolInstanceArray",dc);class dd extends X{getoffsetX(a){return this.float32[1*a+0]}}c("GlyphOffsetArray",dd);class de extends at{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}c("SymbolLineVertexArray",de);class df extends O{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}df.prototype.size=12;class dg extends au{get(a){return new df(this,a)}}c("FeatureIndexArray",dg);class dh extends O{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}dh.prototype.size=4;class di extends Y{get(a){return new dh(this,a)}}c("FillExtrusionCentroidArray",di);const hR=j([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},]),hS=j([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var bc=ah(function(a){a.exports=function(c,j){var g,h,a,i,e,f,b,d;for(h=c.length-(g=3&c.length),a=j,e=3432918353,f=461845907,d=0;d>>16)*e&65535)<<16)&4294967295)<<15|b>>>17))*f+(((b>>>16)*f&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(b=0,g){case 3:b^=(255&c.charCodeAt(d+2))<<16;case 2:b^=(255&c.charCodeAt(d+1))<<8;case 1:a^=b=(65535&(b=(b=(65535&(b^=255&c.charCodeAt(d)))*e+(((b>>>16)*e&65535)<<16)&4294967295)<<15|b>>>17))*f+(((b>>>16)*f&65535)<<16)&4294967295}return a^=c.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}}),dj=ah(function(a){a.exports=function(b,f){for(var d,e=b.length,a=f^e,c=0;e>=4;)d=1540483477*(65535&(d=255&b.charCodeAt(c)|(255&b.charCodeAt(++c))<<8|(255&b.charCodeAt(++c))<<16|(255&b.charCodeAt(++c))<<24))+((1540483477*(d>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(d=1540483477*(65535&(d^=d>>>24))+((1540483477*(d>>>16)&65535)<<16)),e-=4,++c;switch(e){case 3:a^=(255&b.charCodeAt(c+2))<<16;case 2:a^=(255&b.charCodeAt(c+1))<<8;case 1:a=1540483477*(65535&(a^=255&b.charCodeAt(c)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}}),bd=bc;bd.murmur3=bc,bd.murmur2=dj;class dk{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,b,c,d){this.ids.push(hT(a)),this.positions.push(b,c,d)}getPositions(f){const d=hT(f);let a=0,b=this.ids.length-1;for(;a>1;this.ids[c]>=d?b=c:a=c+1}const e=[];for(;this.ids[a]===d;)e.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return e}static serialize(c,d){const a=new Float64Array(c.ids),b=new Uint32Array(c.positions);return hU(a,b,0,a.length-1),d&&d.push(a.buffer,b.buffer),{ids:a,positions:b}}static deserialize(b){const a=new dk;return a.ids=b.ids,a.positions=b.positions,a.indexed=!0,a}}function hT(b){const a=+b;return!isNaN(a)&&Number.MIN_SAFE_INTEGER<=a&&a<=Number.MAX_SAFE_INTEGER?a:bd(String(b))}function hU(c,f,d,e){for(;d>1];let b=d-1,a=e+1;for(;;){do b++;while(c[b]g)if(b>=a)break;hV(c,b,a),hV(f,3*b,3*a),hV(f,3*b+1,3*a+1),hV(f,3*b+2,3*a+2)}a-d`u_${a}`),this.type=c}setUniform(a,c,b){a.set(b.constantOr(this.value))}getBinding(a,b,c){return"color"===this.type?new dn(a,b):new dl(a,b)}}class dq{constructor(b,a){this.uniformNames=a.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,b){this.pixelRatioFrom=b.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=b.tl.concat(b.br),this.patternTo=a.tl.concat(a.br)}setUniform(c,d,e,a){const b="u_pattern_to"===a||"u_dash_to"===a?this.patternTo:"u_pattern_from"===a||"u_dash_from"===a?this.patternFrom:"u_pixel_ratio_to"===a?this.pixelRatioTo:"u_pixel_ratio_from"===a?this.pixelRatioFrom:null;b&&c.set(b)}getBinding(b,c,a){return"u_pattern_from"===a||"u_pattern_to"===a||"u_dash_from"===a||"u_dash_to"===a?new dm(b,c):new dl(b,c)}}class dr{constructor(a,b,c,d){this.expression=a,this.type=c,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(a,b,h,c,d,e){const f=this.paintVertexArray.length,g=this.expression.evaluate(new c5(0),b,{},d,c,e);this.paintVertexArray.resize(a),this._setPaintValue(f,a,g)}updatePaintArray(a,b,c,d,e){const f=this.expression.evaluate({zoom:0},c,d,void 0,e);this._setPaintValue(a,b,f)}_setPaintValue(d,e,a){if("color"===this.type){const f=hZ(a);for(let b=d;b`u_${a}_t`),this.type=c,this.useIntegerZoom=d,this.zoom=e,this.maxValue=0,this.paintVertexAttributes=a.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?4:2,offset:0})),this.paintVertexArray=new f}populatePaintArray(a,b,i,c,d,e){const f=this.expression.evaluate(new c5(this.zoom),b,{},d,c,e),g=this.expression.evaluate(new c5(this.zoom+1),b,{},d,c,e),h=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(h,a,f,g)}updatePaintArray(d,e,a,b,c){const f=this.expression.evaluate({zoom:this.zoom},a,b,void 0,c),g=this.expression.evaluate({zoom:this.zoom+1},a,b,void 0,c);this._setPaintValue(d,e,f,g)}_setPaintValue(e,f,a,b){if("color"===this.type){const g=hZ(a),h=hZ(b);for(let c=e;c!0){this.binders={},this._buffers=[];const g=[];for(const a in e.paint._values){if(!n(a))continue;const c=e.paint.get(a);if(!(c instanceof hM&&gj(c.property.specification)))continue;const f=h_(a,e.type),b=c.value,d=c.property.specification.type,j=c.property.useIntegerZoom,k=c.property.specification["property-type"],h="cross-faded"===k||"cross-faded-data-driven"===k,l="line-dasharray"===String(a)&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==b.kind||l){if("source"===b.kind||l||h){const m=h2(a,d,"source");this.binders[a]=h?new dt(b,f,d,j,i,m,e.id):new dr(b,f,d,m),g.push(`/a_${a}`)}else{const o=h2(a,d,"composite");this.binders[a]=new ds(b,f,d,j,i,o),g.push(`/z_${a}`)}}else this.binders[a]=h?new dq(b.value,f):new dp(b.value,f,d),g.push(`/u_${a}`)}this.cacheKey=g.sort().join("")}getMaxValue(b){const a=this.binders[b];return a instanceof dr||a instanceof ds?a.maxValue:0}populatePaintArrays(b,c,d,e,f,g){for(const h in this.binders){const a=this.binders[h];(a instanceof dr||a instanceof ds||a instanceof dt)&&a.populatePaintArray(b,c,d,e,f,g)}}setConstantPatternPositions(b,c){for(const d in this.binders){const a=this.binders[d];a instanceof dq&&a.setConstantPatternPositions(b,c)}}updatePaintArrays(c,g,h,i,j,k){let d=!1;for(const e in c){const l=g.getPositions(e);for(const b of l){const m=h.feature(b.index);for(const f in this.binders){const a=this.binders[f];if((a instanceof dr||a instanceof ds||a instanceof dt)&& !0===a.expression.isStateDependent){const n=i.paint.get(f);a.expression=n.value,a.updatePaintArray(b.start,b.end,m,c[e],j,k),d=!0}}}}return d}defines(){const b=[];for(const c in this.binders){const a=this.binders[c];(a instanceof dp||a instanceof dq)&&b.push(...a.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return b}getBinderAttributes(){const c=[];for(const d in this.binders){const a=this.binders[d];if(a instanceof dr||a instanceof ds||a instanceof dt)for(let b=0;b!0){for(const a of(this.programConfigurations={},b))this.programConfigurations[a.id]=new du(a,c,d);this.needsUpload=!1,this._featureMap=new dk,this._bufferOffset=0}populatePaintArrays(a,b,c,d,e,f,g){for(const h in this.programConfigurations)this.programConfigurations[h].populatePaintArrays(a,b,d,e,f,g);void 0!==b.id&&this._featureMap.add(b.id,c,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(b,c,d,e,f){for(const a of d)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(b,this._featureMap,c,a,e,f)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(const b in this.programConfigurations)this.programConfigurations[b].upload(a);this.needsUpload=!1}}destroy(){for(const a in this.programConfigurations)this.programConfigurations[a].destroy()}}const h$={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from",],"line-dasharray":["dash_to","dash_from"]};function h_(a,b){return h$[a]||[a.replace(`${b}-`,"").replace(/-/g,"_"),]}const h0={"line-pattern":{source:w,composite:w},"fill-pattern":{source:w,composite:w},"fill-extrusion-pattern":{source:w,composite:w},"line-dasharray":{source:W,composite:W}},h1={color:{source:Z,composite:aw},number:{source:X,composite:Z}};function h2(c,d,a){const b=h0[c];return b&&b[a]||h1[d][a]}c("ConstantBinder",dp),c("CrossFadedConstantBinder",dq),c("SourceExpressionBinder",dr),c("CrossFadedCompositeBinder",dt),c("CompositeExpressionBinder",ds),c("ProgramConfiguration",du,{omit:["_buffers"]}),c("ProgramConfigurationSet",dv);const h3="-transition";class be extends S{constructor(a,b){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==a.type&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,"background"!==a.type&&"sky"!==a.type&&(this.source=a.source,this.sourceLayer=a["source-layer"],this.filter=a.filter),b.layout&&(this._unevaluatedLayout=new class{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}getValue(a){return bX(this._values[a].value)}setValue(a,b){this._values[a]=new hI(this._values[a].property,null===b?void 0:bX(b))}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c)}return a}possiblyEvaluate(c,d,e){const a=new hN(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].possiblyEvaluate(c,d,e);return a}}(b.layout)),b.paint)){for(const c in this._transitionablePaint=new c6(b.paint),a.paint)this.setPaintProperty(c,a.paint[c],{validate:!1});for(const d in a.layout)this.setLayoutProperty(d,a.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hN(b.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return"visibility"===a?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,b,c={}){null!=b&&this._validate(gV,`layers.${this.id}.layout.${a}`,a,b,c)||("visibility"!==a?this._unevaluatedLayout.setValue(a,b):this.visibility=b)}getPaintProperty(a){return bV(a,h3)?this._transitionablePaint.getTransition(a.slice(0,-h3.length)):this._transitionablePaint.getValue(a)}setPaintProperty(a,b,e={}){if(null!=b&&this._validate(gU,`layers.${this.id}.paint.${a}`,a,b,e))return!1;if(bV(a,h3))return this._transitionablePaint.setTransition(a.slice(0,-h3.length),b||void 0),!1;{const c=this._transitionablePaint._values[a],f="cross-faded-data-driven"===c.property.specification["property-type"],g=c.value.isDataDriven(),h=c.value;this._transitionablePaint.setValue(a,b),this._handleSpecialPaintPropertyUpdate(a);const d=this._transitionablePaint._values[a].value;return d.isDataDriven()||g||f||this._handleOverridablePaintPropertyUpdate(a,h,d)}}_handleSpecialPaintPropertyUpdate(a){}getProgramIds(){return null}getProgramConfiguration(a){return null}_handleOverridablePaintPropertyUpdate(a,b,c){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||"none"===this.visibility}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,b){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,b)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,b)}serialize(){const a={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),bW(a,(a,b)=>!(void 0===a||"layout"===b&&!Object.keys(a).length||"paint"===b&&!Object.keys(a).length))}_validate(c,d,e,f,a={}){return(!a|| !1!==a.validate)&&c_(this,c.call(M,{key:d,layerType:this.type,objectKey:e,value:f,styleSpec:b,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const b in this.paint._values){const a=this.paint.get(b);if(a instanceof hM&&gj(a.property.specification)&&("source"===a.value.kind||"composite"===a.value.kind)&&a.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=gB(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const dw=j([{name:"a_pos",components:2,type:"Int16"},],4),{members:h4}=dw;class ay{constructor(a=[]){this.segments=a}prepareSegment(b,d,e,c){let a=this.segments[this.segments.length-1];return b>ay.MAX_VERTEX_ARRAY_LENGTH&&bY(`Max vertices per segment is ${ay.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${b}`),(!a||a.vertexLength+b>ay.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==c)&&(a={vertexOffset:d.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0},void 0!==c&&(a.sortKey=c),this.segments.push(a)),a}get(){return this.segments}destroy(){for(const a of this.segments)for(const b in a.vaos)a.vaos[b].destroy()}static simpleSegment(a,b,c,d){return new ay([{vertexOffset:a,primitiveOffset:b,vertexLength:c,primitiveLength:d,vaos:{},sortKey:0},])}}ay.MAX_VERTEX_ARRAY_LENGTH=65535,c("SegmentVector",ay);class dx{constructor(a,b){a&&(b?this.setSouthWest(a).setNorthEast(b):4===a.length?this.setSouthWest([a[0],a[1],]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))}setNorthEast(a){return this._ne=a instanceof dy?new dy(a.lng,a.lat):dy.convert(a),this}setSouthWest(a){return this._sw=a instanceof dy?new dy(a.lng,a.lat):dy.convert(a),this}extend(a){const d=this._sw,e=this._ne;let b,c;if(a instanceof dy)b=a,c=a;else{if(!(a instanceof dx))return Array.isArray(a)?4===a.length||a.every(Array.isArray)?this.extend(dx.convert(a)):this.extend(dy.convert(a)):this;if(b=a._sw,c=a._ne,!b||!c)return this}return d||e?(d.lng=Math.min(b.lng,d.lng),d.lat=Math.min(b.lat,d.lat),e.lng=Math.max(c.lng,e.lng),e.lat=Math.max(c.lat,e.lat)):(this._sw=new dy(b.lng,b.lat),this._ne=new dy(c.lng,c.lat)),this}getCenter(){return new dy((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new dy(this.getWest(),this.getNorth())}getSouthEast(){return new dy(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(d){const{lng:a,lat:b}=dy.convert(d);let c=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=b&&b<=this._ne.lat&&c}static convert(a){return!a||a instanceof dx?a:new dx(a)}}class dy{constructor(a,b){if(isNaN(a)||isNaN(b))throw Error(`Invalid LngLat object: (${a}, ${b})`);if(this.lng=+a,this.lat=+b,this.lat>90||this.lat< -90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new dy(bO(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(b){const a=Math.PI/180,c=this.lat*a,d=b.lat*a,e=Math.sin(c)*Math.sin(d)+Math.cos(c)*Math.cos(d)*Math.cos((b.lng-this.lng)*a);return 6371008.8*Math.acos(Math.min(e,1))}toBounds(c=0){const a=360*c/40075017,b=a/Math.cos(Math.PI/180*this.lat);return new dx(new dy(this.lng-b,this.lat-a),new dy(this.lng+b,this.lat+a))}static convert(a){if(a instanceof dy)return a;if(Array.isArray(a)&&(2===a.length||3===a.length))return new dy(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&"object"==typeof a&&null!==a)return new dy(Number("lng"in a?a.lng:a.lon),Number(a.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const h5=2*Math.PI*6371008.8;function h6(a){return h5*Math.cos(a*Math.PI/180)}function dz(a){return(180+a)/360}function dA(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function dB(a,b){return a/h6(b)}function h7(a){return 360*a-180}function dC(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function h8(a,b){return a*h6(dC(b))}class dD{constructor(a,b,c=0){this.x=+a,this.y=+b,this.z=+c}static fromLngLat(b,c=0){const a=dy.convert(b);return new dD(dz(a.lng),dA(a.lat),dB(c,a.lat))}toLngLat(){return new dy(h7(this.x),dC(this.y))}toAltitude(){return h8(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/h5*(1/Math.cos(dC(this.y)*Math.PI/180))}}function h9(c,i,j,k,l,d,b,e,f){const g=(i+k)/2,h=(j+l)/2,a=new aF(g,h);e(a),function(e,f,a,b,g,h){const c=a-g,d=b-h;return Math.abs((b-f)*c-(a-e)*d)/Math.hypot(c,d)}(a.x,a.y,d.x,d.y,b.x,b.y)>=f?(h9(c,i,j,g,h,d,a,e,f),h9(c,g,h,k,l,a,b,e,f)):c.push(b)}function ia(i,d,j){const b=[];let e,f,c;for(const a of i){const{x:g,y:h}=a;d(a),c?h9(b,e,f,g,h,c,a,d,j):b.push(a),e=g,f=h,c=a}return b}function ib(a,d){const b=Math.round(a.x*d),c=Math.round(a.y*d);return a.x=bM(b,-16384,16383),a.y=bM(c,-16384,16383),(ba.x+1||ca.y+1)&&bY("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function ic(d,g,e){const a=d.loadGeometry(),f=d.extent,j=8192/f;if(g&&e&&e.projection.isReprojectedInTileSpace){const m=1<{const c=h7((g.x+a.x/f)/m),d=dC((g.y+a.y/f)/m),b=q.project(c,d);a.x=(b.x*n-o)*f,a.y=(b.y*n-p)*f};for(let b=0;b=f||c.y<0||c.y>=f||(h(c),i.push(c));a[b]=i}}for(const k of a)for(const l of k)ib(l,j);return a}function id(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?ic(a):[]}}function ie(a,b,c,d,e){a.emplaceBack(2*b+(d+1)/2,2*c+(e+1)/2)}class bf{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new al,this.indexArray=new aq,this.segments=new ay,this.programConfigurations=new dv(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(g,h,a,m){const i=this.layers[0],d=[];let b=null;for(const{feature:c,id:n,index:o,sourceLayerIndex:p}of("circle"===i.type&&(b=i.layout.get("circle-sort-key")),g)){const j=this.layers[0]._featureFilter.needGeometry,e=id(c,j);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),e,a))continue;const q=b?b.evaluate(e,{},a):void 0,r={id:n,properties:c.properties,type:c.type,sourceLayerIndex:p,index:o,geometry:j?e.geometry:ic(c,a,m),patterns:{},sortKey:q};d.push(r)}for(const k of(b&&d.sort((a,b)=>a.sortKey-b.sortKey),d)){const{geometry:l,index:f,sourceLayerIndex:s}=k,t=g[f].feature;this.addFeature(k,l,f,h.availableImages,a),h.featureIndex.insert(t,l,f,s,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,h4),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,g,h,i,j){for(const k of g)for(const f of k){const a=f.x,b=f.y;if(a<0||a>=8192||b<0||b>=8192)continue;const d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=d.vertexLength;ie(this.layoutVertexArray,a,b,-1,-1),ie(this.layoutVertexArray,a,b,1,-1),ie(this.layoutVertexArray,a,b,1,1),ie(this.layoutVertexArray,a,b,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),d.vertexLength+=4,d.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},i,j)}}function dE(a,b){for(let c=0;c1){if(ij(a,b))return!0;for(let c=0;c1?b:b.sub(a)._mult(d)._add(a))}function io(h,c){let b,a,d,e=!1;for(let f=0;fc.y!=d.y>c.y&&c.x<(d.x-a.x)*(c.y-a.y)/(d.y-a.y)+a.x&&(e=!e)}return e}function ip(b,c){let d=!1;for(let e=0,g=b.length-1;ec.y!=f.y>c.y&&c.x<(f.x-a.x)*(c.y-a.y)/(f.y-a.y)+a.x&&(d=!d)}return d}function dF(a,d,e,f,g){for(const b of a)if(d<=b.x&&e<=b.y&&f>=b.x&&g>=b.y)return!0;const h=[new aF(d,e),new aF(d,g),new aF(f,g),new aF(f,e),];if(a.length>2){for(const i of h)if(ip(a,i))return!0}for(let c=0;ce.x&&b.x>e.x||a.ye.y&&b.y>e.y)return!1;const f=eR(a,b,c[0]);return f!==eR(a,b,c[1])||f!==eR(a,b,c[2])||f!==eR(a,b,c[3])}function ir(a,b,d){const c=b.paint.get(a).value;return"constant"===c.kind?c.value:d.programConfigurations.get(b.id).getMaxValue(a)}function is(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function it(a,b,f,g,h){if(!b[0]&&!b[1])return a;const d=aF.convert(b)._mult(h);"viewport"===f&&d._rotate(-g);const e=[];for(let c=0;c{var a,b,c;const h=bF([],j,d),i=1/h[3]/e*g;return a=h,b=h,c=[i,i,f?1/h[3]:i,i],a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a[3]=b[3]*c[3],a}),c=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(a=>{const c=bz([],bB([],bE([],b[a[0]],b[a[1]]),bE([],b[a[2]],b[a[1]]))),d=-bA(c,b[a[1]]);return c.concat(d)});return new dH(b,c)}}class B{constructor(a,b){this.min=a,this.max=b,this.center=bx([],bw([],this.min,this.max),.5)}quadrant(d){const b=[d%2==0,d<2],e=eH(this.min),c=eH(this.max);for(let a=0;a=0;if(0===e)return 0;e!==c.length&&(j=!1)}if(j)return 2;for(let a=0;a<3;a++){let g=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(let i=0;ithis.max[a]-this.min[a])return 0}return 1}}function iw(b,l,c,g,h,a,i,m,d){if(a&&b.queryGeometry.isAboveHorizon)return!1;for(const n of(a&&(d*=b.pixelToTileUnitsFactor),l))for(const f of n){const e=f.add(m),j=h&&c.elevation?c.elevation.exaggeration()*h.getElevationAt(e.x,e.y,!0):0,o=a?e:ix(e,j,g),p=a?b.tilespaceRays.map(a=>iA(a,j)):b.queryGeometry.screenGeometry,k=bF([],[f.x,f.y,j,1],g);if(!i&&a?d*=k[3]/c.cameraToCenterDistance:i&&!a&&(d*=c.cameraToCenterDistance/k[3]),ig(p,o,d))return!0}return!1}function ix(b,c,d){const a=bF([],[b.x,b.y,c,1],d);return new aF(a[0]/a[3],a[1]/a[3])}const iy=Q(0,0,0),iz=Q(0,0,1);function iA(b,c){const a=aK();return iy[2]=c,b.intersectsPlane(iy,iz,a),new aF(a[0],a[1])}class dI extends bf{}function iB(b,{width:c,height:d},e,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==c*d*e)throw RangeError("mismatched image size")}else a=new Uint8Array(c*d*e);return b.width=c,b.height=d,b.data=a,b}function iC(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const e=iB({},{width:b,height:c},d);iD(a,e,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,b),height:Math.min(a.height,c)},d),a.width=b,a.height=c,a.data=e.data}function iD(c,b,d,e,a,h){if(0===a.width||0===a.height)return b;if(a.width>c.width||a.height>c.height||d.x>c.width-a.width||d.y>c.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>b.width||a.height>b.height||e.x>b.width-a.width||e.y>b.height-a.height)throw RangeError("out of range destination coordinates for image copy");const i=c.data,j=b.data;for(let f=0;f{o[a.evaluationKey]=e;const b=a.expression.evaluate(o);l.data[c+d+0]=Math.floor(255*b.r/b.a),l.data[c+d+1]=Math.floor(255*b.g/b.a),l.data[c+d+2]=Math.floor(255*b.b/b.a),l.data[c+d+3]=Math.floor(255*b.a)};if(a.clips)for(let c=0,h=0;c80*a){d=g=b[0],e=h=b[1];for(var l=a;lg&&(g=i),j>h&&(h=j);k=0!==(k=Math.max(g-d,h-e))?1/k:0}return iJ(c,m,a,d,e,k),m}function iH(c,e,f,d,g){var a,b;if(g===i3(c,e,f,d)>0)for(a=e;a=e;a-=d)b=i0(a,c[a],c[a+1],b);return b&&iW(b,b.next)&&(i1(b),b=b.next),b}function iI(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner|| !iW(a,a.next)&&0!==iV(a.prev,a,a.next))a=a.next;else{if(i1(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function iJ(a,b,c,e,f,d,h){if(a){!h&&d&&function(b,c,d,e){var a=b;do null===a.z&&(a.z=iR(a.x,a.y,c,d,e)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==b)a.prevZ.nextZ=null,a.prevZ=null,function(g){var h,b,a,c,d,i,e,f,j=1;do{for(b=g,g=null,d=null,i=0;b;){for(i++,a=b,e=0,h=0;h0||f>0&&a;)0!==e&&(0===f||!a||b.z<=a.z)?(c=b,b=b.nextZ,e--):(c=a,a=a.nextZ,f--),d?d.nextZ=c:g=c,c.prevZ=d,d=c;b=a}d.nextZ=null,j*=2}while(i>1)}(a)}(a,e,f,d);for(var i,g,j=a;a.prev!==a.next;)if(i=a.prev,g=a.next,d?iL(a,e,f,d):iK(a))b.push(i.i/c),b.push(a.i/c),b.push(g.i/c),i1(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?iJ(a=iM(iI(a),b,c),b,c,e,f,d,2):2===h&&iN(a,b,c,e,f,d):iJ(iI(a),b,c,e,f,d,1);break}}}function iK(b){var c=b.prev,d=b,e=b.next;if(iV(c,d,e)>=0)return!1;for(var a=b.next.next;a!==b.prev;){if(iT(c.x,c.y,d.x,d.y,e.x,e.y,a.x,a.y)&&iV(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function iL(f,g,h,i){var d=f.prev,e=f,a=f.next;if(iV(d,e,a)>=0)return!1;for(var l=d.x>e.x?d.x>a.x?d.x:a.x:e.x>a.x?e.x:a.x,m=d.y>e.y?d.y>a.y?d.y:a.y:e.y>a.y?e.y:a.y,j=iR(d.x=j&&c&&c.z<=k;){if(b!==f.prev&&b!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,b.x,b.y)&&iV(b.prev,b,b.next)>=0||(b=b.prevZ,c!==f.prev&&c!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,c.x,c.y)&&iV(c.prev,c,c.next)>=0))return!1;c=c.nextZ}for(;b&&b.z>=j;){if(b!==f.prev&&b!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,b.x,b.y)&&iV(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;c&&c.z<=k;){if(c!==f.prev&&c!==f.next&&iT(d.x,d.y,e.x,e.y,a.x,a.y,c.x,c.y)&&iV(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function iM(d,e,f){var a=d;do{var c=a.prev,b=a.next.next;!iW(c,b)&&iX(c,a,a.next,b)&&i$(c,b)&&i$(b,c)&&(e.push(c.i/f),e.push(a.i/f),e.push(b.i/f),i1(a),i1(a.next),a=d=b),a=a.next}while(a!==d)return iI(a)}function iN(d,e,f,g,h,i){var a=d;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&iU(a,b)){var c=i_(a,b);return a=iI(a,a.next),c=iI(c,c.next),iJ(a,e,f,g,h,i),void iJ(c,e,f,g,h,i)}b=b.next}a=a.next}while(a!==d)}function iO(a,b){return a.x-b.x}function iP(c,b){var a=function(h,k){var b,a=k,d=h.x,c=h.y,e=-1/0;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y){var f=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(f<=d&&f>e){if(e=f,f===d){if(c===a.y)return a;if(c===a.next.y)return a.next}b=a.x=a.x&&a.x>=l&&d!==a.x&&iT(cb.x||a.x===b.x&&iQ(b,a)))&&(b=a,j=g)),a=a.next;while(a!==m)return b}(c,b);if(!a)return b;var d=i_(a,c),e=iI(a,a.next);return iI(d,d.next),b===a?e:b}function iQ(a,b){return 0>iV(a.prev,a,b.prev)&&0>iV(b.next,a,a.next)}function iR(a,b,d,e,c){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-d)*c)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-e)*c)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function iS(c){var a=c,b=c;do(a.x=0&&(c-a)*(f-b)-(e-a)*(d-b)>=0&&(e-a)*(h-b)-(g-a)*(f-b)>=0}function iU(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(b,c){var a=b;do{if(a.i!==b.i&&a.next.i!==b.i&&a.i!==c.i&&a.next.i!==c.i&&iX(a,a.next,b,c))return!0;a=a.next}while(a!==b)return!1}(a,b)&&(i$(a,b)&&i$(b,a)&&function(b,e){var a=b,c=!1,f=(b.x+e.x)/2,d=(b.y+e.y)/2;do a.y>d!=a.next.y>d&&a.next.y!==a.y&&f<(a.next.x-a.x)*(d-a.y)/(a.next.y-a.y)+a.x&&(c=!c),a=a.next;while(a!==b)return c}(a,b)&&(iV(a.prev,a,b.prev)||iV(a,b.prev,b))||iW(a,b)&&iV(a.prev,a,a.next)>0&&iV(b.prev,b,b.next)>0)}function iV(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function iW(a,b){return a.x===b.x&&a.y===b.y}function iX(a,b,c,d){var e=iZ(iV(a,b,c)),f=iZ(iV(a,b,d)),g=iZ(iV(c,d,a)),h=iZ(iV(c,d,b));return e!==f&&g!==h||!(0!==e||!iY(a,c,b))||!(0!==f||!iY(a,d,b))||!(0!==g||!iY(c,a,d))||!(0!==h||!iY(c,b,d))}function iY(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function iZ(a){return a>0?1:a<0?-1:0}function i$(a,b){return 0>iV(a.prev,a,a.next)?iV(a,b,a.next)>=0&&iV(a,a.prev,b)>=0:0>iV(a,b,a.prev)||0>iV(a,a.next,b)}function i_(a,b){var d=new i2(a.i,a.x,a.y),c=new i2(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,d.next=e,e.prev=d,c.next=d,d.prev=c,f.next=c,c.prev=f,c}function i0(c,d,e,b){var a=new i2(c,d,e);return b?(a.next=b.next,a.prev=b,b.next.prev=a,b.next=a):(a.prev=a,a.next=a),a}function i1(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function i2(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function i3(b,g,d,e){for(var f=0,a=g,c=d-e;ab;){if(d-b>600){var f=d-b+1,k=e-b+1,l=Math.log(f),i=.5*Math.exp(2*l/3),m=.5*Math.sqrt(l*i*(f-i)/f)*(k-f/2<0?-1:1);i5(a,e,Math.max(b,Math.floor(e-k*i/f+m)),Math.min(d,Math.floor(e+(f-k)*i/f+m)),g)}var j=a[e],h=b,c=d;for(i6(a,b,e),g(a[d],j)>0&&i6(a,b,d);hg(a[h],j);)h++;for(;g(a[c],j)>0;)c--}0===g(a[b],j)?i6(a,b,c):i6(a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function i6(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function i7(a,b){return ab?1:0}function i8(c,f){const i=c.length;if(i<=1)return[c];const a=[];let d,h;for(let e=0;e1)for(let b=0;b0&&c.holes.push(g+=b[a-1].length)}return c},dM.default=az;class dN{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new al,this.indexArray=new aq,this.indexArray2=new Y,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.segments2=new ay,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,b,l){this.hasPattern=ja("fill",this.layers,a);const d=this.layers[0].layout.get("fill-sort-key"),e=[];for(const{feature:c,id:m,index:n,sourceLayerIndex:o}of i){const j=this.layers[0]._featureFilter.needGeometry,f=id(c,j);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),f,b))continue;const p=d?d.evaluate(f,{},b,a.availableImages):void 0,q={id:m,properties:c.properties,type:c.type,sourceLayerIndex:o,index:n,geometry:j?f.geometry:ic(c,b,l),patterns:{},sortKey:p};e.push(q)}for(const g of(d&&e.sort((a,b)=>a.sortKey-b.sortKey),e)){const{geometry:k,index:h,sourceLayerIndex:r}=g;if(this.hasPattern){const s=jb("fill",this.layers,g,this.zoom,a);this.patternFeatures.push(s)}else this.addFeature(g,k,h,b,{},a.availableImages);a.featureIndex.insert(i[h].feature,k,h,r,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(e,b,c,d){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,iG),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(m,n,o,p,q,r=[]){for(const g of i8(n,500)){let h=0;for(const s of g)h+=s.length;const i=this.segments.prepareSegment(h,this.layoutVertexArray,this.indexArray),j=i.vertexLength,c=[],l=[];for(const a of g){if(0===a.length)continue;a!==g[0]&&l.push(c.length/2);const k=this.segments2.prepareSegment(a.length,this.layoutVertexArray,this.indexArray2),f=k.vertexLength;this.layoutVertexArray.emplaceBack(a[0].x,a[0].y),this.indexArray2.emplaceBack(f+a.length-1,f),c.push(a[0].x),c.push(a[0].y);for(let b=1;b>3}if(d--,1===c||2===c)f+=b.readSVarint(),g+=b.readSVarint(),1===c&&(a&&e.push(a),a=[]),a.push(new aF(f,g));else{if(7!==c)throw Error("unknown command "+c);a&&a.push(a[0].clone())}}return a&&e.push(a),e},$.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var k=a.readVarint()+a.pos,b=1,e=0,c=0,d=0,f=1/0,g=-1/0,h=1/0,i=-1/0;a.pos>3}if(e--,1===b||2===b)(c+=a.readSVarint())g&&(g=c),(d+=a.readSVarint())i&&(i=d);else if(7!==b)throw Error("unknown command "+b)}return[f,h,g,i]},$.prototype.toGeoJSON=function(h,i,j){var a,c,k=this.extent*Math.pow(2,j),l=this.extent*h,m=this.extent*i,b=this.loadGeometry(),d=$.types[this.type];function e(b){for(var a=0;a>3;c=1===b?a.readString():2===b?a.readFloat():3===b?a.readDouble():4===b?a.readVarint64():5===b?a.readVarint():6===b?a.readSVarint():7===b?a.readBoolean():null}return c}(c))}function ji(c,d,a){if(3===c){var b=new dR(a,a.readVarint()+a.pos);b.length&&(d[b.name]=b)}}dS.prototype.feature=function(a){if(a<0||a>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[a];var b=this._pbf.readVarint()+this._pbf.pos;return new dQ(this._pbf,b,this.extent,this._keys,this._values)};var _={VectorTile:function(a,b){this.layers=a.readFields(ji,{},b)},VectorTileFeature:dQ,VectorTileLayer:dR};const jj=_.VectorTileFeature.types;function jk(a,b,c,d,e,f,g,h){a.emplaceBack((b<<1)+g,(c<<1)+f,(Math.floor(8192*d)<<1)+e,Math.round(h))}class dT{constructor(){this.acc=new aF(0,0),this.polyCount=[]}startRing(a){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new aF(a.x,a.y),this.max=new aF(a.x,a.y))}append(a,c){this.currentPolyCount.edges++,this.acc._add(a);let b=!!this.borders;const d=this.min,e=this.max;a.xe.x&&(e.x=a.x,b=!0),a.ye.y&&(e.y=a.y,b=!0),((0===a.x||8192===a.x)&&a.x===c.x)!=((0===a.y||8192===a.y)&&a.y===c.y)&&this.processBorderOverlap(a,c),b&&this.checkBorderIntersection(a,c)}checkBorderIntersection(b,a){a.x<0!=b.x<0&&this.addBorderIntersection(0,aY(a.y,b.y,(0-a.x)/(b.x-a.x))),a.x>8192!=b.x>8192&&this.addBorderIntersection(1,aY(a.y,b.y,(8192-a.x)/(b.x-a.x))),a.y<0!=b.y<0&&this.addBorderIntersection(2,aY(a.x,b.x,(0-a.y)/(b.y-a.y))),a.y>8192!=b.y>8192&&this.addBorderIntersection(3,aY(a.x,b.x,(8192-a.y)/(b.y-a.y)))}addBorderIntersection(c,a){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],]);const b=this.borders[c];ab[1]&&(b[1]=a)}processBorderOverlap(a,b){if(a.x===b.x){if(a.y===b.y)return;const c=0===a.x?0:1;this.addBorderIntersection(c,b.y),this.addBorderIntersection(c,a.y)}else{const d=0===a.y?2:3;this.addBorderIntersection(d,b.x),this.addBorderIntersection(d,a.x)}}centroid(){const a=this.polyCount.reduce((a,b)=>a+b.edges,0);return 0!==a?this.acc.div(a)._round():new aF(0,0)}span(){return new aF(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((a,b)=>a+ +(b[0]!==Number.MAX_VALUE),0)}}class dU{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new am,this.centroidVertexArray=new di,this.indexArray=new aq,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.enableTerrain=a.enableTerrain}populate(i,b,c,j){for(const{feature:a,id:k,index:e,sourceLayerIndex:f}of(this.features=[],this.hasPattern=ja("fill-extrusion",this.layers,b),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(a){const b=Math.exp(Math.PI*(1-a.y/(1<a.x<=0)||l.every(a=>a.x>=8192)||l.every(a=>a.y<=0)||l.every(a=>a.y>=8192))continue;for(let u=0;u=1){const d=g[i-1];if(!jl(c,d)){a&&a.append(c,d),b.vertexLength+4>ay.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const n=c.sub(d)._perp(),o=n.x/(Math.abs(n.x)+Math.abs(n.y)),p=n.y>0?1:0,z=d.dist(c);f+z>32768&&(f=0),jk(this.layoutVertexArray,c.x,c.y,o,p,0,0,f),jk(this.layoutVertexArray,c.x,c.y,o,p,0,1,f),f+=z,jk(this.layoutVertexArray,d.x,d.y,o,p,0,0,f),jk(this.layoutVertexArray,d.x,d.y,o,p,0,1,f);const h=b.vertexLength;this.indexArray.emplaceBack(h,h+2,h+1),this.indexArray.emplaceBack(h+1,h+2,h+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+m>ay.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray)),"Polygon"!==jj[y.type])continue;const q=[],A=[],v=b.vertexLength;for(let w=0;w0){if(a.borders){a.vertexArrayOffset=this.centroidVertexArray.length;const G=a.borders,H=this.featuresOnBorder.push(a)-1;for(let t=0;t<4;t++)G[t][0]!==Number.MAX_VALUE&&this.borders[t].push(H)}this.encodeCentroid(a.borders?void 0:a.centroid(),a)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,y,C,E,F,D)}sortBorders(){for(let a=0;a<4;a++)this.borders[a].sort((b,c)=>this.featuresOnBorder[b].borders[a][0]-this.featuresOnBorder[c].borders[a][0])}encodeCentroid(b,e,f=!0){let c,a;if(b){if(0!==b.y){const h=e.span()._mult(this.tileToMeter);c=(Math.max(b.x,1)<<3)+Math.min(7,Math.round(h.x/10)),a=(Math.max(b.y,1)<<3)+Math.min(7,Math.round(h.y/10))}else c=Math.ceil(7*(b.x+450)),a=0}else c=0,a=+f;let g=f?this.centroidVertexArray.length:e.vertexArrayOffset;for(const d of e.polyCount){f&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*d.edges+d.top);for(let i=0;i<2*d.edges;i++)this.centroidVertexArray.emplace(g++,0,a),this.centroidVertexArray.emplace(g++,c,a);for(let j=0;j8192)||a.y===b.y&&(a.y<0||a.y>8192)}c("FillExtrusionBucket",dU,{omit:["layers","features"]}),c("PartMetadata",dT);var jm={paint:new n({"fill-extrusion-opacity":new e(b["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new g(b["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new e(b["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new e(b["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new N(b["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new g(b["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new g(b["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new e(b["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function jn(a,b){return a.x*b.x+a.y*b.y}function jo(i,a){if(1===i.length){let b=0;const c=a[b++];let d;for(;!d||c.equals(d);)if(!(d=a[b++]))return 1/0;for(;ba.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new a6,this.layoutVertexArray2=new an,this.indexArray=new aq,this.programConfigurations=new dv(a.layers,a.zoom),this.segments=new ay,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(j,a,b,m){this.hasPattern=ja("line",this.layers,a);const e=this.layers[0].layout.get("line-sort-key"),f=[];for(const{feature:c,id:n,index:o,sourceLayerIndex:p}of j){const k=this.layers[0]._featureFilter.needGeometry,g=id(c,k);if(!this.layers[0]._featureFilter.filter(new c5(this.zoom),g,b))continue;const q=e?e.evaluate(g,{},b):void 0,r={id:n,properties:c.properties,type:c.type,sourceLayerIndex:p,index:o,geometry:k?g.geometry:ic(c,b,m),patterns:{},sortKey:q};f.push(r)}e&&f.sort((a,b)=>a.sortKey-b.sortKey);const{lineAtlas:h,featureIndex:s}=a,t=this.addConstantDashes(h);for(const d of f){const{geometry:l,index:i,sourceLayerIndex:u}=d;if(t&&this.addFeatureDashes(d,h),this.hasPattern){const v=jb("line",this.layers,d,this.zoom,a);this.patternFeatures.push(v)}else this.addFeature(d,l,i,b,h.positions,a.availableImages);s.insert(j[i].feature,l,i,u,this.index)}}addConstantDashes(b){let d=!1;for(const e of this.layers){const f=e.paint.get("line-dasharray").value,g=e.layout.get("line-cap").value;if("constant"!==f.kind||"constant"!==g.kind)d=!0;else{const c=g.value,a=f.value;if(!a)continue;b.addDash(a.from,c),b.addDash(a.to,c),a.other&&b.addDash(a.other,c)}}return d}addFeatureDashes(a,b){const c=this.zoom;for(const m of this.layers){const d=m.paint.get("line-dasharray").value,e=m.layout.get("line-cap").value;if("constant"===d.kind&&"constant"===e.kind)continue;let g,h,i,j,k,l;if("constant"===d.kind){const f=d.value;if(!f)continue;g=f.other||f.to,h=f.to,i=f.from}else g=d.evaluate({zoom:c-1},a),h=d.evaluate({zoom:c},a),i=d.evaluate({zoom:c+1},a);"constant"===e.kind?j=k=l=e.value:(j=e.evaluate({zoom:c-1},a),k=e.evaluate({zoom:c},a),l=e.evaluate({zoom:c+1},a)),b.addDash(g,j),b.addDash(h,k),b.addDash(i,l);const n=b.getKey(g,j),o=b.getKey(h,k),p=b.getKey(i,l);a.patterns[m.id]={min:n,mid:o,max:p}}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(e,b,c,d){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,js)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,jr),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&a.properties.hasOwnProperty("mapbox_clip_start")&&a.properties.hasOwnProperty("mapbox_clip_end"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,c,d,e,f,g){const b=this.layers[0].layout,h=b.get("line-join").evaluate(a,{}),i=b.get("line-cap").evaluate(a,{}),j=b.get("line-miter-limit"),k=b.get("line-round-limit");for(const l of(this.lineClips=this.lineFeatureClips(a),c))this.addLine(l,a,h,i,j,k);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,d,f,g,e)}addLine(g,K,A,L,v,M){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let q=0;q=2&&g[i-1].equals(g[i-2]);)i--;let l=0;for(;l0;if(B&&m>l){const C=a.dist(h);if(C>2*s){const w=a.sub(a.sub(h)._mult(s/C)._round());this.updateDistance(h,w),this.addCurrentVertex(w,d,0,0,c),h=w}}const D=h&&j;let e=D?A:r?"butt":L;if(D&&"round"===e&&(kv&&(e="bevel"),"bevel"===e&&(k>2&&(e="flipbevel"),k100)f=b.mult(-1);else{const O=k*d.add(b).mag()/d.sub(b).mag();f._perp()._mult(O*(p?-1:1))}this.addCurrentVertex(a,f,0,0,c),this.addCurrentVertex(a,f.mult(-1),0,0,c)}else if("bevel"===e||"fakeround"===e){const E=-Math.sqrt(k*k-1),F=p?E:0,G=p?0:E;if(h&&this.addCurrentVertex(a,d,F,G,c),"fakeround"===e){const H=Math.round(180*N/Math.PI/20);for(let x=1;x2*s){const z=a.add(j.sub(a)._mult(s/J)._round());this.updateDistance(a,z),this.addCurrentVertex(z,b,0,0,c),a=z}}}}addCurrentVertex(d,a,b,c,e,f=!1){const g=a.y*c-a.x,h=-a.y-a.x*c;this.addHalfVertex(d,a.x+a.y*b,a.y-a.x*b,f,!1,b,e),this.addHalfVertex(d,g,h,f,!0,-c,e)}addHalfVertex({x:e,y:f},g,h,i,b,c,d){this.layoutVertexArray.emplaceBack((e<<1)+(i?1:0),(f<<1)+(b?1:0),Math.round(63*g)+128,Math.round(63*h)+128,1+(0===c?0:c<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const a=d.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,a),d.primitiveLength++),b?this.e2=a:this.e1=a}updateScaledDistance(){if(this.lineClips){const a=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=a*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(a,b){this.distance+=a.dist(b),this.updateScaledDistance()}}c("LineBucket",dX,{omit:["layers","patternFeatures"]});const dY=new n({"line-cap":new g(b.layout_line["line-cap"]),"line-join":new g(b.layout_line["line-join"]),"line-miter-limit":new e(b.layout_line["line-miter-limit"]),"line-round-limit":new e(b.layout_line["line-round-limit"]),"line-sort-key":new g(b.layout_line["line-sort-key"])});var dZ={paint:new n({"line-opacity":new g(b.paint_line["line-opacity"]),"line-color":new g(b.paint_line["line-color"]),"line-translate":new e(b.paint_line["line-translate"]),"line-translate-anchor":new e(b.paint_line["line-translate-anchor"]),"line-width":new g(b.paint_line["line-width"]),"line-gap-width":new g(b.paint_line["line-gap-width"]),"line-offset":new g(b.paint_line["line-offset"]),"line-blur":new g(b.paint_line["line-blur"]),"line-dasharray":new N(b.paint_line["line-dasharray"]),"line-pattern":new N(b.paint_line["line-pattern"]),"line-gradient":new V(b.paint_line["line-gradient"])}),layout:dY};const d$=new class extends g{possiblyEvaluate(b,a){return a=new c5(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(b,a)}evaluate(b,a,c,d){return a=bR({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(b,a,c,d)}}(dZ.paint.properties["line-width"].specification);function jv(a,b){return b>0?b+2*a:a}d$.useIntegerZoom=!0;const jw=j([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"},],4),jx=j([{name:"a_projected_pos",components:3,type:"Float32"},],4);j([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const jy=j([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),jz=j([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);j([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},]);const jA=j([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),d_=j([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function d0(e,i){const{expression:a}=i;if("constant"===a.kind)return{kind:"constant",layoutSize:a.evaluate(new c5(e+1))};if("source"===a.kind)return{kind:"source"};{const{zoomStops:b,interpolationType:h}=a;let c=0;for(;c{a.text=function(a,c,d){const b=c.layout.get("text-transform").evaluate(d,{});return"uppercase"===b?a=a.toLocaleUpperCase():"lowercase"===b&&(a=a.toLocaleLowerCase()),c4.applyArabicShaping&&(a=c4.applyArabicShaping(a)),a}(a.text,b,c)}),a}const jC={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xa2":"\uFFE0","\xa3":"\uFFE1","\xa5":"\uFFE5","\xa6":"\uFFE4","\xac":"\uFFE2","\xaf":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function jD(a){return"\uFE36"===a||"\uFE48"===a||"\uFE38"===a||"\uFE44"===a||"\uFE42"===a||"\uFE3E"===a||"\uFE3C"===a||"\uFE3A"===a||"\uFE18"===a||"\uFE40"===a||"\uFE10"===a||"\uFE13"===a||"\uFE14"===a||"\uFF40"===a||"\uFFE3"===a||"\uFE11"===a||"\uFE12"===a}function jE(a){return"\uFE35"===a||"\uFE47"===a||"\uFE37"===a||"\uFE43"===a||"\uFE41"===a||"\uFE3D"===a||"\uFE3B"===a||"\uFE39"===a||"\uFE17"===a||"\uFE3F"===a}var jF=function(g,h,j,e,k){var a,c,l=8*k-e-1,m=(1<>1,b=-7,d=j?k-1:0,i=j?-1:1,f=g[h+d];for(d+=i,a=f&(1<< -b)-1,f>>=-b,b+=l;b>0;a=256*a+g[h+d],d+=i,b-=8);for(c=a&(1<< -b)-1,a>>=-b,b+=e;b>0;c=256*c+g[h+d],d+=i,b-=8);if(0===a)a=1-n;else{if(a===m)return c?NaN:1/0*(f?-1:1);c+=Math.pow(2,e),a-=n}return(f?-1:1)*c*Math.pow(2,a-e)},jG=function(j,b,k,m,c,n){var a,d,e,h=8*n-c-1,i=(1<>1,o=23===c?5960464477539062e-23:0,g=m?0:n-1,l=m?1:-1,p=b<0||0===b&&1/b<0?1:0;for(isNaN(b=Math.abs(b))||b===1/0?(d=isNaN(b)?1:0,a=i):(a=Math.floor(Math.log(b)/Math.LN2),b*(e=Math.pow(2,-a))<1&&(a--,e*=2),(b+=a+f>=1?o/e:o*Math.pow(2,1-f))*e>=2&&(a++,e/=2),a+f>=i?(d=0,a=i):a+f>=1?(d=(b*e-1)*Math.pow(2,c),a+=f):(d=b*Math.pow(2,f-1)*Math.pow(2,c),a=0));c>=8;j[k+g]=255&d,g+=l,d/=256,c-=8);for(a=a<0;j[k+g]=255&a,g+=l,a/=256,h-=8);j[k+g-l]|=128*p},d2=P;function P(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}P.Varint=0,P.Fixed64=1,P.Bytes=2,P.Fixed32=5;var jH="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function jI(a){return a.type===P.Bytes?a.readVarint()+a.pos:a.pos+1}function jJ(e,a,b){var d=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));b.realloc(d);for(var c=b.pos-1;c>=e;c--)b.buf[c+d]=b.buf[c]}function jK(b,c){for(var a=0;a>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function jV(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function jW(b,a,c){a.glyphs=[],1===b&&c.readMessage(jX,a)}function jX(a,b,c){if(3===a){const{id:f,bitmap:g,width:d,height:e,left:h,top:i,advance:j}=c.readMessage(jY,{});b.glyphs.push({id:f,bitmap:new dJ({width:d+6,height:e+6},g),metrics:{width:d,height:e,left:h,top:i,advance:j}})}else 4===a?b.ascender=c.readSVarint():5===a&&(b.descender=c.readSVarint())}function jY(a,b,c){1===a?b.id=c.readVarint():2===a?b.bitmap=c.readBytes():3===a?b.width=c.readVarint():4===a?b.height=c.readVarint():5===a?b.left=c.readSVarint():6===a?b.top=c.readSVarint():7===a&&(b.advance=c.readVarint())}function d3(g){let h=0,i=0;for(const j of g)h+=j.w*j.h,i=Math.max(i,j.w);g.sort((a,b)=>b.h-a.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(h/.95)),i),h:1/0},];let e=0,f=0;for(const a of g)for(let d=c.length-1;d>=0;d--){const b=c[d];if(!(a.w>b.w||a.h>b.h)){if(a.x=b.x,a.y=b.y,f=Math.max(f,a.y+a.h),e=Math.max(e,a.x+a.w),a.w===b.w&&a.h===b.h){const k=c.pop();d>3,f=this.pos;this.type=7&b,d(e,c,this),this.pos===f&&this.skip(b)}return c},readMessage:function(a,b){return this.readFields(a,b,this.readVarint()+this.pos)},readFixed32:function(){var a=jT(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=jV(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=jT(this.buf,this.pos)+4294967296*jT(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=jT(this.buf,this.pos)+4294967296*jV(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=jF(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=jF(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(d){var a,b,c=this.buf;return a=127&(b=c[this.pos++]),b<128?a:(a|=(127&(b=c[this.pos++]))<<7,b<128?a:(a|=(127&(b=c[this.pos++]))<<14,b<128?a:(a|=(127&(b=c[this.pos++]))<<21,b<128?a:function(g,h,b){var e,f,c,a,d=b.buf;if(c=(112&(a=d[b.pos++]))>>4,a<128||(c|=(127&(a=d[b.pos++]))<<3,a<128)||(c|=(127&(a=d[b.pos++]))<<10,a<128)||(c|=(127&(a=d[b.pos++]))<<17,a<128)||(c|=(127&(a=d[b.pos++]))<<24,a<128)||(c|=(1&(a=d[b.pos++]))<<31,a<128))return e=g,f=c,h?4294967296*f+(e>>>0):4294967296*(f>>>0)+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(a|=(15&(b=c[this.pos]))<<28,d,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?-((a+1)/2):a/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var c,d,e,a=this.readVarint()+this.pos,b=this.pos;return this.pos=a,a-b>=12&&jH?(c=this.buf,d=b,e=a,jH.decode(c.subarray(d,e))):function(d,k,j){for(var h="",b=k;b239?4:c>223?3:c>191?2:1;if(b+e>j)break;1===e?c<128&&(a=c):2===e?128==(192&(f=d[b+1]))&&(a=(31&c)<<6|63&f)<=127&&(a=null):3===e?(g=d[b+2],128==(192&(f=d[b+1]))&&128==(192&g)&&((a=(15&c)<<12|(63&f)<<6|63&g)<=2047||a>=55296&&a<=57343)&&(a=null)):4===e&&(g=d[b+2],i=d[b+3],128==(192&(f=d[b+1]))&&128==(192&g)&&128==(192&i)&&((a=(15&c)<<18|(63&f)<<12|(63&g)<<6|63&i)<=65535||a>=1114112)&&(a=null)),null===a?(a=65533,e=1):a>65535&&(a-=65536,h+=String.fromCharCode(a>>>10&1023|55296),a=56320|1023&a),h+=String.fromCharCode(a),b+=e}return h}(this.buf,b,a)},readBytes:function(){var a=this.readVarint()+this.pos,b=this.buf.subarray(this.pos,a);return this.pos=a,b},readPackedVarint:function(a,b){if(this.type!==P.Bytes)return a.push(this.readVarint(b));var c=jI(this);for(a=a||[];this.pos127;);else if(a===P.Bytes)this.pos=this.readVarint()+this.pos;else if(a===P.Fixed32)this.pos+=4;else{if(a!==P.Fixed64)throw Error("Unimplemented type: "+a);this.pos+=8}},writeTag:function(a,b){this.writeVarint(a<<3|b)},realloc:function(c){for(var a=this.length||16;a268435455||a<0?function(e,h){var f,g,d,c,a,b,i;if(e>=0?(f=e%4294967296|0,g=e/4294967296|0):(g=~(-e/4294967296),4294967295^(f=~(-e%4294967296))?f=f+1|0:(f=0,g=g+1|0)),e>=18446744073709552e3||e< -18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");h.realloc(10),d=f,(c=h).buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,d>>>=7,c.buf[c.pos++]=127&d|128,c.buf[c.pos]=127&(d>>>=7),a=g,b=h,i=(7&a)<<4,b.buf[b.pos++]|=i|((a>>>=3)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a|((a>>>=7)?128:0),a&&(b.buf[b.pos++]=127&a)))))}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?-(2*a)-1:2*a)},writeBoolean:function(a){this.writeVarint(Boolean(a))},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var c=this.pos;this.pos=function(c,f,b){for(var a,d,e=0;e55295&&a<57344){if(!d){a>56319||e+1===f.length?(c[b++]=239,c[b++]=191,c[b++]=189):d=a;continue}if(a<56320){c[b++]=239,c[b++]=191,c[b++]=189,d=a;continue}a=d-55296<<10|a-56320|65536,d=null}else d&&(c[b++]=239,c[b++]=191,c[b++]=189,d=null);a<128?c[b++]=a:(a<2048?c[b++]=a>>6|192:(a<65536?c[b++]=a>>12|224:(c[b++]=a>>18|240,c[b++]=a>>12&63|128),c[b++]=a>>6&63|128),c[b++]=63&a|128)}return b}(this.buf,a,this.pos);var b=this.pos-c;b>=128&&jJ(c,b,this),this.pos=c-1,this.writeVarint(b),this.pos+=b},writeFloat:function(a){this.realloc(4),jG(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),jG(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var a=c.length;this.writeVarint(a),this.realloc(a);for(var b=0;b=128&&jJ(b,a,this),this.pos=b-1,this.writeVarint(a),this.pos+=a},writeMessage:function(a,b,c){this.writeTag(a,P.Bytes),this.writeRawMessage(b,c)},writePackedVarint:function(b,a){a.length&&this.writeMessage(b,jK,a)},writePackedSVarint:function(b,a){a.length&&this.writeMessage(b,jL,a)},writePackedBoolean:function(b,a){a.length&&this.writeMessage(b,jO,a)},writePackedFloat:function(b,a){a.length&&this.writeMessage(b,jM,a)},writePackedDouble:function(b,a){a.length&&this.writeMessage(b,jN,a)},writePackedFixed32:function(b,a){a.length&&this.writeMessage(b,jP,a)},writePackedSFixed32:function(b,a){a.length&&this.writeMessage(b,jQ,a)},writePackedFixed64:function(b,a){a.length&&this.writeMessage(b,jR,a)},writePackedSFixed64:function(b,a){a.length&&this.writeMessage(b,jS,a)},writeBytesField:function(a,b){this.writeTag(a,P.Bytes),this.writeBytes(b)},writeFixed32Field:function(a,b){this.writeTag(a,P.Fixed32),this.writeFixed32(b)},writeSFixed32Field:function(a,b){this.writeTag(a,P.Fixed32),this.writeSFixed32(b)},writeFixed64Field:function(a,b){this.writeTag(a,P.Fixed64),this.writeFixed64(b)},writeSFixed64Field:function(a,b){this.writeTag(a,P.Fixed64),this.writeSFixed64(b)},writeVarintField:function(a,b){this.writeTag(a,P.Varint),this.writeVarint(b)},writeSVarintField:function(a,b){this.writeTag(a,P.Varint),this.writeSVarint(b)},writeStringField:function(a,b){this.writeTag(a,P.Bytes),this.writeString(b)},writeFloatField:function(a,b){this.writeTag(a,P.Fixed32),this.writeFloat(b)},writeDoubleField:function(a,b){this.writeTag(a,P.Fixed64),this.writeDouble(b)},writeBooleanField:function(a,b){this.writeVarintField(a,Boolean(b))}};class bj{constructor(a,{pixelRatio:b,version:c,stretchX:d,stretchY:e,content:f}){this.paddedRect=a,this.pixelRatio=b,this.stretchX=d,this.stretchY=e,this.content=f,this.version=c}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1,]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1,]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio,]}}class d4{constructor(g,h){const i={},j={};this.haveRenderCallbacks=[];const k=[];this.addImages(g,i,k),this.addImages(h,j,k);const{w:q,h:r}=d3(k),b=new bg({width:q||1,height:r||1});for(const l in g){const m=g[l],n=i[l].paddedRect;bg.copy(m.data,b,{x:0,y:0},{x:n.x+1,y:n.y+1},m.data)}for(const o in h){const a=h[o],p=j[o].paddedRect,c=p.x+1,d=p.y+1,e=a.data.width,f=a.data.height;bg.copy(a.data,b,{x:0,y:0},{x:c,y:d},a.data),bg.copy(a.data,b,{x:0,y:f-1},{x:c,y:d-1},{width:e,height:1}),bg.copy(a.data,b,{x:0,y:0},{x:c,y:d+f},{width:e,height:1}),bg.copy(a.data,b,{x:e-1,y:0},{x:c-1,y:d},{width:1,height:f}),bg.copy(a.data,b,{x:0,y:0},{x:c+e,y:d},{width:1,height:f})}this.image=b,this.iconPositions=i,this.patternPositions=j}addImages(c,e,f){for(const b in c){const a=c[b],d={x:0,y:0,w:a.data.width+2,h:a.data.height+2};f.push(d),e[b]=new bj(d,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(b)}}patchUpdatedImages(a,c){for(const b in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[b],a.getImage(b),c),this.patchUpdatedImage(this.patternPositions[b],a.getImage(b),c)}patchUpdatedImage(a,b,c){if(!a||!b||a.version===b.version)return;a.version=b.version;const[d,e]=a.tl;c.update(b.data,void 0,{x:d,y:e})}}c("ImagePosition",bj),c("ImageAtlas",d4);const d5={horizontal:1,vertical:2,horizontalOnly:3};class jZ{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(b,c){const a=new jZ;return a.scale=b||1,a.fontStack=c,a}static forImage(b){const a=new jZ;return a.imageName=b,a}}class j${constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(d,e){const a=new j$;for(let b=0;b=0&&b>=a&&j0[this.text.charCodeAt(b)];b--)d--;this.text=this.text.substring(a,d),this.sectionIndex=this.sectionIndex.slice(a,d)}substring(b,c){const a=new j$;return a.text=this.text.substring(b,c),a.sectionIndex=this.sectionIndex.slice(b,c),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,b)=>Math.max(a,this.sections[b].scale),0)}addTextSection(a,c){this.text+=a.text,this.sections.push(jZ.forText(a.scale,a.fontStack||c));const d=this.sections.length-1;for(let b=0;b=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function j_(u,c,v,d,w,i,x,y,z,e,f,j,m,k,l,A){const a=j$.fromFeature(u,w);let b;j===d5.vertical&&a.verticalizePunctuation(m);const{processBidirectionalText:n,processStyledBidirectionalText:o}=c4;if(n&&1===a.sections.length){b=[];const B=n(a.toString(),j7(a,e,i,c,d,k,l));for(const p of B){const g=new j$;g.text=p,g.sections=a.sections;for(let q=0;q0&&D>k&&(k=D)}else{const E=U[e.fontStack];if(!E)continue;E[c]&&(u=E[c]);const l=H[e.fontStack];if(!l)continue;const P=l.glyphs[c];if(!P)continue;if(d=P.metrics,B=8203!==c?24:0,i){const F=void 0!==l.ascender?Math.abs(l.ascender):0,Q=void 0!==l.descender?Math.abs(l.descender):0,R=(F+Q)*a;M=0;let f=0;for(let c=0;c -j/2;){if(--a<0)return!1;c-=b[a].dist(k),k=b[a]}c+=b[a].dist(b[a+1]),a++;const f=[];let g=0;for(;cl;)g-=f.shift().angleDelta;if(g>m)return!1;a++,c+=h.dist(i)}return!0}function kc(b){let c=0;for(let a=0;aj){const k=(j-e)/f,q=aY(c.x,d.x,k),r=aY(c.y,d.y,k),l=new d7(q,r,0,d.angleTo(c),b);return!i||kb(a,l,p,i,m)?l:void 0}e+=f}}function kg(b,a,k,f,l,g,c,h,d){const m=kd(f,g,c),i=ke(f,l),e=i*c,j=0===b[0].x||b[0].x===d||0===b[0].y||b[0].y===d;return a-e=0&&m=0&&n=0&&b+r<=v){const o=new d7(m,n,0,w,c);o._round(),i&&!kb(a,o,j,i,p)||f.push(o)}}e+=l}return u||f.length||q||(f=kh(a,e/2,d,i,p,j,q,!0,k)),f}function d8(k,c,d,e,f){const l=[];for(let i=0;i=e&&b.x>=e||(a.x>=e?a=new aF(e,a.y+(e-a.x)/(b.x-a.x)*(b.y-a.y))._round():b.x>=e&&(b=new aF(e,a.y+(e-a.x)/(b.x-a.x)*(b.y-a.y))._round()),a.y>=f&&b.y>=f||(a.y>=f?a=new aF(a.x+(f-a.y)/(b.y-a.y)*(b.x-a.x),f)._round():b.y>=f&&(b=new aF(a.x+(f-a.y)/(b.y-a.y)*(b.x-a.x),f)._round()),g&&a.equals(g[g.length-1])||(g=[a],l.push(g)),g.push(b)))))}}return l}function ki(f,a,b,g,h,c,i,j,k){for(let d=a;d -1)f[++c]=a,b[c]=j,b[c+1]=1e20}for(let e=0,k=0;e{let a=this.entries[b];a||(a=this.entries[b]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let d=a.glyphs[c];if(void 0!==d)return void f(null,{stack:b,id:c,glyph:d});if(d=this._tinySDF(a,b,c))return a.glyphs[c]=d,void f(null,{stack:b,id:c,glyph:d});const e=Math.floor(c/256);if(256*e>65535)return void f(Error("glyphs > 65535 not supported"));if(a.ranges[e])return void f(null,{stack:b,id:c,glyph:d});let g=a.requests[e];g||(g=a.requests[e]=[],aA.loadGlyphRange(b,e,this.url,this.requestManager,(d,b)=>{if(b){for(const c in a.ascender=b.ascender,a.descender=b.descender,b.glyphs)this._doesCharSupportLocalGlyph(+c)||(a.glyphs[+c]=b.glyphs[+c]);a.ranges[e]=!0}for(const f of g)f(d,b);delete a.requests[e]})),g.push((a,d)=>{a?f(a):d&&f(null,{stack:b,id:c,glyph:d.glyphs[c]||null})})},(d,f)=>{if(d)e(d);else if(f){const b={};for(const{stack:a,id:g,glyph:c}of f)void 0===b[a]&&(b[a]={}),void 0===b[a].glyphs&&(b[a].glyphs={}),b[a].glyphs[g]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics},b[a].ascender=this.entries[a].ascender,b[a].descender=this.entries[a].descender;e(null,b)}})}_doesCharSupportLocalGlyph(a){return this.localGlyphMode!==d9.none&&(this.localGlyphMode===d9.all?!!this.localFontFamily:!!this.localFontFamily&&(hh(a)||hk(a)||g8(a)||g9(a))||g7(a))}_tinySDF(e,d,a){const f=this.localFontFamily;if(!f||!this._doesCharSupportLocalGlyph(a))return;let b=e.tinySDF;if(!b){let c="400";/bold/i.test(d)?c="900":/medium/i.test(d)?c="500":/light/i.test(d)&&(c="200"),(b=e.tinySDF=new aA.TinySDF({fontFamily:f,fontWeight:c,fontSize:48,buffer:6,radius:16})).fontWeight=c}if(this.localGlyphs[b.fontWeight][a])return this.localGlyphs[b.fontWeight][a];const g=String.fromCharCode(a),{data:h,width:i,height:j,glyphWidth:k,glyphHeight:l,glyphLeft:m,glyphTop:n,glyphAdvance:o}=b.draw(g);return this.localGlyphs[b.fontWeight][a]={id:a,bitmap:new dJ({width:i,height:j},h),metrics:{width:k/2,height:l/2,left:m/2,top:n/2-27,advance:o/2,localGlyph:!0}}}}function kk(c,D,E,o){const h=[],b=c.image,F=b.pixelRatio,i=b.paddedRect.w-2,j=b.paddedRect.h-2,G=c.right-c.left,H=c.bottom-c.top,d=b.stretchX||[[0,i]],e=b.stretchY||[[0,j]],p=(b,a)=>b+a[1]-a[0],k=d.reduce(p,0),l=e.reduce(p,0),q=i-k,r=j-l;let s=0,t=k,u=0,v=l,x=0,y=q,z=0,A=r;if(b.content&&o){const a=b.content;s=kl(d,0,a[0]),u=kl(e,0,a[1]),t=kl(d,a[0],a[2]),v=kl(e,a[1],a[3]),x=a[0]-s,z=a[1]-u,y=a[2]-a[0]-t,A=a[3]-a[1]-v}const w=(a,d,e,f)=>{const i=(a.stretch-s)/t*G+c.left,J=a.fixed-x-y*a.stretch/k,j=(d.stretch-u)/v*H+c.top,K=d.fixed-z-A*d.stretch/l,m=(e.stretch-s)/t*G+c.left,L=e.fixed-x-y*e.stretch/k,n=(f.stretch-u)/v*H+c.top,M=f.fixed-z-A*f.stretch/l,o=new aF(i,j),p=new aF(m,j),q=new aF(m,n),r=new aF(i,n),N=new aF(J/F,K/F),O=new aF(L/F,M/F),h=D*Math.PI/180;if(h){const w=Math.sin(h),B=Math.cos(h),g=[B,-w,w,B];o._matMult(g),p._matMult(g),r._matMult(g),q._matMult(g)}const C=a.stretch+a.fixed,I=d.stretch+d.fixed;return{tl:o,tr:p,bl:r,br:q,tex:{x:b.paddedRect.x+1+C,y:b.paddedRect.y+1+I,w:e.stretch+e.fixed-C,h:f.stretch+f.fixed-I},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:N,pixelOffsetBR:O,minFontScaleX:y/F/G,minFontScaleY:A/F/H,isSDF:E}};if(o&&(b.stretchX||b.stretchY)){const m=km(d,q,k),n=km(e,r,l);for(let f=0;f{if(b)g(b);else if(c){var d;const e={},a=(d=c,new d2(d).readFields(jW,{}));for(const f of a.glyphs)e[f.id]=f;g(null,{glyphs:e,ascender:a.ascender,descender:a.descender})}})},aA.TinySDF=class{constructor({fontSize:c=24,buffer:d=3,radius:e=8,cutoff:f=.25,fontFamily:g="sans-serif",fontWeight:h="normal",fontStyle:i="normal"}){this.buffer=d,this.cutoff=f,this.radius=e;const a=this.size=c+4*d,j=this._createCanvas(a),b=this.ctx=j.getContext("2d",{willReadFrequently:!0});b.font=`${i} ${h} ${c}px ${g}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(b){const a=document.createElement("canvas");return a.width=a.height=b,a}draw(p){const{width:u,actualBoundingBoxAscent:q,actualBoundingBoxDescent:v,actualBoundingBoxLeft:w,actualBoundingBoxRight:x}=this.ctx.measureText(p),r=Math.floor(q),b=Math.min(this.size-this.buffer,Math.ceil(x-w)),c=Math.min(this.size-this.buffer,Math.ceil(q)+Math.ceil(v)),d=b+2*this.buffer,m=c+2*this.buffer,i=d*m,s=new Uint8ClampedArray(i),t={data:s,width:d,height:m,glyphWidth:b,glyphHeight:c,glyphTop:r,glyphLeft:0,glyphAdvance:u};if(0===b||0===c)return t;const{ctx:n,buffer:a,gridInner:f,gridOuter:g}=this;n.clearRect(a,a,b,c),n.fillText(p,a,a+r+1);const y=n.getImageData(a,a,b,c);g.fill(1e20,0,i),f.fill(0,0,i);for(let j=0;j0?e*e:0,f[l]=e<0?e*e:0}}ki(g,0,0,d,m,d,this.f,this.v,this.z),ki(f,a,a,b,c,d,this.f,this.v,this.z);for(let h=0;hb?1:0}){if(this.data=b,this.length=this.data.length,this.compare=c,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const a=this.data[0],b=this.data.pop();return this.length--,this.length>0&&(this.data[0]=b,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:b,compare:f}=this,c=b[a];for(;a>0;){const d=a-1>>1,e=b[d];if(f(c,e)>=0)break;b[a]=e,a=d}b[a]=c}_down(a){const{data:b,compare:f}=this,h=this.length>>1,g=b[a];for(;af(b[e],d)&&(c=e,d=b[e]),f(d,g)>=0)break;b[a]=d,a=c}b[a]=g}}function kp(e,r=1,p=!1){let h=1/0,i=1/0,j=-1/0,k=-1/0;const q=e[0];for(let f=0;fj)&&(j=c.x),(!f||c.y>k)&&(k=c.y)}const l=Math.min(j-h,k-i);let a=l/2;const d=new ko([],kq);if(0===l)return new aF(h,i);for(let m=h;mg.d||!g.d)&&(g=b,p&&console.log("found best %d after %d probes",Math.round(1e4*b.d)/1e4,o)),b.max-g.d<=r||(a=b.h/2,d.push(new kr(b.p.x-a,b.p.y-a,a,e)),d.push(new kr(b.p.x+a,b.p.y-a,a,e)),d.push(new kr(b.p.x-a,b.p.y+a,a,e)),d.push(new kr(b.p.x+a,b.p.y+a,a,e)),o+=4)}return p&&(console.log(`num probes: ${o}`),console.log(`best distance: ${g.d}`)),g.p}function kq(a,b){return b.max-a.max}function kr(a,b,c,d){this.p=new aF(a,b),this.h=c,this.d=function(b,i){let d=!1,e=1/0;for(let f=0;fb.y!=c.y>b.y&&b.x<(c.x-a.x)*(b.y-a.y)/(c.y-a.y)+a.x&&(d=!d),e=Math.min(e,im(b,a,c))}}return(d?1:-1)*Math.sqrt(e)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const ks=Number.POSITIVE_INFINITY,kt=Math.sqrt(2);function ea(b,a){return a[1]!==ks?function(e,a,b){let c=0,d=0;switch(a=Math.abs(a),b=Math.abs(b),e){case"top-right":case"top-left":case"top":d=b-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-b}switch(e){case"top-right":case"bottom-right":case"right":c=-a;break;case"top-left":case"bottom-left":case"left":c=a}return[c,d]}(b,a[0],a[1]):function(e,a){let b=0,c=0;a<0&&(a=0);const d=a/kt;switch(e){case"top-right":case"top-left":c=d-7;break;case"bottom-right":case"bottom-left":c=7-d;break;case"bottom":c=7-a;break;case"top":c=a-7}switch(e){case"top-right":case"bottom-right":b=-d;break;case"top-left":case"bottom-left":b=d;break;case"left":b=a;break;case"right":b=-a}return[b,c]}(b,a[0])}function ku(a,w,x,y,n,M,N,b,o,O){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const d=a.layers[0].layout,g=a.layers[0]._unevaluatedLayout._values,e={};if("composite"===a.textSizeData.kind){const{minZoom:P,maxZoom:Q}=a.textSizeData;e.compositeTextSizes=[g["text-size"].possiblyEvaluate(new c5(P),b),g["text-size"].possiblyEvaluate(new c5(Q),b),]}if("composite"===a.iconSizeData.kind){const{minZoom:R,maxZoom:S}=a.iconSizeData;e.compositeIconSizes=[g["icon-size"].possiblyEvaluate(new c5(R),b),g["icon-size"].possiblyEvaluate(new c5(S),b),]}e.layoutTextSize=g["text-size"].possiblyEvaluate(new c5(o+1),b),e.layoutIconSize=g["icon-size"].possiblyEvaluate(new c5(o+1),b),e.textMaxSize=g["text-size"].possiblyEvaluate(new c5(18),b);const z="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),T=d.get("text-size");for(const c of a.features){const A=d.get("text-font").evaluate(c,{},b).join(","),B=T.evaluate(c,{},b),p=e.layoutTextSize.evaluate(c,{},b),f=(e.layoutIconSize.evaluate(c,{},b),{horizontal:{},vertical:void 0}),k=c.text;let q,l=[0,0];if(k){const C=k.toString(),U=24*d.get("text-letter-spacing").evaluate(c,{},b),D=24*d.get("text-line-height").evaluate(c,{},b),E=ht(C)?U:0,r=d.get("text-anchor").evaluate(c,{},b),s=d.get("text-variable-anchor");if(!s){const F=d.get("text-radial-offset").evaluate(c,{},b);l=F?ea(r,[24*F,ks]):d.get("text-offset").evaluate(c,{},b).map(a=>24*a)}let h=z?"center":d.get("text-justify").evaluate(c,{},b);const i=d.get("symbol-placement"),V="point"===i,G="point"===i?24*d.get("text-max-width").evaluate(c,{},b):0,H=b=>{a.allowVerticalPlacement&&hs(C)&&(f.vertical=j_(k,w,x,n,A,G,D,r,b,E,l,d5.vertical,!0,i,p,B))};if(!z&&s){const I="auto"===h?s.map(a=>eb(a)):[h];let J=!1;for(let t=0;t=0||!hs(C)){const K=j_(k,w,x,n,A,G,D,r,h,E,l,d5.horizontal,!1,i,p,B);K&&(f.horizontal[h]=K)}H("point"===i?"left":h)}}let L=!1;if(c.icon&&c.icon.name){const j=y[c.icon.name];j&&(q=j9(n[c.icon.name],d.get("icon-offset").evaluate(c,{},b),d.get("icon-anchor").evaluate(c,{},b)),L=j.sdf,void 0===a.sdfIcons?a.sdfIcons=j.sdf:a.sdfIcons!==j.sdf&&bY("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==a.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(a.iconsNeedLinear=!0))}const v=ky(f.horizontal)||f.vertical;a.iconsInText||(a.iconsInText=!!v&&v.iconsInText),(v||q)&&kv(a,c,f,q,y,e,p,0,l,L,N,b,O)}M&&a.generateCollisionDebugBuffers(o,a.collisionBoxArray)}function eb(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kv(c,b,e,f,F,A,n,G,H,I,J,d,K){let i=A.textMaxSize.evaluate(b,{},d);void 0===i&&(i=n);const a=c.layers[0].layout,o=a.get("icon-offset").evaluate(b,{},d),g=ky(e.horizontal)||e.vertical,p=n/24,q=c.tilePixelRatio*i/24,r=c.tilePixelRatio*a.get("symbol-spacing"),L=a.get("text-padding")*c.tilePixelRatio,M=a.get("icon-padding")*c.tilePixelRatio,s=a.get("text-max-angle")*aP,N="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement"),O="map"===a.get("icon-rotation-alignment")&&"point"!==a.get("symbol-placement"),t=a.get("symbol-placement"),B=r/2,j=a.get("icon-text-fit");let C;f&&"none"!==j&&(c.allowVerticalPlacement&&e.vertical&&(C=ka(f,e.vertical,j,a.get("icon-text-fit-padding"),o,p)),g&&(f=ka(f,g,j,a.get("icon-text-fit-padding"),o,p)));const h=(g,a,h)=>{if(a.x<0||a.x>=8192||a.y<0||a.y>=8192)return;const{x:i,y:j,z:k}=K.projectTilePoint(a.x,a.y,h),l=new d7(i,j,k,0,void 0);!function(a,d,e,aa,h,z,H,j,f,r,m,s,t,I,u,v,ac,J,K,L,b,w,M,x,c){const k=a.addToLineVertexArray(d,aa);let l,n,o,y,N,O,P,Q=0,R=0,S=0,T=0,A=-1,B=-1;const g={};let U=bd(""),C=0,D=0;if(void 0===f._unevaluatedLayout.getValue("text-radial-offset")?[C,D]=f.layout.get("text-offset").evaluate(b,{},c).map(a=>24*a):(C=24*f.layout.get("text-radial-offset").evaluate(b,{},c),D=ks),a.allowVerticalPlacement&&h.vertical){const V=h.vertical;if(u)O=kA(V),j&&(P=kA(j));else{const W=f.layout.get("text-rotate").evaluate(b,{},c)+90;o=kz(r,e,d,m,s,t,V,I,W,v),j&&(y=kz(r,e,d,m,s,t,j,J,W))}}if(z){const E=f.layout.get("icon-rotate").evaluate(b,{},c),X="none"!==f.layout.get("icon-text-fit"),Y=kk(z,E,M,X),F=j?kk(j,E,M,X):void 0;n=kz(r,e,d,m,s,t,z,J,E),Q=4*Y.length;const Z=a.iconSizeData;let p=null;"source"===Z.kind?(p=[128*f.layout.get("icon-size").evaluate(b,{},c),])[0]>kw&&bY(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Z.kind&&((p=[128*w.compositeIconSizes[0].evaluate(b,{},c),128*w.compositeIconSizes[1].evaluate(b,{},c),])[0]>kw||p[1]>kw)&&bY(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),a.addSymbols(a.icon,Y,p,L,K,b,!1,e,d,k.lineStartIndex,k.lineLength,-1,x,c),A=a.icon.placedSymbolArray.length-1,F&&(R=4*F.length,a.addSymbols(a.icon,F,p,L,K,b,d5.vertical,e,d,k.lineStartIndex,k.lineLength,-1,x,c),B=a.icon.placedSymbolArray.length-1)}for(const $ in h.horizontal){const q=h.horizontal[$];l||(U=bd(q.text),u?N=kA(q):l=kz(r,e,d,m,s,t,q,I,f.layout.get("text-rotate").evaluate(b,{},c),v));const _=1===q.positionedLines.length;if(S+=kx(a,e,d,q,H,f,u,b,v,k,h.vertical?d5.horizontal:d5.horizontalOnly,_?Object.keys(h.horizontal):[$],g,A,w,x,c),_)break}h.vertical&&(T+=kx(a,e,d,h.vertical,H,f,u,b,v,k,d5.vertical,["vertical"],g,B,w,x,c));let i=-1;const G=(a,b)=>a?Math.max(a,b):b;i=G(N,i),i=G(O,i),i=G(P,i);const ab=i> -1?1:0;a.glyphOffsetArray.length>=aB.MAX_GLYPHS&&bY("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&a.addToSortKeyRanges(a.symbolInstances.length,b.sortKey),a.symbolInstances.emplaceBack(e.x,e.y,e.z,d.x,d.y,g.right>=0?g.right:-1,g.center>=0?g.center:-1,g.left>=0?g.left:-1,g.vertical>=0?g.vertical:-1,A,B,U,void 0!==l?l:a.collisionBoxArray.length,void 0!==l?l+1:a.collisionBoxArray.length,void 0!==o?o:a.collisionBoxArray.length,void 0!==o?o+1:a.collisionBoxArray.length,void 0!==n?n:a.collisionBoxArray.length,void 0!==n?n+1:a.collisionBoxArray.length,y||a.collisionBoxArray.length,y?y+1:a.collisionBoxArray.length,m,S,T,Q,R,ab,0,C,D,i)}(c,a,l,g,e,f,F,C,c.layers[0],c.collisionBoxArray,b.index,b.sourceLayerIndex,c.index,L,N,H,0,M,O,o,b,A,I,J,d)};if("line"===t)for(const u of d8(b.geometry,0,0,8192,8192)){const D=kg(u,r,s,e.vertical||g,f,24,q,c.overscaling,8192);for(const v of D){const w=g;w&&kB(c,w.text,B,v)||h(u,v,d)}}else if("line-center"===t){for(const k of b.geometry)if(k.length>1){const x=kf(k,s,e.vertical||g,f,24,q);x&&h(k,x,d)}}else if("Polygon"===b.type)for(const y of i8(b.geometry,0)){const z=kp(y,16);h(y[0],new d7(z.x,z.y,0,0,void 0),d)}else if("LineString"===b.type)for(const l of b.geometry)h(l,new d7(l[0].x,l[0].y,0,0,void 0),d);else if("Point"===b.type)for(const E of b.geometry)for(const m of E)h([m],new d7(m.x,m.y,0,0,void 0),d)}const kw=32640;function kx(a,l,m,n,o,e,f,b,g,h,p,q,r,s,i,t,c){const j=function(Z,c,g,M,l,N,O,B){const s=[];if(0===c.positionedLines.length)return s;const h=M.layout.get("text-rotate").evaluate(N,{})*Math.PI/180,m=function(c){const a=c[0],b=c[1],d=a*b;return d>0?[a,-b]:d<0?[-a,b]:0===a?[b,a]:[b,-a]}(g);let C=Math.abs(c.top-c.bottom);for(const P of c.positionedLines)C-=P.lineOffset;const D=c.positionedLines.length,Q=C/D;let t=c.top-g[1];for(let n=0;nkw&&bY(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===k.kind&&((d=[128*i.compositeTextSizes[0].evaluate(b,{},c),128*i.compositeTextSizes[1].evaluate(b,{},c),])[0]>kw||d[1]>kw)&&bY(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),a.addSymbols(a.text,j,d,g,f,b,p,l,m,h.lineStartIndex,h.lineLength,s,t,c),q))r[u]=a.text.placedSymbolArray.length-1;return 4*j.length}function ky(a){for(const b in a)return a[b];return null}function kz(o,m,p,r,s,t,a,u,q,n){let b=a.top,c=a.bottom,d=a.left,e=a.right;const f=a.collisionPadding;if(f&&(d-=f[0],b-=f[1],e+=f[2],c+=f[3]),q){const g=new aF(d,b),h=new aF(e,b),i=new aF(d,c),j=new aF(e,c),l=q*aP;let k=new aF(0,0);n&&(k=new aF(n[0],n[1])),g._rotateAround(l,k),h._rotateAround(l,k),i._rotateAround(l,k),j._rotateAround(l,k),d=Math.min(g.x,h.x,i.x,j.x),e=Math.max(g.x,h.x,i.x,j.x),b=Math.min(g.y,h.y,i.y,j.y),c=Math.max(g.y,h.y,i.y,j.y)}return o.emplaceBack(m.x,m.y,m.z,p.x,p.y,d,b,e,c,u,r,s,t),o.length-1}function kA(a){a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const b=a.bottom-a.top;return b>0?Math.max(10,b):null}function kB(f,a,g,d){const b=f.compareText;if(a in b){const e=b[a];for(let c=e.length-1;c>=0;c--)if(d.dist(e[c])a.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=aI([]),this.placementViewportMatrix=aI([]);const d=this.layers[0]._unevaluatedLayout._values;this.textSizeData=d0(this.zoom,d["text-size"]),this.iconSizeData=d0(this.zoom,d["icon-size"]);const b=this.layers[0].layout,e=b.get("symbol-sort-key"),c=b.get("symbol-z-order");this.canOverlap=b.get("text-allow-overlap")||b.get("icon-allow-overlap")||b.get("text-ignore-placement")||b.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==c&& void 0!==e.constantOr(1),this.sortFeaturesByY=("viewport-y"===c||"auto"===c&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=b.get("text-writing-mode").map(a=>d5[a]),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.sourceID=a.sourceID}createArrays(){this.text=new ec(new dv(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new ec(new dv(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new dd,this.lineVertexArray=new de,this.symbolInstances=new dc}calculateGlyphDependencies(b,c,g,e,f){for(let a=0;a0)&&("constant"!==k.value.kind||k.value.value.length>0),o="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,x=b.get("symbol-sort-key");if(this.features=[],!n&&!o)return;const p=j.iconDependencies,q=j.glyphDependencies,r=j.availableImages,y=new c5(this.zoom);for(const{feature:h,id:z,index:A,sourceLayerIndex:B}of v){const s=d._featureFilter.needGeometry,a=id(h,s);if(!d._featureFilter.filter(y,a,c))continue;let e,f;if(s||(a.geometry=ic(h,c,w)),n){const C=d.getValueAndResolveTokens("text-field",a,c,r),t=fB.factory(C);kF(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===c3()||this.hasRTLText&&c4.isParsed())&&(e=jB(t,d,a))}if(o){const m=d.getValueAndResolveTokens("icon-image",a,c,r);f=m instanceof cj?m:cj.fromString(m)}if(!e&&!f)continue;const D=this.sortFeaturesByKey?x.evaluate(a,{},c):void 0;if(this.features.push({id:z,text:e,icon:f,index:A,sourceLayerIndex:B,geometry:a.geometry,properties:h.properties,type:kC[h.type],sortKey:D}),f&&(p[f.name]=!0),e){const E=k.evaluate(a,{},c).join(","),F="map"===b.get("text-rotation-alignment")&&"point"!==b.get("symbol-placement");for(const i of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(d5.vertical)>=0,e.sections))if(i.image)p[i.image.name]=!0;else{const G=hs(e.toString()),u=i.fontStack||E,H=q[u]=q[u]||{};this.calculateGlyphDependencies(i.text,H,F,this.allowVerticalPlacement,G)}}}"line"===b.get("symbol-placement")&&(this.features=function(k){const d={},c={},g=[];let l=0;function m(a){g.push(k[a]),l++}function n(b,d,e){const a=c[b];return delete c[b],c[d]=a,g[a].geometry[0].pop(),g[a].geometry[0]=g[a].geometry[0].concat(e[0]),a}function o(c,b,e){const a=d[b];return delete d[b],d[c]=a,g[a].geometry[0].shift(),g[a].geometry[0]=e[0].concat(g[a].geometry[0]),a}function i(c,a,d){const b=d?a[0][a[0].length-1]:a[0][0];return`${c}:${b.x}:${b.y}`}for(let e=0;ea.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((a,b)=>a.sortKey-b.sortKey)}update(a,b,c,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,b,this.layers,c,d),this.icon.programConfigurations.updatePaintArrays(a,b,this.layers,c,d))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(d,a){const h=this.lineVertexArray.length;if(void 0!==d.segment){let i=d.dist(a[d.segment+1]),j=d.dist(a[d.segment]);const e={};for(let b=d.segment+1;b=0;c--)e[c]={x:a[c].x,y:a[c].y,tileUnitDistanceFromAnchor:j},c>0&&(j+=a[c-1].dist(a[c]));for(let f=0;f=0?a.rightJustifiedTextSymbolIndex:a.centerJustifiedTextSymbolIndex>=0?a.centerJustifiedTextSymbolIndex:a.leftJustifiedTextSymbolIndex>=0?a.leftJustifiedTextSymbolIndex:a.verticalPlacedTextSymbolIndex>=0?a.verticalPlacedTextSymbolIndex:c),e=bh(this.textSizeData,b,d)/24;return this.tilePixelRatio*e}getSymbolInstanceIconSize(a,e,b){const c=this.icon.placedSymbolArray.get(b),d=bh(this.iconSizeData,a,c);return this.tilePixelRatio*d}_commitDebugCollisionVertexUpdate(b,c,a){b.emplaceBack(c,-a,-a),b.emplaceBack(c,a,-a),b.emplaceBack(c,a,a),b.emplaceBack(c,-a,a)}_updateTextDebugCollisionBoxes(b,c,d,e,f,g){for(let a=e;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(b,d){const c=b.placedSymbolArray.get(d),e=c.vertexStartIndex+4*c.numGlyphs;for(let a=c.vertexStartIndex;ag[a]-g[b]||h[b]-h[a]),c}addToSortKeyRanges(a,c){const b=this.sortKeyRanges[this.sortKeyRanges.length-1];b&&b.sortKey===c?b.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(b){if(this.sortFeaturesByY&&this.sortedAngle!==b&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const c of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(b),this.sortedAngle=b,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const a=this.symbolInstances.get(c);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex,].forEach((a,b,c)=>{a>=0&&c.indexOf(a)===b&&this.addIndicesForPlacedSymbol(this.text,a)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}c("SymbolBucket",aB,{omit:["layers","collisionBoxArray","features","compareText",]}),aB.MAX_GLYPHS=65535,aB.addDynamicAttributes=bk;const ee=new n({"symbol-placement":new e(b.layout_symbol["symbol-placement"]),"symbol-spacing":new e(b.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new e(b.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new g(b.layout_symbol["symbol-sort-key"]),"symbol-z-order":new e(b.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new e(b.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new e(b.layout_symbol["icon-ignore-placement"]),"icon-optional":new e(b.layout_symbol["icon-optional"]),"icon-rotation-alignment":new e(b.layout_symbol["icon-rotation-alignment"]),"icon-size":new g(b.layout_symbol["icon-size"]),"icon-text-fit":new e(b.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new e(b.layout_symbol["icon-text-fit-padding"]),"icon-image":new g(b.layout_symbol["icon-image"]),"icon-rotate":new g(b.layout_symbol["icon-rotate"]),"icon-padding":new e(b.layout_symbol["icon-padding"]),"icon-keep-upright":new e(b.layout_symbol["icon-keep-upright"]),"icon-offset":new g(b.layout_symbol["icon-offset"]),"icon-anchor":new g(b.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new e(b.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new e(b.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new e(b.layout_symbol["text-rotation-alignment"]),"text-field":new g(b.layout_symbol["text-field"]),"text-font":new g(b.layout_symbol["text-font"]),"text-size":new g(b.layout_symbol["text-size"]),"text-max-width":new g(b.layout_symbol["text-max-width"]),"text-line-height":new g(b.layout_symbol["text-line-height"]),"text-letter-spacing":new g(b.layout_symbol["text-letter-spacing"]),"text-justify":new g(b.layout_symbol["text-justify"]),"text-radial-offset":new g(b.layout_symbol["text-radial-offset"]),"text-variable-anchor":new e(b.layout_symbol["text-variable-anchor"]),"text-anchor":new g(b.layout_symbol["text-anchor"]),"text-max-angle":new e(b.layout_symbol["text-max-angle"]),"text-writing-mode":new e(b.layout_symbol["text-writing-mode"]),"text-rotate":new g(b.layout_symbol["text-rotate"]),"text-padding":new e(b.layout_symbol["text-padding"]),"text-keep-upright":new e(b.layout_symbol["text-keep-upright"]),"text-transform":new g(b.layout_symbol["text-transform"]),"text-offset":new g(b.layout_symbol["text-offset"]),"text-allow-overlap":new e(b.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new e(b.layout_symbol["text-ignore-placement"]),"text-optional":new e(b.layout_symbol["text-optional"])});var kG={paint:new n({"icon-opacity":new g(b.paint_symbol["icon-opacity"]),"icon-color":new g(b.paint_symbol["icon-color"]),"icon-halo-color":new g(b.paint_symbol["icon-halo-color"]),"icon-halo-width":new g(b.paint_symbol["icon-halo-width"]),"icon-halo-blur":new g(b.paint_symbol["icon-halo-blur"]),"icon-translate":new e(b.paint_symbol["icon-translate"]),"icon-translate-anchor":new e(b.paint_symbol["icon-translate-anchor"]),"text-opacity":new g(b.paint_symbol["text-opacity"]),"text-color":new g(b.paint_symbol["text-color"],{runtimeType:y,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new g(b.paint_symbol["text-halo-color"]),"text-halo-width":new g(b.paint_symbol["text-halo-width"]),"text-halo-blur":new g(b.paint_symbol["text-halo-blur"]),"text-translate":new e(b.paint_symbol["text-translate"]),"text-translate-anchor":new e(b.paint_symbol["text-translate-anchor"])}),layout:ee};class ef{constructor(a){this.type=a.property.overrides?a.property.overrides.runtimeType:cf,this.defaultValue=a}evaluate(a){if(a.formattedSection){const b=this.defaultValue.property.overrides;if(b&&b.hasOverride(a.formattedSection))return b.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}c("FormatSectionOverride",ef,{omit:["defaultValue"]});class eg extends be{constructor(a){super(a,kG)}recalculate(d,e){super.recalculate(d,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const b=this.layout.get("text-writing-mode");if(b){const a=[];for(const c of b)0>a.indexOf(c)&&a.push(c);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(b,c,e,f){var g;const a=this.layout.get(b).evaluate(c,{},e,f),d=this._unevaluatedLayout._values[b];return d.isDataDriven()||gv(d.value)||!a?a:(g=c.properties,a.replace(/{([^{}]+)}/g,(b,a)=>a in g?String(g[a]):""))}createBucket(a){return new aB(a)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const b of kG.paint.overridableProperties){if(!eg.hasPaintOverride(this.layout,b))continue;const a=this.paint.get(b),e=new ef(a),c=new cM(e,a.property.specification);let d=null;d="constant"===a.value.kind||"source"===a.value.kind?new cO("source",c):new cP("composite",c,a.value.zoomStops,a.value._interpolationType),this.paint._values[b]=new hM(a.property,d,a.parameters)}}_handleOverridablePaintPropertyUpdate(a,b,c){return!(!this.layout||b.isDataDriven()||c.isDataDriven())&&eg.hasPaintOverride(this.layout,a)}static hasPaintOverride(c,d){const a=c.get("text-field"),h=kG.paint.properties[d];let e=!1;const f=a=>{for(const b of a)if(h.overrides&&h.overrides.hasOverride(b))return void(e=!0)};if("constant"===a.value.kind&&a.value.value instanceof fB)f(a.value.value.sections);else if("source"===a.value.kind){const g=a=>{e||(a instanceof ck&&fE(a.value)===ch?f(a.value.sections):a instanceof cl?f(a.sections):a.eachChild(g))},b=a.value;b._styleExpression&&g(b._styleExpression.expression)}return e}getProgramConfiguration(a){return new du(this,a)}}var kH={paint:new n({"background-color":new e(b.paint_background["background-color"]),"background-pattern":new a5(b.paint_background["background-pattern"]),"background-opacity":new e(b.paint_background["background-opacity"])})},kI={paint:new n({"raster-opacity":new e(b.paint_raster["raster-opacity"]),"raster-hue-rotate":new e(b.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new e(b.paint_raster["raster-brightness-min"]),"raster-brightness-max":new e(b.paint_raster["raster-brightness-max"]),"raster-saturation":new e(b.paint_raster["raster-saturation"]),"raster-contrast":new e(b.paint_raster["raster-contrast"]),"raster-resampling":new e(b.paint_raster["raster-resampling"]),"raster-fade-duration":new e(b.paint_raster["raster-fade-duration"])})};class kJ extends be{constructor(a){super(a,{}),this.implementation=a}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(a){this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)}onRemove(a){this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)}}var kK={paint:new n({"sky-type":new e(b.paint_sky["sky-type"]),"sky-atmosphere-sun":new e(b.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new e(b.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new e(b.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new e(b.paint_sky["sky-gradient-radius"]),"sky-gradient":new V(b.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new e(b.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new e(b.paint_sky["sky-atmosphere-color"]),"sky-opacity":new e(b.paint_sky["sky-opacity"])})};function kL(l,m,n){var a,b,f,h,i,j,k,c,d;const g=Q(0,0,1),e=bG(aO());return a=e,b=e,f=n?-(l*aP)+Math.PI:l*aP,f*=.5,h=b[0],i=b[1],j=b[2],k=b[3],c=Math.sin(f),d=Math.cos(f),a[0]=h*d-j*c,a[1]=i*d+k*c,a[2]=j*d+h*c,a[3]=k*d-i*c,bH(e,e,-(m*aP)),bD(g,g,e),bz(g,g)}const kM={circle:class extends be{constructor(a){super(a,iv)}createBucket(a){return new bf(a)}queryRadius(b){const a=b;return ir("circle-radius",this,a)+ir("circle-stroke-width",this,a)+is(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,e,j,d,f,g){const h=iu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,a.pixelToTileUnitsFactor),i=this.paint.get("circle-radius").evaluate(b,c)+this.paint.get("circle-stroke-width").evaluate(b,c);return iw(a,e,d,f,g,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,i)}getProgramIds(){return["circle"]}getProgramConfiguration(a){return new du(this,a)}},heatmap:class extends be{createBucket(a){return new dI(a)}constructor(a){super(a,iE),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){"heatmap-color"===a&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=dK({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(a){return ir("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,i,e,f,g){const h=this.paint.get("heatmap-radius").evaluate(b,c);return iw(a,d,e,f,g,!0,!0,new aF(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(a){return new du(this,a)}},hillshade:class extends be{constructor(a){super(a,iF)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(a){return new du(this,a)}},fill:class extends be{constructor(a){super(a,jc)}getProgramIds(){const a=this.paint.get("fill-pattern"),b=a&&a.constantOr(1),c=[b?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&c.push(b&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),c}getProgramConfiguration(a){return new du(this,a)}recalculate(b,c){super.recalculate(b,c);const a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&& void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(a){return new dN(a)}queryRadius(){return is(this.paint.get("fill-translate"))}queryIntersectsFeature(a,d,e,b,f,c){return!a.queryGeometry.isAboveHorizon&&ih(it(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),c.angle,a.pixelToTileUnitsFactor),b)}isTileClipped(){return!0}},"fill-extrusion":class extends be{constructor(a){super(a,jm)}createBucket(a){return new dU(a)}queryRadius(){return is(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(a){return new du(this,a)}queryIntersectsFeature(c,k,l,v,C,a,w,m,x){var d,e,f,g,h,i,n,o,p;const y=iu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,c.pixelToTileUnitsFactor),z=this.paint.get("fill-extrusion-height").evaluate(k,l),A=this.paint.get("fill-extrusion-base").evaluate(k,l),b=[0,0],q=m&&a.elevation,B=a.elevation?a.elevation.exaggeration():1;if(q){const r=c.tile.getBucket(this).centroidVertexArray,s=x+1;if(s=3){for(let d=0;d1&&(b=i[++j]);const n=Math.abs(a-b.left),o=Math.abs(a-b.right),e=Math.min(n,o);let g;const h=d/c*(f+1);if(b.isDash){const k=f-Math.abs(h);g=Math.sqrt(e*e+k*k)}else g=f-Math.sqrt(e*e+h*h);this.image.data[m+a]=Math.max(0,Math.min(255,g+128))}}}addRegularDash(a,k){for(let b=a.length-1;b>=0;--b){const e=a[b],f=a[b+1];e.zeroLength?a.splice(b,1):f&&f.isDash===e.isDash&&(f.left=e.left,a.splice(b,1))}const g=a[0],h=a[a.length-1];g.isDash===h.isDash&&(g.left=h.left-this.width,h.right=g.right+this.width);const l=this.width*this.nextRow;let i=0,d=a[i];for(let c=0;c1&&(d=a[++i]);const m=Math.abs(c-d.left),n=Math.abs(c-d.right),j=Math.min(m,n);this.image.data[l+c]=Math.max(0,Math.min(255,(d.isDash?j:-j)+k+128))}}addDash(a,e){const f=this.getKey(a,e);if(this.positions[f])return this.positions[f];const h="round"===e,c=h?7:0,i=2*c+1;if(this.nextRow+i>this.height)return bY("LineAtlas out of space"),null;0===a.length&&a.push(1);let d=0;for(let b=0;b0;a--)c+=(e&(b=1<this.canonical.z?new bn(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new bn(a,this.wrap,a,this.canonical.x>>b,this.canonical.y>>b)}calculateScaledKey(a,b=!0){if(this.overscaledZ===a&&b)return this.key;if(a>this.canonical.z)return kU(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return kU(this.wrap*+b,a,a,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(a){if(a.wrap!==this.wrap)return!1;const b=this.canonical.z-a.canonical.z;return 0===a.overscaledZ||a.overscaledZ>b&&a.canonical.y===this.canonical.y>>b}children(d){if(this.overscaledZ>=d)return[new bn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const a=this.canonical.z+1,b=2*this.canonical.x,c=2*this.canonical.y;return[new bn(a,this.wrap,a,b,c),new bn(a,this.wrap,a,b+1,c),new bn(a,this.wrap,a,b,c+1),new bn(a,this.wrap,a,b+1,c+1),]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.yMath.abs(i[a])){if(d[a]h[a])return null}else{const j=1/i[a];let b=(g[a]-d[a])*j,c=(h[a]-d[a])*j;if(b>c){const k=b;b=c,c=k}if(b>e&&(e=b),cf)return null}return e}function kZ(b,c,d,y,z,A,B,C,D,e,a){const f=y-b,g=z-c,h=A-d,i=B-b,j=C-c,k=D-d,q=a[1]*k-a[2]*j,r=a[2]*i-a[0]*k,s=a[0]*j-a[1]*i,t=f*q+g*r+h*s;if(1e-15>Math.abs(t))return null;const l=1/t,m=e[0]-b,n=e[1]-c,o=e[2]-d,p=(m*q+n*r+o*s)*l;if(p<0||p>1)return null;const u=n*h-o*g,v=o*f-m*h,w=m*g-n*f,x=(a[0]*u+a[1]*v+a[2]*w)*l;return x<0||p+x>1?null:(i*u+j*v+k*w)*l}function k$(d,e,j,b,c,k,l,f,g){const a=1<{const e=f?1:0,g=(c+1)*a-e,h=d*a,i=(d+1)*a-e;b[0]=c*a,b[1]=h,b[2]=g,b[3]=i};let c=new kX(b);const a=[];for(let g=0;g=1;b/=2){const d=f[f.length-1];c=new kX(b);for(let h=0;h0;){const{idx:u,t:B,nodex:g,nodey:h,depth:j}=t.pop();if(this.leaves[u]){k$(g,h,j,o,p,q,r,a,b);const k=1<=x[2])return B}continue}let l=0;for(let c=0;c=s[i[m]]&&(i.splice(m,0,c),y=!0);y||(i[l]=c),l++}}for(let z=0;z=this.dim+1||b< -1||b>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(b+1)*this.stride+(a+1)}_unpackMapbox(a,b,c){return(256*a*256+256*b+c)/10-1e4}_unpackTerrarium(a,b,c){return 256*a+b+c/256-32768}static pack(d,e){const b=[0,0,0,0],c=bo.getUnpackVector(e);let a=Math.floor((d+c[3])/c[2]);return b[2]=a%256,a=Math.floor(a/256),b[1]=a%256,a=Math.floor(a/256),b[0]=a,b}getPixels(){return new bg({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,a,b){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let e=a*this.dim,f=a*this.dim+this.dim,g=b*this.dim,h=b*this.dim+this.dim;switch(a){case -1:e=f-1;break;case 1:f=e+1}switch(b){case -1:g=h-1;break;case 1:h=g+1}const j=-a*this.dim,k=-b*this.dim;for(let c=g;c{"source"===a.dataType&&"metadata"===a.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===a.dataType&&"content"===a.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),a.on("error",()=>{this._sourceErrored=!0}),this._source=a,this._tiles={},this._cache=new class{constructor(a,b){this.max=a,this.onRemove=b,this.reset()}reset(){for(const b in this.data)for(const a of this.data[b])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(e,f,b){const a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);const c={value:f,timeout:void 0};if(void 0!==b&&(c.timeout=setTimeout(()=>{this.remove(e,c)},b)),this.data[a].push(c),this.order.push(a),this.order.length>this.max){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const b=this.data[a].shift();return b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),b.value}getByKey(b){const a=this.data[b];return a?a[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(c,d){if(!this.has(c))return this;const a=c.wrapped().key,e=void 0===d?0:this.data[a].indexOf(d),b=this.data[a][e];return this.data[a].splice(e,1),b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(b.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(b){for(this.max=b;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(d){const a=[];for(const e in this.data)for(const b of this.data[e])d(b.value)||a.push(b);for(const c of a)this.remove(c.value.tileID,c)}}(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,g,c){const b=String(g);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][b]=this.stateChanges[a][b]||{},bR(this.stateChanges[a][b],c),null===this.deletedStates[a])for(const d in this.deletedStates[a]={},this.state[a])d!==b&&(this.deletedStates[a][d]=null);else if(this.deletedStates[a]&&null===this.deletedStates[a][b])for(const e in this.deletedStates[a][b]={},this.state[a][b])c[e]||(this.deletedStates[a][b][e]=null);else for(const f in c)this.deletedStates[a]&&this.deletedStates[a][b]&&null===this.deletedStates[a][b][f]&&delete this.deletedStates[a][b][f]}removeFeatureState(a,d,c){if(null===this.deletedStates[a])return;const b=String(d);if(this.deletedStates[a]=this.deletedStates[a]||{},c&& void 0!==d)null!==this.deletedStates[a][b]&&(this.deletedStates[a][b]=this.deletedStates[a][b]||{},this.deletedStates[a][b][c]=null);else if(void 0!==d){if(this.stateChanges[a]&&this.stateChanges[a][b])for(c in this.deletedStates[a][b]={},this.stateChanges[a][b])this.deletedStates[a][b][c]=null;else this.deletedStates[a][b]=null}else this.deletedStates[a]=null}getState(a,b){const c=String(b),d=bR({},(this.state[a]||{})[c],(this.stateChanges[a]||{})[c]);if(null===this.deletedStates[a])return{};if(this.deletedStates[a]){const e=this.deletedStates[a][b];if(null===e)return{};for(const f in e)delete d[f]}return d}initializeTileState(a,b){a.setFeatureState(this.state,b)}coalesceChanges(g,j){const c={};for(const b in this.stateChanges){this.state[b]=this.state[b]||{};const h={};for(const d in this.stateChanges[b])this.state[b][d]||(this.state[b][d]={}),bR(this.state[b][d],this.stateChanges[b][d]),h[d]=this.state[b][d];c[b]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const f={};if(null===this.deletedStates[a])for(const i in this.state[a])f[i]={},this.state[a][i]={};else for(const e in this.deletedStates[a]){if(null===this.deletedStates[a][e])this.state[a][e]={};else for(const k of Object.keys(this.deletedStates[a][e]))delete this.state[a][e][k];f[e]=this.state[a][e]}c[a]=c[a]||{},bR(c[a],f)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(c).length)for(const l in g)g[l].setFeatureState(c,j)}}}onAdd(a){this.map=a,this._minTileCacheSize=a?a._minTileCacheSize:null,this._maxTileCacheSize=a?a._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const b in this._tiles){const a=this._tiles[b];if("loaded"!==a.state&&"errored"!==a.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(a,b){return a.isSymbolTile=this._onlySymbols,this._source.loadTile(a,b)}_unloadTile(a){if(this._source.unloadTile)return this._source.unloadTile(a,()=>{})}_abortTile(a){if(this._source.abortTile)return this._source.abortTile(a,()=>{})}serialize(){return this._source.serialize()}prepare(b){for(const c in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const a=this._tiles[c];a.upload(b),a.prepare(this.map.style.imageManager)}}getIds(){return bQ(this._tiles).map(a=>a.tileID).sort(k2).map(a=>a.key)}getRenderableIds(b){const a=[];for(const c in this._tiles)this._isIdRenderable(+c,b)&&a.push(this._tiles[c]);return b?a.sort((e,f)=>{const a=e.tileID,b=f.tileID,c=new aF(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),d=new aF(b.canonical.x,b.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-b.overscaledZ||d.y-c.y||d.x-c.x}).map(a=>a.tileID.key):a.map(a=>a.tileID).sort(k2).map(a=>a.key)}hasRenderableParent(b){const a=this.findLoadedParent(b,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(a,b){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(b||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const a in this._cache.reset(),this._tiles)"errored"!==this._tiles[a].state&&this._reloadTile(+a,"reloading")}_reloadTile(b,c){const a=this._tiles[b];a&&("loading"!==a.state&&(a.state=c),this._loadTile(a,this._tileLoaded.bind(this,a,b,c)))}_tileLoaded(a,d,e,b){if(b){if(a.state="errored",404!==b.status)this._source.fire(new cb(b,{tile:a}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const c=this.map.painter.terrain;this.update(this.transform,c.getScaledDemTileSize(),!0),c.resetTileLookupCache(this.id)}else this.update(this.transform)}else a.timeAdded=b$.now(),"expired"===e&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(d,a),"raster-dem"===this._source.type&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),this._source.fire(new aW("data",{dataType:"source",tile:a,coord:a.tileID,sourceCacheId:this.id}))}_backfillDEM(a){const c=this.getRenderableIds();for(let b=0;b1||(Math.abs(b)>1&&(1===Math.abs(b+d)?b+=d:1===Math.abs(b-d)&&(b-=d)),c.dem&&a.dem&&(a.dem.backfillBorder(c.dem,b,e),a.neighboringTiles&&a.neighboringTiles[f]&&(a.neighboringTiles[f].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(h,d,i,e){for(const f in this._tiles){let a=this._tiles[f];if(e[f]||!a.hasData()||a.tileID.overscaledZ<=d||a.tileID.overscaledZ>i)continue;let b=a.tileID;for(;a&&a.tileID.overscaledZ>d+1;){const g=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[g.key])&&a.hasData()&&(b=g)}let c=b;for(;c.overscaledZ>d;)if(h[(c=c.scaledTo(c.overscaledZ-1)).key]){e[b.key]=b;break}}}findLoadedParent(a,d){if(a.key in this._loadedParentTiles){const b=this._loadedParentTiles[a.key];return b&&b.tileID.overscaledZ>=d?b:null}for(let c=a.overscaledZ-1;c>=d;c--){const f=a.scaledTo(c),e=this._getLoadedTile(f);if(e)return e}}_getLoadedTile(a){const b=this._tiles[a.key];return b&&b.hasData()?b:this._cache.getByKey(this._source.reparseOverscaled?a.wrapped().key:a.canonical.key)}updateCacheSize(b,a){a=a||this._source.tileSize;const e=Math.ceil(b.width/a)+1,f=Math.ceil(b.height/a)+1,c=Math.floor(e*f*5),d="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,c):c,g="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(g)}handleWrapJump(b){const c=Math.round((b-(void 0===this._prevLng?b:this._prevLng))/360);if(this._prevLng=b,c){const d={};for(const g in this._tiles){const a=this._tiles[g];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+c),d[a.tileID.key]=a}for(const e in this._tiles=d,this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const f in this._tiles)this._setTileReloadTimer(+f,this._tiles[f])}}update(e,n,o){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!o)return;let a;this.updateCacheSize(e,n),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(a=>new bn(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(a=e.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!o,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter(a=>this._source.hasTile(a)))):a=[];const b=this._updateRetainedTiles(a);if(k3(this._source.type)&&0!==a.length){const h={},p={},s=Object.keys(b);for(const i of s){const j=b[i],k=this._tiles[i];if(!k||k.fadeEndTime&&k.fadeEndTime<=b$.now())continue;const f=this.findLoadedParent(j,Math.max(j.overscaledZ-aD.maxOverzooming,this._source.minzoom));f&&(this._addTile(f.tileID),h[f.tileID.key]=f.tileID),p[i]=j}const t=a[a.length-1].overscaledZ;for(const l in this._tiles){const m=this._tiles[l];if(b[l]||!m.hasData())continue;let c=m.tileID;for(;c.overscaledZ>t;){c=c.scaledTo(c.overscaledZ-1);const q=this._tiles[c.key];if(q&&q.hasData()&&p[c.key]){b[l]=m.tileID;break}}}for(const g in h)b[g]||(this._coveredTiles[g]=!0,b[g]=h[g])}for(const u in b)this._tiles[u].clearFadeHold();const v=function(c,d){const a=[];for(const b in c)b in d||a.push(b);return a}(this._tiles,b);for(const r of v){const d=this._tiles[r];d.hasSymbolBuckets&&!d.holdingForFade()?d.setHoldDuration(this.map._fadeDuration):d.hasSymbolBuckets&&!d.symbolFadeFinished()||this._removeTile(+r)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(+a)}_updateRetainedTiles(e){const a={};if(0===e.length)return a;const j={},k=e.reduce((a,b)=>Math.min(a,b.overscaledZ),1/0),l=e[0].overscaledZ,p=Math.max(l-aD.maxOverzooming,this._source.minzoom),q=Math.max(l+aD.maxUnderzooming,this._source.minzoom),m={};for(const f of e){const r=this._addTile(f);a[f.key]=f,r.hasData()||k=this._source.maxzoom){const h=c.children(this._source.maxzoom)[0],n=this.getTile(h);if(n&&n.hasData()){a[h.key]=h;continue}}else{const g=c.children(this._source.maxzoom);if(a[g[0].key]&&a[g[1].key]&&a[g[2].key]&&a[g[3].key])continue}let o=b.wasRequested();for(let i=c.overscaledZ-1;i>=p;--i){const d=c.scaledTo(i);if(j[d.key]||(j[d.key]=!0,(b=this.getTile(d))||!o||(b=this._addTile(d)),b&&(a[d.key]=d,o=b.wasRequested(),b.hasData())))break}}return a}_updateLoadedParentTileCache(){for(const e in this._loadedParentTiles={},this._tiles){const c=[];let b,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){b=this._loadedParentTiles[a.key];break}c.push(a.key);const d=a.scaledTo(a.overscaledZ-1);if(b=this._getLoadedTile(d))break;a=d}for(const f of c)this._loadedParentTiles[f]=b}}_addTile(b){let a=this._tiles[b.key];if(a)return a;(a=this._cache.getAndRemove(b))&&(this._setTileReloadTimer(b.key,a),a.tileID=b,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[b.key]&&(clearTimeout(this._cacheTimers[b.key]),delete this._cacheTimers[b.key],this._setTileReloadTimer(b.key,a)));const c=Boolean(a);if(!c){const d=this.map?this.map.painter:null,e="raster"===this._source.type||"raster-dem"===this._source.type;a=new eq(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,d,e),this._loadTile(a,this._tileLoaded.bind(this,a,b.key,a.state))}return a?(a.uses++,this._tiles[b.key]=a,c||this._source.fire(new aW("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a):null}_setTileReloadTimer(a,c){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const b=c.getExpiryTimeout();b&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},b))}_removeTile(b){const a=this._tiles[b];a&&(a.uses--,delete this._tiles[b],this._timers[b]&&(clearTimeout(this._timers[b]),delete this._timers[b]),a.uses>0||(a.hasData()&&"reloading"!==a.state?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}clearTiles(){for(const a in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+a);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(e,f,g){const a=[],c=this.transform;if(!c)return a;for(const h in this._tiles){const b=this._tiles[h];if(g&&b.clearQueryDebugViz(),b.holdingForFade())continue;const d=e.containsTile(b,c,f);d&&a.push(d)}return a}getVisibleCoordinates(c){const a=this.getRenderableIds(c).map(a=>this._tiles[a].tileID);for(const b of a)b.projMatrix=this.transform.calculateProjMatrix(b.toUnwrapped());return a}hasTransition(){if(this._source.hasTransition())return!0;if(k3(this._source.type))for(const b in this._tiles){const a=this._tiles[b];if(void 0!==a.fadeEndTime&&a.fadeEndTime>=b$.now())return!0}return!1}setFeatureState(a,b,c){this._state.updateState(a=a||"_geojsonTileLayer",b,c)}removeFeatureState(a,b,c){this._state.removeFeatureState(a=a||"_geojsonTileLayer",b,c)}getFeatureState(a,b){return this._state.getState(a=a||"_geojsonTileLayer",b)}setDependencies(b,c,d){const a=this._tiles[b];a&&a.setDependencies(c,d)}reloadTilesForDependencies(b,c){for(const a in this._tiles)this._tiles[a].hasDependency(b,c)&&this._reloadTile(+a,"reloading");this._cache.filter(a=>!a.hasDependency(b,c))}_preloadTiles(a,f){const b=new Map,g=Array.isArray(a)?a:[a],c=this.map.painter.terrain,h=this.usedForTerrain&&c?c.getScaledDemTileSize():this._source.tileSize;for(const d of g){const i=d.coveringTiles({tileSize:h,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of i)b.set(e.key,e);this.usedForTerrain&&d.updateElevation(!1)}const j=Array.from(b.values()),k="raster"===this._source.type||"raster-dem"===this._source.type;bP(j,(a,c)=>{const b=new eq(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,this.map.painter,k);this._loadTile(b,a=>{"raster-dem"===this._source.type&&b.dem&&this._backfillDEM(b),c(a,b)})},f)}}function k2(a,b){const c=Math.abs(2*a.wrap)- +(a.wrap<0),d=Math.abs(2*b.wrap)- +(b.wrap<0);return a.overscaledZ-b.overscaledZ||d-c||b.canonical.y-a.canonical.y||b.canonical.x-a.canonical.x}function k3(a){return"raster"===a||"image"===a||"video"===a}aD.maxOverzooming=10,aD.maxUnderzooming=3;class k4{constructor(a,b,c){this._demTile=a,this._dem=this._demTile.dem,this._scale=b,this._offset=c}static create(f,b,g){const a=g||f.findDEMTileFor(b);if(!a||!a.dem)return;const e=a.dem,c=a.tileID,d=1<=0&&a[3]>=0&&l.insert(k,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(const a in this.vtLayers=new _.VectorTile(new d2(this.rawTileData)).layers,this.sourceLayerCoder=new kV(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[a]=[];return this.vtLayers}query(c,j,k,l){this.loadVTLayers();const d=c.params||{},m=gB(d.filter),n=c.tileResult,g=c.transform,a=n.bufferedTilespaceBounds,b=this.grid.query(a.min.x,a.min.y,a.max.x,a.max.y,(a,b,c,d)=>dF(n.bufferedTilespaceGeometry,a,b,c,d));b.sort(k6);let o=null;g.elevation&&b.length>0&&(o=k4.create(g.elevation,this.tileID));const h={};let i;for(let e=0;e(q||(q=ic(a,this.tileID.canonical,c.tileTransform)),b.queryIntersectsFeature(n,a,d,q,this.z,c.transform,c.pixelPosMatrix,o,e)))}return h}loadMatchingFeature(l,t,g,e,m,u,v,n,o){const{featureIndex:p,bucketIndex:w,sourceLayerIndex:x,layoutVertexArrayOffset:y}=t,h=this.bucketLayerIDs[w];if(e&&!function(b,c){for(let a=0;a=0)return!0;return!1}(e,h))return;const q=this.sourceLayerCoder.decode(x),a=this.vtLayers[q].feature(p);if(g.needGeometry){const z=id(a,!0);if(!g.filter(new c5(this.tileID.overscaledZ),z,this.tileID.canonical))return}else if(!g.filter(new c5(this.tileID.overscaledZ),a))return;const i=this.getId(a,q);for(let j=0;je.indexOf(b))continue;const c=u[b];if(!c)continue;let f={};void 0!==i&&n&&(f=n.getState(c.sourceLayer||"_geojsonTileLayer",i));const d=bR({},v[b]);d.paint=k5(d.paint,c.paint,a,f,m),d.layout=k5(d.layout,c.layout,a,f,m);const r=!o||o(a,c,f,y);if(!r)continue;const s=new kW(a,this.z,this.x,this.y,i);s.layer=d;let k=l[b];void 0===k&&(k=l[b]=[]),k.push({featureIndex:p,feature:s,intersectionZ:r})}}lookupSymbolFeatures(b,c,d,e,f,g,h,i){const a={};this.loadVTLayers();const j=gB(f);for(const k of b)this.loadMatchingFeature(a,{bucketIndex:d,sourceLayerIndex:e,featureIndex:k,layoutVertexArrayOffset:0},j,g,h,i,c);return a}loadFeature(e){const{featureIndex:a,sourceLayerIndex:f}=e;this.loadVTLayers();const c=this.sourceLayerCoder.decode(f),b=this.vtFeatures[c];if(b[a])return b[a];const d=this.vtLayers[c].feature(a);return b[a]=d,d}hasLayer(a){for(const b of this.bucketLayerIDs)for(const c of b)if(a===c)return!0;return!1}getId(b,c){let a=b.id;return this.promoteId&&"boolean"==typeof(a=b.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[c]])&&(a=Number(a)),a}}function k5(a,b,c,d,e){return eP(a,(g,f)=>{const a=b instanceof hN?b.get(f):null;return a&&a.evaluate?a.evaluate(c,d,e):a})}function k6(a,b){return b-a}c("FeatureIndex",el,{omit:["rawTileData","sourceLayerCoder"]});var em=j([{name:"a_pos",type:"Int16",components:2},]);const aa=new Uint16Array(8184);for(let ab=0;ab<2046;ab++){let aE=ab+2,D=0,E=0,F=0,G=0,ac=0,ad=0;for(1&aE?F=G=ac=32:D=E=ad=32;(aE>>=1)>1;){const en=D+F>>1,eo=E+G>>1;1&aE?(F=D,G=E,D=ac,E=ad):(D=F,E=G,F=ac,G=ad),ac=en,ad=eo}const ae=4*ab;aa[ae+0]=D,aa[ae+1]=E,aa[ae+2]=F,aa[ae+3]=G}const k7=new Uint16Array(2178),k8=new Uint8Array(1089),k9=new Uint16Array(1089);function la(a){return 0===a?-0.03125:32===a?.03125:0}var ep=j([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const lb={type:2,extent:8192,loadGeometry:()=>[[new aF(0,0),new aF(8193,0),new aF(8193,8193),new aF(0,8193),new aF(0,0),],]};class eq{constructor(b,c,d,a,e){this.tileID=b,this.uid=bS(),this.uses=0,this.tileSize=c,this.tileZoom=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=e,this.expiredRequestCount=0,this.state="loading",a&&a.transform&&(this.projection=a.transform.projection)}registerFadeDuration(b){const a=b+this.timeAdded;ae.getLayer(a)).filter(Boolean);if(0!==c.length)for(const f of(a.layers=c,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(a=>c.filter(b=>b.id===a)[0])),c))b[f.id]=a}return b}(a.buckets,b.style),this.hasSymbolBuckets=!1,this.buckets){const c=this.buckets[g];if(c instanceof aB){if(this.hasSymbolBuckets=!0,!f)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const h in this.buckets){const d=this.buckets[h];if(d instanceof aB&&d.hasRTLText){this.hasRTLText=!0,c4.isLoading()||c4.isLoaded()||"deferred"!==c3()||hH();break}}for(const e in this.queryPadding=0,this.buckets){const i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,b.style.getLayer(e).queryRadius(i))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage),a.lineAtlas&&(this.lineAtlas=a.lineAtlas)}else this.collisionBoxArray=new c8}unloadVectorData(){if(this.hasData()){for(const a in this.buckets)this.buckets[a].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(a){return this.buckets[a.id]}upload(a){for(const d in this.buckets){const c=this.buckets[d];c.uploadPending()&&c.upload(a)}const b=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new eh(a,this.imageAtlas.image,b.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new eh(a,this.glyphAtlasImage,b.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new eh(a,this.lineAtlas.image,b.ALPHA),this.lineAtlas.uploaded=!0)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,b,c,d,e,f,g,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:g,transform:f,params:e,tileTransform:this.tileTransform},a,b,c):{}}querySourceFeatures(m,a){const b=this.latestFeatureIndex;if(!b||!b.rawTileData)return;const g=b.loadVTLayers(),h=a?a.sourceLayer:"",d=g._geojsonTileLayer||g[h];if(!d)return;const e=gB(a&&a.filter),{z:i,x:j,y:k}=this.tileID.canonical,n={z:i,x:j,y:k};for(let f=0;fe)a=!1;else if(c){if(this.expirationTime=0;f--){const g=4*f,h=aa[g+0],i=aa[g+1],j=aa[g+2],k=aa[g+3],l=h+j>>1,m=i+k>>1,r=l+m-i,s=m+h-l,t=33*i+h,u=33*k+j,a=33*m+l,y=Math.hypot((k7[2*t+0]+k7[2*u+0])/2-k7[2*a+0],(k7[2*t+1]+k7[2*u+1])/2-k7[2*a+1])>=16;if(k8[a]=k8[a]||(y?1:0),f<1022){const z=(i+s>>1)*33+(h+r>>1),A=(k+s>>1)*33+(j+r>>1);k8[a]=k8[a]||k8[z]||k8[A]}}const B=new am,C=new aq;let D=0;function E(b,c){const a=33*c+b;return 0===k9[a]&&(B.emplaceBack(k7[2*a+0],k7[2*a+1],8192*b/32,8192*c/32),k9[a]=++D),k9[a]-1}function v(a,b,e,f,c,d){const g=a+e>>1,h=b+f>>1;if(Math.abs(a-c)+Math.abs(b-d)>1&&k8[33*h+g])v(c,d,a,b,g,h),v(e,f,c,d,g,h);else{const i=E(a,b),j=E(e,f),k=E(c,d);C.emplaceBack(i,j,k)}}return v(0,0,32,32,32,0),v(32,32,0,0,0,32),{vertices:B,indices:C}}(this.tileID.canonical,e);a=g.vertices,b=g.indices}else{for(const{x:i,y:j}of(a=new am,b=new aq,h))a.emplaceBack(i,j,0,0);const d=dM(a.int16,void 0,4);for(let c=0;c{const a=65*d+b;c.emplaceBack(a+1,a,a+65),c.emplaceBack(a+65,a+65+1,a+1)};for(let a=0;a<64;a++)for(let b=0;b<64;b++)d(b,a);return c}getWirefameBuffer(b){if(!this.wireframeSegments){const a=this._createWireframeGrid();this.wireframeIndexBuffer=b.createIndexBuffer(a),this.wireframeSegments=ay.simpleSegment(0,0,4096,a.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const c=new Y,d=(b,d)=>{const a=65*d+b;c.emplaceBack(a,a+1),c.emplaceBack(a,a+65),c.emplaceBack(a,a+65+1)};for(let a=0;a<64;a++)for(let b=0;b<64;b++)d(b,a);return c}}function ew(a,b){if(!b.isReprojectedInTileSpace)return{scale:1<m&&(n(i,a,e,f,c,d),n(a,j,c,d,g,h))}n(c,d,h,j,i,j),n(d,e,i,j,i,k),n(e,f,i,k,h,k),n(f,c,h,k,h,j),o-=m,p-=m,q+=m,r+=m;const l=1/Math.max(q-o,r-p);return{scale:l,x:o*l,y:p*l,x2:q*l,y2:r*l,projection:b}}class ex{constructor(c){const d={},e=[];for(const f in c){const g=c[f],q=d[f]={};for(const h in g.glyphs){const a=g.glyphs[+h];if(!a||0===a.bitmap.width||0===a.bitmap.height)continue;const i=a.metrics.localGlyph?2:1,j={x:0,y:0,w:a.bitmap.width+2*i,h:a.bitmap.height+2*i};e.push(j),q[h]=j}}const{w:r,h:s}=d3(e),k=new dJ({width:r||1,height:s||1});for(const l in c){const m=c[l];for(const n in m.glyphs){const b=m.glyphs[+n];if(!b||0===b.bitmap.width||0===b.bitmap.height)continue;const o=d[l][n],p=b.metrics.localGlyph?2:1;dJ.copy(b.bitmap,k,{x:0,y:0},{x:o.x+p,y:o.y+p},b.bitmap)}}this.image=k,this.positions=d}}c("GlyphAtlas",ex);class lk{constructor(a){this.tileID=new bn(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),this.tileZoom=a.tileZoom,this.uid=a.uid,this.zoom=a.zoom,this.canonical=a.tileID.canonical,this.pixelRatio=a.pixelRatio,this.tileSize=a.tileSize,this.source=a.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=a.showCollisionBoxes,this.collectResourceTiming=!!a.collectResourceTiming,this.returnDependencies=!!a.returnDependencies,this.promoteId=a.promoteId,this.enableTerrain=!!a.enableTerrain,this.isSymbolTile=a.isSymbolTile,this.tileTransform=ew(a.tileID.canonical,a.projection),this.projection=a.projection}parse(h,v,i,j,E){this.status="parsing",this.data=h,this.collisionBoxArray=new c8;const w=new kV(Object.keys(h.layers).sort()),c=new el(this.tileID,this.promoteId);c.bucketLayerIDs=[];const x={},m=new bl(256,256),d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:m,availableImages:i},k=v.familiesBySource[this.source];for(const b in k){const e=h.layers[b];if(!e)continue;let n=!1,o=!1;for(const y of k[b])"symbol"===y[0].type?n=!0:o=!0;if(!0===this.isSymbolTile&&!n|| !1===this.isSymbolTile&&!o)continue;1===e.version&&bY(`Vector tile source "${this.source}" layer "${b}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const p=w.encode(b),q=[];for(let f=0;f=a.maxzoom||"none"!==a.visibility&&(ll(g,this.zoom,i),(x[a.id]=a.createBucket({index:c.bucketLayerIDs.length,layers:g,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:p,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:i})).populate(q,d,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(g.map(a=>a.id)))}}let F,A,B,C;m.trim();const l={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},s=eP(d.glyphDependencies,a=>Object.keys(a).map(Number));Object.keys(s).length?j.send("getGlyphs",{uid:this.uid,stacks:s},(a,b)=>{F||(F=a,A=b,D.call(this))},void 0,!1,l):A={};const t=Object.keys(d.iconDependencies);t.length?j.send("getImages",{icons:t,source:this.source,tileID:this.tileID,type:"icons"},(a,b)=>{F||(F=a,B=b,D.call(this))},void 0,!1,l):B={};const u=Object.keys(d.patternDependencies);function D(){if(F)return E(F);if(A&&B&&C){const b=new ex(A),e=new d4(B,C);for(const f in x){const a=x[f];a instanceof aB?(ll(a.layers,this.zoom,i),ku(a,A,b.positions,B,e.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection),a.projection=this.projection.name):a.hasPattern&&(a instanceof dX||a instanceof dN||a instanceof dU)&&(ll(a.layers,this.zoom,i),a.addFeatures(d,this.tileID.canonical,e.patternPositions,i))}this.status="done",E(null,{buckets:bQ(x).filter(a=>!a.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,lineAtlas:m,imageAtlas:e,glyphMap:this.returnDependencies?A:null,iconMap:this.returnDependencies?B:null,glyphPositions:this.returnDependencies?b.positions:null})}}u.length?j.send("getImages",{icons:u,source:this.source,tileID:this.tileID,type:"patterns"},(a,b)=>{F||(F=a,C=b,D.call(this))},void 0,!1,l):C={},D.call(this)}}function ll(a,b,c){const d=new c5(b);for(const e of a)e.recalculate(d,c)}class ey{constructor(a){this.entries={},this.scheduler=a}request(b,d,e,c){const a=this.entries[b]=this.entries[b]||{callbacks:[]};if(a.result){const[f,g]=a.result;return this.scheduler?this.scheduler.add(()=>{c(f,g)},d):c(f,g),()=>{}}return a.callbacks.push(c),a.cancel||(a.cancel=e((c,e)=>{for(const f of(a.result=[c,e],a.callbacks))this.scheduler?this.scheduler.add(()=>{f(c,e)},d):f(c,e);setTimeout(()=>delete this.entries[b],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(a=>a!==c),a.callbacks.length||(a.cancel(),delete this.entries[b]))}}}function ez(a,c,d){const b=JSON.stringify(a.request);return a.data&&(this.deduped.entries[b]={result:[null,a.data]}),this.deduped.request(b,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},b=>{const c=fi(a.request,(c,a,e,f)=>{c?b(c):a&&b(null,{vectorTile:d?void 0:new _.VectorTile(new d2(a)),rawData:a,cacheControl:e,expires:f})});return()=>{c.cancel(),b()}},c)}const lm=aI(new Float64Array(16));class ln{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lm}createTileMatrix(e){let a,f,g;const c=e.canonical,b=aI(new Float64Array(16)),h=this._tr.projection;if(h.isReprojectedInTileSpace){const d=ew(c,h);a=1,f=d.x+e.wrap*d.scale,g=d.y,bs(b,b,[a/d.scale,a/d.scale,this._tr.pixelsPerMeter/this._worldSize,])}else a=this._worldSize/this._tr.zoomScale(c.z),f=(c.x+Math.pow(2,c.z)*e.wrap)*a,g=c.y*a;return br(b,b,[f,g,0]),bs(b,b,[a/8192,a/8192,1]),b}pointCoordinate(a,b,c){const d=this._tr.horizonLineFromTop(!1),e=new aF(a,Math.max(d,b));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(e,c))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var eA={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&eJ(this.parallels,this.constants.parallels))return;const a=Math.sin(this.parallels[0]*aP),b=(a+Math.sin(this.parallels[1]*aP))/2,c=1+a*(2*b-a),d=Math.sqrt(c)/b;this.constants={n:b,c:c,r0:d,parallels:this.parallels}},project(d,e){this.initializeConstants();const b=(d-this.center[0])*aP,{n:a,c:f,r0:g}=this.constants,c=Math.sqrt(f-2*a*Math.sin(e*aP))/a;return{x:c*Math.sin(b*a),y:c*Math.cos(b*a)-g,z:0}},unproject(c,f){this.initializeConstants();const{n:a,c:g,r0:h}=this.constants,b=h+f;let d=Math.atan2(c,Math.abs(b))*Math.sign(b);b*a<0&&(d-=Math.PI*Math.sign(c)*Math.sign(b));const e=this.center[0]*aP*a;d=bO(d,-Math.PI-e,Math.PI-e);const i=d/a*eK+this.center[0],j=Math.asin(bM((g-(c*c+b*b)*a*a)/(2*a),-1,1)),k=bM(j*eK,-85.051129,85.051129);return new dy(i,k)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lo=Math.sqrt(3)/2;var eB={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(c,d){d=d/180*Math.PI,c=c/180*Math.PI;const b=Math.asin(lo*Math.sin(d)),a=b*b,e=a*a*a;return{x:.5*(c*Math.cos(b)/(lo*(1.340264+ -0.24331799999999998*a+e*(.0062510000000000005+.034164*a)))/Math.PI+.5),y:1-.5*(b*(1.340264+ -0.081106*a+e*(893e-6+.003796*a))/Math.PI+1),z:0}},unproject(d,e){d=(2*d-.5)*Math.PI;let b=e=(2*(1-e)-1)*Math.PI,a=b*b,c=a*a*a;for(let f,g,h,i=0;i<12&&(g=b*(1.340264+ -0.081106*a+c*(893e-6+.003796*a))-e,h=1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a),f=g/h,b=bM(b-f,-Math.PI/3,Math.PI/3),a=b*b,c=a*a*a,!(1e-12>Math.abs(f)));++i);const j=lo*d*(1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a))/Math.cos(b),k=Math.asin(Math.sin(b)/lo),l=bM(180*j/Math.PI,-180,180),m=bM(180*k/Math.PI,-85.051129,85.051129);return new dy(l,m)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)},eC={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(a,b)=>({x:.5+a/360,y:.5-b/360,z:0}),unproject(a,b){const c=bM(360*(.5-b),-85.051129,85.051129);return new dy(360*(a-.5),c)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lp=Math.PI/2;function lq(a){return Math.tan((lp+a)/2)}var lr,eD={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&eJ(this.parallels,this.constants.parallels))return;const a=this.parallels[0]*aP,b=this.parallels[1]*aP,d=Math.cos(a),c=a===b?Math.sin(a):Math.log(d/Math.cos(b))/Math.log(lq(b)/lq(a)),e=d*Math.pow(lq(a),c)/c;this.constants={n:c,f:e,parallels:this.parallels}},project(b,a){this.initializeConstants(),a*=aP,b=(b-this.center[0])*aP;const{n:c,f:d}=this.constants;d>0?a< -lp+1e-6&&(a=-lp+1e-6):a>lp-1e-6&&(a=lp-1e-6);const e=d/Math.pow(lq(a),c),f=e*Math.sin(c*b),g=d-e*Math.cos(c*b);return{x:.5*(f/Math.PI+.5),y:1-.5*(g/Math.PI+.5),z:0}},unproject(a,d){this.initializeConstants(),a=(2*a-.5)*Math.PI,d=(2*(1-d)-.5)*Math.PI;const{n:c,f:e}=this.constants,b=e-d,f=Math.sign(b),h=Math.sign(c)*Math.sqrt(a*a+b*b);let g=Math.atan2(a,Math.abs(b))*f;b*c<0&&(g-=Math.PI*Math.sign(a)*f);const i=bM(g/c*eK+this.center[0],-180,180),j=bM((2*Math.atan(Math.pow(e/h,1/c))-lp)*eK,-85.051129,85.051129);return new dy(i,j)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)},eE={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(a,b)=>({x:dz(a),y:dA(b),z:0}),unproject(a,b){const c=h7(a),d=dC(b);return new dy(c,d)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const ls=85.051129*aP;var eF={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(d,c){const a=(c*=aP)*c,b=a*a;return{x:.5*((d*=aP)*(.8707-.131979*a+b*(b*(.003971*a-.001529*b)-.013791))/Math.PI+.5),y:1-.5*(c*(1.007226+a*(.015085+b*(.028874*a-.044475-.005916*b)))/Math.PI+1),z:0}},unproject(d,e){d=(2*d-.5)*Math.PI;let b=e=(2*(1-e)-1)*Math.PI,g=25,f=0,a=b*b;do{a=b*b;const c=a*a;f=(b*(1.007226+a*(.015085+c*(.028874*a-.044475-.005916*c)))-e)/(1.007226+a*(.045255+c*(.259866*a-.311325-.06507600000000001*c))),b=bM(b-f,-ls,ls)}while(Math.abs(f)>1e-6&& --g>0)a=b*b;const h=bM(d/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*eK,-180,180),i=b*eK;return new dy(h,i)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)};const lt=85.051129*aP,lu={albers:eA,equalEarth:eB,equirectangular:eC,lambertConformalConic:eD,mercator:eE,naturalEarth:eF,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b*=aP,a*=aP;const c=Math.cos(b),d=Math.acos(c*Math.cos(a/2)),e=Math.sin(d)/d,f=.5*(a*(2/Math.PI)+2*c*Math.sin(a/2)/e)||0,g=.5*(b+Math.sin(b)/e)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(g/Math.PI+1),z:0}},unproject(j,k){let b=j=(2*j-.5)*Math.PI,c=k=(2*(1-k)-1)*Math.PI,z=25,l=0,m=0;do{const a=Math.cos(c),d=Math.sin(c),o=2*d*a,p=d*d,n=a*a,e=Math.cos(b/2),f=Math.sin(b/2),q=2*e*f,r=f*f,h=1-n*e*e,i=h?1/h:0,g=h?Math.acos(a*e)*Math.sqrt(1/h):0,s=.5*(2*g*a*f+2*b/Math.PI)-j,t=.5*(g*d+c)-k,u=.5*i*(n*r+g*a*e*p)+1/Math.PI,v=i*(q*o/4-g*d*f),w=.125*i*(o*f-g*d*n*q),x=.5*i*(p*e+g*r*a)+.5,y=v*w-x*u;l=(t*v-s*x)/y,m=(s*w-t*u)/y,b=bM(b-l,-Math.PI,Math.PI),c=bM(c-m,-lt,lt)}while((Math.abs(l)>1e-6||Math.abs(m)>1e-6)&& --z>0)return new dy(b*eK,c*eK)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>dB(1,a)*b,farthestPixelDistance(a){return le(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new ln(a,b)}};a.ARRAY_TYPE=I,a.AUTH_ERR_MSG=b1,a.Aabb=B,a.Actor=class{constructor(a,b,c){this.target=a,this.parent=b,this.mapId=c,this.callbacks={},this.cancelCallbacks={},bU(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=bZ()?a:s,this.scheduler=new class{constructor(){this.tasks={},this.taskQueue=[],bU(["process"],this),this.invoker=new class{constructor(a){this._callback=a,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}(this.process),this.nextId=0}add(b,c){const a=this.nextId++,d=function({type:b,isSymbolTile:c,zoom:a}){return a=a||0,"message"===b?0:"maybePrepare"!==b||c?"parseTile"!==b||c?"parseTile"===b&&c?300-a:"maybePrepare"===b&&c?400-a:500:200-a:100-a}(c);return 0===d?(bZ(),b(),{cancel(){}}):(this.tasks[a]={fn:b,metadata:c,priority:d,id:a},this.taskQueue.push(a),this.invoker.trigger(),{cancel:()=>{delete this.tasks[a]}})}process(){bZ();{if(this.taskQueue=this.taskQueue.filter(a=>!!this.tasks[a]),!this.taskQueue.length)return;const a=this.pick();if(null===a)return;const b=this.tasks[a];if(delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),!b)return;b.fn()}}pick(){let a=null,c=1/0;for(let b=0;b{a&&delete this.callbacks[b],this.target.postMessage({id:b,type:"",targetMapId:f,sourceMapId:this.mapId})}}}receive(e){const a=e.data,b=a.id;if(b&&(!a.targetMapId||this.mapId===a.targetMapId)){if(""===a.type){const c=this.cancelCallbacks[b];delete this.cancelCallbacks[b],c&&c.cancel()}else if(a.mustQueue||bZ()){const d=this.callbacks[b];this.cancelCallbacks[b]=this.scheduler.add(()=>this.processTask(b,a),d&&d.metadata||{type:"message"})}else this.processTask(b,a)}}processTask(e,a){if(""===a.type){const b=this.callbacks[e];delete this.callbacks[e],b&&(a.error?b(g0(a.error)):b(null,g0(a.data)))}else{const g=eX(this.globalScope)?void 0:[],c=a.hasCallback?(a,b)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:a?g_(a):null,data:g_(b,g)},g)}:a=>{},d=g0(a.data);if(this.parent[a.type])this.parent[a.type](a.sourceMapId,d,c);else if(this.parent.getWorkerSource){const f=a.type.split(".");this.parent.getWorkerSource(a.sourceMapId,f[0],d.source)[f[1]](d,c)}else c(Error(`Could not find function ${a.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.CanonicalTileID=bm,a.Color=m,a.ColorMode=r,a.CullFaceMode=o,a.DEMData=bo,a.DataConstantProperty=e,a.DedupedRequest=ey,a.DepthMode=C,a.EXTENT=8192,a.Elevation=class{getAtPointOrZero(a,b=0){return this.getAtPoint(a,b)||0}getAtPoint(a,f,o=!0){null==f&&(f=null);const i=this._source();if(!i||a.y<0||a.y>1)return f;const g=i.getSource().maxzoom,j=1<{const e=this.getAtTileOffset(a,c.x,c.y),d=b.upVector(a.canonical,c.x,c.y);return bx(d,d,e*b.upVectorScale(a.canonical)),d}}getForTilePoints(a,b,e,c){const d=k4.create(this,a,c);return!!d&&(b.forEach(a=>{a[2]=this.exaggeration()*d.getElevationAt(a[0],a[1],e)}),!0)}getMinMaxForTile(a){const c=this.findDEMTileFor(a);if(!c||!c.dem)return null;const d=c.dem.tree,e=c.tileID,h=1<Math.abs(e))return!1;const d=((b[0]-this.pos[0])*a[0]+(b[1]-this.pos[1])*a[1]+(b[2]-this.pos[2])*a[2])/e;return c[0]=this.pos[0]+this.dir[0]*d,c[1]=this.pos[1]+this.dir[1]*d,c[2]=this.pos[2]+this.dir[2]*d,!0}closestPointOnSphere(i,b,a){var j,k,n,o,p,q,r,s;if(j=this.pos,k=i,n=j[0],o=j[1],p=j[2],q=k[0],r=k[1],s=k[2],Math.abs(n-q)<=1e-6*Math.max(1,Math.abs(n),Math.abs(q))&&Math.abs(o-r)<=1e-6*Math.max(1,Math.abs(o),Math.abs(r))&&Math.abs(p-s)<=1e-6*Math.max(1,Math.abs(p),Math.abs(s))||0===b)return a[0]=a[1]=a[2]=0,!1;const[f,g,h]=this.dir,c=this.pos[0]-i[0],d=this.pos[1]-i[1],e=this.pos[2]-i[2],w=f*f+g*g+h*h,l=2*(c*f+d*g+e*h),x=l*l-4*w*(c*c+d*d+e*e-b*b);if(x<0){const t=Math.max(-l/2,0),y=c+f*t,z=d+g*t,A=e+h*t,u=Math.hypot(y,z,A);return a[0]=y*b/u,a[1]=z*b/u,a[2]=A*b/u,!1}{const m=(-l-Math.sqrt(x))/(2*w);if(m<0){const v=Math.hypot(c,d,e);return a[0]=c*b/v,a[1]=d*b/v,a[2]=e*b/v,!1}return a[0]=c+f*m,a[1]=d+g*m,a[2]=e+h*m,!0}}},a.RequestManager=class{constructor(a,b,c){this._transformRequestFn=a,this._customAccessToken=b,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const a=function(){let a="";for(let b=0;b<10;b++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",a].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(a,b){return this._transformRequestFn&&this._transformRequestFn(a,b)||{url:a}}normalizeStyleURL(a,c){if(!b2(a))return a;const b=e4(a);return b.path=`/styles/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||c)}normalizeGlyphsURL(a,c){if(!b2(a))return a;const b=e4(a);return b.path=`/fonts/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||c)}normalizeSourceURL(b,c){if(!b2(b))return b;const a=e4(b);return a.path=`/v4/${a.authority}.json`,a.params.push("secure"),this._makeAPIURL(a,this._customAccessToken||c)}normalizeSpriteURL(b,c,d,e){const a=e4(b);return b2(b)?(a.path=`/styles/v1${a.path}/sprite${c}${d}`,this._makeAPIURL(a,this._customAccessToken||e)):(a.path+=`${c}${d}`,e5(a))}normalizeTileURL(b,e,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),b&&!b2(b))return b;const a=e4(b);a.path=a.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||c&&"raster"!==a.authority&&512===c?"@2x":""}${b0.supported?".webp":"$1"}`),"raster"===a.authority?a.path=`/${b_.RASTER_URL_PREFIX}${a.path}`:(a.path=a.path.replace(/^.+\/v4\//,"/"),a.path=`/${b_.TILE_URL_VERSION}${a.path}`);const d=this._customAccessToken||function(b){for(const c of b){const a=c.match(/^access_token=(.*)$/);if(a)return a[1]}return null}(a.params)||b_.ACCESS_TOKEN;return b_.REQUIRE_ACCESS_TOKEN&&d&&this._skuToken&&a.params.push(`sku=${this._skuToken}`),this._makeAPIURL(a,d)}canonicalizeTileURL(d,e){const a=e4(d);if(!a.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!a.path.match(/\.[\w]+$/))return d;let b="mapbox://";a.path.match(/^\/raster\/v1\//)?b+=`raster/${a.path.replace(`/${b_.RASTER_URL_PREFIX}/`,"")}`:b+=`tiles/${a.path.replace(`/${b_.TILE_URL_VERSION}/`,"")}`;let c=a.params;return e&&(c=c.filter(a=>!a.match(/^access_token=/))),c.length&&(b+=`?${c.join("&")}`),b}canonicalizeTileset(d,c){const e=!!c&&b2(c),a=[];for(const b of d.tiles||[])e2(b)?a.push(this.canonicalizeTileURL(b,e)):a.push(b);return a}_makeAPIURL(a,b){const d="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",c=e4(b_.API_URL);if(a.protocol=c.protocol,a.authority=c.authority,"http"===a.protocol){const e=a.params.indexOf("secure");e>=0&&a.params.splice(e,1)}if("/"!==c.path&&(a.path=`${c.path}${a.path}`),!b_.REQUIRE_ACCESS_TOKEN)return e5(a);if(b=b||b_.ACCESS_TOKEN,!this._silenceAuthErrors){if(!b)throw Error(`An API access token is required to use Mapbox GL. ${d}`);if("s"===b[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${d}`)}return a.params=a.params.filter(a=>-1===a.indexOf("access_token")),a.params.push(`access_token=${b||""}`),e5(a)}},a.ResourceType=aV,a.SegmentVector=ay,a.SourceCache=aD,a.StencilMode=aC,a.StructArrayLayout1ui2=av,a.StructArrayLayout2f1f2i16=ap,a.StructArrayLayout2i4=al,a.StructArrayLayout2ui4=Y,a.StructArrayLayout3f12=an,a.StructArrayLayout3ui6=aq,a.StructArrayLayout4i8=am,a.Texture=eh,a.Tile=eq,a.Transitionable=c6,a.Uniform1f=dl,a.Uniform1i=class extends ax{constructor(a,b){super(a,b),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},a.Uniform2f=class extends ax{constructor(a,b){super(a,b),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},a.Uniform3f=class extends ax{constructor(a,b){super(a,b),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},a.Uniform4f=dm,a.UniformColor=dn,a.UniformMatrix2f=class extends ax{constructor(a,b){super(a,b),this.current=hY}set(b){for(let a=0;a<4;a++)if(b[a]!==this.current[a]){this.current=b,this.gl.uniformMatrix2fv(this.location,!1,b);break}}},a.UniformMatrix3f=class extends ax{constructor(a,b){super(a,b),this.current=hX}set(b){for(let a=0;a<9;a++)if(b[a]!==this.current[a]){this.current=b,this.gl.uniformMatrix3fv(this.location,!1,b);break}}},a.UniformMatrix4f=class extends ax{constructor(a,b){super(a,b),this.current=hW}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let b=1;b<16;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},a.UnwrappedTileID=ej,a.ValidationError=cc,a.VectorTileWorkerSource=class extends S{constructor(a,b,c,d,e){super(),this.actor=a,this.layerIndex=b,this.availableImages=c,this.loadVectorData=e||ez,this.loading={},this.loaded={},this.deduped=new ey(a.scheduler),this.isSpriteLoaded=d,this.scheduler=a.scheduler}loadTile(a,e){const c=a.uid,b=a&&a.request,f=b&&b.collectResourceTiming,d=this.loading[c]=new lk(a);d.abort=this.loadVectorData(a,(h,g)=>{const i=!this.loading[c];if(delete this.loading[c],i||h||!g)return d.status="done",i||(this.loaded[c]=d),e(h);const k=g.rawData,j={};g.expires&&(j.expires=g.expires),g.cacheControl&&(j.cacheControl=g.cacheControl),d.vectorTile=g.vectorTile||new _.VectorTile(new d2(k));const l=()=>{d.parse(d.vectorTile,this.layerIndex,this.availableImages,this.actor,(a,c)=>{if(a||!c)return e(a);const d={};if(f){const g=ei(b);g.length>0&&(d.resourceTiming=JSON.parse(JSON.stringify(g)))}e(null,bR({rawTileData:k.slice(0)},c,j,d))})};this.isSpriteLoaded?l():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(l,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom}):l()}),this.loaded=this.loaded||{},this.loaded[c]=d})}reloadTile(b,f){const c=this.loaded,e=b.uid,g=this;if(c&&c[e]){const a=c[e];a.showCollisionBoxes=b.showCollisionBoxes,a.enableTerrain=!!b.enableTerrain,a.projection=b.projection;const d=(c,d)=>{const b=a.reloadCallback;b&&(delete a.reloadCallback,a.parse(a.vectorTile,g.layerIndex,this.availableImages,g.actor,b)),f(c,d)};"parsing"===a.status?a.reloadCallback=d:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,d):d())}}abortTile(c,d){const b=c.uid,a=this.loading[b];a&&(a.abort&&a.abort(),delete this.loading[b]),d()}removeTile(c,d){const a=this.loaded,b=c.uid;a&&a[b]&&delete a[b],d()}},a.WritingMode=d5,a.ZoomHistory=c0,a.add=bw,a.addDynamicAttributes=bk,a.adjoint=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8];return a[0]=g*k-h*j,a[1]=e*j-d*k,a[2]=d*h-e*g,a[3]=h*i-f*k,a[4]=c*k-e*i,a[5]=e*f-c*h,a[6]=f*j-g*i,a[7]=d*i-c*j,a[8]=c*g-d*f,a},a.asyncAll=bP,a.bezier=aQ,a.bindAll=bU,a.boundsAttributes=ep,a.bufferConvexPolygon=function(a,g){const e=[];for(let b=0;bfd&&(a.getActor().send("enforceCacheSizeLimit",fc),fg=0)},a.calculateGlobeMatrix=eu,a.calculateGlobeMercatorMatrix=function(a){const c=a.worldSize,f=bM(a.center.lat,-85.051129,85.051129),d=new aF(dz(a.center.lng)*c,dA(f)*c),g=dB(1,a.center.lat)*c,h=a.pixelsPerMeter,e=c/(g/a.pixelsPerMeter),b=aI(new Float64Array(16));return br(b,b,[d.x,d.y,0]),bs(b,b,[e,e,h]),b},a.clamp=bM,a.clearTileCache=function(a){const b=s.caches.delete(e9);a&&b.catch(a).then(()=>a())},a.clipLine=d8,a.clone=function(b){var a=new I(16);return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},a.clone$1=bX,a.collisionCircleLayout=d_,a.config=b_,a.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a},a.create=function(){var a=new I(16);return I!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},a.create$1=aH,a.createExpression=cN,a.createLayout=j,a.createStyleLayer=function(a){return"custom"===a.type?new kJ(a):new kM[a.type](a)},a.cross=bB,a.degToRad=bI,a.div=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a},a.dot=bA,a.ease=bL,a.easeCubicInOut=bK,a.emitValidationErrors=c_,a.endsWith=bV,a.enforceCacheSizeLimit=function(a){fe(),fa&&fa.then(b=>{b.keys().then(d=>{for(let c=0;cb&&(e+=(c[a]-b)*(c[a]-b)),d[a]Math.abs(a.parallels[0]+a.parallels[1])){let c=function(b){const a=Math.max(.01,Math.cos(b*aP)),c=1/(2*Math.max(Math.PI*a,1/a));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(b,d){const e=b*aP*a,f=Math.sin(d*aP)/a;return{x:e*c+.5,y:-f*c+.5,z:0}},unproject(b,d){const e=-(d-.5)/c,f=bM((b-.5)/c*eK/a,-180,180),g=Math.asin(bM(e*a,-1,1)),h=bM(g*eK,-85.051129,85.051129);return new dy(f,h)}}}(a.parallels[0]);if("lambertConformalConic"===a.name){const{project:d,unproject:e}=lu.mercator;c={wrap:!0,supportsWorldCopies:!0,project:d,unproject:e}}return bR({},b,a,c)}return bR({},b,a)}(a,b):a},a.getRTLTextPluginStatus=c3,a.getReferrer=b6,a.getTilePoint=function(a,{x:b,y:c},d=0){return new aF(((b-d)*a.scale-a.x)*8192,(c*a.scale-a.y)*8192)},a.getTileVec3=function(a,b,c=0){return Q(((b.x-c)*a.scale-a.x)*8192,(b.y*a.scale-a.y)*8192,h8(b.z,b.y))},a.getVideo=function(c,e){const a=s.document.createElement("video");a.muted=!0,a.onloadstart=function(){e(null,a)};for(let b=0;b0&&(a=1/Math.sqrt(a)),b[0]=d*a,b[1]=e*a,b[2]=f*a,b[3]=g*a,b},a.number=aY,a.ortho=function(a,b,c,d,e,f,g){var h=1/(b-c),i=1/(d-e),j=1/(f-g);return a[0]=-2*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*i,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*j,a[11]=0,a[12]=(b+c)*h,a[13]=(e+d)*i,a[14]=(g+f)*j,a[15]=1,a},a.pbf=d2,a.perspective=function(a,f,g,c,b){var d,e=1/Math.tan(f/2);return a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(a[10]=(b+c)*(d=1/(c-b)),a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a},a.pick=function(c,d){const e={};for(let a=0;athis._layers[a.id]),e=g[0];if("none"===e.visibility)continue;const h=e.source||"";let c=this.familiesBySource[h];c||(c=this.familiesBySource[h]={});const i=e.sourceLayer||"_geojsonTileLayer";let f=c[i];f||(f=c[i]=[]),f.push(g)}}}const{ImageBitmap:n}=a.window;class o{loadTile(d,e){const{uid:f,encoding:g,rawImageData:b,padding:c,buildQuadTree:h}=d,i=n&&b instanceof n?this.getImageData(b,c):b;e(null,new a.DEMData(f,i,g,c<1,h))}getImageData(b,c){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const d=this.offscreenCanvasContext.getImageData(-c,-c,b.width+2*c,b.height+2*c);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:d.width,height:d.height},d.data)}}var f,p=function e(b,c){var a,d=b&&b.type;if("FeatureCollection"===d)for(a=0;a=Math.abs(d)?b-f+d:d-f+b,b=f}b+g>=0!= !!i&&a.reverse()}const s=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class t{constructor(b){this._feature=b,this.extent=a.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(1===this._feature.type){const b=[];for(const c of this._feature.geometry)b.push([new a.pointGeometry(c[0],c[1]),]);return b}{const d=[];for(const g of this._feature.geometry){const e=[];for(const f of g)e.push(new a.pointGeometry(f[0],f[1]));d.push(e)}return d}}toGeoJSON(a,b,c){return s.call(this,a,b,c)}}class u{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(a){return new t(this._features[a])}}var g=a.vectorTile.VectorTileFeature,h=i;function i(a,b){this.options=b||{},this.features=a,this.length=a.length}function b(a,b){this.id="number"==typeof a.id?a.id:void 0,this.type=a.type,this.rawGeometry=1===a.type?[a.geometry]:a.geometry,this.properties=a.tags,this.extent=b||4096}i.prototype.feature=function(a){return new b(this.features[a],this.options.extent)},b.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var c=0;c>31}function A(f,a){for(var g=f.loadGeometry(),d=f.type,h=0,i=0,n=g.length,e=0;e>1;D(c,d,g,a,b,f%2),C(c,d,e,a,g-1,f+1),C(c,d,e,g+1,b,f+1)}function D(g,a,e,b,d,h){for(;d>b;){if(d-b>600){const f=d-b+1,l=e-b+1,m=Math.log(f),j=.5*Math.exp(2*m/3),n=.5*Math.sqrt(m*j*(f-j)/f)*(l-f/2<0?-1:1);D(g,a,e,Math.max(b,Math.floor(e-l*j/f+n)),Math.min(d,Math.floor(e+(f-l)*j/f+n)),h)}const k=a[2*e+h];let i=b,c=d;for(E(g,a,b,e),a[2*d+h]>k&&E(g,a,b,d);ik;)c--}a[2*b+h]===k?E(g,a,b,c):E(g,a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function E(d,c,a,b){F(d,a,b),F(c,2*a,2*b),F(c,2*a+1,2*b+1)}function F(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function G(c,d,e,f){const a=c-e,b=d-f;return a*a+b*b}c.fromVectorTileJs=j,c.fromGeojsonVt=function(d,b){b=b||{};var c={};for(var a in d)c[a]=new h(d[a].features,b),c[a].name=a,c[a].version=b.version,c[a].extent=b.extent;return j({layers:c})},c.GeoJSONWrapper=h;class H{constructor(b,f=a=>a[0],g=a=>a[1],e=64,h=Float64Array){this.nodeSize=e,this.points=b;const i=b.length<65536?Uint16Array:Uint32Array,c=this.ids=new i(b.length),d=this.coords=new h(2*b.length);for(let a=0;a=j&&b<=l&&c>=k&&c<=m&&n.push(i[d]);continue}const e=Math.floor((h+g)/2);b=f[2*e],c=f[2*e+1],b>=j&&b<=l&&c>=k&&c<=m&&n.push(i[e]);const p=(o+1)%2;(0===o?j<=b:k<=c)&&(a.push(h),a.push(e-1),a.push(p)),(0===o?l>=b:m>=c)&&(a.push(e+1),a.push(g),a.push(p))}return n}(this.ids,this.coords,a,b,c,d,this.nodeSize)}within(a,b,c){return function(j,e,f,g,b,q){const a=[0,j.length-1,0],k=[],o=b*b;for(;a.length;){const l=a.pop(),h=a.pop(),i=a.pop();if(h-i<=q){for(let c=i;c<=h;c++)G(e[2*c],e[2*c+1],f,g)<=o&&k.push(j[c]);continue}const d=Math.floor((i+h)/2),m=e[2*d],n=e[2*d+1];G(m,n,f,g)<=o&&k.push(j[d]);const p=(l+1)%2;(0===l?f-b<=m:g-b<=n)&&(a.push(i),a.push(d-1),a.push(p)),(0===l?f+b>=m:g+b>=n)&&(a.push(d+1),a.push(h),a.push(p))}return k}(this.ids,this.coords,a,b,c,this.nodeSize)}}const I=Math.fround||(f=new Float32Array(1),a=>(f[0]=+a,f[0]));class J{constructor(a){this.options=R(Object.create({minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a}),a),this.trees=Array(this.options.maxZoom+1)}load(b){const{log:c,minZoom:i,maxZoom:f,nodeSize:g}=this.options;c&&console.time("total time");const h=`prepare ${b.length} points`;c&&console.time(h),this.points=b;let a=[];for(let d=0;d=i;e--){const j=+Date.now();a=this._cluster(a,e),this.trees[e]=new H(a,S,T,g,Float32Array),c&&console.log("z%d: %d clusters in %dms",e,a.length,+Date.now()-j)}return c&&console.timeEnd("total time"),this}getClusters(a,d){let b=((a[0]+180)%360+360)%360-180;const e=Math.max(-90,Math.min(90,a[1]));let c=180===a[2]?180:((a[2]+180)%360+360)%360-180;const f=Math.max(-90,Math.min(90,a[3]));if(a[2]-a[0]>=360)b=-180,c=180;else if(b>c){const j=this.getClusters([b,e,180,f],d),k=this.getClusters([-180,e,c,f],d);return j.concat(k)}const h=this.trees[this._limitZoom(d)],l=h.range(O(b),P(f),O(c),P(e)),i=[];for(const m of l){const g=h.points[m];i.push(g.numPoints?M(g):this.points[g.index])}return i}getChildren(c){const h=this._getOriginId(c),g=this._getOriginZoom(c),d="No cluster with the specified id.",a=this.trees[g];if(!a)throw Error(d);const e=a.points[h];if(!e)throw Error(d);const i=this.options.radius/(this.options.extent*Math.pow(2,g-1)),j=a.within(e.x,e.y,i),f=[];for(const k of j){const b=a.points[k];b.parentId===c&&f.push(b.numPoints?M(b):this.points[b.index])}if(0===f.length)throw Error(d);return f}getLeaves(d,a,b){const c=[];return this._appendLeaves(c,d,a=a||10,b=b||0,0),c}getTile(i,d,e){const b=this.trees[this._limitZoom(i)],a=Math.pow(2,i),{extent:j,radius:k}=this.options,c=k/j,g=(e-c)/a,h=(e+1+c)/a,f={features:[]};return this._addTileFeatures(b.range((d-c)/a,g,(d+1+c)/a,h),b.points,d,e,a,f),0===d&&this._addTileFeatures(b.range(1-c/a,g,1,h),b.points,a,e,a,f),d===a-1&&this._addTileFeatures(b.range(0,g,c/a,h),b.points,-1,e,a,f),f.features.length?f:null}getClusterExpansionZoom(a){let b=this._getOriginZoom(a)-1;for(;b<=this.options.maxZoom;){const c=this.getChildren(a);if(b++,1!==c.length)break;a=c[0].properties.cluster_id}return b}_appendLeaves(c,g,e,d,a){const h=this.getChildren(g);for(const f of h){const b=f.properties;if(b&&b.cluster?a+b.point_count<=d?a+=b.point_count:a=this._appendLeaves(c,b.cluster_id,e,d,a):ab&&(c+=o.numPoints||1)}if(c>e&&c>=u){let p=a.x*e,q=a.y*e,i=j&&e>1?this._map(a,!0):null;const l=(g<<5)+(b+1)+this.points.length;for(const x of k){const d=h.points[x];if(d.zoom<=b)continue;d.zoom=b;const r=d.numPoints||1;p+=d.x*r,q+=d.y*r,d.parentId=l,j&&(i||(i=this._map(a,!0)),j(i,this._map(d)))}a.parentId=l,f.push(K(p/c,q/c,l,c,i))}else if(f.push(a),c>1)for(const y of k){const m=h.points[y];m.zoom<=b||(m.zoom=b,f.push(m))}}return f}_getOriginId(a){return a-this.points.length>>5}_getOriginZoom(a){return(a-this.points.length)%32}_map(a,c){if(a.numPoints)return c?R({},a.properties):a.properties;const d=this.points[a.index].properties,b=this.options.map(d);return c&&b===d?R({},b):b}}function K(a,b,c,d,e){return{x:I(a),y:I(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:e}}function L(a,b){const[c,d]=a.geometry.coordinates;return{x:I(O(c)),y:I(P(d)),zoom:1/0,index:b,parentId:-1}}function M(a){return{type:"Feature",id:a.id,properties:N(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),Q(a.y),]}}}function N(b){const a=b.numPoints,c=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a;return R(R({},b.properties),{cluster:!0,cluster_id:b.id,point_count:a,point_count_abbreviated:c})}function O(a){return a/360+.5}function P(c){const b=Math.sin(c*Math.PI/180),a=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return a<0?0:a>1?1:a}function Q(a){return 360*Math.atan(Math.exp((180-360*a)*Math.PI/180))/Math.PI-90}function R(a,b){for(const c in b)a[c]=b[c];return a}function S(a){return a.x}function T(a){return a.y}function U(a,b,c,g){for(var d,f=g,k=c-b>>1,i=c-b,l=a[b],m=a[b+1],n=a[c],o=a[c+1],e=b+3;ef)d=e,f=h;else if(h===f){var j=Math.abs(e-k);jg&&(d-b>3&&U(a,b,d,g),a[d+2]=f,c-d>3&&U(a,d,c,g))}function V(f,g,c,d,h,i){var a=h-c,b=i-d;if(0!==a||0!==b){var e=((f-c)*a+(g-d)*b)/(a*a+b*b);e>1?(c=h,d=i):e>0&&(c+=a*e,d+=b*e)}return(a=f-c)*a+(b=g-d)*b}function W(a,c,d,e){var b={id:void 0===a?null:a,type:c,geometry:d,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(d){var b=d.geometry,c=d.type;if("Point"===c||"MultiPoint"===c||"LineString"===c)X(d,b);else if("Polygon"===c||"MultiLineString"===c)for(var a=0;a0&&(h+=k?(f*d-c*g)/2:Math.sqrt(Math.pow(c-f,2)+Math.pow(d-g,2))),f=c,g=d}var i=a.length-3;a[2]=1,U(a,0,i,j),a[i+2]=1,a.size=Math.abs(h),a.start=0,a.end=a.size}function _(b,d,e,f){for(var a=0;a1?1:a}function ac(j,m,e,d,f,n,o,p){if(d/=m,n>=(e/=m)&&o=d)return null;for(var i=[],k=0;k=e&&r=d)){var b=[];if("Point"===a||"MultiPoint"===a)ad(h,b,e,d,f);else if("LineString"===a)ae(h,b,e,d,f,!1,p.lineMetrics);else if("MultiLineString"===a)ag(h,b,e,d,f,!1);else if("Polygon"===a)ag(h,b,e,d,f,!0);else if("MultiPolygon"===a)for(var g=0;g=e&&d<=f&&(c.push(b[a]),c.push(b[a+1]),c.push(b[a+2]))}}function ae(b,u,e,f,o,v,m){for(var n,g,a=af(b),p=0===o?ai:aj,q=b.start,h=0;he&&(g=p(a,c,d,j,k,e),m&&(a.start=q+n*g)):l>f?r=e&&(g=p(a,c,d,j,k,e),t=!0),r>f&&l<=f&&(g=p(a,c,d,j,k,f),t=!0),!v&&t&&(m&&(a.end=q+n*g),u.push(a),a=af(b)),m&&(q+=n)}var i=b.length-3;c=b[i],d=b[i+1],s=b[i+2],(l=0===o?c:d)>=e&&l<=f&&ah(a,c,d,s),i=a.length-3,v&&i>=3&&(a[i]!==a[0]||a[i+1]!==a[1])&&ah(a,a[0],a[1],a[2]),a.length&&u.push(a)}function af(b){var a=[];return a.size=b.size,a.start=b.start,a.end=b.end,a}function ag(b,c,d,e,f,g){for(var a=0;aa.maxX&&(a.maxX=h),i>a.maxY&&(a.maxY=i)}return a}function ap(f,d,h,m){var b=d.geometry,c=d.type,e=[];if("Point"===c||"MultiPoint"===c)for(var a=0;a0&&a.size<(f?g:b))e.numPoints+=a.length/3;else{for(var d=[],c=0;cg)&&(e.numSimplified++,d.push(a[c]),d.push(a[c+1])),e.numPoints++;f&&function(b,f){for(var e=0,a=0,c=b.length,d=c-2;a0===f)for(a=0,c=b.length;a24)throw Error("maxZoom should be in the 0-24 range");if(a.promoteId&&a.generateId)throw Error("promoteId and generateId cannot be used together.");var d,e,b,c,f,g,h=function(a,d){var c=[];if("FeatureCollection"===a.type)for(var b=0;b1&&console.time("creation"),a=this.tiles[u]=ao(g,c,d,b,e),this.tileCoords.push({z:c,x:d,y:b}),j)){j>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c,d,b,a.numFeatures,a.numPoints,a.numSimplified),console.timeEnd("creation"));var v="z"+c;this.stats[v]=(this.stats[v]||0)+1,this.total++}if(a.source=g,m){if(c===e.maxZoom||c===m)continue;var w=1<1&&console.time("clipping");var n,o,p,q,k,l,i=.5*e.buffer/e.extent,r=.5-i,s=.5+i,t=1+i;n=o=p=q=null,k=ac(g,h,d-i,d+s,0,a.minX,a.maxX,e),l=ac(g,h,d+r,d+t,0,a.minX,a.maxX,e),g=null,k&&(n=ac(k,h,b-i,b+s,1,a.minY,a.maxY,e),o=ac(k,h,b+r,b+t,1,a.minY,a.maxY,e),k=null),l&&(p=ac(l,h,b-i,b+s,1,a.minY,a.maxY,e),q=ac(l,h,b+r,b+t,1,a.minY,a.maxY,e),l=null),j>1&&console.timeEnd("clipping"),f.push(n||[],c+1,2*d,2*b),f.push(o||[],c+1,2*d,2*b+1),f.push(p||[],c+1,2*d+1,2*b),f.push(q||[],c+1,2*d+1,2*b+1)}}},d.prototype.getTile=function(a,b,g){var k=this.options,l=k.extent,h=k.debug;if(a<0||a>24)return null;var j=1<1&&console.log("drilling down to z%d-%d-%d",a,b,g);for(var c,d=a,e=b,f=g;!c&&d>0;)d--,e=Math.floor(e/2),f=Math.floor(f/2),c=this.tiles[ar(d,e,f)];return c&&c.source?(h>1&&console.log("found parent tile z%d-%d-%d",d,e,f),h>1&&console.time("drilling down"),this.splitTile(c.source,d,e,f,a,b,g),h>1&&console.timeEnd("drilling down"),this.tiles[i]?am(this.tiles[i],l):null):null};class as extends a.VectorTileWorkerSource{constructor(b,d,e,f,a){super(b,d,e,f,function(g,b){const d=g.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const e=this._geoJSONIndex.getTile(d.z,d.x,d.y);if(!e)return b(null,null);const f=new u(e.features);let a=c(f);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),b(null,{vectorTile:f,rawData:a.buffer})}),a&&(this.loadGeoJSON=a)}loadData(b,e){const c=b&&b.request,f=c&&c.collectResourceTiming;this.loadGeoJSON(b,(i,g)=>{if(i||!g)return e(i);if("object"!=typeof g)return e(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{p(g,!0);try{var j,k;if(b.filter){const l=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===l.result)throw Error(l.value.map(a=>`${a.key}: ${a.message}`).join(", "));const n=g.features.filter(a=>l.value.evaluate({zoom:0},a));g={type:"FeatureCollection",features:n}}this._geoJSONIndex=b.cluster?new J(function({superclusterOptions:b,clusterProperties:d}){if(!d||!b)return b;const f={},g={},l={accumulated:null,zoom:0},m={properties:null},h=Object.keys(d);for(const c of h){const[e,i]=d[c],j=a.createExpression(i),k=a.createExpression("string"==typeof e?[e,["accumulated",],["get",c,],]:e);f[c]=j.value,g[c]=k.value}return b.map=c=>{m.properties=c;const a={};for(const b of h)a[b]=f[b].evaluate(l,m);return a},b.reduce=(b,c)=>{for(const a of(m.properties=c,h))l.accumulated=b[a],b[a]=g[a].evaluate(l,m)},b}(b)).load(g.features):(j=g,k=b.geojsonVtOptions,new d(j,k))}catch(o){return e(o)}this.loaded={};const h={};if(f){const m=a.getPerformanceMeasurement(c);m&&(h.resourceTiming={},h.resourceTiming[b.source]=JSON.parse(JSON.stringify(m)))}e(null,h)}})}reloadTile(a,b){const c=this.loaded;return c&&c[a.uid]?super.reloadTile(a,b):this.loadTile(a,b)}loadGeoJSON(b,c){if(b.request)a.getJSON(b.request,c);else{if("string"!=typeof b.data)return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));try{return c(null,JSON.parse(b.data))}catch(d){return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(b,a){try{a(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(c){a(c)}}getClusterChildren(b,a){try{a(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(c){a(c)}}getClusterLeaves(a,b){try{b(null,this._geoJSONIndex.getLeaves(a.clusterId,a.limit,a.offset))}catch(c){b(c)}}}class e{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.getProjection({name:"mercator"}),this.workerSourceTypes={vector:a.VectorTileWorkerSource,geojson:as},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(a,b)=>{if(this.workerSourceTypes[a])throw Error(`Worker source with name "${a}" already registered.`);this.workerSourceTypes[a]=b},this.self.registerRTLTextPlugin=b=>{if(a.plugin.isParsed())throw Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=b.applyArabicShaping,a.plugin.processBidirectionalText=b.processBidirectionalText,a.plugin.processStyledBidirectionalText=b.processStyledBidirectionalText}}clearCaches(a,c,b){delete this.layerIndexes[a],delete this.availableImages[a],delete this.workerSources[a],delete this.demWorkerSources[a],b()}checkIfReady(b,c,a){a()}setReferrer(b,a){this.referrer=a}spriteLoaded(c,e){for(const f in this.isSpriteLoaded[c]=e,this.workerSources[c]){const b=this.workerSources[c][f];for(const d in b)b[d]instanceof a.VectorTileWorkerSource&&(b[d].isSpriteLoaded=e,b[d].fire(new a.Event("isSpriteLoaded")))}}setImages(a,b,d){for(const e in this.availableImages[a]=b,this.workerSources[a]){const c=this.workerSources[a][e];for(const f in c)c[f].availableImages=b}d()}enableTerrain(c,a,b){this.terrain=a,b()}setProjection(b,c){this.projections[b]=a.getProjection(c)}setLayers(a,b,c){this.getLayerIndex(a).replace(b),c()}updateLayers(b,a,c){this.getLayerIndex(b).update(a.layers,a.removedIds),c()}loadTile(c,b,e){const d=this.enableTerrain?a.extend({enableTerrain:this.terrain},b):b;d.projection=this.projections[c]||this.defaultProjection,this.getWorkerSource(c,b.type,b.source).loadTile(d,e)}loadDEMTile(c,b,d){const e=this.enableTerrain?a.extend({buildQuadTree:this.terrain},b):b;this.getDEMWorkerSource(c,b.source).loadTile(e,d)}reloadTile(c,b,e){const d=this.enableTerrain?a.extend({enableTerrain:this.terrain},b):b;d.projection=this.projections[c]||this.defaultProjection,this.getWorkerSource(c,b.type,b.source).reloadTile(d,e)}abortTile(b,a,c){this.getWorkerSource(b,a.type,a.source).abortTile(a,c)}removeTile(b,a,c){this.getWorkerSource(b,a.type,a.source).removeTile(a,c)}removeSource(b,a,c){if(!this.workerSources[b]||!this.workerSources[b][a.type]||!this.workerSources[b][a.type][a.source])return;const d=this.workerSources[b][a.type][a.source];delete this.workerSources[b][a.type][a.source],void 0!==d.removeSource?d.removeSource(a,c):c()}loadWorkerSource(d,b,a){try{this.self.importScripts(b.url),a()}catch(c){a(c.toString())}}syncRTLPluginState(g,e,c){try{a.plugin.setState(e);const b=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&null!=b){this.self.importScripts(b);const d=a.plugin.isParsed();c(d?void 0:Error(`RTL Text Plugin failed to import scripts from ${b}`),d)}}catch(f){c(f.toString())}}getAvailableImages(b){let a=this.availableImages[b];return a||(a=[]),a}getLayerIndex(b){let a=this.layerIndexes[b];return a||(a=this.layerIndexes[b]=new m),a}getWorkerSource(a,b,c){return this.workerSources[a]||(this.workerSources[a]={}),this.workerSources[a][b]||(this.workerSources[a][b]={}),this.workerSources[a][b][c]||(this.workerSources[a][b][c]=new this.workerSourceTypes[b]({send:(b,c,d,g,e,f)=>{this.actor.send(b,c,d,a,e,f)},scheduler:this.actor.scheduler},this.getLayerIndex(a),this.getAvailableImages(a),this.isSpriteLoaded[a])),this.workerSources[a][b][c]}getDEMWorkerSource(a,b){return this.demWorkerSources[a]||(this.demWorkerSources[a]={}),this.demWorkerSources[a][b]||(this.demWorkerSources[a][b]=new o),this.demWorkerSources[a][b]}enforceCacheSizeLimit(c,b){a.enforceCacheSizeLimit(b)}getWorkerPerformanceMetrics(b,c,a){a(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new e(self)),e}),a(["./shared"],function(a){var l=m;function m(c){var b,a;return b=c,"undefined"!=typeof window&&"undefined"!=typeof document&&!!Array.prototype&&!!Array.prototype.every&&!!Array.prototype.filter&&!!Array.prototype.forEach&&!!Array.prototype.indexOf&&!!Array.prototype.lastIndexOf&&!!Array.prototype.map&&!!Array.prototype.some&&!!Array.prototype.reduce&&!!Array.prototype.reduceRight&&!!Array.isArray&&!!Function.prototype&&!!Function.prototype.bind&&!!Object.keys&&!!Object.create&&!!Object.getPrototypeOf&&!!Object.getOwnPropertyNames&&!!Object.isSealed&&!!Object.isFrozen&&!!Object.isExtensible&&!!Object.getOwnPropertyDescriptor&&!!Object.defineProperty&&!!Object.defineProperties&&!!Object.seal&&!!Object.freeze&&!!Object.preventExtensions&&!!("JSON"in window&&"parse"in JSON&&"stringify"in JSON)&&!!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var a,b,d=new Blob([""],{type:"text/javascript"}),c=URL.createObjectURL(d);try{b=new Worker(c),a=!0}catch(e){a=!1}return b&&b.terminate(),URL.revokeObjectURL(c),a}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d");if(!b)return!1;var c=b.getImageData(0,0,1,1);return c&&c.width===a.width}()&&(void 0===B[a=b&&b.failIfMajorPerformanceCaveat]&&(B[a]=function(f){var e,c,d,b,a=(e=f,c=document.createElement("canvas"),(d=Object.create(m.webGLContextAttributes)).failIfMajorPerformanceCaveat=e,c.getContext("webgl",d)||c.getContext("experimental-webgl",d));if(!a)return!1;try{b=a.createShader(a.VERTEX_SHADER)}catch(g){return!1}return!(!b||a.isContextLost())&&(a.shaderSource(b,"void main() {}"),a.compileShader(b),!0===a.getShaderParameter(b,a.COMPILE_STATUS))}(a)),!!B[a]&&!document.documentMode)}var B={};function C(b,c){var d=c[0],e=c[1],f=c[2],g=c[3],a=d*g-f*e;return a?(b[0]=g*(a=1/a),b[1]=-e*a,b[2]=-f*a,b[3]=d*a,b):null}function D(a,b){if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(let c=0;c{a.window.removeEventListener("click",G,!0)},0)},b.mousePos=function(a,b){const c=a.getBoundingClientRect();return H(a,c,b)},b.touchPos=function(b,c){const e=b.getBoundingClientRect(),d=[];for(let a=0;a=0?0:b.button};class J extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:b,callback:c}of this.requestors)this._notify(b,c);this.requestors=[]}}getImage(a){return this.images[a]}addImage(a,b){this._validate(a,b)&&(this.images[a]=b)}_validate(d,b){let c=!0;return this._validateStretch(b.stretchX,b.data&&b.data.width)||(this.fire(new a.ErrorEvent(Error(`Image "${d}" has invalid "stretchX" value`))),c=!1),this._validateStretch(b.stretchY,b.data&&b.data.height)||(this.fire(new a.ErrorEvent(Error(`Image "${d}" has invalid "stretchY" value`))),c=!1),this._validateContent(b.content,b)||(this.fire(new a.ErrorEvent(Error(`Image "${d}" has invalid "content" value`))),c=!1),c}_validateStretch(b,d){if(!b)return!0;let c=0;for(const a of b){if(a[0]{this.ready=!0})}broadcast(c,d,b){a.asyncAll(this.actors,(a,b)=>{a.send(c,d,b)},b=b||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function V(b,c,d){return c*(a.EXTENT/(b.tileSize*Math.pow(2,d-b.tileID.overscaledZ)))}n.Actor=a.Actor;class W{constructor(b,c,d){this.context=b;const a=b.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(d),this.context.unbindVAO(),b.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete c.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(b){const a=this.context.gl;this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,b.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const X={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Y{constructor(c,b,d,e){this.length=b.length,this.attributes=d,this.itemSize=b.bytesPerElement,this.dynamicDraw=e,this.context=c;const a=c.gl;this.buffer=a.createBuffer(),c.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(b){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,b.arrayBuffer)}enableAttributes(c,d){for(let a=0;ad.pointCoordinate3D(a)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(b,c){let d,e;if(b instanceof a.pointGeometry||"number"==typeof b[0]){const h=a.pointGeometry.convert(b);d=[a.pointGeometry.convert(b)],e=c.isPointAboveHorizon(h)}else{const f=a.pointGeometry.convert(b[0]),g=a.pointGeometry.convert(b[1]);d=[f,g],e=a.polygonizeBounds(f,g).every(a=>c.isPointAboveHorizon(a))}return new _(d,c.getCameraPoint(),e,c)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(b){return a.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],b)}bufferedCameraGeometry(e){const d=this.screenBounds[0],b=1===this.screenBounds.length?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],c=a.polygonizeBounds(d,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>d.x&&this.cameraPoint.x=b.x?c[2]=this.cameraPoint:this.cameraPoint.x<=d.x&&(c[3]=this.cameraPoint)),a.bufferConvexPolygon(c,e)}containsTile(c,d,h){var b;const f=c.queryPadding+1,i=c.tileID.wrap,e=h?this._bufferedCameraMercator(f,d).map(b=>a.getTilePoint(c.tileTransform,b,i)):this._bufferedScreenMercator(f,d).map(b=>a.getTilePoint(c.tileTransform,b,i)),g=this.screenGeometryMercator.map(b=>a.getTileVec3(c.tileTransform,b,i)),j=g.map(b=>new a.pointGeometry(b[0],b[1])),k=d.getFreeCameraOptions().position||new a.MercatorCoordinate(0,0,0),n=a.getTileVec3(c.tileTransform,k,i),l=g.map(c=>{const b=a.sub(c,c,n);return a.normalize(b,b),new a.Ray(n,b)}),m=V(c,1,d.zoom);if(a.polygonIntersectsBox(e,0,0,a.EXTENT,a.EXTENT))return{queryGeometry:this,tilespaceGeometry:j,tilespaceRays:l,bufferedTilespaceGeometry:e,bufferedTilespaceBounds:((b=a.getBounds(e)).min.x=a.clamp(b.min.x,0,a.EXTENT),b.min.y=a.clamp(b.min.y,0,a.EXTENT),b.max.x=a.clamp(b.max.x,0,a.EXTENT),b.max.y=a.clamp(b.max.y,0,a.EXTENT),b),tile:c,tileID:c.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(b,d){const a=aa(b);if(this._screenRaycastCache[a])return this._screenRaycastCache[a];{const c=this.bufferedScreenGeometry(b).map(a=>d.pointCoordinate3D(a));return this._screenRaycastCache[a]=c,c}}_bufferedCameraMercator(b,d){const a=aa(b);if(this._cameraRaycastCache[a])return this._cameraRaycastCache[a];{const c=this.bufferedCameraGeometry(b).map(a=>d.pointCoordinate3D(a));return this._cameraRaycastCache[a]=c,c}}}function aa(a){return 100*a|0}function ab(b,c,e){const d=function(g,f){if(g)return e(g);if(f){const d=a.pick(a.extend(f,b),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);f.vector_layers&&(d.vectorLayers=f.vector_layers,d.vectorLayerIds=d.vectorLayers.map(a=>a.id)),d.tiles=c.canonicalizeTileset(d,b.url),e(null,d)}};return b.url?a.getJSON(c.transformRequest(c.normalizeSourceURL(b.url),a.ResourceType.Source),d):a.exported.frame(()=>d(null,b))}class ac{constructor(b,c,d){this.bounds=a.LngLatBounds.convert(this.validateBounds(b)),this.minzoom=c||0,this.maxzoom=d||24}validateBounds(a){return Array.isArray(a)&&4===a.length?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3]),]:[-180,-90,180,90]}contains(b){const c=Math.pow(2,b.z),d=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*c),e=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*c),f=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*c),g=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*c);return b.x>=d&&b.x=e&&b.y{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):b&&(a.extend(this,b),b.bounds&&(this.tileBounds=new ac(b.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(b.tiles),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(b,e){const c=a.exported.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);b.request=a.getImage(this.map._requestManager.transformRequest(d,a.ResourceType.Tile),(g,f,h,i)=>{if(delete b.request,b.aborted)b.state="unloaded",e(null);else if(g)b.state="errored",e(g);else if(f){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const c=this.map.painter.context,d=c.gl;b.texture=this.map.painter.getTileTexture(f.width),b.texture?b.texture.update(f,{useMipmap:!0}):(b.texture=new a.Texture(c,f,d.RGBA,{useMipmap:!0}),b.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&d.texParameterf(d.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),b.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),e(null)}})}abortTile(a,b){a.request&&(a.request.cancel(),delete a.request),b()}unloadTile(a,b){a.texture&&this.map.painter.saveTileTexture(a.texture),b()}hasTransition(){return!1}}let ad;function ae(e,f,g,h,i,j,k,l){const b=[e,g,i,f,h,j,1,1,1],c=[k,l,1],d=a.adjoint([],b),[m,n,o]=a.transformMat3(c,c,a.transpose(d,d));return a.multiply(b,[m,0,0,0,n,0,0,0,o],b)}class s extends a.Evented{constructor(b,a,c,d){super(),this.id=b,this.dispatcher=c,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=a}load(b,c){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(d,e)=>{this._loaded=!0,d?this.fire(new a.ErrorEvent(d)):e&&(this.image=a.exported.getImageData(e),this.width=this.image.width,this.height=this.image.height,b&&(this.coordinates=b),c&&c(),this._finishLoading())})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url&&(this.options.url=a.url,this.load(a.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}setCoordinates(b){this.coordinates=b,delete this._boundsArray;const c=b.map(a.MercatorCoordinate.fromLngLat);return this.tileID=function(i){let b=1/0,c=1/0,d=-1/0,e=-1/0;for(const f of i)b=Math.min(b,f.x),c=Math.min(c,f.y),d=Math.max(d,f.x),e=Math.max(e,f.y);const j=Math.max(d-b,e-c),g=Math.max(0,Math.floor(-Math.log(j)/Math.LN2)),h=Math.pow(2,g);return new a.CanonicalTileID(g,Math.floor((b+d)/2*h),Math.floor((c+e)/2*h))}(c),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const f=a.tileTransform(this.tileID,this.map.transform.projection),[b,c,d,e]=this.coordinates.map(b=>{const c=f.projection.project(b[0],b[1]);return a.getTilePoint(f,c)._round()});return this.perspectiveTransform=function(c,d,f,g,h,i,j,k,l,m){const e=ae(0,0,c,0,0,d,c,d),b=ae(f,g,h,i,j,k,l,m);return a.multiply(b,a.adjoint(e,e),b),[b[6]/b[8]*c/a.EXTENT,b[7]/b[8]*d/a.EXTENT,]}(this.width,this.height,b.x,b.y,c.x,c.y,e.x,e.y,d.x,d.y),this._boundsArray=new a.StructArrayLayout4i8,this._boundsArray.emplaceBack(b.x,b.y,0,0),this._boundsArray.emplaceBack(c.x,c.y,a.EXTENT,0),this._boundsArray.emplaceBack(e.x,e.y,0,a.EXTENT),this._boundsArray.emplaceBack(d.x,d.y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const b=this.map.painter.context,c=b.gl;for(const e in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new a.Texture(b,this.image,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){const d=this.tiles[e];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}loadTile(a,b){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},b(null)):(a.state="errored",b(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const af={vector:class extends a.Evented{constructor(c,b,d,e){if(super(),this.id=c,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(b,["url","scheme","tileSize","promoteId",])),this._options=a.extend({type:"vector"},b),this._collectResourceTiming=b.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(e),this._tileWorkers={},this._deduped=new a.DedupedRequest}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ab(this._options,this.map._requestManager,(c,b)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):b&&(a.extend(this,b),b.bounds&&(this.tileBounds=new ac(b.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(b.tiles,this.map._requestManager._customAccessToken),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}onAdd(a){this.map=a,this.load()}setSourceProperty(a){this._tileJSONRequest&&this._tileJSONRequest.cancel(),a();const b=this.map.style._getSourceCaches(this.id);for(const c of b)c.clearTiles();this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(b,e){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(d,a.ResourceType.Tile),data:void 0,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,tileSize:this.tileSize*b.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:b.isSymbolTile};if(c.request.collectResourceTiming=this._collectResourceTiming,b.actor&&"expired"!==b.state)"loading"===b.state?b.reloadCallback=e:b.request=b.actor.send("reloadTile",c,g.bind(this));else if(b.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)b.request=b.actor.send("loadTile",c,g.bind(this),void 0,!0);else{const f=a.loadVectorTile.call({deduped:this._deduped},c,(d,a)=>{d||!a?g.call(this,d):(c.data={cacheControl:a.cacheControl,expires:a.expires,rawData:a.rawData.slice(0)},b.actor&&b.actor.send("loadTile",c,g.bind(this),void 0,!0))},!0);b.request={cancel:f}}function g(d,c){return delete b.request,b.aborted?e(null):d&&404!==d.status?e(d):(c&&c.resourceTiming&&(b.resourceTiming=c.resourceTiming),this.map._refreshExpiredTiles&&c&&b.setExpiryData(c),b.loadVectorData(c,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),e(null),void(b.reloadCallback&&(this.loadTile(b,b.reloadCallback),b.reloadCallback=null)))}}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id})}unloadTile(a){a.unloadVectorData(),a.actor&&a.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:r,"raster-dem":class extends r{constructor(c,b,d,e){super(c,b,d,e),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},b),this.encoding=b.encoding||"mapbox"}loadTile(b,d){const c=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function e(a,c){a&&(b.state="errored",d(a)),c&&(b.dem=c,b.dem.onDeserialize(),b.needsHillshadePrepare=!0,b.needsDEMTextureUpload=!0,b.state="loaded",d(null))}b.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),(function(g,c,h,i){if(delete b.request,b.aborted)b.state="unloaded",d(null);else if(g)b.state="errored",d(g);else if(c){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const j=a.window.ImageBitmap&&c instanceof a.window.ImageBitmap&&(null==ad&&(ad=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),ad),f=1-(c.width-a.prevPowerOfTwo(c.width))/2;f<1||b.neighboringTiles||(b.neighboringTiles=this._getNeighboringTiles(b.tileID));const k=j?c:a.exported.getImageData(c,f),l={uid:b.uid,coord:b.tileID,source:this.id,rawImageData:k,encoding:this.encoding,padding:f};b.actor&&"expired"!==b.state||(b.actor=this.dispatcher.getActor(),b.actor.send("loadDEMTile",l,e.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(c){const b=c.canonical,e=Math.pow(2,b.z),f=(b.x-1+e)%e,g=0===b.x?c.wrap-1:c.wrap,h=(b.x+1+e)%e,i=b.x+1===e?c.wrap+1:c.wrap,d={};return d[new a.OverscaledTileID(c.overscaledZ,g,b.z,f,b.y).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,i,b.z,h,b.y).key]={backfilled:!1},b.y>0&&(d[new a.OverscaledTileID(c.overscaledZ,g,b.z,f,b.y-1).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,c.wrap,b.z,b.x,b.y-1).key]={backfilled:!1},d[new a.OverscaledTileID(c.overscaledZ,i,b.z,h,b.y-1).key]={backfilled:!1}),b.y+1{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new a.ErrorEvent(c));else{const d={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&b&&b.resourceTiming&&b.resourceTiming[this.id]&&(d.resourceTiming=b.resourceTiming[this.id]),this.fire(new a.Event("data",d)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(b,d){const c=b.actor?"reloadTile":"loadTile";b.actor=this.actor,b.request=this.actor.send(c,{type:this.type,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(a,e)=>(delete b.request,b.unloadVectorData(),b.aborted?d(null):a?d(a):(b.loadVectorData(e,this.map.painter,"reloadTile"===c),d(null))),void 0,"loadTile"===c)}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.aborted=!0}unloadTile(a){a.unloadVectorData(),this.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s{constructor(b,a,c,d){super(b,a,c,d),this.roundZoom=!0,this.type="video",this.options=a}load(){this._loaded=!1;const b=this.options;for(const c of(this.urls=[],b.urls))this.urls.push(this.map._requestManager.transformRequest(c,a.ResourceType.Source).url);a.getVideo(this.urls,(b,c)=>{this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(this.video=c,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const b=this.video.seekable;cb.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${b.start(0)} and ${b.end(0)}-second mark.`))):this.video.currentTime=c}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const c=this.map.painter.context,b=c.gl;for(const e in this.texture?this.video.paused||(this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE),b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,this.video)):(this.texture=new a.Texture(c,this.video,b.RGBA),this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const d=this.tiles[e];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s,canvas:class extends s{constructor(c,b,d,e){super(c,b,d,e),b.coordinates?Array.isArray(b.coordinates)&&4===b.coordinates.length&&!b.coordinates.some(a=>!Array.isArray(a)||2!==a.length||a.some(a=>"number"!=typeof a))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "coordinates"'))),b.animate&&"boolean"!=typeof b.animate&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),b.canvas?"string"==typeof b.canvas||b.canvas instanceof a.window.HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${c}`,null,'missing required property "canvas"'))),this.options=b,this.animate=void 0===b.animate||b.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof a.window.HTMLCanvasElement?this.options.canvas:a.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const c=this.map.painter.context,e=c.gl;for(const f in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.Texture(c,this.canvas,e.RGBA,{premultiply:!0}),this.tiles){const d=this.tiles[f];"loaded"!==d.state&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height,])if(isNaN(a)||a<=0)return!0;return!1}}},ag=function(c,d,e,f){const b=new af[d.type](c,d,e,f);if(b.id!==c)throw Error(`Expected Source id to be ${c} instead of ${b.id}`);return a.bindAll(["load","abort","unload","serialize","prepare",],b),b};function ah(c,d){const b=a.identity([]);return a.scale(b,b,[.5*c.width,-(.5*c.height),1,]),a.translate(b,b,[1,-1,0]),a.multiply$1(b,b,c.calculateProjMatrix(d.toUnwrapped()))}function ai(b,g,h,i,j,k,l,d=!1){const e=b.tilesIn(i,l,d);e.sort(ak);const f=[];for(const a of e)f.push({wrappedTileID:a.tile.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(g,h,b._state,a,j,k,ah(b.transform,a.tile.tileID),d)});const c=function(j){const b={},d={};for(const e of j){const f=e.queryResults,g=e.wrappedTileID,h=d[g]=d[g]||{};for(const a in f){const k=f[a],i=h[a]=h[a]||{},l=b[a]=b[a]||[];for(const c of k)i[c.featureIndex]||(i[c.featureIndex]=!0,l.push(c))}}return b}(f);for(const m in c)c[m].forEach(c=>{const a=c.feature,d=b.getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=d});return c}function aj(g,h){const b=g.getRenderableIds().map(a=>g.getTileByID(a)),c=[],d={};for(let a=0;a{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[am]}numActive(){return Object.keys(this.active).length}}let an;function ao(){return an||(an=new e),an}function ap(c,e){const d={};for(const b in c)"ref"!==b&&(d[b]=c[b]);return a.refProperties.forEach(a=>{a in e&&(d[a]=e[a])}),d}function aq(a){a=a.slice();const d=Object.create(null);for(let c=0;c0?(e-g)/h:0;return this.points[f].mult(1-i).add(this.points[b].mult(i))}}class az{constructor(a,b,c){const e=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(a/c),this.yCellCount=Math.ceil(b/c);for(let d=0;dthis.width||i<0||g>this.height)return!d&&[];const a=[];if(f<=0&&g<=0&&this.width<=h&&this.height<=i){if(d)return!0;for(let b=0;b0:a}_queryCircle(b,c,a,d,j){const f=b-a,g=b+a,h=c-a,i=c+a;if(g<0||f>this.width||i<0||h>this.height)return!d&&[];const e=[];return this._forEachCell(f,h,g,i,this._queryCellCircle,e,{hitTest:d,circle:{x:b,y:c,radius:a},seenUids:{box:{},circle:{}}},j),d?e.length>0:e}query(a,b,c,d,e){return this._query(a,b,c,d,!1,e)}hitTest(a,b,c,d,e){return this._query(a,b,c,d,!0,e)}hitTestCircle(a,b,c,d){return this._queryCircle(a,b,c,!0,d)}_queryCell(l,m,n,o,p,g,k,h){const i=k.seenUids,q=this.boxCells[p];if(null!==q){const a=this.bboxes;for(const e of q)if(!i.box[e]){i.box[e]=!0;const b=4*e;if(l<=a[b+2]&&m<=a[b+3]&&n>=a[b+0]&&o>=a[b+1]&&(!h||h(this.boxKeys[e]))){if(k.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[e],x1:a[b],y1:a[b+1],x2:a[b+2],y2:a[b+3]})}}}const r=this.circleCells[p];if(null!==r){const c=this.circles;for(const f of r)if(!i.circle[f]){i.circle[f]=!0;const d=3*f;if(this._circleAndRectCollide(c[d],c[d+1],c[d+2],l,m,n,o)&&(!h||h(this.circleKeys[f]))){if(k.hitTest)return g.push(!0),!0;{const s=c[d],t=c[d+1],j=c[d+2];g.push({key:this.circleKeys[f],x1:s-j,y1:t-j,x2:s+j,y2:t+j})}}}}}_queryCellCircle(o,p,q,r,j,k,l,b){const a=l.circle,c=l.seenUids,m=this.boxCells[j];if(null!==m){const d=this.bboxes;for(const e of m)if(!c.box[e]){c.box[e]=!0;const f=4*e;if(this._circleAndRectCollide(a.x,a.y,a.radius,d[f+0],d[f+1],d[f+2],d[f+3])&&(!b||b(this.boxKeys[e])))return k.push(!0),!0}}const n=this.circleCells[j];if(null!==n){const h=this.circles;for(const g of n)if(!c.circle[g]){c.circle[g]=!0;const i=3*g;if(this._circlesCollide(h[i],h[i+1],h[i+2],a.x,a.y,a.radius)&&(!b||b(this.circleKeys[g])))return k.push(!0),!0}}}_forEachCell(c,d,e,f,g,h,i,j){const k=this._convertToXCellCoord(c),l=this._convertToYCellCoord(d),m=this._convertToXCellCoord(e),n=this._convertToYCellCoord(f);for(let a=k;a<=m;a++)for(let b=l;b<=n;b++)if(g.call(this,c,d,e,f,this.xCellCount*b+a,h,i,j))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(d,e,f,g,h,i){const a=g-d,b=h-e,c=f+i;return c*c>a*a+b*b}_circleAndRectCollide(j,k,a,f,g,l,m){const b=(l-f)/2,d=Math.abs(j-(f+b));if(d>b+a)return!1;const c=(m-g)/2,e=Math.abs(k-(g+c));if(e>c+a)return!1;if(d<=b||e<=c)return!0;const h=d-b,i=e-c;return h*h+i*i<=a*a}}const aA=Math.tan(85*Math.PI/180);function aB(e,f,g,h,c,i){let b=a.create();if(g){if("globe"===c.projection.name)b=a.calculateGlobeMatrix(c,c.worldSize/c._projectionScaler,[0,0]),a.multiply$1(b,b,a.globeDenormalizeECEF(a.globeTileBounds(f)));else{const d=C([],i);b[0]=d[0],b[1]=d[1],b[4]=d[2],b[5]=d[3]}h||a.rotateZ(b,b,c.angle)}else a.multiply$1(b,c.labelPlaneMatrix,e);return b}function aC(g,j,h,i,f,b){if(h){if("globe"===f.projection.name){const c=aB(g,j,h,i,f,b);return a.invert(c,c),a.multiply$1(c,g,c),c}{const d=a.clone(g),e=a.identity([]);return e[0]=b[0],e[1]=b[1],e[4]=b[2],e[5]=b[3],a.multiply$1(d,d,e),i||a.rotateZ(d,d,-f.angle),d}}return f.glCoordMatrix}function aD(d,e,f=0){const b=[d.x,d.y,f,1];f?a.transformMat4$1(b,b,e):aP(b,b,e);const c=b[3];return{point:new a.pointGeometry(b[0]/c,b[1]/c),signedDistanceFromCamera:c}}function aE(a,b){return Math.min(.5+a/b*.5,1.5)}function aF(a,b){const c=a[0]/a[3],d=a[1]/a[3];return c>= -b[0]&&c<=b[0]&&d>= -b[1]&&d<=b[1]}function aG(c,m,e,i,n,x,y,z,o,p){const q=e.transform,A=i?c.textSizeData:c.iconSizeData,G=a.evaluateSizeForZoom(A,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1,],d=i?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;d.clear();const B=c.lineVertexArray,r=i?c.text.placedSymbolArray:c.icon.placedSymbolArray,C=e.transform.width/e.transform.height;let f=!1;for(let g=0;gMath.abs(c.x-b.x)*e?{useVertical:!0}:d.writingMode===a.WritingMode.vertical?b.yaA}(b,c,e)?1===d.flipState?{needsFlipping:!0}:null:b.x>c.x?{needsFlipping:!0}:null}function aJ(b,E,c,v,m,n,w,o,d,F,p,e,q,x,r,i,j){const f=E/24,s=b.lineOffsetX*f,t=b.lineOffsetY*f;let g;if(b.numGlyphs>1){const G=b.glyphStartIndex+b.numGlyphs,H=b.lineStartIndex,I=b.lineStartIndex+b.lineLength,h=aH(f,o,s,t,c,p,e,b,d,n,q,r,!1,i,j);if(!h)return{notEnoughRoom:!0};const J=aD(h.first.point,w).point,K=aD(h.last.point,w).point;if(v&&!c){const k=aI(b,J,K,x);if(b.flipState=k&&k.needsFlipping?1:2,k)return k}g=[h.first];for(let u=b.glyphStartIndex+1;u0?B.point:aL(e,A,y,1,m,void 0,i,j.canonical),x);if(b.flipState=l&&l.needsFlipping?1:2,l)return l}const C=aM(f*o.getoffsetX(b.glyphStartIndex),s,t,c,p,e,b.segment,b.lineStartIndex,b.lineStartIndex+b.lineLength,d,n,q,r,!1,!1,i,j);if(!C)return{notEnoughRoom:!0};g=[C]}for(const D of g)a.addDynamicAttributes(F,D.point,D.angle);return{}}function aK(c,g,e,h,f){const b=h.projectTilePoint(c.x,c.y,g);if(!f)return aD(b,e,b.z);const d=f(c);return aD(new a.pointGeometry(b.x+d[0],b.y+d[1]),e,b.z+d[2])}function aL(a,d,b,e,f,g,h,i){const j=aK(a.add(a.sub(d)._unit()),i,f,h,g).point,c=b.sub(j);return b.add(c._mult(e/c.mag()))}function aM(p,q,r,s,t,D,u,k,E,f,F,j,v,w,G,H,I){const x=s?p-q:p+q;let h=x>0?1:-1,l=0;s&&(h*=-1,l=Math.PI),h<0&&(l+=Math.PI);let b=h>0?k+u:k+u+1,c=t,e=t,m=0,i=0;const y=Math.abs(x),n=[],g=[];let d=D;const J=()=>{const c=b-h;return 0===m?D:new a.pointGeometry(f.getx(c),f.gety(c))},z=()=>aL(J(),d,e,y-m+1,F,v,H,I.canonical);for(;m+i<=y;){if((b+=h)=E)return null;if(e=c,n.push(c),w&&g.push(d||J()),void 0===(c=j[b])){d=new a.pointGeometry(f.getx(b),f.gety(b));const A=aK(d,I.canonical,F,H,v);c=A.signedDistanceFromCamera>0?j[b]=A.point:z()}else d=null;m+=i,i=e.dist(c)}G&&v&&(d=d||new a.pointGeometry(f.getx(b),f.gety(b)),j[b]=c=void 0===j[b]?c:z(),i=e.dist(c));const B=(y-m)/i,C=c.sub(e),o=C.mult(B)._add(e);r&&o._add(C._unit()._perp()._mult(r*h));const K=l+Math.atan2(c.y-e.y,c.x-e.x);return n.push(o),w&&(d=d||new a.pointGeometry(f.getx(b),f.gety(b)),g.push(function(c,d,b){const e=1-b;return new a.pointGeometry(c.x*e+d.x*b,c.y*e+d.y*b)}(g.length>0?g[g.length-1]:d,d,B))),{point:o,angle:K,path:n,tilePath:g}}const aN=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function aO(d,a){for(let b=0;ba.sortKey-b.sortKey));this._currentPartIndex[0,0,0],I=new a.pointGeometry(f.tileAnchorX,f.tileAnchorY),r=this.transform.projection.projectTilePoint(f.tileAnchorX,f.tileAnchorY,l.canonical),s=H(I),g=[r.x+s[0],r.y+s[1],r.z+s[2]],t=this.projectAndGetPerspectiveRatio(V,g[0],g[1],g[2],l),{perspectiveRatio:u}=t,v=(q?D/u:D*u)/a.ONE_EM,_=aD(new a.pointGeometry(g[0],g[1]),E,g[2]).point,w=t.signedDistanceFromCamera>0?aH(v,U,f.lineOffsetX*v,f.lineOffsetY*v,!1,_,I,f,T,E,{},k&&!q?H:null,q&&!!k,this.transform.projection,l):null;let m=!1,x=!1,y=!0;if(w&&!t.aboveHorizon){const c=.5*Y*u+Z,h=new a.pointGeometry(-100,-100),i=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),n=new ay,J=w.first,K=w.last;let b=[];for(let z=J.path.length-1;z>=1;z--)b.push(J.path[z]);for(let A=1;A{const c=H(aaD(a,W));b=L.some(a=>a.signedDistanceFromCamera<=0)?[]:L.map(a=>a.point)}let M=[];if(b.length>0){const d=b[0].clone(),e=b[0].clone();for(let j=1;j=h.x&&e.x<=i.x&&d.y>=h.y&&e.y<=i.y?[b]:e.xi.x||e.yi.y?[]:a.clipLine([b],h.x,h.y,i.x,i.y)}for(const ab of M){n.reset(ab,.25*c);let B=0;B=n.length<=.5*c?1:Math.ceil(n.paddedLength/aa)+1;for(let C=0;C0){a.transformMat4$1(b,b,d);let i=!1;this.fogState&&g&&(i=function(d,e,f,g,h,b){const i=b.calculateFogTileMatrix(h),c=[e,f,g];return a.transformMat4(c,c,i),Q(d,c,b.pitch,b._fov)}(this.fogState,e,f,c||0,g.toUnwrapped(),this.transform)>.9),h=b[2]>b[3]||i}else aP(b,b,d);return{point:new a.pointGeometry((b[0]/b[3]+1)/2*this.transform.width+100,(-b[1]/b[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/b[3]*.5,1.5),signedDistanceFromCamera:b[3],aboveHorizon:h}}isOffscreen(a,b,c,d){return c<100||a>=this.screenRightBoundary||d<100||b>this.screenBottomBoundary}isInsideGrid(a,b,c,d){return c>=0&&a=0&&ba.collisionGroupID===b}}return this.collisionGroups[a]}}(e),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(h,d,b,q){const c=b.getBucket(d),i=b.latestFeatureIndex;if(!c||!i||d.id!==c.layerIds[0])return;const e=c.layers[0].layout,r=b.collisionBoxArray,s=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),t=b.tileSize/a.EXTENT,j=b.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(j),g="map"===e.get("text-pitch-alignment"),k="map"===e.get("text-rotation-alignment");d.compileFilter();const l=d.dynamicFilter(),u=d.dynamicFilterNeedsFeature(),m=this.transform.calculatePixelsToTileUnitsMatrix(b),v=aB(f,b.tileID.canonical,g,k,this.transform,m);let n=null;if(g){const w=aC(f,b.tileID.canonical,g,k,this.transform,m);n=a.multiply$1([],this.transform.labelPlaneMatrix,w)}let o=null;l&&b.latestFeatureIndex&&(o={unwrappedTileID:j,dynamicFilter:l,dynamicFilterNeedsFeature:u,featureIndex:b.latestFeatureIndex}),this.retainedQueryData[c.bucketInstanceId]=new aU(c.bucketInstanceId,i,c.sourceLayerIndex,c.index,b.tileID);const p={bucket:c,layout:e,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:n,clippingData:o,scale:s,textPixelRatio:t,holdingForFade:b.holdingForFade(),collisionBoxArray:r,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(c.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.evaluateSizeForZoom(c.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(q)for(const x of c.sortKeyRanges){const{sortKey:y,symbolInstanceStart:z,symbolInstanceEnd:A}=x;h.push({sortKey:y,symbolInstanceStart:z,symbolInstanceEnd:A,parameters:p})}else h.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:p})}attemptAnchorPlacement(d,s,g,h,e,i,j,k,l,m,n,a,t,c,f,o,v,u){const p=[a.textOffset0,a.textOffset1],b=aV(d,g,h,p,e),q=this.collisionIndex.placeCollisionBox(e,s,aW(b.x,b.y,i,j,this.transform.angle),n,k,l,m.predicate);if((!o||0!==this.collisionIndex.placeCollisionBox(c.getSymbolInstanceIconSize(u,this.transform.zoom,t),o,aW(b.x,b.y,i,j,this.transform.angle),n,k,l,m.predicate).box.length)&&q.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[a.crossTileID]&&this.prevPlacement.placements[a.crossTileID]&&this.prevPlacement.placements[a.crossTileID].text&&(r=this.prevPlacement.variableOffsets[a.crossTileID].anchor),this.variableOffsets[a.crossTileID]={textOffset:p,width:g,height:h,anchor:d,textScale:e,prevAnchor:r},this.markUsedJustification(c,d,a,f),c.allowVerticalPlacement&&(this.markUsedOrientation(c,f,a),this.placedOrientations[a.crossTileID]=f),{shift:b,placedGlyphBoxes:q}}}placeLayerBucketPart(e,t,i,o){const{bucket:b,layout:c,posMatrix:p,textLabelPlaneMatrix:u,labelToScreenMatrix:v,clippingData:w,textPixelRatio:x,holdingForFade:y,collisionBoxArray:f,partiallyEvaluatedTextSize:z,partiallyEvaluatedIconSize:A,collisionGroup:B}=e.parameters,q=c.get("text-optional"),r=c.get("icon-optional"),j=c.get("text-allow-overlap"),k=c.get("icon-allow-overlap"),C="map"===c.get("text-rotation-alignment"),D="map"===c.get("text-pitch-alignment"),E="none"!==c.get("icon-text-fit"),s="viewport-y"===c.get("symbol-z-order"),F=j&&(k||!b.hasIconData()||r),G=k&&(j||!b.hasTextData()||q);!b.collisionArrays&&f&&b.deserializeCollisionBoxes(f),i&&o&&b.updateCollisionDebugBuffers(this.transform.zoom,f);const l=(d,ac,f)=>{if(w){const $={zoom:this.transform.zoom,pitch:this.transform.pitch};let N=null;if(w.dynamicFilterNeedsFeature){const O=this.retainedQueryData[b.bucketInstanceId];N=w.featureIndex.loadFeature({featureIndex:d.featureIndex,bucketIndex:O.bucketIndex,sourceLayerIndex:O.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,w.dynamicFilter)($,N,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new a.pointGeometry(d.tileAnchorX,d.tileAnchorY),this.transform.calculateDistanceTileData(w.unwrappedTileID)))return this.placements[d.crossTileID]=new aS(!1,!1,!1,!0),void(t[d.crossTileID]=!0)}if(t[d.crossTileID])return;if(y)return void(this.placements[d.crossTileID]=new aS(!1,!1,!1));let e=!1,l=!1,n=!0,ad=null,h={box:null,offscreen:null},s={box:null,offscreen:null},m=null,g=null,H=null,J=0,K=0,P=0;f.textFeatureIndex?J=f.textFeatureIndex:d.useRuntimeCollisionCircles&&(J=d.featureIndex),f.verticalTextFeatureIndex&&(K=f.verticalTextFeatureIndex);const _=a=>{a.tileID=this.retainedQueryData[b.bucketInstanceId].tileID,(this.transform.elevation||a.elevation)&&(a.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[b.bucketInstanceId].tileID,a.tileAnchorX,a.tileAnchorY):0)},Q=f.textBox;if(Q){_(Q);const R=f=>{let c=a.WritingMode.horizontal;if(b.allowVerticalPlacement&&!f&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[d.crossTileID];e&&(this.placedOrientations[d.crossTileID]=e,c=e,this.markUsedOrientation(b,c,d))}return c},S=(c,e)=>{if(b.allowVerticalPlacement&&d.numVerticalGlyphVertices>0&&f.verticalTextBox){for(const g of b.writingModes)if(g===a.WritingMode.vertical?s=h=e():h=c(),h&&h.box&&h.box.length)break}else h=c()};if(c.get("text-variable-anchor")){let L=c.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]){const T=this.prevPlacement.variableOffsets[d.crossTileID];L.indexOf(T.anchor)>0&&(L=L.filter(a=>a!==T.anchor)).unshift(T.anchor)}const ae=(a,l,m)=>{const g=b.getSymbolInstanceTextSize(z,d,this.transform.zoom,ac),n=(a.x2-a.x1)*g+2*a.padding,o=(a.y2-a.y1)*g+2*a.padding,h=E&&!k?l:null;h&&_(h);let c={box:[],offscreen:!1};const q=j?2*L.length:L.length;for(let f=0;f=L.length,d,ac,b,m,h,z,A);if(i&&(c=i.placedGlyphBoxes)&&c.box&&c.box.length){e=!0,ad=i.shift;break}}return c};S(()=>ae(Q,f.iconBox,a.WritingMode.horizontal),()=>{const c=f.verticalTextBox;return c&&_(c),b.allowVerticalPlacement&&!(h&&h.box&&h.box.length)&&d.numVerticalGlyphVertices>0&&c?ae(c,f.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),h&&(e=h.box,n=h.offscreen);const aa=R(h&&h.box);if(!e&&this.prevPlacement){const M=this.prevPlacement.variableOffsets[d.crossTileID];M&&(this.variableOffsets[d.crossTileID]=M,this.markUsedJustification(b,M.anchor,d,aa))}}else{const af=(f,e)=>{const g=b.getSymbolInstanceTextSize(z,d,this.transform.zoom,ac),c=this.collisionIndex.placeCollisionBox(g,f,new a.pointGeometry(0,0),j,x,p,B.predicate);return c&&c.box&&c.box.length&&(this.markUsedOrientation(b,e,d),this.placedOrientations[d.crossTileID]=e),c};S(()=>af(Q,a.WritingMode.horizontal),()=>{const c=f.verticalTextBox;return b.allowVerticalPlacement&&d.numVerticalGlyphVertices>0&&c?(_(c),af(c,a.WritingMode.vertical)):{box:null,offscreen:null}}),R(h&&h.box&&h.box.length)}}if(e=(m=h)&&m.box&&m.box.length>0,n=m&&m.offscreen,d.useRuntimeCollisionCircles){const U=b.text.placedSymbolArray.get(d.centerJustifiedTextSymbolIndex>=0?d.centerJustifiedTextSymbolIndex:d.verticalPlacedTextSymbolIndex),V=a.evaluateSizeForFeature(b.textSizeData,z,U),ab=c.get("text-padding");g=this.collisionIndex.placeCollisionCircles(j,U,b.lineVertexArray,b.glyphOffsetArray,V,p,u,v,i,D,B.predicate,d.collisionCircleDiameter*V/a.ONE_EM,ab,this.retainedQueryData[b.bucketInstanceId].tileID),e=j||g.circles.length>0&&!g.collisionDetected,n=n&&g.offscreen}if(f.iconFeatureIndex&&(P=f.iconFeatureIndex),f.iconBox){const W=c=>{_(c);const d=E&&ad?aW(ad.x,ad.y,C,D,this.transform.angle):new a.pointGeometry(0,0),e=b.getSymbolInstanceIconSize(A,this.transform.zoom,ac);return this.collisionIndex.placeCollisionBox(e,c,d,k,x,p,B.predicate)};l=s&&s.box&&s.box.length&&f.verticalIconBox?(H=W(f.verticalIconBox)).box.length>0:(H=W(f.iconBox)).box.length>0,n=n&&H.offscreen}const X=q||0===d.numHorizontalGlyphVertices&&0===d.numVerticalGlyphVertices,Y=r||0===d.numIconVertices;if(X||Y?Y?X||(l=l&&e):e=l&&e:l=e=l&&e,e&&m&&m.box&&this.collisionIndex.insertCollisionBox(m.box,c.get("text-ignore-placement"),b.bucketInstanceId,s&&s.box&&K?K:J,B.ID),l&&H&&this.collisionIndex.insertCollisionBox(H.box,c.get("icon-ignore-placement"),b.bucketInstanceId,P,B.ID),g&&(e&&this.collisionIndex.insertCollisionCircles(g.circles,c.get("text-ignore-placement"),b.bucketInstanceId,J,B.ID),i)){const Z=b.bucketInstanceId;let o=this.collisionCircleArrays[Z];void 0===o&&(o=this.collisionCircleArrays[Z]=new aT);for(let I=0;I=0;--g){const h=m[g];l(b.symbolInstances.get(h),h,b.collisionArrays[h])}}else for(let d=e.symbolInstanceStart;d=0&&(e.text.placedSymbolArray.get(d).crossTileID=c>=0&&d!==c?0:b.crossTileID)}markUsedOrientation(d,b,c){const e=b===a.WritingMode.horizontal||b===a.WritingMode.horizontalOnly?b:0,f=b===a.WritingMode.vertical?b:0,g=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,];for(const h of g)d.text.placedSymbolArray.get(h).placedOrientation=e;c.verticalPlacedTextSymbolIndex&&(d.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(f){this.commitTime=f,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let c=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const i=a?a.symbolFadeChange(f):1,j=a?a.opacities:{},m=a?a.variableOffsets:{},n=a?a.placedOrientations:{};for(const g in this.placements){const b=this.placements[g],h=j[g];h?(this.opacities[g]=new aR(h,i,b.text,b.icon,null,b.clipped),c=c||b.text!==h.text.placed||b.icon!==h.icon.placed):(this.opacities[g]=new aR(null,i,b.text,b.icon,b.skipFade,b.clipped),c=c||b.text||b.icon)}for(const k in j){const l=j[k];if(!this.opacities[k]){const o=new aR(l,i,!1,!1);o.isHidden()||(this.opacities[k]=o,c=c||l.text.placed||l.icon.placed)}}for(const d in m)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=m[d]);for(const e in n)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=n[e]);c?this.lastPlacementChangeTime=f:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:f)}updateLayerOpacities(c,d){const e={};for(const a of d){const b=a.getBucket(c);b&&a.latestFeatureIndex&&c.id===b.layerIds[0]&&this.updateBucketOpacities(b,e,a.collisionBoxArray)}}updateBucketOpacities(b,s,t){b.hasTextData()&&b.text.opacityVertexArray.clear(),b.hasIconData()&&b.icon.opacityVertexArray.clear(),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexArray.clear(),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexArray.clear();const f=b.layers[0].layout,F=!!b.layers[0].dynamicFilter(),G=new aR(null,0,!1,!1,!0),u=f.get("text-allow-overlap"),v=f.get("icon-allow-overlap"),H=f.get("text-variable-anchor"),I="map"===f.get("text-rotation-alignment"),J="map"===f.get("text-pitch-alignment"),l="none"!==f.get("icon-text-fit"),K=new aR(null,0,u&&(v||!b.hasIconData()||f.get("icon-optional")),v&&(u||!b.hasTextData()||f.get("text-optional")),!0);!b.collisionArrays&&t&&(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData())&&b.deserializeCollisionBoxes(t);const m=(b,c,d)=>{for(let a=0;a0||y>0,A=c.numIconVertices>0,o=this.placedOrientations[c.crossTileID],p=o===a.WritingMode.vertical,j=o===a.WritingMode.horizontal||o===a.WritingMode.horizontalOnly;if(!z&&!A||d.isHidden()||w++,z){const B=aY(d.text);m(b.text,x,p?0:B),m(b.text,y,j?0:B);const L=d.text.isHidden();[c.rightJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.leftJustifiedTextSymbolIndex,].forEach(a=>{a>=0&&(b.text.placedSymbolArray.get(a).hidden=L||p?1:0)}),c.verticalPlacedTextSymbolIndex>=0&&(b.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).hidden=L||j?1:0);const C=this.variableOffsets[c.crossTileID];C&&this.markUsedJustification(b,C.anchor,c,o);const q=this.placedOrientations[c.crossTileID];q&&(this.markUsedJustification(b,"left",c,q),this.markUsedOrientation(b,q,c))}if(A){const D=aY(d.icon);c.placedIconSymbolIndex>=0&&(m(b.icon,c.numIconVertices,p?0:D),b.icon.placedSymbolArray.get(c.placedIconSymbolIndex).hidden=d.icon.isHidden()),c.verticalPlacedIconSymbolIndex>=0&&(m(b.icon,c.numVerticalIconVertices,j?0:D),b.icon.placedSymbolArray.get(c.verticalPlacedIconSymbolIndex).hidden=d.icon.isHidden())}if(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData()){const g=b.collisionArrays[n];if(g){let e=new a.pointGeometry(0,0),k=!0;if(g.textBox||g.verticalTextBox){if(H){const h=this.variableOffsets[i];h?(e=aV(h.anchor,h.width,h.height,h.textOffset,h.textScale),I&&e._rotate(J?this.transform.angle:-this.transform.angle)):k=!1}F&&(k=!d.clipped),g.textBox&&aX(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||p,e.x,e.y),g.verticalTextBox&&aX(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||j,e.x,e.y)}const E=k&&Boolean(!j&&g.verticalIconBox);g.iconBox&&aX(b.iconCollisionBox.collisionVertexArray,d.icon.placed,E,l?e.x:0,l?e.y:0),g.verticalIconBox&&aX(b.iconCollisionBox.collisionVertexArray,d.icon.placed,!E,l?e.x:0,l?e.y:0)}}}if(b.fullyClipped=0===w,b.sortFeatures(this.transform.angle),this.retainedQueryData[b.bucketInstanceId]&&(this.retainedQueryData[b.bucketInstanceId].featureSortOrder=b.featureSortOrder),b.hasTextData()&&b.text.opacityVertexBuffer&&b.text.opacityVertexBuffer.updateData(b.text.opacityVertexArray),b.hasIconData()&&b.icon.opacityVertexBuffer&&b.icon.opacityVertexBuffer.updateData(b.icon.opacityVertexArray),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexBuffer&&b.iconCollisionBox.collisionVertexBuffer.updateData(b.iconCollisionBox.collisionVertexArray),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexBuffer&&b.textCollisionBox.collisionVertexBuffer.updateData(b.textCollisionBox.collisionVertexArray),b.bucketInstanceId in this.collisionCircleArrays){const r=this.collisionCircleArrays[b.bucketInstanceId];b.placementInvProjMatrix=r.invProjMatrix,b.placementViewportMatrix=r.viewportMatrix,b.collisionCircleArray=r.circles,delete this.collisionCircleArrays[b.bucketInstanceId]}}symbolFadeChange(a){return 0===this.fadeDuration?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimeb}setStale(){this.stale=!0}}(b,f,g,h,i),this._currentPlacementIndex=c.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=e,this._done=!1}isDone(){return this._done}continuePlacement(d,e,f){const h=a.exported.now(),g=()=>{const b=a.exported.now()-h;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const b=e[d[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===b.type&&(!b.minzoom||b.minzoom<=c)&&(!b.maxzoom||b.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new aZ(b)),this._inProgressLayer.continuePlacement(f[b.source],this.placement,this._showCollisionBoxes,b,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const a_=512/a.EXTENT/2;class a0{constructor(d,e,f){this.tileID=d,this.indexedSymbolInstances={},this.bucketInstanceId=f;for(let a=0;aa.overscaledZ)for(const l in f){const i=f[l];i.tileID.isChildOf(a)&&i.findMatches(b.symbolInstances,a,d)}else{const j=f[a.scaledTo(Number(e)).key];j&&j.findMatches(b.symbolInstances,a,d)}}for(let g=0;g{c[a]=!0}),this.layerIndexes)c[a]||delete this.layerIndexes[a]}}const a3=(c,b)=>a.emitValidationErrors(c,b&&b.filter(a=>"source.canvas"!==a.identifier)),a4=a.pick(i,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),a5=a.pick(i,["setCenter","setZoom","setBearing","setPitch",]),a6=function(){const c={},f=a.spec.$version;for(const b in a.spec.$root){const d=a.spec.$root[b];if(d.required){let e=null;null!=(e="version"===b?f:"array"===d.type?[]:{})&&(c[b]=e)}}return c}(),a7={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class c extends a.Evented{constructor(d,b={}){super(),this.map=d,this.dispatcher=new n(ao(),this),this.imageManager=new J,this.imageManager.setEventedParent(this),this.glyphManager=new a.GlyphManager(d._requestManager,b.localFontFamily?a.LocalGlyphMode.all:b.localIdeographFontFamily?a.LocalGlyphMode.ideographs:a.LocalGlyphMode.none,b.localFontFamily||b.localIdeographFontFamily),this.lineAtlas=new a.LineAtlas(256,512),this.crossTileSymbolIndex=new a2,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const e=this;this._rtlTextPluginCallback=c.registerForPluginStateChange(b=>{e.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(f,b)=>{if(a.triggerPluginCompletionEvent(f),b&&b.every(a=>a))for(const g in e._sourceCaches){const c=e._sourceCaches[g],d=c.getSource().type;"vector"!==d&&"geojson"!==d||c.reload()}})}),this.on("data",a=>{if("source"!==a.dataType||"metadata"!==a.sourceDataType)return;const b=this.getSource(a.sourceId);if(b&&b.vectorLayerIds)for(const d in this._layers){const c=this._layers[d];c.source===b.id&&this._validateLayer(c)}})}loadURL(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const e="boolean"==typeof c.validate?c.validate:!a.isMapboxURL(b);b=this.map._requestManager.normalizeStyleURL(b,c.accessToken);const d=this.map._requestManager.transformRequest(b,a.ResourceType.Style);this._request=a.getJSON(d,(b,c)=>{this._request=null,b?this.fire(new a.ErrorEvent(b)):c&&this._load(c,e)})}loadJSON(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(b,!1!==c.validate)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(a6,!1)}_updateLayerCount(a,c){const b=c?1:-1;a.is3D()&&(this._num3DLayers+=b),"circle"===a.type&&(this._numCircleLayers+=b),"symbol"===a.type&&(this._numSymbolLayers+=b)}_load(c,f){if(f&&a3(this,a.validateStyle(c)))return;for(const d in this._loaded=!0,this.stylesheet=c,this.updateProjection(),c.sources)this.addSource(d,c.sources[d],{validate:!1});this._changed=!1,c.sprite?this._loadSprite(c.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(c.glyphs);const e=aq(this.stylesheet.layers);for(let b of(this._order=e.map(a=>a.id),this._layers={},this._serializedLayers={},e))(b=a.createStyleLayer(b)).setEventedParent(this,{layer:{id:b.id}}),this._layers[b.id]=b,this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new M(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const b=this.map.transform.projection,c=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),a=this.map.transform.projection;if(this._loaded&&(a.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),c){if(a.isReprojectedInTileSpace||b.isReprojectedInTileSpace)for(const d in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[d].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(b){this._spriteRequest=function(c,b,e){let f,g,h;const d=a.exported.devicePixelRatio>1?"@2x":"";let i=a.getJSON(b.transformRequest(b.normalizeSpriteURL(c,d,".json"),a.ResourceType.SpriteJSON),(a,b)=>{i=null,h||(h=a,f=b,k())}),j=a.getImage(b.transformRequest(b.normalizeSpriteURL(c,d,".png"),a.ResourceType.SpriteImage),(a,b)=>{j=null,h||(h=a,g=b,k())});function k(){if(h)e(h);else if(f&&g){const k=a.exported.getImageData(g),b={};for(const c in f){const{width:d,height:i,x:l,y:m,sdf:n,pixelRatio:o,stretchX:p,stretchY:q,content:r}=f[c],j=new a.RGBAImage({width:d,height:i});a.RGBAImage.copy(k,j,{x:l,y:m},{x:0,y:0},{width:d,height:i}),b[c]={data:j,pixelRatio:o,sdf:n,stretchX:p,stretchY:q,content:r}}e(null,b)}}return{cancel(){i&&(i.cancel(),i=null),j&&(j.cancel(),j=null)}}}(b,this.map._requestManager,(c,b)=>{if(this._spriteRequest=null,c)this.fire(new a.ErrorEvent(c));else if(b)for(const d in b)this.imageManager.addImage(d,b[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(c){const b=this.getSource(c.source);if(!b)return;const d=c.sourceLayer;d&&("geojson"===b.type||b.vectorLayerIds&& -1===b.vectorLayerIds.indexOf(d))&&this.fire(new a.ErrorEvent(Error(`Source layer "${d}" does not exist on source "${b.id}" as specified by style layer "${c.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(c){const a=[];for(const d of c){const b=this._layers[d];"custom"!==b.type&&a.push(b.serialize())}return a}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const b in this._layers)if(this._layers[b].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&a7[a.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(b){if(!this._loaded)return;const p=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);for(const d in(g.length||h.length)&&this._updateWorkerLayers(g,h),this._updatedSources){const i=this._updatedSources[d];"reload"===i?this._reloadSource(d):"clear"===i&&this._clearSource(d)}for(const q in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[q].updateTransitions(b);this.light.updateTransitions(b),this.fog&&this.fog.updateTransitions(b),this._resetUpdates()}const e={};for(const j in this._sourceCaches){const k=this._sourceCaches[j];e[j]=k.used,k.used=!1}for(const r of this._order){const c=this._layers[r];if(c.recalculate(b,this._availableImages),!c.isHidden(b.zoom)){const l=this._getLayerSourceCache(c);l&&(l.used=!0)}const m=this.map.painter;if(m){const n=c.getProgramIds();if(!n)continue;const s=c.getProgramConfiguration(b.zoom);for(const t of n)m.useProgram(t,s)}}for(const o in e){const f=this._sourceCaches[o];e[o]!==f.used&&f.getSource().fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:f.getSource().id}))}this.light.recalculate(b),this.terrain&&this.terrain.recalculate(b),this.fog&&this.fog.recalculate(b),this.z=b.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),p&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const b in this._sourceCaches)this._sourceCaches[b].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,b){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:b})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(b){if(this._checkLoaded(),a3(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=aq(b.layers);const c=(function(c,a){if(!c)return[{command:i.setStyle,args:[a]},];let b=[];try{if(!D(c.version,a.version))return[{command:i.setStyle,args:[a]},];D(c.center,a.center)||b.push({command:i.setCenter,args:[a.center]}),D(c.zoom,a.zoom)||b.push({command:i.setZoom,args:[a.zoom]}),D(c.bearing,a.bearing)||b.push({command:i.setBearing,args:[a.bearing]}),D(c.pitch,a.pitch)||b.push({command:i.setPitch,args:[a.pitch]}),D(c.sprite,a.sprite)||b.push({command:i.setSprite,args:[a.sprite]}),D(c.glyphs,a.glyphs)||b.push({command:i.setGlyphs,args:[a.glyphs]}),D(c.transition,a.transition)||b.push({command:i.setTransition,args:[a.transition]}),D(c.light,a.light)||b.push({command:i.setLight,args:[a.light]}),D(c.fog,a.fog)||b.push({command:i.setFog,args:[a.fog]}),D(c.projection,a.projection)||b.push({command:i.setProjection,args:[a.projection]});const e={},f=[];!function(c,b,d,e){let a;for(a in b=b||{},c=c||{})c.hasOwnProperty(a)&&(b.hasOwnProperty(a)||as(a,d,e));for(a in b)b.hasOwnProperty(a)&&(c.hasOwnProperty(a)?D(c[a],b[a])||("geojson"===c[a].type&&"geojson"===b[a].type&&au(c,b,a)?d.push({command:i.setGeoJSONSourceData,args:[a,b[a].data,]}):at(a,b,d,e)):ar(a,b,d))}(c.sources,a.sources,f,e);const g=[];c.layers&&c.layers.forEach(a=>{e[a.source]?b.push({command:i.removeLayer,args:[a.id]}):g.push(a)});let d=c.terrain;d&&e[d.source]&&(b.push({command:i.setTerrain,args:[void 0]}),d=void 0),b=b.concat(f),D(d,a.terrain)||b.push({command:i.setTerrain,args:[a.terrain]}),function(m,k,f){k=k||[];const n=(m=m||[]).map(aw),j=k.map(aw),p=m.reduce(ax,{}),o=k.reduce(ax,{}),g=n.slice(),q=Object.create(null);let e,h,b,d,c,l,a;for(e=0,h=0;e!(a.command in a5));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in a4));if(d.length>0)throw Error(`Unimplemented: ${d.map(a=>a.command).join(", ")}.`);return c.forEach(a=>{"setTransition"!==a.command&&this[a.command].apply(this,a.args)}),this.stylesheet=b,this.updateProjection(),!0}addImage(b,c){if(this.getImage(b))return this.fire(new a.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(b,c),this._afterImageUpdated(b)}updateImage(a,b){this.imageManager.updateImage(a,b)}getImage(a){return this.imageManager.getImage(a)}removeImage(b){if(!this.getImage(b))return this.fire(new a.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(b),this._afterImageUpdated(b)}_afterImageUpdated(b){this._availableImages=this.imageManager.listImages(),this._changedImages[b]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(c,b,f={}){if(this._checkLoaded(),void 0!==this.getSource(c))throw Error("There is already a source with this ID");if(!b.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(b).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(b.type)>=0&&this._validate(a.validateStyle.source,`sources.${c}`,b,null,f))return;this.map&&this.map._collectResourceTiming&&(b.collectResourceTiming=!0);const d=ag(c,b,this.dispatcher,this);d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:c}));const e=b=>{const f=(b?"symbol:":"other:")+c,e=this._sourceCaches[f]=new a.SourceCache(f,d,b);(b?this._symbolSourceCaches:this._otherSourceCaches)[c]=e,e.style=this,e.onAdd(this.map)};e(!1),"vector"!==b.type&&"geojson"!==b.type||e(!0),d.onAdd&&d.onAdd(this.map),this._changed=!0}removeSource(b){this._checkLoaded();const d=this.getSource(b);if(void 0===d)throw Error("There is no source with this ID");for(const e in this._layers)if(this._layers[e].source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while layer "${e}" is using it.`)));if(this.terrain&&this.terrain.get().source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while terrain is using it.`)));const f=this._getSourceCaches(b);for(const c of f)delete this._sourceCaches[c.id],delete this._updatedSources[c.id],c.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:c.getSource().id})),c.setEventedParent(null),c.clearTiles();delete this._otherSourceCaches[b],delete this._symbolSourceCaches[b],d.setEventedParent(null),d.onRemove&&d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,b){this._checkLoaded(),this.getSource(a).setData(b),this._changed=!0}getSource(b){const a=this._getSourceCache(b);return a&&a.getSource()}addLayer(c,e,h={}){this._checkLoaded();const d=c.id;if(this.getLayer(d))return void this.fire(new a.ErrorEvent(Error(`Layer with id "${d}" already exists on this map`)));let b;if("custom"===c.type){if(a3(this,a.validateCustomStyleLayer(c)))return;b=a.createStyleLayer(c)}else{if("object"==typeof c.source&&(this.addSource(d,c.source),c=a.clone$1(c),c=a.extend(c,{source:d})),this._validate(a.validateStyle.layer,`layers.${d}`,c,{arrayIndex:-1},h))return;b=a.createStyleLayer(c),this._validateLayer(b),b.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}const f=e?this._order.indexOf(e):this._order.length;if(e&& -1===f)return void this.fire(new a.ErrorEvent(Error(`Layer with id "${e}" does not exist on this map.`)));this._order.splice(f,0,d),this._layerOrderChanged=!0,this._layers[d]=b;const g=this._getLayerSourceCache(b);if(this._removedLayers[d]&&b.source&&g&&"custom"!==b.type){const i=this._removedLayers[d];delete this._removedLayers[d],i.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",g.pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(b,c){if(this._checkLoaded(),this._changed=!0,!this._layers[b])return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be moved.`)));if(b===c)return;const e=this._order.indexOf(b);this._order.splice(e,1);const d=c?this._order.indexOf(c):this._order.length;c&& -1===d?this.fire(new a.ErrorEvent(Error(`Layer with id "${c}" does not exist on this map.`))):(this._order.splice(d,0,b),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(b){this._checkLoaded();const c=this._layers[b];if(!c)return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be removed.`)));c.setEventedParent(null),this._updateLayerCount(c,!1);const d=this._order.indexOf(b);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[b]=c,delete this._layers[b],delete this._serializedLayers[b],delete this._updatedLayers[b],delete this._updatedPaintProps[b],c.onRemove&&c.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const b in this._layers)if(this._layers[b].type===a)return!0;return!1}setLayerZoomRange(e,c,d){this._checkLoaded();const b=this.getLayer(e);b?b.minzoom===c&&b.maxzoom===d||(null!=c&&(b.minzoom=c),null!=d&&(b.maxzoom=d),this._updateLayer(b)):this.fire(new a.ErrorEvent(Error(`The layer '${e}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(d,c,e={}){this._checkLoaded();const b=this.getLayer(d);if(b){if(!D(b.filter,c))return null==c?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(a.validateStyle.filter,`layers.${b.id}.filter`,c,{layerType:b.type},e)||(b.filter=a.clone$1(c),this._updateLayer(b)))}else this.fire(new a.ErrorEvent(Error(`The layer '${d}' does not exist in the map's style and cannot be filtered.`)))}getFilter(b){return a.clone$1(this.getLayer(b).filter)}setLayoutProperty(c,d,e,f={}){this._checkLoaded();const b=this.getLayer(c);b?D(b.getLayoutProperty(d),e)||(b.setLayoutProperty(d,e,f),this._updateLayer(b)):this.fire(new a.ErrorEvent(Error(`The layer '${c}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(b,d){const c=this.getLayer(b);if(c)return c.getLayoutProperty(d);this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style.`)))}setPaintProperty(c,d,e,f={}){this._checkLoaded();const b=this.getLayer(c);b?D(b.getPaintProperty(d),e)||(b.setPaintProperty(d,e,f)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[c]=!0):this.fire(new a.ErrorEvent(Error(`The layer '${c}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,b){return this.getLayer(a).getPaintProperty(b)}setFeatureState(b,g){this._checkLoaded();const c=b.source,d=b.sourceLayer,e=this.getSource(c);if(void 0===e)return void this.fire(new a.ErrorEvent(Error(`The source '${c}' does not exist in the map's style.`)));const f=e.type;if("geojson"===f&&d)return void this.fire(new a.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===f&&!d)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided.")));const h=this._getSourceCaches(c);for(const i of h)i.setFeatureState(d,b.id,g)}removeFeatureState(b,d){this._checkLoaded();const c=b.source,e=this.getSource(c);if(void 0===e)return void this.fire(new a.ErrorEvent(Error(`The source '${c}' does not exist in the map's style.`)));const f=e.type,g="vector"===f?b.sourceLayer:void 0;if("vector"===f&&!g)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(d&&"string"!=typeof b.id&&"number"!=typeof b.id)return void this.fire(new a.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const h=this._getSourceCaches(c);for(const i of h)i.removeFeatureState(g,b.id,d)}getFeatureState(b){this._checkLoaded();const c=b.source,d=b.sourceLayer,e=this.getSource(c);if(void 0!==e){if("vector"!==e.type||d)return void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(c)[0].getFeatureState(d,b.id);this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new a.ErrorEvent(Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const b={};for(const d in this._sourceCaches){const c=this._sourceCaches[d].getSource();b[c.id]||(b[c.id]=c.serialize())}return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:b,layers:this._serializeLayers(this._order)},a=>void 0!==a)}_updateLayer(a){this._updatedLayers[a.id]=!0;const b=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&b&&"raster"!==b.getSource().type&&(this._updatedSources[a.source]="reload",b.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(g){var h,i;const j={},a=[];for(let b=this._order.length-1;b>=0;b--){const d=this._order[b];if(h=d,"fill-extrusion"===this._layers[h].type)for(const o of(j[d]=b,g)){const k=o[d];if(k)for(const p of k)a.push(p)}}a.sort((a,b)=>b.intersectionZ-a.intersectionZ);const e=[];for(let c=this._order.length-1;c>=0;c--){const l=this._order[c];if(i=l,"fill-extrusion"===this._layers[i].type)for(let f=a.length-1;f>=0;f--){const m=a[f].feature;if(j[m.layer.id]{const a=this.getLayer(b);return a&&a.is3D()}):this.has3DLayers(),h=_.createFromScreenPoints(j,d);for(const i in this._sourceCaches){const l=this._sourceCaches[i].getSource().id;b.layers&&!e[l]||c.push(ai(this._sourceCaches[i],this._layers,this._serializedLayers,h,b,d,k,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,j,r,k,c,l,m){const a={},f=l.queryRenderedSymbols(k),d=[];for(const n of Object.keys(f).map(Number))d.push(m[n]);for(const b of(d.sort(ak),d)){const g=b.featureIndex.lookupSymbolFeatures(f[b.bucketInstanceId],j,b.bucketIndex,b.sourceLayerIndex,c.filter,c.layers,c.availableImages,i);for(const e in g){const o=a[e]=a[e]||[],h=g[e];for(const p of(h.sort((c,d)=>{const a=b.featureSortOrder;if(a){const e=a.indexOf(c.featureIndex);return a.indexOf(d.featureIndex)-e}return d.featureIndex-c.featureIndex}),h))o.push(p)}}for(const q in a)a[q].forEach(b=>{const a=b.feature,c=r(i[q]).getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=c});return a}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),h.screenGeometry,b,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(d,b){b&&b.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",b.filter,null,b);const e=this._getSourceCaches(d);let c=[];for(const f of e)c=c.concat(aj(f,b));return c}addSourceType(a,b,d){return c.getSourceType(a)?d(Error(`A source type called "${a}" already exists.`)):(c.setSourceType(a,b),b.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:b.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(b,e={}){this._checkLoaded();const f=this.light.getLight();let c=!1;for(const d in b)if(!D(b[d],f[d])){c=!0;break}if(!c)return;const g={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(b,e),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(b,c=1){if(this._checkLoaded(),!b)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===c){if("object"==typeof b.source){const e="terrain-dem-src";this.addSource(e,b.source),b=a.clone$1(b),b=a.extend(b,{source:e})}if(this._validate(a.validateStyle.terrain,"terrain",b))return}if(!this.terrain||this.terrain&&c!==this.terrain.drapeRenderMode)this._createTerrain(b,c);else{const d=this.terrain,g=d.get();for(const f in b)if(!D(b[f],g[f])){d.set(b),this.stylesheet.terrain=b;const h={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(h);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(b){const c=this.fog=new U(b,this.map.transform);this.stylesheet.fog=b;const d={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(d)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(b){if(this._checkLoaded(),!b)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const c=this.fog,e=c.get();for(const d in b)if(!D(b[d],e[d])){c.set(b),this.stylesheet.fog=b;const f={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(f);break}}else this._createFog(b);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(a=>this.isLayerDraped(this._layers[a])),b=this._order.filter(a=>!this.isLayerDraped(this._layers[a]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...b)}_createTerrain(b,c){const d=this.terrain=new P(b,c);this.stylesheet.terrain=b,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const e={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(e)}_force3DLayerUpdate(){for(const b in this._layers){const a=this._layers[b];"fill-extrusion"===a.type&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const b in this._layers){const a=this._layers[b];"symbol"===a.type&&this._updateLayer(a)}}_validate(c,d,e,f,b={}){return(!b|| !1!==b.validate)&&a3(this,c.call(a.validateStyle,a.extend({key:d,style:this.serialize(),value:e,styleSpec:a.spec},f)))}_remove(){for(const c in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[c].setEventedParent(null);for(const b in this._sourceCaches)this._sourceCaches[b].clearTiles(),this._sourceCaches[b].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const b=this._getSourceCaches(a);for(const c of b)c.clearTiles()}_reloadSource(b){const c=this._getSourceCaches(b);for(const a of c)a.resume(),a.reload()}_updateSources(a){for(const b in this._sourceCaches)this._sourceCaches[b].update(a)}_generateCollisionBoxes(){for(const b in this._sourceCaches){const a=this._sourceCaches[b];a.resume(),a.reload()}}_updatePlacement(c,k,h,l,e=!1){let f=!1,i=!1;const d={};for(const m of this._order){const b=this._layers[m];if("symbol"!==b.type)continue;if(!d[b.source]){const j=this._getLayerSourceCache(b);if(!j)continue;d[b.source]=j.getRenderableIds(!0).map(a=>j.getTileByID(a)).sort((a,b)=>b.tileID.overscaledZ-a.tileID.overscaledZ||(a.tileID.isLessThan(b.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(b,d[b.source],c.center.lng,c.projection);f=f||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),e=e||this._layerOrderChanged||0===h,this._layerOrderChanged&&this.fire(new a.Event("neworder")),(e||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),c.zoom))&&(this.pauseablePlacement=new a$(c,this._order,e,k,h,l,this.placement,this.fog&&c.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,d),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),i=!0),f&&this.pauseablePlacement.placement.setStale()),i||f)for(const o of this._order){const g=this._layers[o];"symbol"===g.type&&this.placement.updateLayerOpacities(g,d[g.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(d,a,c){this.imageManager.getImages(a.icons,c),this._updateTilesForChangedImages();const b=b=>{b&&b.setDependencies(a.tileID.key,a.type,a.icons)};b(this._otherSourceCaches[a.source]),b(this._symbolSourceCaches[a.source])}getGlyphs(c,a,b){this.glyphManager.getGlyphs(a.stacks,b)}getResource(d,b,c){return a.makeRequest(b,c)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return"symbol"===a.type?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const b=[];return this._otherSourceCaches[a]&&b.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&b.push(this._symbolSourceCaches[a]),b}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}c.getSourceType=function(a){return af[a]},c.setSourceType=function(a,b){af[a]=b},c.registerForPluginStateChange=a.registerForPluginStateChange;var t="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}\n#endif",j="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let u={},v={};u=bb("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0),v=bb("#ifdef FOG\nuniform float u_fog_temporal_offset;float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif","#ifdef FOG\nuniform mat4 u_fog_matrix;vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",!0);const a8=bb("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),a9=t;var ba={background:bb("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:bb("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:bb("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 scaled_extrude=extrude*a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=scaled_extrude.x*surface_vectors[0]+scaled_extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:bb("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:bb("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\ngl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nextrude*=a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:bb("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:bb("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:bb("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:bb("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:bb("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:bb("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:bb("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:bb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:bb("varying vec4 v_color;void main() {vec4 color=v_color;\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(pos.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:bb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:bb("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:bb("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:bb("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:bb("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:bb("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:bb("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:bb("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:bb("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:bb("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n}"),terrainDepth:bb("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:bb("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",j),skyboxGradient:bb("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",j),skyboxCapture:bb("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:bb("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:bb("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function bb(c,b,h){const e=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,i=b.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),f=c.match(d),g=b.match(d),j=t.match(d);let a=g?g.concat(f):f;h||(u.staticUniforms&&(a=u.staticUniforms.concat(a)),v.staticUniforms&&(a=v.staticUniforms.concat(a))),a&&(a=a.concat(j));const k={};return{fragmentSource:c=c.replace(e,(e,d,b,c,a)=>(k[a]=!0,"define"===d?` #ifndef HAS_UNIFORM_u_${a} varying ${b} ${c} ${a}; #else @@ -57,4 +57,4 @@ uniform ${b} ${c} u_${a}; `}),staticAttributes:i,staticUniforms:a}}class bc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(f,h,i,b,a,j,c,d){this.context=f;let g=this.boundPaintVertexBuffers.length!==b.length;for(let e=0;!g&&e{const g=b.paint.get("hillshade-shadow-color"),h=b.paint.get("hillshade-highlight-color"),i=b.paint.get("hillshade-accent-color");let e=b.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===b.paint.get("hillshade-illumination-anchor")&&(e-=c.transform.angle);const j=!c.options.moving;return{u_matrix:f||c.transform.calculateProjMatrix(d.tileID.toUnwrapped(),j),u_image:0,u_latrange:function(e,b){const c=Math.pow(2,b.canonical.z),d=b.canonical.y;return[new a.MercatorCoordinate(0,d/c).toLngLat().lat,new a.MercatorCoordinate(0,(d+1)/c).toLngLat().lat,]}(0,d.tileID),u_light:[b.paint.get("hillshade-exaggeration"),e,],u_shadow:g,u_highlight:h,u_accent:i}})(b,f,g,b.terrain?e.projMatrix:null);b.prepareDrawProgram(c,i,e.toUnwrapped());const{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=b.getTileBoundsBuffers(f);i.draw(c,d.TRIANGLES,j,k,l,a.CullFaceMode.disabled,m,g.id,n,o,p)}function be(d,b,e){if(!b.needsDEMTextureUpload)return;const c=d.context,g=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||d.getTileTexture(e.stride);const f=e.getPixels();b.demTexture?b.demTexture.update(f,{premultiply:!1}):b.demTexture=new a.Texture(c,f,g.RGBA,{premultiply:!1}),b.needsDEMTextureUpload=!1}function bf(f,b,j,k,l,m){const c=f.context,d=c.gl;if(!b.dem)return;const g=b.dem;if(c.activeTexture.set(d.TEXTURE1),be(f,b,g),!b.demTexture)return;b.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const e=g.dim;c.activeTexture.set(d.TEXTURE0);let h=b.fbo;if(!h){const i=new a.Texture(c,{width:e,height:e,data:null},d.RGBA);i.bind(d.LINEAR,d.CLAMP_TO_EDGE),(h=b.fbo=c.createFramebuffer(e,e,!0)).colorAttachment.set(i.texture)}c.bindFramebuffer.set(h.framebuffer),c.viewport.set([0,0,e,e]);const{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=f.getMercatorTileBoundsBuffers();f.useProgram("hillshadePrepare").draw(c,d.TRIANGLES,k,l,m,a.CullFaceMode.disabled,((e,c)=>{const d=c.stride,b=a.create();return a.ortho(b,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(b,b,[0,-a.EXTENT,0]),{u_matrix:b,u_image:1,u_dimension:[d,d],u_zoom:e.overscaledZ,u_unpack:c.unpackVector}})(b.tileID,g),j.id,n,o,p),b.needsHillshadePrepare=!1}const k=(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image0:new a.Uniform1i(b,c.u_image0),u_skirt_height:new a.Uniform1f(b,c.u_skirt_height)}),bg=(a,b)=>({u_matrix:a,u_image0:0,u_skirt_height:b}),bh=(a,b,c,d,e)=>({u_proj_matrix:Float32Array.from(a),u_globe_matrix:b,u_merc_matrix:c,u_zoom_transition:d,u_merc_center:e,u_image0:0});function bi(a,b){return null!=a&&null!=b&&!(!a.hasData()||!b.hasData())&&null!=a.demTexture&&null!=b.demTexture&&a.tileID.key!==b.tileID.key}const bj=new class{constructor(){this.operations={}}newMorphing(a,d,b,e,f){if(a in this.operations){const c=this.operations[a];c.to.tileID.key!==b.tileID.key&&(c.queued=b)}else this.operations[a]={startTime:e,phase:0,duration:f,from:d,to:b,queued:null}}getMorphValuesForProxy(b){if(!(b in this.operations))return null;const a=this.operations[b];return{from:a.from,to:a.to,phase:a.phase}}update(b){for(const c in this.operations){const a=this.operations[c];for(a.phase=(b-a.startTime)/a.duration;a.phase>=1||!this._validOp(a);)if(!this._nextOp(a,b)){delete this.operations[c];break}}}_nextOp(a,b){return!!a.queued&&(a.from=a.to,a.to=a.queued,a.queued=null,a.phase=0,a.startTime=b,!0)}_validOp(a){return a.from.hasData()&&a.to.hasData()}},bk={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function bl(a,c){const b=1<({u_matrix:a});function bn(b,c,k,l,d){if(d>0){const e=a.exported.now(),f=(e-b.timeAdded)/d,m=c?(e-c.timeAdded)/d:-1,g=k.getSource(),h=l.coveringZoomLevel({tileSize:g.tileSize,roundZoom:g.roundZoom}),i=!c||Math.abs(c.tileID.overscaledZ-h)>Math.abs(b.tileID.overscaledZ-h),j=i&&b.refreshedUponExpiration?1:a.clamp(i?f:1-m,0,1);return b.refreshedUponExpiration&&f>=1&&(b.refreshedUponExpiration=!1),c?{opacity:1,mix:1-j}:{opacity:j,mix:0}}return{opacity:1,mix:0}}class bo extends a.SourceCache{constructor(a){const c={type:"raster-dem",maxzoom:a.transform.maxZoom},d=new n(ao(),null),b=ag("mock-dem",c,d,a.style);super("mock-dem",b,!1),b.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,b){a.state="loaded",b(null)}}class bp extends a.SourceCache{constructor(a){const b=ag("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new n(ao(),null),a.style);super("proxy",b,!1),b.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(c,e,f){if(c.freezeTileCoverage)return;this.transform=c;const d=c.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((d,b)=>{if(d[b.key]="",!this._tiles[b.key]){const e=new a.Tile(b,this._source.tileSize*b.overscaleFactor(),c.tileZoom);e.state="loaded",this._tiles[b.key]=e}return d},{});for(const b in this._tiles)b in d||(this.freeFBO(b),this._tiles[b].unloadVectorData(),delete this._tiles[b])}freeFBO(a){const b=this.proxyCachedFBO[a];if(void 0!==b){const c=Object.values(b);this.renderCachePool.push(...c),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class bq extends a.OverscaledTileID{constructor(a,b,c){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=b,this.projMatrix=c}}class br extends a.Elevation{constructor(c,d){super(),this.painter=c,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[e,g,h]=function(o){const e=new a.StructArrayLayout4i8,i=new a.StructArrayLayout3ui6;e.reserve(17161),i.reserve(33800);const b=a.EXTENT/128,f=a.EXTENT+b/2,j=f+b;for(let c=-b;cf||c<0||c>f?24575:0,k=a.clamp(Math.round(d),0,a.EXTENT),l=a.clamp(Math.round(c),0,a.EXTENT);e.emplaceBack(k+m,l,k,l)}const n=(b,c)=>{const a=131*c+b;i.emplaceBack(a+1,a,a+131),i.emplaceBack(a+131,a+131+1,a+1)};for(let g=1;g<129;g++)for(let h=1;h<129;h++)n(h,g);return[0,129].forEach(b=>{for(let a=0;a<130;a++)n(a,b),n(b,a)}),[e,i,32768]}(),f=c.context;this.gridBuffer=f.createVertexBuffer(e,a.boundsAttributes.members),this.gridIndexBuffer=f.createIndexBuffer(g),this.gridSegments=a.SegmentVector.simpleSegment(0,0,e.length,g.length),this.gridNoSkirtSegments=a.SegmentVector.simpleSegment(0,0,e.length,h),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new bp(d.map),this.orthoMatrix=a.create(),a.ortho(this.orthoMatrix,0,a.EXTENT,0,a.EXTENT,0,1);const b=f.gl;this._overlapStencilMode=new a.StencilMode({func:b.GEQUAL,mask:255},0,255,b.KEEP,b.KEEP,b.REPLACE),this._previousZoom=c.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=d,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new bo(d.map)}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),a.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=a,this._checkRenderCacheEfficiency()}update(b,c,f){if(b&&b.terrain){this._style!==b&&(this.style=b),this.enabled=!0;const d=b.terrain.properties;this.sourceCache=0===b.terrain.drapeRenderMode?this._mockSourceCache:b._getSourceCache(d.get("source")),this._exaggeration=d.get("exaggeration");const e=()=>{this.sourceCache.used&&a.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const b=this.getScaledDemTileSize();this.sourceCache.update(c,b,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,e(),this._initializing=!0),e(),c.updateElevation(!f),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(c),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const b=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==b.efficiency&&a.warnOnce(`Terrain render cache efficiency is not optimal (${b.efficiency}%) and performance may be affected negatively, consider placing all background, fill and line layers before layer - with id '${b.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&"source"===a.dataType?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):"style"===a.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(h){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,d=this.painter.transform;this._initializing&&(this._initializing=0===d._centerAltitude&& -1===this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(d.center),-1),this._emptyDEMTextureDirty=!this._initializing);const c=this.proxyCoords=i.getIds().map(b=>{const a=i.getTileByID(b).tileID;return a.projMatrix=d.calculateProjMatrix(a.toUnwrapped()),a});(function(d,b){const c=b.transform.pointCoordinate(b.transform.getCameraPoint()),e=new a.pointGeometry(c.x,c.y);d.sort((b,c)=>{if(c.overscaledZ-b.overscaledZ)return c.overscaledZ-b.overscaledZ;const f=new a.pointGeometry(b.canonical.x+(1<{this.proxyToSource[a.key]={}}),this.terrainTileForTile={};const k=this._style._sourceCaches;for(const e in k){const b=k[e];if(!b.used||(b!==this.sourceCache&&this.resetTileLookupCache(b.id),this._setupProxiedCoordsForOrtho(b,h[e],j),b.usedForTerrain))continue;const m=h[e];b.getSource().reparseOverscaled&&this._assignTerrainTiles(m)}this.proxiedCoords[i.id]=c.map(a=>new bq(a,a.key,this.orthoMatrix)),this._assignTerrainTiles(c),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(j),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const l={};for(const n of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[n.key];if(!f)continue;const g=f.tileID.key;g in l||(this._visibleDemTiles.push(f),l[g]=g)}}_assignTerrainTiles(a){this._initializing||a.forEach(a=>{if(this.terrainTileForTile[a.key])return;const b=this._findTileCoveringTileID(a,this.sourceCache);b&&(this.terrainTileForTile[a.key]=b)})}_prepareDEMTextures(){const b=this.painter.context,d=b.gl;for(const e in this.terrainTileForTile){const a=this.terrainTileForTile[e],c=a.dem;c&&(!a.demTexture||a.needsDEMTextureUpload)&&(b.activeTexture.set(d.TEXTURE1),be(this.painter,a,c))}}_prepareDemTileUniforms(f,a,d,g){if(!a||null==a.demTexture)return!1;const b=f.tileID.canonical,c=Math.pow(2,a.tileID.canonical.z-b.z),e=g||"";return d[`u_dem_tl${e}`]=[b.x*c%1,b.y*c%1,],d[`u_dem_scale${e}`]=c,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const b=this.painter.context,c=b.gl;if(!this._emptyDepthBufferTexture){const d={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new a.Texture(b,d,c.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const b=this._visibleDemTiles.reduce((b,c)=>{if(!c.dem)return b;const d=c.dem.tree.minimums[0];return d>0&&a++,b+d},0);return a?b/a:0}_updateEmptyDEMTexture(){const c=this.painter.context,d=c.gl;c.activeTexture.set(d.TEXTURE2);const f=this._getLoadedAreaMinimum(),e={width:1,height:1,data:new Uint8Array(a.DEMData.pack(f,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let b=this._emptyDEMTexture;return b?b.update(e,{premultiply:!1}):b=this._emptyDEMTexture=new a.Texture(c,e,d.RGBA,{premultiply:!1}),b}setupElevationDraw(g,p,d){var n;const f=this.painter.context,b=f.gl,c=(n=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:a.DEMData.getUnpackVector(n),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});c.u_dem_size=this.sourceCache.getSource().tileSize,c.u_exaggeration=this.exaggeration();const j=this.painter.transform,h=j.projection.createTileTransform(j,j.worldSize),i=g.tileID.canonical;c.u_tile_tl_up=h.upVector(i,0,0),c.u_tile_tr_up=h.upVector(i,a.EXTENT,0),c.u_tile_br_up=h.upVector(i,a.EXTENT,a.EXTENT),c.u_tile_bl_up=h.upVector(i,0,a.EXTENT),c.u_tile_up_scale=h.upVectorScale(i);let e=null,k=null,o=1;if(d&&d.morphing&&this._useVertexMorphing){const l=d.morphing.srcDemTile,m=d.morphing.dstDemTile;o=d.morphing.phase,l&&m&&(this._prepareDemTileUniforms(g,l,c,"_prev")&&(k=l),this._prepareDemTileUniforms(g,m,c)&&(e=m))}if(k&&e?(f.activeTexture.set(b.TEXTURE2),e.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),f.activeTexture.set(b.TEXTURE4),k.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),c.u_dem_lerp=o):(e=this.terrainTileForTile[g.tileID.key],f.activeTexture.set(b.TEXTURE2),(this._prepareDemTileUniforms(g,e,c)?e.demTexture:this.emptyDEMTexture).bind(b.NEAREST,b.CLAMP_TO_EDGE)),f.activeTexture.set(b.TEXTURE3),d&&d.useDepthForOcclusion?(this._depthTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),d&&d.useMeterToDem&&e){const q=(1<{if(l===c)return;const a=[];d&&a.push(bk[g]),a.push(bk[c]),a.push("PROJECTION_GLOBE_VIEW"),k=b.useProgram("globeRaster",null,a),l=c},n=b.colorModeForRenderPass(),o=new a.DepthMode(f.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bj.update(d);const c=b.transform,p=a.calculateGlobeMatrix(c,c.worldSize),q=a.calculateGlobeMercatorMatrix(c),r=[a.mercatorXfromLng(c.center.lng),a.mercatorYfromLat(c.center.lat),],s=b.globeSharedBuffers;(g?[!1,!0]:[!1]).forEach(u=>{l=-1;const x=u?f.LINES:f.TRIANGLES;for(const g of j){const v=i.getTile(g),y=Math.pow(2,g.canonical.z),[D,E]=a.globeBuffersForTileMesh(b,v,g,y),z=a.StencilMode.disabled,A=h.prevTerrainTileForTile[g.key],B=h.terrainTileForTile[g.key];bi(A,B)&&bj.newMorphing(g.key,A,B,d,250),e.activeTexture.set(f.TEXTURE0),v.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const t=bj.getMorphValuesForProxy(g.key),F=t?1:0,C={};t&&a.extend$1(C,{morphing:{srcDemTile:t.from,dstDemTile:t.to,phase:a.easeCubicInOut(t.phase)}});const G=a.globeMatrixForTile(g.canonical,p),H=bh(c.projMatrix,G,q,a.globeToMercatorTransition(c.zoom),r);if(m(F,u),h.setupElevationDraw(v,k,C),b.prepareDrawProgram(e,k,g.toUnwrapped()),s){const[I,J]=u?s.getWirefameBuffer(b.context):[s.gridIndexBuffer,s.gridSegments,];k.draw(e,x,o,z,n,a.CullFaceMode.backCCW,H,"globe_raster",D,I,J)}if(!u){const K=[0===g.canonical.y?a.globePoleMatrixForTile(g.canonical,!1,c):null,g.canonical.y===y-1?a.globePoleMatrixForTile(g.canonical,!0,c):null,];for(const w of K){if(!w)continue;const L=bh(c.projMatrix,w,w,0,r);s&&k.draw(e,x,o,z,n,a.CullFaceMode.disabled,L,"globe_pole_raster",E,s.poleIndexBuffer,s.poleSegments)}}}})}(b,c,e,f,d);else{const g=b.context,h=g.gl;let k,l;const i=b.options.showTerrainWireframe?2:0,m=(a,d)=>{if(l===a)return;const c=[bk[a]];d&&c.push(bk[i]),k=b.useProgram("terrainRaster",null,c),l=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(h.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bj.update(d);const j=b.transform,p=6*Math.pow(1.5,22-j.zoom)*c.exaggeration();(i?[!1,!0]:[!1]).forEach(r=>{l=-1;const w=r?h.LINES:h.TRIANGLES,[x,y]=r?c.getWirefameBuffer():[c.gridIndexBuffer,c.gridSegments,];for(const i of f){const s=e.getTile(i),z=a.StencilMode.disabled,t=c.prevTerrainTileForTile[i.key],u=c.terrainTileForTile[i.key];bi(t,u)&&bj.newMorphing(i.key,t,u,d,250),g.activeTexture.set(h.TEXTURE0),s.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST);const q=bj.getMorphValuesForProxy(i.key),A=q?1:0;let v;q&&(v={morphing:{srcDemTile:q.from,dstDemTile:q.to,phase:a.easeCubicInOut(q.phase)}});const B=bg(i.projMatrix,bl(i.canonical,j.renderWorldCopies)?p/10:p);m(A,r),c.setupElevationDraw(s,k,v),b.prepareDrawProgram(g,k,i.toUnwrapped()),k.draw(g,w,o,z,n,a.CullFaceMode.backCCW,B,"terrain_raster",c.gridBuffer,x,y)}})}}(c,this,this.proxySourceCache,b,this._updateTimestamp),this.renderingToTexture=!0,b.splice(0,b.length))}renderBatch(p){if(0===this._drapedRenderBatches.length)return p+1;this.renderingToTexture=!0;const c=this.painter,e=this.painter.context,f=this.proxySourceCache,s=this.proxiedCoords[f.id],k=this._drapedRenderBatches.shift(),h=[],t=c.style.order;let i=0;for(const g of s){const l=f.getTileByID(g.proxyTileKey),m=f.proxyCachedFBO[g.key]?f.proxyCachedFBO[g.key][p]:void 0,b=void 0!==m?f.renderCache[m]:this.pool[i++],q=void 0!==m;if(l.texture=b.tex,q&&!b.dirty){h.push(l.tileID);continue}let r;e.bindFramebuffer.set(b.fb.framebuffer),this.renderedToTile=!1,b.dirty&&(e.clear({color:a.Color.transparent,stencil:0}),b.dirty=!1);for(let n=k.start;n<=k.end;++n){const j=c.style._layers[t[n]];if(j.isHidden(c.transform.zoom))continue;const d=c.style._getLayerSourceCache(j),o=d?this.proxyToSource[g.key][d.id]:[g];if(!o)continue;const u=o;e.viewport.set([0,0,b.fb.width,b.fb.height,]),r!==(d?d.id:null)&&(this._setupStencil(b,o,j,d),r=d?d.id:null),c.renderLayer(c,d,j,u)}this.renderedToTile?(b.dirty=!0,h.push(l.tileID)):q|| --i,5===i&&(i=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,e.bindFramebuffer.set(null),e.viewport.set([0,0,c.width,c.height]),k.end+1}postRender(){}renderCacheEfficiency(a){const e=a.order.length;if(0===e)return{efficiency:100};let f,g=0,b=0,c=!1;for(let d=0;da.dem).forEach(b=>{a=Math.min(a,b.dem.tree.minimums[0])}),0===a?a:(a-30)*this._exaggeration}raycast(d,e,f){if(!this._visibleDemTiles)return null;const b=this._visibleDemTiles.filter(a=>a.dem).map(b=>{const c=b.tileID,a=Math.pow(2,c.overscaledZ),{x:g,y:h}=c.canonical,i=g/a,j=(g+1)/a,k=h/a,l=(h+1)/a;return{minx:i,miny:k,maxx:j,maxy:l,t:b.dem.tree.raycastRoot(i,k,j,l,d,e,f),tile:b}});for(const a of(b.sort((a,b)=>(null!==a.t?a.t:Number.MAX_VALUE)-(null!==b.t?b.t:Number.MAX_VALUE)),b)){if(null==a.t)break;const c=a.tile.dem.tree.raycast(a.minx,a.miny,a.maxx,a.maxy,d,e,f);if(null!=c)return c}return null}_createFBO(){const b=this.painter.context,c=b.gl,d=this.drapeBufferSize;b.activeTexture.set(c.TEXTURE0);const f=new a.Texture(b,{width:d[0],height:d[1],data:null},c.RGBA);f.bind(c.LINEAR,c.CLAMP_TO_EDGE);const e=b.createFramebuffer(d[0],d[1],!1);return e.colorAttachment.set(f.texture),e.depthAttachment=new Z(b,e.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=b.createRenderbuffer(b.gl.DEPTH_STENCIL,d[0],d[1]),this._stencilRef=0,e.depthAttachment.set(this._sharedDepthStencil),b.clear({stencil:0})):e.depthAttachment.set(this._sharedDepthStencil),b.extTextureFilterAnisotropic&&!b.extTextureFilterAnisotropicForceOff&&c.texParameterf(c.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax),{fb:e,tex:f,dirty:!1}}_initFBOPool(){for(;this.pool.length{const a=this._style._layers[c],d=a.isHidden(this.painter.transform.zoom),b=a.getCrossfadeParameters(),e=!!b&&1!==b.t,f=a.hasTransition();return"custom"!==a.type&&!d&&(e||f)})}_clearRasterFadeFromRenderCache(){let e=!1;for(const h in this._style._sourceCaches)if(this._style._sourceCaches[h]._source instanceof r){e=!0;break}if(e)for(let c=0;ca.renderCachePool.length){const i=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let e=0;e=0;g--){const b=f[g];if(a.getTileByID(b.key),void 0!==a.proxyCachedFBO[b.key]){const j=p[b.key],k=this.proxyToSource[b.key];let d=0;for(const l in k){const m=k[l],n=j[l];if(!n||n.length!==m.length||m.some((a,b)=>a!==n[b]||t[l]&&t[l].hasOwnProperty(a.key))){d=-1;break}++d}for(const r in a.proxyCachedFBO[b.key])a.renderCache[a.proxyCachedFBO[b.key][r]].dirty=d<0||d!==Object.values(j).length}}const o=[...this._drapedRenderBatches];for(const s of(o.sort((a,b)=>b.end-b.start-(a.end-a.start)),o))for(const h of f){if(a.proxyCachedFBO[h.key])continue;let c=a.renderCachePool.pop();void 0===c&&a.renderCache.length<50&&(c=a.renderCache.length,a.renderCache.push(this._createFBO())),void 0!==c&&(a.proxyCachedFBO[h.key]={},a.proxyCachedFBO[h.key][s.start]=c,a.renderCache[c].dirty=!0)}this._tilesDirty={}}_setupStencil(g,a,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const e=this.painter.context,f=e.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let b;if(c.isTileClipped())b=a.length,this._overlapStencilMode.test={func:f.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a[a.length-1].overscaledZ))return void(this._overlapStencilType=!1);b=1,this._overlapStencilMode.test={func:f.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+b>255&&(e.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=b,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(b){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[b.key]),this._overlapStencilMode):a.StencilMode.disabled}_renderTileClippingMasks(f,g){const b=this.painter,d=this.painter.context,c=d.gl;b._tileClippingMaskIDs={},d.setColorMode(a.ColorMode.disabled),d.setDepthMode(a.DepthMode.disabled);const h=b.useProgram("clippingMask");for(const e of f){const i=b._tileClippingMaskIDs[e.key]=--g;h.draw(d,c.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:c.ALWAYS,mask:0},i,255,c.KEEP,c.KEEP,c.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bm(e.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(e){const d=this.painter.transform;if(e.x<0||e.x>d.width||e.y<0||e.y>d.height)return null;const b=[e.x,e.y,1,1];a.transformMat4$1(b,b,d.pixelMatrixInverse),a.scale$1(b,b,1/b[3]),b[0]/=d.worldSize,b[1]/=d.worldSize;const g=d._camera.position,i=a.mercatorZfromAltitude(1,d.center.lat),c=[g[0],g[1],g[2]/i,0],f=a.subtract([],b.slice(0,3),c);a.normalize(f,f);const h=this.raycast(c,f,this._exaggeration);return null!==h&&h?(a.scaleAndAdd(c,c,f,h),c[3]=c[2],c[2]*=i,c):null}drawDepth(){const e=this.painter,b=e.context,i=this.proxySourceCache,c=Math.ceil(e.width),d=Math.ceil(e.height);if(this._depthFBO&&(this._depthFBO.width!==c||this._depthFBO.height!==d)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const f=b.gl,g=b.createFramebuffer(c,d,!0);b.activeTexture.set(f.TEXTURE0);const h=new a.Texture(b,{width:c,height:d,data:null},f.RGBA);h.bind(f.NEAREST,f.CLAMP_TO_EDGE),g.colorAttachment.set(h.texture);const j=b.createRenderbuffer(b.gl.DEPTH_COMPONENT16,c,d);g.depthAttachment.set(j),this._depthFBO=g,this._depthTexture=h}b.bindFramebuffer.set(this._depthFBO.framebuffer),b.viewport.set([0,0,c,d]),function(b,c,h,i){if("globe"===b.transform.projection.name)return;const d=b.context,e=d.gl;d.clear({depth:1});const f=b.useProgram("terrainDepth"),j=new a.DepthMode(e.LESS,a.DepthMode.ReadWrite,b.depthRangeFor3D);for(const g of i){const k=h.getTile(g),l=bg(g.projMatrix,0);c.setupElevationDraw(k,f),f.draw(d,e.TRIANGLES,j,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.backCCW,l,"terrain_depth",c.gridBuffer,c.gridIndexBuffer,c.gridNoSkirtSegments)}}(e,this,i,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,f,c){if(a.getSource() instanceof s)return this._setupProxiedCoordsForImageSource(a,f,c);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const k=this.proxiedCoords[a.id]=[],l=this.proxyCoords;for(let g=0;g(a.min.x=Math.min(a.min.x,b.x-o.x),a.min.y=Math.min(a.min.y,b.y-o.y),a.max.x=Math.max(a.max.x,b.x-o.x),a.max.y=Math.max(a.max.y,b.y-o.y),a),{min:new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),n=(b,c)=>{const d=b.wrap+b.canonical.x/(1<g+p.max.x||e+fh+p.max.y};for(let f=0;fa.key===c.tileID.key);if(j)return j}if(c.tileID.key!==b.key){const d=b.canonical.z-c.tileID.canonical.z;let f,g,h;e=a.create();const k=c.tileID.wrap-b.wrap<0?(g=(f=a.EXTENT>>d)*((c.tileID.canonical.x<=g){const h=c.canonical.z-g;d.getSource().reparseOverscaled?(e=Math.max(c.canonical.z+2,d.transform.tileZoom),f=new a.OverscaledTileID(e,c.wrap,g,c.canonical.x>>h,c.canonical.y>>h)):0!==h&&(e=g,f=new a.OverscaledTileID(e,c.wrap,g,c.canonical.x>>h,c.canonical.y>>h))}f.key!==c.key&&(m.push(f.key),b=d.getTile(f))}const n=a=>{m.forEach(b=>{l[b]=a}),m.length=0};for(e-=1;e>=o&&(!b||!b.hasData());e--){b&&n(b.tileID.key);const j=f.calculateScaledKey(e);if((b=d.getTileByID(j))&&b.hasData())break;const k=l[j];if(null===k)break;void 0===k?m.push(j):b=d.getTileByID(k)}return n(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(a){this.renderedToTile=!0}_clearRenderCacheForTile(b,c){let a=this._tilesDirty[b];a||(a=this._tilesDirty[b]={}),a[c.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const b=function(g){let f,e,b;const c=new a.StructArrayLayout2ui4,d=131;for(e=1;e<129;e++){for(f=1;f<129;f++)b=e*d+f,c.emplaceBack(b,b+1),c.emplaceBack(b,b+d),c.emplaceBack(b+1,b+d),128===e&&c.emplaceBack(b+d,b+d+1);c.emplaceBack(b+1,b+1+d)}return c}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(b),this.wireframeSegments=a.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function bs(b){const c=[];for(let a=0;am.indexOf(t)&&m.push(t);let n=e?e.defines():[];n=n.concat(r.map(a=>`#define ${a}`));const D=n.concat("\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",a9,a8.fragmentSource,v.fragmentSource,k.fragmentSource).join("\n"),E=n.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",a9,a8.vertexSource,v.vertexSource,u.vertexSource,k.vertexSource).join("\n"),o=d.createShader(d.FRAGMENT_SHADER);if(d.isContextLost())return void(this.failedToCreate=!0);d.shaderSource(o,D),d.compileShader(o),d.attachShader(this.program,o);const p=d.createShader(d.VERTEX_SHADER);if(d.isContextLost())return void(this.failedToCreate=!0);d.shaderSource(p,E),d.compileShader(p),d.attachShader(this.program,p),this.attributes={};const i={};this.numAttributes=l.length;for(let f=0;f>16,g>>16],u_pixel_coord_lower:[65535&f,65535&g]}}const bv=(h,f,i,j)=>{const b=f.style.light,c=b.properties.get("position"),d=[c.x,c.y,c.z],g=a.create$1();"viewport"===b.properties.get("anchor")&&(a.fromRotation(g,-f.transform.angle),a.transformMat3(d,d,g));const e=b.properties.get("color");return{u_matrix:h,u_lightpos:d,u_lightintensity:b.properties.get("intensity"),u_lightcolor:[e.r,e.g,e.b],u_vertical_gradient:+i,u_opacity:j}},bw=(d,b,e,f,g,h,c)=>a.extend(bv(d,b,e,f),bu(h,b,c),{u_height_factor:-Math.pow(2,g.overscaledZ)/c.tileSize/8}),bx=a=>({u_matrix:a}),by=(b,c,d,e)=>a.extend(bx(b),bu(d,c,e)),bz=(a,b)=>({u_matrix:a,u_world:b}),bA=(b,c,d,e,f)=>a.extend(by(b,c,d,e),{u_world:f}),bB=(d,g,e,c)=>{const b=d.transform;let f;return f="map"===c.paint.get("circle-pitch-alignment")?b.calculatePixelsToTileUnitsMatrix(e):new Float32Array([b.pixelsToGLUnits[0],0,0,b.pixelsToGLUnits[1],]),{u_camera_to_center_distance:b.cameraToCenterDistance,u_matrix:d.translatePosMatrix(g.projMatrix,e,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_device_pixel_ratio:a.exported.devicePixelRatio,u_extrude_scale:f}},bC=b=>{const a=[];return"map"===b.paint.get("circle-pitch-alignment")&&a.push("PITCH_WITH_MAP"),"map"===b.paint.get("circle-pitch-scale")&&a.push("SCALE_WITH_MAP"),a},bD=(d,b,e)=>{const c=a.EXTENT/e.tileSize;return{u_matrix:d,u_camera_to_center_distance:b.cameraToCenterDistance,u_extrude_scale:[b.pixelsToGLUnits[0]/c,b.pixelsToGLUnits[1]/c,]}},bE=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bF=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:V(b,1,c),u_intensity:d}),bG=(d,b,g,e,h,i)=>{const f=d.transform,j=f.calculatePixelsToTileUnitsMatrix(b),c={u_matrix:bJ(d,b,g,h),u_pixels_to_tile_units:j,u_device_pixel_ratio:a.exported.devicePixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(bK(g)){const k=bI(b,d.transform);c.u_texsize=b.lineAtlasTexture.size,c.u_scale=[k,e.fromScale,e.toScale,],c.u_mix=e.t}return c},bH=(e,b,f,d,g)=>{const c=e.transform,h=bI(b,c);return{u_matrix:bJ(e,b,f,g),u_texsize:b.imageAtlasTexture.size,u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(b),u_device_pixel_ratio:a.exported.devicePixelRatio,u_image:0,u_scale:[h,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function bI(a,b){return 1/V(a,1,b.tileZoom)}function bJ(c,a,b,d){return c.translatePosMatrix(d||a.tileID.projMatrix,a,b.paint.get("line-translate"),b.paint.get("line-translate-anchor"))}function bK(b){const a=b.paint.get("line-dasharray").value;return a.value||"constant"!==a.kind}const bL=(e,f,g,d,a,h)=>{var b,c;return{u_matrix:e,u_tl_parent:f,u_scale_parent:g,u_fade_t:d.mix,u_opacity:d.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(c=a.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(b=a.paint.get("raster-contrast"))>0?1/(1-b):1+b,u_spin_weights:bM(a.paint.get("raster-hue-rotate")),u_perspective_transform:h}};function bM(a){a*=Math.PI/180;const c=Math.sin(a),b=Math.cos(a);return[(2*b+1)/3,(-Math.sqrt(3)*c-b+1)/3,(Math.sqrt(3)*c-b+1)/3,]}const bN=(a,b,e,f,d,g,h,i,j,k,l,m,n,o)=>{const c=d.transform;return{u_is_size_zoom_constant:+("constant"===a||"source"===a),u_is_size_feature_constant:+("constant"===a||"camera"===a),u_size_t:b?b.uSizeT:0,u_size:b?b.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+e,u_aspect_ratio:c.width/c.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:h,u_coord_matrix:i,u_is_text:+j,u_pitch_with_map:+f,u_texsize:k,u_tile_id:l,u_zoom_transition:m,u_inv_rot_matrix:n,u_merc_center:o,u_texture:0}},bO=(d,e,f,c,b,g,h,i,j,k,l,m,n,o,p)=>{const{cameraToCenterDistance:q,_pitch:r}=b.transform;return a.extend(bN(d,e,f,c,b,g,h,i,j,k,m,n,o,p),{u_gamma_scale:c?q*Math.cos(b.terrain?0:r):1,u_device_pixel_ratio:a.exported.devicePixelRatio,u_is_halo:+l})},bP=(b,c,d,e,f,g,h,i,j,k,l,m,n,o)=>a.extend(bO(b,c,d,e,f,g,h,i,!0,j,!0,l,m,n,o),{u_texsize_icon:k,u_texture_icon:1}),bQ=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bR=(b,c,d,e,f,g)=>a.extend(function(f,c,b,a){const d=b.imageManager.getPattern(f.from.toString()),e=b.imageManager.getPattern(f.to.toString()),{width:k,height:l}=b.imageManager.getPixelSize(),g=Math.pow(2,a.tileID.overscaledZ),h=a.tileSize*Math.pow(2,b.transform.tileZoom)/g,i=h*(a.tileID.canonical.x+a.tileID.wrap*g),j=h*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:d.tl,u_pattern_br_a:d.br,u_pattern_tl_b:e.tl,u_pattern_br_b:e.br,u_texsize:[k,l],u_mix:c.t,u_pattern_size_a:d.displaySize,u_pattern_size_b:e.displaySize,u_scale_a:c.fromScale,u_scale_b:c.toScale,u_tile_units_to_pixels:1/V(a,1,b.transform.tileZoom),u_pixel_coord_upper:[i>>16,j>>16,],u_pixel_coord_lower:[65535&i,65535&j,]}}(e,g,d,f),{u_matrix:b,u_opacity:c}),bS={fillExtrusion:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fillExtrusionPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_height_factor:new a.Uniform1f(b,c.u_height_factor),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fill:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),fillPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),fillOutline:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world)}),fillOutlinePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),circle:(b,c)=>({u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.UniformMatrix2f(b,c.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),collisionBox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.Uniform2f(b,c.u_extrude_scale)}),collisionCircle:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_inv_matrix:new a.UniformMatrix4f(b,c.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(b,c.u_viewport_size)}),debug:(b,c)=>({u_color:new a.UniformColor(b,c.u_color),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_overlay:new a.Uniform1i(b,c.u_overlay),u_overlay_scale:new a.Uniform1f(b,c.u_overlay_scale)}),clippingMask:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmap:(b,c)=>({u_extrude_scale:new a.Uniform1f(b,c.u_extrude_scale),u_intensity:new a.Uniform1f(b,c.u_intensity),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmapTexture:(b,c)=>({u_image:new a.Uniform1i(b,c.u_image),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_opacity:new a.Uniform1f(b,c.u_opacity)}),hillshade:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_latrange:new a.Uniform2f(b,c.u_latrange),u_light:new a.Uniform2f(b,c.u_light),u_shadow:new a.UniformColor(b,c.u_shadow),u_highlight:new a.UniformColor(b,c.u_highlight),u_accent:new a.UniformColor(b,c.u_accent)}),hillshadePrepare:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_dimension:new a.Uniform2f(b,c.u_dimension),u_zoom:new a.Uniform1f(b,c.u_zoom),u_unpack:new a.Uniform4f(b,c.u_unpack)}),line:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_dash_image:new a.Uniform1i(b,c.u_dash_image),u_gradient_image:new a.Uniform1i(b,c.u_gradient_image),u_image_height:new a.Uniform1f(b,c.u_image_height),u_texsize:new a.Uniform2f(b,c.u_texsize),u_scale:new a.Uniform3f(b,c.u_scale),u_mix:new a.Uniform1f(b,c.u_mix),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),linePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_image:new a.Uniform1i(b,c.u_image),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),raster:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_tl_parent:new a.Uniform2f(b,c.u_tl_parent),u_scale_parent:new a.Uniform1f(b,c.u_scale_parent),u_fade_t:new a.Uniform1f(b,c.u_fade_t),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image0:new a.Uniform1i(b,c.u_image0),u_image1:new a.Uniform1i(b,c.u_image1),u_brightness_low:new a.Uniform1f(b,c.u_brightness_low),u_brightness_high:new a.Uniform1f(b,c.u_brightness_high),u_saturation_factor:new a.Uniform1f(b,c.u_saturation_factor),u_contrast_factor:new a.Uniform1f(b,c.u_contrast_factor),u_spin_weights:new a.Uniform3f(b,c.u_spin_weights),u_perspective_transform:new a.Uniform2f(b,c.u_perspective_transform)}),symbolIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_texture:new a.Uniform1i(b,c.u_texture)}),symbolSDF:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texture:new a.Uniform1i(b,c.u_texture),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),symbolTextAndIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texsize_icon:new a.Uniform2f(b,c.u_texsize_icon),u_texture:new a.Uniform1i(b,c.u_texture),u_texture_icon:new a.Uniform1i(b,c.u_texture_icon),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),background:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_color:new a.UniformColor(b,c.u_color)}),backgroundPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image:new a.Uniform1i(b,c.u_image),u_pattern_tl_a:new a.Uniform2f(b,c.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(b,c.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(b,c.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(b,c.u_pattern_br_b),u_texsize:new a.Uniform2f(b,c.u_texsize),u_mix:new a.Uniform1f(b,c.u_mix),u_pattern_size_a:new a.Uniform2f(b,c.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(b,c.u_pattern_size_b),u_scale_a:new a.Uniform1f(b,c.u_scale_a),u_scale_b:new a.Uniform1f(b,c.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(b,c.u_tile_units_to_pixels)}),terrainRaster:k,terrainDepth:k,skybox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_cubemap:new a.Uniform1i(b,c.u_cubemap),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxGradient:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_center_direction:new a.Uniform3f(b,c.u_center_direction),u_radius:new a.Uniform1f(b,c.u_radius),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxCapture:(b,c)=>({u_matrix_3f:new a.UniformMatrix3f(b,c.u_matrix_3f),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_sun_intensity:new a.Uniform1f(b,c.u_sun_intensity),u_color_tint_r:new a.Uniform4f(b,c.u_color_tint_r),u_color_tint_m:new a.Uniform4f(b,c.u_color_tint_m),u_luminance:new a.Uniform1f(b,c.u_luminance)}),globeRaster:(b,c)=>({u_proj_matrix:new a.UniformMatrix4f(b,c.u_proj_matrix),u_globe_matrix:new a.UniformMatrix4f(b,c.u_globe_matrix),u_merc_matrix:new a.UniformMatrix4f(b,c.u_merc_matrix),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_image0:new a.Uniform1i(b,c.u_image0)}),globeAtmosphere:(b,c)=>({u_center:new a.Uniform2f(b,c.u_center),u_radius:new a.Uniform1f(b,c.u_radius),u_screen_size:new a.Uniform2f(b,c.u_screen_size),u_pixel_ratio:new a.Uniform1f(b,c.u_pixel_ratio),u_opacity:new a.Uniform1f(b,c.u_opacity),u_fadeout_range:new a.Uniform1f(b,c.u_fadeout_range),u_start_color:new a.Uniform3f(b,c.u_start_color),u_end_color:new a.Uniform3f(b,c.u_end_color)})};let bT;function bU(b,H,s,A,t,I,B){var u;const f=b.context,C=f.gl,D=b.useProgram("collisionBox"),j=[];let g=0,E=0;for(let v=0;v0){const l=a.create(),J=x;a.mul(l,d.placementInvProjMatrix,b.transform.glCoordMatrix),a.mul(l,l,d.placementViewportMatrix),j.push({circleArray:y,circleOffset:E,transform:J,invTransform:l}),g+=y.length/4,E=g}e&&(b.terrain&&b.terrain.setupElevationDraw(k,D),D.draw(f,C.LINES,a.DepthMode.disabled,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.disabled,bD(x,b.transform,k),s.id,e.layoutVertexBuffer,e.indexBuffer,e.segments,null,b.transform.zoom,null,e.collisionVertexBuffer,e.collisionVertexBufferExt))}if(!B||!j.length)return;const K=b.useProgram("collisionCircle"),c=new a.StructArrayLayout2f1f2i16;c.resize(4*g),c._trim();let m=0;for(const h of j)for(let z=0;z[0,0,0];e.clear();for(let j=0;j=0&&(r[b.associatedIconIndex]={shiftedAnchor:x,angle:y})}else aO(b.numGlyphs,e)}if(p){d.clear();const A=c.icon.placedSymbolArray;for(let f=0;f[0,0,0];aG(d,g.projMatrix,b,i,C,W,j,ad,am,g)}const D=b.translatePosMatrix(g.projMatrix,e,J,K),E=n||i&&Q||al?bV:C,F=b.translatePosMatrix(W,e,J,K,!0),an=o&&0!==h.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let Y;const G=N.createInversionMatrix(g.toUnwrapped());Y=o?d.iconsInText?bP(m.kind,y,u,j,b,D,E,F,p,T,z,x,G,v):bO(m.kind,y,u,j,b,D,E,F,i,p,!0,z,x,G,v):bN(m.kind,y,u,j,b,D,E,F,i,p,z,x,G,v);const Z={program:ag,buffers:l,uniformValues:Y,atlasTexture:A,atlasTextureIcon:U,atlasInterpolation:B,atlasInterpolationIcon:S,isSDF:o,hasHalo:an,tile:e,labelPlaneMatrixInv:aj};if(ae&&d.canOverlap){O=!0;const ao=l.segments.get();for(const $ of ao)r.push({segments:new a.SegmentVector([$]),sortKey:$.sortKey,state:Z})}else r.push({segments:l.segments,sortKey:0,state:Z})}for(const H of(O&&r.sort((a,b)=>a.sortKey-b.sortKey),r)){const c=H.state;if(b.terrain&&b.terrain.setupElevationDraw(c.tile,c.program,{useDepthForOcclusion:!w,labelPlaneMatrixInv:c.labelPlaneMatrixInv}),t.activeTexture.set(k.TEXTURE0),c.atlasTexture.bind(c.atlasInterpolation,k.CLAMP_TO_EDGE),c.atlasTextureIcon&&(t.activeTexture.set(k.TEXTURE1),c.atlasTextureIcon&&c.atlasTextureIcon.bind(c.atlasInterpolationIcon,k.CLAMP_TO_EDGE)),c.isSDF){const I=c.uniformValues;c.hasHalo&&(I.u_is_halo=1,b$(c.buffers,H.segments,h,b,c.program,P,L,M,I)),I.u_is_halo=0}b$(c.buffers,H.segments,h,b,c.program,P,L,M,c.uniformValues)}}function b$(b,f,c,d,g,h,i,j,k){const e=d.context;g.draw(e,e.gl.TRIANGLES,h,i,j,a.CullFaceMode.disabled,k,c.id,b.layoutVertexBuffer,b.indexBuffer,f,c.paint,d.transform.zoom,b.programConfigurations.get(c.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function b_(b,y,c,z,A,B,s){const e=b.context.gl,l=c.paint.get("fill-pattern"),g=l&&l.constantOr(1),m=c.getCrossfadeParameters();let n,i,o,p,q;for(const h of(s?(i=g&&!c.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",n=e.LINES):(i=g?"fillPattern":"fill",n=e.TRIANGLES),z)){const d=y.getTile(h);if(g&&!d.patternsLoaded())continue;const f=d.getBucket(c);if(!f)continue;b.prepareDrawTile(h);const j=f.programConfigurations.get(c.id),t=b.useProgram(i,j);g&&(b.context.activeTexture.set(e.TEXTURE0),d.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),j.updatePaintBuffers(m));const r=l.constantOr(null);if(r&&d.imageAtlas){const u=d.imageAtlas,v=u.patternPositions[r.to.toString()],w=u.patternPositions[r.from.toString()];v&&w&&j.setConstantPatternPositions(v,w)}const k=b.translatePosMatrix(h.projMatrix,d,c.paint.get("fill-translate"),c.paint.get("fill-translate-anchor"));if(s){p=f.indexBuffer2,q=f.segments2;const x=b.terrain&&b.terrain.renderingToTexture?b.terrain.drapeBufferSize:[e.drawingBufferWidth,e.drawingBufferHeight,];o="fillOutlinePattern"===i&&g?bA(k,b,m,d,x):bz(k,x)}else p=f.indexBuffer,q=f.segments,o=g?by(k,b,m,d):bx(k);b.prepareDrawProgram(b.context,t,h.toUnwrapped()),t.draw(b.context,n,A,b.stencilModeForClipping(h),B,a.CullFaceMode.disabled,o,c.id,f.layoutVertexBuffer,p,q,c.paint,b.transform.zoom,j)}}function b0(b,m,c,x,y,z,A){const f=b.context,h=f.gl,n=c.paint.get("fill-extrusion-pattern"),k=n.constantOr(1),o=c.getCrossfadeParameters(),p=c.paint.get("fill-extrusion-opacity");for(const g of x){const e=m.getTile(g),d=e.getBucket(c);if(!d)continue;const i=d.programConfigurations.get(c.id),j=b.useProgram(k?"fillExtrusionPattern":"fillExtrusion",i);if(b.terrain){const q=b.terrain;if(!d.enableTerrain)continue;if(q.setupElevationDraw(e,j,{useMeterToDem:!0}),b1(f,m,g,d,c,q),!d.centroidVertexBuffer){const r=j.attributes.a_centroid_pos;void 0!==r&&h.vertexAttrib2f(r,0,0)}}k&&(b.context.activeTexture.set(h.TEXTURE0),e.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),i.updatePaintBuffers(o));const l=n.constantOr(null);if(l&&e.imageAtlas){const s=e.imageAtlas,t=s.patternPositions[l.to.toString()],u=s.patternPositions[l.from.toString()];t&&u&&i.setConstantPatternPositions(t,u)}const v=b.translatePosMatrix(g.projMatrix,e,c.paint.get("fill-extrusion-translate"),c.paint.get("fill-extrusion-translate-anchor")),w=c.paint.get("fill-extrusion-vertical-gradient"),B=k?bw(v,b,w,p,g,o,e):bv(v,b,w,p);b.prepareDrawProgram(f,j,g.toUnwrapped()),j.draw(f,f.gl.TRIANGLES,y,z,A,a.CullFaceMode.backCCW,B,c.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,c.paint,b.transform.zoom,i,b.terrain?d.centroidVertexBuffer:null)}}function b1(w,D,p,c,E,q){const x=[b=>{let c=b.canonical.x-1,d=b.wrap;return c<0&&(c=(1<{let c=b.canonical.x+1,d=b.wrap;return c===1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,(0===b.canonical.y?1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y===(1<{const b=D.getSource().maxzoom,c=b=>{const a=D.getTileByID(b);if(a&&a.hasData())return a.getBucket(E)};let d,e,f;return(a.overscaledZ===a.canonical.z||a.overscaledZ>=b)&&(d=c(a.key)),a.overscaledZ>=b&&(e=c(a.calculateScaledKey(a.overscaledZ+1))),a.overscaledZ>b&&(f=c(a.calculateScaledKey(a.overscaledZ-1))),d||e||f},F=[0,0,0],G=(b,c)=>(F[0]=Math.min(b.min.y,c.min.y),F[1]=Math.max(b.max.y,c.max.y),F[2]=a.EXTENT-c.min.x>b.max.x?c.min.x-a.EXTENT:b.max.x,F),H=(b,c)=>(F[0]=Math.min(b.min.x,c.min.x),F[1]=Math.max(b.max.x,c.max.x),F[2]=a.EXTENT-c.min.y>b.max.y?c.min.y-a.EXTENT:b.max.y,F),z=[(a,b)=>G(a,b),(a,b)=>G(b,a),(a,b)=>H(a,b),(a,b)=>H(b,a),],j=new a.pointGeometry(0,0);let r,s,A;const B=(e,f,b,c,d)=>{const g=[[c?b:e,c?e:b,0],[c?b:f,c?f:b,0],],i=d<0?a.EXTENT+d:d,h=[c?i:(e+f)/2,c?(e+f)/2:i,0,];return 0===b&&d<0||0!==b&&d>0?q.getForTilePoints(A,[h],!0,s):g.push(h),q.getForTilePoints(p,g,!0,r),Math.max(g[0][2],g[1][2],h[2])/q.exaggeration()};for(let d=0;d<4;d++){const k=c.borders[d];if(0===k.length&&(c.borderDone[d]=!0),c.borderDone[d])continue;const t=A=x[d](p),b=y(t);if(!b||!b.enableTerrain||!(s=q.findDEMTileFor(t))||!s.dem)continue;if(!r){const l=q.findDEMTileFor(p);if(!l||!l.dem)return;r=l}const f=(d<2?1:5)-d,h=b.borders[f];let g=0;for(let m=0;mu[0]+3);)b.borderDone[f]||b.encodeCentroid(void 0,e,!1),g++;if(e&&gu[1]-3)&&(n++,++g!==h.length);)e=b.featuresOnBorder[h[g]];if(e=b.featuresOnBorder[h[v]],i.intersectsCount()>1||e.intersectsCount()>1||1!==n){1!==n&&(g=v),c.encodeCentroid(void 0,i,!1),b.borderDone[f]||b.encodeCentroid(void 0,e,!1);continue}const o=z[d](i,e),C=d%2?a.EXTENT-1:0;j.x=B(o[0],Math.min(a.EXTENT-1,o[1]),C,d<2,o[2]),j.y=0,c.encodeCentroid(j,i,!1),b.borderDone[f]||b.encodeCentroid(j,e,!1)}else c.encodeCentroid(void 0,i,!1)}c.borderDone[d]=c.needsCentroidUpdate=!0,b.borderDone[f]||(b.borderDone[f]=b.needsCentroidUpdate=!0)}(c.needsCentroidUpdate|| !c.centroidVertexBuffer&&0!==c.centroidVertexArray.length)&&c.uploadCentroid(w)}const b2=new a.Color(1,0,0,1),b3=new a.Color(0,1,0,1),b4=new a.Color(0,0,1,1),b5=new a.Color(1,0,1,1),b6=new a.Color(0,1,1,1);function b7(a,c,b,d){b9(a,0,c+b/2,a.transform.width,b,d)}function b8(a,c,b,d){b9(a,c-b/2,0,b,a.transform.height,d)}function b9(d,e,f,g,h,i){const c=d.context,b=c.gl;b.enable(b.SCISSOR_TEST),b.scissor(e*a.exported.devicePixelRatio,f*a.exported.devicePixelRatio,g*a.exported.devicePixelRatio,h*a.exported.devicePixelRatio),c.clear({color:i}),b.disable(b.SCISSOR_TEST)}function ca(b,h,c){const f=b.context,e=f.gl,i=c.projMatrix,g=b.useProgram("debug"),d=h.getTileByID(c.key);b.terrain&&b.terrain.setupElevationDraw(d,g);const j=a.DepthMode.disabled,k=a.StencilMode.disabled,o=b.colorModeForRenderPass(),l="$debug";f.activeTexture.set(e.TEXTURE0),b.emptyTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),d._makeDebugTileBoundsBuffers(b.context,b.transform.projection);const p=d._tileDebugBuffer||b.debugBuffer,q=d._tileDebugIndexBuffer||b.debugIndexBuffer,r=d._tileDebugSegments||b.debugSegments;g.draw(f,e.LINE_STRIP,j,k,o,a.CullFaceMode.disabled,bE(i,a.Color.red),l,p,q,r);const m=d.latestRawTileData,s=Math.floor((m&&m.byteLength||0)/1024),t=h.getTile(c).tileSize,u=512/Math.min(t,512)*(c.overscaledZ/b.transform.zoom)*.5;let n=c.canonical.toString();c.overscaledZ!==c.canonical.z&&(n+=` => ${c.overscaledZ}`),function(b,d){b.initDebugOverlayCanvas();const c=b.debugOverlayCanvas,e=b.context.gl,a=b.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,c.width,c.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(d,5,5),a.strokeText(d,5,5),b.debugOverlayTexture.update(c),b.debugOverlayTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}(b,`${n} ${s}kb`),g.draw(f,e.TRIANGLES,j,k,a.ColorMode.alphaBlended,a.CullFaceMode.disabled,bE(i,a.Color.transparent,u),l,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments)}const w=a.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:cb}=w;function cc(a,b,c,d){a.emplaceBack(b,c,d)}class cd{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,cc(this.vertexArray,-1,-1,1),cc(this.vertexArray,1,-1,1),cc(this.vertexArray,-1,1,1),cc(this.vertexArray,1,1,1),cc(this.vertexArray,-1,-1,-1),cc(this.vertexArray,1,-1,-1),cc(this.vertexArray,-1,1,-1),cc(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=b.createVertexBuffer(this.vertexArray,cb),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function ce(f,b,j,k,l,m){var g,h,i,c,d;const e=f.gl,n=b.paint.get("sky-atmosphere-color"),o=b.paint.get("sky-atmosphere-halo-color"),p=b.paint.get("sky-atmosphere-sun-intensity"),q=(g=a.fromMat4([],k),h=l,i=p,c=n,d=o,{u_matrix_3f:g,u_sun_direction:h,u_sun_intensity:i,u_color_tint_r:[c.r,c.g,c.b,c.a],u_color_tint_m:[d.r,d.g,d.b,d.a],u_luminance:5e-5});e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+m,b.skyboxTexture,0),j.draw(f,e.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.frontCW,q,"skyboxCapture",b.skyboxGeometry.vertexBuffer,b.skyboxGeometry.indexBuffer,b.skyboxGeometry.segment)}const cf={symbol:function(c,d,b,e,h){if("translucent"!==c.renderPass)return;const f=a.StencilMode.disabled,g=c.colorModeForRenderPass();b.layout.get("text-variable-anchor")&&function(k,e,g,l,m,n,o){const b=e.transform,h="map"===m,i="map"===n,p=b.projection.createTileTransform(b,b.worldSize);for(const f of k){const d=l.getTile(f),c=d.getBucket(g);if(!c||c.projection!==b.projection.name||!c.text||!c.text.segments.get().length)continue;const j=a.evaluateSizeForZoom(c.textSizeData,b.zoom),q=e.transform.calculatePixelsToTileUnitsMatrix(d),r=aB(f.projMatrix,d.tileID.canonical,i,h,e.transform,q),s="none"!==g.layout.get("icon-text-fit")&&c.hasIconData();if(j){const t=Math.pow(2,b.zoom-d.tileID.overscaledZ);bX(c,h,i,o,a.symbolSize,b,r,f,t,j,s,p)}}}(e,c,b,d,b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),h),0!==b.paint.get("icon-opacity").constantOr(1)&&bZ(c,d,b,e,!1,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),b.layout.get("icon-rotation-alignment"),b.layout.get("icon-pitch-alignment"),b.layout.get("icon-keep-upright"),f,g),0!==b.paint.get("text-opacity").constantOr(1)&&bZ(c,d,b,e,!0,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),b.layout.get("text-keep-upright"),f,g),d.map.showCollisionBoxes&&(bU(c,d,b,e,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),!0),bU(c,d,b,e,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),!1))},circle:function(b,r,c,j){if("translucent"!==b.renderPass)return;const s=c.paint.get("circle-opacity"),t=c.paint.get("circle-stroke-width"),u=c.paint.get("circle-stroke-opacity"),k=void 0!==c.layout.get("circle-sort-key").constantOr(1);if(0===s.constantOr(1)&&(0===t.constantOr(1)||0===u.constantOr(1)))return;const f=b.context,v=f.gl,w=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),x=a.StencilMode.disabled,y=b.colorModeForRenderPass(),e=[];for(let g=0;ga.sortKey-b.sortKey);const B={useDepthForOcclusion:"globe"!==b.transform.projection.name};for(const p of e){const{programConfiguration:C,program:i,layoutVertexBuffer:D,indexBuffer:E,uniformValues:F,tile:q}=p.state,G=p.segments;b.terrain&&b.terrain.setupElevationDraw(q,i,B),b.prepareDrawProgram(f,i,q.tileID.toUnwrapped()),i.draw(f,v.TRIANGLES,w,x,y,a.CullFaceMode.disabled,F,c.id,D,E,G,c.paint,b.transform.zoom,C)}},heatmap:function(b,k,c,l){if(0!==c.paint.get("heatmap-opacity")){if("offscreen"===b.renderPass){const d=b.context,g=d.gl,n=a.StencilMode.disabled,o=new a.ColorMode([g.ONE,g.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(b,c,e){const a=b.gl;b.activeTexture.set(a.TEXTURE1),b.viewport.set([0,0,c.width/4,c.height/4,]);let d=e.heatmapFbo;if(d)a.bindTexture(a.TEXTURE_2D,d.colorAttachment.get()),b.bindFramebuffer.set(d.framebuffer);else{const f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),d=e.heatmapFbo=b.createFramebuffer(c.width/4,c.height/4,!1),function(b,c,d,e){const a=b.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,c.width/4,c.height/4,0,a.RGBA,b.extRenderToTextureHalfFloat?b.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),e.colorAttachment.set(d)}(b,c,f,d)}})(d,b,c),d.clear({color:a.Color.transparent});for(let h=0;h{const b=[];bK(a)&&b.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&b.push("RENDER_LINE_GRADIENT");const c=a.paint.get("line-pattern").constantOr(1),d=1!==a.paint.get("line-opacity").constantOr(1);return!c&&d&&b.push("RENDER_LINE_ALPHA_DISCARD"),b})(c);let m=v.includes("RENDER_LINE_ALPHA_DISCARD");for(const h of(b.terrain&&b.terrain.clipOrMaskOverlapStencilType()&&(m=!1),H)){const f=s.getTile(h);if(j&&!f.patternsLoaded())continue;const i=f.getBucket(c);if(!i)continue;b.prepareDrawTile(h);const k=i.programConfigurations.get(c.id),O=b.useProgram(N,k,v),n=u.constantOr(null);if(n&&f.imageAtlas){const w=f.imageAtlas,x=w.patternPositions[n.to.toString()],y=w.patternPositions[n.from.toString()];x&&y&&k.setConstantPatternPositions(x,y)}const o=t.constantOr(null),p=L.constantOr(null);if(!j&&o&&p&&f.lineAtlas){const z=f.lineAtlas,A=z.getDash(o.to,p),B=z.getDash(o.from,p);A&&B&&k.setConstantPatternPositions(A,B)}const C=b.terrain?h.projMatrix:null,D=j?bH(b,f,c,l,C):bG(b,f,c,l,C,i.lineClipsArray.length);if(M){const e=i.gradients[c.id];let E=e.texture;if(c.gradientVersion!==e.version){let F=256;if(c.stepInterpolant){const P=s.getSource().maxzoom,Q=h.canonical.z===P?Math.ceil(1<{O.draw(g,d.TRIANGLES,R,e,S,a.CullFaceMode.disabled,D,c.id,i.layoutVertexBuffer,i.indexBuffer,i.segments,c.paint,b.transform.zoom,k,i.layoutVertexBuffer2)};if(m){const r=b.stencilModeForClipping(h).ref;0===r&&b.terrain&&g.clear({stencil:0});const G={func:d.EQUAL,mask:255};D.u_alpha_discard_threshold=.8,q(new a.StencilMode(G,r,255,d.KEEP,d.KEEP,d.INVERT)),D.u_alpha_discard_threshold=0,q(new a.StencilMode(G,r,255,d.KEEP,d.KEEP,d.KEEP))}else q(b.stencilModeForClipping(h))}m&&(b.resetStencilClippingMasks(),b.terrain&&g.clear({stencil:0}))},fill:function(b,d,c,e){const h=c.paint.get("fill-color"),f=c.paint.get("fill-opacity");if(0===f.constantOr(1))return;const g=b.colorModeForRenderPass(),i=c.paint.get("fill-pattern"),j=b.opaquePassEnabledForLayer()&&!i.constantOr(1)&&1===h.constantOr(a.Color.transparent).a&&1===f.constantOr(0)?"opaque":"translucent";if(b.renderPass===j){const k=b.depthModeForSublayer(1,"opaque"===b.renderPass?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly);b_(b,d,c,e,k,g,!1)}if("translucent"===b.renderPass&&c.paint.get("fill-antialias")){const l=b.depthModeForSublayer(c.getPaintProperty("fill-outline-color")?2:0,a.DepthMode.ReadOnly);b_(b,d,c,e,l,g,!0)}},"fill-extrusion":function(b,d,c,e){const g=c.paint.get("fill-extrusion-opacity");if(0!==g&&"translucent"===b.renderPass){const f=new a.DepthMode(b.context.gl.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);if(1!==g||c.paint.get("fill-extrusion-pattern").constantOr(1))b0(b,d,c,e,f,a.StencilMode.disabled,a.ColorMode.disabled),b0(b,d,c,e,f,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const h=b.colorModeForRenderPass();b0(b,d,c,e,f,a.StencilMode.disabled,h)}}},hillshade:function(b,j,e,f){if("offscreen"!==b.renderPass&&"translucent"!==b.renderPass)return;const k=b.context,g=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),h=b.colorModeForRenderPass(),i=b.terrain&&b.terrain.renderingToTexture,[l,m]="translucent"!==b.renderPass||i?[{},f]:b.stencilConfigForOverlap(f);for(const c of m){const d=j.getTile(c);if(d.needsHillshadePrepare&&"offscreen"===b.renderPass)bf(b,d,e,g,a.StencilMode.disabled,h);else if("translucent"===b.renderPass){const n=i&&b.terrain?b.terrain.stencilModeForRTTOverlap(c):l[c.overscaledZ];bd(b,c,d,e,g,n,h)}}k.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,j,f,m,H,x){if("translucent"!==b.renderPass||0===f.paint.get("raster-opacity")||!m.length)return;const g=b.context,c=g.gl,h=j.getSource(),n=b.useProgram("raster"),q=b.colorModeForRenderPass(),i=b.terrain&&b.terrain.renderingToTexture,[y,o]=h instanceof s||i?[{},m]:b.stencilConfigForOverlap(m),z=o[o.length-1].overscaledZ,A=!b.options.moving;for(const e of o){const r=i?a.DepthMode.disabled:b.depthModeForSublayer(e.overscaledZ-z,1===f.paint.get("raster-opacity")?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly,c.LESS),t=e.toUnwrapped(),d=j.getTile(e);if(i&&(!d||!d.hasData()))continue;const B=i?e.projMatrix:b.transform.calculateProjMatrix(t,A),C=b.terrain&&i?b.terrain.stencilModeForRTTOverlap(e):y[e.overscaledZ],u=x?0:f.paint.get("raster-fade-duration");d.registerFadeDuration(u);const k=j.findLoadedParent(e,0),D=bn(d,k,j,b.transform,u);let l,v;b.terrain&&b.terrain.prepareDrawTile(e);const p="nearest"===f.paint.get("raster-resampling")?c.NEAREST:c.LINEAR;g.activeTexture.set(c.TEXTURE0),d.texture.bind(p,c.CLAMP_TO_EDGE),g.activeTexture.set(c.TEXTURE1),k?(k.texture.bind(p,c.CLAMP_TO_EDGE),l=Math.pow(2,k.tileID.overscaledZ-d.tileID.overscaledZ),v=[d.tileID.canonical.x*l%1,d.tileID.canonical.y*l%1,]):d.texture.bind(p,c.CLAMP_TO_EDGE);const w=bL(B,v||[0,0],l||1,D,f,h instanceof s?h.perspectiveTransform:[0,0]);if(b.prepareDrawProgram(g,n,t),h instanceof s)n.draw(g,c.TRIANGLES,r,a.StencilMode.disabled,q,a.CullFaceMode.disabled,w,f.id,h.boundsBuffer,b.quadTriangleIndexBuffer,h.boundsSegments);else{const{tileBoundsBuffer:E,tileBoundsIndexBuffer:F,tileBoundsSegments:G}=b.getTileBoundsBuffers(d);n.draw(g,c.TRIANGLES,r,C,q,a.CullFaceMode.disabled,w,f.id,E,F,G)}}b.resetStencilClippingMasks()},background:function(b,j,e,k){const l=e.paint.get("background-color"),f=e.paint.get("background-opacity");if(0===f)return;const g=b.context,m=g.gl,n=b.transform,o=n.tileSize,d=e.paint.get("background-pattern");if(b.isPatternMissing(d))return;const p=!d&&1===l.a&&1===f&&b.opaquePassEnabledForLayer()?"opaque":"translucent";if(b.renderPass!==p)return;const t=a.StencilMode.disabled,u=b.depthModeForSublayer(0,"opaque"===p?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly),v=b.colorModeForRenderPass(),q=b.useProgram(d?"backgroundPattern":"background");let h,i=k;i||(i=Object.values(h=b.getBackgroundTiles()).map(a=>a.tileID)),d&&(g.activeTexture.set(m.TEXTURE0),b.imageManager.bind(b.context));const w=e.getCrossfadeParameters();for(const c of i){const r=c.toUnwrapped(),s=k?c.projMatrix:b.transform.calculateProjMatrix(r);b.prepareDrawTile(c);const x=j?j.getTile(c):h?h[c.key]:new a.Tile(c,o,n.zoom,b),y=d?bR(s,f,b,d,{tileID:c,tileSize:o},w):bQ(s,f,l);b.prepareDrawProgram(g,q,r);const{tileBoundsBuffer:z,tileBoundsIndexBuffer:A,tileBoundsSegments:B}=b.getTileBoundsBuffers(x);q.draw(g,m.TRIANGLES,u,t,v,a.CullFaceMode.disabled,y,e.id,z,A,B)}},sky:function(b,k,c){const d=b.transform,i="mercator"===d.projection.name||"globe"===d.projection.name?1:a.smoothstep(7,8,d.zoom),e=c.paint.get("sky-opacity")*i;if(0===e)return;const j=b.context,f=c.paint.get("sky-type"),g=new a.DepthMode(j.gl.LEQUAL,a.DepthMode.ReadOnly,[0,1]),h=b.frameCounter/1e3%1;"atmosphere"===f?"offscreen"===b.renderPass?c.needsSkyboxCapture(b)&&(function(h,e,k,l){const d=h.context,b=d.gl;let i=e.skyboxFbo;if(!i){i=e.skyboxFbo=d.createFramebuffer(32,32,!1),e.skyboxGeometry=new cd(d),e.skyboxTexture=d.gl.createTexture(),b.bindTexture(b.TEXTURE_CUBE_MAP,e.skyboxTexture),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);for(let j=0;j<6;++j)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,b.RGBA,32,32,0,b.RGBA,b.UNSIGNED_BYTE,null)}d.bindFramebuffer.set(i.framebuffer),d.viewport.set([0,0,32,32,]);const f=e.getCenter(h,!0),g=h.useProgram("skyboxCapture"),c=new Float64Array(16);a.identity(c),a.rotateY(c,c,-(.5*Math.PI)),ce(d,e,g,c,f,0),a.identity(c),a.rotateY(c,c,.5*Math.PI),ce(d,e,g,c,f,1),a.identity(c),a.rotateX(c,c,-(.5*Math.PI)),ce(d,e,g,c,f,2),a.identity(c),a.rotateX(c,c,.5*Math.PI),ce(d,e,g,c,f,3),a.identity(c),ce(d,e,g,c,f,4),a.identity(c),a.rotateY(c,c,Math.PI),ce(d,e,g,c,f,5),d.viewport.set([0,0,h.width,h.height,])}(b,c),c.markSkyboxValid(b)):"sky"===b.renderPass&&function(b,c,i,j,k){var f,g;const d=b.context,e=d.gl,l=b.transform,h=b.useProgram("skybox");d.activeTexture.set(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,c.skyboxTexture);const m=(f=l.skyboxMatrix,g=c.getCenter(b,!1),{u_matrix:f,u_sun_direction:g,u_cubemap:0,u_opacity:j,u_temporal_offset:k});b.prepareDrawProgram(d,h),h.draw(d,e.TRIANGLES,i,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,m,"skybox",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,c,g,e,h):"gradient"===f&&"sky"===b.renderPass&&function(c,b,m,n,o){var g,h,i,j,k;const d=c.context,e=d.gl,p=c.transform,l=c.useProgram("skyboxGradient");b.skyboxGeometry||(b.skyboxGeometry=new cd(d)),d.activeTexture.set(e.TEXTURE0);let f=b.colorRampTexture;f||(f=b.colorRampTexture=new a.Texture(d,b.colorRamp,e.RGBA)),f.bind(e.LINEAR,e.CLAMP_TO_EDGE);const q=(g=p.skyboxMatrix,h=b.getCenter(c,!1),i=b.paint.get("sky-gradient-radius"),j=n,k=o,{u_matrix:g,u_color_ramp:0,u_center_direction:h,u_radius:a.degToRad(i),u_opacity:j,u_temporal_offset:k});c.prepareDrawProgram(d,l),l.draw(d,e.TRIANGLES,m,a.StencilMode.disabled,c.colorModeForRenderPass(),a.CullFaceMode.backCW,q,"skyboxGradient",b.skyboxGeometry.vertexBuffer,b.skyboxGeometry.indexBuffer,b.skyboxGeometry.segment)}(b,c,g,e,h)},debug:function(c,d,b){for(let a=0;aa.getOpacity(this.transform.pitch)||.03>a.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[b,c]=a.getFovAdjustedRange(this.transform._fov);if(b>c)return void(this.transform.fogCullDistSq=null);const d=b+.78*(c-b);this.transform.fogCullDistSq=d*d}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(b,c){if(this.width=b*a.exported.devicePixelRatio,this.height=c*a.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const d of this.style.order)this.style._layers[d].resize()}setup(){const b=this.context,c=new a.StructArrayLayout2i4;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=b.createVertexBuffer(c,a.posAttributes.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.StructArrayLayout2i4;d.emplaceBack(0,0),d.emplaceBack(a.EXTENT,0),d.emplaceBack(0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=b.createVertexBuffer(d,a.posAttributes.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const e=new a.StructArrayLayout2i4;e.emplaceBack(-1,-1),e.emplaceBack(1,-1),e.emplaceBack(-1,1),e.emplaceBack(1,1),this.viewportBuffer=b.createVertexBuffer(e,a.posAttributes.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.StructArrayLayout4i8;f.emplaceBack(0,0,0,0),f.emplaceBack(a.EXTENT,0,a.EXTENT,0),f.emplaceBack(0,a.EXTENT,0,a.EXTENT),f.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.mercatorBoundsBuffer=b.createVertexBuffer(f,a.boundsAttributes.members),this.mercatorBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const h=new a.StructArrayLayout3ui6;h.emplaceBack(0,1,2),h.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=b.createIndexBuffer(h);const i=new a.StructArrayLayout1ui2;for(const j of[0,1,3,2,0])i.emplaceBack(j);this.debugIndexBuffer=b.createIndexBuffer(i),this.emptyTexture=new a.Texture(b,{width:1,height:1,data:new Uint8Array([0,0,0,0])},b.gl.RGBA),this.identityMat=a.create();const g=this.context.gl;this.stencilClearMode=new a.StencilMode({func:g.ALWAYS,mask:0},0,255,g.ZERO,g.ZERO,g.ZERO),this.loadTimeStamps.push(a.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const b=this.context,c=b.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(b,c.TRIANGLES,a.DepthMode.disabled,this.stencilClearMode,a.ColorMode.disabled,a.CullFaceMode.disabled,bm(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(h,d,b){if(!d||this.currentStencilSource===d.id||!h.isTileClipped()||!b||0===b.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let g=!1;for(const i of b)if(void 0===this._tileClippingMaskIDs[i.key]){g=!0;break}if(!g)return}this.currentStencilSource=d.id;const e=this.context,c=e.gl;this.nextStencilID+b.length>256&&this.clearStencil(),e.setColorMode(a.ColorMode.disabled),e.setDepthMode(a.DepthMode.disabled);const j=this.useProgram("clippingMask");for(const f of(this._tileClippingMaskIDs={},b)){const k=d.getTile(f),l=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,{tileBoundsBuffer:m,tileBoundsIndexBuffer:n,tileBoundsSegments:o}=this.getTileBoundsBuffers(k);j.draw(e,c.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:c.ALWAYS,mask:0},l,255,c.KEEP,c.KEEP,c.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bm(f.projMatrix),"$clipping",m,n,o)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const c=this.nextStencilID++,b=this.context.gl;return new a.StencilMode({func:b.NOTEQUAL,mask:255},c,255,b.KEEP,b.KEEP,b.REPLACE)}stencilModeForClipping(c){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(c);const b=this.context.gl;return new a.StencilMode({func:b.EQUAL,mask:255},this._tileClippingMaskIDs[c.key],0,b.KEEP,b.KEEP,b.REPLACE)}stencilConfigForOverlap(h){const c=this.context.gl,b=h.sort((a,b)=>b.overscaledZ-a.overscaledZ),f=b[b.length-1].overscaledZ,d=b[0].overscaledZ-f+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const g={};for(let e=0;e=0;this.currentLayer--){const k=this.style._layers[c[this.currentLayer]],l=b._getLayerSourceCache(k);if(k.isSky())continue;const x=l?g[l.id]:void 0;this._renderTileClippingMasks(k,l,x),this.renderLayer(this,l,k,x)}if(this.renderPass="sky",(a.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const a=b._getLayerSourceCache(c);a&&!c.isHidden(this.transform.zoom)&&(!t||t.getSource().maxzoom0?a.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const b=this.imageManager.getPattern(a.from.toString()),c=this.imageManager.getPattern(a.to.toString());return!b||!c}currentGlobalDefines(){const b=this.terrain&&this.terrain.renderingToTexture,c=this.style&&this.style.fog,a=[];return this.terrain&&!this.terrain.renderingToTexture&&a.push("TERRAIN"),c&&!b&&0!==c.getOpacity(this.transform.pitch)&&a.push("FOG"),b&&a.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&a.push("OVERDRAW_INSPECTOR"),a}useProgram(a,c,e){this.cache=this.cache||{};const d=this.currentGlobalDefines().concat(e||[]),b=bt.cacheKey(a,d,c);return this.cache[b]||(this.cache[b]=new bt(this.context,a,ba[a],c,bS[a],d)),this.cache[b]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=a.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(a){this.terrain&&this.terrain.prepareDrawTile(a)}prepareDrawProgram(c,d,e){if(this.terrain&&this.terrain.renderingToTexture)return;const a=this.style.fog;if(a){const b=a.getOpacity(this.transform.pitch);0!==b&&d.setFogUniformValues(c,((b,c,d,e)=>{const a=c.properties.get("color"),f=b.frameCounter/1e3%1,g=[a.r/a.a,a.g/a.a,a.b/a.a,e,];return{u_fog_matrix:d?b.transform.calculateFogTileMatrix(d):b.identityMat,u_fog_range:c.getFovAdjustedRange(b.transform._fov),u_fog_color:g,u_fog_horizon_blend:c.properties.get("horizon-blend"),u_fog_temporal_offset:f}})(this,a,e,b))}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,b=a.createTexture();return a.bindTexture(a.TEXTURE_2D,b),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),b}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&0!==a.getOpacity(this.transform.pitch)}getBackgroundTiles(){const d=this._backgroundTiles,c=this._backgroundTiles={},e=this.transform.coveringTiles({tileSize:512});for(const b of e)c[b.key]=d[b.key]||new a.Tile(b,512,this.transform.tileZoom,this);return c}clearBackgroundTiles(){this._backgroundTiles={}}}class ch{constructor(a=0,b=0,c=0,d=0){if(isNaN(a)||a<0||isNaN(b)||b<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=b,this.left=c,this.right=d}interpolate(b,c,d){return null!=c.top&&null!=b.top&&(this.top=a.number(b.top,c.top,d)),null!=c.bottom&&null!=b.bottom&&(this.bottom=a.number(b.bottom,c.bottom,d)),null!=c.left&&null!=b.left&&(this.left=a.number(b.left,c.left,d)),null!=c.right&&null!=b.right&&(this.right=a.number(b.right,c.right,d)),this}getCenter(b,c){const d=a.clamp((this.left+b-this.right)/2,0,b),e=a.clamp((this.top+c-this.bottom)/2,0,c);return new a.pointGeometry(d,e)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new ch(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ci(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function cj(c,b){a.setColumn(c,3,[b[0],b[1],b[2],1])}function ck(c,d){const b=a.identity$1([]);return a.rotateZ$1(b,b,-d),a.rotateX$1(b,b,-c),b}function cl(b,c){const f=[b[0],b[1],0],d=[c[0],c[1],0];if(a.length(f)>=1e-15){const g=a.normalize([],f);a.scale$2(d,g,a.dot(d,g)),c[0]=d[0],c[1]=d[1]}const e=a.cross([],c,b);if(1e-15>a.len(e))return null;const h=Math.atan2(-e[1],e[0]);return ck(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),h)}class x{constructor(a,b){this.position=a,this.orientation=b}get position(){return this._position}set position(b){this._position=this._renderWorldCopies?function(b){if(!b)return;const c=Array.isArray(b)?new a.MercatorCoordinate(b[0],b[1],b[2]):b;return c.x=a.wrap(c.x,0,1),c}(b):b}lookAtPoint(e,b){if(this.orientation=null,!this.position)return;const f=this._elevation?this._elevation.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(e)):0,c=this.position,d=a.MercatorCoordinate.fromLngLat(e,f),g=[d.x-c.x,d.y-c.y,d.z-c.z];b||(b=[0,0,1]),b[2]=Math.abs(b[2]),this.orientation=cl(g,b)}setPitchBearing(b,c){this.orientation=ck(a.degToRad(b),a.degToRad(-c))}}class cm{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,ci(this._transform,this._orientation)),b&&cj(this._transform,b)}get mercatorPosition(){const b=this.position;return new a.MercatorCoordinate(b[0],b[1],b[2])}get position(){const b=a.getColumn(this._transform,3);return[b[0],b[1],b[2]]}set position(a){cj(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,ci(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),b=this.right();return{bearing:Math.atan2(-b[1],b[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,b){this._orientation=ck(a,b),ci(this._transform,this._orientation)}forward(){const b=a.getColumn(this._transform,2);return[-b[0],-b[1],-b[2]]}up(){const b=a.getColumn(this._transform,1);return[-b[0],-b[1],-b[2]]}right(){const b=a.getColumn(this._transform,0);return[b[0],b[1],b[2]]}getCameraToWorld(c,d){const b=new Float64Array(16);return a.invert(b,this.getWorldToCamera(c,d)),b}getWorldToCameraPosition(e,f,c){const d=this.position;a.scale$2(d,d,-e);const b=new Float64Array(16);return a.fromScaling(b,[c,c,c]),a.translate(b,b,d),b[10]*=f,b}getWorldToCamera(f,c){const b=new Float64Array(16),e=new Float64Array(4),d=this.position;return a.conjugate(e,this._orientation),a.scale$2(d,d,-f),a.fromQuat(b,e),a.translate(b,b,d),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=c,b[9]*=c,b[10]*=c,b[11]*=c,b}getCameraToClipPerspective(c,d,e,f){const b=new Float64Array(16);return a.perspective(b,c,d,e,f),b}getDistanceToElevation(b){const c=0===b?0:a.mercatorZfromAltitude(b,this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new cm([...this.position],[...this.orientation])}}function cn(b,e){const f=cp(b),c=function(c,y,d,h,v){const l=new a.LngLat(d.lng-180*cq,d.lat),m=new a.LngLat(d.lng+180*cq,d.lat),n=c.project(l.lng,l.lat),o=c.project(m.lng,m.lat),e=-Math.atan2(o.y-n.y,o.x-n.x),i=a.MercatorCoordinate.fromLngLat(d);i.y=a.clamp(i.y,-0.999975,.999975);const f=i.toLngLat(),g=c.project(f.lng,f.lat),p=a.MercatorCoordinate.fromLngLat(f);p.x+=cq;const q=p.toLngLat(),r=c.project(q.lng,q.lat),w=cs(r.x-g.x,r.y-g.y,e),s=a.MercatorCoordinate.fromLngLat(f);s.y+=cq;const t=s.toLngLat(),u=c.project(t.lng,t.lat),j=cs(u.x-g.x,u.y-g.y,e),x=Math.abs(w.x)/Math.abs(j.y),k=a.identity([]);a.rotateZ(k,k,-e*(1-(v?0:h)));const b=a.identity([]);return a.scale(b,b,[1,1-(1-x)*h,1]),b[4]=-j.x/j.y*h,a.rotateZ(b,b,e),a.multiply$1(b,k,b),b}(b.projection,0,b.center,f,e),d=co(b);return a.scale(c,c,[d,d,1]),c}function co(b){const c=b.projection,d=cp(b),e=cr(c,b.center),f=cr(c,a.LngLat.convert(c.center));return Math.pow(2,e*d+(1-d)*f)}function cp(b){const c=b.projection.range;if(!c)return 0;const e=Math.max(b.width,b.height),d=Math.log(e/1024)/Math.LN2;return a.smoothstep(c[0]+d,c[1]+d,b.zoom)}const cq=1/4e4;function cr(d,c){const b=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),e=new a.LngLat(c.lng-180*cq,b),f=new a.LngLat(c.lng+180*cq,b),g=d.project(e.lng,b),h=d.project(f.lng,b),i=a.MercatorCoordinate.fromLngLat(e),j=a.MercatorCoordinate.fromLngLat(f),k=h.x-g.x,l=h.y-g.y,m=j.x-i.x,n=j.y-i.y;return Math.log(Math.sqrt((m*m+n*n)/(k*k+l*l)))/Math.LN2}function cs(a,b,c){const d=Math.cos(c),e=Math.sin(c);return{x:a*d-b*e,y:a*e+b*d}}class ct{constructor(e,f,b,c,d){this.tileSize=512,this._renderWorldCopies=void 0===d||d,this._minZoom=e||0,this._maxZoom=f||22,this._minPitch=null==b?0:b,this._maxPitch=null==c?60:c,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ch,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new cm,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new ct(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.setProjection(this.getProjection()),a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a.tileSize=this.tileSize,a.setMaxBounds(this.getMaxBounds()),a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._cameraZoom=this._cameraZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,a?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(a){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),a&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return a.pick(this.projection,["name","center","parallels",])}setProjection(b){null==b&&(b={name:"mercator"}),this.projectionOptions=b;const c=this.projection?this.getProjection():void 0;return this.projection=a.getProjection(b),!D(c,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&& !0===this.projection.supportsWorldCopies}set renderWorldCopies(a){void 0===a?a=!0:null===a&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return a.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(m){var b,c,d,g,h,i,j,k,e,f;const l=-m*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=(b=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0),b[0]=1,b[3]=1,b),c=this.rotationMatrix,d=this.rotationMatrix,g=this.angle,h=d[0],i=d[1],j=d[2],k=d[3],e=Math.sin(g),f=Math.cos(g),c[0]=h*f+j*e,c[1]=i*f+k*e,c[2]=-(h*e)+j*f,c[3]=-(i*e)+k*f)}get pitch(){return this._pitch/Math.PI*180}set pitch(c){const b=a.clamp(c,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==b&&(this._unmodified=!1,this._pitch=b,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(b){const a=Math.min(Math.max(b,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===a?(this._cameraZoom=null,!1):(this._centerAltitude=a,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const i=this._elevation,d=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],f=this.horizonLineFromTop();let g=0,e=0;for(let b=0;bc.maxzoom&&(d=c.maxzoom);const r=this.locationCoordinate(this.center),e=1<{const d=1/4e4,g=new a.MercatorCoordinate(b.x+d,b.y,b.z),h=new a.MercatorCoordinate(b.x,b.y+d,b.z),i=b.toLngLat(),j=g.toLngLat(),k=h.toLngLat(),c=this.locationCoordinate(i),e=this.locationCoordinate(j),f=this.locationCoordinate(k),l=Math.hypot(e.x-c.x,e.y-c.y),m=Math.hypot(f.x-c.x,f.y-c.y);return Math.sqrt(l*m)*O/d},j=b=>{const c=F,d=N;return{aabb:a.tileAABB(this,e,0,0,0,b,d,c,this.projection),zoom:0,x:0,y:0,minZ:d,maxZ:c,wrap:b,fullyVisible:!1}},f=[];let h=[];const k=d,v=c.reparseOverscaled?A:d,G=a=>a*a,Q=G((u-this._centerAltitude)*E),H=b=>{if(!this._elevation||!b.tileID||!C)return;const c=this._elevation.getMinMaxForTile(b.tileID),a=b.aabb;c?(a.min[2]=c.min,a.max[2]=c.max,a.center[2]=(a.min[2]+a.max[2])/2):(b.shouldSplit=I(b),b.shouldSplit||(a.min[2]=a.max[2]=a.center[2]=this._centerAltitude))},I=b=>{if(b.zoom.85?1:h}const i=d*d+e*e+c;return i{if(b*G(.707)0;){const b=f.pop(),l=b.x,m=b.y;let n=b.fullyVisible;if(!n){const w=b.aabb.intersects(D);if(0===w)continue;n=2===w}if(b.zoom!==k&&I(b))for(let g=0;g<4;g++){const o=(l<<1)+g%2,p=(m<<1)+(g>>1),q={aabb:C?b.aabb.quadrant(g):a.tileAABB(this,e,b.zoom+1,o,p,b.wrap,b.minZ,b.maxZ,this.projection),zoom:b.zoom+1,x:o,y:p,wrap:b.wrap,fullyVisible:n,tileID:void 0,shouldSplit:void 0,minZ:b.minZ,maxZ:b.maxZ};B&&(q.tileID=new a.OverscaledTileID(b.zoom+1===k?v:b.zoom+1,b.wrap,b.zoom+1,o,p),H(q)),f.push(q)}else{const x=b.zoom===k?v:b.zoom;if(c.minzoom&&c.minzoom>x)continue;const y=s[0]-(.5+l+(b.wrap<{const e=[0,0,0,1],f=[a.EXTENT,a.EXTENT,0,1],i=this.calculateFogTileMatrix(d.tileID.toUnwrapped());a.transformMat4$1(e,e,i),a.transformMat4$1(f,f,i);const g=a.getAABBPointSquareDist(e,f);if(0===g)return!0;let j=!1;const k=this._elevation;if(k&&g>R&&0!==S){const m=this.calculateProjMatrix(d.tileID.toUnwrapped());let b;c.isTerrainDEM||(b=k.getMinMaxForTile(d.tileID)),b||(b={min:N,max:F});const l=a.furthestTileCorner(this.rotation),h=[l[0]*a.EXTENT,l[1]*a.EXTENT,b.max,];a.transformMat4(h,h,m),j=(1-h[1])*this.height*.5a.distanceSq-b.distanceSq).map(a=>a.tileID)}resize(a,b){this.width=a,this.height=b,this.pixelsToGLUnits=[2/a,-2/b],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(b){const d=a.clamp(b.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),c=this.projection.project(b.lng,d);return new a.pointGeometry(c.x*this.worldSize,c.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(e,f){const b=this.pointCoordinate(f),c=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(e);this.setLocation(new a.MercatorCoordinate(d.x-(b.x-c.x),d.y-(b.y-c.y)))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this._coordinatePoint(this.locationCoordinate(a),!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(b,c){const e=c?a.mercatorZfromAltitude(c,b.lat):void 0,d=this.projection.project(b.lng,b.lat);return new a.MercatorCoordinate(d.x,d.y,e)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(d,f){const h=null!=f?f:this._centerAltitude,b=[d.x,d.y,0,1],c=[d.x,d.y,1,1];a.transformMat4$1(b,b,this.pixelMatrixInverse),a.transformMat4$1(c,c,this.pixelMatrixInverse);const i=c[3];a.scale$1(b,b,1/b[3]),a.scale$1(c,c,1/i);const e=b[2],g=c[2];return{p0:b,p1:c,t:e===g?0:(h-e)/(g-e)}}screenPointToMercatorRay(d){const b=[d.x,d.y,0,1],c=[d.x,d.y,1,1];return a.transformMat4$1(b,b,this.pixelMatrixInverse),a.transformMat4$1(c,c,this.pixelMatrixInverse),a.scale$1(b,b,1/b[3]),a.scale$1(c,c,1/c[3]),b[2]=a.mercatorZfromAltitude(b[2],this._center.lat)*this.worldSize,c[2]=a.mercatorZfromAltitude(c[2],this._center.lat)*this.worldSize,a.scale$1(b,b,1/this.worldSize),a.scale$1(c,c,1/this.worldSize),new a.Ray([b[0],b[1],b[2]],a.normalize([],a.sub([],c,b)))}rayIntersectionCoordinate(e){const{p0:b,p1:c,t:d}=e,f=a.mercatorZfromAltitude(b[2],this._center.lat),g=a.mercatorZfromAltitude(c[2],this._center.lat);return new a.MercatorCoordinate(a.number(b[0],c[0],d)/this.worldSize,a.number(b[1],c[1],d)/this.worldSize,a.number(f,g,d))}pointCoordinate(a,b=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(a.x,a.y,b)}pointCoordinate3D(c){if(!this.elevation)return this.pointCoordinate(c);const i=this.elevation;let b=this.elevation.pointCoordinate(c);if(b)return new a.MercatorCoordinate(b[0],b[1],b[2]);let f=0,d=this.horizonLineFromTop();if(c.y>d)return this.pointCoordinate(c);const j=.02*d,e=c.clone();for(let g=0;g<10&&d-f>j;g++){e.y=a.number(f,d,.66);const h=i.pointCoordinate(e);h?(d=e.y,b=h):f=e.y}return b?new a.MercatorCoordinate(b[0],b[1],b[2]):this.pointCoordinate(c)}isPointAboveHorizon(a){if(this.elevation)return!this.elevation.pointCoordinate(a);{const b=this.horizonLineFromTop();return a.y0?new a.pointGeometry(b[0]/b[3],b[1]/b[3]):new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(j,k){var f,l,g,m,h,n,i,o;const p=new a.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),q=new a.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),r=new a.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),s=new a.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let b=this.pointCoordinate(p,j),c=this.pointCoordinate(q,j);const d=this.pointCoordinate(r,k),e=this.pointCoordinate(s,k);return b.y>1&&c.y>=0?b=new a.MercatorCoordinate((1-e.y)/(f=e,((l=b).y-f.y)/(l.x-f.x))+e.x,1):b.y<0&&c.y<=1&&(b=new a.MercatorCoordinate(-e.y/(g=e,((m=b).y-g.y)/(m.x-g.x))+e.x,0)),c.y>1&&b.y>=0?c=new a.MercatorCoordinate((1-d.y)/(h=d,((n=c).y-h.y)/(n.x-h.x))+d.x,1):c.y<0&&b.y<=1&&(c=new a.MercatorCoordinate(-d.y/(i=d,((o=c).y-i.y)/(o.x-i.x))+d.x,0)),new a.LngLatBounds().extend(this.coordinateLocation(b)).extend(this.coordinateLocation(c)).extend(this.coordinateLocation(e)).extend(this.coordinateLocation(d))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length)return this._getBounds(0,0);const b=a.visibleDemTiles.reduce((a,b)=>{if(b.dem){const c=b.dem.tree;a.min=Math.min(a.min,c.minimums[0]),a.max=Math.max(a.max,c.maximums[0])}return a},{min:Number.MAX_VALUE,max:0});return this._getBounds(b.min*a.exaggeration(),b.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(b=!0){const c=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,a=this.height/2-c*(1-this._horizonShift);return b?Math.max(0,a):a}getMaxBounds(){return this.maxBounds}setMaxBounds(b){this.maxBounds=b,this.minLat=-a.MAX_MERCATOR_LATITUDE,this.maxLat=a.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,b&&(this.minLat=b.getSouth(),this.maxLat=b.getNorth(),this.minLng=b.getWest(),this.maxLng=b.getEast(),this.maxLngi&&(g=i-l),i-he&&(b=e-k),e-d.5?j-1:j,k>.5?k-1:k,0,]),this.alignedProjMatrix=l,b=a.create(),a.scale(b,b,[this.width/2,-this.height/2,1,]),a.translate(b,b,[1,-1,0]),this.labelPlaneMatrix=b,b=a.create(),a.scale(b,b,[1,-1,1]),a.translate(b,b,[-1,-1,0]),a.scale(b,b,[2/this.width,2/this.height,1,]),this.glCoordMatrix=b,this.pixelMatrix=a.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},b=a.invert(new Float64Array(16),this.pixelMatrix),!b)throw new Error("failed to invert matrix");this.pixelMatrixInverse=b,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSize,f=this.cameraPixelsPerMeter,b=this._camera.position,g=1/this.height,d=[e,e,f];a.scale$2(d,d,g),a.scale$2(b,b,-1),a.multiply$2(b,b,d);const c=a.create();a.translate(c,c,b),a.scale(c,c,d),this.mercatorFogMatrix=c,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,f,g)}_computeCameraPosition(a){const e=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),d=this.point,c=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*e-a/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-b[0]*c,d.y/this.worldSize-b[1]*c,a/this.worldSize*this._centerAltitude-b[2]*c,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(b){const e=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=b[2];let d=1;c>0&&(d=Math.min((e-this._camera.position[2])/c,1)),this._camera.position=a.scaleAndAdd([],this._camera.position,b,d),this._updateStateFromCamera()}_updateStateFromCamera(){const b=this._camera.position,e=this._camera.forward(),{pitch:c,bearing:f}=this._camera.getPitchBearing(),g=a.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,h=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.degToRad(this._maxPitch)),d=Math.max((b[2]-g)/Math.cos(c),h),i=this._zoomFromMercatorZ(d);a.scaleAndAdd(b,b,e,d),this._pitch=a.clamp(c,a.degToRad(this.minPitch),a.degToRad(this.maxPitch)),this.angle=a.wrap(f,-Math.PI,Math.PI),this._setZoom(a.clamp(i,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new a.MercatorCoordinate(b[0],b[1],b[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}_terrainEnabled(){return!(!this._elevation|| !this.projection.supportsTerrain&&(a.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(b,c){const f=Math.min(b.x,c.x),g=Math.max(b.x,c.x),e=Math.min(b.y,c.y),h=Math.max(b.y,c.y);if(el||d.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.pointGeometry(0,0),new a.pointGeometry(this.width,this.height))}zoomDeltaToMovement(c,d){const b=a.length(a.sub([],this._camera.position,c)),e=this._zoomFromMercatorZ(b)+d;return b-this._mercatorZfromZoom(e)}getCameraPoint(){const b=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,b))}}function cu(a,b){let c=!1,d=null;const e=()=>{d=null,c&&(a(),d=setTimeout(e,b),c=!1)};return()=>(c=!0,d||e(),d)}const d={linearity:.3,easing:a.bezier(0,0,.3,1)},cv=a.extend({deceleration:2500,maxSpeed:1400},d),cw=a.extend({deceleration:20,maxSpeed:1400},d),cx=a.extend({deceleration:1e3,maxSpeed:360},d),cy=a.extend({deceleration:1e3,maxSpeed:90},d);function cz(a,b){(!a.duration||a.durationf.unproject(a)),g=d.reduce((a,b,d,c)=>a.add(b.div(c.length)),new a.pointGeometry(0,0));super(e,{points:d,point:g,lngLats:i,lngLat:f.unproject(g),originalEvent:c}),this._defaultPrevented=!1}}class cD extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,c,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class cE{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cD(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cB(a.type,this._map,a))}mouseup(a){this._map.fire(new cB(a.type,this._map,a))}preclick(c){const b=a.extend({},c);b.type="preclick",this._map.fire(new cB(b.type,this._map,b))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cB(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cB(a.type,this._map,a))}mouseover(a){this._map.fire(new cB(a.type,this._map,a))}mouseout(a){this._map.fire(new cB(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cC(a.type,this._map,a))}touchmove(a){this._map.fire(new cC(a.type,this._map,a))}touchend(a){this._map.fire(new cC(a.type,this._map,a))}touchcancel(a){this._map.fire(new cC(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cF{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cB(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cB("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cB(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cG{constructor(a,b){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=b.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,c){this.isEnabled()&&a.shiftKey&&0===a.button&&(b.disableDrag(),this._startPos=this._lastPos=c,this._active=!0)}mousemoveWindow(d,e){if(!this._active)return;const a=e;if(this._lastPos.equals(a)|| !this._box&&a.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${f}px,${h}px)`,this._box.style.width=g-f+"px",this._box.style.height=i-h+"px")})}mouseupWindow(c,f){if(!this._active||0!==c.button)return;const d=this._startPos,e=f;if(this.reset(),b.suppressClick(),d.x!==e.x||d.y!==e.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:c})),{cameraAnimation:a=>a.fitScreenCoordinates(d,e,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",c)}keydown(a){this._active&&27===a.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),b.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(b,c){return this._map.fire(new a.Event(b,{originalEvent:c}))}}function cH(b,d){const c={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=d.timeStamp),b.length===this.numTouches&&(this.centroid=function(b){const c=new a.pointGeometry(0,0);for(const d of b)c._add(d);return c.div(b.length)}(c),this.touches=cH(b,c)))}touchmove(g,c,d){if(this.aborted||!this.centroid)return;const e=cH(d,c);for(const a in this.touches){const f=this.touches[a],b=e[a];(!b||b.dist(f)>30)&&(this.aborted=!0)}}touchend(b,d,c){if((!this.centroid||b.timeStamp-this.startTime>500)&&(this.aborted=!0),0===c.length){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}(b),this.numTaps=b.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,b,c){this.singleTap.touchstart(a,b,c)}touchmove(a,b,c){this.singleTap.touchmove(a,b,c)}touchend(b,c,d){const a=this.singleTap.touchend(b,c,d);if(a){const e=b.timeStamp-this.lastTime<500,f=!this.lastTap||30>this.lastTap.dist(a);if(e&&f||this.reset(),this.count++,this.lastTime=b.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class cJ{constructor(){this._zoomIn=new cI({numTouches:1,numTaps:2}),this._zoomOut=new cI({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,b,c){this._zoomIn.touchstart(a,b,c),this._zoomOut.touchstart(a,b,c)}touchmove(a,b,c){this._zoomIn.touchmove(a,b,c),this._zoomOut.touchmove(a,b,c)}touchend(a,b,c){const d=this._zoomIn.touchend(a,b,c),e=this._zoomOut.touchend(a,b,c);return d?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(d)},{originalEvent:a})}):e?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(e)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cK={0:1,2:2};class f{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(a,b){return!1}_move(a,b){return{}}mousedown(a,d){if(this._lastPoint)return;const c=b.mouseButton(a);this._correctButton(a,c)&&(this._lastPoint=d,this._eventButton=c)}mousemoveWindow(c,a){const b=this._lastPoint;if(b){if(c.preventDefault(),function(a,c){const b=cK[c];return void 0===a.buttons||(a.buttons&b)!==b}(c,this._eventButton))this.reset();else if(this._moved||!(a.dist(b)0&&(this._active=!0);const b=cH(g,k),h=new a.pointGeometry(0,0),d=new a.pointGeometry(0,0);let c=0;for(const e in b){const f=b[e],i=this._touches[e];i&&(h._add(f),d._add(f.sub(i)),c++,b[e]=f)}if(this._touches=b,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class g{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(a){}_move(a,b,c){return{}}touchstart(c,b,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier,],this._start([b[0],b[1]]))}touchmove(c,d,e){if(!this._firstTwoTouches)return;c.preventDefault();const[f,g]=this._firstTwoTouches,a=cP(e,d,f),b=cP(e,d,g);if(!a||!b)return;const h=this._aroundCenter?null:a.add(b).div(2);return this._move([a,b],h,c)}touchend(h,a,c){if(!this._firstTwoTouches)return;const[d,e]=this._firstTwoTouches,f=cP(c,a,d),g=cP(c,a,e);f&&g||(this._active&&b.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function cP(b,c,d){for(let a=0;aMath.abs(cQ(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cQ(this._distance,c),pinchAround:b}}}function cS(a,b){return 180*a.angleWith(b)/Math.PI}class cT extends g{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,b){const c=this._vector;if(this._vector=a[0].sub(a[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:cS(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cS(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cV extends g{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(a){this._lastPoints=a,cU(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,e,b){const c=a[0].sub(this._lastPoints[0]),d=a[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&b.touches.length<3)&&(this._valid=this.gestureBeginsVertically(c,d,b.timeStamp),this._valid))return this._lastPoints=a,this._active=!0,{pitchDelta:-((c.y+d.y)/2*.5)}}gestureBeginsVertically(a,b,c){if(void 0!==this._valid)return this._valid;const d=a.mag()>=2,e=b.mag()>=2;if(!d&&!e)return;if(!d||!e)return void 0===this._firstMove&&(this._firstMove=c),c-this._firstMove<100&&void 0;const f=a.y>0==b.y>0;return cU(a)&&cU(b)&&f}}class cW{constructor(){const a={panStep:100,bearingStep:15,pitchStep:10};this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let d=0,b=0,c=0,e=0,f=0;switch(a.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:a.shiftKey?b=-1:(a.preventDefault(),e=-1);break;case 39:a.shiftKey?b=1:(a.preventDefault(),e=1);break;case 38:a.shiftKey?c=1:(a.preventDefault(),f=-1);break;case 40:a.shiftKey?c=-1:(a.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(b=0,c=0),{cameraAnimation:g=>{const h=g.getZoom();g.easeTo({duration:300,easeId:"keyboardHandler",easing:cX,zoom:d?Math.round(h)+d*(a.shiftKey?2:1):h,bearing:g.getBearing()+b*this._bearingStep,pitch:g.getPitch()+c*this._pitchStep,offset:[-e*this._panStep,-f*this._panStep,],center:g.getCenter()},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function cX(a){return a*(2-a)}const cY=4.000244140625;class cZ{constructor(b,c){this._map=b,this._el=b.getCanvasContainer(),this._handler=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active|| void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(b){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(b.ctrlKey||b.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let c=b.deltaMode===a.window.WheelEvent.DOM_DELTA_LINE?40*b.deltaY:b.deltaY;const d=a.exported.now(),e=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,0!==c&&c%cY==0?this._type="wheel":0!==c&&4>Math.abs(c)?this._type="trackpad":e>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,b)):this._type||(this._type=200>Math.abs(e*c)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),b.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=b,this._delta-=c,this._active||this._start(b)),b.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const c=b.mousePos(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:c,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const b=this._map.transform,c=()=>b._terrainEnabled()&&this._aroundCoord?b.computeZoomRelativeTo(this._aroundCoord):b.zoom;if(0!==this._delta){const k="wheel"===this._type&&Math.abs(this._delta)>cY?this._wheelZoomRate:this._defaultZoomRate;let d=2/(1+Math.exp(-Math.abs(this._delta*k)));this._delta<0&&0!==d&&(d=1/d);const l=c(),m=Math.pow(2,l),n="number"==typeof this._targetZoom?b.zoomScale(this._targetZoom):m;this._targetZoom=Math.min(b.maxZoom,Math.max(b.minZoom,b.scaleZoom(n*d))),"wheel"===this._type&&(this._startZoom=c(),this._easing=this._smoothOutEasing(200)),this._delta=0}const g="number"==typeof this._targetZoom?this._targetZoom:c(),h=this._startZoom,i=this._easing;let f,e=!1;if("wheel"===this._type&&h&&i){const j=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),o=i(j);f=a.number(h,g,o),j<1?this._frameId||(this._frameId=!0):e=!0}else f=g,e=!0;return this._active=!0,e&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!e,zoomDelta:f-c(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(g){let c=a.ease;if(this._prevEase){const b=this._prevEase,e=(a.exported.now()-b.start)/b.duration,f=b.easing(e+.01)-b.easing(e),d=.27/Math.sqrt(f*f+1e-4)*.01,h=Math.sqrt(.0729-d*d);c=a.bezier(d,h,.25,1)}return this._prevEase={start:a.exported.now(),duration:g,easing:c},c}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=b.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(a.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_isFullscreen(){return!!a.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class c${constructor(a,b){this._clickZoom=a,this._tapZoom=b}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class c_{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,b){return a.preventDefault(),{cameraAnimation(c){c.easeTo({duration:300,zoom:c.getZoom()+(a.shiftKey?-1:1),around:c.unproject(b)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c0{constructor(){this._tap=new cI({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(b,c,a){this._swipePoint||(this._tapTime&&b.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=c[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(b,c,a))}touchmove(a,b,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=b[0],e=d.y-this._swipePoint.y;return this._swipePoint=d,a.preventDefault(),this._active=!0,{zoomDelta:e/128}}}else this._tap.touchmove(a,b,c)}touchend(a,c,b){this._tapTime?this._swipePoint&&0===b.length&&this.reset():this._tap.touchend(a,c,b)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c1{constructor(a,b,c){this._el=a,this._mousePan=b,this._touchPan=c}enable(a){this._inertiaOptions=a||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class c2{constructor(a,b,c){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=b,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class c3{constructor(a,b,c,d){this._el=a,this._touchZoom=b,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const c4=a=>a.zoom||a.drag||a.pitch||a.rotate;class c5 extends a.Event{}function c6(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c7="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c8 extends a.Evented{constructor(b,c){super(),this._moving=!1,this._zooming=!1,this.transform=b,this._bearingSnap=c.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,b){return this.jumpTo({center:a},b)}panBy(b,c,d){return b=a.pointGeometry.convert(b).mult(-1),this.panTo(this.transform.center,a.extend({offset:b},c),d)}panTo(b,c,d){return this.easeTo(a.extend({center:b},c),d)}getZoom(){return this.transform.zoom}setZoom(a,b){return this.jumpTo({zoom:a},b),this}zoomTo(b,c,d){return this.easeTo(a.extend({zoom:b},c),d)}zoomIn(a,b){return this.zoomTo(this.getZoom()+1,a,b),this}zoomOut(a,b){return this.zoomTo(this.getZoom()-1,a,b),this}getBearing(){return this.transform.bearing}setBearing(a,b){return this.jumpTo({bearing:a},b),this}getPadding(){return this.transform.padding}setPadding(a,b){return this.jumpTo({padding:a},b),this}rotateTo(b,c,d){return this.easeTo(a.extend({bearing:b},c),d)}resetNorth(b,c){return this.rotateTo(0,a.extend({duration:1e3},b),c),this}resetNorthPitch(b,c){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},b),c),this}snapToNorth(a,b){return Math.abs(this.getBearing())i=>{if(t&&(c.zoom=a.number(d,g,i)),u&&(c.bearing=a.number(e,n,i)),v&&(c.pitch=a.number(f,o,i)),w&&(c.interpolatePadding(z,p,i),h=c.centerPoint.add(q)),k)c.setLocationAtPoint(k,s);else{const l=c.zoomScale(c.zoom-d),x=g>d?Math.min(2,B):Math.max(.5,B),y=Math.pow(x,1-i),j=c.unproject(r.add(A.mult(i*y)).mult(l));c.setLocationAtPoint(c.renderWorldCopies?j.wrap():j,h)}return b.preloadOnly||this._fireMoveEvents(m),c};if(b.preloadOnly){const x=this._emulate(l,b.duration,c);return this._preloadTiles(x),this}const y={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=t,this._rotating=u,this._pitching=v,this._padding=w,this._easeId=b.easeId,this._prepareEase(m,b.noMoveStart,y),this._ease(l(c),a=>{c.recenterOnTerrain(),this._afterEase(m,a)},b),this}_prepareEase(b,d,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",d||c.moving||this.fire(new a.Event("movestart",b)),this._zooming&&!c.zooming&&this.fire(new a.Event("zoomstart",b)),this._rotating&&!c.rotating&&this.fire(new a.Event("rotatestart",b)),this._pitching&&!c.pitching&&this.fire(new a.Event("pitchstart",b))}_fireMoveEvents(b){this.fire(new a.Event("move",b)),this._zooming&&this.fire(new a.Event("zoom",b)),this._rotating&&this.fire(new a.Event("rotate",b)),this._pitching&&this.fire(new a.Event("pitch",b))}_afterEase(b,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId,this.transform.cameraElevationReference="ground";const d=this._zooming,e=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.Event("zoomend",b)),e&&this.fire(new a.Event("rotateend",b)),f&&this.fire(new a.Event("pitchend",b)),this.fire(new a.Event("moveend",b))}flyTo(b,g){if(!b.essential&&a.exported.prefersReducedMotion){const r=a.pick(b,["center","zoom","bearing","pitch","around",]);return this.jumpTo(r,g)}this.stop(),b=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},b);const c=this.transform,f=this.getZoom(),h=this.getBearing(),k=this.getPitch(),J=this.getPadding(),l="zoom"in b?a.clamp(+b.zoom,c.minZoom,c.maxZoom):f,s="bearing"in b?this._normalizeBearing(b.bearing,h):h,t="pitch"in b?+b.pitch:k,u="padding"in b?b.padding:c.padding,v=c.zoomScale(l-f),w=a.pointGeometry.convert(b.offset);let x=c.centerPoint.add(w);const m=c.pointLocation(x),n=a.LngLat.convert(b.center||m);this._normalizeCenter(n);const y=c.project(m),z=c.project(n).sub(y);let d=b.curve;const e=Math.max(c.width,c.height),i=e/v,o=z.mag();if("minZoom"in b){const A=a.clamp(Math.min(b.minZoom,f,l),c.minZoom,c.maxZoom),B=e/c.zoomScale(A-f);d=Math.sqrt(B/o*2)}const K=d*d;function p(b){const a=(i*i-e*e+(b?-1:1)*K*K*o*o)/(2*(b?i:e)*K*o);return Math.log(Math.sqrt(a*a+1)-a)}function L(a){return(Math.exp(a)-Math.exp(-a))/2}function M(a){return(Math.exp(a)+Math.exp(-a))/2}const C=p(0);let D=function(a){return M(C)/M(C+d*a)},E=function(b){var a;return e*((M(C)*(L(a=C+d*b)/M(a))-L(C))/K)/o},j=(p(1)-C)/d;if(1e-6>Math.abs(o)||!isFinite(j)){if(1e-6>Math.abs(e-i))return this.easeTo(b,g);const N=ib.maxDuration&&(b.duration=0);const F=h!==s,G=t!==k,H=!c.isPaddingEqual(u),q=c=>d=>{const e=d*j,i=1/D(e);c.zoom=1===d?l:f+c.scaleZoom(i),F&&(c.bearing=a.number(h,s,d)),G&&(c.pitch=a.number(k,t,d)),H&&(c.interpolatePadding(J,u,d),x=c.centerPoint.add(w));const m=1===d?n:c.unproject(y.add(z.mult(E(e))).mult(i));return c.setLocationAtPoint(c.renderWorldCopies?m.wrap():m,x),c._updateCenterElevation(),b.preloadOnly||this._fireMoveEvents(g),c};if(b.preloadOnly){const I=this._emulate(q,b.duration,c);return this._preloadTiles(I),this}return this._zooming=!0,this._rotating=F,this._pitching=G,this._padding=H,this._prepareEase(g,!1),this._ease(q(c),()=>this._afterEase(g),b),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(b,c){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,c)}if(!b){const a=this.handlers;a&&a.stop(!1)}return this}_ease(c,d,b){!1===b.animate||0===b.duration?(c(1),d()):(this._easeStart=a.exported.now(),this._easeOptions=b,this._onEaseFrame=c,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const b=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(b)),b<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(b,c){b=a.wrap(b,-180,180);const d=Math.abs(b-c);return Math.abs(b-360-c)180?-360:c< -180?360:0}_emulate(d,e,f){const b=Math.ceil(15*e/1e3),c=[],g=d(f.clone());for(let a=0;a<=b;a++){const h=g(a/b);c.push(h.clone())}return c}}class y{constructor(b={}){this.options=b,a.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(c){const a=this.options&&this.options.compact;return this._map=c,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=b.create("button","mapboxgl-ctrl-attrib-button",this._container),b.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=b.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),a&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===a&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(a,c){const b=this._map._getUIString(`AttributionControl.${c}`);a.setAttribute("aria-label",b),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let b=this._editLink;b||(b=this._editLink=this._container.querySelector(".mapbox-improve-map"));const c=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.config.ACCESS_TOKEN},];if(b){const d=c.reduce((b,a,d)=>(a.value&&(b+=`${a.key}=${a.value}${da.indexOf(b.attribution)&&a.push(b.attribution)}}a.sort((a,b)=>a.length-b.length),a=a.filter((c,d)=>{for(let b=d+1;b=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a,]:a.unshift(this.options.customAttribution));const c=a.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,a.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class c9{constructor(){a.bindAll(["_updateLogo"],this),a.bindAll(["_updateCompact"],this)}onAdd(c){this._map=c,this._container=b.create("div","mapboxgl-ctrl");const a=b.create("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(a){a&&"metadata"!==a.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(0===Object.entries(a).length)return!0;for(const c in a){const b=a[c].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const b=a[0];this._map.getCanvasContainer().offsetWidth<250?b.classList.add("mapboxgl-compact"):b.classList.remove("mapboxgl-compact")}}}class da{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(b){const a=++this._id;return this._queue.push({callback:b,id:a,cancelled:!1}),a}remove(c){const a=this._currentlyRunning,d=a?this._queue.concat(a):this._queue;for(const b of d)if(b.id===c)return void(b.cancelled=!0)}run(b=0){const c=this._currentlyRunning=this._queue;for(const a of(this._queue=[],c))if(!a.cancelled&&(a.callback(b),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function db(b,d,c){if(b=new a.LngLat(b.lng,b.lat),d){const f=new a.LngLat(b.lng-360,b.lat),g=new a.LngLat(b.lng+360,b.lat),h=360*Math.ceil(Math.abs(b.lng-c.center.lng)/360),i=c.locationPoint(b).distSqr(d),j=d.x<0||d.y<0||d.x>c.width||d.y>c.height;c.locationPoint(f).distSqr(d)180;){const e=c.locationPoint(b);if(e.x>=0&&e.y>=0&&e.x<=c.width&&e.y<=c.height)break;b.lng>c.center.lng?b.lng-=360:b.lng+=360}return b}const dc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class z extends a.Evented{constructor(c,e){if(super(),(c instanceof a.window.HTMLElement||e)&&(c=a.extend({element:c},e)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=c&&c.anchor||"center",this._color=c&&c.color||"#3FB1CE",this._scale=c&&c.scale||1,this._draggable=c&&c.draggable||!1,this._clickTolerance=c&&c.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=c&&c.rotation||0,this._rotationAlignment=c&&c.rotationAlignment||"auto",this._pitchAlignment=c&&c.pitchAlignment&&"auto"!==c.pitchAlignment?c.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),c&&c.element)this._element=c.element,this._offset=a.pointGeometry.convert(c&&c.offset||[0,0]);else{this._defaultMarker=!0,this._element=b.create("div");const f=41,g=27,d=b.createSVG("svg",{display:"block",height:f*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${f}`},this._element),h=b.createSVG("radialGradient",{id:"shadowGradient"},b.createSVG("defs",{},d));b.createSVG("stop",{offset:"10%","stop-opacity":.4},h),b.createSVG("stop",{offset:"100%","stop-opacity":.05},h),b.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},d),b.createSVG("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},d),b.createSVG("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},d),b.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},d),this._offset=a.pointGeometry.convert(c&&c.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()});const i=this._element.classList;for(const j in dc)i.remove(`mapboxgl-marker-anchor-${j}`);i.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(c){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),c){if(!("offset"in c.options)){const b=38.1,a=13.5,d=Math.sqrt(Math.pow(a,2)/2);c.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-b],"bottom-left":[d,-1*(b-a+d),],"bottom-right":[-d,-1*(b-a+d),],left:[a,-1*(b-a)],right:[-a,-1*(b-a)]}:this._offset}this._popup=c,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(a){const b=a.code,c=a.charCode||a.keyCode;"Space"!==b&&"Enter"!==b&&32!==c&&13!==c||this.togglePopup()}_onMapClick(c){const a=c.originalEvent.target,b=this._element;this._popup&&(a===b||b.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a&&(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):(a.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const a=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(a))return void this._clearFadeTimer();const b=this._map.unproject(a);let c=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const d=this._map.getFreeCameraOptions();if(d.position){const e=d.position.toLngLat();c=e.distanceTo(b)<.9*e.distanceTo(this._lngLat)}}const f=(1-this._map._queryFogOpacity(b))*(c?.2:1);this._element.style.opacity=`${f}`,this._popup&&this._popup._setOpacity(`${f}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(a){const b=this._map.transform;return!!a&&a.x>=0&&a.x=0&&a.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const b=this._map.transform,a=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&a._rotate(b.angle),"map"===this._pitchAlignment&&(a.y*=Math.cos(b._pitch)),a}getOffset(){return this._offset}setOffset(b){return this._offset=a.pointGeometry.convert(b),this._update(),this}_onMove(b){if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=b.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=b.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(a){this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(a){return this._draggable=!!a,this._map&&(a?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&"auto"!==a?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const{HTMLImageElement:dd,HTMLElement:de,ImageBitmap:df}=a.window;function dg(a){a.parentNode&&a.parentNode.removeChild(a)}class dh{constructor(c,b,d=!1){this._clickTolerance=10,this.element=b,this.mouseRotate=new cM({clickTolerance:c.dragRotate._mouseRotate._clickTolerance}),this.map=c,d&&(this.mousePitch=new cN({clickTolerance:c.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),b.addEventListener("mousedown",this.mousedown),b.addEventListener("touchstart",this.touchstart,{passive:!1}),b.addEventListener("touchmove",this.touchmove),b.addEventListener("touchend",this.touchend),b.addEventListener("touchcancel",this.reset)}down(a,c){this.mouseRotate.mousedown(a,c),this.mousePitch&&this.mousePitch.mousedown(a,c),b.disableDrag()}move(d,e){const a=this.map,b=this.mouseRotate.mousemoveWindow(d,e);if(b&&b.bearingDelta&&a.setBearing(a.getBearing()+b.bearingDelta),this.mousePitch){const c=this.mousePitch.mousemoveWindow(d,e);c&&c.pitchDelta&&a.setPitch(a.getPitch()+c.pitchDelta)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){b.enableDrag(),a.window.removeEventListener("mousemove",this.mousemove),a.window.removeEventListener("mouseup",this.mouseup)}mousedown(c){this.down(a.extend({},c,{ctrlKey:!0,preventDefault:()=>c.preventDefault()}),b.mousePos(this.element,c)),a.window.addEventListener("mousemove",this.mousemove),a.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,b.mousePos(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){1!==a.targetTouches.length?this.reset():(this._startPos=this._lastPos=b.touchPos(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){1!==a.targetTouches.length?this.reset():(this._lastPos=b.touchPos(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){0===a.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?dm(d,c,f/5280,a._getUIString("ScaleControl.Miles"),a):dm(d,c,f,a._getUIString("ScaleControl.Feet"),a)}else b&&"nautical"===b.unit?dm(d,c,e/1852,a._getUIString("ScaleControl.NauticalMiles"),a):e>=1e3?dm(d,c,e/1e3,a._getUIString("ScaleControl.Kilometers"),a):dm(d,c,e,a._getUIString("ScaleControl.Meters"),a)}function dm(d,e,a,f,b){const c=function(b){const c=Math.pow(10,`${Math.floor(b)}`.length-1);let a=b/c;return a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(a){const b=Math.pow(10,Math.ceil(-Math.log(a)/Math.LN10));return Math.round(a*b)/b}(a),c*a}(a),g=c/a;b._requestDomTask(()=>{d.style.width=e*g+"px",d.innerHTML=`${c} ${f}`})}const A={version:a.version,supported:l,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends c8{constructor(c){if(null!=(c=a.extend({},{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},c)).minZoom&&null!=c.maxZoom&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=c.minPitch&&null!=c.maxPitch&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=c.minPitch&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=c.maxPitch&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ct(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),c),this._interactive=c.interactive,this._minTileCacheSize=c.minTileCacheSize,this._maxTileCacheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=c.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=c.collectResourceTiming,this._optimizeForTerrain=c.optimizeForTerrain,this._renderTaskQueue=new da,this._domRenderTaskQueue=new da,this._controls=[],this._markers=[],this._mapId=a.uniqueId(),this._locale=a.extend({},{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},c.locale),this._clickTolerance=c.clickTolerance,this._cooperativeGestures=c.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new class{constructor(a){this.jumpTo(a)}getValue(b){if(b<=this._startTime)return this._start;if(b>=this._endTime)return this._end;const c=a.easeCubicInOut((b-this._startTime)/(this._endTime-this._startTime));return this._start*(1-c)+this._end*c}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(b,a,c){this._start=this.getValue(a),this._end=b,this._startTime=a,this._endTime=a+c}}(0),this._requestManager=new a.RequestManager(c.transformRequest,c.accessToken,c.testMode),this._silenceAuthErrors=!!c.testMode,"string"==typeof c.container){if(this._container=a.window.document.getElementById(c.container),!this._container)throw new Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof de))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(this._container.childNodes.length>0&&a.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),c.maxBounds&&this.setMaxBounds(c.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==a.window&&(a.window.addEventListener("online",this._onWindowOnline,!1),a.window.addEventListener("resize",this._onWindowResize,!1),a.window.addEventListener("orientationchange",this._onWindowResize,!1),a.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new class{constructor(c,d){this._map=c,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new class{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(b){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:b})}_drainInertiaBuffer(){const b=this._inertiaBuffer,c=a.exported.now();for(;b.length>0&&c-b[0].time>160;)b.shift()}_onMoveEnd(k){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const b={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)b.zoom+=d.zoomDelta||0,b.bearing+=d.bearingDelta||0,b.pitch+=d.pitchDelta||0,d.panDelta&&b.pan._add(d.panDelta),d.around&&(b.around=d.around),d.pinchAround&&(b.pinchAround=d.pinchAround);const e=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(b.pan.mag()){const f=cA(b.pan.mag(),e,a.extend({},cv,k||{}));c.offset=b.pan.mult(f.amount/b.pan.mag()),c.center=this._map.transform.center,cz(c,f)}if(b.zoom){const g=cA(b.zoom,e,cw);c.zoom=this._map.transform.zoom+g.amount,cz(c,g)}if(b.bearing){const h=cA(b.bearing,e,cx);c.bearing=this._map.transform.bearing+a.clamp(h.amount,-179,179),cz(c,h)}if(b.pitch){const i=cA(b.pitch,e,cy);c.pitch=this._map.transform.pitch+i.amount,cz(c,i)}if(c.zoom||c.bearing){const j=void 0===b.pinchAround?b.around:b.pinchAround;c.around=j?this._map.unproject(j):this._map.getCenter()}return this.clear(),a.extend(c,{noMoveStart:!0})}}(c),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new class{constructor(){this.constants=[1,1,.01],this.radius=0}setup(c,d){const b=a.sub([],d,c);this.radius=a.length(b[2]<0?a.div([],b,this.constants):[b[0],b[1],0])}projectRay(c){a.div(c,c,this.constants),a.normalize(c,c),a.mul$1(c,c,this.constants);const b=a.scale$2([],c,this.radius);if(b[2]>0){const e=a.scale$2([],[0,0,1],a.dot(b,[0,0,1])),f=a.scale$2([],a.normalize([],[b[0],b[1],0]),this.radius),d=a.add([],b,a.scale$2([],a.sub([],a.add([],f,e),b),2));b[0]=d[0],b[1]=d[1]}return b}},this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(d),a.bindAll(["handleEvent","handleWindowEvent"],this);const b=this._el;for(const[e,f,g]of(this._listeners=[[b,"touchstart",{passive:!0},],[b,"touchmove",{passive:!1},],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[a.window.document,"mousemove",{capture:!0},],[a.window.document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1},],[b,"keyup",void 0],[b,"wheel",{passive:!1},],[b,"contextmenu",void 0],[a.window,"blur",void 0],],this._listeners))e.addEventListener(f,e===a.window.document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[b,c,d]of this._listeners)b.removeEventListener(c,b===a.window.document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(b){const a=this._map,d=a.getCanvasContainer();this._add("mapEvent",new cE(a,b));const n=a.boxZoom=new cG(a,b);this._add("boxZoom",n);const e=new cJ,f=new c_;a.doubleClickZoom=new c$(f,e),this._add("tapZoom",e),this._add("clickZoom",f);const g=new c0;this._add("tapDragZoom",g);const o=a.touchPitch=new cV(a);this._add("touchPitch",o);const h=new cM(b),i=new cN(b);a.dragRotate=new c2(b,h,i),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",i,["mouseRotate"]);const j=new cL(b),k=new cO(a,b);a.dragPan=new c1(d,j,k),this._add("mousePan",j),this._add("touchPan",k,["touchZoom","touchRotate",]);const l=new cT,m=new cR;a.touchZoomRotate=new c3(d,m,l,g),this._add("touchRotate",l,["touchPan","touchZoom",]),this._add("touchZoom",m,["touchPan","touchRotate",]),this._add("blockableMapEvent",new cF(a));const p=a.scrollZoom=new cZ(a,this);this._add("scrollZoom",p,["mousePan"]);const q=a.keyboard=new cW;for(const c of(this._add("keyboard",q),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))b.interactive&&b[c]&&a[c].enable(b[c])}_add(a,b,c){this._handlers.push({handlerName:a,handler:b,allowed:c}),this._handlersById[a]=b}stop(a){if(!this._updatingCamera){for(const{handler:b}of this._handlers)b.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(c4(this._eventsInProgress))||this.isZooming()}_blockedByActive(c,a,d){for(const b in c)if(b!==d&&(!a||0>a.indexOf(b)))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(c){const a=[];for(const b of c)this._el.contains(b.target)&&a.push(b);return a}handleEvent(a,j){this._updatingCamera=!0;const k="renderFrame"===a.type,l=k?void 0:a,d={needsRenderFrame:!1},m={},e={},g=a.touches?this._getMapTouches(a.touches):void 0,p=g?b.touchPos(this._el,g):k?void 0:b.mousePos(this._el,a);for(const{handlerName:h,handler:c,allowed:q}of this._handlers){if(!c.isEnabled())continue;let f;this._blockedByActive(e,q,h)?c.reset():c[j||a.type]&&(f=c[j||a.type](a,p,g),this.mergeHandlerResult(d,m,f,h,l),f&&f.needsRenderFrame&&this._triggerRenderFrame()),(f||c.isActive())&&(e[h]=c)}const i={};for(const n in this._previousActiveHandlers)e[n]||(i[n]=l);this._previousActiveHandlers=e,(Object.keys(i).length||c6(d))&&(this._changes.push([d,m,i]),this._triggerRenderFrame()),(Object.keys(e).length||c6(d))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:o}=d;o&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],o(this._map))}mergeHandlerResult(e,c,b,f,g){if(!b)return;a.extend(e,b);const d={handlerName:f,originalEvent:b.originalEvent||g};void 0!==b.zoomDelta&&(c.zoom=d),void 0!==b.panDelta&&(c.drag=d),void 0!==b.pitchDelta&&(c.pitch=d),void 0!==b.bearingDelta&&(c.rotate=d)}_applyChanges(){const c={},d={},e={};for(const[b,f,g]of this._changes)b.panDelta&&(c.panDelta=(c.panDelta||new a.pointGeometry(0,0))._add(b.panDelta)),b.zoomDelta&&(c.zoomDelta=(c.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(c.bearingDelta=(c.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(c.pitchDelta=(c.pitchDelta||0)+b.pitchDelta),void 0!==b.around&&(c.around=b.around),void 0!==b.aroundCoord&&(c.aroundCoord=b.aroundCoord),void 0!==b.pinchAround&&(c.pinchAround=b.pinchAround),b.noInertia&&(c.noInertia=b.noInertia),a.extend(d,f),a.extend(e,g);this._updateMapTransform(c,d,e),this._changes=[]}_updateMapTransform(d,f,k){const g=this._map,b=g.transform,l=a=>[a.x,a.y,a.z];if((b=>{const a=this._eventsInProgress.drag;return a&&!this._handlersById[a.handlerName].isActive()})()&&!c6(d)){const t=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",t!==b.zoom&&this._map._update(!0)}if(!c6(d))return this._fireEvents(f,k,!0);let{panDelta:m,zoomDelta:h,bearingDelta:n,pitchDelta:o,around:c,aroundCoord:u,pinchAround:p}=d;void 0!==p&&(c=p),f.drag&&!this._eventsInProgress.drag&&c&&(this._dragOrigin=l(b.pointCoordinate3D(c)),this._trackingEllipsoid.setup(b._camera.position,this._dragOrigin)),b.cameraElevationReference="sea",g._stop(!0),c=c||g.transform.centerPoint,n&&(b.bearing+=n),o&&(b.pitch+=o),b._updateCameraState();const e=[0,0,0];if(m){const i=b.pointCoordinate(c),j=b.pointCoordinate(c.sub(m));i&&j&&(e[0]=j.x-i.x,e[1]=j.y-i.y)}const v=b.zoom,q=[0,0,0];if(h){const r=l(u||b.pointCoordinate3D(c)),s={dir:a.normalize([],a.sub([],r,b._camera.position))};if(s.dir[2]<0){const w=b.zoomDeltaToMovement(r,h);a.scale$2(q,s.dir,w)}}const x=a.add(e,e,q);b._translateCameraConstrained(x),h&&Math.abs(b.zoom-v)>1e-4&&b.recenterOnTerrain(),b.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(f,k,!0)}_fireEvents(b,p,q){const j=c4(this._eventsInProgress),c=c4(b),g={};for(const d in b){const{originalEvent:r}=b[d];this._eventsInProgress[d]||(g[`${d}start`]=r),this._eventsInProgress[d]=b[d]}for(const k in!j&&c&&this._fireEvent("movestart",c.originalEvent),g)this._fireEvent(k,g[k]);for(const l in c&&this._fireEvent("move",c.originalEvent),b){const{originalEvent:s}=b[l];this._fireEvent(l,s)}const h={};let e;for(const i in this._eventsInProgress){const{handlerName:m,originalEvent:t}=this._eventsInProgress[i];this._handlersById[m].isActive()||(delete this._eventsInProgress[i],e=p[m]||t,h[`${i}end`]=e)}for(const n in h)this._fireEvent(n,h[n]);const u=c4(this._eventsInProgress);if(q&&(j||c)&&!u){this._updatingCamera=!0;const f=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),o=a=>0!==a&& -this._bearingSnap{delete this._frameId,this.handleEvent(new c5("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}(this,c),this._localFontFamily=c.localFontFamily,this._localIdeographFontFamily=c.localIdeographFontFamily,c.style&&this.setStyle(c.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),c.projection&&this.setProjection(c.projection),this._hash=c.hash&&new class{constructor(b){this._hashName=b&&encodeURIComponent(b),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=cu(this._updateHashUnthrottled.bind(this),300)}addTo(b){return this._map=b,a.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return a.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(k){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,c=Math.pow(10,Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10)),g=Math.round(f.lng*c)/c,h=Math.round(f.lat*c)/c,i=this._map.getBearing(),e=this._map.getPitch();let b="";if(b+=k?`/${g}/${h}/${d}`:`${d}/${h}/${g}`,(i||e)&&(b+="/"+Math.round(10*i)/10),e&&(b+=`/${Math.round(e)}`),this._hashName){const l=this._hashName;let m=!1;const j=a.window.location.hash.slice(1).split("&").map(a=>{const c=a.split("=")[0];return c===l?(m=!0,`${c}=${b}`):a}).filter(a=>a);return m||j.push(`${l}=${b}`),`#${j.join("&")}`}return`#${b}`}_getCurrentHash(){const b=a.window.location.hash.replace("#","");if(this._hashName){let c;return b.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(c=a)}),(c&&c[1]||"").split("/")}return b.split("/")}_onHashChange(){const a=this._getCurrentHash();if(a.length>=3&&!a.some(a=>isNaN(a))){const b=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:b,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){const b=a.window.location.href.replace(/(#.+)?$/,this.getHashString());a.window.history.replaceState(a.window.history.state,null,b)}}("string"==typeof c.hash&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,a.extend({},c.fitBoundsOptions,{duration:0})))),this.resize(),c.attributionControl&&this.addControl(new y({customAttribution:c.customAttribution})),this._logoControl=new c9,this.addControl(this._logoControl,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",b=>{this._update("style"===b.dataType),this.fire(new a.Event(`${b.dataType}data`,b))}),this.on("dataloading",b=>{this.fire(new a.Event(`${b.dataType}dataloading`,b))})}_getMapId(){return this._mapId}addControl(b,c){if(void 0===c&&(c=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const e=b.onAdd(this);this._controls.push(b);const d=this._controlPositions[c];return -1!==c.indexOf("bottom")?d.insertBefore(e,d.firstChild):d.appendChild(e),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const c=this._controls.indexOf(b);return c> -1&&this._controls.splice(c,1),b.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)> -1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(b){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const c=!this._moving;return c&&this.fire(new a.Event("movestart",b)).fire(new a.Event("move",b)),this.fire(new a.Event("resize",b)),c&&this.fire(new a.Event("moveend",b)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(b){return this.transform.setMaxBounds(a.LngLatBounds.convert(b)),this._update()}setMinZoom(b){if((b=null==b?-2:b)>= -2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b?this.setZoom(b):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=null==b?0:b)<0)throw new Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b?this.setPitch(b):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}getProjection(){return this.transform.getProjection()}setProjection(a){return this._lazyInitEmptyStyle(),"string"==typeof a&&(a={name:a}),this._runtimeProjection=a,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(b){return this.transform.locationPoint3D(a.LngLat.convert(b))}unproject(b){return this.transform.pointLocation3D(a.pointGeometry.convert(b))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(a,b,c){if("mouseenter"===a||"mouseover"===a){let h=!1;const d=d=>{const e=b.filter(a=>this.getLayer(a)),f=e.length?this.queryRenderedFeatures(d.point,{layers:e}):[];f.length?h||(h=!0,c.call(this,new cB(a,this,d.originalEvent,{features:f}))):h=!1},e=()=>{h=!1};return{layers:new Set(b),listener:c,delegates:{mousemove:d,mouseout:e}}}if("mouseleave"===a||"mouseout"===a){let i=!1;const f=d=>{const e=b.filter(a=>this.getLayer(a));(e.length?this.queryRenderedFeatures(d.point,{layers:e}):[]).length?i=!0:i&&(i=!1,c.call(this,new cB(a,this,d.originalEvent)))},g=b=>{i&&(i=!1,c.call(this,new cB(a,this,b.originalEvent)))};return{layers:new Set(b),listener:c,delegates:{mousemove:f,mouseout:g}}}return{layers:new Set(b),listener:c,delegates:{[a]:a=>{const d=b.filter(a=>this.getLayer(a)),e=d.length?this.queryRenderedFeatures(a.point,{layers:d}):[];e.length&&(a.features=e,c.call(this,a),delete a.features)}}}}on(a,b,d){if(void 0===d)return super.on(a,b);Array.isArray(b)||(b=[b]);const c=this._createDelegatedListener(a,b,d);for(const e in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(c),c.delegates)this.on(e,c.delegates[e]);return this}once(b,a,c){if(void 0===c)return super.once(b,a);Array.isArray(a)||(a=[a]);const d=this._createDelegatedListener(b,a,c);for(const e in d.delegates)this.once(e,d.delegates[e]);return this}off(b,a,d){if(void 0===d)return super.off(b,a);a=new Set(Array.isArray(a)?a:[a]);const e=(a,b)=>{if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0},c=this._delegatedListeners?this._delegatedListeners[b]:void 0;return c&&(f=>{for(let b=0;b{b?this.fire(new a.ErrorEvent(b)):d&&this._updateDiff(d,c)})}else"object"==typeof b&&this._updateDiff(b,c)}_updateDiff(c,d){try{this.style.setState(c)&&this._update(!0)}catch(b){a.warnOnce(`Unable to perform style diff: ${b.message||b.error||b}. Rebuilding the style from scratch.`),this._updateStyle(c,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(a,b){return this._lazyInitEmptyStyle(),this.style.addSource(a,b),this._update(!0)}isSourceLoaded(b){const c=this.style&&this.style._getSourceCaches(b);if(0!==c.length)return c.every(a=>a.loaded());this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${b}'`)))}areTilesLoaded(){const a=this.style&&this.style._sourceCaches;for(const d in a){const b=a[d]._tiles;for(const e in b){const c=b[e];if("loaded"!==c.state&&"errored"!==c.state)return!1}}return!0}addSourceType(a,b,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,b,c)}removeSource(a){return this.style.removeSource(a),this._updateTerrain(),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(c,b,{pixelRatio:e=1,sdf:f=!1,stretchX:g,stretchY:h,content:i}={}){if(this._lazyInitEmptyStyle(),b instanceof dd||df&&b instanceof df){const{width:j,height:k,data:l}=a.exported.getImageData(b);this.style.addImage(c,{data:new a.RGBAImage({width:j,height:k},l),pixelRatio:e,stretchX:g,stretchY:h,content:i,sdf:f,version:0})}else{if(void 0===b.width|| void 0===b.height)return this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:m,height:n,data:o}=b,d=b;this.style.addImage(c,{data:new a.RGBAImage({width:m,height:n},new Uint8Array(o)),pixelRatio:e,stretchX:g,stretchY:h,content:i,sdf:f,version:0,userImage:d}),d.onAdd&&d.onAdd(this,c)}}}updateImage(d,b){const c=this.style.getImage(d);if(!c)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const g=b instanceof dd||df&&b instanceof df?a.exported.getImageData(b):b,{width:e,height:f,data:h}=g;return void 0===e|| void 0===f?this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):e!==c.data.width||f!==c.data.height?this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(c.data.replace(h,!(b instanceof dd||df&&b instanceof df)),void this.style.updateImage(d,c))}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(b,c){a.getImage(this._requestManager.transformRequest(b,a.ResourceType.Image),(d,b)=>{c(d,b instanceof dd?a.exported.getImageData(b):b)})}listImages(){return this.style.listImages()}addLayer(a,b){return this._lazyInitEmptyStyle(),this.style.addLayer(a,b),this._update(!0)}moveLayer(a,b){return this.style.moveLayer(a,b),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,b,c){return this.style.setLayerZoomRange(a,b,c),this._update(!0)}setFilter(a,b,c={}){return this.style.setFilter(a,b,c),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,b,c,d={}){return this.style.setPaintProperty(a,b,c,d),this._update(!0)}getPaintProperty(a,b){return this.style.getPaintProperty(a,b)}setLayoutProperty(a,b,c,d={}){return this.style.setLayoutProperty(a,b,c,d),this._update(!0)}getLayoutProperty(a,b){return this.style.getLayoutProperty(a,b)}setLight(a,b={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,b),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(b){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.LngLat.convert(b),this.transform):0}setFeatureState(a,b){return this.style.setFeatureState(a,b),this._update()}removeFeatureState(a,b){return this.style.removeFeatureState(a,b),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}_updateContainerDimensions(){if(!this._container)return;const d=this._container.getBoundingClientRect().width||400,e=this._container.getBoundingClientRect().height||300;let b,c=this._container;for(;c&&!b;){const f=a.window.getComputedStyle(c).transform;f&&"none"!==f&&(b=f.match(/matrix.*\((.+)\)/)[1].split(", ")),c=c.parentElement}b?(this._containerWidth=b[0]&&"0"!==b[0]?Math.abs(d/b[0]):d,this._containerHeight=b[3]&&"0"!==b[3]?Math.abs(e/b[3]):e):(this._containerWidth=d,this._containerHeight=e)}_detectMissingCSS(){"rgb(250, 128, 114)"!==a.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&a.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=b.create("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const c=this._canvasContainer=b.create("div","mapboxgl-canvas-container",a);this._interactive&&c.classList.add("mapboxgl-interactive"),this._canvas=b.create("canvas","mapboxgl-canvas",c),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const d=this._controlContainer=b.create("div","mapboxgl-control-container",a),e=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(a=>{e[a]=b.create("div",`mapboxgl-ctrl-${a}`,d)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,c){const d=a.exported.devicePixelRatio||1;this._canvas.width=d*Math.ceil(b),this._canvas.height=d*Math.ceil(c),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${c}px`}_addMarker(a){this._markers.push(a)}_removeMarker(b){const a=this._markers.indexOf(b);-1!==a&&this._markers.splice(a,1)}_setupPainter(){const c=a.extend({},l.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),b=this._canvas.getContext("webgl",c)||this._canvas.getContext("experimental-webgl",c);b?(a.storeAuthState(b,!0),this.painter=new cg(b,this.transform),this.on("data",a=>{"source"===a.dataType&&this.painter.setTileLoadedFlag(!0)}),a.exported$1.testSupport(b)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:b}))}_contextRestored(b){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:b}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(a){return this.style&&(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(h){let c;const b=this.painter.context.extTimerQuery,d=a.exported.now();this.listens("gpu-timing-frame")&&(c=b.createQueryEXT(),b.beginQueryEXT(b.TIME_ELAPSED_EXT,c));let e=this._updateAverageElevation(d);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._domRenderTaskQueue.run(h),this._removed)return;this._updateProjection();let i=!1;const f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,o=this.transform.pitch,k=a.exported.now();this.style.zoomHistory.update(j,k);const l=new a.EvaluationParameters(j,{now:k,fadeDuration:f,pitch:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=l.crossFadingFactor();1===g&&g===this._crossFadingFactor||(i=!0,this._crossFadingFactor=g),this.style.update(l)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const q=a.exported.now()-d;b.endQueryEXT(b.TIME_ELAPSED_EXT,c),setTimeout(()=>{const d=b.getQueryObjectEXT(c,b.QUERY_RESULT_EXT)/1e6;b.deleteQueryEXT(c),this.fire(new a.Event("gpu-timing-frame",{cpuTime:q,gpuTime:d}))},50)}if(this.listens("gpu-timing-layer")){const r=this.painter.collectGpuTimers();setTimeout(()=>{const b=this.painter.queryGpuTimers(r);this.fire(new a.Event("gpu-timing-layer",{layerTimes:b}))},50)}const m=this._sourcesDirty||this._styleDirty||this._placementDirty||e;if(m||this._repaint)this.triggerRepaint();else{const n=!this.isMoving()&&this.loaded();if(n&&(e=this._updateAverageElevation(d,!0)),e)this.triggerRepaint();else if(this._triggerFrame(!1),n&&(this.fire(new a.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const p=this._calculateSpeedIndex();this.fire(new a.Event("speedindexcompleted",{speedIndex:p})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const a of this._markers)a._update()}_updateAverageElevation(b,e=!1){const c=a=>(this.transform.averageElevation=a,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&c(0);if((e||b-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(b)){const f=this.transform.averageElevation;let a=this.transform.sampleAverageElevation();isNaN(a)?a=0:this._averageElevationLastSampledAt=b;const d=Math.abs(f-a);if(d>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(a),c(a);this._averageElevation.easeTo(a,b,300)}else if(d>1e-4)return this._averageElevation.jumpTo(a),c(a)}return!!this._averageElevation.isEasing(b)&&c(this._averageElevation.getValue(b))}_authenticate(){a.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,c=>{if(c&&(c.message===a.AUTH_ERR_MSG||401===c.status)){const b=this.painter.context.gl;a.storeAuthState(b,!1),this._logoControl instanceof c9&&this._logoControl._updateLogo(),b&&b.clear(b.DEPTH_BUFFER_BIT|b.COLOR_BUFFER_BIT|b.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),a.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const d=this.painter.canvasCopy(),a=this.painter.getCanvasCopiesAndTimestamps();a.timeStamps.push(performance.now());const b=this.painter.context.gl,e=b.createFramebuffer();function c(c){b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,c,0);const a=new Uint8Array(b.drawingBufferWidth*b.drawingBufferHeight*4);return b.readPixels(0,0,b.drawingBufferWidth,b.drawingBufferHeight,b.RGBA,b.UNSIGNED_BYTE,a),a}return b.bindFramebuffer(b.FRAMEBUFFER,e),this._canvasPixelComparison(c(d),a.canvasCopies.map(c),a.timeStamps)}_canvasPixelComparison(b,f,e){let g=e[1]-e[0];const i=b.length/4;for(let c=0;c{const b=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,b&&this._render(a)}))}_preloadTiles(c){const b=this.style&&Object.values(this.style._sourceCaches)||[];return a.asyncAll(b,(a,b)=>a._preloadTiles(c,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(b,c){a.setCacheLimits(b,c)}get version(){return a.version}},NavigationControl:class{constructor(c){this.options=a.extend({},{showCompass:!0,showZoom:!0,visualizePitch:!1},c),this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),b.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),b.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=b.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const a=this._map.getZoom(),b=a===this._map.getMaxZoom(),c=a===this._map.getMinZoom();this._zoomInButton.disabled=b,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",b.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,d){const a=b.create("button",c,this._container);return a.type="button",a.addEventListener("click",d),a}_setButtonTitle(a,c){const b=this._map._getUIString(`NavigationControl.${c}`);a.setAttribute("aria-label",b),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}},GeolocateControl:class extends a.Evented{constructor(b){super(),this.options=a.extend({},{positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},b),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=cu(this._updateMarkerRotation,20)}onAdd(d){var c;return this._map=d,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),c=this._setupUI,void 0!==di?c(di):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(di="denied"!==a.state)}):c(di=!!a.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,dj=0,dk=!1}_isOutOfMapMaxBounds(c){const a=this._map.getMaxBounds(),b=c.coords;return a&&(b.longitudea.getEast()||b.latitudea.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(b){if(this._map){if(this._isOutOfMapMaxBounds(b))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",b)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=b,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(b),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(b),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",b)),this._finish()}}_updateCamera(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude),d=b.coords.accuracy,e=this._map.getBearing(),f=a.extend({bearing:e},this.options.fitBoundsOptions);this._map.fitBounds(c.toBounds(d),f,{geolocateSource:!0})}_updateMarker(b){if(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=b.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._containerHeight/2,c=this._map.unproject([0,a]),d=this._map.unproject([100,a]),e=c.distanceTo(d)/100,b=Math.ceil(2*this._accuracy/e);this._circleElement.style.width=`${b}px`,this._circleElement.style.height=`${b}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(b){if(this._map){if(this.options.trackUserLocation){if(1===b.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===b.code&&dk)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",b)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=b.create("button","mapboxgl-ctrl-geolocate",this._container),b.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=b.create("div","mapboxgl-user-location"),this._dotElement.appendChild(b.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(b.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new z({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=b.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new z({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",b=>{b.geolocateSource||"ACTIVE_LOCK"!==this._watchState||b.originalEvent&&"resize"===b.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:!0===a.absolute&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":dj--,dk=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&& void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let b;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++dj>1?(b={maximumAge:6e5,timeout:0},dk=!0):(b=this.options.positionOptions,dk=!1),this._geolocationWatchID=a.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else a.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const b=()=>{a.window.addEventListener("ondeviceorientationabsolute"in a.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==a.window.DeviceMotionEvent&&"function"==typeof a.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(a=>{"granted"===a&&b()}).catch(console.error):b()}_clearWatch(){a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),a.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),a.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:y,ScaleControl:class{constructor(b){this.options=a.extend({},{maxWidth:100,unit:"metric"},b),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dl(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,dl(this._map,this._container,this.options)}},FullscreenControl:class{constructor(b){this._fullscreen=!1,b&&b.container&&(b.container instanceof a.window.HTMLElement?this._container=b.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in a.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in a.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,a.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!a.window.document.fullscreenEnabled&&!a.window.document.webkitFullscreenEnabled)}_setupUI(){const c=this._fullscreenButton=b.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);b.create("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden",!0),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(a.window.document.fullscreenElement||a.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?a.window.document.exitFullscreen?a.window.document.exitFullscreen():a.window.document.webkitCancelFullScreen&&a.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(b){super(),this.options=a.extend(Object.create({closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}),b),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(b&&b.className?b.className.trim().split(/\s+/):[])}addTo(b){return this._map&&this.remove(),this._map=b,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(b){return this.setDOMContent(a.window.document.createTextNode(b))}setHTML(e){const b=a.window.document.createDocumentFragment(),c=a.window.document.createElement("body");let d;for(c.innerHTML=e;d=c.firstChild;)b.appendChild(d);return this.setDOMContent(b)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=b.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._container&&this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._container&&this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(b){let a;return this._classList.delete(b)?a=!1:(this._classList.add(b),a=!0),this._container&&this._updateClassList(),a}_createCloseButton(){this.options.closeButton&&(this._closeButton=b.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const b=this._pos,c=this._container.offsetWidth,d=this._container.offsetHeight;let a;return a=b.y+e.bottom.ythis._map.transform.height-d?["bottom"]:[],b.xthis._map.transform.width-c/2&&a.push("right"),0===a.length?"bottom":a.join("-")}_updateClassList(){const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),this._container.className=a.join(" ")}_update(c){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=b.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=b.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=db(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||c){const e=this._pos=this._trackPointer&&c?c:this._map.project(this._lngLat),d=function(b){if(b||(b=new a.pointGeometry(0,0)),"number"==typeof b){const d=Math.round(Math.sqrt(.5*Math.pow(b,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,b),"top-left":new a.pointGeometry(d,d),"top-right":new a.pointGeometry(-d,d),bottom:new a.pointGeometry(0,-b),"bottom-left":new a.pointGeometry(d,-d),"bottom-right":new a.pointGeometry(-d,-d),left:new a.pointGeometry(b,0),right:new a.pointGeometry(-b,0)}}if(b instanceof a.pointGeometry||Array.isArray(b)){const c=a.pointGeometry.convert(b);return{center:c,top:c,"top-left":c,"top-right":c,bottom:c,"bottom-left":c,"bottom-right":c,left:c,right:c}}return{center:a.pointGeometry.convert(b.center||[0,0,]),top:a.pointGeometry.convert(b.top||[0,0]),"top-left":a.pointGeometry.convert(b["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(b["top-right"]||[0,0]),bottom:a.pointGeometry.convert(b.bottom||[0,0,]),"bottom-left":a.pointGeometry.convert(b["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(b["bottom-right"]||[0,0]),left:a.pointGeometry.convert(b.left||[0,0]),right:a.pointGeometry.convert(b.right||[0,0,])}}(this.options.offset),f=this._anchor=this._getAnchor(d),g=e.add(d[f]).round();this._map._requestDomTask(()=>{this._container&&f&&(this._container.style.transform=`${dc[f]} translate(${g.x}px,${g.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._content&&(this._content.style.opacity=a),this._tip&&(this._tip.style.opacity=a)}},Marker:z,Style:c,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,FreeCameraOptions:x,Evented:a.Evented,config:a.config,prewarm:function(){ao().acquire(am)},clearPrewarmedResources:function(){const a=an;a&&(a.isPreloaded()&&1===a.numActive()?(a.release(am),an=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return a.config.ACCESS_TOKEN},set accessToken(t){a.config.ACCESS_TOKEN=t},get baseApiUrl(){return a.config.API_URL},set baseApiUrl(t){a.config.API_URL=t},get workerCount(){return e.workerCount},set workerCount(e){e.workerCount=e},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){a.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(b){a.clearTileCache(b)},workerUrl:"",workerClass:null,setNow:a.exported.setNow,restoreNow:a.exported.restoreNow};return A}),b})}},]) + with id '${b.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&"source"===a.dataType?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):"style"===a.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(h){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,d=this.painter.transform;this._initializing&&(this._initializing=0===d._centerAltitude&& -1===this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(d.center),-1),this._emptyDEMTextureDirty=!this._initializing);const c=this.proxyCoords=i.getIds().map(b=>{const a=i.getTileByID(b).tileID;return a.projMatrix=d.calculateProjMatrix(a.toUnwrapped()),a});(function(d,b){const c=b.transform.pointCoordinate(b.transform.getCameraPoint()),e=new a.pointGeometry(c.x,c.y);d.sort((b,c)=>{if(c.overscaledZ-b.overscaledZ)return c.overscaledZ-b.overscaledZ;const f=new a.pointGeometry(b.canonical.x+(1<{this.proxyToSource[a.key]={}}),this.terrainTileForTile={};const k=this._style._sourceCaches;for(const e in k){const b=k[e];if(!b.used||(b!==this.sourceCache&&this.resetTileLookupCache(b.id),this._setupProxiedCoordsForOrtho(b,h[e],j),b.usedForTerrain))continue;const m=h[e];b.getSource().reparseOverscaled&&this._assignTerrainTiles(m)}this.proxiedCoords[i.id]=c.map(a=>new bq(a,a.key,this.orthoMatrix)),this._assignTerrainTiles(c),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(j),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const l={};for(const n of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[n.key];if(!f)continue;const g=f.tileID.key;g in l||(this._visibleDemTiles.push(f),l[g]=g)}}_assignTerrainTiles(a){this._initializing||a.forEach(a=>{if(this.terrainTileForTile[a.key])return;const b=this._findTileCoveringTileID(a,this.sourceCache);b&&(this.terrainTileForTile[a.key]=b)})}_prepareDEMTextures(){const b=this.painter.context,d=b.gl;for(const e in this.terrainTileForTile){const a=this.terrainTileForTile[e],c=a.dem;c&&(!a.demTexture||a.needsDEMTextureUpload)&&(b.activeTexture.set(d.TEXTURE1),be(this.painter,a,c))}}_prepareDemTileUniforms(f,a,d,g){if(!a||null==a.demTexture)return!1;const b=f.tileID.canonical,c=Math.pow(2,a.tileID.canonical.z-b.z),e=g||"";return d[`u_dem_tl${e}`]=[b.x*c%1,b.y*c%1,],d[`u_dem_scale${e}`]=c,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const b=this.painter.context,c=b.gl;if(!this._emptyDepthBufferTexture){const d={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new a.Texture(b,d,c.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const b=this._visibleDemTiles.reduce((b,c)=>{if(!c.dem)return b;const d=c.dem.tree.minimums[0];return d>0&&a++,b+d},0);return a?b/a:0}_updateEmptyDEMTexture(){const c=this.painter.context,d=c.gl;c.activeTexture.set(d.TEXTURE2);const f=this._getLoadedAreaMinimum(),e={width:1,height:1,data:new Uint8Array(a.DEMData.pack(f,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let b=this._emptyDEMTexture;return b?b.update(e,{premultiply:!1}):b=this._emptyDEMTexture=new a.Texture(c,e,d.RGBA,{premultiply:!1}),b}setupElevationDraw(g,p,d){var n;const f=this.painter.context,b=f.gl,c=(n=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:a.DEMData.getUnpackVector(n),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});c.u_dem_size=this.sourceCache.getSource().tileSize,c.u_exaggeration=this.exaggeration();const j=this.painter.transform,h=j.projection.createTileTransform(j,j.worldSize),i=g.tileID.canonical;c.u_tile_tl_up=h.upVector(i,0,0),c.u_tile_tr_up=h.upVector(i,a.EXTENT,0),c.u_tile_br_up=h.upVector(i,a.EXTENT,a.EXTENT),c.u_tile_bl_up=h.upVector(i,0,a.EXTENT),c.u_tile_up_scale=h.upVectorScale(i);let e=null,k=null,o=1;if(d&&d.morphing&&this._useVertexMorphing){const l=d.morphing.srcDemTile,m=d.morphing.dstDemTile;o=d.morphing.phase,l&&m&&(this._prepareDemTileUniforms(g,l,c,"_prev")&&(k=l),this._prepareDemTileUniforms(g,m,c)&&(e=m))}if(k&&e?(f.activeTexture.set(b.TEXTURE2),e.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),f.activeTexture.set(b.TEXTURE4),k.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),c.u_dem_lerp=o):(e=this.terrainTileForTile[g.tileID.key],f.activeTexture.set(b.TEXTURE2),(this._prepareDemTileUniforms(g,e,c)?e.demTexture:this.emptyDEMTexture).bind(b.NEAREST,b.CLAMP_TO_EDGE)),f.activeTexture.set(b.TEXTURE3),d&&d.useDepthForOcclusion?(this._depthTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),d&&d.useMeterToDem&&e){const q=(1<{if(l===c)return;const a=[];d&&a.push(bk[g]),a.push(bk[c]),a.push("PROJECTION_GLOBE_VIEW"),k=b.useProgram("globeRaster",null,a),l=c},n=b.colorModeForRenderPass(),o=new a.DepthMode(f.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bj.update(d);const c=b.transform,p=a.calculateGlobeMatrix(c,c.worldSize),q=a.calculateGlobeMercatorMatrix(c),r=[a.mercatorXfromLng(c.center.lng),a.mercatorYfromLat(c.center.lat),],s=b.globeSharedBuffers;(g?[!1,!0]:[!1]).forEach(u=>{l=-1;const x=u?f.LINES:f.TRIANGLES;for(const g of j){const v=i.getTile(g),y=Math.pow(2,g.canonical.z),[D,E]=a.globeBuffersForTileMesh(b,v,g,y),z=a.StencilMode.disabled,A=h.prevTerrainTileForTile[g.key],B=h.terrainTileForTile[g.key];bi(A,B)&&bj.newMorphing(g.key,A,B,d,250),e.activeTexture.set(f.TEXTURE0),v.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const t=bj.getMorphValuesForProxy(g.key),F=t?1:0,C={};t&&a.extend$1(C,{morphing:{srcDemTile:t.from,dstDemTile:t.to,phase:a.easeCubicInOut(t.phase)}});const G=a.globeMatrixForTile(g.canonical,p),H=bh(c.projMatrix,G,q,a.globeToMercatorTransition(c.zoom),r);if(m(F,u),h.setupElevationDraw(v,k,C),b.prepareDrawProgram(e,k,g.toUnwrapped()),s){const[I,J]=u?s.getWirefameBuffer(b.context):[s.gridIndexBuffer,s.gridSegments,];k.draw(e,x,o,z,n,a.CullFaceMode.backCCW,H,"globe_raster",D,I,J)}if(!u){const K=[0===g.canonical.y?a.globePoleMatrixForTile(g.canonical,!1,c):null,g.canonical.y===y-1?a.globePoleMatrixForTile(g.canonical,!0,c):null,];for(const w of K){if(!w)continue;const L=bh(c.projMatrix,w,w,0,r);s&&k.draw(e,x,o,z,n,a.CullFaceMode.disabled,L,"globe_pole_raster",E,s.poleIndexBuffer,s.poleSegments)}}}})}(b,c,e,f,d);else{const g=b.context,h=g.gl;let k,l;const i=b.options.showTerrainWireframe?2:0,m=(a,d)=>{if(l===a)return;const c=[bk[a]];d&&c.push(bk[i]),k=b.useProgram("terrainRaster",null,c),l=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(h.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bj.update(d);const j=b.transform,p=6*Math.pow(1.5,22-j.zoom)*c.exaggeration();(i?[!1,!0]:[!1]).forEach(r=>{l=-1;const w=r?h.LINES:h.TRIANGLES,[x,y]=r?c.getWirefameBuffer():[c.gridIndexBuffer,c.gridSegments,];for(const i of f){const s=e.getTile(i),z=a.StencilMode.disabled,t=c.prevTerrainTileForTile[i.key],u=c.terrainTileForTile[i.key];bi(t,u)&&bj.newMorphing(i.key,t,u,d,250),g.activeTexture.set(h.TEXTURE0),s.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST);const q=bj.getMorphValuesForProxy(i.key),A=q?1:0;let v;q&&(v={morphing:{srcDemTile:q.from,dstDemTile:q.to,phase:a.easeCubicInOut(q.phase)}});const B=bg(i.projMatrix,bl(i.canonical,j.renderWorldCopies)?p/10:p);m(A,r),c.setupElevationDraw(s,k,v),b.prepareDrawProgram(g,k,i.toUnwrapped()),k.draw(g,w,o,z,n,a.CullFaceMode.backCCW,B,"terrain_raster",c.gridBuffer,x,y)}})}}(c,this,this.proxySourceCache,b,this._updateTimestamp),this.renderingToTexture=!0,b.splice(0,b.length))}renderBatch(p){if(0===this._drapedRenderBatches.length)return p+1;this.renderingToTexture=!0;const c=this.painter,e=this.painter.context,f=this.proxySourceCache,s=this.proxiedCoords[f.id],k=this._drapedRenderBatches.shift(),h=[],t=c.style.order;let i=0;for(const g of s){const l=f.getTileByID(g.proxyTileKey),m=f.proxyCachedFBO[g.key]?f.proxyCachedFBO[g.key][p]:void 0,b=void 0!==m?f.renderCache[m]:this.pool[i++],q=void 0!==m;if(l.texture=b.tex,q&&!b.dirty){h.push(l.tileID);continue}let r;e.bindFramebuffer.set(b.fb.framebuffer),this.renderedToTile=!1,b.dirty&&(e.clear({color:a.Color.transparent,stencil:0}),b.dirty=!1);for(let n=k.start;n<=k.end;++n){const j=c.style._layers[t[n]];if(j.isHidden(c.transform.zoom))continue;const d=c.style._getLayerSourceCache(j),o=d?this.proxyToSource[g.key][d.id]:[g];if(!o)continue;const u=o;e.viewport.set([0,0,b.fb.width,b.fb.height,]),r!==(d?d.id:null)&&(this._setupStencil(b,o,j,d),r=d?d.id:null),c.renderLayer(c,d,j,u)}this.renderedToTile?(b.dirty=!0,h.push(l.tileID)):q|| --i,5===i&&(i=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,e.bindFramebuffer.set(null),e.viewport.set([0,0,c.width,c.height]),k.end+1}postRender(){}renderCacheEfficiency(a){const e=a.order.length;if(0===e)return{efficiency:100};let f,g=0,b=0,c=!1;for(let d=0;da.dem).forEach(b=>{a=Math.min(a,b.dem.tree.minimums[0])}),0===a?a:(a-30)*this._exaggeration}raycast(d,e,f){if(!this._visibleDemTiles)return null;const b=this._visibleDemTiles.filter(a=>a.dem).map(b=>{const c=b.tileID,a=Math.pow(2,c.overscaledZ),{x:g,y:h}=c.canonical,i=g/a,j=(g+1)/a,k=h/a,l=(h+1)/a;return{minx:i,miny:k,maxx:j,maxy:l,t:b.dem.tree.raycastRoot(i,k,j,l,d,e,f),tile:b}});for(const a of(b.sort((a,b)=>(null!==a.t?a.t:Number.MAX_VALUE)-(null!==b.t?b.t:Number.MAX_VALUE)),b)){if(null==a.t)break;const c=a.tile.dem.tree.raycast(a.minx,a.miny,a.maxx,a.maxy,d,e,f);if(null!=c)return c}return null}_createFBO(){const b=this.painter.context,c=b.gl,d=this.drapeBufferSize;b.activeTexture.set(c.TEXTURE0);const f=new a.Texture(b,{width:d[0],height:d[1],data:null},c.RGBA);f.bind(c.LINEAR,c.CLAMP_TO_EDGE);const e=b.createFramebuffer(d[0],d[1],!1);return e.colorAttachment.set(f.texture),e.depthAttachment=new Z(b,e.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=b.createRenderbuffer(b.gl.DEPTH_STENCIL,d[0],d[1]),this._stencilRef=0,e.depthAttachment.set(this._sharedDepthStencil),b.clear({stencil:0})):e.depthAttachment.set(this._sharedDepthStencil),b.extTextureFilterAnisotropic&&!b.extTextureFilterAnisotropicForceOff&&c.texParameterf(c.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax),{fb:e,tex:f,dirty:!1}}_initFBOPool(){for(;this.pool.length{const a=this._style._layers[c],d=a.isHidden(this.painter.transform.zoom),b=a.getCrossfadeParameters(),e=!!b&&1!==b.t,f=a.hasTransition();return"custom"!==a.type&&!d&&(e||f)})}_clearRasterFadeFromRenderCache(){let e=!1;for(const h in this._style._sourceCaches)if(this._style._sourceCaches[h]._source instanceof r){e=!0;break}if(e)for(let c=0;ca.renderCachePool.length){const i=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let e=0;e=0;g--){const b=f[g];if(a.getTileByID(b.key),void 0!==a.proxyCachedFBO[b.key]){const j=p[b.key],k=this.proxyToSource[b.key];let d=0;for(const l in k){const m=k[l],n=j[l];if(!n||n.length!==m.length||m.some((a,b)=>a!==n[b]||t[l]&&t[l].hasOwnProperty(a.key))){d=-1;break}++d}for(const r in a.proxyCachedFBO[b.key])a.renderCache[a.proxyCachedFBO[b.key][r]].dirty=d<0||d!==Object.values(j).length}}const o=[...this._drapedRenderBatches];for(const s of(o.sort((a,b)=>b.end-b.start-(a.end-a.start)),o))for(const h of f){if(a.proxyCachedFBO[h.key])continue;let c=a.renderCachePool.pop();void 0===c&&a.renderCache.length<50&&(c=a.renderCache.length,a.renderCache.push(this._createFBO())),void 0!==c&&(a.proxyCachedFBO[h.key]={},a.proxyCachedFBO[h.key][s.start]=c,a.renderCache[c].dirty=!0)}this._tilesDirty={}}_setupStencil(g,a,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const e=this.painter.context,f=e.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let b;if(c.isTileClipped())b=a.length,this._overlapStencilMode.test={func:f.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a[a.length-1].overscaledZ))return void(this._overlapStencilType=!1);b=1,this._overlapStencilMode.test={func:f.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+b>255&&(e.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=b,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(b){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[b.key]),this._overlapStencilMode):a.StencilMode.disabled}_renderTileClippingMasks(f,g){const b=this.painter,d=this.painter.context,c=d.gl;b._tileClippingMaskIDs={},d.setColorMode(a.ColorMode.disabled),d.setDepthMode(a.DepthMode.disabled);const h=b.useProgram("clippingMask");for(const e of f){const i=b._tileClippingMaskIDs[e.key]=--g;h.draw(d,c.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:c.ALWAYS,mask:0},i,255,c.KEEP,c.KEEP,c.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bm(e.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(e){const d=this.painter.transform;if(e.x<0||e.x>d.width||e.y<0||e.y>d.height)return null;const b=[e.x,e.y,1,1];a.transformMat4$1(b,b,d.pixelMatrixInverse),a.scale$1(b,b,1/b[3]),b[0]/=d.worldSize,b[1]/=d.worldSize;const g=d._camera.position,i=a.mercatorZfromAltitude(1,d.center.lat),c=[g[0],g[1],g[2]/i,0],f=a.subtract([],b.slice(0,3),c);a.normalize(f,f);const h=this.raycast(c,f,this._exaggeration);return null!==h&&h?(a.scaleAndAdd(c,c,f,h),c[3]=c[2],c[2]*=i,c):null}drawDepth(){const e=this.painter,b=e.context,i=this.proxySourceCache,c=Math.ceil(e.width),d=Math.ceil(e.height);if(this._depthFBO&&(this._depthFBO.width!==c||this._depthFBO.height!==d)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const f=b.gl,g=b.createFramebuffer(c,d,!0);b.activeTexture.set(f.TEXTURE0);const h=new a.Texture(b,{width:c,height:d,data:null},f.RGBA);h.bind(f.NEAREST,f.CLAMP_TO_EDGE),g.colorAttachment.set(h.texture);const j=b.createRenderbuffer(b.gl.DEPTH_COMPONENT16,c,d);g.depthAttachment.set(j),this._depthFBO=g,this._depthTexture=h}b.bindFramebuffer.set(this._depthFBO.framebuffer),b.viewport.set([0,0,c,d]),function(b,c,h,i){if("globe"===b.transform.projection.name)return;const d=b.context,e=d.gl;d.clear({depth:1});const f=b.useProgram("terrainDepth"),j=new a.DepthMode(e.LESS,a.DepthMode.ReadWrite,b.depthRangeFor3D);for(const g of i){const k=h.getTile(g),l=bg(g.projMatrix,0);c.setupElevationDraw(k,f),f.draw(d,e.TRIANGLES,j,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.backCCW,l,"terrain_depth",c.gridBuffer,c.gridIndexBuffer,c.gridNoSkirtSegments)}}(e,this,i,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,f,c){if(a.getSource() instanceof s)return this._setupProxiedCoordsForImageSource(a,f,c);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const k=this.proxiedCoords[a.id]=[],l=this.proxyCoords;for(let g=0;g(a.min.x=Math.min(a.min.x,b.x-o.x),a.min.y=Math.min(a.min.y,b.y-o.y),a.max.x=Math.max(a.max.x,b.x-o.x),a.max.y=Math.max(a.max.y,b.y-o.y),a),{min:new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),n=(b,c)=>{const d=b.wrap+b.canonical.x/(1<g+p.max.x||e+fh+p.max.y};for(let f=0;fa.key===c.tileID.key);if(j)return j}if(c.tileID.key!==b.key){const d=b.canonical.z-c.tileID.canonical.z;let f,g,h;e=a.create();const k=c.tileID.wrap-b.wrap<0?(g=(f=a.EXTENT>>d)*((c.tileID.canonical.x<=g){const h=c.canonical.z-g;d.getSource().reparseOverscaled?(e=Math.max(c.canonical.z+2,d.transform.tileZoom),f=new a.OverscaledTileID(e,c.wrap,g,c.canonical.x>>h,c.canonical.y>>h)):0!==h&&(e=g,f=new a.OverscaledTileID(e,c.wrap,g,c.canonical.x>>h,c.canonical.y>>h))}f.key!==c.key&&(m.push(f.key),b=d.getTile(f))}const n=a=>{m.forEach(b=>{l[b]=a}),m.length=0};for(e-=1;e>=o&&(!b||!b.hasData());e--){b&&n(b.tileID.key);const j=f.calculateScaledKey(e);if((b=d.getTileByID(j))&&b.hasData())break;const k=l[j];if(null===k)break;void 0===k?m.push(j):b=d.getTileByID(k)}return n(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(a){this.renderedToTile=!0}_clearRenderCacheForTile(b,c){let a=this._tilesDirty[b];a||(a=this._tilesDirty[b]={}),a[c.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const b=function(g){let f,e,b;const c=new a.StructArrayLayout2ui4,d=131;for(e=1;e<129;e++){for(f=1;f<129;f++)b=e*d+f,c.emplaceBack(b,b+1),c.emplaceBack(b,b+d),c.emplaceBack(b+1,b+d),128===e&&c.emplaceBack(b+d,b+d+1);c.emplaceBack(b+1,b+1+d)}return c}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(b),this.wireframeSegments=a.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function bs(b){const c=[];for(let a=0;am.indexOf(t)&&m.push(t);let n=e?e.defines():[];n=n.concat(r.map(a=>`#define ${a}`));const D=n.concat("\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",a9,a8.fragmentSource,v.fragmentSource,k.fragmentSource).join("\n"),E=n.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",a9,a8.vertexSource,v.vertexSource,u.vertexSource,k.vertexSource).join("\n"),o=d.createShader(d.FRAGMENT_SHADER);if(d.isContextLost())return void(this.failedToCreate=!0);d.shaderSource(o,D),d.compileShader(o),d.attachShader(this.program,o);const p=d.createShader(d.VERTEX_SHADER);if(d.isContextLost())return void(this.failedToCreate=!0);d.shaderSource(p,E),d.compileShader(p),d.attachShader(this.program,p),this.attributes={};const i={};this.numAttributes=l.length;for(let f=0;f>16,g>>16],u_pixel_coord_lower:[65535&f,65535&g]}}const bv=(h,f,i,j)=>{const b=f.style.light,c=b.properties.get("position"),d=[c.x,c.y,c.z],g=a.create$1();"viewport"===b.properties.get("anchor")&&(a.fromRotation(g,-f.transform.angle),a.transformMat3(d,d,g));const e=b.properties.get("color");return{u_matrix:h,u_lightpos:d,u_lightintensity:b.properties.get("intensity"),u_lightcolor:[e.r,e.g,e.b],u_vertical_gradient:+i,u_opacity:j}},bw=(d,b,e,f,g,h,c)=>a.extend(bv(d,b,e,f),bu(h,b,c),{u_height_factor:-Math.pow(2,g.overscaledZ)/c.tileSize/8}),bx=a=>({u_matrix:a}),by=(b,c,d,e)=>a.extend(bx(b),bu(d,c,e)),bz=(a,b)=>({u_matrix:a,u_world:b}),bA=(b,c,d,e,f)=>a.extend(by(b,c,d,e),{u_world:f}),bB=(d,g,e,c)=>{const b=d.transform;let f;return f="map"===c.paint.get("circle-pitch-alignment")?b.calculatePixelsToTileUnitsMatrix(e):new Float32Array([b.pixelsToGLUnits[0],0,0,b.pixelsToGLUnits[1],]),{u_camera_to_center_distance:b.cameraToCenterDistance,u_matrix:d.translatePosMatrix(g.projMatrix,e,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_device_pixel_ratio:a.exported.devicePixelRatio,u_extrude_scale:f}},bC=b=>{const a=[];return"map"===b.paint.get("circle-pitch-alignment")&&a.push("PITCH_WITH_MAP"),"map"===b.paint.get("circle-pitch-scale")&&a.push("SCALE_WITH_MAP"),a},bD=(d,b,e)=>{const c=a.EXTENT/e.tileSize;return{u_matrix:d,u_camera_to_center_distance:b.cameraToCenterDistance,u_extrude_scale:[b.pixelsToGLUnits[0]/c,b.pixelsToGLUnits[1]/c,]}},bE=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bF=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:V(b,1,c),u_intensity:d}),bG=(d,b,g,e,h,i)=>{const f=d.transform,j=f.calculatePixelsToTileUnitsMatrix(b),c={u_matrix:bJ(d,b,g,h),u_pixels_to_tile_units:j,u_device_pixel_ratio:a.exported.devicePixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(bK(g)){const k=bI(b,d.transform);c.u_texsize=b.lineAtlasTexture.size,c.u_scale=[k,e.fromScale,e.toScale,],c.u_mix=e.t}return c},bH=(e,b,f,d,g)=>{const c=e.transform,h=bI(b,c);return{u_matrix:bJ(e,b,f,g),u_texsize:b.imageAtlasTexture.size,u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(b),u_device_pixel_ratio:a.exported.devicePixelRatio,u_image:0,u_scale:[h,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function bI(a,b){return 1/V(a,1,b.tileZoom)}function bJ(c,a,b,d){return c.translatePosMatrix(d||a.tileID.projMatrix,a,b.paint.get("line-translate"),b.paint.get("line-translate-anchor"))}function bK(b){const a=b.paint.get("line-dasharray").value;return a.value||"constant"!==a.kind}const bL=(e,f,g,d,a,h)=>{var b,c;return{u_matrix:e,u_tl_parent:f,u_scale_parent:g,u_fade_t:d.mix,u_opacity:d.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(c=a.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(b=a.paint.get("raster-contrast"))>0?1/(1-b):1+b,u_spin_weights:bM(a.paint.get("raster-hue-rotate")),u_perspective_transform:h}};function bM(a){a*=Math.PI/180;const c=Math.sin(a),b=Math.cos(a);return[(2*b+1)/3,(-Math.sqrt(3)*c-b+1)/3,(Math.sqrt(3)*c-b+1)/3,]}const bN=(a,b,e,f,d,g,h,i,j,k,l,m,n,o)=>{const c=d.transform;return{u_is_size_zoom_constant:+("constant"===a||"source"===a),u_is_size_feature_constant:+("constant"===a||"camera"===a),u_size_t:b?b.uSizeT:0,u_size:b?b.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+e,u_aspect_ratio:c.width/c.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:h,u_coord_matrix:i,u_is_text:+j,u_pitch_with_map:+f,u_texsize:k,u_tile_id:l,u_zoom_transition:m,u_inv_rot_matrix:n,u_merc_center:o,u_texture:0}},bO=(d,e,f,c,b,g,h,i,j,k,l,m,n,o,p)=>{const{cameraToCenterDistance:q,_pitch:r}=b.transform;return a.extend(bN(d,e,f,c,b,g,h,i,j,k,m,n,o,p),{u_gamma_scale:c?q*Math.cos(b.terrain?0:r):1,u_device_pixel_ratio:a.exported.devicePixelRatio,u_is_halo:+l})},bP=(b,c,d,e,f,g,h,i,j,k,l,m,n,o)=>a.extend(bO(b,c,d,e,f,g,h,i,!0,j,!0,l,m,n,o),{u_texsize_icon:k,u_texture_icon:1}),bQ=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bR=(b,c,d,e,f,g)=>a.extend(function(f,c,b,a){const d=b.imageManager.getPattern(f.from.toString()),e=b.imageManager.getPattern(f.to.toString()),{width:k,height:l}=b.imageManager.getPixelSize(),g=Math.pow(2,a.tileID.overscaledZ),h=a.tileSize*Math.pow(2,b.transform.tileZoom)/g,i=h*(a.tileID.canonical.x+a.tileID.wrap*g),j=h*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:d.tl,u_pattern_br_a:d.br,u_pattern_tl_b:e.tl,u_pattern_br_b:e.br,u_texsize:[k,l],u_mix:c.t,u_pattern_size_a:d.displaySize,u_pattern_size_b:e.displaySize,u_scale_a:c.fromScale,u_scale_b:c.toScale,u_tile_units_to_pixels:1/V(a,1,b.transform.tileZoom),u_pixel_coord_upper:[i>>16,j>>16,],u_pixel_coord_lower:[65535&i,65535&j,]}}(e,g,d,f),{u_matrix:b,u_opacity:c}),bS={fillExtrusion:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fillExtrusionPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_height_factor:new a.Uniform1f(b,c.u_height_factor),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fill:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),fillPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),fillOutline:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world)}),fillOutlinePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),circle:(b,c)=>({u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.UniformMatrix2f(b,c.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),collisionBox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.Uniform2f(b,c.u_extrude_scale)}),collisionCircle:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_inv_matrix:new a.UniformMatrix4f(b,c.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(b,c.u_viewport_size)}),debug:(b,c)=>({u_color:new a.UniformColor(b,c.u_color),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_overlay:new a.Uniform1i(b,c.u_overlay),u_overlay_scale:new a.Uniform1f(b,c.u_overlay_scale)}),clippingMask:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmap:(b,c)=>({u_extrude_scale:new a.Uniform1f(b,c.u_extrude_scale),u_intensity:new a.Uniform1f(b,c.u_intensity),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmapTexture:(b,c)=>({u_image:new a.Uniform1i(b,c.u_image),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_opacity:new a.Uniform1f(b,c.u_opacity)}),hillshade:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_latrange:new a.Uniform2f(b,c.u_latrange),u_light:new a.Uniform2f(b,c.u_light),u_shadow:new a.UniformColor(b,c.u_shadow),u_highlight:new a.UniformColor(b,c.u_highlight),u_accent:new a.UniformColor(b,c.u_accent)}),hillshadePrepare:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_dimension:new a.Uniform2f(b,c.u_dimension),u_zoom:new a.Uniform1f(b,c.u_zoom),u_unpack:new a.Uniform4f(b,c.u_unpack)}),line:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_dash_image:new a.Uniform1i(b,c.u_dash_image),u_gradient_image:new a.Uniform1i(b,c.u_gradient_image),u_image_height:new a.Uniform1f(b,c.u_image_height),u_texsize:new a.Uniform2f(b,c.u_texsize),u_scale:new a.Uniform3f(b,c.u_scale),u_mix:new a.Uniform1f(b,c.u_mix),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),linePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_image:new a.Uniform1i(b,c.u_image),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),raster:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_tl_parent:new a.Uniform2f(b,c.u_tl_parent),u_scale_parent:new a.Uniform1f(b,c.u_scale_parent),u_fade_t:new a.Uniform1f(b,c.u_fade_t),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image0:new a.Uniform1i(b,c.u_image0),u_image1:new a.Uniform1i(b,c.u_image1),u_brightness_low:new a.Uniform1f(b,c.u_brightness_low),u_brightness_high:new a.Uniform1f(b,c.u_brightness_high),u_saturation_factor:new a.Uniform1f(b,c.u_saturation_factor),u_contrast_factor:new a.Uniform1f(b,c.u_contrast_factor),u_spin_weights:new a.Uniform3f(b,c.u_spin_weights),u_perspective_transform:new a.Uniform2f(b,c.u_perspective_transform)}),symbolIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_texture:new a.Uniform1i(b,c.u_texture)}),symbolSDF:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texture:new a.Uniform1i(b,c.u_texture),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),symbolTextAndIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texsize_icon:new a.Uniform2f(b,c.u_texsize_icon),u_texture:new a.Uniform1i(b,c.u_texture),u_texture_icon:new a.Uniform1i(b,c.u_texture_icon),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),background:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_color:new a.UniformColor(b,c.u_color)}),backgroundPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image:new a.Uniform1i(b,c.u_image),u_pattern_tl_a:new a.Uniform2f(b,c.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(b,c.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(b,c.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(b,c.u_pattern_br_b),u_texsize:new a.Uniform2f(b,c.u_texsize),u_mix:new a.Uniform1f(b,c.u_mix),u_pattern_size_a:new a.Uniform2f(b,c.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(b,c.u_pattern_size_b),u_scale_a:new a.Uniform1f(b,c.u_scale_a),u_scale_b:new a.Uniform1f(b,c.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(b,c.u_tile_units_to_pixels)}),terrainRaster:k,terrainDepth:k,skybox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_cubemap:new a.Uniform1i(b,c.u_cubemap),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxGradient:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_center_direction:new a.Uniform3f(b,c.u_center_direction),u_radius:new a.Uniform1f(b,c.u_radius),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxCapture:(b,c)=>({u_matrix_3f:new a.UniformMatrix3f(b,c.u_matrix_3f),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_sun_intensity:new a.Uniform1f(b,c.u_sun_intensity),u_color_tint_r:new a.Uniform4f(b,c.u_color_tint_r),u_color_tint_m:new a.Uniform4f(b,c.u_color_tint_m),u_luminance:new a.Uniform1f(b,c.u_luminance)}),globeRaster:(b,c)=>({u_proj_matrix:new a.UniformMatrix4f(b,c.u_proj_matrix),u_globe_matrix:new a.UniformMatrix4f(b,c.u_globe_matrix),u_merc_matrix:new a.UniformMatrix4f(b,c.u_merc_matrix),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_image0:new a.Uniform1i(b,c.u_image0)}),globeAtmosphere:(b,c)=>({u_center:new a.Uniform2f(b,c.u_center),u_radius:new a.Uniform1f(b,c.u_radius),u_screen_size:new a.Uniform2f(b,c.u_screen_size),u_pixel_ratio:new a.Uniform1f(b,c.u_pixel_ratio),u_opacity:new a.Uniform1f(b,c.u_opacity),u_fadeout_range:new a.Uniform1f(b,c.u_fadeout_range),u_start_color:new a.Uniform3f(b,c.u_start_color),u_end_color:new a.Uniform3f(b,c.u_end_color)})};let bT;function bU(b,H,s,A,t,I,B){var u;const f=b.context,C=f.gl,D=b.useProgram("collisionBox"),j=[];let g=0,E=0;for(let v=0;v0){const l=a.create(),J=x;a.mul(l,d.placementInvProjMatrix,b.transform.glCoordMatrix),a.mul(l,l,d.placementViewportMatrix),j.push({circleArray:y,circleOffset:E,transform:J,invTransform:l}),g+=y.length/4,E=g}e&&(b.terrain&&b.terrain.setupElevationDraw(k,D),D.draw(f,C.LINES,a.DepthMode.disabled,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.disabled,bD(x,b.transform,k),s.id,e.layoutVertexBuffer,e.indexBuffer,e.segments,null,b.transform.zoom,null,e.collisionVertexBuffer,e.collisionVertexBufferExt))}if(!B||!j.length)return;const K=b.useProgram("collisionCircle"),c=new a.StructArrayLayout2f1f2i16;c.resize(4*g),c._trim();let m=0;for(const h of j)for(let z=0;z[0,0,0];e.clear();for(let j=0;j=0&&(r[b.associatedIconIndex]={shiftedAnchor:x,angle:y})}else aO(b.numGlyphs,e)}if(p){d.clear();const A=c.icon.placedSymbolArray;for(let f=0;f[0,0,0];aG(d,g.projMatrix,b,i,C,W,j,ad,am,g)}const D=b.translatePosMatrix(g.projMatrix,e,J,K),E=n||i&&Q||al?bV:C,F=b.translatePosMatrix(W,e,J,K,!0),an=o&&0!==h.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let Y;const G=N.createInversionMatrix(g.toUnwrapped());Y=o?d.iconsInText?bP(m.kind,y,u,j,b,D,E,F,p,T,z,x,G,v):bO(m.kind,y,u,j,b,D,E,F,i,p,!0,z,x,G,v):bN(m.kind,y,u,j,b,D,E,F,i,p,z,x,G,v);const Z={program:ag,buffers:l,uniformValues:Y,atlasTexture:A,atlasTextureIcon:U,atlasInterpolation:B,atlasInterpolationIcon:S,isSDF:o,hasHalo:an,tile:e,labelPlaneMatrixInv:aj};if(ae&&d.canOverlap){O=!0;const ao=l.segments.get();for(const $ of ao)r.push({segments:new a.SegmentVector([$]),sortKey:$.sortKey,state:Z})}else r.push({segments:l.segments,sortKey:0,state:Z})}for(const H of(O&&r.sort((a,b)=>a.sortKey-b.sortKey),r)){const c=H.state;if(b.terrain&&b.terrain.setupElevationDraw(c.tile,c.program,{useDepthForOcclusion:!w,labelPlaneMatrixInv:c.labelPlaneMatrixInv}),t.activeTexture.set(k.TEXTURE0),c.atlasTexture.bind(c.atlasInterpolation,k.CLAMP_TO_EDGE),c.atlasTextureIcon&&(t.activeTexture.set(k.TEXTURE1),c.atlasTextureIcon&&c.atlasTextureIcon.bind(c.atlasInterpolationIcon,k.CLAMP_TO_EDGE)),c.isSDF){const I=c.uniformValues;c.hasHalo&&(I.u_is_halo=1,b$(c.buffers,H.segments,h,b,c.program,P,L,M,I)),I.u_is_halo=0}b$(c.buffers,H.segments,h,b,c.program,P,L,M,c.uniformValues)}}function b$(b,f,c,d,g,h,i,j,k){const e=d.context;g.draw(e,e.gl.TRIANGLES,h,i,j,a.CullFaceMode.disabled,k,c.id,b.layoutVertexBuffer,b.indexBuffer,f,c.paint,d.transform.zoom,b.programConfigurations.get(c.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function b_(b,y,c,z,A,B,s){const e=b.context.gl,l=c.paint.get("fill-pattern"),g=l&&l.constantOr(1),m=c.getCrossfadeParameters();let n,i,o,p,q;for(const h of(s?(i=g&&!c.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",n=e.LINES):(i=g?"fillPattern":"fill",n=e.TRIANGLES),z)){const d=y.getTile(h);if(g&&!d.patternsLoaded())continue;const f=d.getBucket(c);if(!f)continue;b.prepareDrawTile(h);const j=f.programConfigurations.get(c.id),t=b.useProgram(i,j);g&&(b.context.activeTexture.set(e.TEXTURE0),d.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),j.updatePaintBuffers(m));const r=l.constantOr(null);if(r&&d.imageAtlas){const u=d.imageAtlas,v=u.patternPositions[r.to.toString()],w=u.patternPositions[r.from.toString()];v&&w&&j.setConstantPatternPositions(v,w)}const k=b.translatePosMatrix(h.projMatrix,d,c.paint.get("fill-translate"),c.paint.get("fill-translate-anchor"));if(s){p=f.indexBuffer2,q=f.segments2;const x=b.terrain&&b.terrain.renderingToTexture?b.terrain.drapeBufferSize:[e.drawingBufferWidth,e.drawingBufferHeight,];o="fillOutlinePattern"===i&&g?bA(k,b,m,d,x):bz(k,x)}else p=f.indexBuffer,q=f.segments,o=g?by(k,b,m,d):bx(k);b.prepareDrawProgram(b.context,t,h.toUnwrapped()),t.draw(b.context,n,A,b.stencilModeForClipping(h),B,a.CullFaceMode.disabled,o,c.id,f.layoutVertexBuffer,p,q,c.paint,b.transform.zoom,j)}}function b0(b,m,c,x,y,z,A){const f=b.context,h=f.gl,n=c.paint.get("fill-extrusion-pattern"),k=n.constantOr(1),o=c.getCrossfadeParameters(),p=c.paint.get("fill-extrusion-opacity");for(const g of x){const e=m.getTile(g),d=e.getBucket(c);if(!d)continue;const i=d.programConfigurations.get(c.id),j=b.useProgram(k?"fillExtrusionPattern":"fillExtrusion",i);if(b.terrain){const q=b.terrain;if(!d.enableTerrain)continue;if(q.setupElevationDraw(e,j,{useMeterToDem:!0}),b1(f,m,g,d,c,q),!d.centroidVertexBuffer){const r=j.attributes.a_centroid_pos;void 0!==r&&h.vertexAttrib2f(r,0,0)}}k&&(b.context.activeTexture.set(h.TEXTURE0),e.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),i.updatePaintBuffers(o));const l=n.constantOr(null);if(l&&e.imageAtlas){const s=e.imageAtlas,t=s.patternPositions[l.to.toString()],u=s.patternPositions[l.from.toString()];t&&u&&i.setConstantPatternPositions(t,u)}const v=b.translatePosMatrix(g.projMatrix,e,c.paint.get("fill-extrusion-translate"),c.paint.get("fill-extrusion-translate-anchor")),w=c.paint.get("fill-extrusion-vertical-gradient"),B=k?bw(v,b,w,p,g,o,e):bv(v,b,w,p);b.prepareDrawProgram(f,j,g.toUnwrapped()),j.draw(f,f.gl.TRIANGLES,y,z,A,a.CullFaceMode.backCCW,B,c.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,c.paint,b.transform.zoom,i,b.terrain?d.centroidVertexBuffer:null)}}function b1(w,D,p,c,E,q){const x=[b=>{let c=b.canonical.x-1,d=b.wrap;return c<0&&(c=(1<{let c=b.canonical.x+1,d=b.wrap;return c===1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,(0===b.canonical.y?1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y===(1<{const b=D.getSource().maxzoom,c=b=>{const a=D.getTileByID(b);if(a&&a.hasData())return a.getBucket(E)};let d,e,f;return(a.overscaledZ===a.canonical.z||a.overscaledZ>=b)&&(d=c(a.key)),a.overscaledZ>=b&&(e=c(a.calculateScaledKey(a.overscaledZ+1))),a.overscaledZ>b&&(f=c(a.calculateScaledKey(a.overscaledZ-1))),d||e||f},F=[0,0,0],G=(b,c)=>(F[0]=Math.min(b.min.y,c.min.y),F[1]=Math.max(b.max.y,c.max.y),F[2]=a.EXTENT-c.min.x>b.max.x?c.min.x-a.EXTENT:b.max.x,F),H=(b,c)=>(F[0]=Math.min(b.min.x,c.min.x),F[1]=Math.max(b.max.x,c.max.x),F[2]=a.EXTENT-c.min.y>b.max.y?c.min.y-a.EXTENT:b.max.y,F),z=[(a,b)=>G(a,b),(a,b)=>G(b,a),(a,b)=>H(a,b),(a,b)=>H(b,a),],j=new a.pointGeometry(0,0);let r,s,A;const B=(e,f,b,c,d)=>{const g=[[c?b:e,c?e:b,0],[c?b:f,c?f:b,0],],i=d<0?a.EXTENT+d:d,h=[c?i:(e+f)/2,c?(e+f)/2:i,0,];return 0===b&&d<0||0!==b&&d>0?q.getForTilePoints(A,[h],!0,s):g.push(h),q.getForTilePoints(p,g,!0,r),Math.max(g[0][2],g[1][2],h[2])/q.exaggeration()};for(let d=0;d<4;d++){const k=c.borders[d];if(0===k.length&&(c.borderDone[d]=!0),c.borderDone[d])continue;const t=A=x[d](p),b=y(t);if(!b||!b.enableTerrain||!(s=q.findDEMTileFor(t))||!s.dem)continue;if(!r){const l=q.findDEMTileFor(p);if(!l||!l.dem)return;r=l}const f=(d<2?1:5)-d,h=b.borders[f];let g=0;for(let m=0;mu[0]+3);)b.borderDone[f]||b.encodeCentroid(void 0,e,!1),g++;if(e&&gu[1]-3)&&(n++,++g!==h.length);)e=b.featuresOnBorder[h[g]];if(e=b.featuresOnBorder[h[v]],i.intersectsCount()>1||e.intersectsCount()>1||1!==n){1!==n&&(g=v),c.encodeCentroid(void 0,i,!1),b.borderDone[f]||b.encodeCentroid(void 0,e,!1);continue}const o=z[d](i,e),C=d%2?a.EXTENT-1:0;j.x=B(o[0],Math.min(a.EXTENT-1,o[1]),C,d<2,o[2]),j.y=0,c.encodeCentroid(j,i,!1),b.borderDone[f]||b.encodeCentroid(j,e,!1)}else c.encodeCentroid(void 0,i,!1)}c.borderDone[d]=c.needsCentroidUpdate=!0,b.borderDone[f]||(b.borderDone[f]=b.needsCentroidUpdate=!0)}(c.needsCentroidUpdate|| !c.centroidVertexBuffer&&0!==c.centroidVertexArray.length)&&c.uploadCentroid(w)}const b2=new a.Color(1,0,0,1),b3=new a.Color(0,1,0,1),b4=new a.Color(0,0,1,1),b5=new a.Color(1,0,1,1),b6=new a.Color(0,1,1,1);function b7(a,c,b,d){b9(a,0,c+b/2,a.transform.width,b,d)}function b8(a,c,b,d){b9(a,c-b/2,0,b,a.transform.height,d)}function b9(d,e,f,g,h,i){const c=d.context,b=c.gl;b.enable(b.SCISSOR_TEST),b.scissor(e*a.exported.devicePixelRatio,f*a.exported.devicePixelRatio,g*a.exported.devicePixelRatio,h*a.exported.devicePixelRatio),c.clear({color:i}),b.disable(b.SCISSOR_TEST)}function ca(b,h,c){const f=b.context,e=f.gl,i=c.projMatrix,g=b.useProgram("debug"),d=h.getTileByID(c.key);b.terrain&&b.terrain.setupElevationDraw(d,g);const j=a.DepthMode.disabled,k=a.StencilMode.disabled,o=b.colorModeForRenderPass(),l="$debug";f.activeTexture.set(e.TEXTURE0),b.emptyTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),d._makeDebugTileBoundsBuffers(b.context,b.transform.projection);const p=d._tileDebugBuffer||b.debugBuffer,q=d._tileDebugIndexBuffer||b.debugIndexBuffer,r=d._tileDebugSegments||b.debugSegments;g.draw(f,e.LINE_STRIP,j,k,o,a.CullFaceMode.disabled,bE(i,a.Color.red),l,p,q,r);const m=d.latestRawTileData,s=Math.floor((m&&m.byteLength||0)/1024),t=h.getTile(c).tileSize,u=512/Math.min(t,512)*(c.overscaledZ/b.transform.zoom)*.5;let n=c.canonical.toString();c.overscaledZ!==c.canonical.z&&(n+=` => ${c.overscaledZ}`),function(b,d){b.initDebugOverlayCanvas();const c=b.debugOverlayCanvas,e=b.context.gl,a=b.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,c.width,c.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(d,5,5),a.strokeText(d,5,5),b.debugOverlayTexture.update(c),b.debugOverlayTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}(b,`${n} ${s}kb`),g.draw(f,e.TRIANGLES,j,k,a.ColorMode.alphaBlended,a.CullFaceMode.disabled,bE(i,a.Color.transparent,u),l,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments)}const w=a.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:cb}=w;function cc(a,b,c,d){a.emplaceBack(b,c,d)}class cd{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,cc(this.vertexArray,-1,-1,1),cc(this.vertexArray,1,-1,1),cc(this.vertexArray,-1,1,1),cc(this.vertexArray,1,1,1),cc(this.vertexArray,-1,-1,-1),cc(this.vertexArray,1,-1,-1),cc(this.vertexArray,-1,1,-1),cc(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=b.createVertexBuffer(this.vertexArray,cb),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function ce(f,b,j,k,l,m){var g,h,i,c,d;const e=f.gl,n=b.paint.get("sky-atmosphere-color"),o=b.paint.get("sky-atmosphere-halo-color"),p=b.paint.get("sky-atmosphere-sun-intensity"),q=(g=a.fromMat4([],k),h=l,i=p,c=n,d=o,{u_matrix_3f:g,u_sun_direction:h,u_sun_intensity:i,u_color_tint_r:[c.r,c.g,c.b,c.a],u_color_tint_m:[d.r,d.g,d.b,d.a],u_luminance:5e-5});e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+m,b.skyboxTexture,0),j.draw(f,e.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.frontCW,q,"skyboxCapture",b.skyboxGeometry.vertexBuffer,b.skyboxGeometry.indexBuffer,b.skyboxGeometry.segment)}const cf={symbol:function(c,d,b,e,h){if("translucent"!==c.renderPass)return;const f=a.StencilMode.disabled,g=c.colorModeForRenderPass();b.layout.get("text-variable-anchor")&&function(k,e,g,l,m,n,o){const b=e.transform,h="map"===m,i="map"===n,p=b.projection.createTileTransform(b,b.worldSize);for(const f of k){const d=l.getTile(f),c=d.getBucket(g);if(!c||c.projection!==b.projection.name||!c.text||!c.text.segments.get().length)continue;const j=a.evaluateSizeForZoom(c.textSizeData,b.zoom),q=e.transform.calculatePixelsToTileUnitsMatrix(d),r=aB(f.projMatrix,d.tileID.canonical,i,h,e.transform,q),s="none"!==g.layout.get("icon-text-fit")&&c.hasIconData();if(j){const t=Math.pow(2,b.zoom-d.tileID.overscaledZ);bX(c,h,i,o,a.symbolSize,b,r,f,t,j,s,p)}}}(e,c,b,d,b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),h),0!==b.paint.get("icon-opacity").constantOr(1)&&bZ(c,d,b,e,!1,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),b.layout.get("icon-rotation-alignment"),b.layout.get("icon-pitch-alignment"),b.layout.get("icon-keep-upright"),f,g),0!==b.paint.get("text-opacity").constantOr(1)&&bZ(c,d,b,e,!0,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),b.layout.get("text-rotation-alignment"),b.layout.get("text-pitch-alignment"),b.layout.get("text-keep-upright"),f,g),d.map.showCollisionBoxes&&(bU(c,d,b,e,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),!0),bU(c,d,b,e,b.paint.get("icon-translate"),b.paint.get("icon-translate-anchor"),!1))},circle:function(b,r,c,j){if("translucent"!==b.renderPass)return;const s=c.paint.get("circle-opacity"),t=c.paint.get("circle-stroke-width"),u=c.paint.get("circle-stroke-opacity"),k=void 0!==c.layout.get("circle-sort-key").constantOr(1);if(0===s.constantOr(1)&&(0===t.constantOr(1)||0===u.constantOr(1)))return;const f=b.context,v=f.gl,w=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),x=a.StencilMode.disabled,y=b.colorModeForRenderPass(),e=[];for(let g=0;ga.sortKey-b.sortKey);const B={useDepthForOcclusion:"globe"!==b.transform.projection.name};for(const p of e){const{programConfiguration:C,program:i,layoutVertexBuffer:D,indexBuffer:E,uniformValues:F,tile:q}=p.state,G=p.segments;b.terrain&&b.terrain.setupElevationDraw(q,i,B),b.prepareDrawProgram(f,i,q.tileID.toUnwrapped()),i.draw(f,v.TRIANGLES,w,x,y,a.CullFaceMode.disabled,F,c.id,D,E,G,c.paint,b.transform.zoom,C)}},heatmap:function(b,k,c,l){if(0!==c.paint.get("heatmap-opacity")){if("offscreen"===b.renderPass){const d=b.context,g=d.gl,n=a.StencilMode.disabled,o=new a.ColorMode([g.ONE,g.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(b,c,e){const a=b.gl;b.activeTexture.set(a.TEXTURE1),b.viewport.set([0,0,c.width/4,c.height/4,]);let d=e.heatmapFbo;if(d)a.bindTexture(a.TEXTURE_2D,d.colorAttachment.get()),b.bindFramebuffer.set(d.framebuffer);else{const f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),d=e.heatmapFbo=b.createFramebuffer(c.width/4,c.height/4,!1),function(b,c,d,e){const a=b.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,c.width/4,c.height/4,0,a.RGBA,b.extRenderToTextureHalfFloat?b.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),e.colorAttachment.set(d)}(b,c,f,d)}})(d,b,c),d.clear({color:a.Color.transparent});for(let h=0;h{const b=[];bK(a)&&b.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&b.push("RENDER_LINE_GRADIENT");const c=a.paint.get("line-pattern").constantOr(1),d=1!==a.paint.get("line-opacity").constantOr(1);return!c&&d&&b.push("RENDER_LINE_ALPHA_DISCARD"),b})(c);let m=v.includes("RENDER_LINE_ALPHA_DISCARD");for(const h of(b.terrain&&b.terrain.clipOrMaskOverlapStencilType()&&(m=!1),H)){const f=s.getTile(h);if(j&&!f.patternsLoaded())continue;const i=f.getBucket(c);if(!i)continue;b.prepareDrawTile(h);const k=i.programConfigurations.get(c.id),O=b.useProgram(N,k,v),n=u.constantOr(null);if(n&&f.imageAtlas){const w=f.imageAtlas,x=w.patternPositions[n.to.toString()],y=w.patternPositions[n.from.toString()];x&&y&&k.setConstantPatternPositions(x,y)}const o=t.constantOr(null),p=L.constantOr(null);if(!j&&o&&p&&f.lineAtlas){const z=f.lineAtlas,A=z.getDash(o.to,p),B=z.getDash(o.from,p);A&&B&&k.setConstantPatternPositions(A,B)}const C=b.terrain?h.projMatrix:null,D=j?bH(b,f,c,l,C):bG(b,f,c,l,C,i.lineClipsArray.length);if(M){const e=i.gradients[c.id];let E=e.texture;if(c.gradientVersion!==e.version){let F=256;if(c.stepInterpolant){const P=s.getSource().maxzoom,Q=h.canonical.z===P?Math.ceil(1<{O.draw(g,d.TRIANGLES,R,e,S,a.CullFaceMode.disabled,D,c.id,i.layoutVertexBuffer,i.indexBuffer,i.segments,c.paint,b.transform.zoom,k,i.layoutVertexBuffer2)};if(m){const r=b.stencilModeForClipping(h).ref;0===r&&b.terrain&&g.clear({stencil:0});const G={func:d.EQUAL,mask:255};D.u_alpha_discard_threshold=.8,q(new a.StencilMode(G,r,255,d.KEEP,d.KEEP,d.INVERT)),D.u_alpha_discard_threshold=0,q(new a.StencilMode(G,r,255,d.KEEP,d.KEEP,d.KEEP))}else q(b.stencilModeForClipping(h))}m&&(b.resetStencilClippingMasks(),b.terrain&&g.clear({stencil:0}))},fill:function(b,d,c,e){const h=c.paint.get("fill-color"),f=c.paint.get("fill-opacity");if(0===f.constantOr(1))return;const g=b.colorModeForRenderPass(),i=c.paint.get("fill-pattern"),j=b.opaquePassEnabledForLayer()&&!i.constantOr(1)&&1===h.constantOr(a.Color.transparent).a&&1===f.constantOr(0)?"opaque":"translucent";if(b.renderPass===j){const k=b.depthModeForSublayer(1,"opaque"===b.renderPass?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly);b_(b,d,c,e,k,g,!1)}if("translucent"===b.renderPass&&c.paint.get("fill-antialias")){const l=b.depthModeForSublayer(c.getPaintProperty("fill-outline-color")?2:0,a.DepthMode.ReadOnly);b_(b,d,c,e,l,g,!0)}},"fill-extrusion":function(b,d,c,e){const g=c.paint.get("fill-extrusion-opacity");if(0!==g&&"translucent"===b.renderPass){const f=new a.DepthMode(b.context.gl.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);if(1!==g||c.paint.get("fill-extrusion-pattern").constantOr(1))b0(b,d,c,e,f,a.StencilMode.disabled,a.ColorMode.disabled),b0(b,d,c,e,f,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const h=b.colorModeForRenderPass();b0(b,d,c,e,f,a.StencilMode.disabled,h)}}},hillshade:function(b,j,e,f){if("offscreen"!==b.renderPass&&"translucent"!==b.renderPass)return;const k=b.context,g=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),h=b.colorModeForRenderPass(),i=b.terrain&&b.terrain.renderingToTexture,[l,m]="translucent"!==b.renderPass||i?[{},f]:b.stencilConfigForOverlap(f);for(const c of m){const d=j.getTile(c);if(d.needsHillshadePrepare&&"offscreen"===b.renderPass)bf(b,d,e,g,a.StencilMode.disabled,h);else if("translucent"===b.renderPass){const n=i&&b.terrain?b.terrain.stencilModeForRTTOverlap(c):l[c.overscaledZ];bd(b,c,d,e,g,n,h)}}k.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,j,f,m,H,x){if("translucent"!==b.renderPass||0===f.paint.get("raster-opacity")||!m.length)return;const g=b.context,c=g.gl,h=j.getSource(),n=b.useProgram("raster"),q=b.colorModeForRenderPass(),i=b.terrain&&b.terrain.renderingToTexture,[y,o]=h instanceof s||i?[{},m]:b.stencilConfigForOverlap(m),z=o[o.length-1].overscaledZ,A=!b.options.moving;for(const e of o){const r=i?a.DepthMode.disabled:b.depthModeForSublayer(e.overscaledZ-z,1===f.paint.get("raster-opacity")?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly,c.LESS),t=e.toUnwrapped(),d=j.getTile(e);if(i&&(!d||!d.hasData()))continue;const B=i?e.projMatrix:b.transform.calculateProjMatrix(t,A),C=b.terrain&&i?b.terrain.stencilModeForRTTOverlap(e):y[e.overscaledZ],u=x?0:f.paint.get("raster-fade-duration");d.registerFadeDuration(u);const k=j.findLoadedParent(e,0),D=bn(d,k,j,b.transform,u);let l,v;b.terrain&&b.terrain.prepareDrawTile(e);const p="nearest"===f.paint.get("raster-resampling")?c.NEAREST:c.LINEAR;g.activeTexture.set(c.TEXTURE0),d.texture.bind(p,c.CLAMP_TO_EDGE),g.activeTexture.set(c.TEXTURE1),k?(k.texture.bind(p,c.CLAMP_TO_EDGE),l=Math.pow(2,k.tileID.overscaledZ-d.tileID.overscaledZ),v=[d.tileID.canonical.x*l%1,d.tileID.canonical.y*l%1,]):d.texture.bind(p,c.CLAMP_TO_EDGE);const w=bL(B,v||[0,0],l||1,D,f,h instanceof s?h.perspectiveTransform:[0,0]);if(b.prepareDrawProgram(g,n,t),h instanceof s)n.draw(g,c.TRIANGLES,r,a.StencilMode.disabled,q,a.CullFaceMode.disabled,w,f.id,h.boundsBuffer,b.quadTriangleIndexBuffer,h.boundsSegments);else{const{tileBoundsBuffer:E,tileBoundsIndexBuffer:F,tileBoundsSegments:G}=b.getTileBoundsBuffers(d);n.draw(g,c.TRIANGLES,r,C,q,a.CullFaceMode.disabled,w,f.id,E,F,G)}}b.resetStencilClippingMasks()},background:function(b,j,e,k){const l=e.paint.get("background-color"),f=e.paint.get("background-opacity");if(0===f)return;const g=b.context,m=g.gl,n=b.transform,o=n.tileSize,d=e.paint.get("background-pattern");if(b.isPatternMissing(d))return;const p=!d&&1===l.a&&1===f&&b.opaquePassEnabledForLayer()?"opaque":"translucent";if(b.renderPass!==p)return;const t=a.StencilMode.disabled,u=b.depthModeForSublayer(0,"opaque"===p?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly),v=b.colorModeForRenderPass(),q=b.useProgram(d?"backgroundPattern":"background");let h,i=k;i||(i=Object.values(h=b.getBackgroundTiles()).map(a=>a.tileID)),d&&(g.activeTexture.set(m.TEXTURE0),b.imageManager.bind(b.context));const w=e.getCrossfadeParameters();for(const c of i){const r=c.toUnwrapped(),s=k?c.projMatrix:b.transform.calculateProjMatrix(r);b.prepareDrawTile(c);const x=j?j.getTile(c):h?h[c.key]:new a.Tile(c,o,n.zoom,b),y=d?bR(s,f,b,d,{tileID:c,tileSize:o},w):bQ(s,f,l);b.prepareDrawProgram(g,q,r);const{tileBoundsBuffer:z,tileBoundsIndexBuffer:A,tileBoundsSegments:B}=b.getTileBoundsBuffers(x);q.draw(g,m.TRIANGLES,u,t,v,a.CullFaceMode.disabled,y,e.id,z,A,B)}},sky:function(b,k,c){const d=b.transform,i="mercator"===d.projection.name||"globe"===d.projection.name?1:a.smoothstep(7,8,d.zoom),e=c.paint.get("sky-opacity")*i;if(0===e)return;const j=b.context,f=c.paint.get("sky-type"),g=new a.DepthMode(j.gl.LEQUAL,a.DepthMode.ReadOnly,[0,1]),h=b.frameCounter/1e3%1;"atmosphere"===f?"offscreen"===b.renderPass?c.needsSkyboxCapture(b)&&(function(h,e,k,l){const d=h.context,b=d.gl;let i=e.skyboxFbo;if(!i){i=e.skyboxFbo=d.createFramebuffer(32,32,!1),e.skyboxGeometry=new cd(d),e.skyboxTexture=d.gl.createTexture(),b.bindTexture(b.TEXTURE_CUBE_MAP,e.skyboxTexture),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);for(let j=0;j<6;++j)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,b.RGBA,32,32,0,b.RGBA,b.UNSIGNED_BYTE,null)}d.bindFramebuffer.set(i.framebuffer),d.viewport.set([0,0,32,32,]);const f=e.getCenter(h,!0),g=h.useProgram("skyboxCapture"),c=new Float64Array(16);a.identity(c),a.rotateY(c,c,-(.5*Math.PI)),ce(d,e,g,c,f,0),a.identity(c),a.rotateY(c,c,.5*Math.PI),ce(d,e,g,c,f,1),a.identity(c),a.rotateX(c,c,-(.5*Math.PI)),ce(d,e,g,c,f,2),a.identity(c),a.rotateX(c,c,.5*Math.PI),ce(d,e,g,c,f,3),a.identity(c),ce(d,e,g,c,f,4),a.identity(c),a.rotateY(c,c,Math.PI),ce(d,e,g,c,f,5),d.viewport.set([0,0,h.width,h.height,])}(b,c),c.markSkyboxValid(b)):"sky"===b.renderPass&&function(b,c,i,j,k){var f,g;const d=b.context,e=d.gl,l=b.transform,h=b.useProgram("skybox");d.activeTexture.set(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,c.skyboxTexture);const m=(f=l.skyboxMatrix,g=c.getCenter(b,!1),{u_matrix:f,u_sun_direction:g,u_cubemap:0,u_opacity:j,u_temporal_offset:k});b.prepareDrawProgram(d,h),h.draw(d,e.TRIANGLES,i,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,m,"skybox",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,c,g,e,h):"gradient"===f&&"sky"===b.renderPass&&function(c,b,m,n,o){var g,h,i,j,k;const d=c.context,e=d.gl,p=c.transform,l=c.useProgram("skyboxGradient");b.skyboxGeometry||(b.skyboxGeometry=new cd(d)),d.activeTexture.set(e.TEXTURE0);let f=b.colorRampTexture;f||(f=b.colorRampTexture=new a.Texture(d,b.colorRamp,e.RGBA)),f.bind(e.LINEAR,e.CLAMP_TO_EDGE);const q=(g=p.skyboxMatrix,h=b.getCenter(c,!1),i=b.paint.get("sky-gradient-radius"),j=n,k=o,{u_matrix:g,u_color_ramp:0,u_center_direction:h,u_radius:a.degToRad(i),u_opacity:j,u_temporal_offset:k});c.prepareDrawProgram(d,l),l.draw(d,e.TRIANGLES,m,a.StencilMode.disabled,c.colorModeForRenderPass(),a.CullFaceMode.backCW,q,"skyboxGradient",b.skyboxGeometry.vertexBuffer,b.skyboxGeometry.indexBuffer,b.skyboxGeometry.segment)}(b,c,g,e,h)},debug:function(c,d,b){for(let a=0;aa.getOpacity(this.transform.pitch)||.03>a.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[b,c]=a.getFovAdjustedRange(this.transform._fov);if(b>c)return void(this.transform.fogCullDistSq=null);const d=b+.78*(c-b);this.transform.fogCullDistSq=d*d}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(b,c){if(this.width=b*a.exported.devicePixelRatio,this.height=c*a.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const d of this.style.order)this.style._layers[d].resize()}setup(){const b=this.context,c=new a.StructArrayLayout2i4;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=b.createVertexBuffer(c,a.posAttributes.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.StructArrayLayout2i4;d.emplaceBack(0,0),d.emplaceBack(a.EXTENT,0),d.emplaceBack(0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=b.createVertexBuffer(d,a.posAttributes.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const e=new a.StructArrayLayout2i4;e.emplaceBack(-1,-1),e.emplaceBack(1,-1),e.emplaceBack(-1,1),e.emplaceBack(1,1),this.viewportBuffer=b.createVertexBuffer(e,a.posAttributes.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.StructArrayLayout4i8;f.emplaceBack(0,0,0,0),f.emplaceBack(a.EXTENT,0,a.EXTENT,0),f.emplaceBack(0,a.EXTENT,0,a.EXTENT),f.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.mercatorBoundsBuffer=b.createVertexBuffer(f,a.boundsAttributes.members),this.mercatorBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const h=new a.StructArrayLayout3ui6;h.emplaceBack(0,1,2),h.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=b.createIndexBuffer(h);const i=new a.StructArrayLayout1ui2;for(const j of[0,1,3,2,0])i.emplaceBack(j);this.debugIndexBuffer=b.createIndexBuffer(i),this.emptyTexture=new a.Texture(b,{width:1,height:1,data:new Uint8Array([0,0,0,0])},b.gl.RGBA),this.identityMat=a.create();const g=this.context.gl;this.stencilClearMode=new a.StencilMode({func:g.ALWAYS,mask:0},0,255,g.ZERO,g.ZERO,g.ZERO),this.loadTimeStamps.push(a.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const b=this.context,c=b.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(b,c.TRIANGLES,a.DepthMode.disabled,this.stencilClearMode,a.ColorMode.disabled,a.CullFaceMode.disabled,bm(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(h,d,b){if(!d||this.currentStencilSource===d.id||!h.isTileClipped()||!b||0===b.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let g=!1;for(const i of b)if(void 0===this._tileClippingMaskIDs[i.key]){g=!0;break}if(!g)return}this.currentStencilSource=d.id;const e=this.context,c=e.gl;this.nextStencilID+b.length>256&&this.clearStencil(),e.setColorMode(a.ColorMode.disabled),e.setDepthMode(a.DepthMode.disabled);const j=this.useProgram("clippingMask");for(const f of(this._tileClippingMaskIDs={},b)){const k=d.getTile(f),l=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,{tileBoundsBuffer:m,tileBoundsIndexBuffer:n,tileBoundsSegments:o}=this.getTileBoundsBuffers(k);j.draw(e,c.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:c.ALWAYS,mask:0},l,255,c.KEEP,c.KEEP,c.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bm(f.projMatrix),"$clipping",m,n,o)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const c=this.nextStencilID++,b=this.context.gl;return new a.StencilMode({func:b.NOTEQUAL,mask:255},c,255,b.KEEP,b.KEEP,b.REPLACE)}stencilModeForClipping(c){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(c);const b=this.context.gl;return new a.StencilMode({func:b.EQUAL,mask:255},this._tileClippingMaskIDs[c.key],0,b.KEEP,b.KEEP,b.REPLACE)}stencilConfigForOverlap(h){const c=this.context.gl,b=h.sort((a,b)=>b.overscaledZ-a.overscaledZ),f=b[b.length-1].overscaledZ,d=b[0].overscaledZ-f+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const g={};for(let e=0;e=0;this.currentLayer--){const k=this.style._layers[c[this.currentLayer]],l=b._getLayerSourceCache(k);if(k.isSky())continue;const x=l?g[l.id]:void 0;this._renderTileClippingMasks(k,l,x),this.renderLayer(this,l,k,x)}if(this.renderPass="sky",(a.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const a=b._getLayerSourceCache(c);a&&!c.isHidden(this.transform.zoom)&&(!t||t.getSource().maxzoom0?a.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const b=this.imageManager.getPattern(a.from.toString()),c=this.imageManager.getPattern(a.to.toString());return!b||!c}currentGlobalDefines(){const b=this.terrain&&this.terrain.renderingToTexture,c=this.style&&this.style.fog,a=[];return this.terrain&&!this.terrain.renderingToTexture&&a.push("TERRAIN"),c&&!b&&0!==c.getOpacity(this.transform.pitch)&&a.push("FOG"),b&&a.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&a.push("OVERDRAW_INSPECTOR"),a}useProgram(a,c,e){this.cache=this.cache||{};const d=this.currentGlobalDefines().concat(e||[]),b=bt.cacheKey(a,d,c);return this.cache[b]||(this.cache[b]=new bt(this.context,a,ba[a],c,bS[a],d)),this.cache[b]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=a.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(a){this.terrain&&this.terrain.prepareDrawTile(a)}prepareDrawProgram(c,d,e){if(this.terrain&&this.terrain.renderingToTexture)return;const a=this.style.fog;if(a){const b=a.getOpacity(this.transform.pitch);0!==b&&d.setFogUniformValues(c,((b,c,d,e)=>{const a=c.properties.get("color"),f=b.frameCounter/1e3%1,g=[a.r/a.a,a.g/a.a,a.b/a.a,e,];return{u_fog_matrix:d?b.transform.calculateFogTileMatrix(d):b.identityMat,u_fog_range:c.getFovAdjustedRange(b.transform._fov),u_fog_color:g,u_fog_horizon_blend:c.properties.get("horizon-blend"),u_fog_temporal_offset:f}})(this,a,e,b))}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,b=a.createTexture();return a.bindTexture(a.TEXTURE_2D,b),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),b}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&0!==a.getOpacity(this.transform.pitch)}getBackgroundTiles(){const d=this._backgroundTiles,c=this._backgroundTiles={},e=this.transform.coveringTiles({tileSize:512});for(const b of e)c[b.key]=d[b.key]||new a.Tile(b,512,this.transform.tileZoom,this);return c}clearBackgroundTiles(){this._backgroundTiles={}}}class ch{constructor(a=0,b=0,c=0,d=0){if(isNaN(a)||a<0||isNaN(b)||b<0||isNaN(c)||c<0||isNaN(d)||d<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=b,this.left=c,this.right=d}interpolate(b,c,d){return null!=c.top&&null!=b.top&&(this.top=a.number(b.top,c.top,d)),null!=c.bottom&&null!=b.bottom&&(this.bottom=a.number(b.bottom,c.bottom,d)),null!=c.left&&null!=b.left&&(this.left=a.number(b.left,c.left,d)),null!=c.right&&null!=b.right&&(this.right=a.number(b.right,c.right,d)),this}getCenter(b,c){const d=a.clamp((this.left+b-this.right)/2,0,b),e=a.clamp((this.top+c-this.bottom)/2,0,c);return new a.pointGeometry(d,e)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new ch(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ci(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function cj(c,b){a.setColumn(c,3,[b[0],b[1],b[2],1])}function ck(c,d){const b=a.identity$1([]);return a.rotateZ$1(b,b,-d),a.rotateX$1(b,b,-c),b}function cl(b,c){const f=[b[0],b[1],0],d=[c[0],c[1],0];if(a.length(f)>=1e-15){const g=a.normalize([],f);a.scale$2(d,g,a.dot(d,g)),c[0]=d[0],c[1]=d[1]}const e=a.cross([],c,b);if(1e-15>a.len(e))return null;const h=Math.atan2(-e[1],e[0]);return ck(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),h)}class x{constructor(a,b){this.position=a,this.orientation=b}get position(){return this._position}set position(b){this._position=this._renderWorldCopies?function(b){if(!b)return;const c=Array.isArray(b)?new a.MercatorCoordinate(b[0],b[1],b[2]):b;return c.x=a.wrap(c.x,0,1),c}(b):b}lookAtPoint(e,b){if(this.orientation=null,!this.position)return;const f=this._elevation?this._elevation.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(e)):0,c=this.position,d=a.MercatorCoordinate.fromLngLat(e,f),g=[d.x-c.x,d.y-c.y,d.z-c.z];b||(b=[0,0,1]),b[2]=Math.abs(b[2]),this.orientation=cl(g,b)}setPitchBearing(b,c){this.orientation=ck(a.degToRad(b),a.degToRad(-c))}}class cm{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,ci(this._transform,this._orientation)),b&&cj(this._transform,b)}get mercatorPosition(){const b=this.position;return new a.MercatorCoordinate(b[0],b[1],b[2])}get position(){const b=a.getColumn(this._transform,3);return[b[0],b[1],b[2]]}set position(a){cj(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,ci(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),b=this.right();return{bearing:Math.atan2(-b[1],b[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,b){this._orientation=ck(a,b),ci(this._transform,this._orientation)}forward(){const b=a.getColumn(this._transform,2);return[-b[0],-b[1],-b[2]]}up(){const b=a.getColumn(this._transform,1);return[-b[0],-b[1],-b[2]]}right(){const b=a.getColumn(this._transform,0);return[b[0],b[1],b[2]]}getCameraToWorld(c,d){const b=new Float64Array(16);return a.invert(b,this.getWorldToCamera(c,d)),b}getWorldToCameraPosition(e,f,c){const d=this.position;a.scale$2(d,d,-e);const b=new Float64Array(16);return a.fromScaling(b,[c,c,c]),a.translate(b,b,d),b[10]*=f,b}getWorldToCamera(f,c){const b=new Float64Array(16),e=new Float64Array(4),d=this.position;return a.conjugate(e,this._orientation),a.scale$2(d,d,-f),a.fromQuat(b,e),a.translate(b,b,d),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=c,b[9]*=c,b[10]*=c,b[11]*=c,b}getCameraToClipPerspective(c,d,e,f){const b=new Float64Array(16);return a.perspective(b,c,d,e,f),b}getDistanceToElevation(b){const c=0===b?0:a.mercatorZfromAltitude(b,this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new cm([...this.position],[...this.orientation])}}function cn(b,e){const f=cp(b),c=function(c,y,d,h,v){const l=new a.LngLat(d.lng-180*cq,d.lat),m=new a.LngLat(d.lng+180*cq,d.lat),n=c.project(l.lng,l.lat),o=c.project(m.lng,m.lat),e=-Math.atan2(o.y-n.y,o.x-n.x),i=a.MercatorCoordinate.fromLngLat(d);i.y=a.clamp(i.y,-0.999975,.999975);const f=i.toLngLat(),g=c.project(f.lng,f.lat),p=a.MercatorCoordinate.fromLngLat(f);p.x+=cq;const q=p.toLngLat(),r=c.project(q.lng,q.lat),w=cs(r.x-g.x,r.y-g.y,e),s=a.MercatorCoordinate.fromLngLat(f);s.y+=cq;const t=s.toLngLat(),u=c.project(t.lng,t.lat),j=cs(u.x-g.x,u.y-g.y,e),x=Math.abs(w.x)/Math.abs(j.y),k=a.identity([]);a.rotateZ(k,k,-e*(1-(v?0:h)));const b=a.identity([]);return a.scale(b,b,[1,1-(1-x)*h,1]),b[4]=-j.x/j.y*h,a.rotateZ(b,b,e),a.multiply$1(b,k,b),b}(b.projection,0,b.center,f,e),d=co(b);return a.scale(c,c,[d,d,1]),c}function co(b){const c=b.projection,d=cp(b),e=cr(c,b.center),f=cr(c,a.LngLat.convert(c.center));return Math.pow(2,e*d+(1-d)*f)}function cp(b){const c=b.projection.range;if(!c)return 0;const e=Math.max(b.width,b.height),d=Math.log(e/1024)/Math.LN2;return a.smoothstep(c[0]+d,c[1]+d,b.zoom)}const cq=1/4e4;function cr(d,c){const b=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),e=new a.LngLat(c.lng-180*cq,b),f=new a.LngLat(c.lng+180*cq,b),g=d.project(e.lng,b),h=d.project(f.lng,b),i=a.MercatorCoordinate.fromLngLat(e),j=a.MercatorCoordinate.fromLngLat(f),k=h.x-g.x,l=h.y-g.y,m=j.x-i.x,n=j.y-i.y;return Math.log(Math.sqrt((m*m+n*n)/(k*k+l*l)))/Math.LN2}function cs(a,b,c){const d=Math.cos(c),e=Math.sin(c);return{x:a*d-b*e,y:a*e+b*d}}class ct{constructor(e,f,b,c,d){this.tileSize=512,this._renderWorldCopies=void 0===d||d,this._minZoom=e||0,this._maxZoom=f||22,this._minPitch=null==b?0:b,this._maxPitch=null==c?60:c,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ch,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new cm,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new ct(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.setProjection(this.getProjection()),a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a.tileSize=this.tileSize,a.setMaxBounds(this.getMaxBounds()),a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._cameraZoom=this._cameraZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,a?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(a){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),a&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return a.pick(this.projection,["name","center","parallels",])}setProjection(b){null==b&&(b={name:"mercator"}),this.projectionOptions=b;const c=this.projection?this.getProjection():void 0;return this.projection=a.getProjection(b),!D(c,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&& !0===this.projection.supportsWorldCopies}set renderWorldCopies(a){void 0===a?a=!0:null===a&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return a.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(m){var b,c,d,g,h,i,j,k,e,f;const l=-m*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=(b=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0),b[0]=1,b[3]=1,b),c=this.rotationMatrix,d=this.rotationMatrix,g=this.angle,h=d[0],i=d[1],j=d[2],k=d[3],e=Math.sin(g),f=Math.cos(g),c[0]=h*f+j*e,c[1]=i*f+k*e,c[2]=-(h*e)+j*f,c[3]=-(i*e)+k*f)}get pitch(){return this._pitch/Math.PI*180}set pitch(c){const b=a.clamp(c,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==b&&(this._unmodified=!1,this._pitch=b,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(b){const a=Math.min(Math.max(b,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===a?(this._cameraZoom=null,!1):(this._centerAltitude=a,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const i=this._elevation,d=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],f=this.horizonLineFromTop();let g=0,e=0;for(let b=0;bc.maxzoom&&(d=c.maxzoom);const r=this.locationCoordinate(this.center),e=1<{const d=1/4e4,g=new a.MercatorCoordinate(b.x+d,b.y,b.z),h=new a.MercatorCoordinate(b.x,b.y+d,b.z),i=b.toLngLat(),j=g.toLngLat(),k=h.toLngLat(),c=this.locationCoordinate(i),e=this.locationCoordinate(j),f=this.locationCoordinate(k),l=Math.hypot(e.x-c.x,e.y-c.y),m=Math.hypot(f.x-c.x,f.y-c.y);return Math.sqrt(l*m)*O/d},j=b=>{const c=F,d=N;return{aabb:a.tileAABB(this,e,0,0,0,b,d,c,this.projection),zoom:0,x:0,y:0,minZ:d,maxZ:c,wrap:b,fullyVisible:!1}},f=[];let h=[];const k=d,v=c.reparseOverscaled?A:d,G=a=>a*a,Q=G((u-this._centerAltitude)*E),H=b=>{if(!this._elevation||!b.tileID||!C)return;const c=this._elevation.getMinMaxForTile(b.tileID),a=b.aabb;c?(a.min[2]=c.min,a.max[2]=c.max,a.center[2]=(a.min[2]+a.max[2])/2):(b.shouldSplit=I(b),b.shouldSplit||(a.min[2]=a.max[2]=a.center[2]=this._centerAltitude))},I=b=>{if(b.zoom.85?1:h}const i=d*d+e*e+c;return i{if(b*G(.707)0;){const b=f.pop(),l=b.x,m=b.y;let n=b.fullyVisible;if(!n){const w=b.aabb.intersects(D);if(0===w)continue;n=2===w}if(b.zoom!==k&&I(b))for(let g=0;g<4;g++){const o=(l<<1)+g%2,p=(m<<1)+(g>>1),q={aabb:C?b.aabb.quadrant(g):a.tileAABB(this,e,b.zoom+1,o,p,b.wrap,b.minZ,b.maxZ,this.projection),zoom:b.zoom+1,x:o,y:p,wrap:b.wrap,fullyVisible:n,tileID:void 0,shouldSplit:void 0,minZ:b.minZ,maxZ:b.maxZ};B&&(q.tileID=new a.OverscaledTileID(b.zoom+1===k?v:b.zoom+1,b.wrap,b.zoom+1,o,p),H(q)),f.push(q)}else{const x=b.zoom===k?v:b.zoom;if(c.minzoom&&c.minzoom>x)continue;const y=s[0]-(.5+l+(b.wrap<{const e=[0,0,0,1],f=[a.EXTENT,a.EXTENT,0,1],i=this.calculateFogTileMatrix(d.tileID.toUnwrapped());a.transformMat4$1(e,e,i),a.transformMat4$1(f,f,i);const g=a.getAABBPointSquareDist(e,f);if(0===g)return!0;let j=!1;const k=this._elevation;if(k&&g>R&&0!==S){const m=this.calculateProjMatrix(d.tileID.toUnwrapped());let b;c.isTerrainDEM||(b=k.getMinMaxForTile(d.tileID)),b||(b={min:N,max:F});const l=a.furthestTileCorner(this.rotation),h=[l[0]*a.EXTENT,l[1]*a.EXTENT,b.max,];a.transformMat4(h,h,m),j=(1-h[1])*this.height*.5a.distanceSq-b.distanceSq).map(a=>a.tileID)}resize(a,b){this.width=a,this.height=b,this.pixelsToGLUnits=[2/a,-2/b],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(b){const d=a.clamp(b.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),c=this.projection.project(b.lng,d);return new a.pointGeometry(c.x*this.worldSize,c.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(e,f){const b=this.pointCoordinate(f),c=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(e);this.setLocation(new a.MercatorCoordinate(d.x-(b.x-c.x),d.y-(b.y-c.y)))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this._coordinatePoint(this.locationCoordinate(a),!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(b,c){const e=c?a.mercatorZfromAltitude(c,b.lat):void 0,d=this.projection.project(b.lng,b.lat);return new a.MercatorCoordinate(d.x,d.y,e)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(d,f){const h=null!=f?f:this._centerAltitude,b=[d.x,d.y,0,1],c=[d.x,d.y,1,1];a.transformMat4$1(b,b,this.pixelMatrixInverse),a.transformMat4$1(c,c,this.pixelMatrixInverse);const i=c[3];a.scale$1(b,b,1/b[3]),a.scale$1(c,c,1/i);const e=b[2],g=c[2];return{p0:b,p1:c,t:e===g?0:(h-e)/(g-e)}}screenPointToMercatorRay(d){const b=[d.x,d.y,0,1],c=[d.x,d.y,1,1];return a.transformMat4$1(b,b,this.pixelMatrixInverse),a.transformMat4$1(c,c,this.pixelMatrixInverse),a.scale$1(b,b,1/b[3]),a.scale$1(c,c,1/c[3]),b[2]=a.mercatorZfromAltitude(b[2],this._center.lat)*this.worldSize,c[2]=a.mercatorZfromAltitude(c[2],this._center.lat)*this.worldSize,a.scale$1(b,b,1/this.worldSize),a.scale$1(c,c,1/this.worldSize),new a.Ray([b[0],b[1],b[2]],a.normalize([],a.sub([],c,b)))}rayIntersectionCoordinate(e){const{p0:b,p1:c,t:d}=e,f=a.mercatorZfromAltitude(b[2],this._center.lat),g=a.mercatorZfromAltitude(c[2],this._center.lat);return new a.MercatorCoordinate(a.number(b[0],c[0],d)/this.worldSize,a.number(b[1],c[1],d)/this.worldSize,a.number(f,g,d))}pointCoordinate(a,b=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(a.x,a.y,b)}pointCoordinate3D(c){if(!this.elevation)return this.pointCoordinate(c);const i=this.elevation;let b=this.elevation.pointCoordinate(c);if(b)return new a.MercatorCoordinate(b[0],b[1],b[2]);let f=0,d=this.horizonLineFromTop();if(c.y>d)return this.pointCoordinate(c);const j=.02*d,e=c.clone();for(let g=0;g<10&&d-f>j;g++){e.y=a.number(f,d,.66);const h=i.pointCoordinate(e);h?(d=e.y,b=h):f=e.y}return b?new a.MercatorCoordinate(b[0],b[1],b[2]):this.pointCoordinate(c)}isPointAboveHorizon(a){if(this.elevation)return!this.elevation.pointCoordinate(a);{const b=this.horizonLineFromTop();return a.y0?new a.pointGeometry(b[0]/b[3],b[1]/b[3]):new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(j,k){var f,l,g,m,h,n,i,o;const p=new a.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),q=new a.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),r=new a.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),s=new a.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let b=this.pointCoordinate(p,j),c=this.pointCoordinate(q,j);const d=this.pointCoordinate(r,k),e=this.pointCoordinate(s,k);return b.y>1&&c.y>=0?b=new a.MercatorCoordinate((1-e.y)/(f=e,((l=b).y-f.y)/(l.x-f.x))+e.x,1):b.y<0&&c.y<=1&&(b=new a.MercatorCoordinate(-e.y/(g=e,((m=b).y-g.y)/(m.x-g.x))+e.x,0)),c.y>1&&b.y>=0?c=new a.MercatorCoordinate((1-d.y)/(h=d,((n=c).y-h.y)/(n.x-h.x))+d.x,1):c.y<0&&b.y<=1&&(c=new a.MercatorCoordinate(-d.y/(i=d,((o=c).y-i.y)/(o.x-i.x))+d.x,0)),new a.LngLatBounds().extend(this.coordinateLocation(b)).extend(this.coordinateLocation(c)).extend(this.coordinateLocation(e)).extend(this.coordinateLocation(d))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length)return this._getBounds(0,0);const b=a.visibleDemTiles.reduce((a,b)=>{if(b.dem){const c=b.dem.tree;a.min=Math.min(a.min,c.minimums[0]),a.max=Math.max(a.max,c.maximums[0])}return a},{min:Number.MAX_VALUE,max:0});return this._getBounds(b.min*a.exaggeration(),b.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(b=!0){const c=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,a=this.height/2-c*(1-this._horizonShift);return b?Math.max(0,a):a}getMaxBounds(){return this.maxBounds}setMaxBounds(b){this.maxBounds=b,this.minLat=-a.MAX_MERCATOR_LATITUDE,this.maxLat=a.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,b&&(this.minLat=b.getSouth(),this.maxLat=b.getNorth(),this.minLng=b.getWest(),this.maxLng=b.getEast(),this.maxLngi&&(g=i-l),i-he&&(b=e-k),e-d.5?j-1:j,k>.5?k-1:k,0,]),this.alignedProjMatrix=l,b=a.create(),a.scale(b,b,[this.width/2,-this.height/2,1,]),a.translate(b,b,[1,-1,0]),this.labelPlaneMatrix=b,b=a.create(),a.scale(b,b,[1,-1,1]),a.translate(b,b,[-1,-1,0]),a.scale(b,b,[2/this.width,2/this.height,1,]),this.glCoordMatrix=b,this.pixelMatrix=a.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},b=a.invert(new Float64Array(16),this.pixelMatrix),!b)throw Error("failed to invert matrix");this.pixelMatrixInverse=b,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSize,f=this.cameraPixelsPerMeter,b=this._camera.position,g=1/this.height,d=[e,e,f];a.scale$2(d,d,g),a.scale$2(b,b,-1),a.multiply$2(b,b,d);const c=a.create();a.translate(c,c,b),a.scale(c,c,d),this.mercatorFogMatrix=c,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,f,g)}_computeCameraPosition(a){const e=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),d=this.point,c=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*e-a/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-b[0]*c,d.y/this.worldSize-b[1]*c,a/this.worldSize*this._centerAltitude-b[2]*c,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(b){const e=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=b[2];let d=1;c>0&&(d=Math.min((e-this._camera.position[2])/c,1)),this._camera.position=a.scaleAndAdd([],this._camera.position,b,d),this._updateStateFromCamera()}_updateStateFromCamera(){const b=this._camera.position,e=this._camera.forward(),{pitch:c,bearing:f}=this._camera.getPitchBearing(),g=a.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,h=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.degToRad(this._maxPitch)),d=Math.max((b[2]-g)/Math.cos(c),h),i=this._zoomFromMercatorZ(d);a.scaleAndAdd(b,b,e,d),this._pitch=a.clamp(c,a.degToRad(this.minPitch),a.degToRad(this.maxPitch)),this.angle=a.wrap(f,-Math.PI,Math.PI),this._setZoom(a.clamp(i,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new a.MercatorCoordinate(b[0],b[1],b[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}_terrainEnabled(){return!(!this._elevation|| !this.projection.supportsTerrain&&(a.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(b,c){const f=Math.min(b.x,c.x),g=Math.max(b.x,c.x),e=Math.min(b.y,c.y),h=Math.max(b.y,c.y);if(el||d.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.pointGeometry(0,0),new a.pointGeometry(this.width,this.height))}zoomDeltaToMovement(c,d){const b=a.length(a.sub([],this._camera.position,c)),e=this._zoomFromMercatorZ(b)+d;return b-this._mercatorZfromZoom(e)}getCameraPoint(){const b=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,b))}}function cu(a,b){let c=!1,d=null;const e=()=>{d=null,c&&(a(),d=setTimeout(e,b),c=!1)};return()=>(c=!0,d||e(),d)}const d={linearity:.3,easing:a.bezier(0,0,.3,1)},cv=a.extend({deceleration:2500,maxSpeed:1400},d),cw=a.extend({deceleration:20,maxSpeed:1400},d),cx=a.extend({deceleration:1e3,maxSpeed:360},d),cy=a.extend({deceleration:1e3,maxSpeed:90},d);function cz(a,b){(!a.duration||a.durationf.unproject(a)),g=d.reduce((a,b,d,c)=>a.add(b.div(c.length)),new a.pointGeometry(0,0));super(e,{points:d,point:g,lngLats:i,lngLat:f.unproject(g),originalEvent:c}),this._defaultPrevented=!1}}class cD extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,c,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class cE{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cD(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cB(a.type,this._map,a))}mouseup(a){this._map.fire(new cB(a.type,this._map,a))}preclick(c){const b=a.extend({},c);b.type="preclick",this._map.fire(new cB(b.type,this._map,b))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cB(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cB(a.type,this._map,a))}mouseover(a){this._map.fire(new cB(a.type,this._map,a))}mouseout(a){this._map.fire(new cB(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cC(a.type,this._map,a))}touchmove(a){this._map.fire(new cC(a.type,this._map,a))}touchend(a){this._map.fire(new cC(a.type,this._map,a))}touchcancel(a){this._map.fire(new cC(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cF{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cB(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cB("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cB(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cG{constructor(a,b){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=b.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,c){this.isEnabled()&&a.shiftKey&&0===a.button&&(b.disableDrag(),this._startPos=this._lastPos=c,this._active=!0)}mousemoveWindow(d,e){if(!this._active)return;const a=e;if(this._lastPos.equals(a)|| !this._box&&a.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${f}px,${h}px)`,this._box.style.width=g-f+"px",this._box.style.height=i-h+"px")})}mouseupWindow(c,f){if(!this._active||0!==c.button)return;const d=this._startPos,e=f;if(this.reset(),b.suppressClick(),d.x!==e.x||d.y!==e.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:c})),{cameraAnimation:a=>a.fitScreenCoordinates(d,e,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",c)}keydown(a){this._active&&27===a.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),b.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(b,c){return this._map.fire(new a.Event(b,{originalEvent:c}))}}function cH(b,d){const c={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=d.timeStamp),b.length===this.numTouches&&(this.centroid=function(b){const c=new a.pointGeometry(0,0);for(const d of b)c._add(d);return c.div(b.length)}(c),this.touches=cH(b,c)))}touchmove(g,c,d){if(this.aborted||!this.centroid)return;const e=cH(d,c);for(const a in this.touches){const f=this.touches[a],b=e[a];(!b||b.dist(f)>30)&&(this.aborted=!0)}}touchend(b,d,c){if((!this.centroid||b.timeStamp-this.startTime>500)&&(this.aborted=!0),0===c.length){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}(b),this.numTaps=b.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,b,c){this.singleTap.touchstart(a,b,c)}touchmove(a,b,c){this.singleTap.touchmove(a,b,c)}touchend(b,c,d){const a=this.singleTap.touchend(b,c,d);if(a){const e=b.timeStamp-this.lastTime<500,f=!this.lastTap||30>this.lastTap.dist(a);if(e&&f||this.reset(),this.count++,this.lastTime=b.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class cJ{constructor(){this._zoomIn=new cI({numTouches:1,numTaps:2}),this._zoomOut=new cI({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,b,c){this._zoomIn.touchstart(a,b,c),this._zoomOut.touchstart(a,b,c)}touchmove(a,b,c){this._zoomIn.touchmove(a,b,c),this._zoomOut.touchmove(a,b,c)}touchend(a,b,c){const d=this._zoomIn.touchend(a,b,c),e=this._zoomOut.touchend(a,b,c);return d?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(d)},{originalEvent:a})}):e?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(e)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cK={0:1,2:2};class f{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(a,b){return!1}_move(a,b){return{}}mousedown(a,d){if(this._lastPoint)return;const c=b.mouseButton(a);this._correctButton(a,c)&&(this._lastPoint=d,this._eventButton=c)}mousemoveWindow(c,a){const b=this._lastPoint;if(b){if(c.preventDefault(),function(a,c){const b=cK[c];return void 0===a.buttons||(a.buttons&b)!==b}(c,this._eventButton))this.reset();else if(this._moved||!(a.dist(b)0&&(this._active=!0);const b=cH(g,k),h=new a.pointGeometry(0,0),d=new a.pointGeometry(0,0);let c=0;for(const e in b){const f=b[e],i=this._touches[e];i&&(h._add(f),d._add(f.sub(i)),c++,b[e]=f)}if(this._touches=b,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class g{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(a){}_move(a,b,c){return{}}touchstart(c,b,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier,],this._start([b[0],b[1]]))}touchmove(c,d,e){if(!this._firstTwoTouches)return;c.preventDefault();const[f,g]=this._firstTwoTouches,a=cP(e,d,f),b=cP(e,d,g);if(!a||!b)return;const h=this._aroundCenter?null:a.add(b).div(2);return this._move([a,b],h,c)}touchend(h,a,c){if(!this._firstTwoTouches)return;const[d,e]=this._firstTwoTouches,f=cP(c,a,d),g=cP(c,a,e);f&&g||(this._active&&b.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function cP(b,c,d){for(let a=0;aMath.abs(cQ(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cQ(this._distance,c),pinchAround:b}}}function cS(a,b){return 180*a.angleWith(b)/Math.PI}class cT extends g{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,b){const c=this._vector;if(this._vector=a[0].sub(a[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:cS(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cS(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cV extends g{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(a){this._lastPoints=a,cU(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,e,b){const c=a[0].sub(this._lastPoints[0]),d=a[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&b.touches.length<3)&&(this._valid=this.gestureBeginsVertically(c,d,b.timeStamp),this._valid))return this._lastPoints=a,this._active=!0,{pitchDelta:-((c.y+d.y)/2*.5)}}gestureBeginsVertically(a,b,c){if(void 0!==this._valid)return this._valid;const d=a.mag()>=2,e=b.mag()>=2;if(!d&&!e)return;if(!d||!e)return void 0===this._firstMove&&(this._firstMove=c),c-this._firstMove<100&&void 0;const f=a.y>0==b.y>0;return cU(a)&&cU(b)&&f}}class cW{constructor(){const a={panStep:100,bearingStep:15,pitchStep:10};this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let d=0,b=0,c=0,e=0,f=0;switch(a.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:a.shiftKey?b=-1:(a.preventDefault(),e=-1);break;case 39:a.shiftKey?b=1:(a.preventDefault(),e=1);break;case 38:a.shiftKey?c=1:(a.preventDefault(),f=-1);break;case 40:a.shiftKey?c=-1:(a.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(b=0,c=0),{cameraAnimation:g=>{const h=g.getZoom();g.easeTo({duration:300,easeId:"keyboardHandler",easing:cX,zoom:d?Math.round(h)+d*(a.shiftKey?2:1):h,bearing:g.getBearing()+b*this._bearingStep,pitch:g.getPitch()+c*this._pitchStep,offset:[-e*this._panStep,-f*this._panStep,],center:g.getCenter()},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function cX(a){return a*(2-a)}const cY=4.000244140625;class cZ{constructor(b,c){this._map=b,this._el=b.getCanvasContainer(),this._handler=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active|| void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(b){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(b.ctrlKey||b.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let c=b.deltaMode===a.window.WheelEvent.DOM_DELTA_LINE?40*b.deltaY:b.deltaY;const d=a.exported.now(),e=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,0!==c&&c%cY==0?this._type="wheel":0!==c&&4>Math.abs(c)?this._type="trackpad":e>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,b)):this._type||(this._type=200>Math.abs(e*c)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),b.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=b,this._delta-=c,this._active||this._start(b)),b.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const c=b.mousePos(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:c,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const b=this._map.transform,c=()=>b._terrainEnabled()&&this._aroundCoord?b.computeZoomRelativeTo(this._aroundCoord):b.zoom;if(0!==this._delta){const k="wheel"===this._type&&Math.abs(this._delta)>cY?this._wheelZoomRate:this._defaultZoomRate;let d=2/(1+Math.exp(-Math.abs(this._delta*k)));this._delta<0&&0!==d&&(d=1/d);const l=c(),m=Math.pow(2,l),n="number"==typeof this._targetZoom?b.zoomScale(this._targetZoom):m;this._targetZoom=Math.min(b.maxZoom,Math.max(b.minZoom,b.scaleZoom(n*d))),"wheel"===this._type&&(this._startZoom=c(),this._easing=this._smoothOutEasing(200)),this._delta=0}const g="number"==typeof this._targetZoom?this._targetZoom:c(),h=this._startZoom,i=this._easing;let f,e=!1;if("wheel"===this._type&&h&&i){const j=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),o=i(j);f=a.number(h,g,o),j<1?this._frameId||(this._frameId=!0):e=!0}else f=g,e=!0;return this._active=!0,e&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!e,zoomDelta:f-c(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(g){let c=a.ease;if(this._prevEase){const b=this._prevEase,e=(a.exported.now()-b.start)/b.duration,f=b.easing(e+.01)-b.easing(e),d=.27/Math.sqrt(f*f+1e-4)*.01,h=Math.sqrt(.0729-d*d);c=a.bezier(d,h,.25,1)}return this._prevEase={start:a.exported.now(),duration:g,easing:c},c}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=b.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(a.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_isFullscreen(){return!!a.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class c${constructor(a,b){this._clickZoom=a,this._tapZoom=b}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class c_{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,b){return a.preventDefault(),{cameraAnimation(c){c.easeTo({duration:300,zoom:c.getZoom()+(a.shiftKey?-1:1),around:c.unproject(b)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c0{constructor(){this._tap=new cI({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(b,c,a){this._swipePoint||(this._tapTime&&b.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=c[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(b,c,a))}touchmove(a,b,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=b[0],e=d.y-this._swipePoint.y;return this._swipePoint=d,a.preventDefault(),this._active=!0,{zoomDelta:e/128}}}else this._tap.touchmove(a,b,c)}touchend(a,c,b){this._tapTime?this._swipePoint&&0===b.length&&this.reset():this._tap.touchend(a,c,b)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c1{constructor(a,b,c){this._el=a,this._mousePan=b,this._touchPan=c}enable(a){this._inertiaOptions=a||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class c2{constructor(a,b,c){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=b,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class c3{constructor(a,b,c,d){this._el=a,this._touchZoom=b,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const c4=a=>a.zoom||a.drag||a.pitch||a.rotate;class c5 extends a.Event{}function c6(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c7="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c8 extends a.Evented{constructor(b,c){super(),this._moving=!1,this._zooming=!1,this.transform=b,this._bearingSnap=c.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,b){return this.jumpTo({center:a},b)}panBy(b,c,d){return b=a.pointGeometry.convert(b).mult(-1),this.panTo(this.transform.center,a.extend({offset:b},c),d)}panTo(b,c,d){return this.easeTo(a.extend({center:b},c),d)}getZoom(){return this.transform.zoom}setZoom(a,b){return this.jumpTo({zoom:a},b),this}zoomTo(b,c,d){return this.easeTo(a.extend({zoom:b},c),d)}zoomIn(a,b){return this.zoomTo(this.getZoom()+1,a,b),this}zoomOut(a,b){return this.zoomTo(this.getZoom()-1,a,b),this}getBearing(){return this.transform.bearing}setBearing(a,b){return this.jumpTo({bearing:a},b),this}getPadding(){return this.transform.padding}setPadding(a,b){return this.jumpTo({padding:a},b),this}rotateTo(b,c,d){return this.easeTo(a.extend({bearing:b},c),d)}resetNorth(b,c){return this.rotateTo(0,a.extend({duration:1e3},b),c),this}resetNorthPitch(b,c){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},b),c),this}snapToNorth(a,b){return Math.abs(this.getBearing())i=>{if(t&&(c.zoom=a.number(d,g,i)),u&&(c.bearing=a.number(e,n,i)),v&&(c.pitch=a.number(f,o,i)),w&&(c.interpolatePadding(z,p,i),h=c.centerPoint.add(q)),k)c.setLocationAtPoint(k,s);else{const l=c.zoomScale(c.zoom-d),x=g>d?Math.min(2,B):Math.max(.5,B),y=Math.pow(x,1-i),j=c.unproject(r.add(A.mult(i*y)).mult(l));c.setLocationAtPoint(c.renderWorldCopies?j.wrap():j,h)}return b.preloadOnly||this._fireMoveEvents(m),c};if(b.preloadOnly){const x=this._emulate(l,b.duration,c);return this._preloadTiles(x),this}const y={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=t,this._rotating=u,this._pitching=v,this._padding=w,this._easeId=b.easeId,this._prepareEase(m,b.noMoveStart,y),this._ease(l(c),a=>{c.recenterOnTerrain(),this._afterEase(m,a)},b),this}_prepareEase(b,d,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",d||c.moving||this.fire(new a.Event("movestart",b)),this._zooming&&!c.zooming&&this.fire(new a.Event("zoomstart",b)),this._rotating&&!c.rotating&&this.fire(new a.Event("rotatestart",b)),this._pitching&&!c.pitching&&this.fire(new a.Event("pitchstart",b))}_fireMoveEvents(b){this.fire(new a.Event("move",b)),this._zooming&&this.fire(new a.Event("zoom",b)),this._rotating&&this.fire(new a.Event("rotate",b)),this._pitching&&this.fire(new a.Event("pitch",b))}_afterEase(b,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId,this.transform.cameraElevationReference="ground";const d=this._zooming,e=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.Event("zoomend",b)),e&&this.fire(new a.Event("rotateend",b)),f&&this.fire(new a.Event("pitchend",b)),this.fire(new a.Event("moveend",b))}flyTo(b,g){if(!b.essential&&a.exported.prefersReducedMotion){const r=a.pick(b,["center","zoom","bearing","pitch","around",]);return this.jumpTo(r,g)}this.stop(),b=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},b);const c=this.transform,f=this.getZoom(),h=this.getBearing(),k=this.getPitch(),J=this.getPadding(),l="zoom"in b?a.clamp(+b.zoom,c.minZoom,c.maxZoom):f,s="bearing"in b?this._normalizeBearing(b.bearing,h):h,t="pitch"in b?+b.pitch:k,u="padding"in b?b.padding:c.padding,v=c.zoomScale(l-f),w=a.pointGeometry.convert(b.offset);let x=c.centerPoint.add(w);const m=c.pointLocation(x),n=a.LngLat.convert(b.center||m);this._normalizeCenter(n);const y=c.project(m),z=c.project(n).sub(y);let d=b.curve;const e=Math.max(c.width,c.height),i=e/v,o=z.mag();if("minZoom"in b){const A=a.clamp(Math.min(b.minZoom,f,l),c.minZoom,c.maxZoom),B=e/c.zoomScale(A-f);d=Math.sqrt(B/o*2)}const K=d*d;function p(b){const a=(i*i-e*e+(b?-1:1)*K*K*o*o)/(2*(b?i:e)*K*o);return Math.log(Math.sqrt(a*a+1)-a)}function L(a){return(Math.exp(a)-Math.exp(-a))/2}function M(a){return(Math.exp(a)+Math.exp(-a))/2}const C=p(0);let D=function(a){return M(C)/M(C+d*a)},E=function(b){var a;return e*((M(C)*(L(a=C+d*b)/M(a))-L(C))/K)/o},j=(p(1)-C)/d;if(1e-6>Math.abs(o)||!isFinite(j)){if(1e-6>Math.abs(e-i))return this.easeTo(b,g);const N=ib.maxDuration&&(b.duration=0);const F=h!==s,G=t!==k,H=!c.isPaddingEqual(u),q=c=>d=>{const e=d*j,i=1/D(e);c.zoom=1===d?l:f+c.scaleZoom(i),F&&(c.bearing=a.number(h,s,d)),G&&(c.pitch=a.number(k,t,d)),H&&(c.interpolatePadding(J,u,d),x=c.centerPoint.add(w));const m=1===d?n:c.unproject(y.add(z.mult(E(e))).mult(i));return c.setLocationAtPoint(c.renderWorldCopies?m.wrap():m,x),c._updateCenterElevation(),b.preloadOnly||this._fireMoveEvents(g),c};if(b.preloadOnly){const I=this._emulate(q,b.duration,c);return this._preloadTiles(I),this}return this._zooming=!0,this._rotating=F,this._pitching=G,this._padding=H,this._prepareEase(g,!1),this._ease(q(c),()=>this._afterEase(g),b),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(b,c){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,c)}if(!b){const a=this.handlers;a&&a.stop(!1)}return this}_ease(c,d,b){!1===b.animate||0===b.duration?(c(1),d()):(this._easeStart=a.exported.now(),this._easeOptions=b,this._onEaseFrame=c,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const b=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(b)),b<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(b,c){b=a.wrap(b,-180,180);const d=Math.abs(b-c);return Math.abs(b-360-c)180?-360:c< -180?360:0}_emulate(d,e,f){const b=Math.ceil(15*e/1e3),c=[],g=d(f.clone());for(let a=0;a<=b;a++){const h=g(a/b);c.push(h.clone())}return c}}class y{constructor(b={}){this.options=b,a.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(c){const a=this.options&&this.options.compact;return this._map=c,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=b.create("button","mapboxgl-ctrl-attrib-button",this._container),b.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=b.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),a&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===a&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(a,c){const b=this._map._getUIString(`AttributionControl.${c}`);a.setAttribute("aria-label",b),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let b=this._editLink;b||(b=this._editLink=this._container.querySelector(".mapbox-improve-map"));const c=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.config.ACCESS_TOKEN},];if(b){const d=c.reduce((b,a,d)=>(a.value&&(b+=`${a.key}=${a.value}${da.indexOf(b.attribution)&&a.push(b.attribution)}}a.sort((a,b)=>a.length-b.length),a=a.filter((c,d)=>{for(let b=d+1;b=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a,]:a.unshift(this.options.customAttribution));const c=a.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,a.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class c9{constructor(){a.bindAll(["_updateLogo"],this),a.bindAll(["_updateCompact"],this)}onAdd(c){this._map=c,this._container=b.create("div","mapboxgl-ctrl");const a=b.create("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(a){a&&"metadata"!==a.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(0===Object.entries(a).length)return!0;for(const c in a){const b=a[c].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const b=a[0];this._map.getCanvasContainer().offsetWidth<250?b.classList.add("mapboxgl-compact"):b.classList.remove("mapboxgl-compact")}}}class da{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(b){const a=++this._id;return this._queue.push({callback:b,id:a,cancelled:!1}),a}remove(c){const a=this._currentlyRunning,d=a?this._queue.concat(a):this._queue;for(const b of d)if(b.id===c)return void(b.cancelled=!0)}run(b=0){const c=this._currentlyRunning=this._queue;for(const a of(this._queue=[],c))if(!a.cancelled&&(a.callback(b),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function db(b,d,c){if(b=new a.LngLat(b.lng,b.lat),d){const f=new a.LngLat(b.lng-360,b.lat),g=new a.LngLat(b.lng+360,b.lat),h=360*Math.ceil(Math.abs(b.lng-c.center.lng)/360),i=c.locationPoint(b).distSqr(d),j=d.x<0||d.y<0||d.x>c.width||d.y>c.height;c.locationPoint(f).distSqr(d)180;){const e=c.locationPoint(b);if(e.x>=0&&e.y>=0&&e.x<=c.width&&e.y<=c.height)break;b.lng>c.center.lng?b.lng-=360:b.lng+=360}return b}const dc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class z extends a.Evented{constructor(c,e){if(super(),(c instanceof a.window.HTMLElement||e)&&(c=a.extend({element:c},e)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=c&&c.anchor||"center",this._color=c&&c.color||"#3FB1CE",this._scale=c&&c.scale||1,this._draggable=c&&c.draggable||!1,this._clickTolerance=c&&c.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=c&&c.rotation||0,this._rotationAlignment=c&&c.rotationAlignment||"auto",this._pitchAlignment=c&&c.pitchAlignment&&"auto"!==c.pitchAlignment?c.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),c&&c.element)this._element=c.element,this._offset=a.pointGeometry.convert(c&&c.offset||[0,0]);else{this._defaultMarker=!0,this._element=b.create("div");const f=41,g=27,d=b.createSVG("svg",{display:"block",height:f*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${f}`},this._element),h=b.createSVG("radialGradient",{id:"shadowGradient"},b.createSVG("defs",{},d));b.createSVG("stop",{offset:"10%","stop-opacity":.4},h),b.createSVG("stop",{offset:"100%","stop-opacity":.05},h),b.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},d),b.createSVG("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},d),b.createSVG("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},d),b.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},d),this._offset=a.pointGeometry.convert(c&&c.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()});const i=this._element.classList;for(const j in dc)i.remove(`mapboxgl-marker-anchor-${j}`);i.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(c){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),c){if(!("offset"in c.options)){const b=38.1,a=13.5,d=Math.sqrt(Math.pow(a,2)/2);c.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-b],"bottom-left":[d,-1*(b-a+d),],"bottom-right":[-d,-1*(b-a+d),],left:[a,-1*(b-a)],right:[-a,-1*(b-a)]}:this._offset}this._popup=c,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(a){const b=a.code,c=a.charCode||a.keyCode;"Space"!==b&&"Enter"!==b&&32!==c&&13!==c||this.togglePopup()}_onMapClick(c){const a=c.originalEvent.target,b=this._element;this._popup&&(a===b||b.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a&&(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):(a.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const a=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(a))return void this._clearFadeTimer();const b=this._map.unproject(a);let c=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const d=this._map.getFreeCameraOptions();if(d.position){const e=d.position.toLngLat();c=e.distanceTo(b)<.9*e.distanceTo(this._lngLat)}}const f=(1-this._map._queryFogOpacity(b))*(c?.2:1);this._element.style.opacity=`${f}`,this._popup&&this._popup._setOpacity(`${f}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(a){const b=this._map.transform;return!!a&&a.x>=0&&a.x=0&&a.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const b=this._map.transform,a=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&a._rotate(b.angle),"map"===this._pitchAlignment&&(a.y*=Math.cos(b._pitch)),a}getOffset(){return this._offset}setOffset(b){return this._offset=a.pointGeometry.convert(b),this._update(),this}_onMove(b){if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=b.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=b.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(a){this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(a){return this._draggable=!!a,this._map&&(a?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&"auto"!==a?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const{HTMLImageElement:dd,HTMLElement:de,ImageBitmap:df}=a.window;function dg(a){a.parentNode&&a.parentNode.removeChild(a)}class dh{constructor(c,b,d=!1){this._clickTolerance=10,this.element=b,this.mouseRotate=new cM({clickTolerance:c.dragRotate._mouseRotate._clickTolerance}),this.map=c,d&&(this.mousePitch=new cN({clickTolerance:c.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),b.addEventListener("mousedown",this.mousedown),b.addEventListener("touchstart",this.touchstart,{passive:!1}),b.addEventListener("touchmove",this.touchmove),b.addEventListener("touchend",this.touchend),b.addEventListener("touchcancel",this.reset)}down(a,c){this.mouseRotate.mousedown(a,c),this.mousePitch&&this.mousePitch.mousedown(a,c),b.disableDrag()}move(d,e){const a=this.map,b=this.mouseRotate.mousemoveWindow(d,e);if(b&&b.bearingDelta&&a.setBearing(a.getBearing()+b.bearingDelta),this.mousePitch){const c=this.mousePitch.mousemoveWindow(d,e);c&&c.pitchDelta&&a.setPitch(a.getPitch()+c.pitchDelta)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){b.enableDrag(),a.window.removeEventListener("mousemove",this.mousemove),a.window.removeEventListener("mouseup",this.mouseup)}mousedown(c){this.down(a.extend({},c,{ctrlKey:!0,preventDefault:()=>c.preventDefault()}),b.mousePos(this.element,c)),a.window.addEventListener("mousemove",this.mousemove),a.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,b.mousePos(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){1!==a.targetTouches.length?this.reset():(this._startPos=this._lastPos=b.touchPos(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){1!==a.targetTouches.length?this.reset():(this._lastPos=b.touchPos(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){0===a.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?dm(d,c,f/5280,a._getUIString("ScaleControl.Miles"),a):dm(d,c,f,a._getUIString("ScaleControl.Feet"),a)}else b&&"nautical"===b.unit?dm(d,c,e/1852,a._getUIString("ScaleControl.NauticalMiles"),a):e>=1e3?dm(d,c,e/1e3,a._getUIString("ScaleControl.Kilometers"),a):dm(d,c,e,a._getUIString("ScaleControl.Meters"),a)}function dm(d,e,a,f,b){const c=function(b){const c=Math.pow(10,`${Math.floor(b)}`.length-1);let a=b/c;return a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(a){const b=Math.pow(10,Math.ceil(-Math.log(a)/Math.LN10));return Math.round(a*b)/b}(a),c*a}(a),g=c/a;b._requestDomTask(()=>{d.style.width=e*g+"px",d.innerHTML=`${c} ${f}`})}const A={version:a.version,supported:l,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends c8{constructor(c){if(null!=(c=a.extend({},{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},c)).minZoom&&null!=c.maxZoom&&c.minZoom>c.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=c.minPitch&&null!=c.maxPitch&&c.minPitch>c.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=c.minPitch&&c.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=c.maxPitch&&c.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new ct(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),c),this._interactive=c.interactive,this._minTileCacheSize=c.minTileCacheSize,this._maxTileCacheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=c.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=c.collectResourceTiming,this._optimizeForTerrain=c.optimizeForTerrain,this._renderTaskQueue=new da,this._domRenderTaskQueue=new da,this._controls=[],this._markers=[],this._mapId=a.uniqueId(),this._locale=a.extend({},{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},c.locale),this._clickTolerance=c.clickTolerance,this._cooperativeGestures=c.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new class{constructor(a){this.jumpTo(a)}getValue(b){if(b<=this._startTime)return this._start;if(b>=this._endTime)return this._end;const c=a.easeCubicInOut((b-this._startTime)/(this._endTime-this._startTime));return this._start*(1-c)+this._end*c}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(b,a,c){this._start=this.getValue(a),this._end=b,this._startTime=a,this._endTime=a+c}}(0),this._requestManager=new a.RequestManager(c.transformRequest,c.accessToken,c.testMode),this._silenceAuthErrors=!!c.testMode,"string"==typeof c.container){if(this._container=a.window.document.getElementById(c.container),!this._container)throw Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof de))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(this._container.childNodes.length>0&&a.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),c.maxBounds&&this.setMaxBounds(c.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==a.window&&(a.window.addEventListener("online",this._onWindowOnline,!1),a.window.addEventListener("resize",this._onWindowResize,!1),a.window.addEventListener("orientationchange",this._onWindowResize,!1),a.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new class{constructor(c,d){this._map=c,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new class{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(b){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:b})}_drainInertiaBuffer(){const b=this._inertiaBuffer,c=a.exported.now();for(;b.length>0&&c-b[0].time>160;)b.shift()}_onMoveEnd(k){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const b={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)b.zoom+=d.zoomDelta||0,b.bearing+=d.bearingDelta||0,b.pitch+=d.pitchDelta||0,d.panDelta&&b.pan._add(d.panDelta),d.around&&(b.around=d.around),d.pinchAround&&(b.pinchAround=d.pinchAround);const e=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(b.pan.mag()){const f=cA(b.pan.mag(),e,a.extend({},cv,k||{}));c.offset=b.pan.mult(f.amount/b.pan.mag()),c.center=this._map.transform.center,cz(c,f)}if(b.zoom){const g=cA(b.zoom,e,cw);c.zoom=this._map.transform.zoom+g.amount,cz(c,g)}if(b.bearing){const h=cA(b.bearing,e,cx);c.bearing=this._map.transform.bearing+a.clamp(h.amount,-179,179),cz(c,h)}if(b.pitch){const i=cA(b.pitch,e,cy);c.pitch=this._map.transform.pitch+i.amount,cz(c,i)}if(c.zoom||c.bearing){const j=void 0===b.pinchAround?b.around:b.pinchAround;c.around=j?this._map.unproject(j):this._map.getCenter()}return this.clear(),a.extend(c,{noMoveStart:!0})}}(c),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new class{constructor(){this.constants=[1,1,.01],this.radius=0}setup(c,d){const b=a.sub([],d,c);this.radius=a.length(b[2]<0?a.div([],b,this.constants):[b[0],b[1],0])}projectRay(c){a.div(c,c,this.constants),a.normalize(c,c),a.mul$1(c,c,this.constants);const b=a.scale$2([],c,this.radius);if(b[2]>0){const e=a.scale$2([],[0,0,1],a.dot(b,[0,0,1])),f=a.scale$2([],a.normalize([],[b[0],b[1],0]),this.radius),d=a.add([],b,a.scale$2([],a.sub([],a.add([],f,e),b),2));b[0]=d[0],b[1]=d[1]}return b}},this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(d),a.bindAll(["handleEvent","handleWindowEvent"],this);const b=this._el;for(const[e,f,g]of(this._listeners=[[b,"touchstart",{passive:!0},],[b,"touchmove",{passive:!1},],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[a.window.document,"mousemove",{capture:!0},],[a.window.document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1},],[b,"keyup",void 0],[b,"wheel",{passive:!1},],[b,"contextmenu",void 0],[a.window,"blur",void 0],],this._listeners))e.addEventListener(f,e===a.window.document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[b,c,d]of this._listeners)b.removeEventListener(c,b===a.window.document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(b){const a=this._map,d=a.getCanvasContainer();this._add("mapEvent",new cE(a,b));const n=a.boxZoom=new cG(a,b);this._add("boxZoom",n);const e=new cJ,f=new c_;a.doubleClickZoom=new c$(f,e),this._add("tapZoom",e),this._add("clickZoom",f);const g=new c0;this._add("tapDragZoom",g);const o=a.touchPitch=new cV(a);this._add("touchPitch",o);const h=new cM(b),i=new cN(b);a.dragRotate=new c2(b,h,i),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",i,["mouseRotate"]);const j=new cL(b),k=new cO(a,b);a.dragPan=new c1(d,j,k),this._add("mousePan",j),this._add("touchPan",k,["touchZoom","touchRotate",]);const l=new cT,m=new cR;a.touchZoomRotate=new c3(d,m,l,g),this._add("touchRotate",l,["touchPan","touchZoom",]),this._add("touchZoom",m,["touchPan","touchRotate",]),this._add("blockableMapEvent",new cF(a));const p=a.scrollZoom=new cZ(a,this);this._add("scrollZoom",p,["mousePan"]);const q=a.keyboard=new cW;for(const c of(this._add("keyboard",q),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))b.interactive&&b[c]&&a[c].enable(b[c])}_add(a,b,c){this._handlers.push({handlerName:a,handler:b,allowed:c}),this._handlersById[a]=b}stop(a){if(!this._updatingCamera){for(const{handler:b}of this._handlers)b.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(c4(this._eventsInProgress))||this.isZooming()}_blockedByActive(c,a,d){for(const b in c)if(b!==d&&(!a||0>a.indexOf(b)))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(c){const a=[];for(const b of c)this._el.contains(b.target)&&a.push(b);return a}handleEvent(a,j){this._updatingCamera=!0;const k="renderFrame"===a.type,l=k?void 0:a,d={needsRenderFrame:!1},m={},e={},g=a.touches?this._getMapTouches(a.touches):void 0,p=g?b.touchPos(this._el,g):k?void 0:b.mousePos(this._el,a);for(const{handlerName:h,handler:c,allowed:q}of this._handlers){if(!c.isEnabled())continue;let f;this._blockedByActive(e,q,h)?c.reset():c[j||a.type]&&(f=c[j||a.type](a,p,g),this.mergeHandlerResult(d,m,f,h,l),f&&f.needsRenderFrame&&this._triggerRenderFrame()),(f||c.isActive())&&(e[h]=c)}const i={};for(const n in this._previousActiveHandlers)e[n]||(i[n]=l);this._previousActiveHandlers=e,(Object.keys(i).length||c6(d))&&(this._changes.push([d,m,i]),this._triggerRenderFrame()),(Object.keys(e).length||c6(d))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:o}=d;o&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],o(this._map))}mergeHandlerResult(e,c,b,f,g){if(!b)return;a.extend(e,b);const d={handlerName:f,originalEvent:b.originalEvent||g};void 0!==b.zoomDelta&&(c.zoom=d),void 0!==b.panDelta&&(c.drag=d),void 0!==b.pitchDelta&&(c.pitch=d),void 0!==b.bearingDelta&&(c.rotate=d)}_applyChanges(){const c={},d={},e={};for(const[b,f,g]of this._changes)b.panDelta&&(c.panDelta=(c.panDelta||new a.pointGeometry(0,0))._add(b.panDelta)),b.zoomDelta&&(c.zoomDelta=(c.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(c.bearingDelta=(c.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(c.pitchDelta=(c.pitchDelta||0)+b.pitchDelta),void 0!==b.around&&(c.around=b.around),void 0!==b.aroundCoord&&(c.aroundCoord=b.aroundCoord),void 0!==b.pinchAround&&(c.pinchAround=b.pinchAround),b.noInertia&&(c.noInertia=b.noInertia),a.extend(d,f),a.extend(e,g);this._updateMapTransform(c,d,e),this._changes=[]}_updateMapTransform(d,f,k){const g=this._map,b=g.transform,l=a=>[a.x,a.y,a.z];if((b=>{const a=this._eventsInProgress.drag;return a&&!this._handlersById[a.handlerName].isActive()})()&&!c6(d)){const t=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",t!==b.zoom&&this._map._update(!0)}if(!c6(d))return this._fireEvents(f,k,!0);let{panDelta:m,zoomDelta:h,bearingDelta:n,pitchDelta:o,around:c,aroundCoord:u,pinchAround:p}=d;void 0!==p&&(c=p),f.drag&&!this._eventsInProgress.drag&&c&&(this._dragOrigin=l(b.pointCoordinate3D(c)),this._trackingEllipsoid.setup(b._camera.position,this._dragOrigin)),b.cameraElevationReference="sea",g._stop(!0),c=c||g.transform.centerPoint,n&&(b.bearing+=n),o&&(b.pitch+=o),b._updateCameraState();const e=[0,0,0];if(m){const i=b.pointCoordinate(c),j=b.pointCoordinate(c.sub(m));i&&j&&(e[0]=j.x-i.x,e[1]=j.y-i.y)}const v=b.zoom,q=[0,0,0];if(h){const r=l(u||b.pointCoordinate3D(c)),s={dir:a.normalize([],a.sub([],r,b._camera.position))};if(s.dir[2]<0){const w=b.zoomDeltaToMovement(r,h);a.scale$2(q,s.dir,w)}}const x=a.add(e,e,q);b._translateCameraConstrained(x),h&&Math.abs(b.zoom-v)>1e-4&&b.recenterOnTerrain(),b.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(f,k,!0)}_fireEvents(b,p,q){const j=c4(this._eventsInProgress),c=c4(b),g={};for(const d in b){const{originalEvent:r}=b[d];this._eventsInProgress[d]||(g[`${d}start`]=r),this._eventsInProgress[d]=b[d]}for(const k in!j&&c&&this._fireEvent("movestart",c.originalEvent),g)this._fireEvent(k,g[k]);for(const l in c&&this._fireEvent("move",c.originalEvent),b){const{originalEvent:s}=b[l];this._fireEvent(l,s)}const h={};let e;for(const i in this._eventsInProgress){const{handlerName:m,originalEvent:t}=this._eventsInProgress[i];this._handlersById[m].isActive()||(delete this._eventsInProgress[i],e=p[m]||t,h[`${i}end`]=e)}for(const n in h)this._fireEvent(n,h[n]);const u=c4(this._eventsInProgress);if(q&&(j||c)&&!u){this._updatingCamera=!0;const f=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),o=a=>0!==a&& -this._bearingSnap{delete this._frameId,this.handleEvent(new c5("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}(this,c),this._localFontFamily=c.localFontFamily,this._localIdeographFontFamily=c.localIdeographFontFamily,c.style&&this.setStyle(c.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),c.projection&&this.setProjection(c.projection),this._hash=c.hash&&new class{constructor(b){this._hashName=b&&encodeURIComponent(b),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=cu(this._updateHashUnthrottled.bind(this),300)}addTo(b){return this._map=b,a.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return a.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(k){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,c=Math.pow(10,Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10)),g=Math.round(f.lng*c)/c,h=Math.round(f.lat*c)/c,i=this._map.getBearing(),e=this._map.getPitch();let b="";if(b+=k?`/${g}/${h}/${d}`:`${d}/${h}/${g}`,(i||e)&&(b+="/"+Math.round(10*i)/10),e&&(b+=`/${Math.round(e)}`),this._hashName){const l=this._hashName;let m=!1;const j=a.window.location.hash.slice(1).split("&").map(a=>{const c=a.split("=")[0];return c===l?(m=!0,`${c}=${b}`):a}).filter(a=>a);return m||j.push(`${l}=${b}`),`#${j.join("&")}`}return`#${b}`}_getCurrentHash(){const b=a.window.location.hash.replace("#","");if(this._hashName){let c;return b.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(c=a)}),(c&&c[1]||"").split("/")}return b.split("/")}_onHashChange(){const a=this._getCurrentHash();if(a.length>=3&&!a.some(a=>isNaN(a))){const b=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:b,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){const b=a.window.location.href.replace(/(#.+)?$/,this.getHashString());a.window.history.replaceState(a.window.history.state,null,b)}}("string"==typeof c.hash&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,a.extend({},c.fitBoundsOptions,{duration:0})))),this.resize(),c.attributionControl&&this.addControl(new y({customAttribution:c.customAttribution})),this._logoControl=new c9,this.addControl(this._logoControl,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",b=>{this._update("style"===b.dataType),this.fire(new a.Event(`${b.dataType}data`,b))}),this.on("dataloading",b=>{this.fire(new a.Event(`${b.dataType}dataloading`,b))})}_getMapId(){return this._mapId}addControl(b,c){if(void 0===c&&(c=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const e=b.onAdd(this);this._controls.push(b);const d=this._controlPositions[c];return -1!==c.indexOf("bottom")?d.insertBefore(e,d.firstChild):d.appendChild(e),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const c=this._controls.indexOf(b);return c> -1&&this._controls.splice(c,1),b.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)> -1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(b){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const c=!this._moving;return c&&this.fire(new a.Event("movestart",b)).fire(new a.Event("move",b)),this.fire(new a.Event("resize",b)),c&&this.fire(new a.Event("moveend",b)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(b){return this.transform.setMaxBounds(a.LngLatBounds.convert(b)),this._update()}setMinZoom(b){if((b=null==b?-2:b)>= -2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b?this.setZoom(b):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=null==b?0:b)<0)throw Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b?this.setPitch(b):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}getProjection(){return this.transform.getProjection()}setProjection(a){return this._lazyInitEmptyStyle(),"string"==typeof a&&(a={name:a}),this._runtimeProjection=a,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(b){return this.transform.locationPoint3D(a.LngLat.convert(b))}unproject(b){return this.transform.pointLocation3D(a.pointGeometry.convert(b))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(a,b,c){if("mouseenter"===a||"mouseover"===a){let h=!1;const d=d=>{const e=b.filter(a=>this.getLayer(a)),f=e.length?this.queryRenderedFeatures(d.point,{layers:e}):[];f.length?h||(h=!0,c.call(this,new cB(a,this,d.originalEvent,{features:f}))):h=!1},e=()=>{h=!1};return{layers:new Set(b),listener:c,delegates:{mousemove:d,mouseout:e}}}if("mouseleave"===a||"mouseout"===a){let i=!1;const f=d=>{const e=b.filter(a=>this.getLayer(a));(e.length?this.queryRenderedFeatures(d.point,{layers:e}):[]).length?i=!0:i&&(i=!1,c.call(this,new cB(a,this,d.originalEvent)))},g=b=>{i&&(i=!1,c.call(this,new cB(a,this,b.originalEvent)))};return{layers:new Set(b),listener:c,delegates:{mousemove:f,mouseout:g}}}return{layers:new Set(b),listener:c,delegates:{[a]:a=>{const d=b.filter(a=>this.getLayer(a)),e=d.length?this.queryRenderedFeatures(a.point,{layers:d}):[];e.length&&(a.features=e,c.call(this,a),delete a.features)}}}}on(a,b,d){if(void 0===d)return super.on(a,b);Array.isArray(b)||(b=[b]);const c=this._createDelegatedListener(a,b,d);for(const e in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(c),c.delegates)this.on(e,c.delegates[e]);return this}once(b,a,c){if(void 0===c)return super.once(b,a);Array.isArray(a)||(a=[a]);const d=this._createDelegatedListener(b,a,c);for(const e in d.delegates)this.once(e,d.delegates[e]);return this}off(b,a,d){if(void 0===d)return super.off(b,a);a=new Set(Array.isArray(a)?a:[a]);const e=(a,b)=>{if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0},c=this._delegatedListeners?this._delegatedListeners[b]:void 0;return c&&(f=>{for(let b=0;b{b?this.fire(new a.ErrorEvent(b)):d&&this._updateDiff(d,c)})}else"object"==typeof b&&this._updateDiff(b,c)}_updateDiff(c,d){try{this.style.setState(c)&&this._update(!0)}catch(b){a.warnOnce(`Unable to perform style diff: ${b.message||b.error||b}. Rebuilding the style from scratch.`),this._updateStyle(c,d)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(a,b){return this._lazyInitEmptyStyle(),this.style.addSource(a,b),this._update(!0)}isSourceLoaded(b){const c=this.style&&this.style._getSourceCaches(b);if(0!==c.length)return c.every(a=>a.loaded());this.fire(new a.ErrorEvent(Error(`There is no source with ID '${b}'`)))}areTilesLoaded(){const a=this.style&&this.style._sourceCaches;for(const d in a){const b=a[d]._tiles;for(const e in b){const c=b[e];if("loaded"!==c.state&&"errored"!==c.state)return!1}}return!0}addSourceType(a,b,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,b,c)}removeSource(a){return this.style.removeSource(a),this._updateTerrain(),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(c,b,{pixelRatio:e=1,sdf:f=!1,stretchX:g,stretchY:h,content:i}={}){if(this._lazyInitEmptyStyle(),b instanceof dd||df&&b instanceof df){const{width:j,height:k,data:l}=a.exported.getImageData(b);this.style.addImage(c,{data:new a.RGBAImage({width:j,height:k},l),pixelRatio:e,stretchX:g,stretchY:h,content:i,sdf:f,version:0})}else{if(void 0===b.width|| void 0===b.height)return this.fire(new a.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:m,height:n,data:o}=b,d=b;this.style.addImage(c,{data:new a.RGBAImage({width:m,height:n},new Uint8Array(o)),pixelRatio:e,stretchX:g,stretchY:h,content:i,sdf:f,version:0,userImage:d}),d.onAdd&&d.onAdd(this,c)}}}updateImage(d,b){const c=this.style.getImage(d);if(!c)return this.fire(new a.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const g=b instanceof dd||df&&b instanceof df?a.exported.getImageData(b):b,{width:e,height:f,data:h}=g;return void 0===e|| void 0===f?this.fire(new a.ErrorEvent(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):e!==c.data.width||f!==c.data.height?this.fire(new a.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(c.data.replace(h,!(b instanceof dd||df&&b instanceof df)),void this.style.updateImage(d,c))}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new a.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(b,c){a.getImage(this._requestManager.transformRequest(b,a.ResourceType.Image),(d,b)=>{c(d,b instanceof dd?a.exported.getImageData(b):b)})}listImages(){return this.style.listImages()}addLayer(a,b){return this._lazyInitEmptyStyle(),this.style.addLayer(a,b),this._update(!0)}moveLayer(a,b){return this.style.moveLayer(a,b),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,b,c){return this.style.setLayerZoomRange(a,b,c),this._update(!0)}setFilter(a,b,c={}){return this.style.setFilter(a,b,c),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,b,c,d={}){return this.style.setPaintProperty(a,b,c,d),this._update(!0)}getPaintProperty(a,b){return this.style.getPaintProperty(a,b)}setLayoutProperty(a,b,c,d={}){return this.style.setLayoutProperty(a,b,c,d),this._update(!0)}getLayoutProperty(a,b){return this.style.getLayoutProperty(a,b)}setLight(a,b={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,b),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(b){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.LngLat.convert(b),this.transform):0}setFeatureState(a,b){return this.style.setFeatureState(a,b),this._update()}removeFeatureState(a,b){return this.style.removeFeatureState(a,b),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}_updateContainerDimensions(){if(!this._container)return;const d=this._container.getBoundingClientRect().width||400,e=this._container.getBoundingClientRect().height||300;let b,c=this._container;for(;c&&!b;){const f=a.window.getComputedStyle(c).transform;f&&"none"!==f&&(b=f.match(/matrix.*\((.+)\)/)[1].split(", ")),c=c.parentElement}b?(this._containerWidth=b[0]&&"0"!==b[0]?Math.abs(d/b[0]):d,this._containerHeight=b[3]&&"0"!==b[3]?Math.abs(e/b[3]):e):(this._containerWidth=d,this._containerHeight=e)}_detectMissingCSS(){"rgb(250, 128, 114)"!==a.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&a.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=b.create("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const c=this._canvasContainer=b.create("div","mapboxgl-canvas-container",a);this._interactive&&c.classList.add("mapboxgl-interactive"),this._canvas=b.create("canvas","mapboxgl-canvas",c),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const d=this._controlContainer=b.create("div","mapboxgl-control-container",a),e=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(a=>{e[a]=b.create("div",`mapboxgl-ctrl-${a}`,d)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,c){const d=a.exported.devicePixelRatio||1;this._canvas.width=d*Math.ceil(b),this._canvas.height=d*Math.ceil(c),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${c}px`}_addMarker(a){this._markers.push(a)}_removeMarker(b){const a=this._markers.indexOf(b);-1!==a&&this._markers.splice(a,1)}_setupPainter(){const c=a.extend({},l.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),b=this._canvas.getContext("webgl",c)||this._canvas.getContext("experimental-webgl",c);b?(a.storeAuthState(b,!0),this.painter=new cg(b,this.transform),this.on("data",a=>{"source"===a.dataType&&this.painter.setTileLoadedFlag(!0)}),a.exported$1.testSupport(b)):this.fire(new a.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:b}))}_contextRestored(b){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:b}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(a){return this.style&&(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(h){let c;const b=this.painter.context.extTimerQuery,d=a.exported.now();this.listens("gpu-timing-frame")&&(c=b.createQueryEXT(),b.beginQueryEXT(b.TIME_ELAPSED_EXT,c));let e=this._updateAverageElevation(d);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._domRenderTaskQueue.run(h),this._removed)return;this._updateProjection();let i=!1;const f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,o=this.transform.pitch,k=a.exported.now();this.style.zoomHistory.update(j,k);const l=new a.EvaluationParameters(j,{now:k,fadeDuration:f,pitch:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=l.crossFadingFactor();1===g&&g===this._crossFadingFactor||(i=!0,this._crossFadingFactor=g),this.style.update(l)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const q=a.exported.now()-d;b.endQueryEXT(b.TIME_ELAPSED_EXT,c),setTimeout(()=>{const d=b.getQueryObjectEXT(c,b.QUERY_RESULT_EXT)/1e6;b.deleteQueryEXT(c),this.fire(new a.Event("gpu-timing-frame",{cpuTime:q,gpuTime:d}))},50)}if(this.listens("gpu-timing-layer")){const r=this.painter.collectGpuTimers();setTimeout(()=>{const b=this.painter.queryGpuTimers(r);this.fire(new a.Event("gpu-timing-layer",{layerTimes:b}))},50)}const m=this._sourcesDirty||this._styleDirty||this._placementDirty||e;if(m||this._repaint)this.triggerRepaint();else{const n=!this.isMoving()&&this.loaded();if(n&&(e=this._updateAverageElevation(d,!0)),e)this.triggerRepaint();else if(this._triggerFrame(!1),n&&(this.fire(new a.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const p=this._calculateSpeedIndex();this.fire(new a.Event("speedindexcompleted",{speedIndex:p})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const a of this._markers)a._update()}_updateAverageElevation(b,e=!1){const c=a=>(this.transform.averageElevation=a,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&c(0);if((e||b-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(b)){const f=this.transform.averageElevation;let a=this.transform.sampleAverageElevation();isNaN(a)?a=0:this._averageElevationLastSampledAt=b;const d=Math.abs(f-a);if(d>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(a),c(a);this._averageElevation.easeTo(a,b,300)}else if(d>1e-4)return this._averageElevation.jumpTo(a),c(a)}return!!this._averageElevation.isEasing(b)&&c(this._averageElevation.getValue(b))}_authenticate(){a.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,c=>{if(c&&(c.message===a.AUTH_ERR_MSG||401===c.status)){const b=this.painter.context.gl;a.storeAuthState(b,!1),this._logoControl instanceof c9&&this._logoControl._updateLogo(),b&&b.clear(b.DEPTH_BUFFER_BIT|b.COLOR_BUFFER_BIT|b.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),a.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const d=this.painter.canvasCopy(),a=this.painter.getCanvasCopiesAndTimestamps();a.timeStamps.push(performance.now());const b=this.painter.context.gl,e=b.createFramebuffer();function c(c){b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,c,0);const a=new Uint8Array(b.drawingBufferWidth*b.drawingBufferHeight*4);return b.readPixels(0,0,b.drawingBufferWidth,b.drawingBufferHeight,b.RGBA,b.UNSIGNED_BYTE,a),a}return b.bindFramebuffer(b.FRAMEBUFFER,e),this._canvasPixelComparison(c(d),a.canvasCopies.map(c),a.timeStamps)}_canvasPixelComparison(b,f,e){let g=e[1]-e[0];const i=b.length/4;for(let c=0;c{const b=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,b&&this._render(a)}))}_preloadTiles(c){const b=this.style&&Object.values(this.style._sourceCaches)||[];return a.asyncAll(b,(a,b)=>a._preloadTiles(c,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(b,c){a.setCacheLimits(b,c)}get version(){return a.version}},NavigationControl:class{constructor(c){this.options=a.extend({},{showCompass:!0,showZoom:!0,visualizePitch:!1},c),this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),b.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),b.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=b.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const a=this._map.getZoom(),b=a===this._map.getMaxZoom(),c=a===this._map.getMinZoom();this._zoomInButton.disabled=b,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",b.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,d){const a=b.create("button",c,this._container);return a.type="button",a.addEventListener("click",d),a}_setButtonTitle(a,c){const b=this._map._getUIString(`NavigationControl.${c}`);a.setAttribute("aria-label",b),a.firstElementChild&&a.firstElementChild.setAttribute("title",b)}},GeolocateControl:class extends a.Evented{constructor(b){super(),this.options=a.extend({},{positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},b),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=cu(this._updateMarkerRotation,20)}onAdd(d){var c;return this._map=d,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),c=this._setupUI,void 0!==di?c(di):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(di="denied"!==a.state)}):c(di=!!a.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,dj=0,dk=!1}_isOutOfMapMaxBounds(c){const a=this._map.getMaxBounds(),b=c.coords;return a&&(b.longitudea.getEast()||b.latitudea.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(b){if(this._map){if(this._isOutOfMapMaxBounds(b))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",b)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=b,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(b),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(b),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",b)),this._finish()}}_updateCamera(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude),d=b.coords.accuracy,e=this._map.getBearing(),f=a.extend({bearing:e},this.options.fitBoundsOptions);this._map.fitBounds(c.toBounds(d),f,{geolocateSource:!0})}_updateMarker(b){if(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=b.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._containerHeight/2,c=this._map.unproject([0,a]),d=this._map.unproject([100,a]),e=c.distanceTo(d)/100,b=Math.ceil(2*this._accuracy/e);this._circleElement.style.width=`${b}px`,this._circleElement.style.height=`${b}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(b){if(this._map){if(this.options.trackUserLocation){if(1===b.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===b.code&&dk)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",b)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=b.create("button","mapboxgl-ctrl-geolocate",this._container),b.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=b.create("div","mapboxgl-user-location"),this._dotElement.appendChild(b.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(b.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new z({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=b.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new z({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",b=>{b.geolocateSource||"ACTIVE_LOCK"!==this._watchState||b.originalEvent&&"resize"===b.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:!0===a.absolute&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":dj--,dk=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&& void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let b;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++dj>1?(b={maximumAge:6e5,timeout:0},dk=!0):(b=this.options.positionOptions,dk=!1),this._geolocationWatchID=a.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else a.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const b=()=>{a.window.addEventListener("ondeviceorientationabsolute"in a.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==a.window.DeviceMotionEvent&&"function"==typeof a.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(a=>{"granted"===a&&b()}).catch(console.error):b()}_clearWatch(){a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),a.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),a.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:y,ScaleControl:class{constructor(b){this.options=a.extend({},{maxWidth:100,unit:"metric"},b),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dl(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,dl(this._map,this._container,this.options)}},FullscreenControl:class{constructor(b){this._fullscreen=!1,b&&b.container&&(b.container instanceof a.window.HTMLElement?this._container=b.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in a.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in a.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=b.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,a.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!a.window.document.fullscreenEnabled&&!a.window.document.webkitFullscreenEnabled)}_setupUI(){const c=this._fullscreenButton=b.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);b.create("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden",!0),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(a.window.document.fullscreenElement||a.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?a.window.document.exitFullscreen?a.window.document.exitFullscreen():a.window.document.webkitCancelFullScreen&&a.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(b){super(),this.options=a.extend(Object.create({closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}),b),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(b&&b.className?b.className.trim().split(/\s+/):[])}addTo(b){return this._map&&this.remove(),this._map=b,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(b){return this.setDOMContent(a.window.document.createTextNode(b))}setHTML(e){const b=a.window.document.createDocumentFragment(),c=a.window.document.createElement("body");let d;for(c.innerHTML=e;d=c.firstChild;)b.appendChild(d);return this.setDOMContent(b)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=b.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._container&&this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._container&&this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(b){let a;return this._classList.delete(b)?a=!1:(this._classList.add(b),a=!0),this._container&&this._updateClassList(),a}_createCloseButton(){this.options.closeButton&&(this._closeButton=b.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const b=this._pos,c=this._container.offsetWidth,d=this._container.offsetHeight;let a;return a=b.y+e.bottom.ythis._map.transform.height-d?["bottom"]:[],b.xthis._map.transform.width-c/2&&a.push("right"),0===a.length?"bottom":a.join("-")}_updateClassList(){const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),this._container.className=a.join(" ")}_update(c){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=b.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=b.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=db(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||c){const e=this._pos=this._trackPointer&&c?c:this._map.project(this._lngLat),d=function(b){if(b||(b=new a.pointGeometry(0,0)),"number"==typeof b){const d=Math.round(Math.sqrt(.5*Math.pow(b,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,b),"top-left":new a.pointGeometry(d,d),"top-right":new a.pointGeometry(-d,d),bottom:new a.pointGeometry(0,-b),"bottom-left":new a.pointGeometry(d,-d),"bottom-right":new a.pointGeometry(-d,-d),left:new a.pointGeometry(b,0),right:new a.pointGeometry(-b,0)}}if(b instanceof a.pointGeometry||Array.isArray(b)){const c=a.pointGeometry.convert(b);return{center:c,top:c,"top-left":c,"top-right":c,bottom:c,"bottom-left":c,"bottom-right":c,left:c,right:c}}return{center:a.pointGeometry.convert(b.center||[0,0,]),top:a.pointGeometry.convert(b.top||[0,0]),"top-left":a.pointGeometry.convert(b["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(b["top-right"]||[0,0]),bottom:a.pointGeometry.convert(b.bottom||[0,0,]),"bottom-left":a.pointGeometry.convert(b["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(b["bottom-right"]||[0,0]),left:a.pointGeometry.convert(b.left||[0,0]),right:a.pointGeometry.convert(b.right||[0,0,])}}(this.options.offset),f=this._anchor=this._getAnchor(d),g=e.add(d[f]).round();this._map._requestDomTask(()=>{this._container&&f&&(this._container.style.transform=`${dc[f]} translate(${g.x}px,${g.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._content&&(this._content.style.opacity=a),this._tip&&(this._tip.style.opacity=a)}},Marker:z,Style:c,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,FreeCameraOptions:x,Evented:a.Evented,config:a.config,prewarm:function(){ao().acquire(am)},clearPrewarmedResources:function(){const a=an;a&&(a.isPreloaded()&&1===a.numActive()?(a.release(am),an=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return a.config.ACCESS_TOKEN},set accessToken(t){a.config.ACCESS_TOKEN=t},get baseApiUrl(){return a.config.API_URL},set baseApiUrl(t){a.config.API_URL=t},get workerCount(){return e.workerCount},set workerCount(e){e.workerCount=e},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){a.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(b){a.clearTileCache(b)},workerUrl:"",workerClass:null,setNow:a.exported.setNow,restoreNow:a.exported.restoreNow};return A}),b})}},]) diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js index ef7469cf893..f0f5e69526e 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[785],{840:function(a,b,c){var d;!function(g,B,Q,l){"use strict";var m,R=["","webkit","Moz","MS","ms","o"],C=B.createElement("div"),S=Math.round,T=Math.abs,U=Date.now;function V(a,b,c){return setTimeout(G(a,c),b)}function W(a,c,b){return!!Array.isArray(a)&&(D(a,b[c],b),!0)}function D(a,c,d){var b;if(a){if(a.forEach)a.forEach(c,d);else if(l!==a.length)for(b=0;b\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=g.console&&(g.console.warn||g.console.log);return b&&b.call(g.console,d,e),c.apply(this,arguments)}}m="function"!=typeof Object.assign?function(b){if(b===l||null===b)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(b),c=1;c -1}function _(a){return a.trim().split(/\s+/g)}function aa(a,d,c){if(a.indexOf&&!c)return a.indexOf(d);for(var b=0;baa(e,f)&&b.push(c[a]),e[a]=f,a++}return g&&(b=d?b.sort(function(a,b){return a[d]>b[d]}):b.sort()),b}function n(e,a){for(var c,d,f=a[0].toUpperCase()+a.slice(1),b=0;b1&&!b.firstMultiple?b.firstMultiple=an(a):1===h&&(b.firstMultiple=!1);var i=b.firstInput,c=b.firstMultiple,j=c?c.center:i.center,k=a.center=ao(e);a.timeStamp=U(),a.deltaTime=a.timeStamp-i.timeStamp,a.angle=as(j,k),a.distance=ar(j,k),al(b,a),a.offsetDirection=aq(a.deltaX,a.deltaY);var d=ap(a.deltaTime,a.deltaX,a.deltaY);a.overallVelocityX=d.x,a.overallVelocityY=d.y,a.overallVelocity=T(d.x)>T(d.y)?d.x:d.y,a.scale=c?au(c.pointers,e):1,a.rotation=c?at(c.pointers,e):0,a.maxPointers=b.prevInput?a.pointers.length>b.prevInput.maxPointers?a.pointers.length:b.prevInput.maxPointers:a.pointers.length,am(b,a);var f=g.element;Z(a.srcEvent.target,f)&&(f=a.srcEvent.target),a.target=f}function al(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function am(h,a){var d,e,f,g,b=h.lastInterval||a,i=a.timeStamp-b.timeStamp;if(8!=a.eventType&&(i>25||l===b.velocity)){var j=a.deltaX-b.deltaX,k=a.deltaY-b.deltaY,c=ap(i,j,k);e=c.x,f=c.y,d=T(c.x)>T(c.y)?c.x:c.y,g=aq(j,k),h.lastInterval=a}else d=b.velocity,e=b.velocityX,f=b.velocityY,g=b.direction;a.velocity=d,a.velocityX=e,a.velocityY=f,a.direction=g}function an(a){for(var c=[],b=0;b=T(b)?a<0?2:4:b<0?8:16}function ar(b,c,a){a||(a=ah);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return Math.sqrt(d*d+e*e)}function as(b,c,a){a||(a=ah);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return 180*Math.atan2(e,d)/Math.PI}function at(a,b){return as(b[1],b[0],ai)+as(a[1],a[0],ai)}function au(a,b){return ar(b[0],b[1],ai)/ar(a[0],a[1],ai)}f.prototype={handler:function(){},init:function(){this.evEl&&H(this.element,this.evEl,this.domHandler),this.evTarget&&H(this.target,this.evTarget,this.domHandler),this.evWin&&H(ae(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&I(this.element,this.evEl,this.domHandler),this.evTarget&&I(this.target,this.evTarget,this.domHandler),this.evWin&&I(ae(this.element),this.evWin,this.domHandler)}};var av={mousedown:1,mousemove:2,mouseup:4};function u(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,f.apply(this,arguments)}e(u,f,{handler:function(a){var b=av[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:L,srcEvent:a}))}});var aw={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ax={2:K,3:"pen",4:L,5:"kinect"},M="pointerdown",N="pointermove pointerup pointercancel";function v(){this.evEl=M,this.evWin=N,f.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}g.MSPointerEvent&&!g.PointerEvent&&(M="MSPointerDown",N="MSPointerMove MSPointerUp MSPointerCancel"),e(v,f,{handler:function(a){var b=this.store,e=!1,d=aw[a.type.toLowerCase().replace("ms","")],f=ax[a.pointerType]||a.pointerType,c=aa(b,a.pointerId,"pointerId");1&d&&(0===a.button||f==K)?c<0&&(b.push(a),c=b.length-1):12&d&&(e=!0),!(c<0)&&(b[c]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),e&&b.splice(c,1))}});var ay={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function w(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,f.apply(this,arguments)}function az(b,d){var a=ab(b.touches),c=ab(b.changedTouches);return 12&d&&(a=ac(a.concat(c),"identifier",!0)),[a,c]}e(w,f,{handler:function(c){var a=ay[c.type];if(1===a&&(this.started=!0),this.started){var b=az.call(this,c,a);12&a&&b[0].length-b[1].length==0&&(this.started=!1),this.callback(this.manager,a,{pointers:b[0],changedPointers:b[1],pointerType:K,srcEvent:c})}}});var aA={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function x(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},f.apply(this,arguments)}function aB(h,g){var b=ab(h.touches),c=this.targetIds;if(3&g&&1===b.length)return c[b[0].identifier]=!0,[b,b];var a,d,e=ab(h.changedTouches),f=[],i=this.target;if(d=b.filter(function(a){return Z(a.target,i)}),1===g)for(a=0;a -1&&d.splice(a,1)},2500)}}function aE(b){for(var d=b.srcEvent.clientX,e=b.srcEvent.clientY,a=0;a -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(d){var c=this,a=this.state;function b(a){c.manager.emit(a,d)}a<8&&b(c.options.event+aM(a)),b(c.options.event),d.additionalEvent&&b(d.additionalEvent),a>=8&&b(c.options.event+aM(a))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ac.threshold&&b&c.direction},attrTest:function(a){return h.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=aN(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),e(p,h,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[aI]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),e(q,i,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[aG]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=V(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=U(),this.manager.emit(this.options.event,this._input)))}}),e(r,h,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[aI]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),e(s,h,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return o.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&T(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=aN(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),e(j,i,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[aH]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var a=1;ac.length)&&(a=c.length);for(var b=0,d=new Array(a);bc?c:a}Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)}),bd=new h(4),h!=Float32Array&&(bd[0]=0,bd[1]=0,bd[2]=0,bd[3]=0);const aG=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function aH(e,f,g){var h=f[0],i=f[1],j=f[2],k=f[3],l=f[4],m=f[5],n=f[6],o=f[7],p=f[8],q=f[9],r=f[10],s=f[11],t=f[12],u=f[13],v=f[14],w=f[15],a=g[0],b=g[1],c=g[2],d=g[3];return e[0]=a*h+b*l+c*p+d*t,e[1]=a*i+b*m+c*q+d*u,e[2]=a*j+b*n+c*r+d*v,e[3]=a*k+b*o+c*s+d*w,a=g[4],b=g[5],c=g[6],d=g[7],e[4]=a*h+b*l+c*p+d*t,e[5]=a*i+b*m+c*q+d*u,e[6]=a*j+b*n+c*r+d*v,e[7]=a*k+b*o+c*s+d*w,a=g[8],b=g[9],c=g[10],d=g[11],e[8]=a*h+b*l+c*p+d*t,e[9]=a*i+b*m+c*q+d*u,e[10]=a*j+b*n+c*r+d*v,e[11]=a*k+b*o+c*s+d*w,a=g[12],b=g[13],c=g[14],d=g[15],e[12]=a*h+b*l+c*p+d*t,e[13]=a*i+b*m+c*q+d*u,e[14]=a*j+b*n+c*r+d*v,e[15]=a*k+b*o+c*s+d*w,e}function aI(b,a,f){var g,h,i,j,k,l,m,n,o,p,q,r,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[0],h=a[1],i=a[2],j=a[3],k=a[4],l=a[5],m=a[6],n=a[7],o=a[8],p=a[9],q=a[10],r=a[11],b[0]=g,b[1]=h,b[2]=i,b[3]=j,b[4]=k,b[5]=l,b[6]=m,b[7]=n,b[8]=o,b[9]=p,b[10]=q,b[11]=r,b[12]=g*c+k*d+o*e+a[12],b[13]=h*c+l*d+p*e+a[13],b[14]=i*c+m*d+q*e+a[14],b[15]=j*c+n*d+r*e+a[15]),b}function aJ(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function aK(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=1e-6*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=1e-6*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=1e-6*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=1e-6*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=1e-6*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=1e-6*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=1e-6*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=1e-6*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=1e-6*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=1e-6*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=1e-6*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=1e-6*Math.max(1,Math.abs(r),Math.abs(H))}function aL(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function aM(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a}function aN(a,b){if(!a)throw new Error(b||"@math.gl/web-mercator: assertion failed.")}be=new h(2),h!=Float32Array&&(be[0]=0,be[1]=0),bf=new h(3),h!=Float32Array&&(bf[0]=0,bf[1]=0,bf[2]=0);const n=Math.PI,aO=n/4,aP=n/180,aQ=180/n;function aR(a){return Math.pow(2,a)}function aS([b,a]){return aN(Number.isFinite(b)),aN(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*aP+n)/(2*n),512*(n+Math.log(Math.tan(aO+.5*(a*aP))))/(2*n)]}function aT([a,b]){return[(a/512*(2*n)-n)*aQ,2*(Math.atan(Math.exp(b/512*(2*n)-n))-aO)*aQ,]}function aU(a){return 2*Math.atan(.5/a)*aQ}function aV(a){return .5/Math.tan(.5*a*aP)}function aW(i,c,j=0){const[a,b,e]=i;if(aN(Number.isFinite(a)&&Number.isFinite(b),"invalid pixel coordinate"),Number.isFinite(e)){const k=aC(c,[a,b,e,1,]);return k}const f=aC(c,[a,b,0,1,]),g=aC(c,[a,b,1,1,]),d=f[2],h=g[2];return aM([],f,g,d===h?0:((j||0)-d)/(h-d))}const aX=Math.PI/180;function aY(a,c,d){const{pixelUnprojectionMatrix:e}=a,b=aC(e,[c,0,1,1,]),f=aC(e,[c,a.height,1,1,]),h=d*a.distanceScales.unitsPerMeter[2],i=(h-b[2])/(f[2]-b[2]),j=aM([],b,f,i),g=aT(j);return g[2]=d,g}class aZ{constructor({width:f,height:c,latitude:l=0,longitude:m=0,zoom:p=0,pitch:n=0,bearing:q=0,altitude:a=null,fovy:b=null,position:o=null,nearZMultiplier:t=.02,farZMultiplier:u=1.01}={width:1,height:1}){f=f||1,c=c||1,null===b&&null===a?b=aU(a=1.5):null===b?b=aU(a):null===a&&(a=aV(b));const r=aR(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){aN(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*aP),e=1.4222222222222223/d,a=12790407194604047e-21/d;if(b.unitsPerMeter=[a,a,a,],b.metersPerUnit=[1/a,1/a,1/a,],b.unitsPerDegree=[1.4222222222222223,e,a,],b.degreesPerUnit=[.703125,1/e,1/a,],j){const f=aP*Math.tan(c*aP)/d,k=1.4222222222222223*f/2,g=12790407194604047e-21*f,h=g/e*a;b.unitsPerDegree2=[0,k,g,],b.unitsPerMeter2=[h,0,h,]}return b}({longitude:m,latitude:l}),d=aS([m,l]);if(d[2]=0,o){var e,g,h,i,j,k;i=d,j=d,k=(e=[],g=o,h=s.unitsPerMeter,e[0]=g[0]*h[0],e[1]=g[1]*h[1],e[2]=g[2]*h[2],e),i[0]=j[0]+k[0],i[1]=j[1]+k[1],i[2]=j[2]+k[2]}this.projectionMatrix=function({width:h,height:i,pitch:j,altitude:k,fovy:l,nearZMultiplier:m,farZMultiplier:n}){var a,f,g,c,b,d,e;const{fov:o,aspect:p,near:q,far:r}=function({width:f,height:g,fovy:a=aU(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=aU(d));const b=.5*a*aP,c=aV(a),e=h*aP;return{fov:2*b,aspect:f/g,focalDistance:c,near:i,far:(Math.sin(e)*(Math.sin(b)*c/Math.sin(Math.min(Math.max(Math.PI/2-e-b,.01),Math.PI-.01)))+c)*j}}({width:h,height:i,altitude:k,fovy:l,pitch:j,nearZMultiplier:m,farZMultiplier:n}),s=(a=[],f=o,g=p,c=q,b=r,e=1/Math.tan(f/2),a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(d=1/(c-b),a[10]=(b+c)*d,a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a);return s}({width:f,height:c,pitch:n,fovy:b,nearZMultiplier:t,farZMultiplier:u}),this.viewMatrix=function({height:F,pitch:G,bearing:H,altitude:I,scale:l,center:E=null}){var a,b,m,f,g,n,o,p,q,r,s,t,u,c,d,v,h,i,w,x,y,z,A,B,C,D,j,k;const e=aB();return aI(e,e,[0,0,-I]),a=e,b=e,m=-G*aP,f=Math.sin(m),g=Math.cos(m),n=b[4],o=b[5],p=b[6],q=b[7],r=b[8],s=b[9],t=b[10],u=b[11],b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=n*g+r*f,a[5]=o*g+s*f,a[6]=p*g+t*f,a[7]=q*g+u*f,a[8]=r*g-n*f,a[9]=s*g-o*f,a[10]=t*g-p*f,a[11]=u*g-q*f,c=e,d=e,v=H*aP,h=Math.sin(v),i=Math.cos(v),w=d[0],x=d[1],y=d[2],z=d[3],A=d[4],B=d[5],C=d[6],D=d[7],d!==c&&(c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15]),c[0]=w*i+A*h,c[1]=x*i+B*h,c[2]=y*i+C*h,c[3]=z*i+D*h,c[4]=A*i-w*h,c[5]=B*i-x*h,c[6]=C*i-y*h,c[7]=D*i-z*h,aJ(e,e,[l/=F,l,l]),E&&aI(e,e,(j=[],k=E,j[0]=-k[0],j[1]=-k[1],j[2]=-k[2],j)),e}({height:c,scale:r,center:d,pitch:n,bearing:q,altitude:a}),this.width=f,this.height=c,this.scale=r,this.latitude=l,this.longitude=m,this.zoom=p,this.pitch=n,this.bearing=q,this.altitude=a,this.fovy=b,this.center=d,this.meterOffset=o||[0,0,0],this.distanceScales=s,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var b,c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,a;const{width:I,height:J,projectionMatrix:K,viewMatrix:L}=this,G=aB();aH(G,G,K),aH(G,G,L),this.viewProjectionMatrix=G;const d=aB();aJ(d,d,[I/2,-J/2,1]),aI(d,d,[1,-1,0]),aH(d,d,G);const H=(b=aB(),e=(c=d)[0],f=c[1],g=c[2],h=c[3],i=c[4],j=c[5],k=c[6],l=c[7],m=c[8],n=c[9],o=c[10],p=c[11],q=c[12],r=c[13],s=c[14],t=c[15],u=e*j-f*i,v=e*k-g*i,w=e*l-h*i,x=f*k-g*j,y=f*l-h*j,z=g*l-h*k,A=m*r-n*q,B=m*s-o*q,C=m*t-p*q,D=n*s-o*r,E=n*t-p*r,F=o*t-p*s,a=u*F-v*E+w*D+x*C-y*B+z*A,a?(a=1/a,b[0]=(j*F-k*E+l*D)*a,b[1]=(g*E-f*F-h*D)*a,b[2]=(r*z-s*y+t*x)*a,b[3]=(o*y-n*z-p*x)*a,b[4]=(k*C-i*F-l*B)*a,b[5]=(e*F-g*C+h*B)*a,b[6]=(s*w-q*z-t*v)*a,b[7]=(m*z-o*w+p*v)*a,b[8]=(i*E-j*C+l*A)*a,b[9]=(f*C-e*E-h*A)*a,b[10]=(q*y-r*w+t*u)*a,b[11]=(n*w-m*y-p*u)*a,b[12]=(j*B-i*D-k*A)*a,b[13]=(e*D-f*B+g*A)*a,b[14]=(r*v-q*x-s*u)*a,b[15]=(m*x-n*v+o*u)*a,b):null);if(!H)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=d,this.pixelUnprojectionMatrix=H}equals(a){return a instanceof aZ&&a.width===this.width&&a.height===this.height&&aK(a.projectionMatrix,this.projectionMatrix)&&aK(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:f=!0}={}){const g=this.projectPosition(a),b=function(d,e){const[a,b,c=0]=d;return aN(Number.isFinite(a)&&Number.isFinite(b)&&Number.isFinite(c)),aC(e,[a,b,c,1])}(g,this.pixelProjectionMatrix),[c,d]=b,e=f?d:this.height-d;return 2===a.length?[c,e]:[c,e,b[2]]}unproject(f,{topLeft:g=!0,targetZ:a}={}){const[h,d,e]=f,i=g?d:this.height-d,j=a&&a*this.distanceScales.unitsPerMeter[2],k=aW([h,i,e],this.pixelUnprojectionMatrix,j),[b,c,l]=this.unprojectPosition(k);return Number.isFinite(e)?[b,c,l]:Number.isFinite(a)?[b,c,a]:[b,c]}projectPosition(a){const[b,c]=aS(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=aT(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return aS(a)}unprojectFlat(a){return aT(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=aW(d,this.pixelUnprojectionMatrix),f=aS(c),g=aL([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=aL([],this.center,g);return aT(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(c,d={}){const{width:a,height:b}=this,{longitude:e,latitude:f,zoom:g}=function({width:m,height:n,bounds:o,minExtent:f=0,maxZoom:p=24,padding:a=0,offset:g=[0,0]}){const[[q,r],[s,t]]=o;if(Number.isFinite(a)){const b=a;a={top:b,bottom:b,left:b,right:b}}else aN(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=aS([q,aF(t,-85.051129,85.051129),]),d=aS([s,aF(r,-85.051129,85.051129),]),h=[Math.max(Math.abs(d[0]-c[0]),f),Math.max(Math.abs(d[1]-c[1]),f),],e=[m-a.left-a.right-2*Math.abs(g[0]),n-a.top-a.bottom-2*Math.abs(g[1]),];aN(e[0]>0&&e[1]>0);const i=e[0]/h[0],j=e[1]/h[1],u=(a.right-a.left)/2/i,v=(a.bottom-a.top)/2/j,w=[(d[0]+c[0])/2+u,(d[1]+c[1])/2+v,],k=aT(w),l=Math.min(p,aG(Math.abs(Math.min(i,j))));return aN(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new aZ({width:a,height:b,longitude:e,latitude:f,zoom:g})}getBounds(b){const a=this.getBoundingRegion(b),c=Math.min(...a.map(a=>a[0])),d=Math.max(...a.map(a=>a[0])),e=Math.min(...a.map(a=>a[1])),f=Math.max(...a.map(a=>a[1]));return[[c,e],[d,f],]}getBoundingRegion(a={}){return function(a,d=0){const{width:e,height:h,unproject:b}=a,c={targetZ:d},i=b([0,h],c),j=b([e,h],c);let f,g;const k=a.fovy?.5*a.fovy*aX:Math.atan(.5/a.altitude),l=(90-a.pitch)*aX;return k>l-.01?(f=aY(a,0,d),g=aY(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]}(this,a.z||0)}}const a$=["longitude","latitude","zoom"],a_={curve:1.414,speed:1.2};function a0(d,h,i){var f,j,k,o,p,q;i=Object.assign({},a_,i);const g=i.curve,l=d.zoom,w=[d.longitude,d.latitude],x=aR(l),y=h.zoom,z=[h.longitude,h.latitude],A=aR(y-l),r=aS(w),B=aS(z),s=(f=[],j=B,k=r,f[0]=j[0]-k[0],f[1]=j[1]-k[1],f),a=Math.max(d.width,d.height),e=a/A,t=(p=(o=s)[0],q=o[1],Math.hypot(p,q)*x),c=Math.max(t,.01),b=g*g,m=(e*e-a*a+b*b*c*c)/(2*a*b*c),n=(e*e-a*a-b*b*c*c)/(2*e*b*c),u=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(n*n+1)-n);return{startZoom:l,startCenterXY:r,uDelta:s,w0:a,u1:t,S:(v-u)/g,rho:g,rho2:b,r0:u,r1:v}}var N=function(){if("undefined"!=typeof Map)return Map;function a(a,c){var b=-1;return a.some(function(a,d){return a[0]===c&&(b=d,!0)}),b}return function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(c){var d=a(this.__entries__,c),b=this.__entries__[d];return b&&b[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(d){var b=this.__entries__,c=a(b,d);~c&&b.splice(c,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(e,a){void 0===a&&(a=null);for(var b=0,c=this.__entries__;b0},a.prototype.connect_=function(){a1&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a4?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},a.prototype.disconnect_=function(){a1&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},a.prototype.onTransitionEnd_=function(b){var a=b.propertyName,c=void 0===a?"":a;a3.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a),this.instance_},a.instance_=null,a}(),a6=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),bj="undefined"!=typeof WeakMap?new WeakMap:new N,O=function(){function a(b){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var c=a5.getInstance(),d=new bi(b,c,this);bj.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=bj.get(this))[a].apply(b,arguments)}});var bk=void 0!==o.ResizeObserver?o.ResizeObserver:O;function bl(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function bm(d,c){for(var b=0;b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function br(a,c){if(a){if("string"==typeof a)return bs(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return bs(a,c)}}function bs(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b1&& void 0!==arguments[1]?arguments[1]:"component";b.debug&&a.checkPropTypes(Q,b,"prop",c)}var i=function(){function a(b){var c=this;if(bl(this,a),g(this,"props",R),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw new Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return bn(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var d=this._map.getContainer(),c=b.container;for(c.classList.add("mapboxgl-map");d.childNodes.length>0;)c.appendChild(d.childNodes[0]);this._map._container=c,a.savedMap=null,b.mapStyle&&this._map.setStyle(bu(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var d=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=d,b.gl}}var c={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:bu(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(c.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},c,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(a){var d=this;a=Object.assign({},R,a),bw(a,"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||R.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var b=a.container;Object.defineProperty(b,"offsetWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"clientWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"offsetHeight",{configurable:!0,get:function(){return d.height}}),Object.defineProperty(b,"clientHeight",{configurable:!0,get:function(){return d.height}});var c=this._map.getCanvas();c&&(c.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(b,a){if(this._map){bw(a=Object.assign({},this.props,a),"Mapbox");var c=this._updateMapViewport(b,a),d=this._updateMapSize(b,a);this._updateMapStyle(b,a),!a.asyncRender&&(c||d)&&this.redraw(),this.props=a}}},{key:"_updateMapStyle",value:function(b,a){b.mapStyle!==a.mapStyle&&this._map.setStyle(bu(a.mapStyle),{diff:!a.preventStyleDiffing})}},{key:"_updateMapSize",value:function(b,a){var c=b.width!==a.width||b.height!==a.height;return c&&(this.width=a.width,this.height=a.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(d,e){var b=this._getViewState(d),a=this._getViewState(e),c=a.latitude!==b.latitude||a.longitude!==b.longitude||a.zoom!==b.zoom||a.pitch!==b.pitch||a.bearing!==b.bearing||a.altitude!==b.altitude;return c&&(this._map.jumpTo(this._viewStateToMapboxProps(a)),a.altitude!==b.altitude&&(this._map.transform.altitude=a.altitude)),c}},{key:"_getViewState",value:function(b){var a=b.viewState||b,f=a.longitude,g=a.latitude,h=a.zoom,c=a.pitch,d=a.bearing,e=a.altitude;return{longitude:f,latitude:g,zoom:h,pitch:void 0===c?0:c,bearing:void 0===d?0:d,altitude:void 0===e?1.5:e}}},{key:"_checkStyleSheet",value:function(){var c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==P)try{var a=P.createElement("div");if(a.className="mapboxgl-map",a.style.display="none",P.body.appendChild(a),!("static"!==window.getComputedStyle(a).position)){var b=P.createElement("link");b.setAttribute("rel","stylesheet"),b.setAttribute("type","text/css"),b.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(c,"/mapbox-gl.css")),P.head.appendChild(b)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude,],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}},]),a}();g(i,"initialized",!1),g(i,"propTypes",Q),g(i,"defaultProps",R),g(i,"savedMap",null);var S=b(6158),A=b.n(S);function bx(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function by(a,b){if(a===b)return!0;if(bx(a)&&bx(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function bz(a,b,c){return Math.max(b,Math.min(c,a))}function bA(a,c,b){return bx(a)?a.map(function(a,d){return bA(a,c[d],b)}):b*c+(1-b)*a}function bB(a,b){if(!a)throw new Error(b||"react-map-gl: assertion failed.")}function bC(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function bD(c){for(var a=1;a0,"`scale` must be a positive number");var f=this._state,b=f.startZoom,c=f.startZoomLngLat;Number.isFinite(b)||(b=this._viewportProps.zoom,c=this._unproject(i)||this._unproject(d)),bB(c,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var g=this._calculateNewZoom({scale:e,startZoom:b||0}),j=new aZ(Object.assign({},this._viewportProps,{zoom:g})),k=j.getMapCenterByLngLatPosition({lngLat:c,pos:d}),h=aA(k,2),l=h[0],m=h[1];return this._getUpdatedMapState({zoom:g,longitude:l,latitude:m})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=bz(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=bz(g,f,e),Object.assign(a,function({width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k=0,bearing:c=0}){(b< -180||b>180)&&(b=aD(b+180,360)-180),(c< -180||c>180)&&(c=aD(c+180,360)-180);const f=aG(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=aT([0,g])[1];if(ai&&(a=i)}}return{width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k,bearing:c}}(a)),a}},{key:"_unproject",value:function(a){var b=new aZ(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new aZ(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var c=a.scale,d=a.startZoom,b=this._viewportProps,e=b.maxZoom,f=b.minZoom;return bz(d+Math.log2(c),f,e)}},{key:"_calculateNewPitchAndBearing",value:function(c){var f=c.deltaScaleX,a=c.deltaScaleY,g=c.startBearing,b=c.startPitch;a=bz(a,-1,1);var e=this._viewportProps,h=e.minPitch,i=e.maxPitch,d=b;return a>0?d=b+a*(i-b):a<0&&(d=b-a*(h-b)),{pitch:d,bearing:g+180*f}}},{key:"_getRotationParams",value:function(c,d){var h=c[0]-d[0],e=c[1]-d[1],i=c[1],a=d[1],f=this._viewportProps,j=f.width,g=f.height,b=0;return e>0?Math.abs(g-a)>5&&(b=e/(a-g)*1.2):e<0&&a>5&&(b=1-i/a),{deltaScaleX:h/j,deltaScaleY:b=Math.min(1,Math.max(-1,b))}}},]),a}();function bG(a){return a[0].toLowerCase()+a.slice(1)}function bH(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function bI(c){for(var a=1;a1&& void 0!==arguments[1]?arguments[1]:{},b=a.current&&a.current.getMap();return b&&b.queryRenderedFeatures(c,d)}}},[]);var p=(0,c.useCallback)(function(b){var a=b.target;a===o.current&&a.scrollTo(0,0)},[]),q=d&&c.createElement(bJ,{value:bO(bO({},b),{},{viewport:b.viewport||bQ(bO({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:bR,onScroll:p},a.children)),r=a.className,s=a.width,t=a.height,u=a.style,v=a.visibilityConstraints,w=Object.assign({position:"relative"},u,{width:s,height:t}),x=a.visible&&function(c){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:B;for(var a in b){var d=a.slice(0,3),e=bG(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},bR,{visibility:x?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:h,style:w},c.createElement("div",{key:"map-mapbox",ref:n,style:y,className:r}),q,!l&&!a.disableTokenWarning&&c.createElement(bS,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bT(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(a.s();!(b=a.n()).done;){var c=b.value;if(!by(d[c],e[c]))return!1}}catch(f){a.e(f)}finally{a.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){bB(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}},]),a}();function bU(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function bV(a,b){return(bV=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function bW(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),Object.defineProperty(b,"prototype",{writable:!1}),a&&bV(b,a)}function bX(a){return(bX="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function bY(b,a){if(a&&("object"===bX(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return bU(b)}function bZ(a){return(bZ=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var b$={longitude:1,bearing:1};function b_(a){return Number.isFinite(a)||Array.isArray(a)}function b0(b,c,a){return b in b$&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function b1(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=b2(a))||c&&a&&"number"==typeof a.length){e&&(a=e);var d=0,b=function(){};return{s:b,n:function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function b2(a,c){if(a){if("string"==typeof a)return b3(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return b3(a,c)}}function b3(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function b9(a,c){if(a){if("string"==typeof a)return ca(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return ca(a,c)}}function ca(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b0&& void 0!==arguments[0]?arguments[0]:{};return bl(this,d),g(bU(a=e.call(this)),"propNames",b4),a.props=Object.assign({},b7,b),a}bn(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=b1(b5);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];bB(b_(g)&&b_(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=b0(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=b1(b6);try{for(d.s();!(l=d.n()).done;){var b=l.value,m=h[b]||0,o=i[b]||0;e[b]=m,f[b]=b0(b,m,o)}}catch(p){d.e(p)}finally{d.f()}return{start:e,end:f}}},{key:"interpolateProps",value:function(c,d,e){var f,g=function(h,i,j,p={}){var c,d,e,k;const a={},{startZoom:q,startCenterXY:r,uDelta:s,w0:t,u1:l,S:u,rho:m,rho2:v,r0:b}=a0(h,i,p);if(l<.01){for(const f of a$){const w=h[f],x=i[f];a[f]=aE(w,x,j)}return a}const n=j*u,y=q+(k=1/(Math.cosh(b)/Math.cosh(b+m*n)),aG(k)),g=(c=[],d=s,e=t*((Math.cosh(b)*Math.tanh(b+m*n)-Math.sinh(b))/v)/l,c[0]=d[0]*e,c[1]=d[1]*e,c);aL(g,g,r);const o=aT(g);return a.longitude=o[0],a.latitude=o[1],a.zoom=y,a}(c,d,e,this.props),a=b1(b6);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=bA(c[b],d[b],e)}}catch(h){a.e(h)}finally{a.f()}return g}},{key:"getDuration",value:function(c,b){var a=b.transitionDuration;return"auto"===a&&(a=function(f,g,a={}){a=Object.assign({},a_,a);const{screenSpeed:c,speed:h,maxDuration:d}=a,{S:i,rho:j}=a0(f,g,a),e=1e3*i;let b;return b=Number.isFinite(c)?e/(c/j):e/h,Number.isFinite(d)&&b>d?0:b}(c,b,this.props)),a}},])}(C);var cb=["longitude","latitude","zoom","bearing","pitch",],D=function(b){bW(a,b);var c,d,e=(c=a,d=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bZ(c);if(d){var e=bZ(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return bY(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return bl(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||cb,b.around&&(c.around=b.around),c}return bn(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new aZ(g).unproject(this.around);Object.assign(e,c,{around:new aZ(c).project(h),aroundLngLat:h})}var i,b=b8(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];bB(b_(f)&&b_(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=b0(a,f,j)}}catch(k){b.e(k)}finally{b.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(e,a,f){var g,b={},c=b8(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=bA(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var j=new aZ(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:bA(e.around,a.around,f)}),h=aA(j,2),k=h[0],l=h[1];b.longitude=k,b.latitude=l}return b}},]),a}(C),r=function(){},E={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},V={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new D,transitionInterruption:E.BREAK,onTransitionStart:r,onTransitionInterrupt:r,onTransitionEnd:r},F=function(){function a(){var c=this,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};bl(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){c._animationFrame=requestAnimationFrame(c._onTransitionFrame),c._updateViewport()}),this.props=null,this.onViewportChange=b.onViewportChange||r,this.onStateChange=b.onStateChange||r,this.time=b.getTime||Date.now}return bn(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(c){var a=this.props;if(this.props=c,!a||this._shouldIgnoreViewportChange(a,c))return!1;if(this._isTransitionEnabled(c)){var d=Object.assign({},a),b=Object.assign({},c);if(this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this.state.interruption===E.SNAP_TO_END?Object.assign(d,this.state.endProps):Object.assign(d,this.state.propsInTransition),this.state.interruption===E.UPDATE)){var f,g,h,e=this.time(),i=(e-this.state.startTime)/this.state.duration;b.transitionDuration=this.state.duration-(e-this.state.startTime),b.transitionEasing=(h=(f=this.state.easing)(g=i),function(a){return 1/(1-h)*(f(a*(1-g)+g)-h)}),b.transitionInterpolator=d.transitionInterpolator}return b.onTransitionStart(),this._triggerTransition(d,b),!0}return this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(b,a){return!b||(this._isTransitionInProgress()?this.state.interruption===E.IGNORE||this._isUpdateDueToCurrentTransition(a):!this._isTransitionEnabled(a)||a.transitionInterpolator.arePropsEqual(b,a))}},{key:"_triggerTransition",value:function(b,a){bB(this._isTransitionEnabled(a)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=a.transitionInterpolator,d=c.getDuration?c.getDuration(b,a):a.transitionDuration;if(0!==d){var e=a.transitionInterpolator.initializeProps(b,a),f={inTransition:!0,isZooming:b.zoom!==a.zoom,isPanning:b.longitude!==a.longitude||b.latitude!==a.latitude,isRotating:b.bearing!==a.bearing||b.pitch!==a.pitch};this.state={duration:d,easing:a.transitionEasing,interpolator:a.transitionInterpolator,interruption:a.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var d=this.time(),a=this.state,e=a.startTime,f=a.duration,g=a.easing,h=a.interpolator,i=a.startProps,j=a.endProps,c=!1,b=(d-e)/f;b>=1&&(b=1,c=!0),b=g(b);var k=h.interpolateProps(i,j,b),l=new bF(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}},]),a}();g(F,"defaultProps",V);var W=b(840),k=b.n(W);const cc={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&&!function(b,c){for(let a=0;ab.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(k().PointerEventInput),k().MouseInput.prototype.handler=function(a){let b=cc[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const cd=k().Manager;var e=k();const ce=e?[[e.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[e.Rotate,{enable:!1},],[e.Pinch,{enable:!1},],[e.Swipe,{enable:!1},],[e.Pan,{threshold:0,enable:!1},],[e.Press,{enable:!1},],[e.Tap,{event:"doubletap",taps:2,enable:!1},],[e.Tap,{event:"anytap",enable:!1},],[e.Tap,{enable:!1},],]:null,cf={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},cg={doubletap:["tap"]},ch={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},s={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},ci={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},cj={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},X="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",G="undefined"!=typeof window?window:b.g;void 0!==b.g?b.g:window;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(ck){}const cl=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:cm}=s,cn="wheel";class co{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=cm.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent,!!Y&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cn&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(cl&&b.deltaMode===G.WheelEvent.DOM_DELTA_PIXEL&&(a/=G.devicePixelRatio),b.deltaMode===G.WheelEvent.DOM_DELTA_LINE&&(a*=40));const c={x:b.clientX,y:b.clientY};0!==a&&a%4.000244140625==0&&(a=Math.floor(a/4.000244140625)),b.shiftKey&&a&&(a*=.25),this._onWheel(b,-a,c)}_onWheel(a,b,c){this.callback({type:cn,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:cp}=s,cq="pointermove",cr="pointerover",cs="pointerout",ct="pointerleave";class cu{constructor(b,c,a={}){this.element=b,this.callback=c,this.pressed=!1,this.options=Object.assign({enable:!0},a),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=cp.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cq&&(this.enableMoveEvent=b),a===cr&&(this.enableOverEvent=b),a===cs&&(this.enableOutEvent=b),a===ct&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:cr,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:cs,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:ct,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:cq,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:cv}=s,cw="keydown",cx="keyup";class cy{constructor(a,c,b={}){this.element=a,this.callback=c,this.options=Object.assign({enable:!0},b),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=cv.concat(b.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=b.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cw&&(this.enableDownEvent=b),a===cx&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:cw,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:cx,srcEvent:a,key:a.key,target:a.target}))}}const cz="contextmenu";class cA{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===cz&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:cz,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const cB={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},cC={srcElement:"root",priority:0};class cD{constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(f,g,a,h=!1,i=!1){const{handlers:j,handlersByElement:e}=this;a&&("object"!=typeof a||a.addEventListener)&&(a={srcElement:a}),a=a?Object.assign({},cC,a):cC;let b=e.get(a.srcElement);b||(b=[],e.set(a.srcElement,b));const c={type:f,handler:g,srcElement:a.srcElement,priority:a.priority};h&&(c.once=!0),i&&(c.passive=!0),j.push(c),this._active=this._active||!c.passive;let d=b.length-1;for(;d>=0&&!(b[d].priority>=c.priority);)d--;b.splice(d+1,0,c)}remove(f,g){const{handlers:b,handlersByElement:e}=this;for(let c=b.length-1;c>=0;c--){const a=b[c];if(a.type===f&&a.handler===g){b.splice(c,1);const d=e.get(a.srcElement);d.splice(d.indexOf(a),1),0===d.length&&e.delete(a.srcElement)}}this._active=b.some(a=>!a.passive)}handleEvent(c){if(this.isEmpty())return;const b=this._normalizeEvent(c);let a=c.srcEvent.target;for(;a&&a!==b.rootElement;){if(this._emit(b,a),b.handled)return;a=a.parentNode}this._emit(b,"root")}_emit(e,f){const a=this.handlersByElement.get(f);if(a){let g=!1;const h=()=>{e.handled=!0},i=()=>{e.handled=!0,g=!0},c=[];for(let b=0;b{const b=this.manager.get(a);b&&cf[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[h,c]of(this.wheelInput=new co(a,this._onOtherEvent,{enable:!1}),this.moveInput=new cu(a,this._onOtherEvent,{enable:!1}),this.keyInput=new cy(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new cA(a,this._onOtherEvent,{enable:!1}),this.events))c.isEmpty()||(this._toggleRecognizer(c.recognizerName,!0),this.manager.on(h,c.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:d}=this;if(!d)return;const c=d.get(a);if(c&&c.options.enable!==b){c.set({enable:b});const e=cg[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=d.get(e);b?(f.requireFailure(a),c.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(b,e,d,f,g){if("string"!=typeof b){for(const h in d=e,b)this._addEventHandler(h,b[h],d,f,g);return}const{manager:i,events:j}=this,c=cj[b]||b;let a=j.get(c);!a&&(a=new cD(this),j.set(c,a),a.recognizerName=ci[c]||c,i&&i.on(c,a.handleEvent)),a.add(b,e,d,f,g),a.isEmpty()||this._toggleRecognizer(a.recognizerName,!0)}_removeEventHandler(a,h){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,i=cj[a]||a,b=d.get(i);if(b&&(b.remove(a,h),b.isEmpty())){const{recognizerName:e}=b;let f=!1;for(const g of d.values())if(g.recognizerName===e&&!g.isEmpty()){f=!0;break}f||this._toggleRecognizer(e,!1)}}_onBasicInput(a){const{srcEvent:c}=a,b=ch[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function cF(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function cG(c){for(var a=1;a0),e=d&&!this.state.isHovering,h=!d&&this.state.isHovering;(c||e)&&(a.features=b,c&&c(a)),e&&cP.call(this,"onMouseEnter",a),h&&cP.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function cT(b){var c=this.props,d=c.onClick,f=c.onNativeClick,g=c.onDblClick,h=c.doubleClickZoom,a=[],e=g||h;switch(b.type){case"anyclick":a.push(f),e||a.push(d);break;case"click":e&&a.push(d)}(a=a.filter(Boolean)).length&&((b=cN.call(this,b)).features=cO.call(this,b.point),a.forEach(function(a){return a(b)}))}var m=(0,c.forwardRef)(function(b,h){var i,t,f=(0,c.useContext)(bK),u=(0,c.useMemo)(function(){return b.controller||new Z},[]),v=(0,c.useMemo)(function(){return new cE(null,{touchAction:b.touchAction,recognizerOptions:b.eventRecognizerOptions})},[]),g=(0,c.useRef)(null),e=(0,c.useRef)(null),a=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;a.props=b,a.map=e.current&&e.current.getMap(),a.setState=function(c){a.state=cM(cM({},a.state),c),g.current.style.cursor=b.getCursor(a.state)};var j=!0,k=function(b,c,d){if(j){i=[b,c,d,];return}var e=a.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(b,"position",{get:function(){return[0,0,bM(a.map,b),]}}),f&&f({viewState:b,interactionState:c,oldViewState:d}),g&&g(b,c,d)};(0,c.useImperativeHandle)(h,function(){var a;return{getMap:(a=e).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var d=(0,c.useMemo)(function(){return cM(cM({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||bQ(a),a.viewport=d.viewport;var w=function(b){var c=b.isDragging,d=void 0!==c&&c;if(d!==a.state.isDragging&&a.setState({isDragging:d}),j){t=b;return}var e=a.props.onInteractionStateChange;e&&e(b)},l=function(){a.width&&a.height&&u.setOptions(cM(cM(cM({},a.props),a.props.viewState),{},{isInteractive:Boolean(a.props.onViewStateChange||a.props.onViewportChange),onViewportChange:k,onStateChange:w,eventManager:v,width:a.width,height:a.height}))},m=function(b){var c=b.width,d=b.height;a.width=c,a.height=d,l(),a.props.onResize({width:c,height:d})};(0,c.useEffect)(function(){return v.setElement(g.current),v.on({pointerdown:cQ.bind(a),pointermove:cS.bind(a),pointerup:cR.bind(a),pointerleave:cP.bind(a,"onMouseOut"),click:cT.bind(a),anyclick:cT.bind(a),dblclick:cP.bind(a,"onDblClick"),wheel:cP.bind(a,"onWheel"),contextmenu:cP.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),bL(function(){if(i){var a;k.apply(void 0,function(a){if(Array.isArray(a))return ax(a)}(a=i)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||ay(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}t&&w(t)}),l();var n=b.width,o=b.height,p=b.style,r=b.getCursor,s=(0,c.useMemo)(function(){return cM(cM({position:"relative"},p),{},{width:n,height:o,cursor:r(a.state)})},[p,n,o,r,a.state]);return i&&a._child||(a._child=c.createElement(bJ,{value:d},c.createElement("div",{key:"event-canvas",ref:g,style:s},c.createElement(q,aw({},b,{width:"100%",height:"100%",style:null,onResize:m,ref:e}))))),j=!1,a._child});m.supported=q.supported,m.propTypes=$,m.defaultProps=_;var cU=m;function cV(b,a){if(b===a)return!0;if(!b||!a)return!1;if(Array.isArray(b)){if(!Array.isArray(a)||b.length!==a.length)return!1;for(var c=0;c prop: ".concat(e))}}(d,a,f.current):d=function(a,c,d){if(a.style&&a.style._loaded){var b=function(c){for(var a=1;a=0||(d[a]=c[a]);return d}(a,d);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(a,b)&&(e[b]=a[b])}return e}(d,["layout","paint","filter","minzoom","maxzoom","beforeId",]);if(p!==a.beforeId&&b.moveLayer(c,p),e!==a.layout){var q=a.layout||{};for(var g in e)cV(e[g],q[g])||b.setLayoutProperty(c,g,e[g]);for(var r in q)e.hasOwnProperty(r)||b.setLayoutProperty(c,r,void 0)}if(f!==a.paint){var s=a.paint||{};for(var h in f)cV(f[h],s[h])||b.setPaintProperty(c,h,f[h]);for(var t in s)f.hasOwnProperty(t)||b.setPaintProperty(c,t,void 0)}for(var i in cV(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)cV(j[i],a[i])||b.setLayerProperty(c,i,j[i])}(c,d,a,b)}catch(e){console.warn(e)}}(a,d,b,e.current):function(a,d,b){if(a.style&&a.style._loaded){var c=cZ(cZ({},b),{},{id:d});delete c.beforeId,a.addLayer(c,b.beforeId)}}(a,d,b),e.current=b,null}).propTypes=ab;var f={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},d={captureScroll:a.bool,captureDrag:a.bool,captureClick:a.bool,captureDoubleClick:a.bool,capturePointerMove:a.bool};function c_(){var d=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},a=(0,c.useContext)(bK),e=(0,c.useRef)(null),f=(0,c.useRef)({props:d,state:{},context:a,containerRef:e}),b=f.current;return b.props=d,b.context=a,(0,c.useEffect)(function(){return function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(c){var b=a.props;b.captureScroll&&c.stopPropagation(),b.onScroll&&b.onScroll(c,a)},panstart:function(c){var b=a.props;b.captureDrag&&c.stopPropagation(),b.onDragStart&&b.onDragStart(c,a)},anyclick:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onNativeClick&&b.onNativeClick(c,a)},click:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onClick&&b.onClick(c,a)},dblclick:function(c){var b=a.props;b.captureDoubleClick&&c.stopPropagation(),b.onDoubleClick&&b.onDoubleClick(c,a)},pointermove:function(c){var b=a.props;b.capturePointerMove&&c.stopPropagation(),b.onPointerMove&&b.onPointerMove(c,a)}};return c.watch(d,b),function(){c.off(d)}}}(b)},[a.eventManager]),b}function c0(b){var a=b.instance,c=c_(b),d=c.context,e=c.containerRef;return a._context=d,a._containerRef=e,a._render()}var H=function(b){bW(a,b);var d,e,f=(d=a,e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bZ(d);if(e){var c=bZ(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return bY(this,a)});function a(){var b;bl(this,a);for(var e=arguments.length,h=new Array(e),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var c="x"===d?a.offsetWidth:a.offsetHeight;return c7(b/100*c)/c*100};function c9(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}var ae=Object.assign({},ac,{className:a.string,longitude:a.number.isRequired,latitude:a.number.isRequired,style:a.object}),af=Object.assign({},ad,{className:""});function t(b){var d,j,e,k,f,l,m,a,h=(d=b,e=(j=aA((0,c.useState)(null),2))[0],k=j[1],f=aA((0,c.useState)(null),2),l=f[0],m=f[1],a=c_(c2(c2({},d),{},{onDragStart:c5})),a.callbacks=d,a.state.dragPos=e,a.state.setDragPos=k,a.state.dragOffset=l,a.state.setDragOffset=m,(0,c.useEffect)(function(){return function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return function(b,a){var h=a.props,c=a.callbacks,d=a.state,i=a.context;b.stopPropagation();var e=c3(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=c4(e,f,h,i),c.onDrag(g)}}(b,a)},panend:function(b){return function(c,a){var h=a.props,d=a.callbacks,b=a.state,i=a.context;c.stopPropagation();var e=b.dragPos,f=b.dragOffset;if(b.setDragPos(null),b.setDragOffset(null),d.onDragEnd&&e&&f){var g=Object.assign({},c);g.lngLat=c4(e,f,h,i),d.onDragEnd(g)}}(b,a)},pancancel:function(d){var c,b;return c=d,b=a.state,void(c.stopPropagation(),b.setDragPos(null),b.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}}(a)},[a.context.eventManager,Boolean(e)]),a),o=h.state,p=h.containerRef,q=b.children,r=b.className,s=b.draggable,A=b.style,t=o.dragPos,u=function(b){var a=b.props,e=b.state,f=b.context,g=a.longitude,h=a.latitude,j=a.offsetLeft,k=a.offsetTop,c=e.dragPos,d=e.dragOffset,l=f.viewport,m=f.map;if(c&&d)return[c[0]+d[0],c[1]+d[1],];var n=bM(m,{longitude:g,latitude:h}),o=l.project([g,h,n,]),i=aA(o,2),p=i[0],q=i[1];return[p+=j,q+=k]}(h),n=aA(u,2),v=n[0],w=n[1],x="translate(".concat(c7(v),"px, ").concat(c7(w),"px)"),y=s?t?"grabbing":"grab":"auto",z=(0,c.useMemo)(function(){var a=function(c){for(var a=1;a0){var t=b,u=e;for(b=0;b<=1;b+=.5)k=(i=n-b*h)+h,e=Math.max(0,d-i)+Math.max(0,k-p+d),e0){var w=a,x=f;for(a=0;a<=1;a+=v)l=(j=m-a*g)+g,f=Math.max(0,d-j)+Math.max(0,l-o+d),f1||h< -1||f<0||f>p.width||g<0||g>p.height?i.display="none":i.zIndex=Math.floor((1-h)/2*1e5)),i),S=(0,c.useCallback)(function(b){t.props.onClose();var a=t.context.eventManager;a&&a.once("click",function(a){return a.stopPropagation()},b.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(L," ").concat(N),style:R,ref:u},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:O}}),c.createElement("div",{key:"content",ref:j,className:"mapboxgl-popup-content"},P&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:S},"\xd7"),Q))}function db(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}u.propTypes=ag,u.defaultProps=ah,c.memo(u);var ai=Object.assign({},d,{toggleLabel:a.string,className:a.string,style:a.object,compact:a.bool,customAttribution:a.oneOfType([a.string,a.arrayOf(a.string),])}),aj=Object.assign({},f,{className:"",toggleLabel:"Toggle Attribution"});function v(a){var b=c_(a),d=b.context,i=b.containerRef,j=(0,c.useRef)(null),e=aA((0,c.useState)(!1),2),f=e[0],m=e[1];(0,c.useEffect)(function(){var h,e,c,f,g,b;return d.map&&(h=(e={customAttribution:a.customAttribution},c=d.map,f=i.current,g=j.current,(b=new(A()).AttributionControl(e))._map=c,b._container=f,b._innerContainer=g,b._updateAttributions(),b._updateEditLink(),c.on("styledata",b._updateData),c.on("sourcedata",b._updateData),b)),function(){var a;return h&&void((a=h)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[d.map]);var h=void 0===a.compact?d.viewport.width<=640:a.compact;(0,c.useEffect)(function(){!h&&f&&m(!1)},[h]);var k=(0,c.useCallback)(function(){return m(function(a){return!a})},[]),l=(0,c.useMemo)(function(){return function(c){for(var a=1;ac)return 1}return 0}(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),f=b.viewport.bearing,d={transform:"rotate(".concat(-f,"deg)")},2===e?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:d}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:d})))))}function dj(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}y.propTypes=ao,y.defaultProps=ap,c.memo(y);var aq=Object.assign({},d,{className:a.string,style:a.object,maxWidth:a.number,unit:a.oneOf(["imperial","metric","nautical"])}),ar=Object.assign({},f,{className:"",maxWidth:100,unit:"metric"});function z(a){var d=c_(a),f=d.context,h=d.containerRef,e=aA((0,c.useState)(null),2),b=e[0],j=e[1];(0,c.useEffect)(function(){if(f.map){var a=new(A()).ScaleControl;a._map=f.map,a._container=h.current,j(a)}},[f.map]),b&&(b.options=a,b._onMove());var i=(0,c.useMemo)(function(){return function(c){for(var a=1;a\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=g.console&&(g.console.warn||g.console.log);return b&&b.call(g.console,d,e),c.apply(this,arguments)}}m="function"!=typeof Object.assign?function(b){if(b===l||null===b)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(b),c=1;c -1}function _(a){return a.trim().split(/\s+/g)}function aa(a,d,c){if(a.indexOf&&!c)return a.indexOf(d);for(var b=0;baa(e,f)&&b.push(c[a]),e[a]=f,a++}return g&&(b=d?b.sort(function(a,b){return a[d]>b[d]}):b.sort()),b}function n(e,a){for(var c,d,f=a[0].toUpperCase()+a.slice(1),b=0;b1&&!b.firstMultiple?b.firstMultiple=an(a):1===h&&(b.firstMultiple=!1);var i=b.firstInput,c=b.firstMultiple,j=c?c.center:i.center,k=a.center=ao(e);a.timeStamp=U(),a.deltaTime=a.timeStamp-i.timeStamp,a.angle=as(j,k),a.distance=ar(j,k),al(b,a),a.offsetDirection=aq(a.deltaX,a.deltaY);var d=ap(a.deltaTime,a.deltaX,a.deltaY);a.overallVelocityX=d.x,a.overallVelocityY=d.y,a.overallVelocity=T(d.x)>T(d.y)?d.x:d.y,a.scale=c?au(c.pointers,e):1,a.rotation=c?at(c.pointers,e):0,a.maxPointers=b.prevInput?a.pointers.length>b.prevInput.maxPointers?a.pointers.length:b.prevInput.maxPointers:a.pointers.length,am(b,a);var f=g.element;Z(a.srcEvent.target,f)&&(f=a.srcEvent.target),a.target=f}function al(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function am(h,a){var d,e,f,g,b=h.lastInterval||a,i=a.timeStamp-b.timeStamp;if(8!=a.eventType&&(i>25||l===b.velocity)){var j=a.deltaX-b.deltaX,k=a.deltaY-b.deltaY,c=ap(i,j,k);e=c.x,f=c.y,d=T(c.x)>T(c.y)?c.x:c.y,g=aq(j,k),h.lastInterval=a}else d=b.velocity,e=b.velocityX,f=b.velocityY,g=b.direction;a.velocity=d,a.velocityX=e,a.velocityY=f,a.direction=g}function an(a){for(var c=[],b=0;b=T(b)?a<0?2:4:b<0?8:16}function ar(b,c,a){a||(a=ah);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return Math.sqrt(d*d+e*e)}function as(b,c,a){a||(a=ah);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return 180*Math.atan2(e,d)/Math.PI}function at(a,b){return as(b[1],b[0],ai)+as(a[1],a[0],ai)}function au(a,b){return ar(b[0],b[1],ai)/ar(a[0],a[1],ai)}f.prototype={handler:function(){},init:function(){this.evEl&&H(this.element,this.evEl,this.domHandler),this.evTarget&&H(this.target,this.evTarget,this.domHandler),this.evWin&&H(ae(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&I(this.element,this.evEl,this.domHandler),this.evTarget&&I(this.target,this.evTarget,this.domHandler),this.evWin&&I(ae(this.element),this.evWin,this.domHandler)}};var av={mousedown:1,mousemove:2,mouseup:4};function u(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,f.apply(this,arguments)}e(u,f,{handler:function(a){var b=av[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:L,srcEvent:a}))}});var aw={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ax={2:K,3:"pen",4:L,5:"kinect"},M="pointerdown",N="pointermove pointerup pointercancel";function v(){this.evEl=M,this.evWin=N,f.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}g.MSPointerEvent&&!g.PointerEvent&&(M="MSPointerDown",N="MSPointerMove MSPointerUp MSPointerCancel"),e(v,f,{handler:function(a){var b=this.store,e=!1,d=aw[a.type.toLowerCase().replace("ms","")],f=ax[a.pointerType]||a.pointerType,c=aa(b,a.pointerId,"pointerId");1&d&&(0===a.button||f==K)?c<0&&(b.push(a),c=b.length-1):12&d&&(e=!0),!(c<0)&&(b[c]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),e&&b.splice(c,1))}});var ay={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function w(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,f.apply(this,arguments)}function az(b,d){var a=ab(b.touches),c=ab(b.changedTouches);return 12&d&&(a=ac(a.concat(c),"identifier",!0)),[a,c]}e(w,f,{handler:function(c){var a=ay[c.type];if(1===a&&(this.started=!0),this.started){var b=az.call(this,c,a);12&a&&b[0].length-b[1].length==0&&(this.started=!1),this.callback(this.manager,a,{pointers:b[0],changedPointers:b[1],pointerType:K,srcEvent:c})}}});var aA={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function x(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},f.apply(this,arguments)}function aB(h,g){var b=ab(h.touches),c=this.targetIds;if(3&g&&1===b.length)return c[b[0].identifier]=!0,[b,b];var a,d,e=ab(h.changedTouches),f=[],i=this.target;if(d=b.filter(function(a){return Z(a.target,i)}),1===g)for(a=0;a -1&&d.splice(a,1)},2500)}}function aE(b){for(var d=b.srcEvent.clientX,e=b.srcEvent.clientY,a=0;a -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(d){var c=this,a=this.state;function b(a){c.manager.emit(a,d)}a<8&&b(c.options.event+aM(a)),b(c.options.event),d.additionalEvent&&b(d.additionalEvent),a>=8&&b(c.options.event+aM(a))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ac.threshold&&b&c.direction},attrTest:function(a){return h.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=aN(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),e(p,h,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[aI]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),e(q,i,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[aG]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=V(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=U(),this.manager.emit(this.options.event,this._input)))}}),e(r,h,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[aI]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),e(s,h,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return o.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&T(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=aN(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),e(j,i,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[aH]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var a=1;ac.length)&&(a=c.length);for(var b=0,d=Array(a);bc?c:a}Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)}),bd=new h(4),h!=Float32Array&&(bd[0]=0,bd[1]=0,bd[2]=0,bd[3]=0);const aG=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function aH(e,f,g){var h=f[0],i=f[1],j=f[2],k=f[3],l=f[4],m=f[5],n=f[6],o=f[7],p=f[8],q=f[9],r=f[10],s=f[11],t=f[12],u=f[13],v=f[14],w=f[15],a=g[0],b=g[1],c=g[2],d=g[3];return e[0]=a*h+b*l+c*p+d*t,e[1]=a*i+b*m+c*q+d*u,e[2]=a*j+b*n+c*r+d*v,e[3]=a*k+b*o+c*s+d*w,a=g[4],b=g[5],c=g[6],d=g[7],e[4]=a*h+b*l+c*p+d*t,e[5]=a*i+b*m+c*q+d*u,e[6]=a*j+b*n+c*r+d*v,e[7]=a*k+b*o+c*s+d*w,a=g[8],b=g[9],c=g[10],d=g[11],e[8]=a*h+b*l+c*p+d*t,e[9]=a*i+b*m+c*q+d*u,e[10]=a*j+b*n+c*r+d*v,e[11]=a*k+b*o+c*s+d*w,a=g[12],b=g[13],c=g[14],d=g[15],e[12]=a*h+b*l+c*p+d*t,e[13]=a*i+b*m+c*q+d*u,e[14]=a*j+b*n+c*r+d*v,e[15]=a*k+b*o+c*s+d*w,e}function aI(b,a,f){var g,h,i,j,k,l,m,n,o,p,q,r,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[0],h=a[1],i=a[2],j=a[3],k=a[4],l=a[5],m=a[6],n=a[7],o=a[8],p=a[9],q=a[10],r=a[11],b[0]=g,b[1]=h,b[2]=i,b[3]=j,b[4]=k,b[5]=l,b[6]=m,b[7]=n,b[8]=o,b[9]=p,b[10]=q,b[11]=r,b[12]=g*c+k*d+o*e+a[12],b[13]=h*c+l*d+p*e+a[13],b[14]=i*c+m*d+q*e+a[14],b[15]=j*c+n*d+r*e+a[15]),b}function aJ(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function aK(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=1e-6*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=1e-6*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=1e-6*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=1e-6*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=1e-6*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=1e-6*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=1e-6*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=1e-6*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=1e-6*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=1e-6*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=1e-6*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=1e-6*Math.max(1,Math.abs(r),Math.abs(H))}function aL(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function aM(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a}function aN(a,b){if(!a)throw Error(b||"@math.gl/web-mercator: assertion failed.")}be=new h(2),h!=Float32Array&&(be[0]=0,be[1]=0),bf=new h(3),h!=Float32Array&&(bf[0]=0,bf[1]=0,bf[2]=0);const n=Math.PI,aO=n/4,aP=n/180,aQ=180/n;function aR(a){return Math.pow(2,a)}function aS([b,a]){return aN(Number.isFinite(b)),aN(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*aP+n)/(2*n),512*(n+Math.log(Math.tan(aO+.5*(a*aP))))/(2*n)]}function aT([a,b]){return[(a/512*(2*n)-n)*aQ,2*(Math.atan(Math.exp(b/512*(2*n)-n))-aO)*aQ,]}function aU(a){return 2*Math.atan(.5/a)*aQ}function aV(a){return .5/Math.tan(.5*a*aP)}function aW(i,c,j=0){const[a,b,e]=i;if(aN(Number.isFinite(a)&&Number.isFinite(b),"invalid pixel coordinate"),Number.isFinite(e)){const k=aC(c,[a,b,e,1,]);return k}const f=aC(c,[a,b,0,1,]),g=aC(c,[a,b,1,1,]),d=f[2],h=g[2];return aM([],f,g,d===h?0:((j||0)-d)/(h-d))}const aX=Math.PI/180;function aY(a,c,d){const{pixelUnprojectionMatrix:e}=a,b=aC(e,[c,0,1,1,]),f=aC(e,[c,a.height,1,1,]),h=d*a.distanceScales.unitsPerMeter[2],i=(h-b[2])/(f[2]-b[2]),j=aM([],b,f,i),g=aT(j);return g[2]=d,g}class aZ{constructor({width:f,height:c,latitude:l=0,longitude:m=0,zoom:p=0,pitch:n=0,bearing:q=0,altitude:a=null,fovy:b=null,position:o=null,nearZMultiplier:t=.02,farZMultiplier:u=1.01}={width:1,height:1}){f=f||1,c=c||1,null===b&&null===a?b=aU(a=1.5):null===b?b=aU(a):null===a&&(a=aV(b));const r=aR(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){aN(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*aP),e=1.4222222222222223/d,a=12790407194604047e-21/d;if(b.unitsPerMeter=[a,a,a,],b.metersPerUnit=[1/a,1/a,1/a,],b.unitsPerDegree=[1.4222222222222223,e,a,],b.degreesPerUnit=[.703125,1/e,1/a,],j){const f=aP*Math.tan(c*aP)/d,k=1.4222222222222223*f/2,g=12790407194604047e-21*f,h=g/e*a;b.unitsPerDegree2=[0,k,g,],b.unitsPerMeter2=[h,0,h,]}return b}({longitude:m,latitude:l}),d=aS([m,l]);if(d[2]=0,o){var e,g,h,i,j,k;i=d,j=d,k=(e=[],g=o,h=s.unitsPerMeter,e[0]=g[0]*h[0],e[1]=g[1]*h[1],e[2]=g[2]*h[2],e),i[0]=j[0]+k[0],i[1]=j[1]+k[1],i[2]=j[2]+k[2]}this.projectionMatrix=function({width:h,height:i,pitch:j,altitude:k,fovy:l,nearZMultiplier:m,farZMultiplier:n}){var a,f,g,c,b,d,e;const{fov:o,aspect:p,near:q,far:r}=function({width:f,height:g,fovy:a=aU(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=aU(d));const b=.5*a*aP,c=aV(a),e=h*aP;return{fov:2*b,aspect:f/g,focalDistance:c,near:i,far:(Math.sin(e)*(Math.sin(b)*c/Math.sin(Math.min(Math.max(Math.PI/2-e-b,.01),Math.PI-.01)))+c)*j}}({width:h,height:i,altitude:k,fovy:l,pitch:j,nearZMultiplier:m,farZMultiplier:n}),s=(a=[],f=o,g=p,c=q,b=r,e=1/Math.tan(f/2),a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(d=1/(c-b),a[10]=(b+c)*d,a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a);return s}({width:f,height:c,pitch:n,fovy:b,nearZMultiplier:t,farZMultiplier:u}),this.viewMatrix=function({height:F,pitch:G,bearing:H,altitude:I,scale:l,center:E=null}){var a,b,m,f,g,n,o,p,q,r,s,t,u,c,d,v,h,i,w,x,y,z,A,B,C,D,j,k;const e=aB();return aI(e,e,[0,0,-I]),a=e,b=e,m=-G*aP,f=Math.sin(m),g=Math.cos(m),n=b[4],o=b[5],p=b[6],q=b[7],r=b[8],s=b[9],t=b[10],u=b[11],b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=n*g+r*f,a[5]=o*g+s*f,a[6]=p*g+t*f,a[7]=q*g+u*f,a[8]=r*g-n*f,a[9]=s*g-o*f,a[10]=t*g-p*f,a[11]=u*g-q*f,c=e,d=e,v=H*aP,h=Math.sin(v),i=Math.cos(v),w=d[0],x=d[1],y=d[2],z=d[3],A=d[4],B=d[5],C=d[6],D=d[7],d!==c&&(c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15]),c[0]=w*i+A*h,c[1]=x*i+B*h,c[2]=y*i+C*h,c[3]=z*i+D*h,c[4]=A*i-w*h,c[5]=B*i-x*h,c[6]=C*i-y*h,c[7]=D*i-z*h,aJ(e,e,[l/=F,l,l]),E&&aI(e,e,(j=[],k=E,j[0]=-k[0],j[1]=-k[1],j[2]=-k[2],j)),e}({height:c,scale:r,center:d,pitch:n,bearing:q,altitude:a}),this.width=f,this.height=c,this.scale=r,this.latitude=l,this.longitude=m,this.zoom=p,this.pitch=n,this.bearing=q,this.altitude=a,this.fovy=b,this.center=d,this.meterOffset=o||[0,0,0],this.distanceScales=s,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var b,c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,a;const{width:I,height:J,projectionMatrix:K,viewMatrix:L}=this,G=aB();aH(G,G,K),aH(G,G,L),this.viewProjectionMatrix=G;const d=aB();aJ(d,d,[I/2,-J/2,1]),aI(d,d,[1,-1,0]),aH(d,d,G);const H=(b=aB(),e=(c=d)[0],f=c[1],g=c[2],h=c[3],i=c[4],j=c[5],k=c[6],l=c[7],m=c[8],n=c[9],o=c[10],p=c[11],q=c[12],r=c[13],s=c[14],t=c[15],u=e*j-f*i,v=e*k-g*i,w=e*l-h*i,x=f*k-g*j,y=f*l-h*j,z=g*l-h*k,A=m*r-n*q,B=m*s-o*q,C=m*t-p*q,D=n*s-o*r,E=n*t-p*r,F=o*t-p*s,a=u*F-v*E+w*D+x*C-y*B+z*A,a?(a=1/a,b[0]=(j*F-k*E+l*D)*a,b[1]=(g*E-f*F-h*D)*a,b[2]=(r*z-s*y+t*x)*a,b[3]=(o*y-n*z-p*x)*a,b[4]=(k*C-i*F-l*B)*a,b[5]=(e*F-g*C+h*B)*a,b[6]=(s*w-q*z-t*v)*a,b[7]=(m*z-o*w+p*v)*a,b[8]=(i*E-j*C+l*A)*a,b[9]=(f*C-e*E-h*A)*a,b[10]=(q*y-r*w+t*u)*a,b[11]=(n*w-m*y-p*u)*a,b[12]=(j*B-i*D-k*A)*a,b[13]=(e*D-f*B+g*A)*a,b[14]=(r*v-q*x-s*u)*a,b[15]=(m*x-n*v+o*u)*a,b):null);if(!H)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=d,this.pixelUnprojectionMatrix=H}equals(a){return a instanceof aZ&&a.width===this.width&&a.height===this.height&&aK(a.projectionMatrix,this.projectionMatrix)&&aK(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:f=!0}={}){const g=this.projectPosition(a),b=function(d,e){const[a,b,c=0]=d;return aN(Number.isFinite(a)&&Number.isFinite(b)&&Number.isFinite(c)),aC(e,[a,b,c,1])}(g,this.pixelProjectionMatrix),[c,d]=b,e=f?d:this.height-d;return 2===a.length?[c,e]:[c,e,b[2]]}unproject(f,{topLeft:g=!0,targetZ:a}={}){const[h,d,e]=f,i=g?d:this.height-d,j=a&&a*this.distanceScales.unitsPerMeter[2],k=aW([h,i,e],this.pixelUnprojectionMatrix,j),[b,c,l]=this.unprojectPosition(k);return Number.isFinite(e)?[b,c,l]:Number.isFinite(a)?[b,c,a]:[b,c]}projectPosition(a){const[b,c]=aS(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=aT(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return aS(a)}unprojectFlat(a){return aT(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=aW(d,this.pixelUnprojectionMatrix),f=aS(c),g=aL([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=aL([],this.center,g);return aT(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(c,d={}){const{width:a,height:b}=this,{longitude:e,latitude:f,zoom:g}=function({width:m,height:n,bounds:o,minExtent:f=0,maxZoom:p=24,padding:a=0,offset:g=[0,0]}){const[[q,r],[s,t]]=o;if(Number.isFinite(a)){const b=a;a={top:b,bottom:b,left:b,right:b}}else aN(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=aS([q,aF(t,-85.051129,85.051129),]),d=aS([s,aF(r,-85.051129,85.051129),]),h=[Math.max(Math.abs(d[0]-c[0]),f),Math.max(Math.abs(d[1]-c[1]),f),],e=[m-a.left-a.right-2*Math.abs(g[0]),n-a.top-a.bottom-2*Math.abs(g[1]),];aN(e[0]>0&&e[1]>0);const i=e[0]/h[0],j=e[1]/h[1],u=(a.right-a.left)/2/i,v=(a.bottom-a.top)/2/j,w=[(d[0]+c[0])/2+u,(d[1]+c[1])/2+v,],k=aT(w),l=Math.min(p,aG(Math.abs(Math.min(i,j))));return aN(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new aZ({width:a,height:b,longitude:e,latitude:f,zoom:g})}getBounds(b){const a=this.getBoundingRegion(b),c=Math.min(...a.map(a=>a[0])),d=Math.max(...a.map(a=>a[0])),e=Math.min(...a.map(a=>a[1])),f=Math.max(...a.map(a=>a[1]));return[[c,e],[d,f],]}getBoundingRegion(a={}){return function(a,d=0){const{width:e,height:h,unproject:b}=a,c={targetZ:d},i=b([0,h],c),j=b([e,h],c);let f,g;const k=a.fovy?.5*a.fovy*aX:Math.atan(.5/a.altitude),l=(90-a.pitch)*aX;return k>l-.01?(f=aY(a,0,d),g=aY(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]}(this,a.z||0)}}const a$=["longitude","latitude","zoom"],a_={curve:1.414,speed:1.2};function a0(d,h,i){var f,j,k,o,p,q;i=Object.assign({},a_,i);const g=i.curve,l=d.zoom,w=[d.longitude,d.latitude],x=aR(l),y=h.zoom,z=[h.longitude,h.latitude],A=aR(y-l),r=aS(w),B=aS(z),s=(f=[],j=B,k=r,f[0]=j[0]-k[0],f[1]=j[1]-k[1],f),a=Math.max(d.width,d.height),e=a/A,t=(p=(o=s)[0],q=o[1],Math.hypot(p,q)*x),c=Math.max(t,.01),b=g*g,m=(e*e-a*a+b*b*c*c)/(2*a*b*c),n=(e*e-a*a-b*b*c*c)/(2*e*b*c),u=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(n*n+1)-n);return{startZoom:l,startCenterXY:r,uDelta:s,w0:a,u1:t,S:(v-u)/g,rho:g,rho2:b,r0:u,r1:v}}var N=function(){if("undefined"!=typeof Map)return Map;function a(a,c){var b=-1;return a.some(function(a,d){return a[0]===c&&(b=d,!0)}),b}return function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(c){var d=a(this.__entries__,c),b=this.__entries__[d];return b&&b[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(d){var b=this.__entries__,c=a(b,d);~c&&b.splice(c,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(e,a){void 0===a&&(a=null);for(var b=0,c=this.__entries__;b0},a.prototype.connect_=function(){a1&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a4?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},a.prototype.disconnect_=function(){a1&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},a.prototype.onTransitionEnd_=function(b){var a=b.propertyName,c=void 0===a?"":a;a3.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a),this.instance_},a.instance_=null,a}(),a6=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),bj="undefined"!=typeof WeakMap?new WeakMap:new N,O=function(){function a(b){if(!(this instanceof a))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var c=a5.getInstance(),d=new bi(b,c,this);bj.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=bj.get(this))[a].apply(b,arguments)}});var bk=void 0!==o.ResizeObserver?o.ResizeObserver:O;function bl(a,b){if(!(a instanceof b))throw TypeError("Cannot call a class as a function")}function bm(d,c){for(var b=0;b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function br(a,c){if(a){if("string"==typeof a)return bs(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return bs(a,c)}}function bs(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=Array(a);b1&& void 0!==arguments[1]?arguments[1]:"component";b.debug&&a.checkPropTypes(Q,b,"prop",c)}var i=function(){function a(b){var c=this;if(bl(this,a),g(this,"props",R),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return bn(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var d=this._map.getContainer(),c=b.container;for(c.classList.add("mapboxgl-map");d.childNodes.length>0;)c.appendChild(d.childNodes[0]);this._map._container=c,a.savedMap=null,b.mapStyle&&this._map.setStyle(bu(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var d=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=d,b.gl}}var c={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:bu(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(c.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},c,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(a){var d=this;a=Object.assign({},R,a),bw(a,"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||R.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var b=a.container;Object.defineProperty(b,"offsetWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"clientWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"offsetHeight",{configurable:!0,get:function(){return d.height}}),Object.defineProperty(b,"clientHeight",{configurable:!0,get:function(){return d.height}});var c=this._map.getCanvas();c&&(c.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(b,a){if(this._map){bw(a=Object.assign({},this.props,a),"Mapbox");var c=this._updateMapViewport(b,a),d=this._updateMapSize(b,a);this._updateMapStyle(b,a),!a.asyncRender&&(c||d)&&this.redraw(),this.props=a}}},{key:"_updateMapStyle",value:function(b,a){b.mapStyle!==a.mapStyle&&this._map.setStyle(bu(a.mapStyle),{diff:!a.preventStyleDiffing})}},{key:"_updateMapSize",value:function(b,a){var c=b.width!==a.width||b.height!==a.height;return c&&(this.width=a.width,this.height=a.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(d,e){var b=this._getViewState(d),a=this._getViewState(e),c=a.latitude!==b.latitude||a.longitude!==b.longitude||a.zoom!==b.zoom||a.pitch!==b.pitch||a.bearing!==b.bearing||a.altitude!==b.altitude;return c&&(this._map.jumpTo(this._viewStateToMapboxProps(a)),a.altitude!==b.altitude&&(this._map.transform.altitude=a.altitude)),c}},{key:"_getViewState",value:function(b){var a=b.viewState||b,f=a.longitude,g=a.latitude,h=a.zoom,c=a.pitch,d=a.bearing,e=a.altitude;return{longitude:f,latitude:g,zoom:h,pitch:void 0===c?0:c,bearing:void 0===d?0:d,altitude:void 0===e?1.5:e}}},{key:"_checkStyleSheet",value:function(){var c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==P)try{var a=P.createElement("div");if(a.className="mapboxgl-map",a.style.display="none",P.body.appendChild(a),!("static"!==window.getComputedStyle(a).position)){var b=P.createElement("link");b.setAttribute("rel","stylesheet"),b.setAttribute("type","text/css"),b.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(c,"/mapbox-gl.css")),P.head.appendChild(b)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude,],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}},]),a}();g(i,"initialized",!1),g(i,"propTypes",Q),g(i,"defaultProps",R),g(i,"savedMap",null);var S=b(6158),A=b.n(S);function bx(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function by(a,b){if(a===b)return!0;if(bx(a)&&bx(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function bz(a,b,c){return Math.max(b,Math.min(c,a))}function bA(a,c,b){return bx(a)?a.map(function(a,d){return bA(a,c[d],b)}):b*c+(1-b)*a}function bB(a,b){if(!a)throw Error(b||"react-map-gl: assertion failed.")}function bC(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function bD(c){for(var a=1;a0,"`scale` must be a positive number");var f=this._state,b=f.startZoom,c=f.startZoomLngLat;Number.isFinite(b)||(b=this._viewportProps.zoom,c=this._unproject(i)||this._unproject(d)),bB(c,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var g=this._calculateNewZoom({scale:e,startZoom:b||0}),j=new aZ(Object.assign({},this._viewportProps,{zoom:g})),k=j.getMapCenterByLngLatPosition({lngLat:c,pos:d}),h=aA(k,2),l=h[0],m=h[1];return this._getUpdatedMapState({zoom:g,longitude:l,latitude:m})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=bz(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=bz(g,f,e),Object.assign(a,function({width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k=0,bearing:c=0}){(b< -180||b>180)&&(b=aD(b+180,360)-180),(c< -180||c>180)&&(c=aD(c+180,360)-180);const f=aG(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=aT([0,g])[1];if(ai&&(a=i)}}return{width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k,bearing:c}}(a)),a}},{key:"_unproject",value:function(a){var b=new aZ(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new aZ(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var c=a.scale,d=a.startZoom,b=this._viewportProps,e=b.maxZoom,f=b.minZoom;return bz(d+Math.log2(c),f,e)}},{key:"_calculateNewPitchAndBearing",value:function(c){var f=c.deltaScaleX,a=c.deltaScaleY,g=c.startBearing,b=c.startPitch;a=bz(a,-1,1);var e=this._viewportProps,h=e.minPitch,i=e.maxPitch,d=b;return a>0?d=b+a*(i-b):a<0&&(d=b-a*(h-b)),{pitch:d,bearing:g+180*f}}},{key:"_getRotationParams",value:function(c,d){var h=c[0]-d[0],e=c[1]-d[1],i=c[1],a=d[1],f=this._viewportProps,j=f.width,g=f.height,b=0;return e>0?Math.abs(g-a)>5&&(b=e/(a-g)*1.2):e<0&&a>5&&(b=1-i/a),{deltaScaleX:h/j,deltaScaleY:b=Math.min(1,Math.max(-1,b))}}},]),a}();function bG(a){return a[0].toLowerCase()+a.slice(1)}function bH(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function bI(c){for(var a=1;a1&& void 0!==arguments[1]?arguments[1]:{},b=a.current&&a.current.getMap();return b&&b.queryRenderedFeatures(c,d)}}},[]);var p=(0,c.useCallback)(function(b){var a=b.target;a===o.current&&a.scrollTo(0,0)},[]),q=d&&c.createElement(bJ,{value:bO(bO({},b),{},{viewport:b.viewport||bQ(bO({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:bR,onScroll:p},a.children)),r=a.className,s=a.width,t=a.height,u=a.style,v=a.visibilityConstraints,w=Object.assign({position:"relative"},u,{width:s,height:t}),x=a.visible&&function(c){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:B;for(var a in b){var d=a.slice(0,3),e=bG(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},bR,{visibility:x?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:h,style:w},c.createElement("div",{key:"map-mapbox",ref:n,style:y,className:r}),q,!l&&!a.disableTokenWarning&&c.createElement(bS,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bT(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(a.s();!(b=a.n()).done;){var c=b.value;if(!by(d[c],e[c]))return!1}}catch(f){a.e(f)}finally{a.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){bB(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}},]),a}();function bU(a){if(void 0===a)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function bV(a,b){return(bV=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function bW(b,a){if("function"!=typeof a&&null!==a)throw TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),Object.defineProperty(b,"prototype",{writable:!1}),a&&bV(b,a)}function bX(a){return(bX="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function bY(b,a){if(a&&("object"===bX(a)||"function"==typeof a))return a;if(void 0!==a)throw TypeError("Derived constructors may only return object or undefined");return bU(b)}function bZ(a){return(bZ=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var b$={longitude:1,bearing:1};function b_(a){return Number.isFinite(a)||Array.isArray(a)}function b0(b,c,a){return b in b$&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function b1(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=b2(a))||c&&a&&"number"==typeof a.length){e&&(a=e);var d=0,b=function(){};return{s:b,n:function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function b2(a,c){if(a){if("string"==typeof a)return b3(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return b3(a,c)}}function b3(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function b9(a,c){if(a){if("string"==typeof a)return ca(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return ca(a,c)}}function ca(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=Array(a);b0&& void 0!==arguments[0]?arguments[0]:{};return bl(this,d),g(bU(a=e.call(this)),"propNames",b4),a.props=Object.assign({},b7,b),a}bn(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=b1(b5);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];bB(b_(g)&&b_(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=b0(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=b1(b6);try{for(d.s();!(l=d.n()).done;){var b=l.value,m=h[b]||0,o=i[b]||0;e[b]=m,f[b]=b0(b,m,o)}}catch(p){d.e(p)}finally{d.f()}return{start:e,end:f}}},{key:"interpolateProps",value:function(c,d,e){var f,g=function(h,i,j,p={}){var c,d,e,k;const a={},{startZoom:q,startCenterXY:r,uDelta:s,w0:t,u1:l,S:u,rho:m,rho2:v,r0:b}=a0(h,i,p);if(l<.01){for(const f of a$){const w=h[f],x=i[f];a[f]=aE(w,x,j)}return a}const n=j*u,y=q+(k=1/(Math.cosh(b)/Math.cosh(b+m*n)),aG(k)),g=(c=[],d=s,e=t*((Math.cosh(b)*Math.tanh(b+m*n)-Math.sinh(b))/v)/l,c[0]=d[0]*e,c[1]=d[1]*e,c);aL(g,g,r);const o=aT(g);return a.longitude=o[0],a.latitude=o[1],a.zoom=y,a}(c,d,e,this.props),a=b1(b6);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=bA(c[b],d[b],e)}}catch(h){a.e(h)}finally{a.f()}return g}},{key:"getDuration",value:function(c,b){var a=b.transitionDuration;return"auto"===a&&(a=function(f,g,a={}){a=Object.assign({},a_,a);const{screenSpeed:c,speed:h,maxDuration:d}=a,{S:i,rho:j}=a0(f,g,a),e=1e3*i;let b;return b=Number.isFinite(c)?e/(c/j):e/h,Number.isFinite(d)&&b>d?0:b}(c,b,this.props)),a}},])}(C);var cb=["longitude","latitude","zoom","bearing","pitch",],D=function(b){bW(a,b);var c,d,e=(c=a,d=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bZ(c);if(d){var e=bZ(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return bY(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return bl(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||cb,b.around&&(c.around=b.around),c}return bn(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new aZ(g).unproject(this.around);Object.assign(e,c,{around:new aZ(c).project(h),aroundLngLat:h})}var i,b=b8(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];bB(b_(f)&&b_(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=b0(a,f,j)}}catch(k){b.e(k)}finally{b.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(e,a,f){var g,b={},c=b8(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=bA(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var j=new aZ(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:bA(e.around,a.around,f)}),h=aA(j,2),k=h[0],l=h[1];b.longitude=k,b.latitude=l}return b}},]),a}(C),r=function(){},E={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},V={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new D,transitionInterruption:E.BREAK,onTransitionStart:r,onTransitionInterrupt:r,onTransitionEnd:r},F=function(){function a(){var c=this,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};bl(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){c._animationFrame=requestAnimationFrame(c._onTransitionFrame),c._updateViewport()}),this.props=null,this.onViewportChange=b.onViewportChange||r,this.onStateChange=b.onStateChange||r,this.time=b.getTime||Date.now}return bn(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(c){var a=this.props;if(this.props=c,!a||this._shouldIgnoreViewportChange(a,c))return!1;if(this._isTransitionEnabled(c)){var d=Object.assign({},a),b=Object.assign({},c);if(this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this.state.interruption===E.SNAP_TO_END?Object.assign(d,this.state.endProps):Object.assign(d,this.state.propsInTransition),this.state.interruption===E.UPDATE)){var f,g,h,e=this.time(),i=(e-this.state.startTime)/this.state.duration;b.transitionDuration=this.state.duration-(e-this.state.startTime),b.transitionEasing=(h=(f=this.state.easing)(g=i),function(a){return 1/(1-h)*(f(a*(1-g)+g)-h)}),b.transitionInterpolator=d.transitionInterpolator}return b.onTransitionStart(),this._triggerTransition(d,b),!0}return this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(b,a){return!b||(this._isTransitionInProgress()?this.state.interruption===E.IGNORE||this._isUpdateDueToCurrentTransition(a):!this._isTransitionEnabled(a)||a.transitionInterpolator.arePropsEqual(b,a))}},{key:"_triggerTransition",value:function(b,a){bB(this._isTransitionEnabled(a)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=a.transitionInterpolator,d=c.getDuration?c.getDuration(b,a):a.transitionDuration;if(0!==d){var e=a.transitionInterpolator.initializeProps(b,a),f={inTransition:!0,isZooming:b.zoom!==a.zoom,isPanning:b.longitude!==a.longitude||b.latitude!==a.latitude,isRotating:b.bearing!==a.bearing||b.pitch!==a.pitch};this.state={duration:d,easing:a.transitionEasing,interpolator:a.transitionInterpolator,interruption:a.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var d=this.time(),a=this.state,e=a.startTime,f=a.duration,g=a.easing,h=a.interpolator,i=a.startProps,j=a.endProps,c=!1,b=(d-e)/f;b>=1&&(b=1,c=!0),b=g(b);var k=h.interpolateProps(i,j,b),l=new bF(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}},]),a}();g(F,"defaultProps",V);var W=b(840),k=b.n(W);const cc={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&&!function(b,c){for(let a=0;ab.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(k().PointerEventInput),k().MouseInput.prototype.handler=function(a){let b=cc[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const cd=k().Manager;var e=k();const ce=e?[[e.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[e.Rotate,{enable:!1},],[e.Pinch,{enable:!1},],[e.Swipe,{enable:!1},],[e.Pan,{threshold:0,enable:!1},],[e.Press,{enable:!1},],[e.Tap,{event:"doubletap",taps:2,enable:!1},],[e.Tap,{event:"anytap",enable:!1},],[e.Tap,{enable:!1},],]:null,cf={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},cg={doubletap:["tap"]},ch={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},s={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},ci={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},cj={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},X="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",G="undefined"!=typeof window?window:b.g;void 0!==b.g?b.g:window;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(ck){}const cl=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:cm}=s,cn="wheel";class co{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=cm.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent,!!Y&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cn&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(cl&&b.deltaMode===G.WheelEvent.DOM_DELTA_PIXEL&&(a/=G.devicePixelRatio),b.deltaMode===G.WheelEvent.DOM_DELTA_LINE&&(a*=40));const c={x:b.clientX,y:b.clientY};0!==a&&a%4.000244140625==0&&(a=Math.floor(a/4.000244140625)),b.shiftKey&&a&&(a*=.25),this._onWheel(b,-a,c)}_onWheel(a,b,c){this.callback({type:cn,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:cp}=s,cq="pointermove",cr="pointerover",cs="pointerout",ct="pointerleave";class cu{constructor(b,c,a={}){this.element=b,this.callback=c,this.pressed=!1,this.options=Object.assign({enable:!0},a),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=cp.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cq&&(this.enableMoveEvent=b),a===cr&&(this.enableOverEvent=b),a===cs&&(this.enableOutEvent=b),a===ct&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:cr,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:cs,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:ct,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:cq,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:cv}=s,cw="keydown",cx="keyup";class cy{constructor(a,c,b={}){this.element=a,this.callback=c,this.options=Object.assign({enable:!0},b),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=cv.concat(b.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=b.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===cw&&(this.enableDownEvent=b),a===cx&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:cw,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:cx,srcEvent:a,key:a.key,target:a.target}))}}const cz="contextmenu";class cA{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===cz&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:cz,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const cB={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},cC={srcElement:"root",priority:0};class cD{constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(f,g,a,h=!1,i=!1){const{handlers:j,handlersByElement:e}=this;a&&("object"!=typeof a||a.addEventListener)&&(a={srcElement:a}),a=a?Object.assign({},cC,a):cC;let b=e.get(a.srcElement);b||(b=[],e.set(a.srcElement,b));const c={type:f,handler:g,srcElement:a.srcElement,priority:a.priority};h&&(c.once=!0),i&&(c.passive=!0),j.push(c),this._active=this._active||!c.passive;let d=b.length-1;for(;d>=0&&!(b[d].priority>=c.priority);)d--;b.splice(d+1,0,c)}remove(f,g){const{handlers:b,handlersByElement:e}=this;for(let c=b.length-1;c>=0;c--){const a=b[c];if(a.type===f&&a.handler===g){b.splice(c,1);const d=e.get(a.srcElement);d.splice(d.indexOf(a),1),0===d.length&&e.delete(a.srcElement)}}this._active=b.some(a=>!a.passive)}handleEvent(c){if(this.isEmpty())return;const b=this._normalizeEvent(c);let a=c.srcEvent.target;for(;a&&a!==b.rootElement;){if(this._emit(b,a),b.handled)return;a=a.parentNode}this._emit(b,"root")}_emit(e,f){const a=this.handlersByElement.get(f);if(a){let g=!1;const h=()=>{e.handled=!0},i=()=>{e.handled=!0,g=!0},c=[];for(let b=0;b{const b=this.manager.get(a);b&&cf[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[h,c]of(this.wheelInput=new co(a,this._onOtherEvent,{enable:!1}),this.moveInput=new cu(a,this._onOtherEvent,{enable:!1}),this.keyInput=new cy(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new cA(a,this._onOtherEvent,{enable:!1}),this.events))c.isEmpty()||(this._toggleRecognizer(c.recognizerName,!0),this.manager.on(h,c.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:d}=this;if(!d)return;const c=d.get(a);if(c&&c.options.enable!==b){c.set({enable:b});const e=cg[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=d.get(e);b?(f.requireFailure(a),c.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(b,e,d,f,g){if("string"!=typeof b){for(const h in d=e,b)this._addEventHandler(h,b[h],d,f,g);return}const{manager:i,events:j}=this,c=cj[b]||b;let a=j.get(c);!a&&(a=new cD(this),j.set(c,a),a.recognizerName=ci[c]||c,i&&i.on(c,a.handleEvent)),a.add(b,e,d,f,g),a.isEmpty()||this._toggleRecognizer(a.recognizerName,!0)}_removeEventHandler(a,h){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,i=cj[a]||a,b=d.get(i);if(b&&(b.remove(a,h),b.isEmpty())){const{recognizerName:e}=b;let f=!1;for(const g of d.values())if(g.recognizerName===e&&!g.isEmpty()){f=!0;break}f||this._toggleRecognizer(e,!1)}}_onBasicInput(a){const{srcEvent:c}=a,b=ch[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function cF(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function cG(c){for(var a=1;a0),e=d&&!this.state.isHovering,h=!d&&this.state.isHovering;(c||e)&&(a.features=b,c&&c(a)),e&&cP.call(this,"onMouseEnter",a),h&&cP.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function cT(b){var c=this.props,d=c.onClick,f=c.onNativeClick,g=c.onDblClick,h=c.doubleClickZoom,a=[],e=g||h;switch(b.type){case"anyclick":a.push(f),e||a.push(d);break;case"click":e&&a.push(d)}(a=a.filter(Boolean)).length&&((b=cN.call(this,b)).features=cO.call(this,b.point),a.forEach(function(a){return a(b)}))}var m=(0,c.forwardRef)(function(b,h){var i,t,f=(0,c.useContext)(bK),u=(0,c.useMemo)(function(){return b.controller||new Z},[]),v=(0,c.useMemo)(function(){return new cE(null,{touchAction:b.touchAction,recognizerOptions:b.eventRecognizerOptions})},[]),g=(0,c.useRef)(null),e=(0,c.useRef)(null),a=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;a.props=b,a.map=e.current&&e.current.getMap(),a.setState=function(c){a.state=cM(cM({},a.state),c),g.current.style.cursor=b.getCursor(a.state)};var j=!0,k=function(b,c,d){if(j){i=[b,c,d,];return}var e=a.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(b,"position",{get:function(){return[0,0,bM(a.map,b),]}}),f&&f({viewState:b,interactionState:c,oldViewState:d}),g&&g(b,c,d)};(0,c.useImperativeHandle)(h,function(){var a;return{getMap:(a=e).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var d=(0,c.useMemo)(function(){return cM(cM({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||bQ(a),a.viewport=d.viewport;var w=function(b){var c=b.isDragging,d=void 0!==c&&c;if(d!==a.state.isDragging&&a.setState({isDragging:d}),j){t=b;return}var e=a.props.onInteractionStateChange;e&&e(b)},l=function(){a.width&&a.height&&u.setOptions(cM(cM(cM({},a.props),a.props.viewState),{},{isInteractive:Boolean(a.props.onViewStateChange||a.props.onViewportChange),onViewportChange:k,onStateChange:w,eventManager:v,width:a.width,height:a.height}))},m=function(b){var c=b.width,d=b.height;a.width=c,a.height=d,l(),a.props.onResize({width:c,height:d})};(0,c.useEffect)(function(){return v.setElement(g.current),v.on({pointerdown:cQ.bind(a),pointermove:cS.bind(a),pointerup:cR.bind(a),pointerleave:cP.bind(a,"onMouseOut"),click:cT.bind(a),anyclick:cT.bind(a),dblclick:cP.bind(a,"onDblClick"),wheel:cP.bind(a,"onWheel"),contextmenu:cP.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),bL(function(){if(i){var a;k.apply(void 0,function(a){if(Array.isArray(a))return ax(a)}(a=i)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||ay(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}t&&w(t)}),l();var n=b.width,o=b.height,p=b.style,r=b.getCursor,s=(0,c.useMemo)(function(){return cM(cM({position:"relative"},p),{},{width:n,height:o,cursor:r(a.state)})},[p,n,o,r,a.state]);return i&&a._child||(a._child=c.createElement(bJ,{value:d},c.createElement("div",{key:"event-canvas",ref:g,style:s},c.createElement(q,aw({},b,{width:"100%",height:"100%",style:null,onResize:m,ref:e}))))),j=!1,a._child});m.supported=q.supported,m.propTypes=$,m.defaultProps=_;var cU=m;function cV(b,a){if(b===a)return!0;if(!b||!a)return!1;if(Array.isArray(b)){if(!Array.isArray(a)||b.length!==a.length)return!1;for(var c=0;c prop: ".concat(e))}}(d,a,f.current):d=function(a,c,d){if(a.style&&a.style._loaded){var b=function(c){for(var a=1;a=0||(d[a]=c[a]);return d}(a,d);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(a,b)&&(e[b]=a[b])}return e}(d,["layout","paint","filter","minzoom","maxzoom","beforeId",]);if(p!==a.beforeId&&b.moveLayer(c,p),e!==a.layout){var q=a.layout||{};for(var g in e)cV(e[g],q[g])||b.setLayoutProperty(c,g,e[g]);for(var r in q)e.hasOwnProperty(r)||b.setLayoutProperty(c,r,void 0)}if(f!==a.paint){var s=a.paint||{};for(var h in f)cV(f[h],s[h])||b.setPaintProperty(c,h,f[h]);for(var t in s)f.hasOwnProperty(t)||b.setPaintProperty(c,t,void 0)}for(var i in cV(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)cV(j[i],a[i])||b.setLayerProperty(c,i,j[i])}(c,d,a,b)}catch(e){console.warn(e)}}(a,d,b,e.current):function(a,d,b){if(a.style&&a.style._loaded){var c=cZ(cZ({},b),{},{id:d});delete c.beforeId,a.addLayer(c,b.beforeId)}}(a,d,b),e.current=b,null}).propTypes=ab;var f={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},d={captureScroll:a.bool,captureDrag:a.bool,captureClick:a.bool,captureDoubleClick:a.bool,capturePointerMove:a.bool};function c_(){var d=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},a=(0,c.useContext)(bK),e=(0,c.useRef)(null),f=(0,c.useRef)({props:d,state:{},context:a,containerRef:e}),b=f.current;return b.props=d,b.context=a,(0,c.useEffect)(function(){return function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(c){var b=a.props;b.captureScroll&&c.stopPropagation(),b.onScroll&&b.onScroll(c,a)},panstart:function(c){var b=a.props;b.captureDrag&&c.stopPropagation(),b.onDragStart&&b.onDragStart(c,a)},anyclick:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onNativeClick&&b.onNativeClick(c,a)},click:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onClick&&b.onClick(c,a)},dblclick:function(c){var b=a.props;b.captureDoubleClick&&c.stopPropagation(),b.onDoubleClick&&b.onDoubleClick(c,a)},pointermove:function(c){var b=a.props;b.capturePointerMove&&c.stopPropagation(),b.onPointerMove&&b.onPointerMove(c,a)}};return c.watch(d,b),function(){c.off(d)}}}(b)},[a.eventManager]),b}function c0(b){var a=b.instance,c=c_(b),d=c.context,e=c.containerRef;return a._context=d,a._containerRef=e,a._render()}var H=function(b){bW(a,b);var d,e,f=(d=a,e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bZ(d);if(e){var c=bZ(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return bY(this,a)});function a(){var b;bl(this,a);for(var e=arguments.length,h=Array(e),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var c="x"===d?a.offsetWidth:a.offsetHeight;return c7(b/100*c)/c*100};function c9(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}var ae=Object.assign({},ac,{className:a.string,longitude:a.number.isRequired,latitude:a.number.isRequired,style:a.object}),af=Object.assign({},ad,{className:""});function t(b){var d,j,e,k,f,l,m,a,h=(d=b,e=(j=aA((0,c.useState)(null),2))[0],k=j[1],f=aA((0,c.useState)(null),2),l=f[0],m=f[1],a=c_(c2(c2({},d),{},{onDragStart:c5})),a.callbacks=d,a.state.dragPos=e,a.state.setDragPos=k,a.state.dragOffset=l,a.state.setDragOffset=m,(0,c.useEffect)(function(){return function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return function(b,a){var h=a.props,c=a.callbacks,d=a.state,i=a.context;b.stopPropagation();var e=c3(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=c4(e,f,h,i),c.onDrag(g)}}(b,a)},panend:function(b){return function(c,a){var h=a.props,d=a.callbacks,b=a.state,i=a.context;c.stopPropagation();var e=b.dragPos,f=b.dragOffset;if(b.setDragPos(null),b.setDragOffset(null),d.onDragEnd&&e&&f){var g=Object.assign({},c);g.lngLat=c4(e,f,h,i),d.onDragEnd(g)}}(b,a)},pancancel:function(d){var c,b;return c=d,b=a.state,void(c.stopPropagation(),b.setDragPos(null),b.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}}(a)},[a.context.eventManager,Boolean(e)]),a),o=h.state,p=h.containerRef,q=b.children,r=b.className,s=b.draggable,A=b.style,t=o.dragPos,u=function(b){var a=b.props,e=b.state,f=b.context,g=a.longitude,h=a.latitude,j=a.offsetLeft,k=a.offsetTop,c=e.dragPos,d=e.dragOffset,l=f.viewport,m=f.map;if(c&&d)return[c[0]+d[0],c[1]+d[1],];var n=bM(m,{longitude:g,latitude:h}),o=l.project([g,h,n,]),i=aA(o,2),p=i[0],q=i[1];return[p+=j,q+=k]}(h),n=aA(u,2),v=n[0],w=n[1],x="translate(".concat(c7(v),"px, ").concat(c7(w),"px)"),y=s?t?"grabbing":"grab":"auto",z=(0,c.useMemo)(function(){var a=function(c){for(var a=1;a0){var t=b,u=e;for(b=0;b<=1;b+=.5)k=(i=n-b*h)+h,e=Math.max(0,d-i)+Math.max(0,k-p+d),e0){var w=a,x=f;for(a=0;a<=1;a+=v)l=(j=m-a*g)+g,f=Math.max(0,d-j)+Math.max(0,l-o+d),f1||h< -1||f<0||f>p.width||g<0||g>p.height?i.display="none":i.zIndex=Math.floor((1-h)/2*1e5)),i),S=(0,c.useCallback)(function(b){t.props.onClose();var a=t.context.eventManager;a&&a.once("click",function(a){return a.stopPropagation()},b.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(L," ").concat(N),style:R,ref:u},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:O}}),c.createElement("div",{key:"content",ref:j,className:"mapboxgl-popup-content"},P&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:S},"\xd7"),Q))}function db(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}u.propTypes=ag,u.defaultProps=ah,c.memo(u);var ai=Object.assign({},d,{toggleLabel:a.string,className:a.string,style:a.object,compact:a.bool,customAttribution:a.oneOfType([a.string,a.arrayOf(a.string),])}),aj=Object.assign({},f,{className:"",toggleLabel:"Toggle Attribution"});function v(a){var b=c_(a),d=b.context,i=b.containerRef,j=(0,c.useRef)(null),e=aA((0,c.useState)(!1),2),f=e[0],m=e[1];(0,c.useEffect)(function(){var h,e,c,f,g,b;return d.map&&(h=(e={customAttribution:a.customAttribution},c=d.map,f=i.current,g=j.current,(b=new(A()).AttributionControl(e))._map=c,b._container=f,b._innerContainer=g,b._updateAttributions(),b._updateEditLink(),c.on("styledata",b._updateData),c.on("sourcedata",b._updateData),b)),function(){var a;return h&&void((a=h)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[d.map]);var h=void 0===a.compact?d.viewport.width<=640:a.compact;(0,c.useEffect)(function(){!h&&f&&m(!1)},[h]);var k=(0,c.useCallback)(function(){return m(function(a){return!a})},[]),l=(0,c.useMemo)(function(){return function(c){for(var a=1;ac)return 1}return 0}(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),f=b.viewport.bearing,d={transform:"rotate(".concat(-f,"deg)")},2===e?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:d}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:d})))))}function dj(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}y.propTypes=ao,y.defaultProps=ap,c.memo(y);var aq=Object.assign({},d,{className:a.string,style:a.object,maxWidth:a.number,unit:a.oneOf(["imperial","metric","nautical"])}),ar=Object.assign({},f,{className:"",maxWidth:100,unit:"metric"});function z(a){var d=c_(a),f=d.context,h=d.containerRef,e=aA((0,c.useState)(null),2),b=e[0],j=e[1];(0,c.useEffect)(function(){if(f.map){var a=new(A()).ScaleControl;a._map=f.map,a._container=h.current,j(a)}},[f.map]),b&&(b.options=a,b._onMove());var i=(0,c.useMemo)(function(){return function(c){for(var a=1;a0)return function(b){if((b=String(b)).length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);if(!c)return NaN;const a=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return 864e5*a;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*a;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*a;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:throw new Error(`The unit ${d} was matched, but no matching case exists.`)}}(c);if("number"==typeof c&&isFinite(c))return f?.long?b(c):a(c);throw new Error("Value is not a string or number.")}catch(e){const g=d(e)?`${e.message}. value=${JSON.stringify(c)}`:"An unknown error has occured.";throw new Error(g)}};function a(a){const b=Math.abs(a);return b>=864e5?`${Math.round(a/864e5)}d`:b>=36e5?`${Math.round(a/36e5)}h`:b>=6e4?`${Math.round(a/6e4)}m`:b>=1e3?`${Math.round(a/1e3)}s`:`${a}ms`}function b(b){const a=Math.abs(b);return a>=864e5?c(b,a,864e5,"day"):a>=36e5?c(b,a,36e5,"hour"):a>=6e4?c(b,a,6e4,"minute"):a>=1e3?c(b,a,1e3,"second"):`${b} ms`}function c(b,c,a,d){return`${Math.round(b/a)} ${d}${c>=1.5*a?"s":""}`}function d(a){return"object"==typeof a&&null!==a&&"message"in a} +export default function(c,f){try{if("string"==typeof c&&c.length>0)return function(b){if((b=String(b)).length>100)throw Error("Value exceeds the maximum length of 100 characters.");const c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);if(!c)return NaN;const a=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return 864e5*a;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*a;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*a;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:throw Error(`The unit ${d} was matched, but no matching case exists.`)}}(c);if("number"==typeof c&&isFinite(c))return f?.long?b(c):a(c);throw Error("Value is not a string or number.")}catch(e){const g=d(e)?`${e.message}. value=${JSON.stringify(c)}`:"An unknown error has occured.";throw Error(g)}};function a(a){const b=Math.abs(a);return b>=864e5?`${Math.round(a/864e5)}d`:b>=36e5?`${Math.round(a/36e5)}h`:b>=6e4?`${Math.round(a/6e4)}m`:b>=1e3?`${Math.round(a/1e3)}s`:`${a}ms`}function b(b){const a=Math.abs(b);return a>=864e5?c(b,a,864e5,"day"):a>=36e5?c(b,a,36e5,"hour"):a>=6e4?c(b,a,6e4,"minute"):a>=1e3?c(b,a,1e3,"second"):`${b} ms`}function c(b,c,a,d){return`${Math.round(b/a)} ${d}${c>=1.5*a?"s":""}`}function d(a){return"object"==typeof a&&null!==a&&"message"in a} diff --git a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js index 869e37b1ae2..01eae28da8a 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js +++ b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js @@ -7,7 +7,7 @@ var arg, index = +match.slice(1, -1); return index + 2 < templateArgs.length ? "function" == typeof (arg = templateArgs[index + 2]) ? arg.toString().replace(/ ?\{[\s\S]*$/, "") : void 0 === arg ? "undefined" : "string" != typeof arg ? toJson(arg) : arg : match; })) + "\nhttp://errors.angularjs.org/1.2.5/" + (module ? module + "/" : "") + code; i < arguments.length; i++)message = message + (2 == i ? "?" : "&") + "p" + (i - 2) + "=" + encodeURIComponent((obj = arguments[i], "function" == typeof obj ? obj.toString().replace(/ \{[\s\S]*$/, "") : void 0 === obj ? "undefined" : "string" != typeof obj ? JSON.stringify(obj) : obj)); - return new Error(message); + return Error(message); }; } var promiseWarning, msie, jqLite, jQuery, angularModule, nodeName_, lowercase = function(string) { @@ -145,7 +145,7 @@ }), source)destination[key1] = copy(source[key1]); setHashKey(destination, h); } - } else destination = source, source && (isArray(source) ? destination = copy(source, []) : isDate(source) ? destination = new Date(source.getTime()) : isRegExp(source) ? destination = new RegExp(source.source) : isObject(source) && (destination = copy(source, {}))); + } else destination = source, source && (isArray(source) ? destination = copy(source, []) : isDate(source) ? destination = new Date(source.getTime()) : isRegExp(source) ? destination = RegExp(source.source) : isObject(source) && (destination = copy(source, {}))); return destination; } function equals(o1, o2) { @@ -2511,8 +2511,8 @@ var code = "var l, fn, p;\n"; forEach(pathKeys, function(key, index) { ensureSafeMemberName(key, fullExp), code += "if(s === null || s === undefined) return s;\nl=s;\ns=" + (index ? "s" : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"];\n' + (options.unwrapPromises ? 'if (s && s.then) {\n pw("' + fullExp.replace(/(["\r\n])/g, "\\$1") + '");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n' : ""); - }), code += "return s;"; - var evaledFnGetter = new Function("s", "k", "pw", code); + }); + var evaledFnGetter = Function("s", "k", "pw", code += "return s;"); evaledFnGetter.toString = function() { return code; }, fn = function(scope, locals) { @@ -2957,9 +2957,9 @@ if (isString(matcher)) { var s; if (matcher.indexOf("***") > -1) throw $sceMinErr("iwcard", "Illegal sequence *** in string matcher. String: {0}", matcher); - return matcher = matcher.replace(/([-()\[\]{}+?*.$\^|,:# 1 ? core_slice.call(arguments) : value, values === progressValues ? deferred.notifyWith(contexts, values) : --remaining || deferred.resolveWith(contexts, values); }; }; - if (length > 1) for(progressValues = new Array(length), progressContexts = new Array(length), resolveContexts = new Array(length); i1 < length; i1++)resolveValues[i1] && jQuery.isFunction(resolveValues[i1].promise) ? resolveValues[i1].promise().done(updateFunc(i1, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i1, progressContexts, progressValues)) : --remaining; + if (length > 1) for(progressValues = Array(length), progressContexts = Array(length), resolveContexts = Array(length); i1 < length; i1++)resolveValues[i1] && jQuery.isFunction(resolveValues[i1].promise) ? resolveValues[i1].promise().done(updateFunc(i1, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i1, progressContexts, progressValues)) : --remaining; return remaining || deferred.resolveWith(resolveContexts, resolveValues), deferred.promise(); } }), jQuery.support = function() { @@ -855,7 +855,7 @@ for(type in events)jQuery.event.remove(elem, type + types[t], handler, selector, !0); continue; } - for(special = jQuery.event.special[type] || {}, handlers = events[type = (selector ? special.delegateType : special.bindType) || type] || [], tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"), origCount = j = handlers.length; j--;)handleObj = handlers[j], (mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || "**" === selector && handleObj.selector) && (handlers.splice(j, 1), handleObj.selector && handlers.delegateCount--, special.remove && special.remove.call(elem, handleObj)); + for(special = jQuery.event.special[type] || {}, handlers = events[type = (selector ? special.delegateType : special.bindType) || type] || [], tmp = tmp[2] && RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"), origCount = j = handlers.length; j--;)handleObj = handlers[j], (mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || "**" === selector && handleObj.selector) && (handlers.splice(j, 1), handleObj.selector && handlers.delegateCount--, special.remove && special.remove.call(elem, handleObj)); origCount && !handlers.length && (special.teardown && !1 !== special.teardown.call(elem, namespaces, elemData.handle) || jQuery.removeEvent(elem, type, elemData.handle), delete events[type]); } jQuery.isEmptyObject(events) && (delete elemData.handle, jQuery._removeData(elem, "events")); @@ -865,7 +865,7 @@ var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document1 ], type = core_hasOwn.call(event, "type") ? event.type : event, namespaces = core_hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; - if (cur = tmp = elem = elem || document1, !(3 === elem.nodeType || 8 === elem.nodeType || rfocusMorph.test(type + jQuery.event.triggered)) && (type.indexOf(".") >= 0 && (type = (namespaces = type.split(".")).shift(), namespaces.sort()), ontype = 0 > type.indexOf(":") && "on" + type, (event = event[jQuery.expando] ? event : new jQuery.Event(type, "object" == typeof event && event)).isTrigger = !0, event.namespace = namespaces.join("."), event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, event.result = undefined, event.target || (event.target = elem), data = null == data ? [ + if (cur = tmp = elem = elem || document1, !(3 === elem.nodeType || 8 === elem.nodeType || rfocusMorph.test(type + jQuery.event.triggered)) && (type.indexOf(".") >= 0 && (type = (namespaces = type.split(".")).shift(), namespaces.sort()), ontype = 0 > type.indexOf(":") && "on" + type, (event = event[jQuery.expando] ? event : new jQuery.Event(type, "object" == typeof event && event)).isTrigger = !0, event.namespace = namespaces.join("."), event.namespace_re = event.namespace ? RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, event.result = undefined, event.target || (event.target = elem), data = null == data ? [ event ] : jQuery.makeArray(data, [ event @@ -1111,15 +1111,15 @@ var i2, cachedruns, Expr, getText, isXML, compile, hasDuplicate, outermostContext, setDocument, document, docElem, documentIsXML, rbuggyQSA, rbuggyMatches, matches1, contains, sortOrder, expando = "sizzle" + -new Date(), preferredDoc = window.document, support = {}, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), strundefined = "undefined", arr = [], pop = arr.pop, push = arr.push, slice = arr.slice, indexOf = arr.indexOf || function(elem) { for(var i = 0, len = this.length; i < len; i++)if (this[i] === elem) return i; return -1; - }, whitespace = "[\\x20\\t\\r\\n\\f]", characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", identifier = characterEncoding.replace("w", "w#"), attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace(3, 8) + ")*)|.*)\\)|)", rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { - ID: new RegExp("^#(" + characterEncoding + ")"), - CLASS: new RegExp("^\\.(" + characterEncoding + ")"), - NAME: new RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"), - TAG: new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), - ATTR: new RegExp("^" + attributes), - PSEUDO: new RegExp("^" + pseudos), - CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), - needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") + }, whitespace = "[\\x20\\t\\r\\n\\f]", characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", identifier = characterEncoding.replace("w", "w#"), attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace(3, 8) + ")*)|.*)\\)|)", rtrim = RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"), rpseudo = RegExp(pseudos), ridentifier = RegExp("^" + identifier + "$"), matchExpr = { + ID: RegExp("^#(" + characterEncoding + ")"), + CLASS: RegExp("^\\.(" + characterEncoding + ")"), + NAME: RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"), + TAG: RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), + ATTR: RegExp("^" + attributes), + PSEUDO: RegExp("^" + pseudos), + CHILD: RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), + needsContext: RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") }, rsibling = /[\x20\t\r\n\f]*[+~]/, rnative = /^[^{]+\{\s*\[native code/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, funescape = function(_, escaped) { var high = "0x" + escaped - 0x10000; return high != high ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xd800, 0x3ff & high | 0xdc00); @@ -1280,7 +1280,7 @@ div.innerHTML = "", div.querySelectorAll("[i^='']").length && rbuggyQSA.push("[*^$]=" + whitespace + "*(?:\"\"|'')"), div.querySelectorAll(":enabled").length || rbuggyQSA.push(":enabled", ":disabled"), div.querySelectorAll("*,:x"), rbuggyQSA.push(",.*:"); })), (support.matchesSelector = isNative(matches1 = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) && assert(function(div) { support.disconnectedMatch = matches1.call(div, "div"), matches1.call(div, "[s!='']:x"), rbuggyMatches.push("!=", pseudos); - }), rbuggyQSA = new RegExp(rbuggyQSA.join("|")), rbuggyMatches = new RegExp(rbuggyMatches.join("|")), contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function(a, b) { + }), rbuggyQSA = RegExp(rbuggyQSA.join("|")), rbuggyMatches = RegExp(rbuggyMatches.join("|")), contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function(a, b) { var adown = 9 === a.nodeType ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!(bup && 1 === bup.nodeType && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(bup))); } : function(a, b) { @@ -1324,7 +1324,7 @@ var val; return ((elem.ownerDocument || elem) !== document && setDocument(elem), documentIsXML || (name = name.toLowerCase()), val = Expr.attrHandle[name]) ? val(elem) : documentIsXML || support.attributes ? elem.getAttribute(name) : ((val = elem.getAttributeNode(name)) || elem.getAttribute(name)) && !0 === elem[name] ? name : val && val.specified ? val.value : null; }, Sizzle.error = function(msg) { - throw new Error("Syntax error, unrecognized expression: " + msg); + throw Error("Syntax error, unrecognized expression: " + msg); }, Sizzle.uniqueSort = function(results) { var elem, duplicates = [], i = 1, j = 0; if (hasDuplicate = !support.detectDuplicates, results.sort(sortOrder), hasDuplicate) { @@ -1384,7 +1384,7 @@ }, CLASS: function(className) { var pattern = classCache[className + " "]; - return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)"), classCache(className, function(elem) { + return pattern || (pattern = RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)"), classCache(className, function(elem) { return pattern.test(elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || ""); })); }, @@ -1828,7 +1828,7 @@ return r; } }); - var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /\s*$/g, wrapMap = { + var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /\s*$/g, wrapMap = { option: [ 1, "